From 17e5a9e1e2b241c67956651f87f40236467fe7d8 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 23 Apr 2025 21:34:06 +0200 Subject: Added tests for inverse move --- test/033_inverse_move/inverse_move_tests.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/033_inverse_move/inverse_move_tests.c (limited to 'test/033_inverse_move/inverse_move_tests.c') 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 @@ +#include "../test.h" + +extern char *movestr[]; + +int64_t readmoves(const char *, size_t n, uint8_t [n]); +uint8_t inverse_move(uint8_t); + +void run(void) { + uint8_t moves[2]; + + char moves_string[STRLENMAX]; + + fgets(moves_string, STRLENMAX, stdin); + if (readmoves(moves_string, 2, moves) != 1) { + printf("Test error: cannot read moves\n"); + return; + } + + printf("%s\n", movestr[inverse_move(moves[0])]); +} -- cgit v1.3