diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-12 11:11:28 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-12 11:11:28 +0200 |
| commit | da8fdd4955fd24666643915a6728678e9965a0d3 (patch) | |
| tree | 878d7baf68f90e80949bc79a039bda159865821f /test | |
| parent | 14689e29252e608d51c5b52e61e43471d2aa021e (diff) | |
| download | nissy-core-da8fdd4955fd24666643915a6728678e9965a0d3.tar.gz nissy-core-da8fdd4955fd24666643915a6728678e9965a0d3.zip | |
Make writecube safer
Diffstat (limited to 'test')
| -rw-r--r-- | test/020_io_H48_read_write/io_H48_tests.c | 2 | ||||
| -rw-r--r-- | test/021_io_B32_write/io_B32_read_tests.c | 2 | ||||
| -rw-r--r-- | test/022_io_B32_read/io_B32_read_tests.c | 2 | ||||
| -rw-r--r-- | test/023_io_LST_write/io_LST_write_tests.c | 2 | ||||
| -rw-r--r-- | test/024_io_LST_read/io_LST_read_tests.c | 2 | ||||
| -rw-r--r-- | test/030_move/move_tests.c | 2 | ||||
| -rw-r--r-- | test/031_premove/premove_tests.c | 2 | ||||
| -rw-r--r-- | test/040_inverse_cube/inverse_tests.c | 2 | ||||
| -rw-r--r-- | test/050_compose/compose_tests.c | 2 | ||||
| -rw-r--r-- | test/060_transform/transform_tests.c | 2 | ||||
| -rw-r--r-- | test/075_set_eo/set_eo_tests.c | 2 | ||||
| -rw-r--r-- | test/076_copy_corners/copy_corners_tests.c | 2 | ||||
| -rw-r--r-- | test/077_copy_edges/copy_edges_tests.c | 2 | ||||
| -rw-r--r-- | test/081_getcube/getcube_tests.c | 2 | ||||
| -rw-r--r-- | test/test.h | 4 |
15 files changed, 16 insertions, 16 deletions
diff --git a/test/020_io_H48_read_write/io_H48_tests.c b/test/020_io_H48_read_write/io_H48_tests.c index 3d4b7e3..7809c87 100644 --- a/test/020_io_H48_read_write/io_H48_tests.c +++ b/test/020_io_H48_read_write/io_H48_tests.c | |||
| @@ -16,7 +16,7 @@ void run(void) { | |||
| 16 | } else if (!issolvable(cube)) { | 16 | } else if (!issolvable(cube)) { |
| 17 | printf("Cube is not solvable\n"); | 17 | printf("Cube is not solvable\n"); |
| 18 | } else { | 18 | } else { |
| 19 | writecube("H48", cube, str); | 19 | writecube("H48", cube, NISSY_SIZE_H48, str); |
| 20 | printf("%s\n", str); | 20 | printf("%s\n", str); |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
diff --git a/test/021_io_B32_write/io_B32_read_tests.c b/test/021_io_B32_write/io_B32_read_tests.c index 1d2d334..50e07d4 100644 --- a/test/021_io_B32_write/io_B32_read_tests.c +++ b/test/021_io_B32_write/io_B32_read_tests.c | |||
| @@ -16,7 +16,7 @@ void run(void) { | |||
| 16 | } else if (!issolvable(cube)) { | 16 | } else if (!issolvable(cube)) { |
| 17 | printf("Cube is not solvable\n"); | 17 | printf("Cube is not solvable\n"); |
| 18 | } else { | 18 | } else { |
| 19 | writecube("B32", cube, str); | 19 | writecube("B32", cube, NISSY_SIZE_B32, str); |
| 20 | printf("%s\n", str); | 20 | printf("%s\n", str); |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
diff --git a/test/022_io_B32_read/io_B32_read_tests.c b/test/022_io_B32_read/io_B32_read_tests.c index 5fa9daf..e11b017 100644 --- a/test/022_io_B32_read/io_B32_read_tests.c +++ b/test/022_io_B32_read/io_B32_read_tests.c | |||
| @@ -16,7 +16,7 @@ void run(void) { | |||
| 16 | } else if (!issolvable(cube)) { | 16 | } else if (!issolvable(cube)) { |
| 17 | printf("Cube is not solvable\n"); | 17 | printf("Cube is not solvable\n"); |
| 18 | } else { | 18 | } else { |
| 19 | writecube("H48", cube, str); | 19 | writecube("H48", cube, NISSY_SIZE_H48, str); |
| 20 | printf("%s\n", str); | 20 | printf("%s\n", str); |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
diff --git a/test/023_io_LST_write/io_LST_write_tests.c b/test/023_io_LST_write/io_LST_write_tests.c index f041864..363bc6d 100644 --- a/test/023_io_LST_write/io_LST_write_tests.c +++ b/test/023_io_LST_write/io_LST_write_tests.c | |||
| @@ -16,7 +16,7 @@ void run(void) { | |||
| 16 | } else if (!issolvable(cube)) { | 16 | } else if (!issolvable(cube)) { |
| 17 | printf("Cube is not solvable\n"); | 17 | printf("Cube is not solvable\n"); |
| 18 | } else { | 18 | } else { |
| 19 | writecube("LST", cube, str); | 19 | writecube("LST", cube, STRLENMAX, str); |
| 20 | printf("%s\n", str); | 20 | printf("%s\n", str); |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
diff --git a/test/024_io_LST_read/io_LST_read_tests.c b/test/024_io_LST_read/io_LST_read_tests.c index fa80131..1a0f087 100644 --- a/test/024_io_LST_read/io_LST_read_tests.c +++ b/test/024_io_LST_read/io_LST_read_tests.c | |||
| @@ -16,7 +16,7 @@ void run(void) { | |||
| 16 | } else if (!issolvable(cube)) { | 16 | } else if (!issolvable(cube)) { |
| 17 | printf("Cube is not solvable\n"); | 17 | printf("Cube is not solvable\n"); |
| 18 | } else { | 18 | } else { |
| 19 | writecube("H48", cube, str); | 19 | writecube("H48", cube, NISSY_SIZE_H48, str); |
| 20 | printf("%s\n", str); | 20 | printf("%s\n", str); |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
diff --git a/test/030_move/move_tests.c b/test/030_move/move_tests.c index d4a109b..2f0ecfb 100644 --- a/test/030_move/move_tests.c +++ b/test/030_move/move_tests.c | |||
| @@ -17,7 +17,7 @@ void run(void) { | |||
| 17 | } else if (!issolvable(cube)) { | 17 | } else if (!issolvable(cube)) { |
| 18 | printf("Moved cube is not solvable\n"); | 18 | printf("Moved cube is not solvable\n"); |
| 19 | } else { | 19 | } else { |
| 20 | writecube("H48", cube, cubestr); | 20 | writecube("H48", cube, NISSY_SIZE_H48, cubestr); |
| 21 | printf("%s\n", cubestr); | 21 | printf("%s\n", cubestr); |
| 22 | } | 22 | } |
| 23 | } | 23 | } |
diff --git a/test/031_premove/premove_tests.c b/test/031_premove/premove_tests.c index fa3707e..07631c1 100644 --- a/test/031_premove/premove_tests.c +++ b/test/031_premove/premove_tests.c | |||
| @@ -21,7 +21,7 @@ void run(void) { | |||
| 21 | } else if (!issolvable(cube)) { | 21 | } else if (!issolvable(cube)) { |
| 22 | printf("Moved cube is not solvable\n"); | 22 | printf("Moved cube is not solvable\n"); |
| 23 | } else { | 23 | } else { |
| 24 | writecube("H48", cube, cubestr); | 24 | writecube("H48", cube, NISSY_SIZE_H48, cubestr); |
| 25 | printf("%s\n", cubestr); | 25 | printf("%s\n", cubestr); |
| 26 | } | 26 | } |
| 27 | } | 27 | } |
diff --git a/test/040_inverse_cube/inverse_tests.c b/test/040_inverse_cube/inverse_tests.c index 4cb7ad1..c1045ab 100644 --- a/test/040_inverse_cube/inverse_tests.c +++ b/test/040_inverse_cube/inverse_tests.c | |||
| @@ -15,7 +15,7 @@ void run(void) { | |||
| 15 | } else if (!issolvable(inv)) { | 15 | } else if (!issolvable(inv)) { |
| 16 | printf("Inverted cube is not solvable\n"); | 16 | printf("Inverted cube is not solvable\n"); |
| 17 | } else { | 17 | } else { |
| 18 | writecube("H48", inv, str); | 18 | writecube("H48", inv, NISSY_SIZE_H48, str); |
| 19 | printf("%s\n", str); | 19 | printf("%s\n", str); |
| 20 | } | 20 | } |
| 21 | } | 21 | } |
diff --git a/test/050_compose/compose_tests.c b/test/050_compose/compose_tests.c index e0e65b2..c778838 100644 --- a/test/050_compose/compose_tests.c +++ b/test/050_compose/compose_tests.c | |||
| @@ -18,7 +18,7 @@ void run(void) { | |||
| 18 | } else if (!issolvable(c3)) { | 18 | } else if (!issolvable(c3)) { |
| 19 | printf("Composed cube is not solvable\n"); | 19 | printf("Composed cube is not solvable\n"); |
| 20 | } else { | 20 | } else { |
| 21 | writecube("H48", c3, str); | 21 | writecube("H48", c3, NISSY_SIZE_H48, str); |
| 22 | printf("%s\n", str); | 22 | printf("%s\n", str); |
| 23 | } | 23 | } |
| 24 | } | 24 | } |
diff --git a/test/060_transform/transform_tests.c b/test/060_transform/transform_tests.c index bdb4dc5..80a2031 100644 --- a/test/060_transform/transform_tests.c +++ b/test/060_transform/transform_tests.c | |||
| @@ -17,7 +17,7 @@ void run(void) { | |||
| 17 | } else if (!issolvable(cube)) { | 17 | } else if (!issolvable(cube)) { |
| 18 | printf("Transformed cube is not solvable\n"); | 18 | printf("Transformed cube is not solvable\n"); |
| 19 | } else { | 19 | } else { |
| 20 | writecube("H48", cube, cubestr); | 20 | writecube("H48", cube, NISSY_SIZE_H48, cubestr); |
| 21 | printf("%s\n", cubestr); | 21 | printf("%s\n", cubestr); |
| 22 | } | 22 | } |
| 23 | } | 23 | } |
diff --git a/test/075_set_eo/set_eo_tests.c b/test/075_set_eo/set_eo_tests.c index fb2c23e..0c67e87 100644 --- a/test/075_set_eo/set_eo_tests.c +++ b/test/075_set_eo/set_eo_tests.c | |||
| @@ -30,7 +30,7 @@ void run(void) { | |||
| 30 | fprintf(stderr, "\n"); | 30 | fprintf(stderr, "\n"); |
| 31 | printf("Setting EO resulted in inconsistent cube\n"); | 31 | printf("Setting EO resulted in inconsistent cube\n"); |
| 32 | } else { | 32 | } else { |
| 33 | writecube("H48", cube, str); | 33 | writecube("H48", cube, NISSY_SIZE_H48, str); |
| 34 | printf("%s\n", str); | 34 | printf("%s\n", str); |
| 35 | } | 35 | } |
| 36 | } | 36 | } |
diff --git a/test/076_copy_corners/copy_corners_tests.c b/test/076_copy_corners/copy_corners_tests.c index 7464ecc..d1674fc 100644 --- a/test/076_copy_corners/copy_corners_tests.c +++ b/test/076_copy_corners/copy_corners_tests.c | |||
| @@ -19,7 +19,7 @@ void run(void) { | |||
| 19 | } else if (!isconsistent(c1)) { | 19 | } else if (!isconsistent(c1)) { |
| 20 | printf("Setting EO resulted in inconsistent cube\n"); | 20 | printf("Setting EO resulted in inconsistent cube\n"); |
| 21 | } else { | 21 | } else { |
| 22 | writecube("H48", c1, str); | 22 | writecube("H48", c1, NISSY_SIZE_H48, str); |
| 23 | printf("%s\n", str); | 23 | printf("%s\n", str); |
| 24 | } | 24 | } |
| 25 | } | 25 | } |
diff --git a/test/077_copy_edges/copy_edges_tests.c b/test/077_copy_edges/copy_edges_tests.c index 5077861..48c5c53 100644 --- a/test/077_copy_edges/copy_edges_tests.c +++ b/test/077_copy_edges/copy_edges_tests.c | |||
| @@ -19,7 +19,7 @@ void run(void) { | |||
| 19 | } else if (!isconsistent(c1)) { | 19 | } else if (!isconsistent(c1)) { |
| 20 | printf("Setting EO resulted in inconsistent cube\n"); | 20 | printf("Setting EO resulted in inconsistent cube\n"); |
| 21 | } else { | 21 | } else { |
| 22 | writecube("H48", c1, str); | 22 | writecube("H48", c1, NISSY_SIZE_H48, str); |
| 23 | printf("%s\n", str); | 23 | printf("%s\n", str); |
| 24 | } | 24 | } |
| 25 | } | 25 | } |
diff --git a/test/081_getcube/getcube_tests.c b/test/081_getcube/getcube_tests.c index 7eb59dc..46c324b 100644 --- a/test/081_getcube/getcube_tests.c +++ b/test/081_getcube/getcube_tests.c | |||
| @@ -23,7 +23,7 @@ void run(void) { | |||
| 23 | } else if (!isconsistent(cube)) { | 23 | } else if (!isconsistent(cube)) { |
| 24 | printf("Inconsistent cube\n"); | 24 | printf("Inconsistent cube\n"); |
| 25 | } else { | 25 | } else { |
| 26 | writecube("H48", cube, str); | 26 | writecube("H48", cube, NISSY_SIZE_H48, str); |
| 27 | printf("%s\n", str); | 27 | printf("%s\n", str); |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
diff --git a/test/test.h b/test/test.h index b90a399..fe362c7 100644 --- a/test/test.h +++ b/test/test.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
| 9 | #include <string.h> | 9 | #include <string.h> |
| 10 | 10 | ||
| 11 | #include "../src/nissy.h" | ||
| 11 | #include "../src/arch/arch.h" | 12 | #include "../src/arch/arch.h" |
| 12 | #include "../src/solvers/tables_types_macros.h" | 13 | #include "../src/solvers/tables_types_macros.h" |
| 13 | #include "../src/solvers/h48/coordinate_macros.h" | 14 | #include "../src/solvers/h48/coordinate_macros.h" |
| @@ -23,8 +24,7 @@ bool isconsistent(cube_t); | |||
| 23 | bool issolvable(cube_t); | 24 | bool issolvable(cube_t); |
| 24 | bool issolved(cube_t); | 25 | bool issolved(cube_t); |
| 25 | cube_t readcube(char *, char *); | 26 | cube_t readcube(char *, char *); |
| 26 | void writecube(char *, cube_t, char *); | 27 | int64_t writecube(char *, cube_t, uint64_t, char *); |
| 27 | void nissy_setlogger(void (*logger_function)(const char *, ...)); | ||
| 28 | 28 | ||
| 29 | /* Test function to be implemented by all tests */ | 29 | /* Test function to be implemented by all tests */ |
| 30 | void run(void); | 30 | void run(void); |
