Example #1
0
 def testSingleByte(self):
     self.assertEqual(bytes([0]), Uleb128Encode(0))
     self.assertEqual(bytes([1]), Uleb128Encode(1))
     self.assertEqual(bytes([127]), Uleb128Encode(127))
Example #2
0
 def testMultiBytes(self):
     self.assertEqual(bytes([0b10000000, 0b1]), Uleb128Encode(128))
     self.assertEqual(bytes([0b10000000, 0b10000000, 0b1]),
                      Uleb128Encode(128**2))
Example #3
0
 def testNegativeValue(self):
     self.assertRaises(ValueError, lambda: Uleb128Encode(-1))