summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest/it.t5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/it.t b/test/it.t
index 65adcd6..64b0fac 100755
--- a/test/it.t
+++ b/test/it.t
@@ -435,6 +435,11 @@ is(it::json_decode('{"foo":"bar"}', ['assoc' => true])['foo'], "bar");
is(it::sort(["2!","19!","1!"]), ["1!", "19!", "2!"]);
is(it::sort(["2!","19!","1!"], "r"), ["2!", "19!", "1!"]);
is(it::sort(["2!","19!","1!"], "rn"), ["19!", "2!", "1!"]);
+is(it::sort(["ccc", "b", "aa"], "", function ($a, $b) { return strlen($a) <=> strlen($b); }), ["b", "aa", "ccc"]);
+is(it::sort(["ccc", "b", "aa"], function ($a, $b) { return strlen($a) <=> strlen($b); }), ["b", "aa", "ccc"]);
+is(it::sort(["ccc", "b", "aa"], "a", function ($a, $b) { return strlen($a) <=> strlen($b); }), [1 => "b", 2 => "aa", 0 => "ccc"]);
+is(it::sort(["ccc" => 2, "b" => 3, "aa" => 1], "k", function ($a, $b) { return strlen($a) <=> strlen($b); }), ['b' => 3, 'aa' => 1, 'ccc' => 2]);
+is(it::sort(["ccc", "b", "aa"], "strlen"), ["b", "aa", "ccc"]);
is(it::mod(-9, 4), 3);
is(it::mod(-8, 4), 0);