diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-28 13:52:00 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-28 13:52:00 +0200 |
| commit | 7f24b27652ee6fa84e38f181cea57f319af0c204 (patch) | |
| tree | 269b15baf20c2ae4ed3bb1fdb052340311aa1981 /test/000_basic/basic_tests.c | |
| parent | 9b248f3b46d5dc0e9522ed264ef71e422a5bc5a5 (diff) | |
| download | nissy-core-7f24b27652ee6fa84e38f181cea57f319af0c204.tar.gz nissy-core-7f24b27652ee6fa84e38f181cea57f319af0c204.zip | |
Make failed assert exit immediately
Diffstat (limited to 'test/000_basic/basic_tests.c')
| -rw-r--r-- | test/000_basic/basic_tests.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/test/000_basic/basic_tests.c b/test/000_basic/basic_tests.c deleted file mode 100644 index df38e88..0000000 --- a/test/000_basic/basic_tests.c +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | bool issolved(oriented_cube_t); | ||
| 4 | bool equal(cube_t, cube_t); | ||
| 5 | |||
| 6 | void | ||
| 7 | check(oriented_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(oriented_cube_t cube1, char *name1, oriented_cube_t cube2, char *name2) | ||
| 15 | { | ||
| 16 | bool eq = equal(cube1.cube, cube2.cube) && | ||
| 17 | cube1.orientation == cube2.orientation; | ||
| 18 | printf("%s and %s are%s equal\n", name1, name2, eq ? "" : " NOT"); | ||
| 19 | } | ||
| 20 | |||
| 21 | void run(void) { | ||
| 22 | oriented_cube_t zero, solved; | ||
| 23 | |||
| 24 | memset(&zero, 0, sizeof(oriented_cube_t)); | ||
| 25 | solved = solvedcube(); | ||
| 26 | |||
| 27 | check(solved, "Solved"); | ||
| 28 | check(zero, "Zero"); | ||
| 29 | |||
| 30 | check2(solved, "Solved", solved, "Solved"); | ||
| 31 | check2(solved, "Solved", zero, "Zero"); | ||
| 32 | check2(zero, "Zero", solved, "Solved"); | ||
| 33 | } | ||
