diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-22 16:12:21 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-22 16:12:21 +0200 |
| commit | bab22e1946a656088804b61cf765461b48744971 (patch) | |
| tree | 43ae3798e5c2f4fc63e68df72d134e742fcaf834 /test/000_basic/basic_tests.c | |
| parent | 93522effba2f200257141189de5925a23fca93b8 (diff) | |
| download | nissy-core-bab22e1946a656088804b61cf765461b48744971.tar.gz nissy-core-bab22e1946a656088804b61cf765461b48744971.zip | |
Update tests for oriented_cube_t
Diffstat (limited to 'test/000_basic/basic_tests.c')
| -rw-r--r-- | test/000_basic/basic_tests.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/000_basic/basic_tests.c b/test/000_basic/basic_tests.c index accde66..df38e88 100644 --- a/test/000_basic/basic_tests.c +++ b/test/000_basic/basic_tests.c | |||
| @@ -1,27 +1,29 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | bool issolved(cube_t); | 3 | bool issolved(oriented_cube_t); |
| 4 | bool equal(cube_t, cube_t); | 4 | bool equal(cube_t, cube_t); |
| 5 | 5 | ||
| 6 | void | 6 | void |
| 7 | check(cube_t cube, char *name) | 7 | check(oriented_cube_t cube, char *name) |
| 8 | { | 8 | { |
| 9 | printf("%s is%s solvable\n", name, issolvable(cube) ? "" : " NOT"); | 9 | printf("%s is%s solvable\n", name, issolvable(cube) ? "" : " NOT"); |
| 10 | printf("%s is%s solved\n", name, issolved(cube) ? "" : " NOT"); | 10 | printf("%s is%s solved\n", name, issolved(cube) ? "" : " NOT"); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | void | 13 | void |
| 14 | check2(cube_t cube1, char *name1, cube_t cube2, char *name2) | 14 | check2(oriented_cube_t cube1, char *name1, oriented_cube_t cube2, char *name2) |
| 15 | { | 15 | { |
| 16 | printf("%s and %s are%s equal\n", name1, name2, | 16 | bool eq = equal(cube1.cube, cube2.cube) && |
| 17 | equal(cube1, cube2) ? "" : " NOT"); | 17 | cube1.orientation == cube2.orientation; |
| 18 | printf("%s and %s are%s equal\n", name1, name2, eq ? "" : " NOT"); | ||
| 18 | } | 19 | } |
| 19 | 20 | ||
| 20 | void run(void) { | 21 | void run(void) { |
| 21 | cube_t zero, solved; | 22 | oriented_cube_t zero, solved; |
| 22 | 23 | ||
| 23 | memset(&zero, 0, sizeof(cube_t)); | 24 | memset(&zero, 0, sizeof(oriented_cube_t)); |
| 24 | solved = solvedcube(); | 25 | solved = solvedcube(); |
| 26 | |||
| 25 | check(solved, "Solved"); | 27 | check(solved, "Solved"); |
| 26 | check(zero, "Zero"); | 28 | check(zero, "Zero"); |
| 27 | 29 | ||
