Пример #1
0
 def test_make_reset(self):
     buf = bytearray(range(32))  # Start with junk in the buffer.
     seq = 67
     p = stentura._make_reset(buf, seq)
     for_crc = [seq, 18, 0, stentura._RESET, 0] + ([0] * 10)
     crc = stentura._crc(for_crc)
     expected = bytearray([1] + for_crc + [crc & 0xFF, crc >> 8])
     self.assertEqual(p, expected)
Пример #2
0
 def test_make_reset(self):
     buf = array.array('B', [3] * 20)  # Start with junk in the buffer.
     seq = 67
     p = stentura._make_reset(buf, seq)
     for_crc = [seq, 18, 0, stentura._RESET, 0] + ([0] * 10)
     crc = stentura._crc(for_crc)
     expected = [1] + for_crc + [crc & 0xFF, crc >> 8]
     self.assertSequenceEqual(p, [chr(b) for b in expected])
Пример #3
0
 def test_make_reset(self):
     buf = bytearray(range(32))  # Start with junk in the buffer.
     seq = 67
     p = stentura._make_reset(buf, seq)
     for_crc = [seq, 18, 0, stentura._RESET, 0] + ([0] * 10)
     crc = stentura._crc(for_crc)
     expected = bytearray([1] + for_crc + [crc & 0xFF, crc >> 8])
     self.assertEqual(p, expected)
Пример #4
0
 def test_make_reset(self):
     buf = array.array('B', [3] * 20)  # Start with junk in the buffer.
     seq = 67
     p = stentura._make_reset(buf, seq)
     for_crc = [seq, 18, 0, stentura._RESET, 0] + ([0] * 10)
     crc = stentura._crc(for_crc)
     expected = [1] + for_crc + [crc & 0xFF, crc >> 8]
     self.assertSequenceEqual(p, [chr(b) for b in expected])