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