aboutsummaryrefslogtreecommitdiff
path: root/test/130_appendsolution/appendsolution_tests.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-04-25 10:09:22 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-04-25 10:09:22 +0200
commit7faca28009c5efb0ba2b897b34dbdcac47a1a6f3 (patch)
treefd507509d00d2926175c72f4c06b9158c3a331a7 /test/130_appendsolution/appendsolution_tests.c
parent17e5a9e1e2b241c67956651f87f40236467fe7d8 (diff)
downloadnissy-core-7faca28009c5efb0ba2b897b34dbdcac47a1a6f3.tar.gz
nissy-core-7faca28009c5efb0ba2b897b34dbdcac47a1a6f3.zip
NISS
Diffstat (limited to '')
-rw-r--r--test/130_appendsolution/appendsolution_tests.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/130_appendsolution/appendsolution_tests.c b/test/130_appendsolution/appendsolution_tests.c
index abff359..e1b7e98 100644
--- a/test/130_appendsolution/appendsolution_tests.c
+++ b/test/130_appendsolution/appendsolution_tests.c
@@ -1,11 +1,11 @@
1/* 1/*
2Input format for appendsolution tests: 2Input format for appendsolution tests:
3 3
4moves on normal 4moves on normal (with NISS notation)
5moves on inverse (without parentheses)
6unniss flag (0=false, 1=true) 5unniss flag (0=false, 1=true)
7number of transformations 6number of transformations
8transformations, one per line 7transformations, one per line
8the orientation of the cube, as a number from 0 to 23
9 9
10See below for the output format. 10See below for the output format.
11*/ 11*/
@@ -13,7 +13,8 @@ See below for the output format.
13#include "../test.h" 13#include "../test.h"
14 14
15uint8_t readtrans(const char [NISSY_SIZE_TRANSFORMATION]); 15uint8_t readtrans(const char [NISSY_SIZE_TRANSFORMATION]);
16int64_t readmoves(const char *, size_t n, uint8_t [n]); 16int64_t readmoves(const char *, size_t n, size_t m,
17 uint64_t *, uint64_t *, uint8_t [n], uint8_t [m]);
17void solution_moves_reset(solution_moves_t [static 1]); 18void solution_moves_reset(solution_moves_t [static 1]);
18bool solution_list_init(solution_list_t [static 1], size_t n, char [n]); 19bool solution_list_init(solution_list_t [static 1], size_t n, char [n]);
19int64_t appendsolution(const solution_moves_t [static 1], 20int64_t appendsolution(const solution_moves_t [static 1],
@@ -22,6 +23,8 @@ int64_t appendsolution(const solution_moves_t [static 1],
22 23
23void run(void) { 24void run(void) {
24 int i, ntrans; 25 int i, ntrans;
26 int64_t tot;
27 uint64_t nm, np;
25 char str[STRLENMAX], buf[STRLENMAX]; 28 char str[STRLENMAX], buf[STRLENMAX];
26 solution_moves_t moves; 29 solution_moves_t moves;
27 solution_settings_t settings; 30 solution_settings_t settings;
@@ -38,9 +41,13 @@ void run(void) {
38 }; 41 };
39 42
40 fgets(str, STRLENMAX, stdin); 43 fgets(str, STRLENMAX, stdin);
41 moves.nmoves = (uint8_t)readmoves(str, 20, moves.moves); 44 tot = readmoves(str, 20, 20, &nm, &np, moves.moves, moves.premoves);
42 fgets(str, STRLENMAX, stdin); 45 if (tot < 0) {
43 moves.npremoves = (uint8_t)readmoves(str, 20, moves.premoves); 46 printf("Test error reading moves\n");
47 return;
48 }
49 moves.nmoves = nm;
50 moves.npremoves = np;
44 fgets(str, STRLENMAX, stdin); 51 fgets(str, STRLENMAX, stdin);
45 settings.unniss = (bool)atoi(str); 52 settings.unniss = (bool)atoi(str);
46 fgets(str, STRLENMAX, stdin); 53 fgets(str, STRLENMAX, stdin);
@@ -49,6 +56,8 @@ void run(void) {
49 fgets(str, STRLENMAX, stdin); 56 fgets(str, STRLENMAX, stdin);
50 settings.tmask |= UINT64_C(1) << (uint64_t)readtrans(str); 57 settings.tmask |= UINT64_C(1) << (uint64_t)readtrans(str);
51 } 58 }
59 fgets(str, STRLENMAX, stdin);
60 settings.orientation = atoi(str);
52 61
53 appendsolution(&moves, &settings, &list, false, "Test"); 62 appendsolution(&moves, &settings, &list, false, "Test");
54 63

Generated with cgit - Back to sebastiano.tronto.net