def test_expected(self): # Test values determined from: # http://www.lammertbies.nl/comm/info/crc-calculation.html for inp, expected in [ (b'0', 0xD7A3), (b'0a', 0x641D), (b'123456789', 0x29B1), (b'foo_bar', 0x37DF)]: self.assertEqual(crc16ccitt(inp), expected)
def test_multi(self): for inp, expected in [((b'0', b'a'), 0x641D), ((b'1234', b'56789'), 0x29B1), ((b'foo_', b'bar'), 0x37DF)]: self.assertEqual(crc16ccitt(*inp), expected)
def test_empty(self): self.assertEqual(crc16ccitt(), 0xffff)
def is_expected_multi(inp, expected): assert crc16ccitt(*inp) == expected
def is_expected(inp, expected): assert crc16ccitt(inp) == expected
def test_empty(): assert crc16ccitt() == 0xffff