aboutsummaryrefslogtreecommitdiff
path: root/test/050_compose/compose_tests.c
blob: 3dea055f85bd497aebec74f9b1724a78c6847490 (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
#include "../test.h"

cube_t compose(cube_t, cube_t);

void run(void) {
	char str[STRLENMAX];
	oriented_cube_t c1, c2, c3;

	fgets(str, STRLENMAX, stdin);
	c1 = readcube(str);
	fgets(str, STRLENMAX, stdin);
	c2 = readcube(str);

	c3 = (oriented_cube_t) {
		.cube = compose(c1.cube, c2.cube),
		.orientation = c1.orientation
	};

	if (iserror(c3)) {
		printf("Error composing cubes\n");
	} else if (!issolvable(c3)) {
		printf("Composed cube is not solvable\n");
	} else {
		writecube(c3, NISSY_SIZE_CUBE, str);
		printf("%s\n", str);
	}
}

Generated with cgit - Back to sebastiano.tronto.net