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 | |
| 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')
| -rw-r--r-- | test/076_copy_co/00_solved_solved.in | 2 | ||||
| -rw-r--r-- | test/076_copy_co/00_solved_solved.out | 1 | ||||
| -rw-r--r-- | test/076_copy_co/01_solved_scrambled.in | 4 | ||||
| -rw-r--r-- | test/076_copy_co/01_solved_scrambled.out | 1 | ||||
| -rw-r--r-- | test/076_copy_co/02_scrambled_scrambled.in | 4 | ||||
| -rw-r--r-- | test/076_copy_co/02_scrambled_scrambled.out | 1 | ||||
| -rw-r--r-- | test/076_copy_co/copy_co_tests.c | 34 |
7 files changed, 47 insertions, 0 deletions
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 @@ | |||
| 1 | ABCDEFGH=ABCDEFGHIJKL=A | ||
| 2 | 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 @@ | |||
| 1 | ABCDEFGH=ABCDEFGHIJKL=A | ||
| 2 | CILVXGMR=FKbGIDSXBJAU=A | ||
| 3 | |||
| 4 | // 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 @@ | |||
| 1 | ICLMVGRX=FIJDAXKGbBUS=A | ||
| 2 | CILVXGMR=FKbGIDSXBJAU=A | ||
| 3 | |||
| 4 | // 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 @@ | |||
| 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 | } | ||
