Commits

Moritz Heidkamp  committed bf10bf6 Merge

Merged in adellica/channel (pull request #2)

bugfix in set-fold

  • Participants
  • Parent commits 4718606, 660c30b

Comments (0)

Files changed (2)

 (define (set-fold set proc seed)
   (hash-table-fold
    (set-table set)
-   (lambda (k v s) (proc k seed))
+   (lambda (k v s) (proc k s))
    seed))
 
 (define (set-empty? set)

File tests/run.scm

 
 (test-begin)
 
+(include "../set.scm")
+
+(test-group
+ "set"
+
+ (let ((set (make-set)))
+   (for-each (cut set-insert! set <>) '(1 2 4))
+
+   (test '(4 2 1) (sort (set-members set) >))
+   (test 7 (set-fold set + 0))
+
+   (test #t (set-contains? set 2))
+   (set-remove! set 2)
+   (test '(4 1) (sort (set-members set) >))
+   (test #f (set-contains? set 2))
+
+   (test #f (set-empty? set))
+   (set-clear! set)
+   (test #t (set-empty? set))))
+
 (define (gc!!)
   (repeat 5 (gc #t)))