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_constructor(): assert BitArray().is_zero() assert BitArray(0).is_zero() ba = BitArray(0x10000000000000000000000000) assert ba.get_lowest_on_bit() == 100 assert ba.get_highest_on_bit() == 100 with pytest.raises(Exception): assert BitArray(-1) with pytest.raises(Exception): assert BitArray(-10000000000000000000)