summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHarmoGlace <23212967+HarmoGlace@users.noreply.github.com>2023-04-20 16:09:41 +0200
committerGitHub <noreply@github.com>2023-04-20 16:09:41 +0200
commit42b93b7b534557205a6dc3dfda8fe3cfccfcc458 (patch)
tree924171b6c1299fef0b628e0ac8c89c5775fea8be /tests
parentc117e2dc276d19b022abccac0d252bd7fc1cd44e (diff)
Add `quo`, `trunc` and `fract` calculation methods and rename `mod` to `rem` (#890)
Diffstat (limited to 'tests')
-rw-r--r--tests/typ/compiler/break-continue.typ4
-rw-r--r--tests/typ/compiler/string.typ2
-rw-r--r--tests/typ/compute/calc.typ32
-rw-r--r--tests/typ/layout/enum-numbering.typ2
4 files changed, 28 insertions, 12 deletions
diff --git a/tests/typ/compiler/break-continue.typ b/tests/typ/compiler/break-continue.typ
index f6245007..6f505f80 100644
--- a/tests/typ/compiler/break-continue.typ
+++ b/tests/typ/compiler/break-continue.typ
@@ -41,7 +41,7 @@
#while x < 8 {
i += 1
- if calc.mod(i, 3) == 0 {
+ if calc.rem(i, 3) == 0 {
continue
}
x += i
@@ -55,7 +55,7 @@
#let x = for i in range(5) {
"a"
- if calc.mod(i, 3) == 0 {
+ if calc.rem(i, 3) == 0 {
"_"
continue
}
diff --git a/tests/typ/compiler/string.typ b/tests/typ/compiler/string.typ
index 95e204c5..2f7ba9ec 100644
--- a/tests/typ/compiler/string.typ
+++ b/tests/typ/compiler/string.typ
@@ -103,7 +103,7 @@
let caps = match.captures
time += 60 * int(caps.at(0)) + int(caps.at(1))
}
- str(int(time / 60)) + ":" + str(calc.mod(time, 60))
+ str(int(time / 60)) + ":" + str(calc.rem(time, 60))
}
#test(timesum(""), "0:0")
diff --git a/tests/typ/compute/calc.typ b/tests/typ/compute/calc.typ
index 6af5189b..c9a37d1b 100644
--- a/tests/typ/compute/calc.typ
+++ b/tests/typ/compute/calc.typ
@@ -55,20 +55,36 @@
#test(calc.even(-11), false)
---
-// Test the `mod` function.
-#test(calc.mod(1, 1), 0)
-#test(calc.mod(5, 3), 2)
-#test(calc.mod(5, -3), 2)
-#test(calc.mod(22.5, 10), 2.5)
-#test(calc.mod(9, 4.5), 0)
+// Test the `rem` function.
+#test(calc.rem(1, 1), 0)
+#test(calc.rem(5, 3), 2)
+#test(calc.rem(5, -3), 2)
+#test(calc.rem(22.5, 10), 2.5)
+#test(calc.rem(9, 4.5), 0)
---
// Error: 14-15 divisor must not be zero
-#calc.mod(5, 0)
+#calc.rem(5, 0)
---
// Error: 16-19 divisor must not be zero
-#calc.mod(3.0, 0.0)
+#calc.rem(3.0, 0.0)
+
+---
+// Test the `quo` function.
+#test(calc.quo(1, 1), 1)
+#test(calc.quo(5, 3), 1)
+#test(calc.quo(5, -3), -1)
+#test(calc.quo(22.5, 10), 2)
+#test(calc.quo(9, 4.5), 2)
+
+---
+// Error: 14-15 divisor must not be zero
+#calc.quo(5, 0)
+
+---
+// Error: 16-19 divisor must not be zero
+#calc.quo(3.0, 0.0)
---
// Test the `min` and `max` functions.
diff --git a/tests/typ/layout/enum-numbering.typ b/tests/typ/layout/enum-numbering.typ
index 3eaf352e..7efe195f 100644
--- a/tests/typ/layout/enum-numbering.typ
+++ b/tests/typ/layout/enum-numbering.typ
@@ -22,7 +22,7 @@
spacing: 0.65em - 3pt,
tight: false,
numbering: n => text(
- fill: (red, green, blue).at(calc.mod(n, 3)),
+ fill: (red, green, blue).at(calc.rem(n, 3)),
numbering("A", n),
),
[Red], [Green], [Blue], [Red],