summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-08-30 16:59:09 +0200
committerLaurenz <laurmaedje@gmail.com>2021-08-30 16:59:09 +0200
commitee84bf74083f5b9cc88a2a0a968dc905b1eef22c (patch)
treed2756f462ee242c328c526d2a65de4105830cb27 /tests/typ
parentff25573224400673d08b31e576d5a0d87751dbe1 (diff)
Add abs() function
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/utility/math.typ18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/typ/utility/math.typ b/tests/typ/utility/math.typ
index 05c3639f..aeb0d6ad 100644
--- a/tests/typ/utility/math.typ
+++ b/tests/typ/utility/math.typ
@@ -2,6 +2,24 @@
// Ref: false
---
+// Test `abs` function.
+#test(abs(-3), 3)
+#test(abs(3), 3)
+#test(abs(-0.0), 0.0)
+#test(abs(0.0), -0.0)
+#test(abs(-3.14), 3.14)
+#test(abs(-12pt), 12pt)
+#test(abs(50%), 50%)
+
+---
+// Error: 6-16 cannot take absolute value of a linear
+#abs(10pt + 50%)
+
+---
+// Error: 6-17 expected numeric value
+#abs("no number")
+
+---
// Test `min` and `max` functions.
#test(min(2, -4), -4)
#test(min(3.5, 1e2, -0.1, 3), -0.1)