Tests the following properties:
- Conjunction Idempotence
n .&. n ≡ n
- Disjunction Idempotence
n .|. n ≡ n
- Double Complement
complement (complement n) ≡ n
- Set Bit
setBit n i ≡ n .|. bit i
- Clear Bit
clearBit n i ≡ n .&. complement (bit i)
- Complement Bit
complementBit n i ≡ xor n (bit i)
- Clear Zero
clearBit zeroBits i ≡ zeroBits
- Set Zero
setBit zeroBits i ≡ bit i
- Test Zero
testBit zeroBits i ≡ False
- Pop Zero
popCount zeroBits ≡ 0
- Right Rotation
no sign extension → (rotateR n i ≡ (shiftR n i) .|. (shiftL n (finiteBitSize ⊥ - i)))
- Left Rotation
no sign extension → (rotateL n i ≡ (shiftL n i) .|. (shiftR n (finiteBitSize ⊥ - i)))
- Count Leading Zeros of Zero
countLeadingZeros zeroBits ≡ finiteBitSize ⊥
- Count Trailing Zeros of Zero
countTrailingZeros zeroBits ≡ finiteBitSize ⊥
All of the useful instances of the Bits typeclass
also have FiniteBits instances, so these property
tests actually require that instance as well.
Note: This property test is only available when
using base-4.7 or newer.