summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/46_min
diff options
context:
space:
mode:
Diffstat (limited to 'tests/custom/03_stdlib/46_min')
-rw-r--r--tests/custom/03_stdlib/46_min28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/custom/03_stdlib/46_min b/tests/custom/03_stdlib/46_min
new file mode 100644
index 0000000..c07fbff
--- /dev/null
+++ b/tests/custom/03_stdlib/46_min
@@ -0,0 +1,28 @@
+The `min()` function returns the minimum of all given arguments.
+
+If multiple equivalent minimum values are given (e.g. `null` and `false`
+both are treated as `0` when comparing numerically), the first minimal
+value is returned.
+
+Returns the minimum value among all given arguments or `null` if no
+arguments were passed.
+
+-- Testcase --
+{%
+ printf("%.J\n", [
+ min(),
+ min(5, 1, 3, -10),
+ min("foo", "bar", "xxx", "abc"),
+ min(false, null, 0, NaN)
+ ]);
+%}
+-- End --
+
+-- Expect stdout --
+[
+ null,
+ -10,
+ "abc",
+ false
+]
+-- End --