about summary refs log tree commit diff
path: root/tvix/eval/src/tests
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-09-21T20·20+0200
committersterni <sternenseemann@systemli.org>2022-09-22T23·12+0000
commit64d3efcc2ce055ffe45034ed169569ece961f04d (patch)
tree1e3f199b768182684f8dc85d1513d0d4ff671a98 /tvix/eval/src/tests
parent55459f02fcdca8612673f2df8ba54cb995ae06b6 (diff)
fix(tvix/eval): handle thunks in arithmetic builtins r/4960
The simplest solution seems to be to pass references to arithmetic_op!()
which avoids the moving annoyance we had to deal with in the
builtins (no more popping!). We then use .force() to force the values
and dereference any Thunks (which arithmetic_op! doesn't do for us).

Change-Id: I0eb8ad60e80a0b3ba9d9f411e973ef8bcf136989
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6724
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src/tests')
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-builtins-add.exp2
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-builtins-add.nix1
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.exp2
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix1
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.exp2
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.nix1
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-builtins-sub.exp2
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-builtins-sub.nix1
8 files changed, 8 insertions, 4 deletions
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-add.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-add.exp
index 25c0a9cc0fba..c3ac813de6b9 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-add.exp
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-add.exp
@@ -1 +1 @@
-[ 18 18.9 18.9 19.1 19 ]
+[ 18 18.9 18.9 19.1 19 42 ]
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-add.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-add.nix
index 6b2a29d7982c..b04b1d1fa6ba 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-add.nix
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-add.nix
@@ -4,4 +4,5 @@
   (builtins.add 7 11.9)
   (builtins.add 7.2 11.9)
   (builtins.add 7.1 11.9)
+  (builtins.add (builtins.add 21 10) 11)
 ]
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
index d71bbb7a060b..73e9bc33b083 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.exp
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.exp
@@ -1 +1 @@
-[ 3 7 0 1 0 0.5 0.5 0.5 ]
+[ 3 7 0 1 0 0.5 0.5 0.5 42 ]
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
index 622ce889daa9..98b8b74bdf2b 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix
@@ -7,4 +7,5 @@
   (builtins.div 1.0 2)
   (builtins.div 1 2.0)
   (builtins.div 1.0 2.0)
+  (builtins.div (builtins.div 84 4) 0.5)
 ]
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
index 5ed8b8e2bd83..e3e0f03a8af5 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.exp
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.exp
@@ -1 +1 @@
-[ 36 0 0 14 ]
+[ 36 0 0 14 42 ]
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
index 5b61e387a622..2a8d6c4214c3 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.nix
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mul.nix
@@ -3,4 +3,5 @@
   (builtins.mul 0 7)
   (builtins.mul 7 0)
   (builtins.mul 7 2)
+  (builtins.mul (builtins.mul 4 0.5) 21)
 ]
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-sub.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-sub.exp
index c47a17fa2709..51842eccfac5 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-sub.exp
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-sub.exp
@@ -1 +1 @@
-[ -4 -3.1 -4.9 -4.7 -4 ]
+[ -4 -3.1 -4.9 -4.7 -4 42 ]
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-sub.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-sub.nix
index 68b1913a0097..2929c4dddd81 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-sub.nix
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-sub.nix
@@ -4,4 +4,5 @@
   (builtins.sub 7 11.9)
   (builtins.sub 7.2 11.9)
   (builtins.sub 7.9 11.9)
+  (builtins.sub (builtins.sub 123 23) 58)
 ]