summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-06-18 02:42:57 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-06-18 02:42:57 -0700
commit213d60b7200b7c1a1085fb239becd8e2f977b6e3 (patch)
treef16d9e491eb07b4a28dd60731d0750b883a14f35 /tests
parentb3c1e6eb4e2b536574253cb744baf3fff5d4b6fc (diff)
downloadtxr-213d60b7200b7c1a1085fb239becd8e2f977b6e3.tar.gz
txr-213d60b7200b7c1a1085fb239becd8e2f977b6e3.tar.bz2
txr-213d60b7200b7c1a1085fb239becd8e2f977b6e3.zip
New function: copy-hash-iter.
* hash.c (hash_iter_ops): Use copy_hash_iter as the clone operation. (copy_hash_iter): New function. * hash.h (copy_hash_iter): Declared. * tests/010/hash.tl: New tests. * txr.1: Documented.
Diffstat (limited to 'tests')
-rw-r--r--tests/010/hash.tl11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/010/hash.tl b/tests/010/hash.tl
index d6a8542b..bd37e180 100644
--- a/tests/010/hash.tl
+++ b/tests/010/hash.tl
@@ -92,3 +92,14 @@
(eql (hash-equal (expt 2 128)) (hash-equal (expt 2 128))) t
(eql (hash-eql "abc") (hash-eql "abc")) nil
(eql (hash-eql (expt 2 128)) (hash-eql (expt 2 128))) t)
+
+(let* ((h #H(() (a 1) (b 2) (c 3) (d 4)))
+ (hi1 (hash-begin h))
+ (hi2 (progn (hash-next hi1) (copy-hash-iter hi1))))
+ (mvtest
+ (hash-next hi1) (hash-next hi2)
+ (hash-next hi2) (hash-next hi1)
+ (hash-next hi1) (hash-next hi2)
+ (hash-next hi2) (hash-next hi1)
+ (hash-next hi1) nil
+ (hash-next hi2) nil))