aboutsummaryrefslogtreecommitdiffstats
path: root/util/digest/multi_ut.pyx
blob: 7716e61712a5fb6ba5e09379673dfb0a23e02ff1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from util.digest.multi cimport MultiHash 
from util.generic.string cimport TString
 
import pytest 
import unittest 
 
 
class TestMultiHash(unittest.TestCase): 
 
    def test_str_int(self): 
        value = MultiHash(TString(b"1234567"), 123)
        self.assertEquals(value, 17038203285960021630) 
 
    def test_int_str(self): 
        value = MultiHash(123, TString(b"1234567"))
        self.assertEquals(value, 9973288649881090712) 
 
    def test_collision(self): 
        self.assertNotEquals(MultiHash(1, 1, 0), MultiHash(2, 2, 0))