From 7faca28009c5efb0ba2b897b34dbdcac47a1a6f3 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 25 Apr 2025 10:09:22 +0200 Subject: NISS --- test/130_appendsolution/appendsolution_tests.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'test/130_appendsolution/appendsolution_tests.c') 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 @@ /* Input format for appendsolution tests: -moves on normal -moves on inverse (without parentheses) +moves on normal (with NISS notation) unniss flag (0=false, 1=true) number of transformations transformations, one per line +the orientation of the cube, as a number from 0 to 23 See below for the output format. */ @@ -13,7 +13,8 @@ See below for the output format. #include "../test.h" uint8_t readtrans(const char [NISSY_SIZE_TRANSFORMATION]); -int64_t readmoves(const char *, size_t n, uint8_t [n]); +int64_t readmoves(const char *, size_t n, size_t m, + uint64_t *, uint64_t *, uint8_t [n], uint8_t [m]); void solution_moves_reset(solution_moves_t [static 1]); bool solution_list_init(solution_list_t [static 1], size_t n, char [n]); int64_t appendsolution(const solution_moves_t [static 1], @@ -22,6 +23,8 @@ int64_t appendsolution(const solution_moves_t [static 1], void run(void) { int i, ntrans; + int64_t tot; + uint64_t nm, np; char str[STRLENMAX], buf[STRLENMAX]; solution_moves_t moves; solution_settings_t settings; @@ -38,9 +41,13 @@ void run(void) { }; fgets(str, STRLENMAX, stdin); - moves.nmoves = (uint8_t)readmoves(str, 20, moves.moves); - fgets(str, STRLENMAX, stdin); - moves.npremoves = (uint8_t)readmoves(str, 20, moves.premoves); + tot = readmoves(str, 20, 20, &nm, &np, moves.moves, moves.premoves); + if (tot < 0) { + printf("Test error reading moves\n"); + return; + } + moves.nmoves = nm; + moves.npremoves = np; fgets(str, STRLENMAX, stdin); settings.unniss = (bool)atoi(str); fgets(str, STRLENMAX, stdin); @@ -49,6 +56,8 @@ void run(void) { fgets(str, STRLENMAX, stdin); settings.tmask |= UINT64_C(1) << (uint64_t)readtrans(str); } + fgets(str, STRLENMAX, stdin); + settings.orientation = atoi(str); appendsolution(&moves, &settings, &list, false, "Test"); -- cgit v1.3