diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-09-08 18:28:30 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-09-08 18:28:30 +0200 |
| commit | 4d08bf731a099de2d174c73489636e1a12935aee (patch) | |
| tree | c751858cb6e33172c97a1123432f7c59d7d94d7e /test/00_basic | |
| parent | c5dfc897160bc9bbc6a91c77b5d58d421fd1cfe1 (diff) | |
| download | nissy-core-4d08bf731a099de2d174c73489636e1a12935aee.tar.gz nissy-core-4d08bf731a099de2d174c73489636e1a12935aee.zip | |
New implementation, moved old to experiments/
Diffstat (limited to '')
| -rw-r--r-- | test/00_basic/all.out | 3 | ||||
| -rw-r--r-- | test/00_basic/basic_tests.c | 27 |
2 files changed, 23 insertions, 7 deletions
diff --git a/test/00_basic/all.out b/test/00_basic/all.out index d77f7f4..aad167e 100644 --- a/test/00_basic/all.out +++ b/test/00_basic/all.out | |||
| @@ -2,3 +2,6 @@ Solved is consistent | |||
| 2 | Solved is solved | 2 | Solved is solved |
| 3 | Zero is NOT consistent | 3 | Zero is NOT consistent |
| 4 | Zero is NOT solved | 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/00_basic/basic_tests.c b/test/00_basic/basic_tests.c index cc2a55c..8c52941 100644 --- a/test/00_basic/basic_tests.c +++ b/test/00_basic/basic_tests.c | |||
| @@ -4,16 +4,29 @@ | |||
| 4 | 4 | ||
| 5 | #include "../../src/cube.h" | 5 | #include "../../src/cube.h" |
| 6 | 6 | ||
| 7 | void | ||
| 8 | check(cube_t cube, char *name) | ||
| 9 | { | ||
| 10 | printf("%s is%s consistent\n", name, isconsistent(cube) ? "" : " NOT"); | ||
| 11 | printf("%s is%s solved\n", name, issolved(cube) ? "" : " NOT"); | ||
| 12 | } | ||
| 13 | |||
| 14 | void | ||
| 15 | check2(cube_t cube1, char *name1, cube_t cube2, char *name2) | ||
| 16 | { | ||
| 17 | printf("%s and %s are%s equal\n", name1, name2, | ||
| 18 | equal(cube1, cube2) ? "" : " NOT"); | ||
| 19 | } | ||
| 20 | |||
| 7 | int main() { | 21 | int main() { |
| 8 | cube_t z, s; | 22 | cube_t zero = (cube_t){0}; |
| 9 | 23 | ||
| 10 | s = solvedcube; | 24 | check(solvedcube, "Solved"); |
| 11 | printf("Solved %s consistent\n", isconsistent(s) ? "is" : "is NOT"); | 25 | check(zero, "Zero"); |
| 12 | printf("Solved %s solved\n", issolved(s) ? "is" : "is NOT"); | ||
| 13 | 26 | ||
| 14 | z = (cube_t){0}; | 27 | check2(solvedcube, "Solved", solvedcube, "Solved"); |
| 15 | printf("Zero %s consistent\n", isconsistent(z) ? "is" : "is NOT"); | 28 | check2(solvedcube, "Solved", zero, "Zero"); |
| 16 | printf("Zero %s solved\n", issolved(z) ? "is" : "is NOT"); | 29 | check2(zero, "Zero", solvedcube, "Solved"); |
| 17 | 30 | ||
| 18 | return 0; | 31 | return 0; |
| 19 | } | 32 | } |
