diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-14 22:01:38 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-14 22:01:38 +0100 |
| commit | ad9bdca9741b5f038610cbe0536131ab0dc7b511 (patch) | |
| tree | 9c1817f6fca0a529a72bebdd7ed1f75a6e35bf3d /test/000_basic | |
| parent | 41e31b84a9adeae0b6bdbc4c9438bfa5e782c9da (diff) | |
| download | nissy-core-ad9bdca9741b5f038610cbe0536131ab0dc7b511.tar.gz nissy-core-ad9bdca9741b5f038610cbe0536131ab0dc7b511.zip | |
Added tests for conversion
Diffstat (limited to 'test/000_basic')
| -rw-r--r-- | test/000_basic/all.in | 0 | ||||
| -rw-r--r-- | test/000_basic/all.out | 7 | ||||
| -rw-r--r-- | test/000_basic/basic_tests.c | 33 |
3 files changed, 40 insertions, 0 deletions
diff --git a/test/000_basic/all.in b/test/000_basic/all.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/000_basic/all.in | |||
diff --git a/test/000_basic/all.out b/test/000_basic/all.out new file mode 100644 index 0000000..892ad22 --- /dev/null +++ b/test/000_basic/all.out | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | Solved is solvable | ||
| 2 | Solved is solved | ||
| 3 | Zero is NOT solvable | ||
| 4 | Zero is NOT solved | ||
| 5 | Solved and Solved are equal | ||
| 6 | Solved and Zero are NOT equal | ||
| 7 | Zero and Solved are NOT equal | ||
diff --git a/test/000_basic/basic_tests.c b/test/000_basic/basic_tests.c new file mode 100644 index 0000000..17f1b2b --- /dev/null +++ b/test/000_basic/basic_tests.c | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | bool issolved(cube_t); | ||
| 4 | bool equal(cube_t, cube_t); | ||
| 5 | |||
| 6 | void | ||
| 7 | check(cube_t cube, char *name) | ||
| 8 | { | ||
| 9 | printf("%s is%s solvable\n", name, issolvable(cube) ? "" : " NOT"); | ||
| 10 | printf("%s is%s solved\n", name, issolved(cube) ? "" : " NOT"); | ||
| 11 | } | ||
| 12 | |||
| 13 | void | ||
| 14 | check2(cube_t cube1, char *name1, cube_t cube2, char *name2) | ||
| 15 | { | ||
| 16 | printf("%s and %s are%s equal\n", name1, name2, | ||
| 17 | equal(cube1, cube2) ? "" : " NOT"); | ||
| 18 | } | ||
| 19 | |||
| 20 | int main() { | ||
| 21 | cube_t zero, solved; | ||
| 22 | |||
| 23 | memset(&zero, 0, sizeof(cube_t)); | ||
| 24 | solved = solvedcube(); | ||
| 25 | check(solved, "Solved"); | ||
| 26 | check(zero, "Zero"); | ||
| 27 | |||
| 28 | check2(solved, "Solved", solved, "Solved"); | ||
| 29 | check2(solved, "Solved", zero, "Zero"); | ||
| 30 | check2(zero, "Zero", solved, "Solved"); | ||
| 31 | |||
| 32 | return 0; | ||
| 33 | } | ||
