mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-04 00:18:02 +00:00
Add bits to flip challenge
This commit is contained in:
21
bit_manipulation/bits_to_flip/test_bits_to_flip.py
Normal file
21
bit_manipulation/bits_to_flip/test_bits_to_flip.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from nose.tools import assert_equal
|
||||
|
||||
|
||||
class TestBits(object):
|
||||
|
||||
def test_bits_to_flip(self):
|
||||
bits = Bits()
|
||||
a = int('11101', base=2)
|
||||
b = int('01111', base=2)
|
||||
expected = 2
|
||||
assert_equal(bits.bits_to_flip(a, b), expected)
|
||||
print('Success: test_bits_to_flip')
|
||||
|
||||
|
||||
def main():
|
||||
test = TestBits()
|
||||
test.test_bits_to_flip()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user