From 7b1836b35e4e4e275c093f1a120db8006108b90d Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 20 May 2024 11:00:48 +0200 Subject: Added tests for h48 invcoord --- test/001_cube_conversion/cube_conversion_tests.c | 2 -- test/071_coord_eo/coord_eo_tests.c | 1 - test/072_coord_co/coord_co_tests.c | 1 - test/073_coord_csep/coord_csep_tests.c | 1 - test/074_coord_esep/coord_esep_tests.c | 1 - test/075_set_eo/set_eo_tests.c | 2 -- test/076_copy_corners/copy_corners_tests.c | 2 -- test/077_copy_edges/copy_edges_tests.c | 2 -- test/078_invcoord_esep/invcoord_esep_tests.c | 1 - test/101_coord_invcoord_h48/00_all.in | 8 +++++ test/101_coord_invcoord_h48/00_all.out | 8 +++++ .../coord_invcoord_h48_tests.c | 40 ++++++++++++++++++++++ test/101_gendata_esep/00_all.in | 0 test/101_gendata_esep/00_all.out | 1 - test/101_gendata_esep/gendata_esep_tests.c | 22 ------------ test/102_gendata_esep/00_all.in | 0 test/102_gendata_esep/00_all.out | 1 + test/102_gendata_esep/gendata_esep_tests.c | 22 ++++++++++++ test/test.h | 2 ++ 19 files changed, 81 insertions(+), 36 deletions(-) create mode 100644 test/101_coord_invcoord_h48/00_all.in create mode 100644 test/101_coord_invcoord_h48/00_all.out create mode 100644 test/101_coord_invcoord_h48/coord_invcoord_h48_tests.c delete mode 100644 test/101_gendata_esep/00_all.in delete mode 100644 test/101_gendata_esep/00_all.out delete mode 100644 test/101_gendata_esep/gendata_esep_tests.c create mode 100644 test/102_gendata_esep/00_all.in create mode 100644 test/102_gendata_esep/00_all.out create mode 100644 test/102_gendata_esep/gendata_esep_tests.c (limited to 'test') diff --git a/test/001_cube_conversion/cube_conversion_tests.c b/test/001_cube_conversion/cube_conversion_tests.c index 589eb82..df03eb6 100644 --- a/test/001_cube_conversion/cube_conversion_tests.c +++ b/test/001_cube_conversion/cube_conversion_tests.c @@ -1,7 +1,5 @@ #include "../test.h" -cube_fast_t cubetofast(cube_t); -cube_t fasttocube(cube_fast_t); bool equal(cube_t, cube_t); int main(void) { diff --git a/test/071_coord_eo/coord_eo_tests.c b/test/071_coord_eo/coord_eo_tests.c index 85128e0..5eec4fc 100644 --- a/test/071_coord_eo/coord_eo_tests.c +++ b/test/071_coord_eo/coord_eo_tests.c @@ -1,7 +1,6 @@ #include "../test.h" int64_t coord_fast_eo(cube_fast_t); -cube_fast_t cubetofast(cube_t); int main(void) { char str[STRLENMAX]; diff --git a/test/072_coord_co/coord_co_tests.c b/test/072_coord_co/coord_co_tests.c index bb061e5..8461324 100644 --- a/test/072_coord_co/coord_co_tests.c +++ b/test/072_coord_co/coord_co_tests.c @@ -1,7 +1,6 @@ #include "../test.h" int64_t coord_fast_co(cube_fast_t); -cube_fast_t cubetofast(cube_t); int main(void) { char str[STRLENMAX]; diff --git a/test/073_coord_csep/coord_csep_tests.c b/test/073_coord_csep/coord_csep_tests.c index b36bf1a..c4113d3 100644 --- a/test/073_coord_csep/coord_csep_tests.c +++ b/test/073_coord_csep/coord_csep_tests.c @@ -1,7 +1,6 @@ #include "../test.h" int64_t coord_fast_csep(cube_fast_t); -cube_fast_t cubetofast(cube_t); int main(void) { char str[STRLENMAX]; diff --git a/test/074_coord_esep/coord_esep_tests.c b/test/074_coord_esep/coord_esep_tests.c index 8276dc0..fa21d67 100644 --- a/test/074_coord_esep/coord_esep_tests.c +++ b/test/074_coord_esep/coord_esep_tests.c @@ -1,7 +1,6 @@ #include "../test.h" int64_t coord_fast_esep(cube_fast_t); -cube_fast_t cubetofast(cube_t); int main(void) { char str[STRLENMAX]; diff --git a/test/075_set_eo/set_eo_tests.c b/test/075_set_eo/set_eo_tests.c index ef7215a..08c8ae8 100644 --- a/test/075_set_eo/set_eo_tests.c +++ b/test/075_set_eo/set_eo_tests.c @@ -2,8 +2,6 @@ int64_t coord_fast_eo(cube_fast_t); void set_eo_fast(cube_fast_t *, int64_t); -cube_fast_t cubetofast(cube_t); -cube_t fasttocube(cube_fast_t); int main(void) { char str[STRLENMAX]; diff --git a/test/076_copy_corners/copy_corners_tests.c b/test/076_copy_corners/copy_corners_tests.c index fecf14a..fe59089 100644 --- a/test/076_copy_corners/copy_corners_tests.c +++ b/test/076_copy_corners/copy_corners_tests.c @@ -1,8 +1,6 @@ #include "../test.h" void copy_corners_fast(cube_fast_t *, cube_fast_t); -cube_fast_t cubetofast(cube_t); -cube_t fasttocube(cube_fast_t); int main(void) { char str[STRLENMAX]; diff --git a/test/077_copy_edges/copy_edges_tests.c b/test/077_copy_edges/copy_edges_tests.c index c3e70a3..b428f89 100644 --- a/test/077_copy_edges/copy_edges_tests.c +++ b/test/077_copy_edges/copy_edges_tests.c @@ -1,8 +1,6 @@ #include "../test.h" void copy_edges_fast(cube_fast_t *, cube_fast_t); -cube_fast_t cubetofast(cube_t); -cube_t fasttocube(cube_fast_t); int main(void) { char str[STRLENMAX]; diff --git a/test/078_invcoord_esep/invcoord_esep_tests.c b/test/078_invcoord_esep/invcoord_esep_tests.c index 167f452..17ea2ff 100644 --- a/test/078_invcoord_esep/invcoord_esep_tests.c +++ b/test/078_invcoord_esep/invcoord_esep_tests.c @@ -2,7 +2,6 @@ int64_t coord_fast_esep(cube_fast_t); cube_fast_t invcoord_fast_esep(int64_t); -cube_fast_t cubetofast(cube_t); int main(void) { char str[STRLENMAX]; diff --git a/test/101_coord_invcoord_h48/00_all.in b/test/101_coord_invcoord_h48/00_all.in new file mode 100644 index 0000000..a2f9540 --- /dev/null +++ b/test/101_coord_invcoord_h48/00_all.in @@ -0,0 +1,8 @@ +UB0 DF0 DB0 UF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 +UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 +UB0 UF0 DB0 DF0 UL0 UR0 DL0 DR0 FR0 FL0 BL0 BR0 UBL0 UFR0 DFL0 DBR0 UBR0 UFL0 DFR0 DBL0 +UL0 BL0 BR1 DL0 FR0 DF0 DB1 DR1 UB0 FL0 UF0 UR1 DFL0 UFR1 DBR1 UBR2 DBL2 DFR0 UFL1 UBL2 +UF0 UB0 DB0 DF0 FR0 UL0 DL0 BR0 DR0 FL0 BL0 UR0 DFR2 UBL0 DFL0 UBR2 UFL0 UFR1 DBR1 DBL0 +FL1 UB0 DB0 FR1 UR0 UL0 DL0 DR0 UF1 DF1 BL0 BR0 UFL1 UBL0 DFR1 DBR0 DFL2 UBR0 UFR2 DBL0 +FR0 BR0 BL0 FL0 UR0 UL0 DL0 DR0 DF0 UF0 UB0 DB0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 +UR0 UL0 DL0 DR0 UB0 UF0 DF0 DB0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 diff --git a/test/101_coord_invcoord_h48/00_all.out b/test/101_coord_invcoord_h48/00_all.out new file mode 100644 index 0000000..e84be4b --- /dev/null +++ b/test/101_coord_invcoord_h48/00_all.out @@ -0,0 +1,8 @@ +1 ok +2 ok +3 ok +4 ok +5 ok +6 ok +7 ok +8 ok diff --git a/test/101_coord_invcoord_h48/coord_invcoord_h48_tests.c b/test/101_coord_invcoord_h48/coord_invcoord_h48_tests.c new file mode 100644 index 0000000..e7858df --- /dev/null +++ b/test/101_coord_invcoord_h48/coord_invcoord_h48_tests.c @@ -0,0 +1,40 @@ +#include "../test.h" + +#define COCSEP_CLASSES 3393U + +size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *); +int64_t coord_h48(cube_fast_t, const uint32_t *, uint8_t); +cube_fast_t invcoord_h48(int64_t, const cube_fast_t *, uint8_t); +cube_fast_t transform(cube_fast_t, uint8_t); + +int main(void) { + char str[STRLENMAX]; + int i; + bool found; + uint8_t h, t; + uint32_t cocsepdata[300000]; + uint64_t selfsim[COCSEP_CLASSES]; + int64_t c, cc; + cube_t cube; + cube_fast_t fast, invc, rep[COCSEP_CLASSES]; + + gendata_cocsep(cocsepdata, selfsim, rep); + + i = 1; + h = 11; + while (fgets(str, STRLENMAX, stdin) != NULL) { + cube = readcube("H48", str); + fast = cubetofast(cube); + c = coord_h48(fast, cocsepdata, h); + invc = invcoord_h48(c, rep, h); + for (t = 0, found = false; t < 48; t++) { + fast = transform(invc, t); + cc = coord_h48(fast, cocsepdata, h); + found = found || cc == c; + } + printf("%d %s\n", i, found ? "ok" : "ERROR"); + i++; + } + + return 0; +} diff --git a/test/101_gendata_esep/00_all.in b/test/101_gendata_esep/00_all.in deleted file mode 100644 index e69de29..0000000 diff --git a/test/101_gendata_esep/00_all.out b/test/101_gendata_esep/00_all.out deleted file mode 100644 index deba01f..0000000 --- a/test/101_gendata_esep/00_all.out +++ /dev/null @@ -1 +0,0 @@ -something diff --git a/test/101_gendata_esep/gendata_esep_tests.c b/test/101_gendata_esep/gendata_esep_tests.c deleted file mode 100644 index bc7ce25..0000000 --- a/test/101_gendata_esep/gendata_esep_tests.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "../test.h" - -#define CSIZE 1200000 -#define ESIZE 250000000 - -uint32_t buf_c[CSIZE/4]; -uint32_t buf_e[ESIZE/4]; - -size_t gendata_cocsep(void *); -size_t gendata_esep(const void *, void *); - -int main(void) { - uint32_t i; - size_t result; - - gendata_cocsep(buf_c); - result = gendata_esep(buf_c, buf_e); - - printf("nothing\n"); - - return 0; -} diff --git a/test/102_gendata_esep/00_all.in b/test/102_gendata_esep/00_all.in new file mode 100644 index 0000000..e69de29 diff --git a/test/102_gendata_esep/00_all.out b/test/102_gendata_esep/00_all.out new file mode 100644 index 0000000..deba01f --- /dev/null +++ b/test/102_gendata_esep/00_all.out @@ -0,0 +1 @@ +something diff --git a/test/102_gendata_esep/gendata_esep_tests.c b/test/102_gendata_esep/gendata_esep_tests.c new file mode 100644 index 0000000..bc7ce25 --- /dev/null +++ b/test/102_gendata_esep/gendata_esep_tests.c @@ -0,0 +1,22 @@ +#include "../test.h" + +#define CSIZE 1200000 +#define ESIZE 250000000 + +uint32_t buf_c[CSIZE/4]; +uint32_t buf_e[ESIZE/4]; + +size_t gendata_cocsep(void *); +size_t gendata_esep(const void *, void *); + +int main(void) { + uint32_t i; + size_t result; + + gendata_cocsep(buf_c); + result = gendata_esep(buf_c, buf_e); + + printf("nothing\n"); + + return 0; +} diff --git a/test/test.h b/test/test.h index 2086283..ab40bde 100644 --- a/test/test.h +++ b/test/test.h @@ -26,3 +26,5 @@ bool issolvable(cube_t); bool issolved(cube_t); cube_t readcube(char *, char *); void writecube(char *, cube_t, char *); +cube_t fasttocube(cube_fast_t); +cube_fast_t cubetofast(cube_t); -- cgit v1.3