Module Test.EasyCheck.Exec

EasyCheck is a library for automated, property-based testing of Curry programs. The ideas behind EasyCheck are described in this paper. This module implements the operations to actually execute the tests.

Author: Sebastian Fischer (with extensions by Michael Hanus)

Version: December 2018

Summary of exported operations:

setMaxTest :: Int -> Config -> Config   
Sets the maximum number of tests in a test configuration.
setMaxFail :: Int -> Config -> Config   
Sets the maximum number of condition failures in a test configuration.
easyConfig :: Config   
The default configuration for EasyCheck shows and deletes the number for each test.
verboseConfig :: Config   
A verbose configuration which shows the arguments of every test.
quietConfig :: Config   
A quiet configuration which shows nothing but failed tests.
check0 :: Config -> String -> Prop -> IO Bool   
Checks a unit test with a given configuration (first argument) and a name for the test (second argument).
checkWithValues0 :: Config -> String -> Prop -> IO Bool   
Checks a unit test with a given configuration (first argument) and a name for the test (second argument).
checkWithValues1 :: Show a => Config -> String -> [a] -> (a -> Prop) -> IO Bool   
Checks a property parameterized over a single argument with a given configuration (first argument), a name for the test (second argument), and all values given in the third argument.
checkWithValues2 :: (Show a, Show b) => Config -> String -> [a] -> [b] -> (a -> b -> Prop) -> IO Bool   
Checks a property parameterized over two arguments with a given configuration (first argument) a name for the test (second argument), and all values given in the third and fourth argument.
checkWithValues3 :: (Show a, Show b, Show c) => Config -> String -> [a] -> [b] -> [c] -> (a -> b -> c -> Prop) -> IO Bool   
Checks a property parameterized over three arguments with a given configuration (first argument) a name for the test (second argument), and all values given in the third, fourth and fifth argument.
checkWithValues4 :: (Show a, Show b, Show c, Show d) => Config -> String -> [a] -> [b] -> [c] -> [d] -> (a -> b -> c -> d -> Prop) -> IO Bool   
Checks a property parameterized over four arguments with a given configuration (first argument) a name for the test (second argument), and all values given in the further arguments.
checkWithValues5 :: (Show a, Show b, Show c, Show d, Show e) => Config -> String -> [a] -> [b] -> [c] -> [d] -> [e] -> (a -> b -> c -> d -> e -> Prop) -> IO Bool   
Checks a property parameterized over five arguments with a given configuration (first argument) a name for the test (second argument), and all values given in the further arguments.
check1 :: Show a => Config -> String -> (a -> Prop) -> IO Bool   
Checks a property parameterized over a single argument with a given configuration (first argument) and a name for the test (second argument).
check2 :: (Show a, Show b) => Config -> String -> (a -> b -> Prop) -> IO Bool   
Checks a property parameterized over two arguments with a given configuration (first argument) and a name for the test (second argument).
check3 :: (Show a, Show b, Show c) => Config -> String -> (a -> b -> c -> Prop) -> IO Bool   
Checks a property parameterized over three arguments with a given configuration (first argument) and a name for the test (second argument).
check4 :: (Show a, Show b, Show c, Show d) => Config -> String -> (a -> b -> c -> d -> Prop) -> IO Bool   
Checks a property parameterized over four arguments with a given configuration (first argument) and a name for the test (second argument).
check5 :: (Show a, Show b, Show c, Show d, Show e) => Config -> String -> (a -> b -> c -> d -> e -> Prop) -> IO Bool   
Checks a property parameterized over five arguments with a given configuration (first argument) and a name for the test (second argument).
easyCheck0 :: String -> Prop -> IO Bool   
Checks a unit test according to the default configuration and a name for the test (first argument).
easyCheck1 :: Show a => String -> (a -> Prop) -> IO Bool   
Checks a property parameterized over a single argument according to the default configuration and a name for the test (first argument).
easyCheck2 :: (Show a, Show b) => String -> (a -> b -> Prop) -> IO Bool   
Checks a property parameterized over two arguments according to the default configuration and a name for the test (first argument).
easyCheck3 :: (Show a, Show b, Show c) => String -> (a -> b -> c -> Prop) -> IO Bool   
Checks a property parameterized over three arguments according to the default configuration and a name for the test (first argument).
easyCheck4 :: (Show a, Show b, Show c, Show d) => String -> (a -> b -> c -> d -> Prop) -> IO Bool   
Checks a property parameterized over four arguments according to the default configuration and a name for the test (first argument).
easyCheck5 :: (Show a, Show b, Show c, Show d, Show e) => String -> (a -> b -> c -> d -> e -> Prop) -> IO Bool   
Checks a property parameterized over five arguments according to the default configuration and a name for the test (first argument).
verboseCheck0 :: String -> Prop -> IO Bool   
Checks a unit test according to the verbose configuration and a name for the test (first argument).
verboseCheck1 :: Show a => String -> (a -> Prop) -> IO Bool   
Checks a property parameterized over a single argument according to the verbose configuration and a name for the test (first argument).
verboseCheck2 :: (Show a, Show b) => String -> (a -> b -> Prop) -> IO Bool   
Checks a property parameterized over two arguments according to the verbose configuration and a name for the test (first argument).
verboseCheck3 :: (Show a, Show b, Show c) => String -> (a -> b -> c -> Prop) -> IO Bool   
Checks a property parameterized over three arguments according to the verbose configuration and a name for the test (first argument).
verboseCheck4 :: (Show a, Show b, Show c, Show d) => String -> (a -> b -> c -> d -> Prop) -> IO Bool   
Checks a property parameterized over four arguments according to the verbose configuration and a name for the test (first argument).
verboseCheck5 :: (Show a, Show b, Show c, Show d, Show e) => String -> (a -> b -> c -> d -> e -> Prop) -> IO Bool   
Checks a property parameterized over five arguments according to the verbose configuration and a name for the test (first argument).
checkPropWithMsg :: String -> IO Bool -> IO (Maybe String)   
Safely checks a property, i.e., catch all exceptions that might occur and return appropriate error message in case of a failed test.
checkPropIOWithMsg :: Config -> String -> PropIO -> IO (Maybe String)   
Safely checks an IO property, i.e., catch all exceptions that might occur and return appropriate error message in case of a failed test.

Exported datatypes:


Config

The configuration of property testing. The configuration contains

  • the maximum number of tests,
  • the maximum number of condition failures before giving up,
  • an operation that shows the number and arguments of each test,
  • a status whether it should work quietly.

Constructors:

  • Config :: Int -> Int -> (Int -> [String] -> String) -> Bool -> Config

    Fields:

    • maxTest :: Int
    • maxFail :: Int
    • every :: (Int -> [String] -> String)
    • isQuiet :: Bool

Exported operations:

setMaxTest :: Int -> Config -> Config   

Sets the maximum number of tests in a test configuration.

Further infos:
  • solution complete, i.e., able to compute all solutions

setMaxFail :: Int -> Config -> Config   

Sets the maximum number of condition failures in a test configuration.

Further infos:
  • solution complete, i.e., able to compute all solutions

easyConfig :: Config   

The default configuration for EasyCheck shows and deletes the number for each test.

verboseConfig :: Config   

A verbose configuration which shows the arguments of every test.

quietConfig :: Config   

A quiet configuration which shows nothing but failed tests.

Properties:

forAllValues n (valuesOf unknown) (suc)

check0 :: Config -> String -> Prop -> IO Bool   

Checks a unit test with a given configuration (first argument) and a name for the test (second argument). Returns a flag whether the test was successful.

Properties:

forAllValues id xs p (forValues)

checkWithValues0 :: Config -> String -> Prop -> IO Bool   

Checks a unit test with a given configuration (first argument) and a name for the test (second argument). Returns a flag whether the test was successful.

checkWithValues1 :: Show a => Config -> String -> [a] -> (a -> Prop) -> IO Bool   

Checks a property parameterized over a single argument with a given configuration (first argument), a name for the test (second argument), and all values given in the third argument. Returns a flag whether the test was successful.

checkWithValues2 :: (Show a, Show b) => Config -> String -> [a] -> [b] -> (a -> b -> Prop) -> IO Bool   

Checks a property parameterized over two arguments with a given configuration (first argument) a name for the test (second argument), and all values given in the third and fourth argument. Returns a flag whether the test was successful.

checkWithValues3 :: (Show a, Show b, Show c) => Config -> String -> [a] -> [b] -> [c] -> (a -> b -> c -> Prop) -> IO Bool   

Checks a property parameterized over three arguments with a given configuration (first argument) a name for the test (second argument), and all values given in the third, fourth and fifth argument. Returns a flag whether the test was successful.

checkWithValues4 :: (Show a, Show b, Show c, Show d) => Config -> String -> [a] -> [b] -> [c] -> [d] -> (a -> b -> c -> d -> Prop) -> IO Bool   

Checks a property parameterized over four arguments with a given configuration (first argument) a name for the test (second argument), and all values given in the further arguments. Returns a flag whether the test was successful.

checkWithValues5 :: (Show a, Show b, Show c, Show d, Show e) => Config -> String -> [a] -> [b] -> [c] -> [d] -> [e] -> (a -> b -> c -> d -> e -> Prop) -> IO Bool   

Checks a property parameterized over five arguments with a given configuration (first argument) a name for the test (second argument), and all values given in the further arguments. Returns a flag whether the test was successful.

check1 :: Show a => Config -> String -> (a -> Prop) -> IO Bool   

Checks a property parameterized over a single argument with a given configuration (first argument) and a name for the test (second argument). Returns a flag whether the test was successful.

check2 :: (Show a, Show b) => Config -> String -> (a -> b -> Prop) -> IO Bool   

Checks a property parameterized over two arguments with a given configuration (first argument) and a name for the test (second argument). Returns a flag whether the test was successful.

check3 :: (Show a, Show b, Show c) => Config -> String -> (a -> b -> c -> Prop) -> IO Bool   

Checks a property parameterized over three arguments with a given configuration (first argument) and a name for the test (second argument). Returns a flag whether the test was successful.

check4 :: (Show a, Show b, Show c, Show d) => Config -> String -> (a -> b -> c -> d -> Prop) -> IO Bool   

Checks a property parameterized over four arguments with a given configuration (first argument) and a name for the test (second argument). Returns a flag whether the test was successful.

check5 :: (Show a, Show b, Show c, Show d, Show e) => Config -> String -> (a -> b -> c -> d -> e -> Prop) -> IO Bool   

Checks a property parameterized over five arguments with a given configuration (first argument) and a name for the test (second argument). Returns a flag whether the test was successful.

easyCheck0 :: String -> Prop -> IO Bool   

Checks a unit test according to the default configuration and a name for the test (first argument). Returns a flag whether the test was successful.

easyCheck1 :: Show a => String -> (a -> Prop) -> IO Bool   

Checks a property parameterized over a single argument according to the default configuration and a name for the test (first argument). Returns a flag whether the test was successful.

easyCheck2 :: (Show a, Show b) => String -> (a -> b -> Prop) -> IO Bool   

Checks a property parameterized over two arguments according to the default configuration and a name for the test (first argument). Returns a flag whether the test was successful.

easyCheck3 :: (Show a, Show b, Show c) => String -> (a -> b -> c -> Prop) -> IO Bool   

Checks a property parameterized over three arguments according to the default configuration and a name for the test (first argument). Returns a flag whether the test was successful.

easyCheck4 :: (Show a, Show b, Show c, Show d) => String -> (a -> b -> c -> d -> Prop) -> IO Bool   

Checks a property parameterized over four arguments according to the default configuration and a name for the test (first argument). Returns a flag whether the test was successful.

easyCheck5 :: (Show a, Show b, Show c, Show d, Show e) => String -> (a -> b -> c -> d -> e -> Prop) -> IO Bool   

Checks a property parameterized over five arguments according to the default configuration and a name for the test (first argument). Returns a flag whether the test was successful.

verboseCheck0 :: String -> Prop -> IO Bool   

Checks a unit test according to the verbose configuration and a name for the test (first argument). Returns a flag whether the test was successful.

verboseCheck1 :: Show a => String -> (a -> Prop) -> IO Bool   

Checks a property parameterized over a single argument according to the verbose configuration and a name for the test (first argument). Returns a flag whether the test was successful.

verboseCheck2 :: (Show a, Show b) => String -> (a -> b -> Prop) -> IO Bool   

Checks a property parameterized over two arguments according to the verbose configuration and a name for the test (first argument). Returns a flag whether the test was successful.

verboseCheck3 :: (Show a, Show b, Show c) => String -> (a -> b -> c -> Prop) -> IO Bool   

Checks a property parameterized over three arguments according to the verbose configuration and a name for the test (first argument). Returns a flag whether the test was successful.

verboseCheck4 :: (Show a, Show b, Show c, Show d) => String -> (a -> b -> c -> d -> Prop) -> IO Bool   

Checks a property parameterized over four arguments according to the verbose configuration and a name for the test (first argument). Returns a flag whether the test was successful.

verboseCheck5 :: (Show a, Show b, Show c, Show d, Show e) => String -> (a -> b -> c -> d -> e -> Prop) -> IO Bool   

Checks a property parameterized over five arguments according to the verbose configuration and a name for the test (first argument). Returns a flag whether the test was successful.

checkPropWithMsg :: String -> IO Bool -> IO (Maybe String)   

Safely checks a property, i.e., catch all exceptions that might occur and return appropriate error message in case of a failed test.

checkPropIOWithMsg :: Config -> String -> PropIO -> IO (Maybe String)   

Safely checks an IO property, i.e., catch all exceptions that might occur and return appropriate error message in case of a failed test. This operation is used by the currycheck tool.