summaryrefslogtreecommitdiff
path: root/tests/typ/utility
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-06-10 16:46:01 +0200
committerLaurenz <laurmaedje@gmail.com>2021-06-10 16:46:01 +0200
commit5611c26577c4cf6d52b9b66b7b1a32253aa23ec1 (patch)
treeb06a64845ef691700aed7fd0ed1e22dd064cc742 /tests/typ/utility
parentbce553a991f19b2b5bb9efef6b74bd12e15a10c6 (diff)
Restructure tests
Diffstat (limited to 'tests/typ/utility')
-rw-r--r--tests/typ/utility/calc.typ15
-rw-r--r--tests/typ/utility/color.typ21
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/typ/utility/calc.typ b/tests/typ/utility/calc.typ
new file mode 100644
index 00000000..3bfc9802
--- /dev/null
+++ b/tests/typ/utility/calc.typ
@@ -0,0 +1,15 @@
+// Test basic calculation functions.
+// Ref: false
+
+---
+// Test `min` and `max` functions.
+#test(min(2, -4), -4)
+#test(min(3.5, 1e2, -0.1, 3), -0.1)
+#test(max(-3, 11), 11)
+#test(min("hi"), "hi")
+
+// Error: 6 missing argument: value
+#min()
+
+// Error: 11-18 cannot compare integer with string
+#test(min(1, "hi"), error)
diff --git a/tests/typ/utility/color.typ b/tests/typ/utility/color.typ
new file mode 100644
index 00000000..2e40828b
--- /dev/null
+++ b/tests/typ/utility/color.typ
@@ -0,0 +1,21 @@
+// Test color creation functions.
+// Ref: false
+
+---
+// Check the output.
+#test(rgb(0.0, 0.3, 0.7), #004db3)
+
+// Alpha channel.
+#test(rgb(1.0, 0.0, 0.0, 0.5), #ff000080)
+
+// Warning: 2:11-2:14 should be between 0.0 and 1.0
+// Warning: 1:16-1:20 should be between 0.0 and 1.0
+#test(rgb(-30, 15.5, 0.5), #00ff80)
+
+// Error: 11-15 missing argument: blue component
+#test(rgb(0, 1), #00ff00)
+
+// Error: 3:11-3:11 missing argument: red component
+// Error: 2:11-2:11 missing argument: green component
+// Error: 1:11-1:11 missing argument: blue component
+#test(rgb(), black)