Beispiel #1
0
 def check_crc_missing_crc(expect):
     with raises(framing.CRCCheckFailure):
         framing.check_crc(b'hello world')
Beispiel #2
0
 def check_crc(expect):
     expect(framing.check_crc(b'hello world\xa8')) == b'hello world'
Beispiel #3
0
 def check_crc_failure(expect):
     with raises(framing.CRCCheckFailure):
         framing.check_crc(b'hello world\xff')
Beispiel #4
0
 def check_crc_empty_string(expect):
     expect(framing.check_crc(b'\x00')) == b''
Beispiel #5
0
 def check_crc_zero_length(expect):
     with raises(framing.CRCCheckFailure):
         framing.check_crc(b'')
Beispiel #6
0
 def check_crc_32bit(expect):
     expect(
         framing.check_crc(b'hello world\x85\x11J\r',
                           crc_size=CrcSize.CRC32)) == b'hello world'
Beispiel #7
0
 def check_crc_16bit(expect):
     expect(framing.check_crc(b'hello world\xc19',
                              crc_size=CrcSize.CRC16)) == b'hello world'
Beispiel #8
0
 def check_crc_8bit(expect):
     expect(framing.check_crc(b'hello world\xa8',
                              crc_size=CrcSize.CRC8)) == b'hello world'