From fb9ae9e41eaf01b3651395fdd450ac1a4743e592 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 10 Nov 2023 14:44:48 +0100 Subject: Big changes to the interface --- test/010_io_H48_read_write/io_H48_tests.c | 4 ++-- test/011_io_SRC_write/01_solved.out | 4 ++-- test/011_io_SRC_write/02_scrambled.out | 4 ++-- test/011_io_SRC_write/io_SRC_tests.c | 4 ++-- test/012_io_AVX_write/io_AVX_tests.c | 4 ++-- test/020_move/move_tests.c | 24 +++++++----------------- test/030_inverse_cube/inverse_tests.c | 4 ++-- test/040_compose/compose_tests.c | 6 +++--- test/050_transform/transform_tests.c | 22 +++++++--------------- test/061_coord_eo/coord_eo_tests.c | 2 +- 10 files changed, 30 insertions(+), 48 deletions(-) (limited to 'test') diff --git a/test/010_io_H48_read_write/io_H48_tests.c b/test/010_io_H48_read_write/io_H48_tests.c index 758124e..70d1a91 100644 --- a/test/010_io_H48_read_write/io_H48_tests.c +++ b/test/010_io_H48_read_write/io_H48_tests.c @@ -17,14 +17,14 @@ int main() { for (c = str; (*c = getchar()) != EOF; c++) ; *c = '\0'; - cube = readcube(H48, str); + cube = readcube("H48", str); if (iserror(cube)) { printf("Error reading cube\n"); } else if (!issolvable(cube)) { printf("Cube is not solvable\n"); } else { - writecube(H48, cube, str); + writecube("H48", cube, str); printf("%s\n", str); } diff --git a/test/011_io_SRC_write/01_solved.out b/test/011_io_SRC_write/01_solved.out index 3853027..3c21bcc 100644 --- a/test/011_io_SRC_write/01_solved.out +++ b/test/011_io_SRC_write/01_solved.out @@ -1,4 +1,4 @@ { - .c = {0, 1, 2, 3, 4, 5, 6, 7}, - .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} + .corner = {0, 1, 2, 3, 4, 5, 6, 7}, + .edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} } diff --git a/test/011_io_SRC_write/02_scrambled.out b/test/011_io_SRC_write/02_scrambled.out index 44d3d04..b899386 100644 --- a/test/011_io_SRC_write/02_scrambled.out +++ b/test/011_io_SRC_write/02_scrambled.out @@ -1,4 +1,4 @@ { - .c = {38, 32, 37, 68, 67, 2, 71, 1}, - .e = {9, 2, 17, 8, 4, 3, 0, 27, 21, 26, 6, 7} + .corner = {38, 32, 37, 68, 67, 2, 71, 1}, + .edge = {9, 2, 17, 8, 4, 3, 0, 27, 21, 26, 6, 7} } diff --git a/test/011_io_SRC_write/io_SRC_tests.c b/test/011_io_SRC_write/io_SRC_tests.c index dd1bb7c..c2d10f6 100644 --- a/test/011_io_SRC_write/io_SRC_tests.c +++ b/test/011_io_SRC_write/io_SRC_tests.c @@ -17,14 +17,14 @@ int main() { for (c = str; (*c = getchar()) != EOF; c++) ; *c = '\0'; - cube = readcube(H48, str); + cube = readcube("H48", str); if (iserror(cube)) { printf("Error reading cube\n"); } else if (!issolvable(cube)) { printf("Cube is not solvable\n"); } else { - writecube(SRC, cube, str); + writecube("SRC", cube, str); printf("%s\n", str); } diff --git a/test/012_io_AVX_write/io_AVX_tests.c b/test/012_io_AVX_write/io_AVX_tests.c index e2fa3e4..cbe6ef0 100644 --- a/test/012_io_AVX_write/io_AVX_tests.c +++ b/test/012_io_AVX_write/io_AVX_tests.c @@ -17,14 +17,14 @@ int main() { for (c = str; (*c = getchar()) != EOF; c++) ; *c = '\0'; - cube = readcube(H48, str); + cube = readcube("H48", str); if (iserror(cube)) { printf("Error reading cube\n"); } else if (!issolvable(cube)) { printf("Cube is not solvable\n"); } else { - writecube(AVX, cube, str); + writecube("AVX", cube, str); printf("%s\n", str); } diff --git a/test/020_move/move_tests.c b/test/020_move/move_tests.c index 4a010f1..9e414cc 100644 --- a/test/020_move/move_tests.c +++ b/test/020_move/move_tests.c @@ -12,32 +12,22 @@ #define MOVESMAX 1000 int main() { - char str[STRLENMAX]; - int i, n; - move_t moves[MOVESMAX]; + char movestr[STRLENMAX], cubestr[STRLENMAX]; cube_t cube; - fgets(str, STRLENMAX, stdin); - n = readmoves(str, moves); + fgets(movestr, STRLENMAX, stdin); + fgets(cubestr, STRLENMAX, stdin); + cube = readcube("H48", cubestr); - if (n == -1) { - printf("Error reading moves\n"); - return 1; - } - - fgets(str, STRLENMAX, stdin); - cube = readcube(H48, str); - - for (i = 0; i < n; i++) - cube = move(cube, moves[i]); + cube = applymoves(cube, movestr); if (iserror(cube)) { printf("Error moving cube\n"); } else if (!issolvable(cube)) { printf("Moved cube is not solvable\n"); } else { - writecube(H48, cube, str); - printf("%s\n", str); + writecube("H48", cube, cubestr); + printf("%s\n", cubestr); } return 0; diff --git a/test/030_inverse_cube/inverse_tests.c b/test/030_inverse_cube/inverse_tests.c index b07ab87..9151e42 100644 --- a/test/030_inverse_cube/inverse_tests.c +++ b/test/030_inverse_cube/inverse_tests.c @@ -15,7 +15,7 @@ int main() { cube_t cube, inv; fgets(str, STRLENMAX, stdin); - cube = readcube(H48, str); + cube = readcube("H48", str); inv = inverse(cube); if (iserror(inv)) { @@ -23,7 +23,7 @@ int main() { } else if (!issolvable(inv)) { printf("Inverted cube is not solvable\n"); } else { - writecube(H48, inv, str); + writecube("H48", inv, str); printf("%s\n", str); } diff --git a/test/040_compose/compose_tests.c b/test/040_compose/compose_tests.c index 62f636e..c9c11af 100644 --- a/test/040_compose/compose_tests.c +++ b/test/040_compose/compose_tests.c @@ -15,9 +15,9 @@ int main() { cube_t c1, c2, c3; fgets(str, STRLENMAX, stdin); - c1 = readcube(H48, str); + c1 = readcube("H48", str); fgets(str, STRLENMAX, stdin); - c2 = readcube(H48, str); + c2 = readcube("H48", str); c3 = compose(c1, c2); @@ -26,7 +26,7 @@ int main() { } else if (!issolvable(c3)) { printf("Composed cube is not solvable\n"); } else { - writecube(H48, c3, str); + writecube("H48", c3, str); printf("%s\n", str); } diff --git a/test/050_transform/transform_tests.c b/test/050_transform/transform_tests.c index 30d62da..e22a4a1 100644 --- a/test/050_transform/transform_tests.c +++ b/test/050_transform/transform_tests.c @@ -11,30 +11,22 @@ #define STRLENMAX 10000 int main() { - char str[STRLENMAX]; - trans_t t; + char cubestr[STRLENMAX], transtr[STRLENMAX]; cube_t cube; - fgets(str, STRLENMAX, stdin); - t = readtrans(str); + fgets(transtr, STRLENMAX, stdin); + fgets(cubestr, STRLENMAX, stdin); + cube = readcube("H48", cubestr); - if (t >= 48) { - printf("Error reading trans\n"); - return 1; - } - - fgets(str, STRLENMAX, stdin); - cube = readcube(H48, str); - - cube = transform(cube, t); + cube = applytrans(cube, transtr); if (iserror(cube)) { printf("Error transforming cube\n"); } else if (!issolvable(cube)) { printf("Transformed cube is not solvable\n"); } else { - writecube(H48, cube, str); - printf("%s\n", str); + writecube("H48", cube, cubestr); + printf("%s\n", cubestr); } return 0; diff --git a/test/061_coord_eo/coord_eo_tests.c b/test/061_coord_eo/coord_eo_tests.c index 65119ef..30989e8 100644 --- a/test/061_coord_eo/coord_eo_tests.c +++ b/test/061_coord_eo/coord_eo_tests.c @@ -16,7 +16,7 @@ int main() { int16_t result; fgets(str, STRLENMAX, stdin); - cube = readcube(H48, str); + cube = readcube("H48", str); result = coord_eo(cube); -- cgit v1.3