diff options
Diffstat (limited to 'tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix')
-rw-r--r-- | tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix | 34 |
1 files changed, 34 insertions, 0 deletions
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..dc6ce2781593 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-div.nix @@ -0,0 +1,34 @@ +[ + (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) + (builtins.div (builtins.div 84 4) 0.5) + + # builtins.div should truncate towards 0 + (builtins.div 3 2) + (builtins.div (-3) (-2)) + (builtins.div (-3) 2) + (builtins.div 3 (-2)) + (-(builtins.div 3 2)) + + (builtins.div 4 3) + (builtins.div (-4) (-3)) + (builtins.div (-4) 3) + (builtins.div 4 (-3)) + (-(builtins.div 4 3)) + + (builtins.div 5 3) + (builtins.div (-5) (-3)) + (builtins.div (-5) 3) + (builtins.div 5 (-3)) + (-(builtins.div 5 3)) + + (builtins.div 2147812578 (-28748)) + (builtins.div (-2147812578) 28748) + (-(builtins.div 2147812578 28748)) +] |