diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-25 10:09:22 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-25 10:09:22 +0200 |
| commit | 7faca28009c5efb0ba2b897b34dbdcac47a1a6f3 (patch) | |
| tree | fd507509d00d2926175c72f4c06b9158c3a331a7 /test/062_transform_move | |
| parent | 17e5a9e1e2b241c67956651f87f40236467fe7d8 (diff) | |
| download | nissy-core-7faca28009c5efb0ba2b897b34dbdcac47a1a6f3.tar.gz nissy-core-7faca28009c5efb0ba2b897b34dbdcac47a1a6f3.zip | |
NISS
Diffstat (limited to 'test/062_transform_move')
| -rw-r--r-- | test/062_transform_move/transform_move_tests.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/062_transform_move/transform_move_tests.c b/test/062_transform_move/transform_move_tests.c index 39e8619..17cb0b6 100644 --- a/test/062_transform_move/transform_move_tests.c +++ b/test/062_transform_move/transform_move_tests.c | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | cube_t applytrans(cube_t, const char *); | 5 | cube_t applytrans(cube_t, const char *); |
| 6 | uint8_t transform_move(uint8_t, uint8_t); | 6 | uint8_t transform_move(uint8_t, uint8_t); |
| 7 | int64_t readmoves(const char *, size_t n, uint8_t [n]); | 7 | int64_t readmoves(const char *, size_t n, size_t m, |
| 8 | uint64_t *, uint64_t *, uint8_t [n], uint8_t [m]); | ||
| 8 | oriented_cube_t move_extended(oriented_cube_t, uint8_t); | 9 | oriented_cube_t move_extended(oriented_cube_t, uint8_t); |
| 9 | oriented_cube_t applymoves(oriented_cube_t, const char *); | 10 | oriented_cube_t applymoves(oriented_cube_t, const char *); |
| 10 | uint8_t readtrans(const char[static NISSY_SIZE_TRANSFORMATION]); | 11 | uint8_t readtrans(const char[static NISSY_SIZE_TRANSFORMATION]); |
| @@ -12,14 +13,19 @@ uint8_t readtrans(const char[static NISSY_SIZE_TRANSFORMATION]); | |||
| 12 | void run(void) { | 13 | void run(void) { |
| 13 | char movestr[STRLENMAX], transtr[STRLENMAX], cubestr[STRLENMAX]; | 14 | char movestr[STRLENMAX], transtr[STRLENMAX], cubestr[STRLENMAX]; |
| 14 | uint8_t t, moves[MAXMOVES]; | 15 | uint8_t t, moves[MAXMOVES]; |
| 15 | int i, n; | 16 | uint64_t i, n, ninv; |
| 17 | int64_t tot; | ||
| 16 | oriented_cube_t cube; | 18 | oriented_cube_t cube; |
| 17 | 19 | ||
| 18 | fgets(transtr, STRLENMAX, stdin); | 20 | fgets(transtr, STRLENMAX, stdin); |
| 19 | fgets(movestr, STRLENMAX, stdin); | 21 | fgets(movestr, STRLENMAX, stdin); |
| 20 | 22 | ||
| 21 | cube = solvedcube(); | 23 | cube = solvedcube(); |
| 22 | n = readmoves(movestr, MAXMOVES, moves); | 24 | tot = readmoves(movestr, MAXMOVES, 0, &n, &ninv, moves, NULL); |
| 25 | if (tot < 0 || ninv != 0) { | ||
| 26 | printf("Test error reading moves\n"); | ||
| 27 | return; | ||
| 28 | } | ||
| 23 | t = readtrans(transtr); | 29 | t = readtrans(transtr); |
| 24 | for (i = 0; i < n; i++) | 30 | for (i = 0; i < n; i++) |
| 25 | cube = move_extended(cube, transform_move(moves[i], t)); | 31 | cube = move_extended(cube, transform_move(moves[i], t)); |
