From 593cace83b3e3c6c6b779f5fc9b11358c1e85d02 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 13 Nov 2017 15:25:24 +0100 Subject: Update introduction assignment 3 --- assignments/assignment3/assignment3.tex | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/assignments/assignment3/assignment3.tex b/assignments/assignment3/assignment3.tex index e3e655f..ec64ee7 100644 --- a/assignments/assignment3/assignment3.tex +++ b/assignments/assignment3/assignment3.tex @@ -6,6 +6,7 @@ \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} @@ -28,12 +29,23 @@ QuickCheck\footnote{\url{http://www.cse.chalmers.se/~rjmh/QuickCheck/}} is a pro 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} -As mentioned above QuickCheck is a property based testing tool. -A property based testing tool, like QuickCheck, can test if certain specifications (a list of properties) of a program/function hold. -This testing is done through generating a large sample of test cases, based on a class known as \mintinline{text}{Arbitrary}. +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 -> [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, like we did in the first assignment, we generate games that are fed to the parser. -However, unlike the first assignment, the PGN games that are generated this time, are generated by QuickCheck and are thus completely random. +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} -- cgit v1.2.3