aboutsummaryrefslogtreecommitdiff
path: root/test/075_set_eo/set_eo_tests.c
blob: ef2156d41d1c71d3e775c7f63c35f1d0621e7af9 (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
33
34
35
36
#include "../test.h"

int64_t coord_eo(cube_t);
void set_eo(cube_t *, int64_t);
void pieces(cube_t *, uint8_t [static 8], uint8_t [static 12]);

void run(void) {
	char str[STRLENMAX];
	oriented_cube_t cube;
	uint8_t edge[12], corner[8];
	int64_t eo;

	fgets(str, STRLENMAX, stdin);
	cube = readcube(str);
	fgets(str, STRLENMAX, stdin);
	eo = atoi(str);

	set_eo(&cube.cube, eo);

	if (iserror(cube)) {
		printf("Error setting EO\n");
	} else if (!isconsistent(cube)) {
		pieces(&cube.cube, corner, edge);
		fprintf(stderr, "edges: ");
		for (int i = 0; i < 12; i++)
			fprintf(stderr, "%d ", edge[i]);
		fprintf(stderr, "\n");
		for (int i = 0; i < 8; i++)
			fprintf(stderr, "%d ", corner[i]);
		fprintf(stderr, "\n");
		printf("Setting EO resulted in inconsistent cube\n");
	} else {
		writecube(cube, NISSY_SIZE_CUBE, str);
		printf("%s\n", str);
	}
}

Generated with cgit - Back to sebastiano.tronto.net