aboutsummaryrefslogtreecommitdiff
path: root/test/091_getcube/getcube_tests.c
blob: 324cbeb813ea23c9bb7892c95b8ae8184cb3f662 (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
27
28
29
30
31
32
#include "../test.h"

cube_t getcube(uint64_t, uint64_t, uint64_t, uint64_t);

void run(void) {
	char str[STRLENMAX];
	oriented_cube_t cube;
	uint64_t ep, eo, cp, co;

	fgets(str, STRLENMAX, stdin);
	ep = atoll(str);
	fgets(str, STRLENMAX, stdin);
	eo = atoll(str);
	fgets(str, STRLENMAX, stdin);
	cp = atoll(str);
	fgets(str, STRLENMAX, stdin);
	co = atoll(str);

	cube = (oriented_cube_t) {
		.cube = getcube(ep, eo, cp, co),
		.orientation = 0
	};

	if (iserror(cube)) {
		printf("Error cube\n");
	} else if (!isconsistent(cube)) {
		printf("Inconsistent cube\n");
	} else {
		writecube(cube, NISSY_SIZE_CUBE, str);
		printf("%s\n", str);
	}
}

Generated with cgit - Back to sebastiano.tronto.net