Пример #1
0
 def test_int_to_from_script_bytes(self):
     for i in range(-127, 127):
         self.assertEqual(int_from_script_bytes(int_to_script_bytes(i)), i)
     for i in range(-1024, 1024, 16):
         self.assertEqual(int_from_script_bytes(int_to_script_bytes(i)), i)
     for i in range(-1024 * 1024, 1024 * 1024, 10000):
         self.assertEqual(int_from_script_bytes(int_to_script_bytes(i)), i)
     self.assertEqual(int_to_script_bytes(1), b"\1")
     self.assertEqual(int_to_script_bytes(127), b"\x7f")
     self.assertEqual(int_to_script_bytes(128), b"\x80\x00")
Пример #2
0
 def test_int_to_from_script_bytes(self):
     for i in range(-127, 127):
         self.assertEqual(int_from_script_bytes(int_to_script_bytes(i)), i)
     for i in range(-1024, 1024, 16):
         self.assertEqual(int_from_script_bytes(int_to_script_bytes(i)), i)
     for i in range(-1024*1024, 1024*1024, 10000):
         self.assertEqual(int_from_script_bytes(int_to_script_bytes(i)), i)
     self.assertEqual(int_to_script_bytes(1), b"\1")
     self.assertEqual(int_to_script_bytes(127), b"\x7f")
     self.assertEqual(int_to_script_bytes(128), b"\x80\x00")
Пример #3
0
 def test_val(n):
     as_bytes = int_to_script_bytes(n)
     test_bytes(as_bytes)