diff options
author | Peter Bex <peter@more-magic.net> | 2025-08-15 13:26:36 +0200 |
---|---|---|
committer | Peter Bex <peter@more-magic.net> | 2025-08-18 13:39:32 +0200 |
commit | 7fd4fc4bc759564db7714748646d5dc74f9e7a11 (patch) | |
tree | a618782ae43a1ec00e34ca151fe848404ba399f4 /tests | |
parent | d3a425a4930fa4395246179ad0af504c783922fd (diff) | |
download | slset-7fd4fc4bc759564db7714748646d5dc74f9e7a11.tar.gz |
Allow reification of slsets to get fast adjoin and membership testing
Diffstat (limited to 'tests')
-rw-r--r-- | tests/run.scm | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/run.scm b/tests/run.scm index 4d15ea7..571a7fe 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -154,6 +154,37 @@ (test-assert (clean? '(a b c z))))) (test-group "finally, all symbols used in any test are still clean" - (test-assert (clean? all-symbols)))) + (test-assert (clean? all-symbols))) + + (test-group "reified slsets" + (let ((result (with-reified-slset '(a b c d a c e) + (lambda (r) + (test #t (reified-slset-contains? r 'a)) + (test #t (reified-slset-contains? r 'b)) + (test #t (reified-slset-contains? r 'e)) + (test #f (reified-slset-contains? r 'i)) + (test #f (reified-slset-contains? r 'x)) + + (reified-slset-delete! r 'b) + (test '(a c d a c e) + (reified-slset->slset r)) + + (reified-slset-adjoin! r 'x) + (test #t (reified-slset-contains? r 'x)) + + (reified-slset-delete! r 'a 'e 'i) + (test '(x c d c) + (reified-slset->slset r)) + + ;; Extra check to ensure we unmark these + (test #f (reified-slset-contains? r 'a)) + + ;; Basic sanity check, remaining contents still in there + (test #t (reified-slset-contains? r 'c)))))) + ;; Put it in an extra list to avoid test form complaining + (test '((x c d c)) (list result))) + + (test-group "all symbols used here still clean" + (test-assert (clean? '(a b c d e i x)))))) (test-exit) |