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