Ejemplo n.º 1
0
 def test_minwidth(self):
     self.assertEquals(
         len(BitPaddedInt.to_bytes(100, width=-1, minwidth=6)), 6)
Ejemplo n.º 2
0
 def test_w129l(self):
     self.assertEquals(
         BitPaddedInt.to_bytes(129, width=2, bigendian=False), b'\x01\x01')
Ejemplo n.º 3
0
 def test_varwidth(self):
     self.assertEquals(len(BitPaddedInt.to_bytes(100)), 4)
     self.assertEquals(len(BitPaddedInt.to_bytes(100, width=-1)), 4)
     self.assertEquals(len(BitPaddedInt.to_bytes(2**32, width=-1)), 5)
Ejemplo n.º 4
0
 def test_w129(self):
     self.assertEquals(BitPaddedInt.to_bytes(129, width=2), b'\x01\x01')
Ejemplo n.º 5
0
 def test_s65(self):
     self.assertEquals(BitPaddedInt.to_bytes(0x41, 6), b'\x00\x00\x01\x01')
Ejemplo n.º 6
0
 def test_s129(self):
     self.assertEquals(BitPaddedInt.to_bytes(129), b'\x00\x00\x01\x01')
Ejemplo n.º 7
0
 def test_s1l(self):
     self.assertEquals(
         BitPaddedInt.to_bytes(1, bigendian=False), b'\x01\x00\x00\x00')
Ejemplo n.º 8
0
 def test_s0(self):
     self.assertEquals(BitPaddedInt.to_bytes(0), b'\x00\x00\x00\x00')