]> git.sesse.net Git - pgn-extract/blob - test/Makefile
Push through a computer/human flag to the binary output.
[pgn-extract] / test / Makefile
1 # Makefile to run a battery of tests of the basic functionality of pgn-extract.
2 # Copyright (C) David J. Barnes, 2013
3 #
4 # Each test is run and then, where relevant, a comparison is made between
5 # the output files generated in the current directory and the 'oracle'
6 # files that exist in $(OUTPUT).
7 #
8 # Beware of case-insensitive filenames when testing flags that
9 # differ only in letter case. In general, double letters have been
10 # used for output-files generated from using upper-case flag letters.
11
12 PGN_EXTRACT=../pgn-extract
13 # Use for memory checking if valgrind is installed.
14 #PGN_EXTRACT=valgrind --dsymutil=yes ../pgn-extract
15
16 # Location of the file of ECO classifications.
17 ECO_FILE=../eco.pgn
18
19 # Location of the input files
20 INPUT=infiles
21 # Location of the oracle output files
22 OUTPUT=outfiles
23
24 # Test everything.
25 all: no-flags-1 no-flags-2 test-7 test-append test-AA test-bl45 \
26      test-bu45 test-bu30 test-checkfile test-nocomments test-duplicates \
27      test-noduplicates test-e test-EE test-f test-FF test-h test-l \
28      test-LL test-checkmate test-n test-NN test-output test-PP test-r \
29      test-RR test-s test-SS test-t test-TT test-nounique test-v \
30      test-VV test-linelength test-WW test-x test-ZZ test-z test-hash \
31      test-evaluation test-fencomments test-markmatches test-nochecks \
32      test-nomovenumbers test-noresults test-notags test-plylimit \
33      test-stalemate test-long-line test-totalplycount test-addhashcode \
34      test-selectonly
35
36 # BEWARE: This removes all PGN files in the current directory.
37 # The required test PGN files are assumed to be in $(INPUT).
38 clean:
39         -rm *.pgn *og.txt
40
41 # No flags:
42 #     + No input file.
43 #     - Input file(s): N/A
44 #     - Example input:
45 #       f3 e5 g4 Qh4 0-1
46 #     - Resulting output should be that the game input on standard input is
47 #       formatted as PGN on standard output.
48 #     - Expected output: 
49 #       Contents of fools-mate.pgn on standard output.
50 no-flags-1:
51         echo "test: No input file."
52         $(PGN_EXTRACT) < $(INPUT)/fools-mate.txt
53
54 # No flags:
55 #     + Single input file
56 #     - Input file(s): fools-mate.txt
57 #     - Resulting output should be the input formatted as PGN on standard output.
58 #     - Expected output: Contents of fools-mate.pgn should appear on standard output.
59 no-flags-2:
60         echo "test: No flags."
61         $(PGN_EXTRACT) $(INPUT)/fools-mate.txt
62
63 # -7 / --seven
64 #     + Input file with games having tags additional to the seven tag roster.
65 #     - Input file(s): test-7.pgn
66 #     - Game output should have only the tags of the seven tag roster.
67 #     - Expected output: test-7-out.pgn
68 test-7:
69         echo "test-7:"
70         $(PGN_EXTRACT) -7 -otest-7-out.pgn $(INPUT)/test-7.pgn
71         -cmp test-7-out.pgn $(OUTPUT)/test-7-out.pgn
72
73 # -a / --append
74 #     + Input file containing games in any accepted format.
75 #     - Input file(s): test-a.txt
76 #     - Resulting output should contain two versions of the input game
77 #       formatted in PGN. The --output command is run first to create
78 #       a new file, then the -a version to append to that file.
79 #     - Expected output: test-a-out.pgn
80 test-append:
81         echo "test-append:"
82         $(PGN_EXTRACT) --output test-a-out.pgn $(INPUT)/test-a.txt
83         $(PGN_EXTRACT) -atest-a-out.pgn $(INPUT)/test-a.txt
84         -cmp test-a-out.pgn $(OUTPUT)/test-a-out.pgn
85
86         $(PGN_EXTRACT) --output test-a-out.pgn $(INPUT)/test-a.txt
87         $(PGN_EXTRACT) --append test-a-out.pgn $(INPUT)/test-a.txt
88         -cmp test-a-out.pgn $(OUTPUT)/test-a-out.pgn
89
90 # -A
91 #     + Input file containing games and a file of arguments.
92 #     - Input file(s): fischer.pgn, petrosian.pgn, arglist.txt
93 #     - Resulting output should be files separating the unique and
94 #       duplicated games in the input files.
95 #     - Expected output: test-AA-unique.pgn, test-AA-dupes.pgn
96 test-AA:
97         echo "test-A:"
98         $(PGN_EXTRACT) -A$(INPUT)/argslist.txt
99         -cmp test-AA-dupes.pgn $(OUTPUT)/test-AA-dupes.pgn
100         -cmp test-AA-unique.pgn $(OUTPUT)/test-AA-unique.pgn
101
102 # -b
103 #     + Input file containing games of different length.
104 #     - Input file(s): fischer.pgn
105 #     - Resulting output: games whose number of moves is within
106 #       the specified bounds.
107
108 test-b: test-bl45 test-bu45 test-bu30
109
110 #     - Expected output: 45 moves or more: test-bl45-out.pgn
111 test-bl45:
112         echo "test-b:"
113         $(PGN_EXTRACT) -bl45 -s -otest-bl45-out.pgn $(INPUT)/fischer.pgn
114         -cmp test-bl45-out.pgn $(OUTPUT)/test-bl45-out.pgn
115
116 #     - Expected output: 45 moves or less: test-bu45-out.pgn
117 test-bu45:
118         echo "test-b:"
119         $(PGN_EXTRACT) -bu45 -s -otest-bu45-out.pgn $(INPUT)/fischer.pgn
120         -cmp test-bu45-out.pgn $(OUTPUT)/test-bu45-out.pgn
121
122 #     - Expected output: exactly 30 moves: test-b30-out.pgn
123 test-bu30:
124         echo "test-b:"
125         $(PGN_EXTRACT) -b30 -s -otest-b30-out.pgn $(INPUT)/fischer.pgn
126         -cmp test-b30-out.pgn $(OUTPUT)/test-b30-out.pgn
127
128
129 # -c / --checkfile
130 #     + Input files containing games.
131 #     - Input file(s): fischer.pgn, petrosian.pgn
132 #     - Resulting output should contain matched games that do not already occur in
133 #       the check file.
134 #     - Expected output: test-c-out.pgn
135 test-checkfile:
136         echo "test-checkfile:"
137         $(PGN_EXTRACT) -c$(INPUT)/petrosian.pgn -D -TpPetrosian -otest-c-out.pgn $(INPUT)/fischer.pgn
138         -cmp test-c-out.pgn $(OUTPUT)/test-c-out.pgn
139         $(PGN_EXTRACT) -c$(INPUT)/clist.txt -D -TpPetrosian -otest-c-out.pgn $(INPUT)/fischer.pgn
140         -cmp test-c-out.pgn $(OUTPUT)/test-c-out.pgn
141
142 # -C / --nocomments
143 #     + Input file containing games with comments
144 #     - Input file(s): test-C.pgn
145 #     - Resulting output should have all comments removed.
146 #     - Expected output: test-CC-out.pgn
147 test-nocomments:
148         echo "test-nocomments:"
149         $(PGN_EXTRACT) -C -otest-CC-out.pgn $(INPUT)/test-C.pgn
150         -cmp test-CC-out.pgn $(OUTPUT)/test-CC-out.pgn
151
152 # -d / --duplicates
153 #     + Input file containing games with duplicates and non-duplicates.
154 #     - Input file(s): fischer.pgn, $(INPUT)/petrosian.pgn
155 #     - Resulting output should be files separating the unique and
156 #       duplicated games in the input files.
157 #     - Expected output: test-d-unique.pgn, test-d-dupes.pgn
158 test-duplicates:
159         echo "test-duplicates:"
160         $(PGN_EXTRACT) -dtest-d-dupes.pgn -s -otest-d-unique.pgn $(INPUT)/fischer.pgn $(INPUT)/petrosian.pgn
161         -cmp test-d-dupes.pgn $(OUTPUT)/test-d-dupes.pgn
162         -cmp test-d-unique.pgn $(OUTPUT)/test-d-unique.pgn
163
164 # -D / --noduplicates
165 #     + Input file containing games with duplicates and non-duplicates.
166 #     - Input file(s): fischer.pgn, $(INPUT)/petrosian.pgn
167 #     - Resulting output should be a file containing the combined input
168 #       with duplicate games removed.
169 #     - Expected output: test-DD-unique.pgn
170 test-noduplicates:
171         echo "test-noduplicates:"
172         $(PGN_EXTRACT) -D -s -otest-DD-unique.pgn $(INPUT)/fischer.pgn $(INPUT)/petrosian.pgn
173         -cmp test-DD-unique.pgn $(OUTPUT)/test-DD-unique.pgn
174         $(PGN_EXTRACT) --noduplicates -s -otest-DD-unique.pgn $(INPUT)/fischer.pgn $(INPUT)/petrosian.pgn
175         -cmp test-DD-unique.pgn $(OUTPUT)/test-DD-unique.pgn
176
177 # -e
178 #     + Input file containing games without ECO classifications.
179 #     - Input file(s): test-e.pgn and eco.pgn in the test folder.
180 #     - Resulting output should have ECO classification added to the tags.
181 #     - Expected output: test-e-out.pgn
182 test-e:
183         echo "test-e:"
184         $(PGN_EXTRACT) -e$(ECO_FILE) -otest-e-out.pgn $(INPUT)/test-e.pgn
185         -cmp test-e-out.pgn $(OUTPUT)/test-e-out.pgn
186
187 # -E
188 #     + Input file containing games.
189 #     - Input file(s): test-E.pgn and eco.pgn if -e flag is used.
190 #     - Resulting output should be separate files for each ECO classification
191 #       at the level of the initial letter (A-E).
192 #     - Expected output: A.pgn, B.pgn, E.pgn
193 test-EE:
194         echo "test-E:"
195         $(PGN_EXTRACT) -e$(ECO_FILE) -E1 $(INPUT)/test-E.pgn
196         -cmp A.pgn $(OUTPUT)/A.pgn
197         -cmp B.pgn $(OUTPUT)/B.pgn
198         -cmp E.pgn $(OUTPUT)/E.pgn
199
200 # -f
201 #     + Input files containing games.
202 #     - Input file(s): test-f1.pgn, test-f2.pgn, files.txt
203 #     - Resulting output should be the combination of the input files.
204 #     - Expected output: test-f-out.pgn
205 test-f:
206         echo "test-f:"
207         $(PGN_EXTRACT) -f$(INPUT)/files.txt -otest-f-out.pgn
208         -cmp test-f-out.pgn $(OUTPUT)/test-f-out.pgn
209
210 # -F:
211 #     + Input file containing games without a trailing FEN comment.
212 #     - Input file(s): test-F.pgn
213 #     - Resulting output should have a comment at the end containing
214 #       the FEN description of the final position.
215 #     - Expected output: test-FF-out.pgn
216 test-FF:
217         echo "test-F:"
218         $(PGN_EXTRACT) -F -otest-FF-out.pgn $(INPUT)/test-F.pgn
219         -cmp test-FF-out.pgn $(OUTPUT)/test-FF-out.pgn
220
221
222 # -h / -? / --help
223 #     + No input required.
224 #     - Input file(s): N/A
225 #     - Resulting output should be a description of how to use pgn-extract
226 #     - Expected output: N/A
227 # Also:
228 #       ../pgn-extract -?
229 #       ../pgn-extract --help
230 test-h:
231         echo "test-h:"
232         -$(PGN_EXTRACT) -h
233
234 # -l
235 #     + Input file containing games.
236 #     - Input file(s): fischer.pgn
237 #     - Resulting output: List of games parsed written to log.txt
238 #     - Expected output: log.txt
239 test-l:
240         echo "test-l:"
241         $(PGN_EXTRACT) -llog.txt -otest-l-out.pgn $(INPUT)/fischer.pgn
242         -cmp log.txt $(OUTPUT)/log.txt
243         -cmp test-l-out.pgn $(OUTPUT)/test-l-out.pgn
244
245 # -L
246 #     + Input file containing games.
247 #     - Input file(s): test-L1.pgn, test-L2.pgn
248 #     - Resulting output should be that log.txt contains the combined
249 #       logs from two runs of pgn-extract.
250 #     - Expected output: log.txt
251 test-LL:
252         echo "test-L:"
253         $(PGN_EXTRACT) -lLLog.txt -r $(INPUT)/test-L1.pgn
254         $(PGN_EXTRACT) -LLLog.txt -r $(INPUT)/test-L2.pgn
255         -cmp LLog.txt $(OUTPUT)/LLog.txt
256
257 # -M / --checkmate
258 #     + Input file containing games.
259 #     - Input file(s): test-checkmate.pgn
260 #     - Resulting output should contain only those games that end in checkmate.
261 #     - Expected output: test-checkmate-out.pgn
262 test-checkmate:
263         echo "test-checkmate:"
264         $(PGN_EXTRACT) --checkmate -otest-checkmate-out.pgn $(INPUT)/test-checkmate.pgn
265         -cmp test-checkmate-out.pgn $(OUTPUT)/test-checkmate-out.pgn
266
267 # -n
268 #     + Input file containing games.
269 #     - Input file(s): petrosian.pgn
270 #     - Resulting output should be separate files containing matched
271 #       and non-matched games.
272 #     - Expected output: test-n-matched.pgn, test-n-unmatched.pgn
273 test-n:
274         echo "test-n:"
275         $(PGN_EXTRACT) -TpFischer -otest-n-matched.pgn -ntest-n-unmatched.pgn $(INPUT)/petrosian.pgn
276         -cmp test-n-matched.pgn $(OUTPUT)/test-n-matched.pgn
277         -cmp test-n-unmatched.pgn $(OUTPUT)/test-n-unmatched.pgn
278
279 # -N / --nonags
280 #     + Input file containing games with NAGs.
281 #     - Input file(s): test-N.pgn
282 #     - Resulting output should have all NAGs removed.
283 #     - Expected output: test-NN-out.pgn
284 test-NN:
285         echo "test-N:"
286         $(PGN_EXTRACT) -N -otest-NN-out.pgn $(INPUT)/test-N.pgn
287         -cmp test-NN-out.pgn $(OUTPUT)/test-NN-out.pgn
288
289
290 # -o / --output
291 #     + Input file containing games in any accepted format.
292 #     - Input file(s): test-o.txt
293 #     - Resulting output should contain the input game formatted in PGN.
294 #     - Expected output: test-o-out.pgn
295 test-output:
296         echo "test-output:"
297         $(PGN_EXTRACT) -otest-o-out.pgn $(INPUT)/test-o.txt
298         -cmp test-o-out.pgn $(OUTPUT)/test-o-out.pgn
299         $(PGN_EXTRACT) --output test-o-out.pgn $(INPUT)/test-o.txt
300         -cmp test-o-out.pgn $(OUTPUT)/test-o-out.pgn
301
302 # -P
303 #     + Input file containing games with different sequences for the same
304 #       opening.
305 #     - Input file(s): test-P.pgn, Pvars.txt
306 #     - Resulting output should be games whose opening move exactly match
307 #       the sequence specified in Pvars.txt
308 #     - Expected output: test-PP-out.pgn
309 test-PP:
310         echo "test-P:"
311         $(PGN_EXTRACT) -P -v$(INPUT)/Pvars.txt -otest-PP-out.pgn $(INPUT)/test-P.pgn
312         -cmp test-PP-out.pgn $(OUTPUT)/test-PP-out.pgn
313
314 # -r
315 #     + Input file containing games in any accepted format.
316 #     - Input file(s): test-r.text
317 #     - Resulting output should contain tag summary lines for the games
318 #       matched and a report of any errors.
319 #     - Expected output: test-r-log.txt
320 test-r:
321         echo "test-r:"
322         $(PGN_EXTRACT) -r -ltest-r-log.txt $(INPUT)/test-r.txt
323         -cmp test-r-log.txt $(OUTPUT)/test-r-log.txt
324
325 # -R
326 #     + Input file containing games.
327 #     - Input file(s): test-R.pgn, roster.txt
328 #     - Resulting output should contain games with their tag roster in
329 #       the order specified in roster.txt
330 #     - Expected output: test-R-out.pgn
331 test-RR:
332         echo "test-R:"
333         $(PGN_EXTRACT) -R$(INPUT)/roster.txt --output test-RR-out.pgn $(INPUT)/test-R.pgn
334         -cmp test-RR-out.pgn $(OUTPUT)/test-RR-out.pgn
335
336 # -s
337 #     + Input file containing games.
338 #     - Input file(s): test-s.pgn
339 #     - Resulting output should be silent, with games written to the output file.
340 #     - Expected output: test-s-out.pgn
341 test-s:
342         echo "test-s:"
343         $(PGN_EXTRACT) -s -o test-s-out.pgn $(INPUT)/test-s.pgn
344         -cmp test-s-out.pgn $(OUTPUT)/test-s-out.pgn
345
346 # -S
347 #     + Input file containing games whose players' names have slight
348 #       sound variations from anglesized versions.
349 #     - Input file(s): test-S.pgn
350 #     - Resulting output should be games that match by ignoring slight
351 #       soundex differences.
352 #     - Expected output: test-S-out.pgn
353 test-SS:
354         echo "test-S:"
355         $(PGN_EXTRACT) -S -TpPetrosian -otest-SS-out.pgn $(INPUT)/test-S.pgn
356         -cmp test-SS-out.pgn $(OUTPUT)/test-SS-out.pgn
357
358 # -t
359 #     + Input file containing games and a file of tag criteria.
360 #     - Input file(s): test-t.pgn, taglist.txt
361 #     - Resulting output should be only those games whose tags match
362 #       all of the criteria.
363 #     - Expected output: test-t-out.pgn
364 test-t:
365         echo "test-t:"
366         $(PGN_EXTRACT) -t$(INPUT)/taglist.txt -otest-t-out.pgn $(INPUT)/test-t.pgn
367         -cmp test-t-out.pgn $(OUTPUT)/test-t-out.pgn
368
369 # -T
370 #     + Input file containing games with tag information.
371 #     - Input file(s): fischer.pgn, test-Ta.pgn (and eco.pgn for -Te test.)
372 #     - Resulting output should contain only those games whose tag information
373 #       matches that specified.
374 #     - Expected output: test-Ta-out.pgn, test-Tb-out.pgn, test-Td-out.pgn,
375 #                        test-Tdd-out.pgn test-Te-out.pgn, test-Tp-out.pgn,
376 #                        test-Tw-out.pgn
377 test-TT:
378         echo "test-T:"
379         $(PGN_EXTRACT) -Td1970 -s -otest-TTd-out.pgn $(INPUT)/fischer.pgn
380         -cmp test-TTd-out.pgn $(OUTPUT)/test-TTd-out.pgn
381         $(PGN_EXTRACT) -Td1960 -Td1962 -s -otest-TTdd-out.pgn $(INPUT)/fischer.pgn
382         -cmp test-TTdd-out.pgn $(OUTPUT)/test-TTdd-out.pgn
383         $(PGN_EXTRACT) -TbPetrosian -s -otest-TTb-out.pgn $(INPUT)/fischer.pgn
384         -cmp test-TTb-out.pgn $(OUTPUT)/test-TTb-out.pgn
385         $(PGN_EXTRACT) -e$(ECO_FILE) -TeB14 -s -otest-Te-out.pgn $(INPUT)/fischer.pgn
386         $(PGN_EXTRACT) -TpPetrosian -s -otest-TTp-out.pgn $(INPUT)/fischer.pgn
387         -cmp test-TTp-out.pgn $(OUTPUT)/test-TTp-out.pgn
388         $(PGN_EXTRACT) -Tr0-1 -s -otest-TTr-out.pgn $(INPUT)/fischer.pgn
389         -cmp test-TTr-out.pgn $(OUTPUT)/test-TTr-out.pgn
390         $(PGN_EXTRACT) -TwFischer -s -otest-TTw-out.pgn $(INPUT)/fischer.pgn
391         -cmp test-TTw-out.pgn $(OUTPUT)/test-TTw-out.pgn
392         $(PGN_EXTRACT) -TaBarnes -s -otest-TTa-out.pgn $(INPUT)/test-Ta.pgn
393         -cmp test-TTa-out.pgn $(OUTPUT)/test-TTa-out.pgn
394
395 # -U / --nounique
396 #     + Input file containing games with duplicates and non-duplicates.
397 #     - Input file(s): fischer.pgn, petrosian.pgn
398 #     - Resulting output should be a file containing just the duplicate games.
399 #     - Expected output: test-U-unique.pgn
400 test-nounique:
401         echo "test-nounique:"
402         $(PGN_EXTRACT) -U -s -otest-UU-unique.pgn $(INPUT)/fischer.pgn $(INPUT)/petrosian.pgn
403         -cmp test-UU-unique.pgn $(OUTPUT)/test-UU-unique.pgn
404         $(PGN_EXTRACT) --nounique -s -otest-UU-unique.pgn $(INPUT)/fischer.pgn $(INPUT)/petrosian.pgn
405         -cmp test-UU-unique.pgn $(OUTPUT)/test-UU-unique.pgn
406
407 # -v
408 #     + Input file containing games.
409 #     - Input file(s): najdorf.pgn, vvars.txt
410 #     - Resulting output should be only those games whose opening moves
411 #       textually match (in any order) the moves in vars.txt.
412 #     - Expected output: test-v-out.pgn
413 test-v:
414         echo "test-v:"
415         $(PGN_EXTRACT) -v$(INPUT)/vvars.txt -otest-v-out.pgn $(INPUT)/najdorf.pgn
416         -cmp test-v-out.pgn $(OUTPUT)/test-v-out.pgn
417
418 # -V
419 #     + Input file containing games with variations
420 #     - Input file(s): test-V.pgn
421 #     - Resulting output should have all variations removed.
422 #     - Expected output: test-V-out.pgn
423 test-VV:
424         echo "test-V:"
425         $(PGN_EXTRACT) -V -otest-VV-out.pgn $(INPUT)/test-V.pgn
426         -cmp test-VV-out.pgn $(OUTPUT)/test-VV-out.pgn
427
428 # -w / --linelength
429 #     + Input file containing games.
430 #     - Input file(s): test-w.pgn
431 #     - Resulting output Games formatted up to the specified line length.
432 #       The default is 75.
433 #     - Expected output: test-w60-out.pgn, test-w75-out.pgn, test-w1000-out.pgn
434 test-linelength:
435         echo "test-linelength:"
436         $(PGN_EXTRACT) -w60 -otest-w60-out.pgn $(INPUT)/test-w.pgn
437         -cmp test-w60-out.pgn $(OUTPUT)/test-w60-out.pgn
438         $(PGN_EXTRACT) -w75 -otest-w75-out.pgn $(INPUT)/test-w.pgn
439         -cmp test-w75-out.pgn $(OUTPUT)/test-w75-out.pgn
440         $(PGN_EXTRACT) -w1000 -otest-w1000-out.pgn $(INPUT)/test-w.pgn
441         -cmp test-w1000-out.pgn $(OUTPUT)/test-w1000-out.pgn
442
443         $(PGN_EXTRACT) --linelength 60 -otest-w60-out.pgn $(INPUT)/test-w.pgn
444         -cmp test-w60-out.pgn $(OUTPUT)/test-w60-out.pgn
445         $(PGN_EXTRACT) --linelength 75 -otest-w75-out.pgn $(INPUT)/test-w.pgn
446         -cmp test-w75-out.pgn $(OUTPUT)/test-w75-out.pgn
447         $(PGN_EXTRACT) --linelength 1000 -otest-w1000-out.pgn $(INPUT)/test-w.pgn
448         -cmp test-w1000-out.pgn $(OUTPUT)/test-w1000-out.pgn
449
450 # -W
451 #     + Input file containing games.
452 #     - Input file(s): test-W.pgn
453 #     - Resulting output should be games formatted in the specified notation:
454 #       halg (hyphenated long algebraic), lalg (non-hyphenated long algebraic),
455 #       elalg (enhanced long algebraic), uci (UCI-compatible output),
456 #       and alternative piece letters.
457 #     - Expected output: test-WWhalg-out.pgn, test-WWlalg-out.pgn,
458 #                        test-WWelalg-out.pgn, test-WWdeutsch-out.pgn,
459 #                        test-WWuci-out.pgn
460 test-WW:
461         echo "test-W:"
462         $(PGN_EXTRACT) -Whalg -otest-WWhalg-out.pgn $(INPUT)/test-W.pgn
463         -cmp test-WWhalg-out.pgn $(OUTPUT)/test-WWhalg-out.pgn
464         $(PGN_EXTRACT) -Wlalg -otest-WWlalg-out.pgn $(INPUT)/test-W.pgn
465         -cmp test-WWlalg-out.pgn $(OUTPUT)/test-WWlalg-out.pgn
466         $(PGN_EXTRACT) -Welalg -otest-WWelalg-out.pgn $(INPUT)/test-W.pgn
467         -cmp test-WWelalg-out.pgn $(OUTPUT)/test-WWelalg-out.pgn
468         $(PGN_EXTRACT) -WsanBSLTDK -otest-WWdeutsch-out.pgn $(INPUT)/test-W.pgn
469         -cmp test-WWdeutsch-out.pgn $(OUTPUT)/test-WWdeutsch-out.pgn
470         $(PGN_EXTRACT) -Wuci -otest-WWuci-out.pgn $(INPUT)/test-W.pgn
471         -cmp test-WWuci-out.pgn $(OUTPUT)/test-WWuci-out.pgn
472
473 # -x
474 #     + Input file containing games.
475 #     - Input file(s): najdorf.pgn, xvars.txt
476 #     - Resulting output should be only those games which match
477 #       the result of reaching the opening sequence in vars.txt.
478 #     - Expected output: test-x-out.pgn
479 test-x:
480         echo "test-x:"
481         $(PGN_EXTRACT) -x$(INPUT)/xvars.txt -otest-x-out.pgn $(INPUT)/najdorf.pgn
482         -cmp test-x-out.pgn $(OUTPUT)/test-x-out.pgn
483
484 # -z
485 #     + Input file containing games.
486 #     - Input file(s): petrosian.pgn, zmatch.txt
487 #     - Resulting output should be games whose material balance matches that
488 #       specified in zmatch.txt
489 #     - Expected output: test-z-out.pgn
490 test-z:
491         echo "test-z:"
492         $(PGN_EXTRACT) -z$(INPUT)/zmatch.txt -otest-z-out.pgn $(INPUT)/petrosian.pgn
493         -cmp test-z-out.pgn $(OUTPUT)/test-z-out.pgn
494
495 # -Z
496 #     + Input file containing games with duplicates and non-duplicates.
497 #     - Input file(s): fischer.pgn, petrosian.pgn
498 #     - Resulting output should be files separating the unique and
499 #       duplicated games in the input files.
500 #     - Expected output: test-ZZ-unique.pgn, test-ZZ-dupes.pgn
501 test-ZZ:
502         echo "test-Z:"
503         $(PGN_EXTRACT) -Z -s -dtest-ZZ-dupes.pgn -otest-ZZ-unique.pgn $(INPUT)/fischer.pgn $(INPUT)/petrosian.pgn
504         -cmp test-ZZ-dupes.pgn $(OUTPUT)/test-ZZ-dupes.pgn
505         -cmp test-ZZ-unique.pgn $(OUTPUT)/test-ZZ-unique.pgn
506
507 # -#
508 #     + Input file containing games.
509 #     - Input file(s): test-hash.pgn
510 #     - Resulting output The input file split in to separate sub-files,
511 #       each containing 10 games, except the last which may contain fewer.
512 #     - Expected output: 1.pgn, 2.pgn
513 test-hash:
514         echo "test-hash:"
515         $(PGN_EXTRACT) -#20 -s $(INPUT)/test-hash.pgn
516         -cmp 1.pgn $(OUTPUT)/1.pgn
517         -cmp 2.pgn $(OUTPUT)/2.pgn
518
519 # --evaluation
520 #     + Input file containing games.
521 #     - Input file(s): test-evaluation.pgn
522 #     - Resulting output should include an evaluation value in a comment
523 #       after every move.
524 #     - Expected output: test-evaluation-out.pgn
525 test-evaluation:
526         echo "test-evaluation:"
527         $(PGN_EXTRACT) --evaluation -otest-evaluation-out.pgn $(INPUT)/test-evaluation.pgn
528         -cmp test-evaluation-out.pgn $(OUTPUT)/test-evaluation-out.pgn
529
530 # --fencomments
531 #     + Input file containing games.
532 #     - Input file(s): test-fencomments.pgn
533 #     - Resulting output should have a comment after every move containing a
534 #       FEN description of the position after that move.
535 #     - Expected output: test-fencomments-out.pgn
536 test-fencomments:
537         echo "test-fencomments:"
538         $(PGN_EXTRACT) --fencomments -otest-fencomments-out.pgn $(INPUT)/test-fencomments.pgn
539         -cmp test-fencomments-out.pgn $(OUTPUT)/test-fencomments-out.pgn
540
541 # --markmatches
542 #     + Input file containing games.
543 #     - Input file(s): najdorf.pgn, xvars.txt
544 #     - Resulting output should be only those games which match
545 #       the result of reaching the opening sequence in vars.txt.
546 #       The point of each match is marked with the comment { MATCH }
547 #     - Expected output: test-markmatches-out.pgn
548 test-markmatches:
549         echo "test-markmatches:"
550         $(PGN_EXTRACT) --markmatches MATCH -x$(INPUT)/xvars.txt -otest-markmatches-out.pgn $(INPUT)/najdorf.pgn
551         -cmp test-markmatches-out.pgn $(OUTPUT)/test-markmatches-out.pgn
552
553 # --nochecks
554 #     + Input file containing games with moves involving moves that give check
555 #       and/or mate.
556 #     - Input file(s): test-nochecks.pgn
557 #     - Resulting output should contain games with no check indicators after moves.
558 #     - Expected output: test-nochecks-out.pgn
559 test-nochecks:
560         echo "test-nochecks:"
561         $(PGN_EXTRACT) --nochecks -otest-nochecks-out.pgn $(INPUT)/test-nochecks.pgn
562         -cmp test-nochecks-out.pgn $(OUTPUT)/test-nochecks-out.pgn
563
564 # --nomovenumbers
565 #     + Input file containing games with move numbers.
566 #     - Input file(s): test-nomovenumbers.pgn
567 #     - Resulting output should contain games with no move numbers.
568 #     - Expected output: test-nomovenumbers-out.pgn
569 test-nomovenumbers:
570         echo "test-nomovenumbers:"
571         $(PGN_EXTRACT) -otest-nomovenumbers-out.pgn --nomovenumbers $(INPUT)/test-nomovenumbers.pgn
572         -cmp test-nomovenumbers-out.pgn $(OUTPUT)/test-nomovenumbers-out.pgn
573
574 # --noresults
575 #     + Input file containing games with results.
576 #     - Input file(s): test-noresults.pgn
577 #     - Resulting output should contain games with no results.
578 #     - Expected output: test-noresults-out.pgn
579 test-noresults:
580         echo "test-noresults:"
581         $(PGN_EXTRACT) -otest-noresults-out.pgn --noresults $(INPUT)/test-noresults.pgn
582         -cmp test-noresults-out.pgn $(OUTPUT)/test-noresults-out.pgn
583
584 # --notags
585 #     + Input file containing games with tag information.
586 #     - Input file(s): test-notags.pgn
587 #     - Resulting output should contain games with no tag information.
588 #     - Expected output: test-notags-out.pgn
589 test-notags:
590         echo "test-notags:"
591         $(PGN_EXTRACT) -otest-notags-out.pgn --notags $(INPUT)/test-notags.pgn
592         -cmp test-notags-out.pgn $(OUTPUT)/test-notags-out.pgn
593
594 # --plylimit
595 #     + Input file containing games.
596 #     - Input file(s): test-plylimit.pgn
597 #     - Resulting output should contain games whose number of moves (plies) are
598 #       limited at the specified ply limit.
599 #     - Expected output: test-plylimit-out.pgn
600 test-plylimit:
601         echo "test-plylimit:"
602         $(PGN_EXTRACT) --plylimit 10 -otest-plylimit-out.pgn $(INPUT)/test-plylimit.pgn
603         -cmp test-plylimit-out.pgn $(OUTPUT)/test-plylimit-out.pgn
604
605 # --selectonly
606 #     + Input file containing games.
607 #     - Input file(s): test-selectonly.pgn
608 #     - Resulting output should contain a single matched game.
609 #     - Expected output: test-selectonly-out.pgn
610 test-selectonly:
611         echo "test-selectonly:"
612         $(PGN_EXTRACT) -TpPetrosian --selectonly 2 -otest-selectonly-out.pgn $(INPUT)/test-selectonly.pgn
613         -cmp test-selectonly-out.pgn $(OUTPUT)/test-selectonly-out.pgn
614
615 # --stalemate
616 #     + Input file containing games.
617 #     - Input file(s): test-stalemate.pgn
618 #     - Resulting output should contain only those games that end in stalemate.
619 #     - Expected output: test-stalemate-out.pgn
620 test-stalemate:
621         echo "test-stalemate:"
622         $(PGN_EXTRACT) --stalemate -otest-stalemate-out.pgn $(INPUT)/test-stalemate.pgn
623         -cmp test-stalemate-out.pgn $(OUTPUT)/test-stalemate-out.pgn
624
625 # --totalplycount
626 #     + Input file containing games.
627 #     - Input file(s): test-totalplycount.pgn
628 #     - Resulting output should contain games with a TotalPlyCount tag.
629 #     - Expected output: test-totalplycount-out.pgn
630 test-totalplycount:
631         echo "test-totalplycount:"
632         $(PGN_EXTRACT) --totalplycount -otest-totalplycount-out.pgn $(INPUT)/test-totalplycount.pgn
633         -cmp test-totalplycount-out.pgn $(OUTPUT)/test-totalplycount-out.pgn
634
635 # --addhashcode
636 #     + Input file containing games.
637 #     - Input file(s): test-addhashcode.pgn
638 #     - Resulting output should contain games with a HashCode tag.
639 #     - Expected output: test-addhashcode-out.pgn
640 test-addhashcode:
641         echo "test-addhashcode:"
642         $(PGN_EXTRACT) --addhashcode -otest-addhashcode-out.pgn $(INPUT)/test-addhashcode.pgn
643         -cmp test-addhashcode-out.pgn $(OUTPUT)/test-addhashcode-out.pgn
644
645 # Test on a file with a string too long to be output within the
646 # defined line length.
647 #     + Input file containing a game with a very long comment.
648 #     + Input file(s): test-long-line.pgn
649 #     + Resulting output should contain the game properly formatted and
650 #       the log file should contain an error message reporting the problem.
651 #     + Expected output: test-long-line-out.pgn, test-long-line-log.txt
652 test-long-line:
653         echo "test long line:"
654         $(PGN_EXTRACT) -otest-long-line-out.pgn -ltest-long-line-log.txt $(INPUT)/test-long-line.pgn
655         -cmp test-long-line-out.pgn $(OUTPUT)/test-long-line-out.pgn
656         -cmp test-long-line-log.txt $(OUTPUT)/test-long-line-log.txt