aboutsummaryrefslogtreecommitdiff
path: root/test/076_copy_co/copy_co_tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/076_copy_co/copy_co_tests.c')
-rw-r--r--test/076_copy_co/copy_co_tests.c34
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
3void copy_co(cube_t *, cube_t);
4void pieces(cube_t *, uint8_t [static 8], uint8_t [static 12]);
5
6void 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}

Generated with cgit - Back to sebastiano.tronto.net