Exemplo n.º 1
0
    def test_update_4_bits(self):
        """Updating 4 bits"""
        crc = heatmiser.CRC16()
        assert crc.high == crc.low
        crc.extract_bits(4)
        assert crc.high == 78
        assert crc.low == 155

        crc = heatmiser.CRC16()
        assert crc.high == crc.low
        crc.extract_bits(8)
        assert crc.high == 143
        assert crc.low == 23
Exemplo n.º 2
0
 def test_crc16_update(self):
     """check that updates work with other numbers"""
     crc = heatmiser.CRC16()
     crc.update(4)
     assert crc.high == 161
     assert crc.low == 116
Exemplo n.º 3
0
 def test_crc16(self):
     """Test that CRC matches"""
     crc = heatmiser.CRC16()
     assert crc.high == crc.low