aboutsummaryrefslogtreecommitdiff
path: root/test/033_inverse_move/inverse_move_tests.c
blob: 86bf7416e4ec55879fa61409cf4b538e62249c22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "../test.h"

extern char *movestr[];

int64_t readmoves(const char *, size_t n, size_t m,
    size_t *, size_t *, uint8_t *, uint8_t *);
uint8_t inverse_move(uint8_t);

void run(void) {
	size_t inv, nor;
	int64_t tot;
	uint8_t moves[2];

	char moves_string[STRLENMAX];

	fgets(moves_string, STRLENMAX, stdin);
	tot = readmoves(moves_string, 2, 0, &nor, &inv, moves, NULL);
	if (nor != 1 || tot != 1) {
		printf("Test error reading moves\n");
		return;
	}

fprintf(stderr, "Read move %" PRIu8 " = %s\n", moves[0], movestr[moves[0]]);

	printf("%s\n", movestr[inverse_move(moves[0])]);
}

Generated with cgit - Back to sebastiano.tronto.net