diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-12-18 07:52:36 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-12-18 07:52:36 -0800 |
commit | 4fc00d854287a24d1ba23940c27a4e3eca29a30e (patch) | |
tree | a58e63d9e749644669f59b5903e0a6afa463ddd3 /tests/010/hash.tl | |
parent | 539c4262a8ace966722de370ef70e91a65a75144 (diff) | |
download | txr-4fc00d854287a24d1ba23940c27a4e3eca29a30e.tar.gz txr-4fc00d854287a24d1ba23940c27a4e3eca29a30e.tar.bz2 txr-4fc00d854287a24d1ba23940c27a4e3eca29a30e.zip |
hash: test cases and small doc fix.
* tests/010/hash.tl: Add test cases for the hash set operations.
* txr.1: Clarify that in hash-uni, the mapping functions are
used on all items, not just ones subject to joinfun.
Diffstat (limited to 'tests/010/hash.tl')
-rw-r--r-- | tests/010/hash.tl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/010/hash.tl b/tests/010/hash.tl index db8f07aa..415dd223 100644 --- a/tests/010/hash.tl +++ b/tests/010/hash.tl @@ -63,3 +63,21 @@ (test [hash-map square '(1 2 3)] #H(() (1 1) (2 4) (3 9))) + +(let ((h1 #H(() (a 1) (b 2) (c 3) (d 4))) + (h2 #H(() (b -2) (c -3) (d -4) (e -5)))) + (mtest + (hash-uni h1 h2) #H(() (a 1) (b 2) (c 3) (d 4) (e -5)) + [hash-uni h1 h2 +] #H(() (a 1) (b 0) (c 0) (d 0) (e -5)) + [hash-uni h1 h2 + -] #H(() (a -1) (b -4) (c -6) (d -8) (e -5)) + [hash-uni h1 h2 + : -] #H(() (a 1) (b 4) (c 6) (d 8) (e 5)) + [hash-uni h1 h2 + - -] #H(() (a -1) (b 0) (c 0) (d 0) (e 5))) + (mtest + (hash-diff h1 h2) #H(() (a 1)) + (hash-diff h2 h1) #H(() (e -5))) + (mtest + (hash-symdiff h1 h2) #H(() (a 1) (e -5)) + (hash-symdiff h2 h1) #H(() (a 1) (e -5))) + (mtest + (hash-isec h1 h2) #H(() (b 2) (c 3) (d 4)) + [hash-isec h1 h2 +] #H(() (b 0) (c 0) (d 0)))) |