aboutsummaryrefslogtreecommitdiff
path: root/test/000_basic
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-04-12 20:22:01 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-04-12 20:22:01 +0200
commit72e018b066bd5cc3ce0181b43865a227e8b9b6ec (patch)
tree60b2e8dbe7fd2dd7cf58ecd1606e03146329b516 /test/000_basic
downloadcubecore-72e018b066bd5cc3ce0181b43865a227e8b9b6ec.tar.gz
cubecore-72e018b066bd5cc3ce0181b43865a227e8b9b6ec.zip
Initial fork from H48
Diffstat (limited to 'test/000_basic')
-rw-r--r--test/000_basic/all.in0
-rw-r--r--test/000_basic/all.out7
-rw-r--r--test/000_basic/basic_tests.c33
3 files changed, 40 insertions, 0 deletions
diff --git a/test/000_basic/all.in b/test/000_basic/all.in
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/000_basic/all.in
diff --git a/test/000_basic/all.out b/test/000_basic/all.out
new file mode 100644
index 0000000..892ad22
--- /dev/null
+++ b/test/000_basic/all.out
@@ -0,0 +1,7 @@
1Solved is solvable
2Solved is solved
3Zero is NOT solvable
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/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
3bool issolved(cube_t);
4bool equal(cube_t, cube_t);
5
6void
7check(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
13void
14check2(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
20int 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}

Generated with cgit - Back to sebastiano.tronto.net