def test_bitarray_getstate(): assert BitArray().__getstate__() == 0 assert BitArray(0).__getstate__() == 0 assert BitArray(100).__getstate__() == 100 assert BitArray(9870000000000000000).__getstate__() == 9870000000000000000 assert BitArray.all_on().__getstate__() == -1 assert (~BitArray(100).__getstate__()) == ~100 assert (~BitArray(812000000000000000).__getstate__()) == ~812000000000000000
def test_bitarray_clear(): ba = BitArray(1234) ba.clear() assert ba.is_zero() assert not ba.is_all_on() assert ba.get_highest_on_bit() == -1 assert ba.get_highest_off_bit() == -1 ba = BitArray.all_on() ba.clear() assert ba.is_zero() assert not ba.is_all_on() assert ba.get_highest_on_bit() == -1 assert ba.get_highest_off_bit() == -1
def test_bitarray_nonzero(): assert not BitArray() assert not BitArray(0) assert BitArray(1) assert BitArray.all_on()
def test_bitarray_allon(): assert BitArray.all_on().is_all_on() assert BitArray.all_on().get_highest_on_bit() == -1 assert BitArray.all_on().get_highest_off_bit() == -1
def test_bitarray_allon(): assert BitArray.all_on().is_all_on()