aboutsummaryrefslogtreecommitdiff
path: root/test/020_move
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-11-10 14:44:48 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-11-10 14:44:48 +0100
commitfb9ae9e41eaf01b3651395fdd450ac1a4743e592 (patch)
tree8fb29e9b62d40d6407f082f55a7164775154bf78 /test/020_move
parent04c3ee1f5acac47650be8d0ffbf90e238df0d12b (diff)
downloadnissy-core-fb9ae9e41eaf01b3651395fdd450ac1a4743e592.tar.gz
nissy-core-fb9ae9e41eaf01b3651395fdd450ac1a4743e592.zip
Big changes to the interface
Diffstat (limited to 'test/020_move')
-rw-r--r--test/020_move/move_tests.c24
1 files changed, 7 insertions, 17 deletions
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 @@
12#define MOVESMAX 1000 12#define MOVESMAX 1000
13 13
14int main() { 14int main() {
15 char str[STRLENMAX]; 15 char movestr[STRLENMAX], cubestr[STRLENMAX];
16 int i, n;
17 move_t moves[MOVESMAX];
18 cube_t cube; 16 cube_t cube;
19 17
20 fgets(str, STRLENMAX, stdin); 18 fgets(movestr, STRLENMAX, stdin);
21 n = readmoves(str, moves); 19 fgets(cubestr, STRLENMAX, stdin);
20 cube = readcube("H48", cubestr);
22 21
23 if (n == -1) { 22 cube = applymoves(cube, movestr);
24 printf("Error reading moves\n");
25 return 1;
26 }
27
28 fgets(str, STRLENMAX, stdin);
29 cube = readcube(H48, str);
30
31 for (i = 0; i < n; i++)
32 cube = move(cube, moves[i]);
33 23
34 if (iserror(cube)) { 24 if (iserror(cube)) {
35 printf("Error moving cube\n"); 25 printf("Error moving cube\n");
36 } else if (!issolvable(cube)) { 26 } else if (!issolvable(cube)) {
37 printf("Moved cube is not solvable\n"); 27 printf("Moved cube is not solvable\n");
38 } else { 28 } else {
39 writecube(H48, cube, str); 29 writecube("H48", cube, cubestr);
40 printf("%s\n", str); 30 printf("%s\n", cubestr);
41 } 31 }
42 32
43 return 0; 33 return 0;

Generated with cgit - Back to sebastiano.tronto.net