Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Maris Orbidans authored and Maris Orbidans committed Feb 27, 2015
1 parent c6832fd commit 1572d05
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/maruks/data/red_black_tree_test.clj
Expand Up @@ -133,4 +133,15 @@
(is (= '(2 3 4) (seq d)))
(is (= '(1 2 3 4) (seq t)))
(is (is-red-black-tree? (.root d)))
(is (is-red-black-tree? (.root t)))))
(testing "removing BLACK node with RED child"
(let [t (red-black-tree '(2 1 4 3))
d (disj t 2)
n (find-node (.root t) 2 compare)
c (.left n)]
(is (and (red? c) (is-leaf? c)))
(is (and (black? n) (not (is-leaf? n))))
(is (= '(1 3 4) (seq d)))
(is (= '(1 2 3 4) (seq t)))
(is (is-red-black-tree? (.root d)))
(is (is-red-black-tree? (.root t))))))

0 comments on commit 1572d05

Please sign in to comment.