From 4eac9372e0d2b9ce84bcb458a0338c0d2ed30260 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Wed, 18 Dec 2024 23:16:35 +0100 Subject: [PATCH] add tests --- bogus.sok | 3 +++ sokoban.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 bogus.sok diff --git a/bogus.sok b/bogus.sok new file mode 100644 index 0000000..97bd873 --- /dev/null +++ b/bogus.sok @@ -0,0 +1,3 @@ +width: 7 +height: 5 +tab: "#### #@ # # #$#### $ ..########" diff --git a/sokoban.c b/sokoban.c index dcc7805..3bf0843 100644 --- a/sokoban.c +++ b/sokoban.c @@ -236,9 +236,17 @@ int main (int argc, char *argv[]) /* test: sokoban.exe -f nofile.sok 2>&1 | grep "can't read file" */ /* test: sokoban.exe -f bogus.sok 2>&1 | grep 'incorrect file' */ /* test: sokoban.exe -h | grep usage */ -/* test: sokoban.exe -l nofile.skb 2>&1 | grep "can't read library" */ -/* test: sokoban.exe -l bogus.skb 2>&1 | grep 'incorrect library' */ +/* test_: sokoban.exe -l nofile.skb 2>&1 | grep "can't read library" */ +/* test_: sokoban.exe -l bogus.skb 2>&1 | grep 'incorrect library' */ +/* test: sokoban.exe -s 2>&1 | grep specified */ /* test: sokoban.exe -v 2>&1 | grep missing */ /* test: sokoban.exe _ 2>&1 | grep invalid */ +/* test: { sleep 1; echo -n k; sleep 1; echo -n q; } | sokoban.exe -f test.sok -s 0 */ +/* test: { sleep 1; echo -n k; sleep 1; echo -n q; } | sokoban.exe -f test.sok -s 1 */ +/* test: { sleep 1; echo -n k; sleep 1; echo -n q; } | sokoban.exe -f test.sok -s 2 */ +/* test: { sleep 1; echo -n k; sleep 1; echo -n q; } | sokoban.exe -f test.sok -s 3 */ +/* test: { sleep 1; echo -n k; sleep 1; echo -ne 'a.sok\e'; sleep 1; echo -e 'sab\b.sok'; sleep 1; echo q; } | sokoban.exe -v 3 -f test.sok */ +/* test: { sleep 1; echo s; sleep 1; echo q; } | sokoban.exe -f a.sok && rm a.sok && test \! -f b.sok */ +/* test: { sleep 1; echo -n kkklll; sleep 1; echo -n jjjiiillkk; sleep 1; echo -n iijjkkkll; sleep 3; echo; } | sokoban.exe -f test.sok -s 3 */ /* vim: set ts=4 sw=4 et: */ -- 2.30.2