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/033_inverse_move/inverse_move_tests.c | |
| parent | 17e5a9e1e2b241c67956651f87f40236467fe7d8 (diff) | |
| download | nissy-core-7faca28009c5efb0ba2b897b34dbdcac47a1a6f3.tar.gz nissy-core-7faca28009c5efb0ba2b897b34dbdcac47a1a6f3.zip | |
NISS
Diffstat (limited to 'test/033_inverse_move/inverse_move_tests.c')
| -rw-r--r-- | test/033_inverse_move/inverse_move_tests.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/033_inverse_move/inverse_move_tests.c b/test/033_inverse_move/inverse_move_tests.c index dc9845c..e9bad0c 100644 --- a/test/033_inverse_move/inverse_move_tests.c +++ b/test/033_inverse_move/inverse_move_tests.c | |||
| @@ -2,19 +2,25 @@ | |||
| 2 | 2 | ||
| 3 | extern char *movestr[]; | 3 | extern char *movestr[]; |
| 4 | 4 | ||
| 5 | int64_t readmoves(const char *, size_t n, uint8_t [n]); | 5 | int64_t readmoves(const char *, size_t n, size_t m, |
| 6 | uint64_t *, uint64_t *, uint8_t [n], uint8_t [m]); | ||
| 6 | uint8_t inverse_move(uint8_t); | 7 | uint8_t inverse_move(uint8_t); |
| 7 | 8 | ||
| 8 | void run(void) { | 9 | void run(void) { |
| 10 | uint64_t inv, nor; | ||
| 11 | int64_t tot; | ||
| 9 | uint8_t moves[2]; | 12 | uint8_t moves[2]; |
| 10 | 13 | ||
| 11 | char moves_string[STRLENMAX]; | 14 | char moves_string[STRLENMAX]; |
| 12 | 15 | ||
| 13 | fgets(moves_string, STRLENMAX, stdin); | 16 | fgets(moves_string, STRLENMAX, stdin); |
| 14 | if (readmoves(moves_string, 2, moves) != 1) { | 17 | tot = readmoves(moves_string, 2, 0, &nor, &inv, moves, NULL); |
| 15 | printf("Test error: cannot read moves\n"); | 18 | if (nor != 1 || tot != 1) { |
| 19 | printf("Test error reading moves\n"); | ||
| 16 | return; | 20 | return; |
| 17 | } | 21 | } |
| 18 | 22 | ||
| 23 | fprintf(stderr, "Read move %" PRIu8 " = %s\n", moves[0], movestr[moves[0]]); | ||
| 24 | |||
| 19 | printf("%s\n", movestr[inverse_move(moves[0])]); | 25 | printf("%s\n", movestr[inverse_move(moves[0])]); |
| 20 | } | 26 | } |
