Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add tests

  • Loading branch information...
commit 041e7a2075ed08c6cd0578bf8a417d2f0dc3cad9 1 parent 43efbe5
Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 daxim authored
Showing with 29 additions and 2 deletions.
  1. +2 −0  .gitignore
  2. +15 −2 Makefile
  3. +12 −0 mm.t.hs
2  .gitignore
View
@@ -1,3 +1,5 @@
*.hi
*.o
Mastermind
+mm.t
+report.html
17 Makefile
View
@@ -1,5 +1,18 @@
all :
ghc --make -Wall Mastermind.hs
-clean :
- rm -f Mastermind Mastermind.hi Mastermind.o
+clean :
+ rm -f Mastermind mm.t *.hi *.o report.html
+
+test :
+ ghc --make -Wall mm.t.hs
+ ./mm.t
+
+prove :
+# cpan App::Prove
+ prove --exec make test
+
+
+provehtml :
+# cpan App::Prove::Plugin::HTML
+ prove -P HTML=outfile:report.html --exec make test
12 mm.t.hs
View
@@ -0,0 +1,12 @@
+import TAP
+-- http://testanything.org/wiki/index.php/HaskellTapModule
+-- http://svn.solucorp.qc.ca/repos/solucorp/JTap/trunk/TAP.hs
+import Mastermind
+
+main = runTests $ do
+ planTests 2
+
+ let list_of_randoms = [2,2,3,5]
+
+ is (reds [2,2,3,4] list_of_randoms) [0,0,0] $ Just "correct number and position"
+ is (whites [1,4,2,2] list_of_randoms) [1,1] $ Just "correct number, but wrong position"
Please sign in to comment.
Something went wrong with that request. Please try again.