summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorfrozolotl <44589151+frozolotl@users.noreply.github.com>2023-11-17 19:55:57 +0100
committerGitHub <noreply@github.com>2023-11-17 19:55:57 +0100
commit43f90b21592f5ab4885d63a351e7caa3b5bdb225 (patch)
treee922134ea942de7e2ce52f9b6d0921f7752be8a3 /tests
parentf5b3af3c1ba4eabef1630afa1c7d496af0b72557 (diff)
Implement euclidean division and remainder (#2678)
Diffstat (limited to 'tests')
-rw-r--r--tests/typ/compute/calc.typ32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/typ/compute/calc.typ b/tests/typ/compute/calc.typ
index 24411ecf..86dcafcd 100644
--- a/tests/typ/compute/calc.typ
+++ b/tests/typ/compute/calc.typ
@@ -77,6 +77,38 @@
#calc.rem(3.0, 0.0)
---
+// Test the `div-euclid` function.
+#test(calc.div-euclid(7, 3), 2)
+#test(calc.div-euclid(7, -3), -2)
+#test(calc.div-euclid(-7, 3), -3)
+#test(calc.div-euclid(-7, -3), 3)
+#test(calc.div-euclid(2.5, 2), 1)
+
+---
+// Error: 21-22 divisor must not be zero
+#calc.div-euclid(5, 0)
+
+---
+// Error: 23-26 divisor must not be zero
+#calc.div-euclid(3.0, 0.0)
+
+---
+// Test the `rem-euclid` function.
+#test(calc.rem-euclid(7, 3), 1)
+#test(calc.rem-euclid(7, -3), 1)
+#test(calc.rem-euclid(-7, 3), 2)
+#test(calc.rem-euclid(-7, -3), 2)
+#test(calc.rem-euclid(2.5, 2), 0.5)
+
+---
+// Error: 21-22 divisor must not be zero
+#calc.rem-euclid(5, 0)
+
+---
+// Error: 23-26 divisor must not be zero
+#calc.rem-euclid(3.0, 0.0)
+
+---
// Test the `quo` function.
#test(calc.quo(1, 1), 1)
#test(calc.quo(5, 3), 1)