leancheck-0.3.0: Cholesterol-free property-based testing

Safe HaskellNone
LanguageHaskell2010

Test.Types

Contents

Description

Types to aid in property-based testing.

Synopsis

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

data Int3 Source

Three-bit signed integers: -4, -3, -2, -1, 0, 1, 2, 3

data Int4 Source

Four-bit signed integers: -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7

data Word4 Source

Four-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

data Nat Source

Natural numbers (including 0): 0, 1, 2, 3, 4, 5, 6, 7, ...

Internally, this type is represented as an Int. So, it is limited by the maxBound of Int.

Aliases to word types (deprecated)