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/00_solved_solved.in | 2 ++ test/076_copy_co/00_solved_solved.out | 1 + test/076_copy_co/01_solved_scrambled.in | 4 ++++ test/076_copy_co/01_solved_scrambled.out | 1 + test/076_copy_co/02_scrambled_scrambled.in | 4 ++++ test/076_copy_co/02_scrambled_scrambled.out | 1 + test/076_copy_co/copy_co_tests.c | 34 +++++++++++++++++++++++++++++ 7 files changed, 47 insertions(+) create mode 100644 test/076_copy_co/00_solved_solved.in create mode 100644 test/076_copy_co/00_solved_solved.out create mode 100644 test/076_copy_co/01_solved_scrambled.in create mode 100644 test/076_copy_co/01_solved_scrambled.out create mode 100644 test/076_copy_co/02_scrambled_scrambled.in create mode 100644 test/076_copy_co/02_scrambled_scrambled.out create mode 100644 test/076_copy_co/copy_co_tests.c (limited to 'test/076_copy_co') diff --git a/test/076_copy_co/00_solved_solved.in b/test/076_copy_co/00_solved_solved.in new file mode 100644 index 0000000..14c8c39 --- /dev/null +++ b/test/076_copy_co/00_solved_solved.in @@ -0,0 +1,2 @@ +ABCDEFGH=ABCDEFGHIJKL=A +ABCDEFGH=ABCDEFGHIJKL=A diff --git a/test/076_copy_co/00_solved_solved.out b/test/076_copy_co/00_solved_solved.out new file mode 100644 index 0000000..5aa6ba7 --- /dev/null +++ b/test/076_copy_co/00_solved_solved.out @@ -0,0 +1 @@ +ABCDEFGH=ABCDEFGHIJKL=A diff --git a/test/076_copy_co/01_solved_scrambled.in b/test/076_copy_co/01_solved_scrambled.in new file mode 100644 index 0000000..3a1db4b --- /dev/null +++ b/test/076_copy_co/01_solved_scrambled.in @@ -0,0 +1,4 @@ +ABCDEFGH=ABCDEFGHIJKL=A +CILVXGMR=FKbGIDSXBJAU=A + +// Scramble: U R D' L D' F L2 D L F B D2 B' L2 F U2 L2 D2 R2 L2 B' diff --git a/test/076_copy_co/01_solved_scrambled.out b/test/076_copy_co/01_solved_scrambled.out new file mode 100644 index 0000000..bcfe94c --- /dev/null +++ b/test/076_copy_co/01_solved_scrambled.out @@ -0,0 +1 @@ +AJKTUFOX=ABCDEFGHIJKL=A diff --git a/test/076_copy_co/02_scrambled_scrambled.in b/test/076_copy_co/02_scrambled_scrambled.in new file mode 100644 index 0000000..fb0bccd --- /dev/null +++ b/test/076_copy_co/02_scrambled_scrambled.in @@ -0,0 +1,4 @@ +ICLMVGRX=FIJDAXKGbBUS=A +CILVXGMR=FKbGIDSXBJAU=A + +// Scramble: U R D' L D' F L2 D L F B D2 B' L2 F U2 L2 D2 R2 L2 B' diff --git a/test/076_copy_co/02_scrambled_scrambled.out b/test/076_copy_co/02_scrambled_scrambled.out new file mode 100644 index 0000000..cde43a9 --- /dev/null +++ b/test/076_copy_co/02_scrambled_scrambled.out @@ -0,0 +1 @@ +AKLUVGJX=FIJDAXKGbBUS=A 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