aboutsummaryrefslogtreecommitdiff
path: root/test/032_invertmoves/invertmoves_tests.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-09-05 17:52:41 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-09-05 17:52:41 +0200
commitf85ac77efc0feeeab183e509a7baca1c507da3c5 (patch)
tree7bc6cee6059b97e41dc58982ef8c9b4c624d9824 /test/032_invertmoves/invertmoves_tests.c
parent35237ef2621d8e5a2387426067c2ec9a75f03836 (diff)
downloadnissy-core-f85ac77efc0feeeab183e509a7baca1c507da3c5.tar.gz
nissy-core-f85ac77efc0feeeab183e509a7baca1c507da3c5.zip
Added test for invermoves and small refactor
Diffstat (limited to 'test/032_invertmoves/invertmoves_tests.c')
-rw-r--r--test/032_invertmoves/invertmoves_tests.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/032_invertmoves/invertmoves_tests.c b/test/032_invertmoves/invertmoves_tests.c
new file mode 100644
index 0000000..acb2adc
--- /dev/null
+++ b/test/032_invertmoves/invertmoves_tests.c
@@ -0,0 +1,21 @@
1#include "../test.h"
2
3#define MAXMOVES 20
4
5int64_t readmoves(const char *, int, uint8_t *);
6void writemoves(uint8_t *, int, char *);
7void invertmoves(uint8_t *, uint8_t, uint8_t *);
8
9void run(void) {
10 char movestr[STRLENMAX], outstr[STRLENMAX];
11 uint8_t moves[MAXMOVES], ret[MAXMOVES];
12 int c;
13
14 fgets(movestr, STRLENMAX, stdin);
15 c = readmoves(movestr, MAXMOVES, moves);
16
17 invertmoves(moves, c, ret);
18 writemoves(ret, c, outstr);
19
20 printf("%s\n", outstr);
21}

Generated with cgit - Back to sebastiano.tronto.net