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: January 2024
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
:: (Data a, 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
:: (Data a, Show a, Data b, 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
:: (Data a, Show a, Data b, Show b, Data c, 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
:: (Data a, Show a, Data b, Show b, Data c, Show c, Data d, 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
:: (Data a, Show a, Data b, Show b, Data c, Show c, Data d, Show d, Data e, 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
:: (Data a, 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
:: (Data a, Show a, Data b, 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
:: (Data a, Show a, Data b, Show b, Data c, 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
:: (Data a, Show a, Data b, Show b, Data c, Show c, Data d, 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
:: (Data a, Show a, Data b, Show b, Data c, Show c, Data d, Show d, Data e, 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
:: (Data a, 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
:: (Data a, Show a, Data b, 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
:: (Data a, Show a, Data b, Show b, Data c, 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
:: (Data a, Show a, Data b, Show b, Data c, Show c, Data d, 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
:: (Data a, Show a, Data b, Show b, Data c, Show c, Data d, Show d, Data e, 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. |
The configuration of property testing. The configuration contains
Constructors:
Config
:: Int -> Int -> (Int -> [String] -> String) -> Bool -> Config
Fields:
maxTest
:: Int
maxFail
:: Int
every
:: (Int -> [String] -> String)
isQuiet
:: Bool
Sets the maximum number of tests in a test configuration.
|
Sets the maximum number of condition failures in a test configuration.
|
The default configuration for EasyCheck shows and deletes the number for each test. |
A verbose configuration which shows the arguments of every test. |
A quiet configuration which shows nothing but failed tests.
|
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.
|
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
Safely checks a property, i.e., catch all exceptions that might occur and return appropriate error message in case of a failed test. |
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. |