aboutsummaryrefslogtreecommitdiff
path: root/test/081_invcoord_co
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-12-22 18:07:06 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2025-12-22 18:07:06 +0100
commit086a06fe3d84ac8b2e74c824e05f9d23f0b292ab (patch)
tree596034b2283b053e023d0988d875396946b9384d /test/081_invcoord_co
parent0c5e4730c699ac006feec4efe25c390977fe372f (diff)
downloadnissy-core-086a06fe3d84ac8b2e74c824e05f9d23f0b292ab.tar.gz
nissy-core-086a06fe3d84ac8b2e74c824e05f9d23f0b292ab.zip
Added tests for copy_co, renamed some tests
Diffstat (limited to 'test/081_invcoord_co')
-rw-r--r--test/081_invcoord_co/00_all.in0
-rw-r--r--test/081_invcoord_co/00_all.out1
-rw-r--r--test/081_invcoord_co/invcoord_co_tests.c36
3 files changed, 37 insertions, 0 deletions
diff --git a/test/081_invcoord_co/00_all.in b/test/081_invcoord_co/00_all.in
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/081_invcoord_co/00_all.in
diff --git a/test/081_invcoord_co/00_all.out b/test/081_invcoord_co/00_all.out
new file mode 100644
index 0000000..d6109db
--- /dev/null
+++ b/test/081_invcoord_co/00_all.out
@@ -0,0 +1 @@
All good
diff --git a/test/081_invcoord_co/invcoord_co_tests.c b/test/081_invcoord_co/invcoord_co_tests.c
new file mode 100644
index 0000000..dd5853e
--- /dev/null
+++ b/test/081_invcoord_co/invcoord_co_tests.c
@@ -0,0 +1,36 @@
1#include "../test.h"
2
3#define POW_3_7 2187
4
5uint64_t coord_co(cube_t);
6cube_t invcoord_co(uint64_t);
7
8void run(void) {
9 oriented_cube_t cube;
10 uint64_t coord, coord2;
11
12 cube.orientation = 0;
13
14 /* Test all possible values for CO coordinate */
15 for (coord = 0; coord < POW_3_7; coord++) {
16 cube.cube = invcoord_co(coord);
17
18 if (!isconsistent(cube)) {
19 printf("Not consistent\n");
20 return;
21 }
22 if (!issolvable(cube)) {
23 printf("Not solvable\n");
24 return;
25 }
26
27 coord2 = coord_co(cube.cube);
28 if (coord != coord2) {
29 printf("Error: invcoord of %" PRIu64
30 " returns %" PRIu64 "\n", coord, coord2);
31 return;
32 }
33 }
34
35 printf("All good\n");
36}

Generated with cgit - Back to sebastiano.tronto.net