diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-12 10:21:52 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-12 10:22:50 +0200 |
| commit | 9b680fadec01789c1fb1317b939c15d186a572c9 (patch) | |
| tree | d9038076657ec3cf887e5fd2bd14f0155ac25b7e /shell | |
| parent | c4f64cf2556c0f8597e1fbc19d7c664b8da94612 (diff) | |
| download | nissy-core-9b680fadec01789c1fb1317b939c15d186a572c9.tar.gz nissy-core-9b680fadec01789c1fb1317b939c15d186a572c9.zip | |
Added shelltest
Will add more tests when I feel like it
Diffstat (limited to '')
| -rw-r--r-- | shell/shell.c (renamed from shell.c) | 2 | ||||
| -rwxr-xr-x | shell/test.sh | 22 | ||||
| -rw-r--r-- | shell/testcases/000_frommoves.in | 1 | ||||
| -rw-r--r-- | shell/testcases/000_frommoves.out | 1 | ||||
| -rw-r--r-- | shell/testcases/001_compose.in | 1 | ||||
| -rw-r--r-- | shell/testcases/001_compose.out | 1 |
6 files changed, 27 insertions, 1 deletions
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <string.h> | 7 | #include <string.h> |
| 8 | #include <time.h> | 8 | #include <time.h> |
| 9 | 9 | ||
| 10 | #include "src/nissy.h" | 10 | #include "../src/nissy.h" |
| 11 | 11 | ||
| 12 | #define PRINTCUBE_BUFFER_SIZE UINT64_C(1024) | 12 | #define PRINTCUBE_BUFFER_SIZE UINT64_C(1024) |
| 13 | #define SOLUTIONS_BUFFER_SIZE UINT64_C(500000) | 13 | #define SOLUTIONS_BUFFER_SIZE UINT64_C(500000) |
diff --git a/shell/test.sh b/shell/test.sh new file mode 100755 index 0000000..de888ef --- /dev/null +++ b/shell/test.sh | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | SHELLBIN="./run" | ||
| 4 | TESTDIR="./shell/testcases" | ||
| 5 | TESTOUT="shell/lasttest.out" | ||
| 6 | TESTERR="shell/lasttest.err" | ||
| 7 | |||
| 8 | for cin in "$TESTDIR"/*.in; do | ||
| 9 | c=$(echo "$cin" | sed 's/\.in//') | ||
| 10 | cout="$c.out" | ||
| 11 | printf "%s: " "$c" | ||
| 12 | (cat "$cin" | xargs "$SHELLBIN") > $TESTOUT 2> $TESTERR | ||
| 13 | if diff "$cout" "$TESTOUT"; then | ||
| 14 | printf "OK\n" | ||
| 15 | else | ||
| 16 | printf "Test failed! stderr:\n" | ||
| 17 | cat $TESTERR | ||
| 18 | exit 1 | ||
| 19 | fi | ||
| 20 | done | ||
| 21 | |||
| 22 | echo "All tests passed!" | ||
diff --git a/shell/testcases/000_frommoves.in b/shell/testcases/000_frommoves.in new file mode 100644 index 0000000..2b3c6d1 --- /dev/null +++ b/shell/testcases/000_frommoves.in | |||
| @@ -0,0 +1 @@ | |||
| frommoves -moves "UFRR" | |||
diff --git a/shell/testcases/000_frommoves.out b/shell/testcases/000_frommoves.out new file mode 100644 index 0000000..dfefe81 --- /dev/null +++ b/shell/testcases/000_frommoves.out | |||
| @@ -0,0 +1 @@ | |||
| DEOISVBH=ZFCYHAGBLTKU | |||
diff --git a/shell/testcases/001_compose.in b/shell/testcases/001_compose.in new file mode 100644 index 0000000..fa09a0b --- /dev/null +++ b/shell/testcases/001_compose.in | |||
| @@ -0,0 +1 @@ | |||
| compose -cube NEORSQLH=ZFCYUAGLHTKB -perm NEORSQLH=ZFCYUAGLHTKB | |||
diff --git a/shell/testcases/001_compose.out b/shell/testcases/001_compose.out new file mode 100644 index 0000000..d36a93c --- /dev/null +++ b/shell/testcases/001_compose.out | |||
| @@ -0,0 +1 @@ | |||
| ASTUGFBH=DACXEZGBLIKF | |||
