aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-08-05 10:13:43 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-08-05 10:13:43 +0200
commit950f3f27b1bbd883767ae282be25414e04f11465 (patch)
treecaf688c071c2e87de8b0e0770ea76f3432c5734c /tools
parentce787387f258a4d7caab39d2c2c7d2161ae89a82 (diff)
downloadnissy-core-950f3f27b1bbd883767ae282be25414e04f11465.tar.gz
nissy-core-950f3f27b1bbd883767ae282be25414e04f11465.zip
Added build target to run solvetests
Diffstat (limited to '')
-rw-r--r--tools/solvetest.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/solvetest.h b/tools/solvetest.h
index 4c72ca5..75f7aab 100644
--- a/tools/solvetest.h
+++ b/tools/solvetest.h
@@ -95,23 +95,24 @@ void run(void) {
95 for (i = 0; s[i].scramble[0]; i++) { 95 for (i = 0; s[i].scramble[0]; i++) {
96 printf("\n%d. %s\n", i, s[i].scramble); 96 printf("\n%d. %s\n", i, s[i].scramble);
97 97
98 /* Multiple solutions */
99 if (nissy_applymoves(NISSY_SOLVED_CUBE, s[i].scramble, cube) 98 if (nissy_applymoves(NISSY_SOLVED_CUBE, s[i].scramble, cube)
100 == -1) { 99 == NISSY_ERROR_INVALID_MOVES) {
101 printf("Invalid scramble\n"); 100 printf("Invalid scramble\n");
102 continue; 101 exit(1);
103 } 102 }
103
104 nissy_solve(cube, solver, 104 nissy_solve(cube, solver,
105 NISSFLAG, MINMOVES, MAXMOVES, MAXSOLUTIONS, OPTIMAL, 105 NISSFLAG, MINMOVES, MAXMOVES, MAXSOLUTIONS, OPTIMAL,
106 0, size, buf, SOL_BUFFER_LEN, sol, stats, 106 0, size, buf, SOL_BUFFER_LEN, sol, stats,
107 NULL, NULL); 107 NULL, NULL);
108
108 if (check_all(sol, s[i].solutions)) { 109 if (check_all(sol, s[i].solutions)) {
109 printf("All solutions are correct\n"); 110 printf("All solutions are correct\n");
110 } else { 111 } else {
111 printf("Error!\n"); 112 printf("Error!\n");
112 printf("Found solution(s):\n%s", sol); 113 printf("Found solution(s):\n%s", sol);
113 printf("Valid solution(s):\n%s", s[i].solutions); 114 printf("Valid solution(s):\n%s", s[i].solutions);
114 return; 115 exit(1);
115 } 116 }
116 } 117 }
117 118

Generated with cgit - Back to sebastiano.tronto.net