diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-22 06:43:11 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-22 18:45:47 +0100 |
| commit | ce3f1cc0ef9f46d70ab5387b1458e9098b40711d (patch) | |
| tree | 4949745670b829f2211381bf14b8440dcc6ca7b1 /test/032_invertmoves | |
| parent | 0550a16c1cce868bbc3f3b5ad59f80e35cf2a6cd (diff) | |
| download | nissy-core-ce3f1cc0ef9f46d70ab5387b1458e9098b40711d.tar.gz nissy-core-ce3f1cc0ef9f46d70ab5387b1458e9098b40711d.zip | |
Some safety with move arrays, small refactor appendchar
Diffstat (limited to 'test/032_invertmoves')
| -rw-r--r-- | test/032_invertmoves/invertmoves_tests.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/032_invertmoves/invertmoves_tests.c b/test/032_invertmoves/invertmoves_tests.c index d5da323..d791524 100644 --- a/test/032_invertmoves/invertmoves_tests.c +++ b/test/032_invertmoves/invertmoves_tests.c | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #define MAXMOVES 20 | 3 | #define MAXMOVES 20 |
| 4 | 4 | ||
| 5 | int64_t readmoves(const char *, int, uint8_t *); | 5 | int64_t readmoves(const char *, int, uint8_t *); |
| 6 | void writemoves(uint8_t *, int, uint64_t, char *); | 6 | void writemoves(size_t n, uint8_t [n], size_t m, char [m]); |
| 7 | void invertmoves(uint8_t *, uint8_t, uint8_t *); | 7 | void invertmoves(size_t n, const uint8_t [n], uint8_t [n]); |
| 8 | 8 | ||
| 9 | void run(void) { | 9 | void run(void) { |
| 10 | char movestr[STRLENMAX], outstr[STRLENMAX]; | 10 | char movestr[STRLENMAX], outstr[STRLENMAX]; |
| @@ -14,8 +14,8 @@ void run(void) { | |||
| 14 | fgets(movestr, STRLENMAX, stdin); | 14 | fgets(movestr, STRLENMAX, stdin); |
| 15 | c = readmoves(movestr, MAXMOVES, moves); | 15 | c = readmoves(movestr, MAXMOVES, moves); |
| 16 | 16 | ||
| 17 | invertmoves(moves, c, ret); | 17 | invertmoves(c, moves, ret); |
| 18 | writemoves(ret, c, STRLENMAX, outstr); | 18 | writemoves(c, ret, STRLENMAX, outstr); |
| 19 | 19 | ||
| 20 | printf("%s\n", outstr); | 20 | printf("%s\n", outstr); |
| 21 | } | 21 | } |
