diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-12-22 18:07:06 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-12-22 18:07:06 +0100 |
| commit | 086a06fe3d84ac8b2e74c824e05f9d23f0b292ab (patch) | |
| tree | 596034b2283b053e023d0988d875396946b9384d /test/076_copy_co/copy_co_tests.c | |
| parent | 0c5e4730c699ac006feec4efe25c390977fe372f (diff) | |
| download | nissy-core-086a06fe3d84ac8b2e74c824e05f9d23f0b292ab.tar.gz nissy-core-086a06fe3d84ac8b2e74c824e05f9d23f0b292ab.zip | |
Added tests for copy_co, renamed some tests
Diffstat (limited to 'test/076_copy_co/copy_co_tests.c')
| -rw-r--r-- | test/076_copy_co/copy_co_tests.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/076_copy_co/copy_co_tests.c b/test/076_copy_co/copy_co_tests.c new file mode 100644 index 0000000..3ca109b --- /dev/null +++ b/test/076_copy_co/copy_co_tests.c | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | void copy_co(cube_t *, cube_t); | ||
| 4 | void pieces(cube_t *, uint8_t [static 8], uint8_t [static 12]); | ||
| 5 | |||
| 6 | void run(void) { | ||
| 7 | char str[STRLENMAX]; | ||
| 8 | oriented_cube_t cube1, cube2; | ||
| 9 | uint8_t edge[12], corner[8]; | ||
| 10 | |||
| 11 | fgets(str, STRLENMAX, stdin); | ||
| 12 | cube1 = readcube(str); | ||
| 13 | fgets(str, STRLENMAX, stdin); | ||
| 14 | cube2 = readcube(str); | ||
| 15 | |||
| 16 | copy_co(&cube1.cube, cube2.cube); | ||
| 17 | |||
| 18 | if (iserror(cube1)) { | ||
| 19 | printf("Error copying CO\n"); | ||
| 20 | } else if (!isconsistent(cube2)) { | ||
| 21 | pieces(&cube1.cube, corner, edge); | ||
| 22 | fprintf(stderr, "edges: "); | ||
| 23 | for (int i = 0; i < 12; i++) | ||
| 24 | fprintf(stderr, "%d ", edge[i]); | ||
| 25 | fprintf(stderr, "\n"); | ||
| 26 | for (int i = 0; i < 8; i++) | ||
| 27 | fprintf(stderr, "%d ", corner[i]); | ||
| 28 | fprintf(stderr, "\n"); | ||
| 29 | printf("Setting CO resulted in inconsistent cube\n"); | ||
| 30 | } else { | ||
| 31 | writecube(cube1, NISSY_SIZE_CUBE, str); | ||
| 32 | printf("%s\n", str); | ||
| 33 | } | ||
| 34 | } | ||
