aboutsummaryrefslogtreecommitdiffstats
path: root/mcgoron
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-03-16 22:24:42 -0400
committerGravatar Peter McGoron 2025-03-16 22:24:42 -0400
commitc19c613fa230112ce78687af5457ea0495f3e01b (patch)
treeb00778ee22dbae35a84518c5dea22b4a6ca44c76 /mcgoron
parentreactive tests for adjoin and find (diff)
reorganize tests, fix set-replaceHEADmaster
Tests are now listed (roughly) in the order of the procedures that they test are listed in the SRFI, and not in a logical order. This is because each test group can be run independently from the others. Ideally at least one of the tests in the group is "basic" in that it uses lists to test the properties of the procedure. However the other tests use procedures and hence tests are circular. This is still OK: passing the test suite is an implementation that is meta-consistent.
Diffstat (limited to 'mcgoron')
-rw-r--r--mcgoron/weight-balanced-trees/srfi/113/252.scm1
-rw-r--r--mcgoron/weight-balanced-trees/srfi/113/sets.scm21
2 files changed, 11 insertions, 11 deletions
diff --git a/mcgoron/weight-balanced-trees/srfi/113/252.scm b/mcgoron/weight-balanced-trees/srfi/113/252.scm
index d1d0a2b..4277a3a 100644
--- a/mcgoron/weight-balanced-trees/srfi/113/252.scm
+++ b/mcgoron/weight-balanced-trees/srfi/113/252.scm
@@ -28,7 +28,6 @@
((comparator element-generator max-set-size)
(define set-size-generator
(make-random-integer-generator 0 max-set-size))
- (define the-set (set comparator))
(gmap (cut list->set comparator <>)
(list-generator-of element-generator max-set-size)))))
diff --git a/mcgoron/weight-balanced-trees/srfi/113/sets.scm b/mcgoron/weight-balanced-trees/srfi/113/sets.scm
index ba55520..ceb3638 100644
--- a/mcgoron/weight-balanced-trees/srfi/113/sets.scm
+++ b/mcgoron/weight-balanced-trees/srfi/113/sets.scm
@@ -100,7 +100,7 @@
(define set-adjoin! set-adjoin)
(define (set-replace set . elements)
- (set-replace-all elements))
+ (set-replace-all set elements))
(define set-replace! set-replace)
(define (set-delete-all set elements)
@@ -400,15 +400,16 @@
(define (set-replace-all set elements)
(let ((cmp (set-element-comparator set)))
- (fold (lambda (new set)
- (update cmp
- set
- new
- (lambda (old) new)
- (lambda ()
- (wb-tree-node new '() '()))))
- (get-node set)
- elements)))
+ (raw-set
+ cmp
+ (fold (lambda (new set)
+ (update cmp
+ set
+ new
+ (lambda (_) new)
+ (lambda () '())))
+ (get-node set)
+ elements))))
(define (generator->set comparator gen)
(raw-set comparator (generator->node comparator gen)))