File: Makefile

package info (click to toggle)
pgn-extract 19.04-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,492 kB
  • sloc: ansic: 13,372; makefile: 483; sh: 76; xml: 50
file content (915 lines) | stat: -rw-r--r-- 40,950 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
# Makefile to run a battery of tests of the basic functionality of pgn-extract.
# Copyright (C) David J. Barnes, 2013-2019
#
# Each test is run and then, where relevant, a comparison is made between
# the output files generated in the current directory and the 'oracle'
# files that exist in $(OUTPUT).
#
# Beware of case-insensitive filenames when testing flags that
# differ only in letter case. In general, double letters have been
# used for output-files generated from using upper-case flag letters.

# Customise these for different OSs.
SEP=/
RM=rm -f
CMP=cmp

# Possible Windows settings
#SEP=\\
#RM=del
#CMP=diff

PGN_EXTRACT=..$(SEP)pgn-extract
# Use for memory checking if valgrind is installed.
#PGN_EXTRACT=valgrind --dsymutil=yes ..$(SEP)pgn-extract
#PGN_EXTRACT=valgrind --dsymutil=yes --leak-check=full ..$(SEP)pgn-extract

# Location of the file of ECO classifications.
ECO_FILE=..$(SEP)eco.pgn

# Location of the input files
INPUT=infiles
# Location of the oracle output files
OUTPUT=outfiles

# Test everything.
all: no-flags-1 no-flags-2 test-7 test-append test-AA test-b test-p \
     test-checkfile test-nocomments test-duplicates \
     test-noduplicates test-e test-EE test-f test-FF test-h test-l \
     test-LL test-checkmate test-n test-NN test-output test-PP test-r \
     test-RR test-s test-SS test-t test-TT test-nounique test-v \
     test-VV test-linelength test-WW test-x test-ZZ test-y test-z test-hash \
     test-evaluation test-fencomments test-markmatches test-nochecks \
     test-nomovenumbers test-noresults test-notags test-plylimit \
     test-stalemate test-long-line test-plycount test-addhashcode \
     test-selectonly test-fifty test-repetition test-promotion \
     test-fixresulttags test-fuzzydepth test-setup test-stopafter \
     test-skipmatching test-splitvariants test-nobadresults test-allownullmoves \
     test-matchplylimit test-nestedcomments test-FENPattern test-dropply

# BEWARE: This removes all PGN files in the current directory.
# The required test PGN files are assumed to be in $(INPUT).
clean:
	-$(RM) *.pgn *og.txt

# No flags:
#     + No input file.
#     - Input file(s): N$(SEP)A
#     - Example input:
#       f3 e5 g4 Qh4 0-1
#     - Resulting output should be that the game input on standard input is
#       formatted as PGN on standard output.
#     - Expected output: 
#       Contents of fools-mate.pgn on standard output.
no-flags-1:
	echo "test: No input file."
	$(PGN_EXTRACT) --quiet < $(INPUT)$(SEP)fools-mate.txt

# No flags:
#     + Single input file
#     - Input file(s): fools-mate.txt
#     - Resulting output should be the input formatted as PGN on standard output.
#     - Expected output: Contents of fools-mate.pgn should appear on standard output.
no-flags-2:
	echo "test: No flags."
	$(PGN_EXTRACT) --quiet $(INPUT)$(SEP)fools-mate.txt

# -7 $(SEP) --seven
#     + Input file with games having tags additional to the seven tag roster.
#     - Input file(s): test-7.pgn
#     - Game output should have only the tags of the seven tag roster.
#     - Expected output: test-7-out.pgn
test-7:
	echo "test-7:"
	$(PGN_EXTRACT) -7 -otest-7-out.pgn --quiet $(INPUT)$(SEP)test-7.pgn
	$(CMP) test-7-out.pgn $(OUTPUT)$(SEP)test-7-out.pgn

# -a $(SEP) --append
#     + Input file containing games in any accepted format.
#     - Input file(s): test-a.txt
#     - Resulting output should contain two versions of the input game
#       formatted in PGN. The --output command is run first to create
#       a new file, then the -a version to append to that file.
#     - Expected output: test-a-out.pgn
test-append:
	echo "test-append:"
	$(PGN_EXTRACT) --output test-a-out.pgn --quiet $(INPUT)$(SEP)test-a.txt
	$(PGN_EXTRACT) -atest-a-out.pgn --quiet $(INPUT)$(SEP)test-a.txt
	$(CMP) test-a-out.pgn $(OUTPUT)$(SEP)test-a-out.pgn

	$(PGN_EXTRACT) --output test-a-out.pgn --quiet $(INPUT)$(SEP)test-a.txt
	$(PGN_EXTRACT) --append test-a-out.pgn --quiet $(INPUT)$(SEP)test-a.txt
	$(CMP) test-a-out.pgn $(OUTPUT)$(SEP)test-a-out.pgn

# -A
#     + Input file containing games and a file of arguments.
#     - Input file(s): fischer.pgn, petrosian.pgn, arglist.txt
#     - Resulting output should be files separating the unique and
#       duplicated games in the input files.
#     - Expected output: test-AA-unique.pgn, test-AA-dupes.pgn
test-AA:
	echo "test-AA:"
	$(PGN_EXTRACT) -C -A$(INPUT)$(SEP)argslist.txt --quiet
	$(CMP) test-AA-dupes.pgn $(OUTPUT)$(SEP)test-AA-dupes.pgn
	$(CMP) test-AA-unique.pgn $(OUTPUT)$(SEP)test-AA-unique.pgn

# -b
#     + Input file containing games of different length.
#     - Input file(s): fischer.pgn
#     - Resulting output: games whose number of moves is within
#       the specified bounds.
# 
test-b: test-bl45 test-bu45 test-bu30

# -p
#     + Input file containing games of different length.
#     - Input file(s): fischer.pgn
#     - Resulting output: games whose number of ply is within
#       the specified bounds.
# 
test-p: test-pl90 test-pu90 test-pu60

#     - Expected output: 45 moves or more: test-bl45-out.pgn
test-bl45:
	echo "test-b:"
	$(PGN_EXTRACT) -bl45 -otest-bl45-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-bl45-out.pgn $(OUTPUT)$(SEP)test-bl45-out.pgn

#     - Expected output: 45 moves or less: test-bu45-out.pgn
test-bu45:
	echo "test-b:"
	$(PGN_EXTRACT) -bu45 -otest-bu45-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-bu45-out.pgn $(OUTPUT)$(SEP)test-bu45-out.pgn

#     - Expected output: exactly 30 moves: test-b30-out.pgn
test-bu30:
	echo "test-b:"
	$(PGN_EXTRACT) -b30 -otest-b30-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-b30-out.pgn $(OUTPUT)$(SEP)test-b30-out.pgn

#     - Expected output: 90 moves or more: test-pl90-out.pgn
test-pl90:
	echo "test-p:"
	$(PGN_EXTRACT) -pl90 -otest-pl90-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-pl90-out.pgn $(OUTPUT)$(SEP)test-pl90-out.pgn

#     - Expected output: 90 moves or less: test-pu90-out.pgn
test-pu90:
	echo "test-p:"
	$(PGN_EXTRACT) -pu90 -otest-pu90-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-pu90-out.pgn $(OUTPUT)$(SEP)test-pu90-out.pgn

#     - Expected output: exactly 60 moves: test-p60-out.pgn
test-pu60:
	echo "test-p:"
	$(PGN_EXTRACT) -p60 -otest-p60-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-p60-out.pgn $(OUTPUT)$(SEP)test-p60-out.pgn

# 
# -c $(SEP) --checkfile
#     + Input files containing games.
#     - Input file(s): fischer.pgn, petrosian.pgn
#     - Resulting output should contain matched games that do not already occur in
#       the check file.
#     - Expected output: test-c-out.pgn
test-checkfile:
	echo "test-checkfile:"
	$(PGN_EXTRACT) -c$(INPUT)$(SEP)petrosian.pgn -D -TpPetrosian -otest-c-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-c-out.pgn $(OUTPUT)$(SEP)test-c-out.pgn
	$(PGN_EXTRACT) -c$(INPUT)$(SEP)clist.txt -D -TpPetrosian -otest-c-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-c-out.pgn $(OUTPUT)$(SEP)test-c-out.pgn

# -C $(SEP) --nocomments
#     + Input file containing games with comments
#     - Input file(s): test-C.pgn
#     - Resulting output should have all comments removed.
#     - Expected output: test-CC-out.pgn
test-nocomments:
	echo "test-nocomments:"
	$(PGN_EXTRACT) -C -otest-CC-out.pgn --quiet $(INPUT)$(SEP)test-C.pgn
	$(CMP) test-CC-out.pgn $(OUTPUT)$(SEP)test-CC-out.pgn

# -d $(SEP) --duplicates
#     + Input file containing games with duplicates and non-duplicates.
#     - Input file(s): fischer.pgn, $(INPUT)$(SEP)petrosian.pgn
#     - Resulting output should be files separating the unique and
#       duplicated games in the input files.
#     - Expected output: test-d-unique.pgn, test-d-dupes.pgn
test-duplicates:
	echo "test-duplicates:"
	$(PGN_EXTRACT) -C -dtest-d-dupes.pgn -otest-d-unique.pgn --quiet $(INPUT)$(SEP)fischer.pgn $(INPUT)$(SEP)petrosian.pgn
	$(CMP) test-d-dupes.pgn $(OUTPUT)$(SEP)test-d-dupes.pgn
	$(CMP) test-d-unique.pgn $(OUTPUT)$(SEP)test-d-unique.pgn

# -D $(SEP) --noduplicates
#     + Input file containing games with duplicates and non-duplicates.
#     - Input file(s): fischer.pgn, $(INPUT)$(SEP)petrosian.pgn
#     - Resulting output should be a file containing the combined input
#       with duplicate games removed.
#     - Expected output: test-DD-unique.pgn
test-noduplicates:
	echo "test-noduplicates:"
	$(PGN_EXTRACT) -D -otest-DD-unique.pgn --quiet $(INPUT)$(SEP)fischer.pgn $(INPUT)$(SEP)petrosian.pgn
	$(CMP) test-DD-unique.pgn $(OUTPUT)$(SEP)test-DD-unique.pgn
	$(PGN_EXTRACT) --noduplicates -otest-DD-unique.pgn --quiet $(INPUT)$(SEP)fischer.pgn $(INPUT)$(SEP)petrosian.pgn
	$(CMP) test-DD-unique.pgn $(OUTPUT)$(SEP)test-DD-unique.pgn

# -e
#     + Input file containing games without ECO classifications.
#     - Input file(s): test-e.pgn and eco.pgn in the test folder.
#     - Resulting output should have ECO classification added to the tags.
#     - Expected output: test-e-out.pgn
test-e:
	echo "test-e:"
	$(PGN_EXTRACT) -e$(ECO_FILE) -otest-e-out.pgn --quiet $(INPUT)$(SEP)test-e.pgn
	$(CMP) test-e-out.pgn $(OUTPUT)$(SEP)test-e-out.pgn

# -E
#     + Input file containing games.
#     - Input file(s): test-ucE.pgn and eco.pgn if -e flag is used.
#     - Resulting output should be separate files for each ECO classification
#       at the level of the initial letter (A-E).
#	NB: The test removes existing A-E files first because this option appends
#	to existing files, which breaks the comparison test otherwise.
#     - Expected output: A.pgn, B.pgn, E.pgn
test-EE:
	echo "test-EE:"
	-$(RM) [A-E].pgn
	$(PGN_EXTRACT) -e$(ECO_FILE) -E1 --quiet $(INPUT)$(SEP)test-ucE.pgn
	$(CMP) A.pgn $(OUTPUT)$(SEP)A.pgn
	$(CMP) B.pgn $(OUTPUT)$(SEP)B.pgn
	$(CMP) E.pgn $(OUTPUT)$(SEP)E.pgn

# -f
#     + Input files containing games.
#     - Input file(s): test-f1.pgn, test-f2.pgn, files.txt
#     - Resulting output should be the combination of the input files.
#     - Expected output: test-f-out.pgn
test-f:
	echo "test-f:"
	$(PGN_EXTRACT) --quiet -f$(INPUT)$(SEP)files.txt -otest-f-out.pgn
	$(CMP) test-f-out.pgn $(OUTPUT)$(SEP)test-f-out.pgn

# -F:
#     + Input file containing games without a trailing FEN comment.
#     - Input file(s): test-F.pgn
#     - Resulting output should have a comment at the end containing
#       the FEN description of the final position.
#     - Expected output: test-FF-out.pgn
test-FF:
	echo "test-FF:"
	$(PGN_EXTRACT) -F -otest-FF-out.pgn --quiet $(INPUT)$(SEP)test-F.pgn
	$(CMP) test-FF-out.pgn $(OUTPUT)$(SEP)test-FF-out.pgn
	$(PGN_EXTRACT) -Fdiagram -otest-FF-text-out.pgn --quiet $(INPUT)$(SEP)test-F-text.pgn
	$(CMP) test-FF-text-out.pgn $(OUTPUT)$(SEP)test-FF-text-out.pgn

# 
# -h $(SEP) -? $(SEP) --help
#     + No input required.
#     - Input file(s): N$(SEP)A
#     - Resulting output should be a description of how to use pgn-extract
#     - Expected output: N$(SEP)A
# Also:
# 	..$(SEP)pgn-extract -?
# 	..$(SEP)pgn-extract --help
test-h:
	echo "test-h:"
	-$(PGN_EXTRACT) -h

# -l
#     + Input file containing games.
#     - Input file(s): fischer.pgn
#     - Resulting output: List of games parsed written to log.txt
#     - Expected output: log.txt
test-l:
	echo "test-l:"
	$(PGN_EXTRACT) -llog.txt -otest-l-out.pgn $(INPUT)$(SEP)fischer.pgn
	$(CMP) log.txt $(OUTPUT)$(SEP)log.txt
	$(CMP) test-l-out.pgn $(OUTPUT)$(SEP)test-l-out.pgn

# -L
#     + Input file containing games.
#     - Input file(s): test-L1.pgn, test-L2.pgn
#     - Resulting output should be that log.txt contains the combined
#       logs from two runs of pgn-extract.
#     - Expected output: log.txt
test-LL:
	echo "test-LL:"
	$(PGN_EXTRACT) -lLLog.txt -r $(INPUT)$(SEP)test-L1.pgn
	$(PGN_EXTRACT) -LLLog.txt -r $(INPUT)$(SEP)test-L2.pgn
	$(CMP) LLog.txt $(OUTPUT)$(SEP)LLog.txt

# -M $(SEP) --checkmate
#     + Input file containing games.
#     - Input file(s): test-checkmate.pgn
#     - Resulting output should contain only those games that end in checkmate.
#     - Expected output: test-checkmate-out.pgn
test-checkmate:
	echo "test-checkmate:"
	$(PGN_EXTRACT) --checkmate -otest-checkmate-out.pgn --quiet $(INPUT)$(SEP)test-checkmate.pgn
	$(CMP) test-checkmate-out.pgn $(OUTPUT)$(SEP)test-checkmate-out.pgn

# -n
#     + Input file containing games.
#     - Input file(s): petrosian.pgn
#     - Resulting output should be separate files containing matched
#       and non-matched games.
#     - Expected output: test-n-matched.pgn, test-n-unmatched.pgn
test-n:
	echo "test-n:"
	$(PGN_EXTRACT) -TpFischer -otest-n-matched.pgn -ntest-n-unmatched.pgn --quiet $(INPUT)$(SEP)petrosian.pgn
	$(CMP) test-n-matched.pgn $(OUTPUT)$(SEP)test-n-matched.pgn
	$(CMP) test-n-unmatched.pgn $(OUTPUT)$(SEP)test-n-unmatched.pgn

# -N $(SEP) --nonags
#     + Input file containing games with NAGs.
#     - Input file(s): test-N.pgn
#     - Resulting output should have all NAGs removed.
#     - Expected output: test-NN-out.pgn
test-NN:
	echo "test-NN:"
	$(PGN_EXTRACT) -N -otest-NN-out.pgn --quiet $(INPUT)$(SEP)test-N.pgn
	$(CMP) test-NN-out.pgn $(OUTPUT)$(SEP)test-NN-out.pgn
#       Comments after multiple nags.
	$(PGN_EXTRACT) -otest-nagcomments-out.pgn --quiet $(INPUT)$(SEP)test-nagcomments.pgn
#       Deleting NAGs with comments after multiple nags.
	$(PGN_EXTRACT) -N -atest-nagcomments-out.pgn --quiet $(INPUT)$(SEP)test-nagcomments.pgn
	$(CMP) test-nagcomments-out.pgn $(OUTPUT)$(SEP)test-nagcomments-out.pgn
	$(CMP) test-nagcomments-out.pgn $(OUTPUT)$(SEP)test-nagcomments-out.pgn

# 
# -o $(SEP) --output
#     + Input file containing games in any accepted format.
#     - Input file(s): test-o.txt
#     - Resulting output should contain the input game formatted in PGN.
#     - Expected output: test-o-out.pgn
test-output:
	echo "test-output:"
	$(PGN_EXTRACT) -otest-o-out.pgn --quiet $(INPUT)$(SEP)test-o.txt
	$(CMP) test-o-out.pgn $(OUTPUT)$(SEP)test-o-out.pgn
	$(PGN_EXTRACT) --output test-o-out.pgn --quiet $(INPUT)$(SEP)test-o.txt
	$(CMP) test-o-out.pgn $(OUTPUT)$(SEP)test-o-out.pgn

# -P
#     + Input file containing games with different sequences for the same
#       opening.
#     - Input file(s): test-P.pgn, Pvars.txt
#     - Resulting output should be games whose opening move exactly match
#       the sequence specified in Pvars.txt
#     - Expected output: test-PP-out.pgn
test-PP:
	echo "test-PP:"
	$(PGN_EXTRACT) -P -v$(INPUT)$(SEP)Pvars.txt -otest-PP-out.pgn --quiet $(INPUT)$(SEP)test-P.pgn
	$(CMP) test-PP-out.pgn $(OUTPUT)$(SEP)test-PP-out.pgn

# -r
#     + Input file containing games in any accepted format.
#     - Input file(s): test-r.text
#     - Resulting output should contain tag summary lines for the games
#       matched and a report of any errors.
#     - Expected output: test-r-log.txt
test-r:
	echo "test-r:"
	$(PGN_EXTRACT) -r -ltest-r-log.txt $(INPUT)$(SEP)test-r.txt
#       $(CMP) test-r-log.txt $(OUTPUT)$(SEP)test-r-log.txt

# -R
#     + Input file containing games.
#     - Input file(s): test-R.pgn, roster.txt
#     - Resulting output should contain games with their tag roster in
#       the order specified in roster.txt
#     - Expected output: test-R-out.pgn
test-RR:
	echo "test-RR:"
	$(PGN_EXTRACT) -R$(INPUT)$(SEP)roster.txt --output test-RR-out.pgn --quiet $(INPUT)$(SEP)test-R.pgn
	$(CMP) test-RR-out.pgn $(OUTPUT)$(SEP)test-RR-out.pgn

# -s
#     + Input file containing games.
#     - Input file(s): test-s.pgn
#     - Resulting output should be silent, with games written to the output file.
#     - Expected output: test-s-out.pgn
test-s:
	echo "test-s:"
	$(PGN_EXTRACT) -s -o test-s-out.pgn $(INPUT)$(SEP)test-s.pgn
	$(CMP) test-s-out.pgn $(OUTPUT)$(SEP)test-s-out.pgn

# -S
#     + Input file containing games whose players' names have slight
#       sound variations from anglesized versions.
#     - Input file(s): test-ucS.pgn
#     - Resulting output should be games that match by ignoring slight
#       soundex differences.
#     - Expected output: test-SS-out.pgn
test-SS:
	echo "test-SS:"
	$(PGN_EXTRACT) -S -TpPetrosian -otest-SS-out.pgn --quiet $(INPUT)$(SEP)test-ucS.pgn
	$(CMP) test-SS-out.pgn $(OUTPUT)$(SEP)test-SS-out.pgn

# -t
#     + Input file containing games and a file of tag criteria.
#     - Input file(s): test-t.pgn, taglist.txt
#     - Resulting output should be only those games whose tags match
#       all of the criteria.
#     - Expected output: test-t-out.pgn
test-t:
	echo "test-t:"
	$(PGN_EXTRACT) -t$(INPUT)$(SEP)taglist.txt -otest-t-out.pgn --quiet $(INPUT)$(SEP)test-t.pgn
	$(CMP) test-t-out.pgn $(OUTPUT)$(SEP)test-t-out.pgn
	$(PGN_EXTRACT) -t$(INPUT)$(SEP)test-tFEN.txt -otest-tFEN-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-tFEN-out.pgn $(OUTPUT)$(SEP)test-tFEN-out.pgn

# -T
#     + Input file containing games with tag information.
#     - Input file(s): fischer.pgn, test-Ta.pgn (and eco.pgn for -Te test.)
#     - Resulting output should contain only those games whose tag information
#       matches that specified.
#     - Expected output: test-Ta-out.pgn, test-Tb-out.pgn, test-Td-out.pgn,
#                        test-Tdd-out.pgn test-Te-out.pgn, test-Tp-out.pgn,
#                        test-Tw-out.pgn
test-TT:
	echo "test-TT:"
	$(PGN_EXTRACT) -Td1970 -otest-TTd-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-TTd-out.pgn $(OUTPUT)$(SEP)test-TTd-out.pgn
	$(PGN_EXTRACT) -Td1960 -Td1962 -otest-TTdd-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-TTdd-out.pgn $(OUTPUT)$(SEP)test-TTdd-out.pgn
	$(PGN_EXTRACT) -TbPetrosian -otest-TTb-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-TTb-out.pgn $(OUTPUT)$(SEP)test-TTb-out.pgn
	$(PGN_EXTRACT) -e$(ECO_FILE) -TeB14 -otest-Te-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(PGN_EXTRACT) -TpPetrosian -otest-TTp-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-TTp-out.pgn $(OUTPUT)$(SEP)test-TTp-out.pgn
	$(PGN_EXTRACT) -Tr0-1 -otest-TTr-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-TTr-out.pgn $(OUTPUT)$(SEP)test-TTr-out.pgn
	$(PGN_EXTRACT) -TwFischer -otest-TTw-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-TTw-out.pgn $(OUTPUT)$(SEP)test-TTw-out.pgn
	$(PGN_EXTRACT) -TaBarnes -otest-TTa-out.pgn --quiet $(INPUT)$(SEP)test-Ta.pgn
	$(CMP) test-TTa-out.pgn $(OUTPUT)$(SEP)test-TTa-out.pgn

# -U $(SEP) --nounique
#     + Input file containing games with duplicates and non-duplicates.
#     - Input file(s): fischer.pgn, petrosian.pgn
#     - Resulting output should be a file containing just the duplicate games.
#     - Expected output: test-U-unique.pgn
test-nounique:
	echo "test-nounique:"
	$(PGN_EXTRACT) -U -otest-UU-unique.pgn --quiet $(INPUT)$(SEP)fischer.pgn $(INPUT)$(SEP)petrosian.pgn
	$(CMP) test-UU-unique.pgn $(OUTPUT)$(SEP)test-UU-unique.pgn
	$(PGN_EXTRACT) --nounique -otest-UU-unique.pgn --quiet $(INPUT)$(SEP)fischer.pgn $(INPUT)$(SEP)petrosian.pgn
	$(CMP) test-UU-unique.pgn $(OUTPUT)$(SEP)test-UU-unique.pgn

# -v
#     + Input file containing games.
#     - Input file(s): najdorf.pgn, vvars.txt
#     - Resulting output should be only those games whose opening moves
#       textually match (in any order) the moves in vars.txt.
#     - Expected output: test-v-out.pgn
test-v:
	echo "test-v:"
	$(PGN_EXTRACT) -v$(INPUT)$(SEP)vvars.txt -otest-v-out.pgn --quiet $(INPUT)$(SEP)najdorf.pgn
	$(CMP) test-v-out.pgn $(OUTPUT)$(SEP)test-v-out.pgn

# -V
#     + Input file containing games with variations
#     - Input file(s): test-V.pgn
#     - Resulting output should have all variations removed.
#     - Expected output: test-V-out.pgn
test-VV:
	echo "test-VV:"
	$(PGN_EXTRACT) -V -otest-VV-out.pgn --quiet $(INPUT)$(SEP)test-V.pgn
	$(CMP) test-VV-out.pgn $(OUTPUT)$(SEP)test-VV-out.pgn

# -w $(SEP) --linelength
#     + Input file containing games.
#     - Input file(s): test-w.pgn
#     - Resulting output Games formatted up to the specified line length.
#       The default is 75.
#     - Expected output: test-w60-out.pgn, test-w75-out.pgn, test-w1000-out.pgn
test-linelength:
	echo "test-linelength:"
	$(PGN_EXTRACT) -w60 -otest-w60-out.pgn --quiet $(INPUT)$(SEP)test-w.pgn
	$(CMP) test-w60-out.pgn $(OUTPUT)$(SEP)test-w60-out.pgn
	$(PGN_EXTRACT) -w75 -otest-w75-out.pgn --quiet $(INPUT)$(SEP)test-w.pgn
	$(CMP) test-w75-out.pgn $(OUTPUT)$(SEP)test-w75-out.pgn
	$(PGN_EXTRACT) -w1000 -otest-w1000-out.pgn --quiet $(INPUT)$(SEP)test-w.pgn
	$(CMP) test-w1000-out.pgn $(OUTPUT)$(SEP)test-w1000-out.pgn

	$(PGN_EXTRACT) --linelength 60 -otest-w60-out.pgn --quiet $(INPUT)$(SEP)test-w.pgn
	$(CMP) test-w60-out.pgn $(OUTPUT)$(SEP)test-w60-out.pgn
	$(PGN_EXTRACT) --linelength 75 -otest-w75-out.pgn --quiet $(INPUT)$(SEP)test-w.pgn
	$(CMP) test-w75-out.pgn $(OUTPUT)$(SEP)test-w75-out.pgn
	$(PGN_EXTRACT) --linelength 1000 -otest-w1000-out.pgn --quiet $(INPUT)$(SEP)test-w.pgn
	$(CMP) test-w1000-out.pgn $(OUTPUT)$(SEP)test-w1000-out.pgn

# -W
#     + Input file containing games.
#     - Input file(s): test-ucW.pgn
#     - Resulting output should be games formatted in the specified notation:
#       halg (hyphenated long algebraic), lalg (non-hyphenated long algebraic),
#       elalg (enhanced long algebraic), xlalg (enhanced with capture info),
#       uci (UCI-compatible output),
#	and alternative piece letters.
#     - Expected output: test-WWhalg-out.pgn, test-WWlalg-out.pgn,
#                        test-WWelalg-out.pgn, test-WWdeutsch-out.pgn,
#                        test-WWuci-out.pgn
test-WW:
	echo "test-WW:"
	$(PGN_EXTRACT) -Whalg -otest-WWhalg-out.pgn --quiet $(INPUT)$(SEP)test-ucW.pgn
	$(CMP) test-WWhalg-out.pgn $(OUTPUT)$(SEP)test-WWhalg-out.pgn
	$(PGN_EXTRACT) -Wlalg -otest-WWlalg-out.pgn --quiet $(INPUT)$(SEP)test-ucW.pgn
	$(CMP) test-WWlalg-out.pgn $(OUTPUT)$(SEP)test-WWlalg-out.pgn
	$(PGN_EXTRACT) -Welalg -otest-WWelalg-out.pgn --quiet $(INPUT)$(SEP)test-ucW.pgn
	$(CMP) test-WWelalg-out.pgn $(OUTPUT)$(SEP)test-WWelalg-out.pgn
	$(PGN_EXTRACT) -Wxlalg -otest-WWxlalg-out.pgn --quiet $(INPUT)$(SEP)test-ucW.pgn
	$(CMP) test-WWxlalg-out.pgn $(OUTPUT)$(SEP)test-WWxlalg-out.pgn
	$(PGN_EXTRACT) -WsanBSLTDK -otest-WWdeutsch-out.pgn --quiet $(INPUT)$(SEP)test-ucW.pgn
	$(CMP) test-WWdeutsch-out.pgn $(OUTPUT)$(SEP)test-WWdeutsch-out.pgn
	$(PGN_EXTRACT) -Wuci -otest-WWuci-out.pgn --quiet $(INPUT)$(SEP)test-ucW.pgn
	$(CMP) test-WWuci-out.pgn $(OUTPUT)$(SEP)test-WWuci-out.pgn
	$(PGN_EXTRACT) -Wepd -otest-WWepd-out.pgn --quiet $(INPUT)$(SEP)test-ucW.pgn
	$(CMP) test-WWepd-out.pgn $(OUTPUT)$(SEP)test-WWepd-out.pgn

# -x
#     + Input file containing games.
#     - Input file(s): najdorf.pgn, xvars.txt
#     - Resulting output should be only those games which match
#       the result of reaching the opening sequence in vars.txt.
#     - Expected output: test-x-out.pgn
test-x:
	echo "test-x:"
	$(PGN_EXTRACT) -x$(INPUT)$(SEP)xvars.txt -otest-x-out.pgn --quiet $(INPUT)$(SEP)najdorf.pgn
	$(CMP) test-x-out.pgn $(OUTPUT)$(SEP)test-x-out.pgn
	$(PGN_EXTRACT) -x$(INPUT)$(SEP)xvars.txt -otest-x-out.pgn -ntest-xn-out.pgn --quiet $(INPUT)$(SEP)najdorf.pgn
	$(CMP) test-xn-out.pgn $(OUTPUT)$(SEP)test-xn-out.pgn

# -y
#     + Input file containing games.
#     - Input file(s): fischer.pgn, zmatch.txt
#     - Resulting output should be games whose material balance matches that
#       specified in ymatch.txt
#     - Expected output: test-y-out.pgn
test-y:
	echo "test-y:"
	$(PGN_EXTRACT) -y$(INPUT)$(SEP)ymatch.txt --markmatches MATCH -otest-y-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-y-out.pgn $(OUTPUT)$(SEP)test-y-out.pgn

# -z
#     + Input file containing games.
#     - Input file(s): fischer.pgn, zmatch.txt
#     - Resulting output should be games whose material balance matches that
#       specified in zmatch.txt
#     - Expected output: test-z-out.pgn
test-z:
	echo "test-z:"
	$(PGN_EXTRACT) -z$(INPUT)$(SEP)zmatch.txt -otest-z-out.pgn --markmatches MATCH --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-z-out.pgn $(OUTPUT)$(SEP)test-z-out.pgn

# -Z
#     + Input file containing games with duplicates and non-duplicates.
#     - Input file(s): fischer.pgn, petrosian.pgn
#     - Resulting output should be files separating the unique and
#       duplicated games in the input files.
#     - Expected output: test-ZZ-unique.pgn, test-ZZ-dupes.pgn
test-ZZ:
	echo "test-ZZ:"
	$(PGN_EXTRACT) -C -Z -dtest-ZZ-dupes.pgn -otest-ZZ-unique.pgn --quiet $(INPUT)$(SEP)fischer.pgn $(INPUT)$(SEP)petrosian.pgn
	$(CMP) test-ZZ-dupes.pgn $(OUTPUT)$(SEP)test-ZZ-dupes.pgn
	$(CMP) test-ZZ-unique.pgn $(OUTPUT)$(SEP)test-ZZ-unique.pgn

# -#
#     + Input file containing games.
#     - Input file(s): test-hash.pgn
#     - Resulting output The input file split in to separate sub-files,
#       each containing 10 games, except the last which may contain fewer.
#     - Expected output: 1.pgn, 2.pgn
test-hash:
	echo "test-hash:"
	$(PGN_EXTRACT) -#20 --quiet $(INPUT)$(SEP)test-hash.pgn
	$(CMP) 1.pgn $(OUTPUT)$(SEP)1.pgn
	$(CMP) 2.pgn $(OUTPUT)$(SEP)2.pgn

	$(PGN_EXTRACT) -#20,10 --quiet $(INPUT)$(SEP)test-hash.pgn
	$(CMP) 10.pgn $(OUTPUT)$(SEP)10.pgn
	$(CMP) 11.pgn $(OUTPUT)$(SEP)11.pgn

# --evaluation
#     + Input file containing games.
#     - Input file(s): test-evaluation.pgn
#     - Resulting output should include an evaluation value in a comment
#       after every move.
#     - Expected output: test-evaluation-out.pgn
test-evaluation:
	echo "test-evaluation:"
	$(PGN_EXTRACT) --evaluation -otest-evaluation-out.pgn --quiet $(INPUT)$(SEP)test-evaluation.pgn
	$(CMP) test-evaluation-out.pgn $(OUTPUT)$(SEP)test-evaluation-out.pgn

# --fencomments
#     + Input file containing games.
#     - Input file(s): test-fencomments.pgn
#     - Resulting output should have a comment after every move containing a
#       FEN description of the position after that move.
#     - Expected output: test-fencomments-out.pgn
test-fencomments:
	echo "test-fencomments:"
	$(PGN_EXTRACT) --fencomments -otest-fencomments-out.pgn --quiet $(INPUT)$(SEP)test-fencomments.pgn
	$(CMP) test-fencomments-out.pgn $(OUTPUT)$(SEP)test-fencomments-out.pgn

# --markmatches
#     + Input file containing games.
#     - Input file(s): najdorf.pgn, xvars.txt
#     - Resulting output should be only those games which match
#       the result of reaching the opening sequence in vars.txt.
#       The point of each match is marked with the comment { MATCH }
#     - Expected output: test-markmatches-out.pgn
test-markmatches:
	echo "test-markmatches:"
	$(PGN_EXTRACT) --markmatches MATCH -x$(INPUT)$(SEP)xvars.txt -otest-markmatches-out.pgn --quiet $(INPUT)$(SEP)najdorf.pgn
	$(CMP) test-markmatches-out.pgn $(OUTPUT)$(SEP)test-markmatches-out.pgn

# --nestedcomments
#     + Input file containing games.
#     - Input file(s): nested-comment.pgn
#     - Resulting output should have retained the nested comment.
#     - Expected output: test-nestedcomments-out.pgn
test-nestedcomments:
	echo "test-nestedcomments:"
	$(PGN_EXTRACT) --nestedcomments -otest-nestedcomments-out.pgn --quiet $(INPUT)$(SEP)nested-comment.pgn
	$(CMP) test-nestedcomments-out.pgn $(OUTPUT)$(SEP)test-nestedcomments-out.pgn

# --nochecks
#     + Input file containing games with moves involving moves that give check
#       and$(SEP)or mate.
#     - Input file(s): test-nochecks.pgn
#     - Resulting output should contain games with no check indicators after moves.
#     - Expected output: test-nochecks-out.pgn
test-nochecks:
	echo "test-nochecks:"
	$(PGN_EXTRACT) --nochecks -otest-nochecks-out.pgn --quiet $(INPUT)$(SEP)test-nochecks.pgn
	$(CMP) test-nochecks-out.pgn $(OUTPUT)$(SEP)test-nochecks-out.pgn

# --nomovenumbers
#     + Input file containing games with move numbers.
#     - Input file(s): test-nomovenumbers.pgn
#     - Resulting output should contain games with no move numbers.
#     - Expected output: test-nomovenumbers-out.pgn
test-nomovenumbers:
	echo "test-nomovenumbers:"
	$(PGN_EXTRACT) -otest-nomovenumbers-out.pgn --nomovenumbers --quiet $(INPUT)$(SEP)test-nomovenumbers.pgn
	$(CMP) test-nomovenumbers-out.pgn $(OUTPUT)$(SEP)test-nomovenumbers-out.pgn

# --noresults
#     + Input file containing games with results.
#     - Input file(s): test-noresults.pgn
#     - Resulting output should contain games with no results.
#     - Expected output: test-noresults-out.pgn
test-noresults:
	echo "test-noresults:"
	$(PGN_EXTRACT) -otest-noresults-out.pgn --noresults --quiet $(INPUT)$(SEP)test-noresults.pgn
	$(CMP) test-noresults-out.pgn $(OUTPUT)$(SEP)test-noresults-out.pgn

# --notags
#     + Input file containing games with tag information.
#     - Input file(s): test-notags.pgn
#     - Resulting output should contain games with no tag information.
#     - Expected output: test-notags-out.pgn
test-notags:
	echo "test-notags:"
	$(PGN_EXTRACT) -otest-notags-out.pgn --notags --quiet $(INPUT)$(SEP)test-notags.pgn
	$(CMP) test-notags-out.pgn $(OUTPUT)$(SEP)test-notags-out.pgn

# --plylimit
#     + Input file containing games.
#     - Input file(s): test-plylimit.pgn
#     - Resulting output should contain games whose number of moves (plies) are
#       limited at the specified ply limit.
#     - Expected output: test-plylimit-out.pgn
test-plylimit:
	echo "test-plylimit:"
	$(PGN_EXTRACT) --plylimit 10 -otest-plylimit-out.pgn --quiet $(INPUT)$(SEP)test-plylimit.pgn
	$(CMP) test-plylimit-out.pgn $(OUTPUT)$(SEP)test-plylimit-out.pgn

# --dropply
#     + Input file containing games.
#     - Input file(s): najdorf.pgn
#     - Resulting output should contain games whose number of moves (plies) are
#       have been reduced by the given number from the beginning or end.
#     - Expected output: test-dropply-out.pgn
test-dropply:
	echo "test-dropply:"
	$(PGN_EXTRACT) --dropply 10 -otest-dropply-out.pgn --quiet $(INPUT)$(SEP)najdorf.pgn
	$(PGN_EXTRACT) --dropply 11 -atest-dropply-out.pgn --quiet $(INPUT)$(SEP)najdorf.pgn
	$(PGN_EXTRACT) --dropply -1 -atest-dropply-out.pgn --quiet $(INPUT)$(SEP)najdorf.pgn
	$(PGN_EXTRACT) --dropply -2 -atest-dropply-out.pgn --quiet $(INPUT)$(SEP)najdorf.pgn
	$(CMP) test-dropply-out.pgn $(OUTPUT)$(SEP)test-dropply-out.pgn

# --selectonly
#     + Input file containing games.
#     - Input file(s): test-selectonly.pgn
#     - Resulting output should contain only two matched games.
#     - Expected output: test-selectonly-out.pgn
test-selectonly:
	echo "test-selectonly:"
	$(PGN_EXTRACT) -TpPetrosian --selectonly 2,3 -otest-selectonly-out.pgn --quiet $(INPUT)$(SEP)test-selectonly.pgn
	$(CMP) test-selectonly-out.pgn $(OUTPUT)$(SEP)test-selectonly-out.pgn

# --skipmatching
#     + Input file containing games.
#     - Input file(s): test-skipmatching.pgn
#     - Resulting output should contain a single matched game.
#     - Expected output: test-selectonly-out.pgn
test-skipmatching:
	echo "test-skipmatching:"
	$(PGN_EXTRACT) -TpKeres --skipmatching 1,2 -otest-skipmatching-out.pgn --quiet $(INPUT)$(SEP)fischer.pgn
	$(CMP) test-skipmatching-out.pgn $(OUTPUT)$(SEP)test-skipmatching-out.pgn

# --splitvariants
#     + Input file containing games.
#     - Input file(s): test-splitvariants.pgn
#     - Resulting output should contain a separate game
#       for every variation in the input file.
#     - Expected output: test-splitvariants-out.pgn
test-splitvariants:
	echo "test-splitvariants:"
	$(PGN_EXTRACT) --splitvariants -otest-splitvariants-out.pgn --quiet $(INPUT)$(SEP)test-splitvariants.pgn
	$(CMP) test-splitvariants-out.pgn $(OUTPUT)$(SEP)test-splitvariants-out.pgn

# --stalemate
#     + Input file containing games.
#     - Input file(s): test-stalemate.pgn
#     - Resulting output should contain only those games that end in stalemate.
#     - Expected output: test-stalemate-out.pgn
test-stalemate:
	echo "test-stalemate:"
	$(PGN_EXTRACT) --stalemate -otest-stalemate-out.pgn --quiet $(INPUT)$(SEP)test-stalemate.pgn
	$(CMP) test-stalemate-out.pgn $(OUTPUT)$(SEP)test-stalemate-out.pgn

# --fifty
#     + Input file containing games.
#     - Input file(s): test-fifty.pgn
#     - Resulting output should contain only those games to which the fifty-move rule
#       applies, with the comment { FIFTY } at the approriate point.
#     - Expected output: test-fifty-out.pgn
test-fifty:
	echo "test-fifty:"
	$(PGN_EXTRACT) --fifty --markmatches FIFTY -otest-fifty-out.pgn --quiet $(INPUT)$(SEP)test-fifty.pgn
	$(CMP) test-fifty-out.pgn $(OUTPUT)$(SEP)test-fifty-out.pgn

# --repetition
#     + Input file containing games.
#     - Input file(s): test-repetition.pgn
#     - Resulting output should contain only those games which contain a 3-fold repetition,
#       with the comment { REPEAT } at the approriate point.
#     - Expected output: test-repetition-out.pgn
test-repetition:
	echo "test-repetition:"
	$(PGN_EXTRACT) --repetition --markmatches REPEAT -otest-repetition-out.pgn --quiet $(INPUT)$(SEP)test-repetition.pgn
	$(CMP) test-repetition-out.pgn $(OUTPUT)$(SEP)test-repetition-out.pgn

# --plycount and --totalplycount
#     + Input file containing games.
#     - Input file(s): test-plycount.pgn
#     - Resulting output should contain games with PlyCount and TotalPlyCount tags.
#     - Expected output: test-plycount-out.pgn
test-plycount:
	echo "test-plycount:"
	$(PGN_EXTRACT) --plycount --totalplycount -otest-plycount-out.pgn --quiet $(INPUT)$(SEP)test-plycount.pgn
	$(CMP) test-plycount-out.pgn $(OUTPUT)$(SEP)test-plycount-out.pgn

# --addhashcode
#     + Input file containing games.
#     - Input file(s): test-addhashcode.pgn
#     - Resulting output should contain games with a HashCode tag.
#     - Expected output: test-addhashcode-out.pgn
test-addhashcode:
	echo "test-addhashcode:"
	$(PGN_EXTRACT) --addhashcode -otest-addhashcode-out.pgn --quiet $(INPUT)$(SEP)test-addhashcode.pgn
	$(CMP) test-addhashcode-out.pgn $(OUTPUT)$(SEP)test-addhashcode-out.pgn

# Test on a file with a string too long to be output within the
# defined line length.
#     + Input file containing a game with a very long comment.
#     + Input file(s): test-long-line.pgn
#     + Resulting output should contain the game properly formatted and
#       the log file should contain an error message reporting the problem.
#     + Expected output: test-long-line-out.pgn, test-long-line-log.txt
test-long-line:
	echo "test long line:"
	$(PGN_EXTRACT) -otest-long-line-out.pgn -ltest-long-line-log.txt $(INPUT)$(SEP)test-long-line.pgn
	$(CMP) test-long-line-out.pgn $(OUTPUT)$(SEP)test-long-line-out.pgn
#       $(CMP) test-long-line-log.txt $(OUTPUT)$(SEP)test-long-line-log.txt

# Promotion characters.
#     + Input file with games involving a promotion
#     - Input file(s): test-promotion-in.pgn
#     - Game output should have all games with promotions.
#     - Expected output: test-promotion-out.pgn
test-promotion:
	echo "test-promotion:"
	$(PGN_EXTRACT) -otest-promotion-out.pgn --quiet $(INPUT)$(SEP)test-promotion-in.pgn
	$(CMP) test-promotion-out.pgn $(OUTPUT)$(SEP)test-promotion-out.pgn
	$(PGN_EXTRACT) --underpromotion -otest-underpromotion-out.pgn --quiet $(INPUT)$(SEP)test-promotion-in.pgn
	$(CMP) test-underpromotion-out.pgn $(OUTPUT)$(SEP)test-underpromotion-out.pgn

# Inconsistent Result tags
#     + Input file with games where the Result tag conflicts with checkmate or stalemate.
#     - Input file(s): test-fixresulttags-in.pgn
#     - Game output should have consistent Result tags
#     - Expected output: test-fixresulttags-out.pgn
test-fixresulttags:
	echo "test-fixresulttags:"
	$(PGN_EXTRACT) --fixresulttags -otest-fixresulttags-out.pgn -lfix-results-log.txt --quiet $(INPUT)$(SEP)test-fixresulttags-in.pgn
	$(CMP) test-fixresulttags-out.pgn $(OUTPUT)$(SEP)test-fixresulttags-out.pgn
#       $(CMP) fix-results-log.txt $(OUTPUT)$(SEP)fix-results-log.txt

# --fuzzydepth
#     + Input file containing games with fuzzy duplicates and non-duplicates.
#     - Input file(s): $(INPUT)$(SEP)test-fuzzydepth.pgn
#     - Resulting output should be files separating the unique and
#       duplicated games in the input files.
#     - Expected output: test-fuzzydepth0-unique.pgn, test-fuzzydepth0-dupes.pgn
test-fuzzydepth:
	echo "test-duplicates:"
	$(PGN_EXTRACT) -C --fuzzydepth 0 -dtest-fuzzydepth0-dupes.pgn -otest-fuzzydepth0-unique.pgn --quiet $(INPUT)$(SEP)test-fuzzydepth.pgn
	$(CMP) test-fuzzydepth0-dupes.pgn $(OUTPUT)$(SEP)test-fuzzydepth0-dupes.pgn
	$(CMP) test-fuzzydepth0-unique.pgn $(OUTPUT)$(SEP)test-fuzzydepth0-unique.pgn
	$(PGN_EXTRACT) -C --fuzzydepth 3 -dtest-fuzzydepth3-dupes.pgn -otest-fuzzydepth3-unique.pgn --quiet $(INPUT)$(SEP)test-fuzzydepth.pgn
	$(CMP) test-fuzzydepth3-dupes.pgn $(OUTPUT)$(SEP)test-fuzzydepth3-dupes.pgn
	$(CMP) test-fuzzydepth3-unique.pgn $(OUTPUT)$(SEP)test-fuzzydepth3-unique.pgn
	$(PGN_EXTRACT) -C --fuzzydepth 4 -dtest-fuzzydepth4-dupes.pgn -otest-fuzzydepth4-unique.pgn --quiet $(INPUT)$(SEP)test-fuzzydepth.pgn
	$(CMP) test-fuzzydepth4-dupes.pgn $(OUTPUT)$(SEP)test-fuzzydepth4-dupes.pgn
	$(CMP) test-fuzzydepth4-unique.pgn $(OUTPUT)$(SEP)test-fuzzydepth4-unique.pgn
	$(PGN_EXTRACT) -C --fuzzydepth 5 -dtest-fuzzydepth5-dupes.pgn -otest-fuzzydepth5-unique.pgn --quiet $(INPUT)$(SEP)test-fuzzydepth.pgn
	$(CMP) test-fuzzydepth5-dupes.pgn $(OUTPUT)$(SEP)test-fuzzydepth5-dupes.pgn
	$(CMP) test-fuzzydepth5-unique.pgn $(OUTPUT)$(SEP)test-fuzzydepth5-unique.pgn

# Selection or exclusion of games with SetUp tags.
#     + Input file with games involving SetUp tags.
#     - Input file(s): test-setup-in.pgn
#     - Game output should either have only games with SetUp tags
#       or only those without.
#     - Expected output: test-nosetup-out.pgn test-onlysetup-out.pgn
test-setup:
	echo "test-setup:"
	$(PGN_EXTRACT) --nosetuptags -otest-nosetup-out.pgn --quiet $(INPUT)$(SEP)test-setup-in.pgn
	$(CMP) test-nosetup-out.pgn $(OUTPUT)$(SEP)test-nosetup-out.pgn
	$(PGN_EXTRACT) --onlysetuptags -otest-onlysetup-out.pgn --quiet $(INPUT)$(SEP)test-setup-in.pgn
	$(CMP) test-onlysetup-out.pgn $(OUTPUT)$(SEP)test-onlysetup-out.pgn

# --stopafter
#     + Input file containing games.
#     - Input file(s): test-stopafter.pgn
#     - Resulting output should contain a single matched game.
#     - Expected output: test-stopafter-out.pgn
test-stopafter:
	echo "test-stopafter:"
	$(PGN_EXTRACT) -TpPetrosian --stopafter 1 -otest-stopafter-out.pgn --quiet $(INPUT)$(SEP)test-stopafter.pgn
	$(CMP) test-stopafter-out.pgn $(OUTPUT)$(SEP)test-stopafter-out.pgn

# --nobadresults
#     + Input file containing games with inconsistent or incomplete results.
#     - Input file(s): test-nobadresults.pgn
#     - Resulting output should contain only those games which are not
#       strictly inconsistent.
#     - Expected output: test-nobadresults-out.pgn
test-nobadresults:
	echo "test-nobadresults:"
	$(PGN_EXTRACT) --nobadresults -otest-nobadresults-out.pgn -ltest-nobadresults-log.txt --quiet $(INPUT)$(SEP)test-nobadresults.pgn
	$(CMP) test-nobadresults-out.pgn $(OUTPUT)$(SEP)test-nobadresults-out.pgn
#       $(CMP) test-nobadresults-log.txt $(OUTPUT)$(SEP)test-nobadresults-log.txt

# --allownullmoves
#     + Input file containing games with inconsistent or incomplete results.
#     - Input file(s): test-allownullmoves.pgn
#     - Resulting output should contain only those games which are not
#       strictly inconsistent.
#     - Expected output: test-allownullmoves-out.pgn
test-allownullmoves:
	echo "test-allownullmoves:"
	$(PGN_EXTRACT) --allownullmoves -otest-allownullmoves-out.pgn -ltest-allownullmoves-log.txt --quiet $(INPUT)$(SEP)test-allownullmoves.pgn
	$(CMP) test-allownullmoves-out.pgn $(OUTPUT)$(SEP)test-allownullmoves-out.pgn
#       $(CMP) test-allownullmoves-log.txt $(OUTPUT)$(SEP)test-allownullmoves-log.txt

# --matchplylimit
#     + Input file containing games.
#     - Input file(s): test-matchplylimit.pgn
#     - Resulting output should contain games whose number of moves (plies) are
#       limited at the specified ply limit.
#     - Expected output: test-matchplylimit-out.pgn
test-matchplylimit:
	echo "test-matchplylimit:"
	-$(RM) test-matchplylimit-out.pgn
	$(PGN_EXTRACT) -Hdb55d4fcaadc775e --matchplylimit 8 --markmatches match -atest-matchplylimit-out.pgn --quiet $(INPUT)$(SEP)test-matchplylimit.pgn
	$(PGN_EXTRACT) -Hdb55d4fcaadc775e --matchplylimit 9 --markmatches match -atest-matchplylimit-out.pgn --quiet $(INPUT)$(SEP)test-matchplylimit.pgn
	$(PGN_EXTRACT) -Hdb55d4fcaadc775e --matchplylimit 10 --markmatches match -atest-matchplylimit-out.pgn --quiet $(INPUT)$(SEP)test-matchplylimit.pgn
	$(PGN_EXTRACT) -Hdb55d4fcaadc775e --matchplylimit 150 --markmatches match -atest-matchplylimit-out.pgn --quiet $(INPUT)$(SEP)test-matchplylimit.pgn
	$(CMP) test-matchplylimit-out.pgn $(OUTPUT)$(SEP)test-matchplylimit-out.pgn

# -A/-t with FENPattern and FENPatternI
# Test both FENPattern and FENPatternI and add a MatchLabel tag
# if the pattern has an associated label.
test-FENPattern:
	echo "test-FENPattern:"
	$(PGN_EXTRACT) -otest-FENPattern-out.pgn -ltest-FENPattern-log.txt --quiet \
            -A$(INPUT)$(SEP)test-FENPattern.txt --addlabeltag --markmatches HERE \
            $(INPUT)$(SEP)/petrosian.pgn
	$(CMP) test-FENPattern-out.pgn $(OUTPUT)$(SEP)test-FENPattern-out.pgn
#       $(CMP) test-FENPattern-log.txt $(OUTPUT)$(SEP)test-FENPattern-log.txt