multi_ut.pyx 526 B

12345678910111213141516171819
  1. from util.digest.multi cimport MultiHash
  2. from util.generic.string cimport TString
  3. import pytest
  4. import unittest
  5. class TestMultiHash(unittest.TestCase):
  6. def test_str_int(self):
  7. value = MultiHash(TString(b"1234567"), 123)
  8. self.assertEquals(value, 17038203285960021630)
  9. def test_int_str(self):
  10. value = MultiHash(123, TString(b"1234567"))
  11. self.assertEquals(value, 9973288649881090712)
  12. def test_collision(self):
  13. self.assertNotEquals(MultiHash(1, 1, 0), MultiHash(2, 2, 0))