summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ArbitraryMove.hs12
-rw-r--r--test/Makefile12
2 files changed, 10 insertions, 14 deletions
diff --git a/test/ArbitraryMove.hs b/test/ArbitraryMove.hs
index e786a68..4c6fb48 100644
--- a/test/ArbitraryMove.hs
+++ b/test/ArbitraryMove.hs
@@ -19,15 +19,7 @@ instance Arbitrary Board where arbitrary = return defaultBoard
type Move = String
arbitraryMove :: Gen Move
-arbitraryMove = frequency
- [ (2, probableArbitraryMove)
- --, (1, invalidMove)
- ]
- where
- invalidMove :: Gen Move
- invalidMove = oneof
- [ liftM2 (\r c -> [r,c]) (choose ('i', 'z')) (elements "09")
- ]
+arbitraryMove = probableArbitraryMove
instance Arbitrary PGN
where
@@ -69,7 +61,7 @@ instance Arbitrary PGN
- on a set of PGN games, e.g. from http://theweekinchess.com/twic.
-}
-probableArbitraryMove :: Gen String
+probableArbitraryMove :: Gen Move
probableArbitraryMove = frequency $ map (return <$>)
[ (8, "a1=B")
, (2, "a1=B+")
diff --git a/test/Makefile b/test/Makefile
index 3b9b4a7..ba62dab 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -7,21 +7,25 @@ AUX:=$(addsuffix .o, $(EXE) $(DEP))\
SRC:=$(addsuffix .hs,$(DEP))
GHC:=ghc
GHCFLAGS:=-O -main-is Test.main
+DATA:=dataset.pgn
-.PHONY=all data run clean
+.PHONY=all run clean
all: $(EXE)
-dataset.pgn:
+$(DATA):
for i in $$(seq 1000 1020); do wget -q http://www.theweekinchess.com/zips/twic$${i}g.zip; unzip -q twic$${i}g.zip; rm twic$${i}g.zip; done
cat twic*.pgn > $@
$(RM) twic*.pgn
-run: $(EXE)
- ./$(EXE) < dataset.pgn
+run: $(EXE) $(DATA)
+ ./$(EXE) < $(DATA)
$(EXE): %: %.hs $(SRC)
$(GHC) $(GHCFLAGS) $< -o $@
clean:
$(RM) $(EXE) $(AUX)
+
+distclean: clean
+ $(RM) $(DATA)