Module "Assertion.curry"

This module defines the datatype and operations for the Curry module tester "currytest".

Author: Michael Hanus

Version: May 2006


 Exported names:

Datatypes:
Assertion | ProtocolMsg

Constructors:
AssertEqual | AssertEqualIO | AssertIO | AssertSolutions | AssertTrue | AssertValues | TestCase | TestCompileError | TestFinished | TestModule

Functions:
checkAssertion | seqStrActions | showTestCase | showTestCompileError | showTestEnd | showTestMod | writeAssertResult


 Summary of exported functions:

seqStrActions  :: IO (String,Bool) -> IO (String,Bool) -> IO (String,Bool)  deterministic 
          Combines two actions and combines their results.
checkAssertion  :: ((String,Bool) -> IO (String,Bool)) -> Assertion a -> IO (String,Bool)  deterministic flexible
          Executes and checks an assertion, and process the result by an I/O action.
writeAssertResult  :: (String,Bool) -> IO ()  deterministic flexible+rigid
          Writes the results of assertion checking into a file and stdout, if the results are non-empty.
showTestMod  :: String -> String -> IO ()  deterministic 
          Sends message to GUI for showing test of a module.
showTestCase  :: String -> (String,Bool) -> IO (String,Bool)  deterministic flexible
          Sends message to GUI for showing result of executing a test case.
showTestEnd  :: String -> IO ()  deterministic 
          Sends message to GUI for showing end of module test.
showTestCompileError  :: String -> IO ()  deterministic 
          Sends message to GUI for showing compilation errors in a module test.

 Imported modules:

AllSolutions
List
Ports
Prelude

 Exported datatypes:

Assertion

Datatype for defining test cases.

Constructors:

AssertTrue :: String -> Bool -> Assertion a

AssertTrue s b - assert (with name s) that b must be true

AssertEqual :: String -> a -> a -> Assertion a

AssertEqual s e1 e2 - assert (with name s) that e1 and e2 must be equal (w.r.t. ==)

AssertValues :: String -> a -> [a] -> Assertion a

AssertValues s e vs - assert (with name s) that vs is the multiset of all values of e (i.e., all values of e are compared with the elements in vs w.r.t. ==)

AssertSolutions :: String -> (a -> Success) -> [a] -> Assertion a

AssertSolutions s c vs - assert (with name s) that constraint abstraction c has the multiset of solutions vs (i.e., the solutions of c are compared with the elements in vs w.r.t. ==)

AssertIO :: String -> (IO a) -> a -> Assertion a

AssertIO s a r - assert (with name s) that I/O action a yields the result value r

AssertEqualIO :: String -> (IO a) -> (IO a) -> Assertion a

AssertEqualIO s a1 a2 - assert (with name s) that I/O actions a1 and a2 yield equal (w.r.t. ==) results


ProtocolMsg

The messages sent to the test GUI. Used by the currytest tool.

Constructors:

TestModule :: String -> ProtocolMsg
TestCase :: String -> Bool -> ProtocolMsg
TestFinished :: ProtocolMsg
TestCompileError :: ProtocolMsg



 Exported functions:

seqStrActions :: IO (String,Bool) -> IO (String,Bool) -> IO (String,Bool)  deterministic 

Combines two actions and combines their results. Used by the currytest tool.

Further infos:
  • defined as left-associative infix operator with precedence 1

checkAssertion :: ((String,Bool) -> IO (String,Bool)) -> Assertion a -> IO (String,Bool)  deterministic flexible

Executes and checks an assertion, and process the result by an I/O action. Used by the currytest tool.

Example call:  (checkAssertion protocol assertion)

Parameters:
protocol - an action to be applied after test execution
assertion - an assertion to be tested
Returns:
a protocol string and a flag whether the test was successful

writeAssertResult :: (String,Bool) -> IO ()  deterministic flexible+rigid

Writes the results of assertion checking into a file and stdout, if the results are non-empty. Used by the currytest tool.


showTestMod :: String -> String -> IO ()  deterministic 

Sends message to GUI for showing test of a module. Used by the currytest tool.

Further infos:
  • might behave indeterministically

showTestCase :: String -> (String,Bool) -> IO (String,Bool)  deterministic flexible

Sends message to GUI for showing result of executing a test case. Used by the currytest tool.

Further infos:
  • might behave indeterministically

showTestEnd :: String -> IO ()  deterministic 

Sends message to GUI for showing end of module test. Used by the currytest tool.

Further infos:
  • might behave indeterministically

showTestCompileError :: String -> IO ()  deterministic 

Sends message to GUI for showing compilation errors in a module test. Used by the currytest tool.

Further infos:
  • might behave indeterministically


Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Aug 28 15:25:34 2008