aboutsummaryrefslogtreecommitdiff
path: root/test/050_transform/transform_tests.c
blob: e1990352cc26dabe9eaea44a2e1b324d474e7fb6 (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
37
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

#include "../../cube.h"

#define STRLENMAX 10000

int main() {
	char str[STRLENMAX];
	trans_t t;
	cube_t cube;

	fgets(str, STRLENMAX, stdin);
	t = readtrans(str);

	if (t >= 48) {
		printf("Error reading trans\n");
		return 1;
	}

	fgets(str, STRLENMAX, stdin);
	cube = readcube(H48, str);

	cube = transform(cube, t);

	if (iserror(cube)) {
		printf("Error transforming cube\n");
	} else if (!issolvable(cube)) {
		printf("Transformed cube is not solvable\n");
	} else {
		writecube(H48, cube, str);
		printf("%s\n", str);
	}

	return 0;
}

Generated with cgit - Back to sebastiano.tronto.net