aboutsummaryrefslogtreecommitdiff
path: root/test/060_solve_simple
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-11-12 14:42:20 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-11-12 14:42:20 +0100
commitd0c592bdc3beb12074f085ab085dd90de9b8e643 (patch)
treea7b31fc66c83400c95288edd7550d6b27cccecaa /test/060_solve_simple
parent91afd406dca8dee4dfdb84ad025dd390f4e5a70c (diff)
downloadnissy-core-d0c592bdc3beb12074f085ab085dd90de9b8e643.tar.gz
nissy-core-d0c592bdc3beb12074f085ab085dd90de9b8e643.zip
Simple solver: added tests, fixed
Diffstat (limited to 'test/060_solve_simple')
-rw-r--r--test/060_solve_simple/01_U_U3.in8
-rw-r--r--test/060_solve_simple/01_U_U3.out1
-rw-r--r--test/060_solve_simple/02_MUMU_alloptimal.in8
-rw-r--r--test/060_solve_simple/02_MUMU_alloptimal.out4
-rw-r--r--test/060_solve_simple/solve_simple_tests.c58
5 files changed, 79 insertions, 0 deletions
diff --git a/test/060_solve_simple/01_U_U3.in b/test/060_solve_simple/01_U_U3.in
new file mode 100644
index 0000000..c0f7930
--- /dev/null
+++ b/test/060_solve_simple/01_U_U3.in
@@ -0,0 +1,8 @@
1UR0 UL0 DB0 DF0 UB0 UF0 DL0 DR0 FR0 FL0 BL0 BR0 UBR0 UFL0 DFL0 DBR0 UFR0 UBL0 DFR0 DBL0
2simple
3
4normal
50
63
73
8-1
diff --git a/test/060_solve_simple/01_U_U3.out b/test/060_solve_simple/01_U_U3.out
new file mode 100644
index 0000000..ca934b4
--- /dev/null
+++ b/test/060_solve_simple/01_U_U3.out
@@ -0,0 +1 @@
U'
diff --git a/test/060_solve_simple/02_MUMU_alloptimal.in b/test/060_solve_simple/02_MUMU_alloptimal.in
new file mode 100644
index 0000000..f97c95f
--- /dev/null
+++ b/test/060_solve_simple/02_MUMU_alloptimal.in
@@ -0,0 +1,8 @@
1UB0 DF0 DB0 UF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
2simple
3
4normal
50
6-1
710
80
diff --git a/test/060_solve_simple/02_MUMU_alloptimal.out b/test/060_solve_simple/02_MUMU_alloptimal.out
new file mode 100644
index 0000000..06cd521
--- /dev/null
+++ b/test/060_solve_simple/02_MUMU_alloptimal.out
@@ -0,0 +1,4 @@
1U2 R' L F2 R L'
2R U2 R' L F2 L'
3R L' U2 R' L F2
4L' U2 R' L F2 R
diff --git a/test/060_solve_simple/solve_simple_tests.c b/test/060_solve_simple/solve_simple_tests.c
new file mode 100644
index 0000000..14a1674
--- /dev/null
+++ b/test/060_solve_simple/solve_simple_tests.c
@@ -0,0 +1,58 @@
1#include <stdbool.h>
2#include <stdint.h>
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6
7#ifdef CUBE_AVX2
8#include <immintrin.h>
9#endif
10
11#include "../../cube.h"
12
13#define S 10000
14
15int main() {
16 char cubestr[S], solverstr[S], optionsstr[S], nisstypestr[S];
17 char minmovesstr[S], maxmovesstr[S], maxsolsstr[S], optimalstr[S];
18 char solutionsstr[S];
19 cube_t cube;
20 int64_t maxsols;
21 int8_t minmoves, maxmoves, optimal;
22
23 fgets(cubestr, S, stdin);
24 fgets(solverstr, S, stdin);
25 fgets(optionsstr, S, stdin);
26 fgets(nisstypestr, S, stdin);
27 fgets(minmovesstr, S, stdin);
28 fgets(maxmovesstr, S, stdin);
29 fgets(maxsolsstr, S, stdin);
30 fgets(optimalstr, S, stdin);
31
32 solverstr[strcspn(solverstr, "\n")] = 0;
33 optionsstr[strcspn(optionsstr, "\n")] = 0;
34 nisstypestr[strcspn(nisstypestr, "\n")] = 0;
35
36 cube = readcube("H48", cubestr);
37 minmoves = atoi(minmovesstr);
38 maxmoves = atoi(maxmovesstr);
39 maxsols = atoi(maxsolsstr);
40 optimal = atoi(optimalstr);
41
42 solve(
43 cube,
44 solverstr,
45 optionsstr,
46 nisstypestr,
47 minmoves,
48 maxmoves,
49 maxsols,
50 optimal,
51 NULL,
52 solutionsstr
53 );
54
55 printf("%s", solutionsstr);
56
57 return 0;
58}

Generated with cgit - Back to sebastiano.tronto.net