Skip to content

Instantly share code, notes, and snippets.

@duncanmak
Last active January 1, 2019 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duncanmak/03147dad1cd1697ca9ac3c2a7ee5ca8f to your computer and use it in GitHub Desktop.
Save duncanmak/03147dad1cd1697ca9ac3c2a7ee5ca8f to your computer and use it in GitHub Desktop.
(import (scheme base)
(srfi :64 testing)
(mit-scheme rb-tree))
(test-begin "rb-tree" 2)
(define tree (make-rb-tree = <))
(rb-tree/insert! tree 1 'foo)
(rb-tree/insert! tree 2 'bar)
(rb-tree/insert! tree 3 'baz)
(test-equal '((1 . foo) (2 . bar) (3 . baz))
(rb-tree->alist tree))
(rb-tree/delete! tree 2)
(test-equal '((1 . foo) (3 . baz))
(rb-tree->alist tree))
(test-end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment