diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/001_pieces/pieces_tests.c | 11 | ||||
| -rw-r--r-- | test/002_cube_conversion/00_solved.in | 1 | ||||
| -rw-r--r-- | test/002_cube_conversion/00_solved.out | 1 | ||||
| -rw-r--r-- | test/002_cube_conversion/01_scrambled.in | 1 | ||||
| -rw-r--r-- | test/002_cube_conversion/01_scrambled.out | 1 | ||||
| -rw-r--r-- | test/002_cube_conversion/cube_conversion_tests.c | 25 | ||||
| -rw-r--r-- | test/071_coord_eo/coord_eo_tests.c | 6 | ||||
| -rw-r--r-- | test/072_coord_co/coord_co_tests.c | 6 | ||||
| -rw-r--r-- | test/073_coord_csep/coord_csep_tests.c | 6 | ||||
| -rw-r--r-- | test/074_coord_esep/coord_esep_tests.c | 6 | ||||
| -rw-r--r-- | test/075_set_eo/set_eo_tests.c | 16 | ||||
| -rw-r--r-- | test/076_copy_corners/copy_corners_tests.c | 8 | ||||
| -rw-r--r-- | test/077_copy_edges/copy_edges_tests.c | 8 | ||||
| -rw-r--r-- | test/078_invcoord_esep/invcoord_esep_tests.c | 12 | ||||
| -rw-r--r-- | test/100_gendata_cocsep/gendata_cocsep_tests.c | 4 | ||||
| -rw-r--r-- | test/101_cocsep_selfsim/cocsep_selfsim_tests.c | 10 | ||||
| -rw-r--r-- | test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c | 18 | ||||
| -rw-r--r-- | test/test.h | 12 |
18 files changed, 49 insertions, 103 deletions
diff --git a/test/001_pieces/pieces_tests.c b/test/001_pieces/pieces_tests.c index f3d8d4e..1ef2fd0 100644 --- a/test/001_pieces/pieces_tests.c +++ b/test/001_pieces/pieces_tests.c | |||
| @@ -1,13 +1,12 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | uint8_t corner(cube_fast_t, int); | 3 | void pieces(cube_t *, uint8_t [static 8], uint8_t [static 12]); |
| 4 | uint8_t edge(cube_fast_t, int); | ||
| 5 | 4 | ||
| 6 | int main(void) { | 5 | int main(void) { |
| 7 | int i; | 6 | int i; |
| 7 | uint8_t corner[8], edge[12]; | ||
| 8 | char str[STRLENMAX], *aux; | 8 | char str[STRLENMAX], *aux; |
| 9 | cube_t cube; | 9 | cube_t cube; |
| 10 | cube_fast_t fast; | ||
| 11 | 10 | ||
| 12 | aux = str; | 11 | aux = str; |
| 13 | while (fgets(aux, STRLENMAX, stdin) != NULL) | 12 | while (fgets(aux, STRLENMAX, stdin) != NULL) |
| @@ -15,13 +14,13 @@ int main(void) { | |||
| 15 | aux++; | 14 | aux++; |
| 16 | 15 | ||
| 17 | cube = readcube("H48", str); | 16 | cube = readcube("H48", str); |
| 18 | fast = cubetofast(cube); | 17 | pieces(&cube, corner, edge); |
| 19 | 18 | ||
| 20 | for (i = 0; i < 8; i++) | 19 | for (i = 0; i < 8; i++) |
| 21 | printf("%" PRIu8 " ", corner(fast, i)); | 20 | printf("%" PRIu8 " ", corner[i]); |
| 22 | printf("\n"); | 21 | printf("\n"); |
| 23 | for (i = 0; i < 12; i++) | 22 | for (i = 0; i < 12; i++) |
| 24 | printf("%" PRIu8 " ", edge(fast, i)); | 23 | printf("%" PRIu8 " ", edge[i]); |
| 25 | printf("\n"); | 24 | printf("\n"); |
| 26 | 25 | ||
| 27 | return 0; | 26 | return 0; |
diff --git a/test/002_cube_conversion/00_solved.in b/test/002_cube_conversion/00_solved.in deleted file mode 100644 index dff224d..0000000 --- a/test/002_cube_conversion/00_solved.in +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 | ||
diff --git a/test/002_cube_conversion/00_solved.out b/test/002_cube_conversion/00_solved.out deleted file mode 100644 index dff224d..0000000 --- a/test/002_cube_conversion/00_solved.out +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 | ||
diff --git a/test/002_cube_conversion/01_scrambled.in b/test/002_cube_conversion/01_scrambled.in deleted file mode 100644 index 453cc8a..0000000 --- a/test/002_cube_conversion/01_scrambled.in +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | BL1 DB0 UL1 DF0 BR1 UF1 DL0 FL1 UB0 DR1 FR1 UR1 UBR2 UBL1 DFR2 DBL2 DBR0 DFL0 UFR0 UFL2 | ||
diff --git a/test/002_cube_conversion/01_scrambled.out b/test/002_cube_conversion/01_scrambled.out deleted file mode 100644 index 453cc8a..0000000 --- a/test/002_cube_conversion/01_scrambled.out +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | BL1 DB0 UL1 DF0 BR1 UF1 DL0 FL1 UB0 DR1 FR1 UR1 UBR2 UBL1 DFR2 DBL2 DBR0 DFL0 UFR0 UFL2 | ||
diff --git a/test/002_cube_conversion/cube_conversion_tests.c b/test/002_cube_conversion/cube_conversion_tests.c deleted file mode 100644 index df03eb6..0000000 --- a/test/002_cube_conversion/cube_conversion_tests.c +++ /dev/null | |||
| @@ -1,25 +0,0 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | bool equal(cube_t, cube_t); | ||
| 4 | |||
| 5 | int main(void) { | ||
| 6 | char cubestr[STRLENMAX]; | ||
| 7 | cube_t cube, cube2; | ||
| 8 | cube_fast_t fast; | ||
| 9 | |||
| 10 | fgets(cubestr, STRLENMAX, stdin); | ||
| 11 | cube = readcube("H48", cubestr); | ||
| 12 | fast = cubetofast(cube); | ||
| 13 | cube2 = fasttocube(fast); | ||
| 14 | |||
| 15 | if (iserror(cube)) { | ||
| 16 | printf("Error reading cube\n"); | ||
| 17 | } else if (iserror(cube2)) { | ||
| 18 | printf("Error converting cube\n"); | ||
| 19 | } else { | ||
| 20 | writecube("H48", cube2, cubestr); | ||
| 21 | printf("%s\n", cubestr); | ||
| 22 | } | ||
| 23 | |||
| 24 | return 0; | ||
| 25 | } | ||
diff --git a/test/071_coord_eo/coord_eo_tests.c b/test/071_coord_eo/coord_eo_tests.c index 5eec4fc..3defb8b 100644 --- a/test/071_coord_eo/coord_eo_tests.c +++ b/test/071_coord_eo/coord_eo_tests.c | |||
| @@ -1,18 +1,16 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | int64_t coord_fast_eo(cube_fast_t); | 3 | int64_t coord_eo(cube_t); |
| 4 | 4 | ||
| 5 | int main(void) { | 5 | int main(void) { |
| 6 | char str[STRLENMAX]; | 6 | char str[STRLENMAX]; |
| 7 | cube_t cube; | 7 | cube_t cube; |
| 8 | cube_fast_t fast; | ||
| 9 | int64_t result; | 8 | int64_t result; |
| 10 | 9 | ||
| 11 | fgets(str, STRLENMAX, stdin); | 10 | fgets(str, STRLENMAX, stdin); |
| 12 | cube = readcube("H48", str); | 11 | cube = readcube("H48", str); |
| 13 | fast = cubetofast(cube); | ||
| 14 | 12 | ||
| 15 | result = coord_fast_eo(fast); | 13 | result = coord_eo(cube); |
| 16 | 14 | ||
| 17 | printf("%" PRId64 "\n", result); | 15 | printf("%" PRId64 "\n", result); |
| 18 | 16 | ||
diff --git a/test/072_coord_co/coord_co_tests.c b/test/072_coord_co/coord_co_tests.c index 8461324..c7af24c 100644 --- a/test/072_coord_co/coord_co_tests.c +++ b/test/072_coord_co/coord_co_tests.c | |||
| @@ -1,18 +1,16 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | int64_t coord_fast_co(cube_fast_t); | 3 | int64_t coord_co(cube_t); |
| 4 | 4 | ||
| 5 | int main(void) { | 5 | int main(void) { |
| 6 | char str[STRLENMAX]; | 6 | char str[STRLENMAX]; |
| 7 | cube_t cube; | 7 | cube_t cube; |
| 8 | cube_fast_t fast; | ||
| 9 | int64_t result; | 8 | int64_t result; |
| 10 | 9 | ||
| 11 | fgets(str, STRLENMAX, stdin); | 10 | fgets(str, STRLENMAX, stdin); |
| 12 | cube = readcube("H48", str); | 11 | cube = readcube("H48", str); |
| 13 | fast = cubetofast(cube); | ||
| 14 | 12 | ||
| 15 | result = coord_fast_co(fast); | 13 | result = coord_co(cube); |
| 16 | 14 | ||
| 17 | printf("%" PRId64 "\n", result); | 15 | printf("%" PRId64 "\n", result); |
| 18 | 16 | ||
diff --git a/test/073_coord_csep/coord_csep_tests.c b/test/073_coord_csep/coord_csep_tests.c index c4113d3..a6e13c5 100644 --- a/test/073_coord_csep/coord_csep_tests.c +++ b/test/073_coord_csep/coord_csep_tests.c | |||
| @@ -1,18 +1,16 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | int64_t coord_fast_csep(cube_fast_t); | 3 | int64_t coord_csep(cube_t); |
| 4 | 4 | ||
| 5 | int main(void) { | 5 | int main(void) { |
| 6 | char str[STRLENMAX]; | 6 | char str[STRLENMAX]; |
| 7 | cube_t cube; | 7 | cube_t cube; |
| 8 | cube_fast_t fast; | ||
| 9 | int64_t result; | 8 | int64_t result; |
| 10 | 9 | ||
| 11 | fgets(str, STRLENMAX, stdin); | 10 | fgets(str, STRLENMAX, stdin); |
| 12 | cube = readcube("H48", str); | 11 | cube = readcube("H48", str); |
| 13 | fast = cubetofast(cube); | ||
| 14 | 12 | ||
| 15 | result = coord_fast_csep(fast); | 13 | result = coord_csep(cube); |
| 16 | 14 | ||
| 17 | printf("%" PRId64 "\n", result); | 15 | printf("%" PRId64 "\n", result); |
| 18 | 16 | ||
diff --git a/test/074_coord_esep/coord_esep_tests.c b/test/074_coord_esep/coord_esep_tests.c index fa21d67..0ed3ef3 100644 --- a/test/074_coord_esep/coord_esep_tests.c +++ b/test/074_coord_esep/coord_esep_tests.c | |||
| @@ -1,18 +1,16 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | int64_t coord_fast_esep(cube_fast_t); | 3 | int64_t coord_esep(cube_t); |
| 4 | 4 | ||
| 5 | int main(void) { | 5 | int main(void) { |
| 6 | char str[STRLENMAX]; | 6 | char str[STRLENMAX]; |
| 7 | cube_t cube; | 7 | cube_t cube; |
| 8 | cube_fast_t fast; | ||
| 9 | int64_t result; | 8 | int64_t result; |
| 10 | 9 | ||
| 11 | fgets(str, STRLENMAX, stdin); | 10 | fgets(str, STRLENMAX, stdin); |
| 12 | cube = readcube("H48", str); | 11 | cube = readcube("H48", str); |
| 13 | fast = cubetofast(cube); | ||
| 14 | 12 | ||
| 15 | result = coord_fast_esep(fast); | 13 | result = coord_esep(cube); |
| 16 | 14 | ||
| 17 | printf("%" PRId64 "\n", result); | 15 | printf("%" PRId64 "\n", result); |
| 18 | 16 | ||
diff --git a/test/075_set_eo/set_eo_tests.c b/test/075_set_eo/set_eo_tests.c index cd4868c..9c01a50 100644 --- a/test/075_set_eo/set_eo_tests.c +++ b/test/075_set_eo/set_eo_tests.c | |||
| @@ -1,32 +1,32 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | int64_t coord_fast_eo(cube_fast_t); | 3 | int64_t coord_eo(cube_t); |
| 4 | void set_eo_fast(cube_fast_t *, int64_t); | 4 | void set_eo(cube_t *, int64_t); |
| 5 | void pieces(cube_t *, uint8_t [static 8], uint8_t [static 12]); | ||
| 5 | 6 | ||
| 6 | int main(void) { | 7 | int main(void) { |
| 7 | char str[STRLENMAX]; | 8 | char str[STRLENMAX]; |
| 8 | cube_t cube; | 9 | cube_t cube; |
| 9 | cube_fast_t fast; | 10 | uint8_t edge[12], corner[8]; |
| 10 | int64_t eo; | 11 | int64_t eo; |
| 11 | 12 | ||
| 12 | fgets(str, STRLENMAX, stdin); | 13 | fgets(str, STRLENMAX, stdin); |
| 13 | cube = readcube("H48", str); | 14 | cube = readcube("H48", str); |
| 14 | fast = cubetofast(cube); | ||
| 15 | fgets(str, STRLENMAX, stdin); | 15 | fgets(str, STRLENMAX, stdin); |
| 16 | eo = atoi(str); | 16 | eo = atoi(str); |
| 17 | 17 | ||
| 18 | set_eo_fast(&fast, eo); | 18 | set_eo(&cube, eo); |
| 19 | 19 | ||
| 20 | cube = fasttocube(fast); | ||
| 21 | if (iserror(cube)) { | 20 | if (iserror(cube)) { |
| 22 | printf("Error setting EO\n"); | 21 | printf("Error setting EO\n"); |
| 23 | } else if (!isconsistent(cube)) { | 22 | } else if (!isconsistent(cube)) { |
| 23 | pieces(&cube, corner, edge); | ||
| 24 | fprintf(stderr, "edges: "); | 24 | fprintf(stderr, "edges: "); |
| 25 | for (int i = 0; i < 12; i++) | 25 | for (int i = 0; i < 12; i++) |
| 26 | fprintf(stderr, "%d ", cube.edge[i]); | 26 | fprintf(stderr, "%d ", edge[i]); |
| 27 | fprintf(stderr, "\n"); | 27 | fprintf(stderr, "\n"); |
| 28 | for (int i = 0; i < 8; i++) | 28 | for (int i = 0; i < 8; i++) |
| 29 | fprintf(stderr, "%d ", cube.corner[i]); | 29 | fprintf(stderr, "%d ", corner[i]); |
| 30 | fprintf(stderr, "\n"); | 30 | fprintf(stderr, "\n"); |
| 31 | printf("Setting EO resulted in inconsistent cube\n"); | 31 | printf("Setting EO resulted in inconsistent cube\n"); |
| 32 | } else { | 32 | } else { |
diff --git a/test/076_copy_corners/copy_corners_tests.c b/test/076_copy_corners/copy_corners_tests.c index fe59089..446a849 100644 --- a/test/076_copy_corners/copy_corners_tests.c +++ b/test/076_copy_corners/copy_corners_tests.c | |||
| @@ -1,23 +1,19 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | void copy_corners_fast(cube_fast_t *, cube_fast_t); | 3 | void copy_corners(cube_t *, cube_t); |
| 4 | 4 | ||
| 5 | int main(void) { | 5 | int main(void) { |
| 6 | char str[STRLENMAX]; | 6 | char str[STRLENMAX]; |
| 7 | cube_t c1, c2; | 7 | cube_t c1, c2; |
| 8 | cube_fast_t f1, f2; | ||
| 9 | 8 | ||
| 10 | fgets(str, STRLENMAX, stdin); | 9 | fgets(str, STRLENMAX, stdin); |
| 11 | c1 = readcube("H48", str); | 10 | c1 = readcube("H48", str); |
| 12 | f1 = cubetofast(c1); | ||
| 13 | 11 | ||
| 14 | fgets(str, STRLENMAX, stdin); | 12 | fgets(str, STRLENMAX, stdin); |
| 15 | c2 = readcube("H48", str); | 13 | c2 = readcube("H48", str); |
| 16 | f2 = cubetofast(c2); | ||
| 17 | 14 | ||
| 18 | copy_corners_fast(&f1, f2); | 15 | copy_corners(&c1, c2); |
| 19 | 16 | ||
| 20 | c1 = fasttocube(f1); | ||
| 21 | if (iserror(c1)) { | 17 | if (iserror(c1)) { |
| 22 | printf("Error setting EO\n"); | 18 | printf("Error setting EO\n"); |
| 23 | } else if (!isconsistent(c1)) { | 19 | } else if (!isconsistent(c1)) { |
diff --git a/test/077_copy_edges/copy_edges_tests.c b/test/077_copy_edges/copy_edges_tests.c index b428f89..9afcb73 100644 --- a/test/077_copy_edges/copy_edges_tests.c +++ b/test/077_copy_edges/copy_edges_tests.c | |||
| @@ -1,23 +1,19 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | void copy_edges_fast(cube_fast_t *, cube_fast_t); | 3 | void copy_edges(cube_t *, cube_t); |
| 4 | 4 | ||
| 5 | int main(void) { | 5 | int main(void) { |
| 6 | char str[STRLENMAX]; | 6 | char str[STRLENMAX]; |
| 7 | cube_t c1, c2; | 7 | cube_t c1, c2; |
| 8 | cube_fast_t f1, f2; | ||
| 9 | 8 | ||
| 10 | fgets(str, STRLENMAX, stdin); | 9 | fgets(str, STRLENMAX, stdin); |
| 11 | c1 = readcube("H48", str); | 10 | c1 = readcube("H48", str); |
| 12 | f1 = cubetofast(c1); | ||
| 13 | 11 | ||
| 14 | fgets(str, STRLENMAX, stdin); | 12 | fgets(str, STRLENMAX, stdin); |
| 15 | c2 = readcube("H48", str); | 13 | c2 = readcube("H48", str); |
| 16 | f2 = cubetofast(c2); | ||
| 17 | 14 | ||
| 18 | copy_edges_fast(&f1, f2); | 15 | copy_edges(&c1, c2); |
| 19 | 16 | ||
| 20 | c1 = fasttocube(f1); | ||
| 21 | if (iserror(c1)) { | 17 | if (iserror(c1)) { |
| 22 | printf("Error setting EO\n"); | 18 | printf("Error setting EO\n"); |
| 23 | } else if (!isconsistent(c1)) { | 19 | } else if (!isconsistent(c1)) { |
diff --git a/test/078_invcoord_esep/invcoord_esep_tests.c b/test/078_invcoord_esep/invcoord_esep_tests.c index 17ea2ff..0b83175 100644 --- a/test/078_invcoord_esep/invcoord_esep_tests.c +++ b/test/078_invcoord_esep/invcoord_esep_tests.c | |||
| @@ -1,21 +1,19 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | int64_t coord_fast_esep(cube_fast_t); | 3 | int64_t coord_esep(cube_t); |
| 4 | cube_fast_t invcoord_fast_esep(int64_t); | 4 | cube_t invcoord_esep(int64_t); |
| 5 | 5 | ||
| 6 | int main(void) { | 6 | int main(void) { |
| 7 | char str[STRLENMAX]; | 7 | char str[STRLENMAX]; |
| 8 | cube_t cube; | 8 | cube_t cube; |
| 9 | cube_fast_t fast; | ||
| 10 | int64_t i; | 9 | int64_t i; |
| 11 | 10 | ||
| 12 | fgets(str, STRLENMAX, stdin); | 11 | fgets(str, STRLENMAX, stdin); |
| 13 | cube = readcube("H48", str); | 12 | cube = readcube("H48", str); |
| 14 | fast = cubetofast(cube); | ||
| 15 | 13 | ||
| 16 | i = coord_fast_esep(fast); | 14 | i = coord_esep(cube); |
| 17 | fast = invcoord_fast_esep(i); | 15 | cube = invcoord_esep(i); |
| 18 | i = coord_fast_esep(fast); | 16 | i = coord_esep(cube); |
| 19 | 17 | ||
| 20 | printf("%" PRId64 "\n", i); | 18 | printf("%" PRId64 "\n", i); |
| 21 | 19 | ||
diff --git a/test/100_gendata_cocsep/gendata_cocsep_tests.c b/test/100_gendata_cocsep/gendata_cocsep_tests.c index bba261b..9d8f03c 100644 --- a/test/100_gendata_cocsep/gendata_cocsep_tests.c +++ b/test/100_gendata_cocsep/gendata_cocsep_tests.c | |||
| @@ -2,12 +2,12 @@ | |||
| 2 | 2 | ||
| 3 | #define COCSEP_CLASSES 3393 | 3 | #define COCSEP_CLASSES 3393 |
| 4 | 4 | ||
| 5 | size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *); | 5 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); |
| 6 | 6 | ||
| 7 | int main(void) { | 7 | int main(void) { |
| 8 | uint32_t buf[300000], i; | 8 | uint32_t buf[300000], i; |
| 9 | uint64_t selfsim[COCSEP_CLASSES]; | 9 | uint64_t selfsim[COCSEP_CLASSES]; |
| 10 | cube_fast_t rep[COCSEP_CLASSES]; | 10 | cube_t rep[COCSEP_CLASSES]; |
| 11 | size_t result; | 11 | size_t result; |
| 12 | 12 | ||
| 13 | result = gendata_cocsep(buf, selfsim, rep); | 13 | result = gendata_cocsep(buf, selfsim, rep); |
diff --git a/test/101_cocsep_selfsim/cocsep_selfsim_tests.c b/test/101_cocsep_selfsim/cocsep_selfsim_tests.c index 02b5377..195f9ba 100644 --- a/test/101_cocsep_selfsim/cocsep_selfsim_tests.c +++ b/test/101_cocsep_selfsim/cocsep_selfsim_tests.c | |||
| @@ -9,23 +9,23 @@ | |||
| 9 | 9 | ||
| 10 | #define COCSEP_CLASSES 3393 | 10 | #define COCSEP_CLASSES 3393 |
| 11 | 11 | ||
| 12 | size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *); | 12 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); |
| 13 | int64_t coord_fast_cocsep(cube_fast_t); | 13 | int64_t coord_cocsep(cube_t); |
| 14 | 14 | ||
| 15 | int main(void) { | 15 | int main(void) { |
| 16 | char str[STRLENMAX]; | 16 | char str[STRLENMAX]; |
| 17 | uint32_t buf[300000], data; | 17 | uint32_t buf[300000], data; |
| 18 | int64_t coord, coclass; | 18 | int64_t coord, coclass; |
| 19 | uint64_t selfsim[COCSEP_CLASSES], sim, t; | 19 | uint64_t selfsim[COCSEP_CLASSES], sim, t; |
| 20 | cube_fast_t fast, rep[COCSEP_CLASSES]; | 20 | cube_t cube, rep[COCSEP_CLASSES]; |
| 21 | 21 | ||
| 22 | gendata_cocsep(buf, selfsim, rep); | 22 | gendata_cocsep(buf, selfsim, rep); |
| 23 | 23 | ||
| 24 | /* All cases in the same test so we do not generate data many times */ | 24 | /* All cases in the same test so we do not generate data many times */ |
| 25 | 25 | ||
| 26 | while (fgets(str, STRLENMAX, stdin) != NULL) { | 26 | while (fgets(str, STRLENMAX, stdin) != NULL) { |
| 27 | fast = cubetofast(readcube("H48", str)); | 27 | cube = readcube("H48", str); |
| 28 | coord = coord_fast_cocsep(fast); | 28 | coord = coord_cocsep(cube); |
| 29 | data = buf[coord]; | 29 | data = buf[coord]; |
| 30 | coclass = (data & (0xFFFU << 16)) >> 16; | 30 | coclass = (data & (0xFFFU << 16)) >> 16; |
| 31 | sim = selfsim[coclass]; | 31 | sim = selfsim[coclass]; |
diff --git a/test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c b/test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c index 5022608..b0668df 100644 --- a/test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c +++ b/test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c | |||
| @@ -2,10 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | #define COCSEP_CLASSES 3393 | 3 | #define COCSEP_CLASSES 3393 |
| 4 | 4 | ||
| 5 | size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *); | 5 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); |
| 6 | int64_t coord_h48(cube_fast_t, const uint32_t *, uint8_t); | 6 | int64_t coord_h48(cube_t, const uint32_t *, uint8_t); |
| 7 | cube_fast_t invcoord_h48(int64_t, const cube_fast_t *, uint8_t); | 7 | cube_t invcoord_h48(int64_t, const cube_t *, uint8_t); |
| 8 | cube_fast_t transform(cube_fast_t, uint8_t); | 8 | cube_t transform(cube_t, uint8_t); |
| 9 | 9 | ||
| 10 | int main(void) { | 10 | int main(void) { |
| 11 | char str[STRLENMAX]; | 11 | char str[STRLENMAX]; |
| @@ -15,8 +15,7 @@ int main(void) { | |||
| 15 | uint32_t cocsepdata[300000]; | 15 | uint32_t cocsepdata[300000]; |
| 16 | uint64_t selfsim[COCSEP_CLASSES]; | 16 | uint64_t selfsim[COCSEP_CLASSES]; |
| 17 | int64_t c, cc; | 17 | int64_t c, cc; |
| 18 | cube_t cube; | 18 | cube_t cube, invc, rep[COCSEP_CLASSES]; |
| 19 | cube_fast_t fast, invc, rep[COCSEP_CLASSES]; | ||
| 20 | 19 | ||
| 21 | gendata_cocsep(cocsepdata, selfsim, rep); | 20 | gendata_cocsep(cocsepdata, selfsim, rep); |
| 22 | 21 | ||
| @@ -24,12 +23,11 @@ int main(void) { | |||
| 24 | h = 11; | 23 | h = 11; |
| 25 | while (fgets(str, STRLENMAX, stdin) != NULL) { | 24 | while (fgets(str, STRLENMAX, stdin) != NULL) { |
| 26 | cube = readcube("H48", str); | 25 | cube = readcube("H48", str); |
| 27 | fast = cubetofast(cube); | 26 | c = coord_h48(cube, cocsepdata, h); |
| 28 | c = coord_h48(fast, cocsepdata, h); | ||
| 29 | invc = invcoord_h48(c, rep, h); | 27 | invc = invcoord_h48(c, rep, h); |
| 30 | for (t = 0, found = false; t < 48; t++) { | 28 | for (t = 0, found = false; t < 48; t++) { |
| 31 | fast = transform(invc, t); | 29 | cube = transform(invc, t); |
| 32 | cc = coord_h48(fast, cocsepdata, h); | 30 | cc = coord_h48(cube, cocsepdata, h); |
| 33 | found = found || cc == c; | 31 | found = found || cc == c; |
| 34 | } | 32 | } |
| 35 | printf("%d %s\n", i, found ? "ok" : "ERROR"); | 33 | printf("%d %s\n", i, found ? "ok" : "ERROR"); |
diff --git a/test/test.h b/test/test.h index ab40bde..1bbb9fc 100644 --- a/test/test.h +++ b/test/test.h | |||
| @@ -6,16 +6,14 @@ | |||
| 6 | 6 | ||
| 7 | #define STRLENMAX 10000 | 7 | #define STRLENMAX 10000 |
| 8 | 8 | ||
| 9 | #ifdef CUBE_AVX2 | ||
| 10 | #include <immintrin.h> | ||
| 11 | typedef __m256i cube_t; | ||
| 12 | #else | ||
| 9 | typedef struct { | 13 | typedef struct { |
| 10 | uint8_t corner[8]; | 14 | uint8_t corner[8]; |
| 11 | uint8_t edge[12]; | 15 | uint8_t edge[12]; |
| 12 | } cube_t; | 16 | } cube_t; |
| 13 | |||
| 14 | #ifdef CUBE_AVX2 | ||
| 15 | #include <immintrin.h> | ||
| 16 | typedef __m256i cube_fast_t; | ||
| 17 | #else | ||
| 18 | typedef cube_t cube_fast_t; | ||
| 19 | #endif | 17 | #endif |
| 20 | 18 | ||
| 21 | /* Basic functions used in most tests */ | 19 | /* Basic functions used in most tests */ |
| @@ -26,5 +24,3 @@ bool issolvable(cube_t); | |||
| 26 | bool issolved(cube_t); | 24 | bool issolved(cube_t); |
| 27 | cube_t readcube(char *, char *); | 25 | cube_t readcube(char *, char *); |
| 28 | void writecube(char *, cube_t, char *); | 26 | void writecube(char *, cube_t, char *); |
| 29 | cube_t fasttocube(cube_fast_t); | ||
| 30 | cube_fast_t cubetofast(cube_t); | ||
