aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-12-26 16:52:47 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-12-26 16:52:47 -0500
commit59b31083a6b3ce7dd786d127620c1766be672202 (patch)
treec951a71eba2b8e92776ce4a767fc144abe19d5a0 /test
parent695049bef9f6c528261d4223b21a57104deb3d9c (diff)
Change table hashing and comparison logic to be *unordered*, but still
O(N)
Diffstat (limited to 'test')
-rw-r--r--test/tables.tm15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/tables.tm b/test/tables.tm
index e67c7127..6abbbe36 100644
--- a/test/tables.tm
+++ b/test/tables.tm
@@ -88,3 +88,18 @@ func main():
>> t4
= &{"one":999, "two":222}
+ do:
+ >> {1:1, 2:2} == {2:2, 1:1}
+ = yes
+ >> {1:1, 2:2} == {1:1, 2:999}
+ = no
+
+ >> {1:1, 2:2} <> {2:2, 1:1}
+ = 0
+ >> [{:Int:Int}, {0:0}, {99:99}, {1:1, 2:2, 3:3}, {1:1, 99:99, 3:3}, {1:1, 2:-99, 3:3}, {1:1, 99:-99, 3:4}]:sorted()
+ = [{}, {0:0}, {1:1, 2:-99, 3:3}, {1:1, 2:2, 3:3}, {1:1, 99:99, 3:3}, {1:1, 99:-99, 3:4}, {99:99}]
+
+ >> [{:Int}, {1}, {2}, {99}, {0, 3}, {1, 2}, {99}]:sorted()
+ = [{}, {0, 3}, {1}, {1, 2}, {2}, {99}, {99}]
+
+