aboutsummaryrefslogtreecommitdiff
path: root/test/000_basic
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-11-14 22:01:38 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-11-14 22:01:38 +0100
commitad9bdca9741b5f038610cbe0536131ab0dc7b511 (patch)
tree9c1817f6fca0a529a72bebdd7ed1f75a6e35bf3d /test/000_basic
parent41e31b84a9adeae0b6bdbc4c9438bfa5e782c9da (diff)
downloadnissy-core-ad9bdca9741b5f038610cbe0536131ab0dc7b511.tar.gz
nissy-core-ad9bdca9741b5f038610cbe0536131ab0dc7b511.zip
Added tests for conversion
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..17f1b2b
--- /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() {
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