Permalink
Browse files

add tests

  • Loading branch information...
1 parent 43efbe5 commit 041e7a2075ed08c6cd0578bf8a417d2f0dc3cad9 @daxim daxim committed Apr 4, 2011
Showing with 29 additions and 2 deletions.
  1. +2 −0 .gitignore
  2. +15 −2 Makefile
  3. +12 −0 mm.t.hs
View
@@ -1,3 +1,5 @@
*.hi
*.o
Mastermind
+mm.t
+report.html
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
View
12 mm.t.hs
@@ -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"

0 comments on commit 041e7a2

Please sign in to comment.