test-unbalanced-map.scm 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. (import
  2. (except (rnrs base) error vector-map)
  3. (only (guile) lambda* λ error)
  4. ;; SRFI-64 for unit testing
  5. (srfi srfi-64)
  6. (unbalanced-set))
  7. (test-begin "unbalanced-set-test")
  8. (test-group "make-empty-set"
  9. (test-assert "make-empty-set returns an empty set - 01"
  10. (set-empty? (make-empty-set <)))
  11. (test-assert "make-empty-set returns an empty set - 02"
  12. (not (set-member? (make-empty-set <) 123))))
  13. (test-group "set-empty?"
  14. (test-assert "set-empty? returns true for an empty set"
  15. (set-empty? (make-empty-set <)))
  16. (test-assert "set-empty? returns false for a non-empty set"
  17. (not (set-empty? (set-insert (make-empty-set <) 123)))))
  18. (test-group "set-member?"
  19. (test-assert "set-member? returns true for a set member"
  20. (set-member? (set-insert (make-empty-set <) 123) 123))
  21. (test-assert "set-member? returns false for a value not in the set"
  22. (not (set-member? (set-insert (make-empty-set <) 123) 456))))
  23. (test-group "set-insert"
  24. (test-assert "set-insert inserts a value"
  25. (set-member? (set-insert (make-empty-set <) 123) 123)))
  26. (test-end "unbalanced-set-test")