Skip to content

Commit 64b2740

Browse files
committed
Add tests for issue 39
1 parent 4c1742f commit 64b2740

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/test_cdblib.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,17 @@ def test_putstrings_fail(self):
480480
]:
481481
with self.assertRaises(exc_type):
482482
self.writer.putstrings(key, value)
483+
484+
def test_zero_hash(self):
485+
# Adapted from https://github.com/bbayles/python-pure-cdb/issues/39
486+
key1 = b'xyz'
487+
key2 = bytes([*[13, 168, 240, 240, 64, 64, 128, 128, 128, 0, 128, 128, 0, 0, 0, 128, 128], *([0] * 692791), 128]) # noqa
488+
value = b'abc'
489+
self.writer.put(key1, value)
490+
self.writer.put(key2, value)
491+
reader = self.get_reader()
492+
self.assertEqual(reader.get(key1), value)
493+
self.assertEqual(reader.get(key2), value)
483494

484495

485496
class WriterNativeInterfaceDjbHashTestCase(WriterNativeInterfaceTestBase,

0 commit comments

Comments
 (0)