Safe Haskell | None |
---|---|
Language | Haskell2010 |
Types to aid in property-based testing.
Integer types
Small-width integer types to aid in property-based testing. Sometimes it is useful to limit the possibilities of enumerated values when testing polymorphic functions, these types allow that.
The signed integer types IntN
are of limited bit width N
bounded by -2^(N-1)
to 2^(N-1)-1
.
The unsigned integer types WordN
are of limited bit width N
bounded by 0
to 2^N-1
.
Operations are closed and modulo 2^N
. e.g.:
maxBound + 1 = minBound read "2" = -2 :: Int2 abs minBound = minBound negate n = 2^N - n :: WordN
Single-bit signed integers: -1, 0
Two-bit signed integers: -2, -1, 0, 1
Three-bit signed integers: -4, -3, -2, -1, 0, 1, 2, 3
Four-bit signed integers: -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7
Single-bit unsigned integer: 0, 1
Two-bit unsigned integers: 0, 1, 2, 3
Three-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7
Four-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
Natural numbers modulo 1: 0
Natural numbers modulo 2: 0, 1
Natural numbers modulo 3: 0, 1, 2
Natural numbers modulo 4: 0, 1, 2, 3
Natural numbers modulo 5: 0, 1, 2, 3, 4
Natural numbers modulo 6: 0, 1, 2, 3, 4, 5
Natural numbers modulo 7: 0, 1, 2, 3, 4, 5, 6