aboutsummaryrefslogtreecommitdiff
path: root/test/00_basic
diff options
context:
space:
mode:
Diffstat (limited to 'test/00_basic')
-rw-r--r--test/00_basic/all.out3
-rw-r--r--test/00_basic/basic_tests.c27
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
2Solved is solved 2Solved is solved
3Zero is NOT consistent 3Zero is NOT consistent
4Zero is NOT solved 4Zero is NOT solved
5Solved and Solved are equal
6Solved and Zero are NOT equal
7Zero 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
7void
8check(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
14void
15check2(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
7int main() { 21int 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}

Generated with cgit - Back to sebastiano.tronto.net