Commit 313dd2c1 authored by Michael Hanus 's avatar Michael Hanus
Browse files

Manual updated

parent 4f4f7ea6
\section{\texttt{curry check}: A Tool for Testing Properties of Curry Programs}
\section{CurryCheck: A Tool for Testing Properties of Curry Programs}
CurryCheck\index{CurryCheck}\index{testing programs}\index{program!testing}
......@@ -14,6 +14,22 @@ by combinators proposed for EasyCheck, which are actually
influenced by QuickCheck \cite{ClaessenHughes00}
but extended to the demands of functional logic programming.
The current implementation of CurryCheck is a package
managed by the Curry Package Manager CPM.
Thus, to install the newest version of CurryCheck, use the following commands:
> cypm update
> cypm install currycheck
This downloads the newest package, compiles it, and places
the executable \code{curry-check} into the directory \code{\$HOME/.cpm/bin}.
Hence it is recommended to add this directory to your path
in order to execute CurryCheck as described below.
\subsection{Testing Properties}
To start with a concrete example, consider the following naive definition of
......@@ -68,7 +84,7 @@ Now we can run all tests by invoking the CurryCheck tool.
If our program is stored in the file \code{Rev.curry},
we can execute the tests as follows:
> curry check Rev
> curry-check Rev
Executing all tests...
revNull (module Rev, line 7):
......@@ -91,12 +107,12 @@ where \code{Prop} denotes the type of a test:
revRevIsId :: [Int] -> Prop
revRevIsId xs = rev (rev xs) -=- xs
The command \code{curry check} has some options to influence
The command \code{curry-check} has some options to influence
the output, like \ccode{-q} for a quiet execution
(only errors and failed tests are reported) or
\ccode{-v} for a verbose execution where all generated test cases
are shown.
Moreover, the return code of \code{curry check} is \code{0}
Moreover, the return code of \code{curry-check} is \code{0}
in case of successful tests, otherwise, it is \code{1}.
Hence, CurryCheck can be easily integrated in tool chains
for automatic testing.
......@@ -217,7 +233,7 @@ permIsEventuallySorted xs = eventually $\code{\$}$ sorted (perm xs)
The previous operations can be exploited to provide
a high-level specification of sorting a list:
psort :: [Int] -> [Int}
psort :: [Int] -> [Int]
psort xs | sorted ys = ys
where ys = perm xs
......@@ -241,7 +257,7 @@ qsortIsSorting xs = qsort xs <~> psort xs
Actually, if we test this property, we obtain a failure:
> curry check ExampleTests
> curry-check ExampleTests
qsortIsSorting (module ExampleTests, line 53) failed
Falsified by third test.
......@@ -284,7 +300,7 @@ neg_or b1 b2 = not (b1 || b2) -=- not b1 && not b2
This property is validated by checking it with all possible values:
> curry check -v ExampleTests
> curry-check -v ExampleTests
......@@ -309,7 +325,7 @@ by the command-line flag \ccode{-m}. For instance, to test
each property with 200 tests, CurryCheck can be invoked by
> curry check -m 200 ExampleTests
> curry-check -m 200 ExampleTests
For a given type, CurryCheck automatically enumerates all values
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment