diff options
Diffstat (limited to 'test/033_inverse_move/inverse_move_tests.c')
| -rw-r--r-- | test/033_inverse_move/inverse_move_tests.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/033_inverse_move/inverse_move_tests.c b/test/033_inverse_move/inverse_move_tests.c new file mode 100644 index 0000000..dc9845c --- /dev/null +++ b/test/033_inverse_move/inverse_move_tests.c | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | extern char *movestr[]; | ||
| 4 | |||
| 5 | int64_t readmoves(const char *, size_t n, uint8_t [n]); | ||
| 6 | uint8_t inverse_move(uint8_t); | ||
| 7 | |||
| 8 | void run(void) { | ||
| 9 | uint8_t moves[2]; | ||
| 10 | |||
| 11 | char moves_string[STRLENMAX]; | ||
| 12 | |||
| 13 | fgets(moves_string, STRLENMAX, stdin); | ||
| 14 | if (readmoves(moves_string, 2, moves) != 1) { | ||
| 15 | printf("Test error: cannot read moves\n"); | ||
| 16 | return; | ||
| 17 | } | ||
| 18 | |||
| 19 | printf("%s\n", movestr[inverse_move(moves[0])]); | ||
| 20 | } | ||
