diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-04-12 20:22:01 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-04-12 20:22:01 +0200 |
| commit | 72e018b066bd5cc3ce0181b43865a227e8b9b6ec (patch) | |
| tree | 60b2e8dbe7fd2dd7cf58ecd1606e03146329b516 /test/000_basic/basic_tests.c | |
| download | cubecore-72e018b066bd5cc3ce0181b43865a227e8b9b6ec.tar.gz cubecore-72e018b066bd5cc3ce0181b43865a227e8b9b6ec.zip | |
Initial fork from H48
Diffstat (limited to 'test/000_basic/basic_tests.c')
| -rw-r--r-- | test/000_basic/basic_tests.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/000_basic/basic_tests.c b/test/000_basic/basic_tests.c new file mode 100644 index 0000000..c4434c5 --- /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(void) { | ||
| 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 | } | ||
