<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[british]{scrartcl}

\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage{enumerate}
\usepackage[hidelinks]{hyperref}
\usepackage{minted}
\setminted{fontsize=\small,breaklines,breakanywhere,tabsize=4}
\newmintinline[hs]{haskell}{style=bw}
\usepackage{caption}
\newenvironment{longlisting}{\captionsetup{type=listing}}{}
\usepackage{tikz}
\usetikzlibrary{arrows, matrix, positioning}
\usepackage{cleveref}

\let\oldurl\url
\def\url#1{{\small\oldurl{#1}}}

\title{Model-Based Testing with QuickCheck}
\subtitle{Testing \texttt{chesshs} with QuickCheck}
\author{Ren\'e den Hertog \and Camil Staps \and Erin van der Veen}

\begin{document}

\maketitle

\section{QuickCheck}
QuickCheck\footnote{\url{http://www.cse.chalmers.se/~rjmh/QuickCheck/}} is a property based testing tool initially created for Haskell.
Given that our SUT is a Haskell library and that QuickCheck is recommended in the assignment, using QuickCheck is nothing but a logical consequence.

\section{Modelling}
We decide to test the move verification functionality and not the parser.
The reason for this is that the parser is less well-defined, as we saw in our previous assignment.
Also, it seems relatively easy to break the parser, so we would prefer to fix the obvious problems before applying automated testing.
Lastly, the move verification functionality is more interesting because of the larger search space and complexity.

As mentioned above, QuickCheck is a property based testing tool.
A property based testing tool can test if certain specifications (a list of properties) of a program/function hold.
This is done through generating a large sample of test cases.

In QuickCheck, test cases are generated with the \hs{Arbitrary} class.
This class implements has two members, \hs{arbitrary :: Gen a} and \hs{shrink :: a -&gt; [a]}.
The first generates random, usually large, test cases.
When a counter-example is found, QuickCheck uses \hs{shrink} to find a minimal counter-example by shrinking the known counter-example while preserving the inconsistency.

The above implies that a model of the system is given using a specification.
In our case, the model is a collection of predicates which should hold.
We compile a test program with \texttt{chesshs} and QuickCheck and run it.
So, unlike in assignment 1, we do not use a wrapper.

\end{document}
</pre></body></html>