Exemplo n.º 1
0
 def testUnsignedLength8(self):
     bitfield = BitField(0xaa,
                         length=8,
                         signed=False,
                         max_value=255,
                         encoder=BitFieldMultiByteEncoder())
     self._test(bitfield)
Exemplo n.º 2
0
 def testBitFieldMultiByteEncoderSignedUnsupported(self):
     with self.assertRaises(KittyException):
         BitField(-12,
                  length=8,
                  signed=True,
                  max_value=127,
                  encoder=BitFieldMultiByteEncoder())
Exemplo n.º 3
0
 def testUnsignedLength16(self):
     bitfield = BitField(1234,
                         length=16,
                         signed=False,
                         encoder=BitFieldMultiByteEncoder())
     self._test(bitfield)
Exemplo n.º 4
0
 def testZero(self):
     uut = BitFieldMultiByteEncoder()
     self.assertEqual(uut.encode(0, 10, False), Bits(bytes='\x00'))
Exemplo n.º 5
0
 def testUnsignedLength64(self):
     bitfield = BitField(78945,
                         length=64,
                         signed=False,
                         encoder=BitFieldMultiByteEncoder())
     self._test(bitfield)