diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-17 17:42:43 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-17 17:42:43 +0200 |
| commit | 1809d7b212128fcdcb481002a17db5dc97a15e03 (patch) | |
| tree | 4e045b4fefc5e229969891b0e1963dd683bd46ad /test/075_set_eo/set_eo_tests.c | |
| parent | d26d9e46d305b3ab3c6ae3b55f1859cf413a1c94 (diff) | |
| download | nissy-core-1809d7b212128fcdcb481002a17db5dc97a15e03.tar.gz nissy-core-1809d7b212128fcdcb481002a17db5dc97a15e03.zip | |
Added inverse eo and copy_{edges,corners}
Diffstat (limited to 'test/075_set_eo/set_eo_tests.c')
| -rw-r--r-- | test/075_set_eo/set_eo_tests.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/075_set_eo/set_eo_tests.c b/test/075_set_eo/set_eo_tests.c new file mode 100644 index 0000000..ef7215a --- /dev/null +++ b/test/075_set_eo/set_eo_tests.c | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | int64_t coord_fast_eo(cube_fast_t); | ||
| 4 | void set_eo_fast(cube_fast_t *, int64_t); | ||
| 5 | cube_fast_t cubetofast(cube_t); | ||
| 6 | cube_t fasttocube(cube_fast_t); | ||
| 7 | |||
| 8 | int main(void) { | ||
| 9 | char str[STRLENMAX]; | ||
| 10 | cube_t cube; | ||
| 11 | cube_fast_t fast; | ||
| 12 | int64_t eo; | ||
| 13 | |||
| 14 | fgets(str, STRLENMAX, stdin); | ||
| 15 | cube = readcube("H48", str); | ||
| 16 | fast = cubetofast(cube); | ||
| 17 | fgets(str, STRLENMAX, stdin); | ||
| 18 | eo = atoi(str); | ||
| 19 | |||
| 20 | set_eo_fast(&fast, eo); | ||
| 21 | |||
| 22 | cube = fasttocube(fast); | ||
| 23 | if (iserror(cube)) { | ||
| 24 | printf("Error setting EO\n"); | ||
| 25 | } else if (!isconsistent(cube)) { | ||
| 26 | fprintf(stderr, "edges: "); | ||
| 27 | for (int i = 0; i < 12; i++) fprintf(stderr, "%d ", cube.edge[i]); | ||
| 28 | fprintf(stderr, "\n"); | ||
| 29 | for (int i = 0; i < 8; i++) fprintf(stderr, "%d ", cube.corner[i]); | ||
| 30 | fprintf(stderr, "\n"); | ||
| 31 | printf("Setting EO resulted in inconsistent cube\n"); | ||
| 32 | } else { | ||
| 33 | writecube("H48", cube, str); | ||
| 34 | printf("%s\n", str); | ||
| 35 | } | ||
| 36 | |||
| 37 | return 0; | ||
| 38 | } | ||
