diff options
Diffstat (limited to 'tests/fst_post_init_tests.c')
| -rw-r--r-- | tests/fst_post_init_tests.c | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/tests/fst_post_init_tests.c b/tests/fst_post_init_tests.c deleted file mode 100644 index 9d8d554..0000000 --- a/tests/fst_post_init_tests.c +++ /dev/null | |||
| @@ -1,81 +0,0 @@ | |||
| 1 | #include "fst_test_util.h" | ||
| 2 | |||
| 3 | static bool fst_move_testcase(Cube *c, Alg *a); | ||
| 4 | static bool fst_inverse_testcase(Cube *c, Alg *a); | ||
| 5 | |||
| 6 | static bool fst_move_test(); | ||
| 7 | static bool fst_inverse_test(); | ||
| 8 | |||
| 9 | static Tester test[] = { | ||
| 10 | fst_move_test, | ||
| 11 | fst_inverse_test, | ||
| 12 | NULL | ||
| 13 | }; | ||
| 14 | |||
| 15 | static char *name[] = { | ||
| 16 | "FST move", | ||
| 17 | "FST inverse", | ||
| 18 | }; | ||
| 19 | |||
| 20 | static bool | ||
| 21 | fst_move_testcase(Cube *c, Alg *a) | ||
| 22 | { | ||
| 23 | int i; | ||
| 24 | Cube d; | ||
| 25 | FstCube fst; | ||
| 26 | |||
| 27 | make_solved(&d); | ||
| 28 | fst = cube_to_fst(&d); | ||
| 29 | |||
| 30 | for (i = 0; i < a->len; i++) { | ||
| 31 | if (a->inv[i] || a->move[i] > B3) { | ||
| 32 | printf("Cannot apply the following alg to FST: "); | ||
| 33 | print_alg(a, false); | ||
| 34 | return false; | ||
| 35 | } | ||
| 36 | fst = fst_move(a->move[i], fst); | ||
| 37 | } | ||
| 38 | |||
| 39 | fst_to_cube(fst, &d); | ||
| 40 | |||
| 41 | return equal_and_log(c, &d); | ||
| 42 | } | ||
| 43 | |||
| 44 | static bool | ||
| 45 | fst_inverse_testcase(Cube *c, Alg *a) | ||
| 46 | { | ||
| 47 | Cube d; | ||
| 48 | |||
| 49 | fst_to_cube(fst_inverse(cube_to_fst(c)), &d); | ||
| 50 | invert_cube(c); | ||
| 51 | |||
| 52 | return equal_and_log(c, &d); | ||
| 53 | } | ||
| 54 | |||
| 55 | static bool | ||
| 56 | fst_move_test() | ||
| 57 | { | ||
| 58 | return try_all_str(fst_move_testcase, "FST move incorrect"); | ||
| 59 | } | ||
| 60 | |||
| 61 | static bool | ||
| 62 | fst_inverse_test() | ||
| 63 | { | ||
| 64 | return try_all_str(fst_inverse_testcase, "FST test incorrect"); | ||
| 65 | } | ||
| 66 | |||
| 67 | void fst_post_init_testall() { | ||
| 68 | int i; | ||
| 69 | |||
| 70 | init_fst(); | ||
| 71 | |||
| 72 | for (i = 0; test[i] != NULL; i++) { | ||
| 73 | printf("Test: %s\n", name[i]); | ||
| 74 | if (!test[i]()) { | ||
| 75 | printf("Failed!\n"); | ||
| 76 | exit(1); | ||
| 77 | } | ||
| 78 | printf("Passed.\n\n"); | ||
| 79 | } | ||
| 80 | printf("All FST post-init tests passed.\n\n"); | ||
| 81 | } | ||
