diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-27 12:04:53 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-27 12:04:53 +0200 |
| commit | 49b9c4a516f72e03d53277075f4580e2df8f0e63 (patch) | |
| tree | dea68649391d14d63a96e742b450c59681ac4305 /test/102_coord_invcoord_h48 | |
| parent | fde8dfa9df8df1e3d42a9a8840836e33817cd498 (diff) | |
| download | nissy-core-49b9c4a516f72e03d53277075f4580e2df8f0e63.tar.gz nissy-core-49b9c4a516f72e03d53277075f4580e2df8f0e63.zip | |
Some type fixes and some cleanup
Diffstat (limited to 'test/102_coord_invcoord_h48')
| -rw-r--r-- | test/102_coord_invcoord_h48/00_all.in | 8 | ||||
| -rw-r--r-- | test/102_coord_invcoord_h48/00_all.out | 8 | ||||
| -rw-r--r-- | test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c | 40 |
3 files changed, 56 insertions, 0 deletions
diff --git a/test/102_coord_invcoord_h48/00_all.in b/test/102_coord_invcoord_h48/00_all.in new file mode 100644 index 0000000..a2f9540 --- /dev/null +++ b/test/102_coord_invcoord_h48/00_all.in | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | UB0 DF0 DB0 UF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 | ||
| 2 | UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 | ||
| 3 | UB0 UF0 DB0 DF0 UL0 UR0 DL0 DR0 FR0 FL0 BL0 BR0 UBL0 UFR0 DFL0 DBR0 UBR0 UFL0 DFR0 DBL0 | ||
| 4 | UL0 BL0 BR1 DL0 FR0 DF0 DB1 DR1 UB0 FL0 UF0 UR1 DFL0 UFR1 DBR1 UBR2 DBL2 DFR0 UFL1 UBL2 | ||
| 5 | UF0 UB0 DB0 DF0 FR0 UL0 DL0 BR0 DR0 FL0 BL0 UR0 DFR2 UBL0 DFL0 UBR2 UFL0 UFR1 DBR1 DBL0 | ||
| 6 | FL1 UB0 DB0 FR1 UR0 UL0 DL0 DR0 UF1 DF1 BL0 BR0 UFL1 UBL0 DFR1 DBR0 DFL2 UBR0 UFR2 DBL0 | ||
| 7 | FR0 BR0 BL0 FL0 UR0 UL0 DL0 DR0 DF0 UF0 UB0 DB0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 | ||
| 8 | UR0 UL0 DL0 DR0 UB0 UF0 DF0 DB0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 | ||
diff --git a/test/102_coord_invcoord_h48/00_all.out b/test/102_coord_invcoord_h48/00_all.out new file mode 100644 index 0000000..e84be4b --- /dev/null +++ b/test/102_coord_invcoord_h48/00_all.out | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | 1 ok | ||
| 2 | 2 ok | ||
| 3 | 3 ok | ||
| 4 | 4 ok | ||
| 5 | 5 ok | ||
| 6 | 6 ok | ||
| 7 | 7 ok | ||
| 8 | 8 ok | ||
diff --git a/test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c b/test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c new file mode 100644 index 0000000..5022608 --- /dev/null +++ b/test/102_coord_invcoord_h48/coord_invcoord_h48_tests.c | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | #define COCSEP_CLASSES 3393 | ||
| 4 | |||
| 5 | size_t gendata_cocsep(void *, uint64_t *, cube_fast_t *); | ||
| 6 | int64_t coord_h48(cube_fast_t, const uint32_t *, uint8_t); | ||
| 7 | cube_fast_t invcoord_h48(int64_t, const cube_fast_t *, uint8_t); | ||
| 8 | cube_fast_t transform(cube_fast_t, uint8_t); | ||
| 9 | |||
| 10 | int main(void) { | ||
| 11 | char str[STRLENMAX]; | ||
| 12 | int i; | ||
| 13 | bool found; | ||
| 14 | uint8_t h, t; | ||
| 15 | uint32_t cocsepdata[300000]; | ||
| 16 | uint64_t selfsim[COCSEP_CLASSES]; | ||
| 17 | int64_t c, cc; | ||
| 18 | cube_t cube; | ||
| 19 | cube_fast_t fast, invc, rep[COCSEP_CLASSES]; | ||
| 20 | |||
| 21 | gendata_cocsep(cocsepdata, selfsim, rep); | ||
| 22 | |||
| 23 | i = 1; | ||
| 24 | h = 11; | ||
| 25 | while (fgets(str, STRLENMAX, stdin) != NULL) { | ||
| 26 | cube = readcube("H48", str); | ||
| 27 | fast = cubetofast(cube); | ||
| 28 | c = coord_h48(fast, cocsepdata, h); | ||
| 29 | invc = invcoord_h48(c, rep, h); | ||
| 30 | for (t = 0, found = false; t < 48; t++) { | ||
| 31 | fast = transform(invc, t); | ||
| 32 | cc = coord_h48(fast, cocsepdata, h); | ||
| 33 | found = found || cc == c; | ||
| 34 | } | ||
| 35 | printf("%d %s\n", i, found ? "ok" : "ERROR"); | ||
| 36 | i++; | ||
| 37 | } | ||
| 38 | |||
| 39 | return 0; | ||
| 40 | } | ||
