Permalink
Browse files

Fix Encoding test

It's the only different behavior between AVLTree and RadixTree.
RadixTree compares keys by char-to-char comparison but AVLTree just uses
String#<=>
  • Loading branch information...
1 parent 5e43e10 commit bf82141a5faed857a2a83602a8e22f712cabf951 @nahi committed Jan 13, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 test/test_avl_tree.rb
View
@@ -425,6 +425,7 @@ def test_clear
end
if RUBY_VERSION >= '1.9.0'
+ # In contrast to RadixTree, AVLTree just uses String#<=> as-is
def test_encoding
h = AVLTree.new
s = { '$B$"$"(B' => 1, '$B$"$$(B' => 2, '$B$$$$(B' => 3, '$B$$$&(B' => 4, '$B$"(B' => 5, '$B$"$$$&(B' => 6 }
@@ -437,7 +438,8 @@ def test_encoding
end
str = '$B$"$"(B'
str.force_encoding('US-ASCII')
- assert_equal nil, h[str]
+ # it's nil for RadixTree because RadixTree uses char-to-char comparison
+ assert_equal 1, h[str]
end
end
end

0 comments on commit bf82141

Please sign in to comment.