Exemplo n.º 1
0
 def test_round_trip(self):
     test_data = [
         _pad_to(bin(struct.unpack('<I', os.urandom(4))[0]), 32)
         for _ in range(1000)]
     for value in test_data:
         round_tripped = hex_to_bin(bin_to_hex(value))
         assert round_tripped == value
Exemplo n.º 2
0
 def test_round_trip(self):
     test_data = [
         _pad_to(bin(struct.unpack('<I', os.urandom(4))[0]), 32)
         for _ in range(1000)
     ]
     for value in test_data:
         round_tripped = hex_to_bin(bin_to_hex(value))
         assert round_tripped == value
Exemplo n.º 3
0
 def test_negative_zero(self):
     expected = '0b10000000000000000000000000000000'
     result = hex_to_bin('0x80000000')
     assert result == expected
Exemplo n.º 4
0
 def test_zero_le(self):
     expected = '0b00000000000000000000000000000000'
     result = hex_to_bin('0x00000000')
     assert result == expected
Exemplo n.º 5
0
 def test_negative_zero(self):
     expected = '0b10000000000000000000000000000000'
     result = hex_to_bin('0x80000000')
     assert result == expected
Exemplo n.º 6
0
 def test_zero_le(self):
     expected = '0b00000000000000000000000000000000'
     result = hex_to_bin('0x00000000')
     assert result == expected