aboutsummaryrefslogtreecommitdiff
path: root/test/io/io_tests.c
blob: 1ef99d028c6dd56045846f02d9cf9f20ae0efbec (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
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

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

#define STRLENMAX 10000

int main() {
	char *c, str[STRLENMAX];
	cube_t cube;

	for (c = str; (*c = getchar()) != EOF; c++) ;
	*c = '\0';

	cube = readcube(str);

	if (cube.e == errorcube.e && cube.c == errorcube.c) {
		printf("Error reading cube\n");
	} else if (!isconsistent(cube)) {
		printf("Cube is inconsistent\n");
	} else {
		writecube(cube, str);
		printf("%s\n", str);
	}

	return 0;
}

Generated with cgit - Back to sebastiano.tronto.net