Example #1
0
 def test_minwidth(self):
     self.assertEquals(
         len(BitPaddedInt.to_bytes(100, width=-1, minwidth=6)), 6)
Example #2
0
 def test_w129l(self):
     self.assertEquals(
         BitPaddedInt.to_bytes(129, width=2, bigendian=False), b'\x01\x01')
Example #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)
Example #4
0
 def test_w129(self):
     self.assertEquals(BitPaddedInt.to_bytes(129, width=2), b'\x01\x01')
Example #5
0
 def test_s65(self):
     self.assertEquals(BitPaddedInt.to_bytes(0x41, 6), b'\x00\x00\x01\x01')
Example #6
0
 def test_s129(self):
     self.assertEquals(BitPaddedInt.to_bytes(129), b'\x00\x00\x01\x01')
Example #7
0
 def test_s1l(self):
     self.assertEquals(
         BitPaddedInt.to_bytes(1, bigendian=False), b'\x01\x00\x00\x00')
Example #8
0
 def test_s0(self):
     self.assertEquals(BitPaddedInt.to_bytes(0), b'\x00\x00\x00\x00')