Rev 3813: Add some tests that we can use the search keys as proper mappings. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/hash_search_key
John Arbash Meinel
john at arbash-meinel.com
Wed Jan 21 20:10:35 GMT 2009
At http://bzr.arbash-meinel.com/branches/bzr/brisbane/hash_search_key
------------------------------------------------------------
revno: 3813
revision-id: john at arbash-meinel.com-20090121201027-ji143it572y82ou4
parent: john at arbash-meinel.com-20090121200529-a1di2ljywetnbaz0
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: hash_search_key
timestamp: Wed 2009-01-21 14:10:27 -0600
message:
Add some tests that we can use the search keys as proper mappings.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_chk_map.py'
--- a/bzrlib/tests/test_chk_map.py 2009-01-21 20:05:29 +0000
+++ b/bzrlib/tests/test_chk_map.py 2009-01-21 20:10:27 +0000
@@ -1066,6 +1066,40 @@
" ('3',) 'baz'\n"
, chkmap._dump_tree())
+ def test_search_key_16(self):
+ chk_bytes = self.get_chk_bytes()
+ chkmap = chk_map.CHKMap(chk_bytes, None,
+ search_key_func=chk_map._search_key_16)
+ chkmap._root_node.set_maximum_size(10)
+ chkmap.map(('1',), 'foo')
+ chkmap.map(('2',), 'bar')
+ chkmap.map(('3',), 'baz')
+ self.assertEqualDiff("'' InternalNode\n"
+ " '1' LeafNode\n"
+ " ('2',) 'bar'\n"
+ " '6' LeafNode\n"
+ " ('3',) 'baz'\n"
+ " '7' LeafNode\n"
+ " ('1',) 'foo'\n"
+ , chkmap._dump_tree())
+
+ def test_search_key_255(self):
+ chk_bytes = self.get_chk_bytes()
+ chkmap = chk_map.CHKMap(chk_bytes, None,
+ search_key_func=chk_map._search_key_255)
+ chkmap._root_node.set_maximum_size(10)
+ chkmap.map(('1',), 'foo')
+ chkmap.map(('2',), 'bar')
+ chkmap.map(('3',), 'baz')
+ self.assertEqualDiff("'' InternalNode\n"
+ " '\\x1a' LeafNode\n"
+ " ('2',) 'bar'\n"
+ " 'm' LeafNode\n"
+ " ('3',) 'baz'\n"
+ " '\\x83' LeafNode\n"
+ " ('1',) 'foo'\n"
+ , chkmap._dump_tree())
+
class TestSearchKeyFuncs(tests.TestCase):
More information about the bazaar-commits
mailing list