diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-09-07 19:28:27 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-09-07 19:28:27 +0200 |
commit | 42e8fcddf0ec78d81d6733c8a14592df9dcb2381 (patch) | |
tree | 62e8e68e408de7a2df99033ae496117b4481a79d /tests/01_arithmetic/01_division | |
parent | d7a4f8d3b7d0ebab6a1b6bef8f342e100ea32f1d (diff) |
tests: add object/array literal and arithmetic test cases
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/01_arithmetic/01_division')
-rw-r--r-- | tests/01_arithmetic/01_division | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/01_arithmetic/01_division b/tests/01_arithmetic/01_division new file mode 100644 index 0000000..d4a2adb --- /dev/null +++ b/tests/01_arithmetic/01_division @@ -0,0 +1,53 @@ +While arithmetic divisions generally follow the value conversion rules +outlined in the "00_value_conversion" test case, a number of additional +constraints apply. + +-- Expect stdout -- +Division by zero yields Infinity: +1 / 0 = Infinity + +Division by Infinity yields zero: +1 / Infinity = 0 + +Dividing Infinity yields Infinity: +Infinity / 1 = Infinity + +Dividing Infinity by Infinity yields NaN: +Infinity / Infinity = NaN + +If either operand is NaN, the result is NaN: +1 / NaN = NaN +NaN / 1 = NaN + +If both operands are integers, integer division is performed: +10 / 3 = 3 + +If either operand is a double, double division is performed: +10.0 / 3 = 3.33333 +10 / 3.0 = 3.33333 +-- End -- + +-- Testcase -- +Division by zero yields Infinity: +1 / 0 = {{ 1 / 0 }} + +Division by Infinity yields zero: +1 / Infinity = {{ 1 / Infinity }} + +Dividing Infinity yields Infinity: +Infinity / 1 = {{ Infinity / 1 }} + +Dividing Infinity by Infinity yields NaN: +Infinity / Infinity = {{ Infinity / Infinity }} + +If either operand is NaN, the result is NaN: +1 / NaN = {{ 1 / NaN }} +NaN / 1 = {{ NaN / 1 }} + +If both operands are integers, integer division is performed: +10 / 3 = {{ 10 / 3 }} + +If either operand is a double, double division is performed: +10.0 / 3 = {{ 10.0 / 3 }} +10 / 3.0 = {{ 10 / 3.0 }} +-- End -- |