/* have to add -o- to get stdout
*/
TEST2PGM  ="$(LIT2PGM)   -o-"
TEST2PGM_Q="$(LIT2PGM) -q -o-"
TEST2TEXI ="$(LIT2TEXI)  -o-"
TEST2LATEX="$(LIT2LATEX) -o-"

LitStuffNeededHere(runtests)

runtests::
	@echo '###############################################################'
	@echo '# The <n>[pqtldc] tests are of lit2pgm, lit2pgm -q, lit2texi, #'
	@echo '# lit2latex, mkdependlit, and lit2changelog, respectively.    #'
	@echo '###############################################################'

ExtraStuffToBeVeryClean( $(STD_VERY_CLEAN) )

/* a StdTest runs a "program" with a given "command line", and
   checks for (1) an expected exit code; (2) expected data on stdout;
   and (3) expected data on stderr.
*/

/* test01: -q will not catch the warnings; not a complete document */
RunStdTest(01p,$(TEST2PGM),     test01.lhs -o1 test01.epgm -o2 test01.stderr)
RunStdTest(01q,$(TEST2PGM_Q),   test01.lhs -o1 test01.epgm)
RunStdTest(01t,$(TEST2TEXI), -c test01.lhs -o1 test01.etxi -o2 test01.stderr)
RunStdTest(01l,$(TEST2LATEX),-c test01.lhs -o1 test01.etex -o2 test01.stderr)

/* test02: also not a complete document */
RunStdTest(02p,$(TEST2PGM),      test02.lit)
RunStdTest(02q,$(TEST2PGM_Q),    test02.lit)
RunStdTest(02t,$(TEST2TEXI), -c test02.lit -o1 test02.etxi)
RunStdTest(02l,$(TEST2LATEX),-c test02.lit -o1 test02.etex)

/* test03: not a complete document either */
RunStdTest(03p,$(TEST2PGM),      test03.lit)
RunStdTest(03q,$(TEST2PGM_Q),    test03.lit)
RunStdTest(03t,$(TEST2TEXI), -c test03.lit -o1 test03.etxi)
RunStdTest(03l,$(TEST2LATEX),-c test03.lit -o1 test03.etex)

RunStdTest(04p,$(TEST2PGM),  test04.lit -o2 test04.stderr)
RunStdTest(04q,$(TEST2PGM_Q),test04.lit -o2 test04.stderr)
RunStdTest(04t,$(TEST2TEXI), test04.lit -o1 test04.etxi -o2 test04.stderr)
RunStdTest(04l,$(TEST2LATEX),test04.lit -o1 test04.etex -o2 test04.stderr)

RunStdTest(05p,$(TEST2PGM),  test05.lhs -o1 test05.epgm)
/* test 5 has code ribbons, so -q will not work */
RunStdTest(05t,$(TEST2TEXI), test05.lhs -o1 test05.etxi)
RunStdTest(05l,$(TEST2LATEX),test05.lhs -o1 test05.etex)

/* I cannot really tell what test06 was for... */
RunStdTest(06p,$(TEST2PGM),  test06.lit)
RunStdTest(06q,$(TEST2PGM_Q),test06.lit)
RunStdTest(06t,$(TEST2TEXI), test06.lit -o1 test06.etxi)
RunStdTest(06l,$(TEST2LATEX),test06.lit -o1 test06.etex)

RunStdTest(07p,$(TEST2PGM),  test07.lit)
RunStdTest(07q,$(TEST2PGM_Q),test07.lit)
RunStdTest(07t,$(TEST2TEXI), test07.lit -o1 test07.etxi)
RunStdTest(07l,$(TEST2LATEX),test07.lit -o1 test07.etex)

RunStdTest(08p,$(TEST2PGM),  test08.lit)
RunStdTest(08q,$(TEST2PGM_Q),test08.lit)
RunStdTest(08t,$(TEST2TEXI), test08.lit -o1 test08.etxi)
RunStdTest(08l,$(TEST2LATEX),test08.lit -o1 test08.etex)

/* test09 needs its \input followed */
/* lit2pgm is of unusual lack of interest for test09 */
/* maybe the two runs should NOT have diff error output ... */
RunStdTest(09t,$(TEST2TEXI), -n test09.lit -x2 -o1 test09.etxi -o2 test09t.stderr)
RunStdTest(09l,$(TEST2LATEX),-n test09.lit -x1 -o1 test09.etex -o2 test09l.stderr)

/* I nominate this test for more math-mode stuff... */
RunStdTest(10p,$(TEST2PGM),  test10.lit)
RunStdTest(10q,$(TEST2PGM_Q),test10.lit)
RunStdTest(10t,$(TEST2TEXI), test10.lit -o1 test10.etxi)
RunStdTest(10l,$(TEST2LATEX),test10.lit -o1 test10.etex)

RunStdTest(11p,$(TEST2PGM),  test11.lprl -o1 test11.epgm -o2 test11.stderr)
RunStdTest(11q,$(TEST2PGM_Q),test11.lprl -o1 test11.epgm -o2 test11.stderr)
RunStdTest(11t,$(TEST2TEXI), test11.lprl -o1 test11.etxi -o2 test11.stderr)
RunStdTest(11l,$(TEST2LATEX),test11.lprl -o1 test11.etex -o2 test11.stderr)

/* test12 needs its \input followed */
/* lit2pgm is of little interest for test12 */
RunStdTest(12t,$(TEST2TEXI),  -n test12.lit -o1 test12.etxi)
RunStdTest(12l,$(TEST2LATEX), -n test12.lit -o1 test12.etex)

/* tests end-of-file Bird code; last line without newline */
/* see also test 18 */
RunStdTest(13p,$(TEST2PGM),  test13.lhs -o1 test13.epgm)
RunStdTest(13q,$(TEST2PGM_Q),test13.lhs -o1 test13.epgm)

/* tests beginning-of-file Bird code; two variants */
RunStdTest(14a-p,$(TEST2PGM),  test14a.lhs -o1 test14a.epgm)
RunStdTest(14a-q,$(TEST2PGM_Q),test14a.lhs -o1 test14a.epgm)
RunStdTest(14b-p,$(TEST2PGM),  test14b.lhs -o1 test14b.epgm)
RunStdTest(14b-q,$(TEST2PGM_Q),test14b.lhs -o1 test14b.epgm)

/* test15 needs its \input followed
    it's checking error checking on Bird-style code, so no real output
    error outputs should differ trivially...
*/
RunStdTest(15p,$(TEST2PGM),  -n test15.lit -x1 -o1 test15.epgm -o2 test15p.stderr)
/* no -q & input following... */
RunStdTest(15t,$(TEST2TEXI), -n test15.lit -x1 -o2 test15t.stderr)
RunStdTest(15l,$(TEST2LATEX),-n test15.lit -x1 -o2 test15l.stderr)

RunStdTest(16p,$(TEST2PGM),  test16.lit -o1 test16.epgm)
RunStdTest(16q,$(TEST2PGM_Q),test16.lit -o1 test16.epgm)
RunStdTest(16t,$(TEST2TEXI), test16.lit -o1 test16.etxi)
RunStdTest(16l,$(TEST2LATEX),test16.lit -o1 test16.etex)

RunStdTest(17p,$(TEST2PGM),  test17.lhs -o1 test17.epgm)
RunStdTest(17q,$(TEST2PGM_Q),test17.lhs -o1 test17.epgm)
RunStdTest(17t,$(TEST2TEXI), test17.lhs -o1 test17.etxi)
RunStdTest(17l,$(TEST2LATEX),test17.lhs -o1 test17.etex)

/* Bird-style code testing, again; see also test 13 */
RunStdTest(18p,$(TEST2PGM),  test18.lhs -o1 test18.epgm)
RunStdTest(18q,$(TEST2PGM_Q),test18.lhs -o1 test18.epgm)

/* test 19: fiddle the language with -lhs */
RunStdTest(19p,$(TEST2PGM),        test19.lit)
RunStdTest(19q,$(TEST2PGM_Q),      test19.lit)
RunStdTest(19t,$(TEST2TEXI), -lhs test19.lit -o1 test19.etxi)
RunStdTest(19l,$(TEST2LATEX),-lhs test19.lit -o1 test19.etex)

RunStdTest(20p,$(TEST2PGM),       test20.lit)
RunStdTest(20q,$(TEST2PGM_Q),     test20.lit)
/* run each standalone and not */
RunStdTest(20t-c,$(TEST2TEXI), -c test20.lit -o1 test20-c.etxi)
RunStdTest(20t-S,$(TEST2TEXI), -S test20.lit -o1 test20-S.etxi)
RunStdTest(20l-c,$(TEST2LATEX),-c test20.lit -o1 test20-c.etex)
RunStdTest(20l-S,$(TEST2LATEX),-S test20.lit -o1 test20-S.etex)

RunStdTest(21p,$(TEST2PGM),       test21.lit -x2 -o2 test21.stderr)
/* will not see the errors... */
RunStdTest(21q,$(TEST2PGM_Q),     test21.lit)
/* run each standalone and not */
RunStdTest(21t-c,$(TEST2TEXI), -c test21.lit -x2 -o1 test21-c.etxi -o2 test21.stderr)
RunStdTest(21t-S,$(TEST2TEXI), -S test21.lit -x2 -o1 test21-S.etxi -o2 test21.stderr)
RunStdTest(21l-c,$(TEST2LATEX),-c test21.lit -x2 -o1 test21-c.etex -o2 test21.stderr)
RunStdTest(21l-S,$(TEST2LATEX),-S test21.lit -x2 -o1 test21-S.etex -o2 test21.stderr)
/* some node-grabbing tests... */
/* should give same output */
RunStdTest(21l-g1,$(TEST2LATEX),-S -g Top test21.lit -x2 -o1 test21-S.etex -o2 test21.stderr)
/* should fail with no output */
RunStdTest(21l-g2,$(TEST2LATEX),-S -g Foo test21.lit -x3 -o2 test21-g2.stderr)
/* these should work */
RunStdTest(21l-g3,$(TEST2LATEX),-S -g ap_depth_10 test21.lit -x2 -o1 test21-g3.etex -o2 test21.stderr)
RunStdTest(21l-g4,$(TEST2LATEX),-S -g depth_0 test21.lit -x2 -o1 test21-g4.etex -o2 test21.stderr)
RunStdTest(21l-g5,$(TEST2LATEX),-S -g ap_subsubsubsection test21.lit -x2 -o1 test21-g5.etex -o2 test21.stderr)

/* test 22: fiddle the language with -lhs */
RunStdTest(22t,$(TEST2TEXI), -lhs test22.lit -o1 test22.etxi)
RunStdTest(22l,$(TEST2LATEX),-lhs test22.lit -o1 test22.etex)

RunStdTest(23t,$(TEST2TEXI), -lhs test23.lit -o1 test23.etxi)
RunStdTest(23l,$(TEST2LATEX),-lhs test23.lit -o1 test23.etex)

/* some old Cordy code... */
RunStdTest(24p,$(TEST2PGM),  test24.lhs -o1 test24.epgm)
RunStdTest(24q,$(TEST2PGM_Q),test24.lhs -o1 test24.epgm)
RunStdTest(24t,$(TEST2TEXI), test24.lhs -o1 test24.etxi)
RunStdTest(24l,$(TEST2LATEX),test24.lhs -o1 test24.etex)

/* a little of everything; needs some flags... */
RunStdTest(25p,$(TEST2PGM),  test25.lhs -o1 test25.epgm)
RunStdTest(25q,$(TEST2PGM_Q),test25.lhs -o1 test25.epgm)
RunStdTest(25t,$(TEST2TEXI), -S -O test25.lhs -o1 test25.etxi)
RunStdTest(25l,$(TEST2LATEX),-S -O test25.lhs -o1 test25.etex)

/* @...@ stuff in section headings (sigh) */
RunStdTest(26t,$(TEST2TEXI), -c test26.lhs -o1 test26.etxi)
RunStdTest(26l,$(TEST2LATEX),-c test26.lhs -o1 test26.etex)

/* spacing around index entries */
RunStdTest(27t,$(TEST2TEXI), -c test27.lit -o1 test27.etxi)
RunStdTest(27l,$(TEST2LATEX),-c test27.lit -o1 test27.etex)

/* \insertribbon */
RunStdTest(28p,$(TEST2PGM),  test28.lhs -o1 test28.epgm)
/* -q and \insertribbon do not mix */
RunStdTest(28t,$(TEST2TEXI), -c test28.lhs -o1 test28.etxi)
RunStdTest(28l,$(TEST2LATEX),-c test28.lhs -o1 test28.etex)

/* Kevin's \item[foo{X}] example */
RunStdTest(29t,$(TEST2TEXI), test29.lit -o1 test29.etxi)
RunStdTest(29l,$(TEST2LATEX),test29.lit -o1 test29.etex)

/* Phil's indexing of "@name :: ...@" example */
RunStdTest(30t,$(TEST2TEXI), test30.lhs -o1 test30.etxi)
RunStdTest(30l,$(TEST2LATEX),test30.lhs -o1 test30.etex)

/* WDP's \item[\pl{\index[<tag>]{<entry>}}:] example */
RunStdTest(31t,$(TEST2TEXI), test31.lit -o1 test31.etxi)
RunStdTest(31l,$(TEST2LATEX),test31.lit -o1 test31.etex)

/* test code formatting ("bird" option)
    also test: -t bird and -t nobird options
    and: try those with/without -t tgrind, -t ruled, -t unruled
*/
RunStdTest(32t,$(TEST2TEXI), test32.lhs -o1 test32.etxi)
RunStdTest(32l,$(TEST2LATEX),test32.lhs -o1 test32.etex)

RunStdTest(32l-bird,$(TEST2LATEX),-tbird test32.lhs -o1 test32-bird.etex)
RunStdTest(32l-nobird,$(TEST2LATEX),-tnobird test32.lhs -o1 test32-nobird.etex)

RunStdTest(32l-bird2,$(TEST2LATEX),"-tbird,tgrind" test32.lhs -o1 test32-bird2.etex)
RunStdTest(32l-nobird2,$(TEST2LATEX),"-tnobird,ruled" test32.lhs -o1 test32-nobird2.etex)
RunStdTest(32l-bird3,$(TEST2LATEX),"-tbird,tgrind,unruled" test32.lhs -o1 test32-bird3.etex)
RunStdTest(32l-nobird3,$(TEST2LATEX),"-tnobird,ruled" test32.lhs -o1 test32-nobird3.etex)

/* rawlatex */
RunStdTest(33t,$(TEST2TEXI), -c test33.lhs -o1 test33.etxi)
RunStdTest(33l,$(TEST2LATEX),-c test33.lhs -o1 test33.etex)
