From 086a06fe3d84ac8b2e74c824e05f9d23f0b292ab Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 22 Dec 2025 18:07:06 +0100 Subject: Added tests for copy_co, renamed some tests --- test/076_copy_co/copy_co_tests.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/076_copy_co/copy_co_tests.c (limited to 'test/076_copy_co/copy_co_tests.c') 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 @@ +#include "../test.h" + +void copy_co(cube_t *, cube_t); +void pieces(cube_t *, uint8_t [static 8], uint8_t [static 12]); + +void run(void) { + char str[STRLENMAX]; + oriented_cube_t cube1, cube2; + uint8_t edge[12], corner[8]; + + fgets(str, STRLENMAX, stdin); + cube1 = readcube(str); + fgets(str, STRLENMAX, stdin); + cube2 = readcube(str); + + copy_co(&cube1.cube, cube2.cube); + + if (iserror(cube1)) { + printf("Error copying CO\n"); + } else if (!isconsistent(cube2)) { + pieces(&cube1.cube, corner, edge); + fprintf(stderr, "edges: "); + for (int i = 0; i < 12; i++) + fprintf(stderr, "%d ", edge[i]); + fprintf(stderr, "\n"); + for (int i = 0; i < 8; i++) + fprintf(stderr, "%d ", corner[i]); + fprintf(stderr, "\n"); + printf("Setting CO resulted in inconsistent cube\n"); + } else { + writecube(cube1, NISSY_SIZE_CUBE, str); + printf("%s\n", str); + } +} -- cgit v1.3