aboutsummaryrefslogtreecommitdiff
path: root/test/032_invertmoves/invertmoves_tests.c
blob: d791524bc946789d86d252bd8689354361d0b80f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "../test.h"

#define MAXMOVES 20

int64_t readmoves(const char *, int, uint8_t *);
void writemoves(size_t n, uint8_t [n], size_t m, char [m]);
void invertmoves(size_t n, const uint8_t [n], uint8_t [n]);

void run(void) {
	char movestr[STRLENMAX], outstr[STRLENMAX];
	uint8_t moves[MAXMOVES], ret[MAXMOVES];
	int c;

	fgets(movestr, STRLENMAX, stdin);
	c = readmoves(movestr, MAXMOVES, moves);

	invertmoves(c, moves, ret);
	writemoves(c, ret, STRLENMAX, outstr);

	printf("%s\n", outstr);
}

Generated with cgit - Back to sebastiano.tronto.net