Example #1
0
 def test_set_bit_no_actual_change(self):
     initial = "10010100"  # 148 in binary
     output = Encrypter.set_bit(int(initial, 2), 6, 0)
     self.assertEqual(bin(output)[2:], initial)
     initial = "10010100"  # 148 in binary
     output = Encrypter.set_bit(int(initial, 2), 2, 1)
     self.assertEqual(bin(output)[2:], initial)
Example #2
0
 def test_set_bit_to_0(self):
     initial = "10010100"  # 148 in binary
     index = 2
     expected_value = "10010000"
     output = Encrypter.set_bit(int(initial, 2), index, 0)
     self.assertEqual(bin(output)[2:], expected_value)