Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 35 lines (29 sloc) 1.328 kB
041e7a2 @daxim add tests
daxim authored
1 import TAP
2 -- http://testanything.org/wiki/index.php/HaskellTapModule
3 -- http://svn.solucorp.qc.ca/repos/solucorp/JTap/trunk/TAP.hs
4 import Mastermind
5
6 main = runTests $ do
060286c @epsilonhalbe fixed my brainlag of implementing the wrong rules ;-)
authored
7 planTests 10
041e7a2 @daxim add tests
daxim authored
8
9 let list_of_randoms = [2,2,3,5]
10
060286c @epsilonhalbe fixed my brainlag of implementing the wrong rules ;-)
authored
11 is (reds [2,2,3,4] list_of_randoms) [0,0,0] $
12 Just "correct number and position"
13 is (reds [] list_of_randoms) [] $
14 Just "correct num and pos - fringe case: []"
15 is (reds [2,2,2,2,2] list_of_randoms) [0,0] $
16 Just "correct num and pos - fringe case:\
17 \input list longer than list_of_randoms"
722f8a0 @epsilonhalbe added 'real' random, saveguarded the user input
authored
18
060286c @epsilonhalbe fixed my brainlag of implementing the wrong rules ;-)
authored
19 is (whites [1,4,2,2] list_of_randoms) [1,1] $
20 Just "correct number, but wrong position"
21 is (whites [] list_of_randoms) [] $
22 Just "correct num, wrong pos - fringe case: []"
23 is (whites [1,1,2,2,2] list_of_randoms) [1,1] $
24 Just "correct num, wrong pos - fringe case:\
25 \input list longer than list_of_randoms"
26 is (whites [1,2,1,1,1] [2,1,2,2,2]) [1,1] $ Just "testing the rules"
722f8a0 @epsilonhalbe added 'real' random, saveguarded the user input
authored
27
060286c @epsilonhalbe fixed my brainlag of implementing the wrong rules ;-)
authored
28 is (parseInts "1,2,3,4,5") [1,2,3,4,5] $
29 Just "fetch number list from user input"
30 is (parseInts "") [] $
31 Just "fetch number list from user input - fringe case: \"\""
32 is (parseInts "a,b,c,1,2,3") [1,2,3] $
33 Just "fetch number list from user input -\
34 \fringe case: letters in string"
Something went wrong with that request. Please try again.