Skip to content

Commit e18789e

Browse files
committed
forcefully test python murmur128
1 parent 541d3c7 commit e18789e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/engine/test_hashfns.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import six
99

1010
from splitio.engine import hashfns, splitters
11+
from splitio.engine.hashfns.murmur3py import hash128_x64 as murmur3_128_py
1112
from splitio.models import splits
1213

1314

@@ -101,3 +102,17 @@ def test_murmur128(self):
101102
seed = int(seed)
102103
hashed = int(hashed)
103104
assert hashfns.murmur_128(key, seed) == hashed
105+
106+
def test_murmur128_pure_python(self):
107+
"""Test legacy hash function against known results."""
108+
file_name = os.path.join(os.path.dirname(__file__), 'files', 'murmur128_test_suite.csv')
109+
with io.open(file_name, 'r', encoding='utf-8') as flo:
110+
lines = flo.read().split('\n')
111+
112+
for line in lines:
113+
if line is None or line == '':
114+
continue
115+
key, seed, hashed = line.split(',')
116+
seed = int(seed)
117+
hashed = int(hashed)
118+
assert murmur3_128_py(key, seed) == hashed

0 commit comments

Comments
 (0)