diff options
Diffstat (limited to '')
| -rw-r--r-- | src/arch/coordinates_unoptimized.h | 2 | ||||
| -rw-r--r-- | src/core/cube.h | 11 | ||||
| -rw-r--r-- | src/core/oriented_cube.h | 3 | ||||
| -rw-r--r-- | src/core/transform.h | 2 | ||||
| -rw-r--r-- | src/solvers/coord/common.h | 2 | ||||
| -rw-r--r-- | src/solvers/h48/coordinate.h | 5 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_cocsep.h | 5 | ||||
| -rw-r--r-- | src/utils/dbg_log.h | 6 | ||||
| -rw-r--r-- | test/000_basic/all.in | 0 | ||||
| -rw-r--r-- | test/000_basic/all.out | 7 | ||||
| -rw-r--r-- | test/000_basic/basic_tests.c | 33 |
11 files changed, 15 insertions, 61 deletions
diff --git a/src/arch/coordinates_unoptimized.h b/src/arch/coordinates_unoptimized.h index c553b2b..de76018 100644 --- a/src/arch/coordinates_unoptimized.h +++ b/src/arch/coordinates_unoptimized.h | |||
| @@ -34,8 +34,6 @@ coord_epud(cube_t cube) | |||
| 34 | uint8_t c[8], e[12]; | 34 | uint8_t c[8], e[12]; |
| 35 | 35 | ||
| 36 | pieces(&cube, c, e); | 36 | pieces(&cube, c, e); |
| 37 | DBG_ASSERT(isperm(8, e), -1, | ||
| 38 | "Cannot compute epud coordinate: edges not separated"); | ||
| 39 | 37 | ||
| 40 | for (i = 0; i < 8; i++) | 38 | for (i = 0; i < 8; i++) |
| 41 | e[i] &= PBITS; | 39 | e[i] &= PBITS; |
diff --git a/src/core/cube.h b/src/core/cube.h index 842ec59..cdd3946 100644 --- a/src/core/cube.h +++ b/src/core/cube.h | |||
| @@ -87,8 +87,7 @@ issolvable(oriented_cube_t cube) | |||
| 87 | { | 87 | { |
| 88 | uint8_t i, eo, co, piece, edge[12], corner[8], ep[12], cp[8]; | 88 | uint8_t i, eo, co, piece, edge[12], corner[8], ep[12], cp[8]; |
| 89 | 89 | ||
| 90 | DBG_ASSERT(isconsistent(cube), false, | 90 | DBG_ASSERT(isconsistent(cube), "issolvable: cube is inconsistent\n"); |
| 91 | "issolvable: cube is inconsistent\n"); | ||
| 92 | 91 | ||
| 93 | pieces(&cube.cube, corner, edge); | 92 | pieces(&cube.cube, corner, edge); |
| 94 | for (i = 0; i < 12; i++) | 93 | for (i = 0; i < 12; i++) |
| @@ -175,16 +174,16 @@ getcube(int64_t ep, int64_t eo, int64_t cp, int64_t co) | |||
| 175 | uint8_t i, earr[12], carr[8], eoarr[12], coarr[8]; | 174 | uint8_t i, earr[12], carr[8], eoarr[12], coarr[8]; |
| 176 | 175 | ||
| 177 | sumzerotodigits(eo, 12, 2, eoarr); | 176 | sumzerotodigits(eo, 12, 2, eoarr); |
| 178 | DBG_ASSERT(eoarr[0] != UINT8_ERROR, ZERO_CUBE, "Error making EO"); | 177 | DBG_ASSERT(eoarr[0] != UINT8_ERROR, "Error making EO"); |
| 179 | indextoperm(ep, 12, earr); | 178 | indextoperm(ep, 12, earr); |
| 180 | DBG_ASSERT(earr[0] != UINT8_ERROR, ZERO_CUBE, "Error making EP"); | 179 | DBG_ASSERT(earr[0] != UINT8_ERROR, "Error making EP"); |
| 181 | for (i = 0; i < 12; i++) | 180 | for (i = 0; i < 12; i++) |
| 182 | earr[i] |= eoarr[i] << EOSHIFT; | 181 | earr[i] |= eoarr[i] << EOSHIFT; |
| 183 | 182 | ||
| 184 | sumzerotodigits(co, 8, 3, coarr); | 183 | sumzerotodigits(co, 8, 3, coarr); |
| 185 | DBG_ASSERT(coarr[0] != UINT8_ERROR, ZERO_CUBE, "Error making CO"); | 184 | DBG_ASSERT(coarr[0] != UINT8_ERROR, "Error making CO"); |
| 186 | indextoperm(cp, 8, carr); | 185 | indextoperm(cp, 8, carr); |
| 187 | DBG_ASSERT(carr[0] != UINT8_ERROR, ZERO_CUBE, "Error making CP"); | 186 | DBG_ASSERT(carr[0] != UINT8_ERROR, "Error making CP"); |
| 188 | for (i = 0; i < 8; i++) | 187 | for (i = 0; i < 8; i++) |
| 189 | carr[i] |= coarr[i] << COSHIFT; | 188 | carr[i] |= coarr[i] << COSHIFT; |
| 190 | 189 | ||
diff --git a/src/core/oriented_cube.h b/src/core/oriented_cube.h index 2c86af0..5449204 100644 --- a/src/core/oriented_cube.h +++ b/src/core/oriented_cube.h | |||
| @@ -56,8 +56,7 @@ applymoves(oriented_cube_t cube, const char *buf) | |||
| 56 | uint8_t m; | 56 | uint8_t m; |
| 57 | oriented_cube_t c, cinv; | 57 | oriented_cube_t c, cinv; |
| 58 | 58 | ||
| 59 | DBG_ASSERT(isconsistent(cube), ZERO_ORIENTED_CUBE, | 59 | DBG_ASSERT(isconsistent(cube), "move error: inconsistent cube\n"); |
| 60 | "move error: inconsistent cube\n"); | ||
| 61 | 60 | ||
| 62 | c = cube; | 61 | c = cube; |
| 63 | cinv = SOLVED_ORIENTED_CUBE; | 62 | cinv = SOLVED_ORIENTED_CUBE; |
diff --git a/src/core/transform.h b/src/core/transform.h index d1d2931..91d4893 100644 --- a/src/core/transform.h +++ b/src/core/transform.h | |||
| @@ -371,7 +371,7 @@ applytrans(oriented_cube_t cube, const char *buf) | |||
| 371 | { | 371 | { |
| 372 | uint8_t t; | 372 | uint8_t t; |
| 373 | 373 | ||
| 374 | DBG_ASSERT(isconsistent(cube), ZERO_ORIENTED_CUBE, | 374 | DBG_ASSERT(isconsistent(cube), |
| 375 | "transformation error: inconsistent cube\n"); | 375 | "transformation error: inconsistent cube\n"); |
| 376 | 376 | ||
| 377 | t = readtrans(buf); | 377 | t = readtrans(buf); |
diff --git a/src/solvers/coord/common.h b/src/solvers/coord/common.h index d000ce9..d38b7d3 100644 --- a/src/solvers/coord/common.h +++ b/src/solvers/coord/common.h | |||
| @@ -133,7 +133,7 @@ coord_gendata_generic( | |||
| 133 | 133 | ||
| 134 | writetableinfo(&info, coord_datasize, data); | 134 | writetableinfo(&info, coord_datasize, data); |
| 135 | 135 | ||
| 136 | DBG_ASSERT(n == coord->sym.classes, SIZE_MAX, | 136 | DBG_ASSERT(n == coord->sym.classes, |
| 137 | "%s coordinate data: computed %" PRIu64 " classes, " | 137 | "%s coordinate data: computed %" PRIu64 " classes, " |
| 138 | "expected %" PRIu64 "\n", coord->name, n, coord->sym.classes); | 138 | "expected %" PRIu64 "\n", coord->name, n, coord->sym.classes); |
| 139 | 139 | ||
diff --git a/src/solvers/h48/coordinate.h b/src/solvers/h48/coordinate.h index eb08fd8..9437fa7 100644 --- a/src/solvers/h48/coordinate.h +++ b/src/solvers/h48/coordinate.h | |||
| @@ -15,7 +15,7 @@ coord_h48( | |||
| 15 | uint32_t data; | 15 | uint32_t data; |
| 16 | uint8_t ttrep; | 16 | uint8_t ttrep; |
| 17 | 17 | ||
| 18 | DBG_ASSERT(h <= 11, -1, "coord_h48: h must be between 0 and 11\n"); | 18 | DBG_ASSERT(h <= 11, "coord_h48: h must be between 0 and 11\n"); |
| 19 | 19 | ||
| 20 | cocsep = coord_cocsep(c); | 20 | cocsep = coord_cocsep(c); |
| 21 | data = cocsepdata[cocsep]; | 21 | data = cocsepdata[cocsep]; |
| @@ -54,8 +54,7 @@ invcoord_h48( | |||
| 54 | cube_t ret; | 54 | cube_t ret; |
| 55 | int64_t hh, coclass, ee, esep, eo; | 55 | int64_t hh, coclass, ee, esep, eo; |
| 56 | 56 | ||
| 57 | DBG_ASSERT(h <= 11, ZERO_CUBE, | 57 | DBG_ASSERT(h <= 11, "invcoord_h48: h must be between 0 and 11\n"); |
| 58 | "invcoord_h48: h must be between 0 and 11\n"); | ||
| 59 | 58 | ||
| 60 | hh = (int64_t)h; | 59 | hh = (int64_t)h; |
| 61 | coclass = i / H48_ESIZE(h); | 60 | coclass = i / H48_ESIZE(h); |
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h index 3117a8e..7a589b5 100644 --- a/src/solvers/h48/gendata_cocsep.h +++ b/src/solvers/h48/gendata_cocsep.h | |||
| @@ -61,9 +61,8 @@ gendata_cocsep( | |||
| 61 | 61 | ||
| 62 | writetableinfo(&info, COCSEP_FULLSIZE, buf); | 62 | writetableinfo(&info, COCSEP_FULLSIZE, buf); |
| 63 | 63 | ||
| 64 | DBG_ASSERT(n == COCSEP_CLASSES, 0, | 64 | DBG_ASSERT(n == COCSEP_CLASSES, "cocsep: computed %" PRIu16 |
| 65 | "cocsep: computed %" PRIu16 " symmetry classes, " | 65 | " symmetry classes, expected %zu\n", n, COCSEP_CLASSES); |
| 66 | "expected %zu\n", n, COCSEP_CLASSES); | ||
| 67 | 66 | ||
| 68 | LOG("[H48 gendata] cocsep data computed\n"); | 67 | LOG("[H48 gendata] cocsep data computed\n"); |
| 69 | 68 | ||
diff --git a/src/utils/dbg_log.h b/src/utils/dbg_log.h index e5b3e24..d737ff2 100644 --- a/src/utils/dbg_log.h +++ b/src/utils/dbg_log.h | |||
| @@ -24,11 +24,11 @@ write_wrapper(void (*write)(const char *, void *), const char *str, ...) | |||
| 24 | #define STATIC | 24 | #define STATIC |
| 25 | #define STATIC_INLINE | 25 | #define STATIC_INLINE |
| 26 | #define DBG_WARN(condition, ...) if (!(condition)) LOG(__VA_ARGS__); | 26 | #define DBG_WARN(condition, ...) if (!(condition)) LOG(__VA_ARGS__); |
| 27 | #define DBG_ASSERT(condition, retval, ...) \ | 27 | #define DBG_ASSERT(condition, ...) \ |
| 28 | if (!(condition)) { LOG(__VA_ARGS__); return retval; } | 28 | if (!(condition)) { LOG(__VA_ARGS__); exit(1); } |
| 29 | #else | 29 | #else |
| 30 | #define STATIC static | 30 | #define STATIC static |
| 31 | #define STATIC_INLINE static inline | 31 | #define STATIC_INLINE static inline |
| 32 | #define DBG_WARN(condition, ...) | 32 | #define DBG_WARN(condition, ...) |
| 33 | #define DBG_ASSERT(condition, retval, ...) | 33 | #define DBG_ASSERT(condition, ...) |
| 34 | #endif | 34 | #endif |
diff --git a/test/000_basic/all.in b/test/000_basic/all.in deleted file mode 100644 index e69de29..0000000 --- a/test/000_basic/all.in +++ /dev/null | |||
diff --git a/test/000_basic/all.out b/test/000_basic/all.out deleted file mode 100644 index 892ad22..0000000 --- a/test/000_basic/all.out +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | Solved is solvable | ||
| 2 | Solved is solved | ||
| 3 | Zero is NOT solvable | ||
| 4 | Zero is NOT solved | ||
| 5 | Solved and Solved are equal | ||
| 6 | Solved and Zero are NOT equal | ||
| 7 | Zero and Solved are NOT equal | ||
diff --git a/test/000_basic/basic_tests.c b/test/000_basic/basic_tests.c deleted file mode 100644 index df38e88..0000000 --- a/test/000_basic/basic_tests.c +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | bool issolved(oriented_cube_t); | ||
| 4 | bool equal(cube_t, cube_t); | ||
| 5 | |||
| 6 | void | ||
| 7 | check(oriented_cube_t cube, char *name) | ||
| 8 | { | ||
| 9 | printf("%s is%s solvable\n", name, issolvable(cube) ? "" : " NOT"); | ||
| 10 | printf("%s is%s solved\n", name, issolved(cube) ? "" : " NOT"); | ||
| 11 | } | ||
| 12 | |||
| 13 | void | ||
| 14 | check2(oriented_cube_t cube1, char *name1, oriented_cube_t cube2, char *name2) | ||
| 15 | { | ||
| 16 | bool eq = equal(cube1.cube, cube2.cube) && | ||
| 17 | cube1.orientation == cube2.orientation; | ||
| 18 | printf("%s and %s are%s equal\n", name1, name2, eq ? "" : " NOT"); | ||
| 19 | } | ||
| 20 | |||
| 21 | void run(void) { | ||
| 22 | oriented_cube_t zero, solved; | ||
| 23 | |||
| 24 | memset(&zero, 0, sizeof(oriented_cube_t)); | ||
| 25 | solved = solvedcube(); | ||
| 26 | |||
| 27 | check(solved, "Solved"); | ||
| 28 | check(zero, "Zero"); | ||
| 29 | |||
| 30 | check2(solved, "Solved", solved, "Solved"); | ||
| 31 | check2(solved, "Solved", zero, "Zero"); | ||
| 32 | check2(zero, "Zero", solved, "Solved"); | ||
| 33 | } | ||
