From 7fd4fc4bc759564db7714748646d5dc74f9e7a11 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Fri, 15 Aug 2025 13:26:36 +0200 Subject: Allow reification of slsets to get fast adjoin and membership testing --- tests/run.scm | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'tests/run.scm') 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) -- cgit v1.2.3