From 890bbf9b1fba98ac9791eaacaf594492e7ead662 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Tue, 6 Sep 2022 14:55:13 -0700 Subject: feat(tvix/eval): Support builtins.lessThan Extend and export the `cmp_op`, and this becomes trivial. Change-Id: I9c93fa4db0f5a1fc8b56928ea144676f79247de1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6557 Autosubmit: wpcarro Tested-by: BuildkiteCI Reviewed-by: sterni --- .../src/tests/tvix_tests/eval-okay-builtins-lessThan.exp | 1 + .../src/tests/tvix_tests/eval-okay-builtins-lessThan.nix | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-lessThan.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-lessThan.nix (limited to 'tvix/eval/src/tests/tvix_tests') diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-lessThan.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-lessThan.exp new file mode 100644 index 000000000000..31f4598bb504 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-lessThan.exp @@ -0,0 +1 @@ +[ true true true true false false false false true true true true false ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-lessThan.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-lessThan.nix new file mode 100644 index 000000000000..cd2d0c209c3a --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-lessThan.nix @@ -0,0 +1,15 @@ +[ + (builtins.lessThan 2 3) + (builtins.lessThan 2.0 3) + (builtins.lessThan 2 3.0) + (builtins.lessThan 2.0 3.0) + (builtins.lessThan 3 2) + (builtins.lessThan 3.0 2) + (builtins.lessThan 3 2.0) + (builtins.lessThan 3.0 2.0) + (builtins.lessThan 10 (builtins.add 9 2)) + (builtins.lessThan (builtins.add 9 1) 11) + (builtins.lessThan (builtins.add 9 1) (builtins.add 9 2)) + (builtins.lessThan "a" "b") + (builtins.lessThan "b" "a") +] -- cgit 1.4.1