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