Permalink
Browse files

Failing tests for trying to delete a different key type

  • Loading branch information...
1 parent 455ff84 commit 3eb7cdc78980996ca753a2eac213064166fb0f42 @eric eric committed with May 7, 2012
Showing with 18 additions and 0 deletions.
  1. +9 −0 test/test_avl_tree.rb
  2. +9 −0 test/test_red_black_tree.rb
View
@@ -307,6 +307,15 @@ def test_delete_compaction_leaf
assert_equal 5, h.dump_tree.split($/).size
end
+ def test_delete_different_type
+ h = AVLTree.new
+ h['a'] = 1
+ h['abc'] = 2
+ h['bb'] = 3
+
+ assert_nil h.delete(3.3)
+ end
+
def test_each
h = AVLTree.new
s = { 'aa' => 1, 'ab' => 2, 'bb' => 3, 'bc' => 4, 'a' => 5, 'abc' => 6 }
@@ -457,6 +457,15 @@ def test_delete_balanced_rotate_right
assert_equal '(f (c (b a) (d - e)) (i (g - h) (k j)))', h.dump_sexp
end
+ def test_delete_different_type
+ h = RedBlackTree.new
+ h['a'] = 1
+ h['abc'] = 2
+ h['bb'] = 3
+
+ assert_nil h.delete(3.4)
+ end
+
def test_each
h = RedBlackTree.new
s = { 'aa' => 1, 'ab' => 2, 'bb' => 3, 'bc' => 4, 'a' => 5, 'abc' => 6 }

0 comments on commit 3eb7cdc

Please sign in to comment.