From 086a06fe3d84ac8b2e74c824e05f9d23f0b292ab Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 22 Dec 2025 18:07:06 +0100 Subject: Added tests for copy_co, renamed some tests --- test/081_invcoord_co/00_all.in | 0 test/081_invcoord_co/00_all.out | 1 + test/081_invcoord_co/invcoord_co_tests.c | 36 ++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 test/081_invcoord_co/00_all.in create mode 100644 test/081_invcoord_co/00_all.out create mode 100644 test/081_invcoord_co/invcoord_co_tests.c (limited to 'test/081_invcoord_co') 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 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 @@ +#include "../test.h" + +#define POW_3_7 2187 + +uint64_t coord_co(cube_t); +cube_t invcoord_co(uint64_t); + +void run(void) { + oriented_cube_t cube; + uint64_t coord, coord2; + + cube.orientation = 0; + + /* Test all possible values for CO coordinate */ + for (coord = 0; coord < POW_3_7; coord++) { + cube.cube = invcoord_co(coord); + + if (!isconsistent(cube)) { + printf("Not consistent\n"); + return; + } + if (!issolvable(cube)) { + printf("Not solvable\n"); + return; + } + + coord2 = coord_co(cube.cube); + if (coord != coord2) { + printf("Error: invcoord of %" PRIu64 + " returns %" PRIu64 "\n", coord, coord2); + return; + } + } + + printf("All good\n"); +} -- cgit v1.3