diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-12-26 12:41:36 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-12-26 12:41:36 +0100 |
| commit | cecdb7c5a0fc4821bc56c6aae5428925ec1baa15 (patch) | |
| tree | 5f478c2154ffafe55f1866edd82546d1472fb6c3 /tests/fst_test_util.c | |
| parent | 1ac26de8dcb76323a5f96eab200a027236cb55d0 (diff) | |
| download | nissy-cecdb7c5a0fc4821bc56c6aae5428925ec1baa15.tar.gz nissy-cecdb7c5a0fc4821bc56c6aae5428925ec1baa15.zip | |
Fixed fst_inverse
Diffstat (limited to 'tests/fst_test_util.c')
| -rw-r--r-- | tests/fst_test_util.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/fst_test_util.c b/tests/fst_test_util.c new file mode 100644 index 0000000..35c1e9f --- /dev/null +++ b/tests/fst_test_util.c | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | #include "fst_test_util.h" | ||
| 2 | |||
| 3 | char *algs[] = { | ||
| 4 | "", | ||
| 5 | "U", "U2", "U'", "D", "D2", "D'", "R", "R2", "R'", | ||
| 6 | "L", "L2", "L'", "F", "F2", "F'", "B", "B2", "B'", | ||
| 7 | "U2 R2 U2 R2 U2", | ||
| 8 | "U2 F2 R2 B2 U2 D2 F2 L2 B2", | ||
| 9 | "RUR'URU2R'", | ||
| 10 | "L2 D R U2 B2 L", | ||
| 11 | "R'U'F", | ||
| 12 | "F2 U' R2 D' B2 D2 R2 D2 R2 U' F L' U' R B F2 R B' D2", | ||
| 13 | "D L2 F2 R2 D R2 U L2 U' B2 D L' F2 U2 B' L D' U' R' B2 F2", | ||
| 14 | "F' L2 F' D' R F2 L U L' D2 R2 F2 D2 R2 B' L2 B2 U2 F D2 B", | ||
| 15 | NULL, | ||
| 16 | }; | ||
| 17 | |||
| 18 | bool | ||
| 19 | equal_and_log(Cube *c, Cube *d) | ||
| 20 | { | ||
| 21 | bool ret = equal(c, d); | ||
| 22 | |||
| 23 | if (!ret) { | ||
| 24 | printf("These cubes should be equal, but are not:\n\n"); | ||
| 25 | print_cube(c); | ||
| 26 | printf("\n"); | ||
| 27 | print_cube(d); | ||
| 28 | printf("\n"); | ||
| 29 | } | ||
| 30 | |||
| 31 | return ret; | ||
| 32 | } | ||
| 33 | |||
| 34 | bool | ||
| 35 | try_str(CubeTester f, char *algstr, char *msg) | ||
| 36 | { | ||
| 37 | bool b; | ||
| 38 | Alg *a; | ||
| 39 | Cube c; | ||
| 40 | |||
| 41 | a = new_alg(algstr); | ||
| 42 | make_solved(&c); | ||
| 43 | apply_alg(a, &c); | ||
| 44 | |||
| 45 | if (!(b = f(&c, a))) | ||
| 46 | printf("%s with alg %s\n", msg, algstr); | ||
| 47 | |||
| 48 | free_alg(a); | ||
| 49 | |||
| 50 | return b; | ||
| 51 | } | ||
| 52 | |||
| 53 | bool | ||
| 54 | try_all_str(CubeTester f, char *msg) | ||
| 55 | { | ||
| 56 | bool b; | ||
| 57 | int i; | ||
| 58 | |||
| 59 | b = true; | ||
| 60 | for (i = 0; algs[i] != NULL; i++) | ||
| 61 | b = b && try_str(f, algs[i], msg); | ||
| 62 | |||
| 63 | return b; | ||
| 64 | } | ||
