From 28ad019d62583b7e89b4e76922aa73857d5876eb Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 28 May 2024 15:42:26 +0200 Subject: Added roadmap for refactor and some simple routines --- test/001_pieces/01_solved.in | 1 + test/001_pieces/01_solved.out | 2 ++ test/001_pieces/02_scrambled.in | 1 + test/001_pieces/02_scrambled.out | 2 ++ test/001_pieces/pieces_tests.c | 28 ++++++++++++++++++++++++++++ 5 files changed, 34 insertions(+) create mode 100644 test/001_pieces/01_solved.in create mode 100644 test/001_pieces/01_solved.out create mode 100644 test/001_pieces/02_scrambled.in create mode 100644 test/001_pieces/02_scrambled.out create mode 100644 test/001_pieces/pieces_tests.c (limited to 'test/001_pieces') diff --git a/test/001_pieces/01_solved.in b/test/001_pieces/01_solved.in new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/test/001_pieces/01_solved.in @@ -0,0 +1 @@ +UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 diff --git a/test/001_pieces/01_solved.out b/test/001_pieces/01_solved.out new file mode 100644 index 0000000..94eb955 --- /dev/null +++ b/test/001_pieces/01_solved.out @@ -0,0 +1,2 @@ +0 1 2 3 4 5 6 7 +0 1 2 3 4 5 6 7 8 9 10 11 diff --git a/test/001_pieces/02_scrambled.in b/test/001_pieces/02_scrambled.in new file mode 100644 index 0000000..6a05bbc --- /dev/null +++ b/test/001_pieces/02_scrambled.in @@ -0,0 +1 @@ +FL0 DB0 UB1 FR0 UR0 DF0 UF0 BR1 UL1 BL1 DL0 DR0 DFR1 UFR1 UBR1 UFL2 DBR2 DFL0 DBL2 UBL0 diff --git a/test/001_pieces/02_scrambled.out b/test/001_pieces/02_scrambled.out new file mode 100644 index 0000000..136336a --- /dev/null +++ b/test/001_pieces/02_scrambled.out @@ -0,0 +1,2 @@ +38 32 37 68 67 2 71 1 +9 2 17 8 4 3 0 27 21 26 6 7 diff --git a/test/001_pieces/pieces_tests.c b/test/001_pieces/pieces_tests.c new file mode 100644 index 0000000..f3d8d4e --- /dev/null +++ b/test/001_pieces/pieces_tests.c @@ -0,0 +1,28 @@ +#include "../test.h" + +uint8_t corner(cube_fast_t, int); +uint8_t edge(cube_fast_t, int); + +int main(void) { + int i; + char str[STRLENMAX], *aux; + cube_t cube; + cube_fast_t fast; + + aux = str; + while (fgets(aux, STRLENMAX, stdin) != NULL) + while (*aux != '\n') + aux++; + + cube = readcube("H48", str); + fast = cubetofast(cube); + + for (i = 0; i < 8; i++) + printf("%" PRIu8 " ", corner(fast, i)); + printf("\n"); + for (i = 0; i < 12; i++) + printf("%" PRIu8 " ", edge(fast, i)); + printf("\n"); + + return 0; +} -- cgit v1.3