From 15e2bc54f1beab0f99a7d7199af92a3139052302 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Mon, 29 Aug 2022 17:31:47 -0700 Subject: feat(tvix/eval): Support builtins.{mul,div} Multiplication and division :) Change-Id: I79e76f3b55b7e9b8d1eb09b3d9741140b4d75742 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6406 Tested-by: BuildkiteCI Reviewed-by: sterni --- tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.exp | 1 + tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix | 10 ++++++++++ tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.exp | 1 + tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.nix | 6 ++++++ 4 files changed, 18 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.nix (limited to 'tvix/eval/src/tests') diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.exp new file mode 100644 index 000000000000..d71bbb7a060b --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.exp @@ -0,0 +1 @@ +[ 3 7 0 1 0 0.5 0.5 0.5 ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix new file mode 100644 index 000000000000..622ce889daa9 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix @@ -0,0 +1,10 @@ +[ + (builtins.div 9 3) + (builtins.div 7 1) + (builtins.div 3 9) + (builtins.div 4 4) + (builtins.div 1 2) + (builtins.div 1.0 2) + (builtins.div 1 2.0) + (builtins.div 1.0 2.0) +] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.exp new file mode 100644 index 000000000000..5ed8b8e2bd83 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.exp @@ -0,0 +1 @@ +[ 36 0 0 14 ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.nix new file mode 100644 index 000000000000..5b61e387a622 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.nix @@ -0,0 +1,6 @@ +[ + (builtins.mul 4 9) + (builtins.mul 0 7) + (builtins.mul 7 0) + (builtins.mul 7 2) +] -- cgit 1.4.1