blob: 2013afad5867311e91e6f25745e4d761f963ab7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
from chrysacase import ChrysalideTestCase
from pychrysalide.common import fnv1a
class TestFnv1a(ChrysalideTestCase):
"""TestCase for common.fnv1a*"""
def testFnv1aConstructor(self):
"""Check that no constructor is available for the fnv1a class."""
with self.assertRaisesRegex(NotImplementedError, 'Chrysalide does not allow building this kind of object from Python'):
instance = fnv1a()
def testFnv1aSamples(self):
"""Compute some Fnv1a hashs."""
# Test cases from http://isthe.com/chongo/src/fnv/test_fnv.c
val = fnv1a.hash('')
self.assertEqual(val, 0xcbf29ce484222325)
val = fnv1a.hash('chongo was here!\n')
self.assertEqual(val, 0x46810940eff5f915)
|