aboutsummaryrefslogtreecommitdiff
path: root/test/082_invcoord_cp/invcoord_cp_tests.c
blob: 7d1e33f12a974061e71f22cd6df998fa37ea217c (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"

#define FACT_8 40320

uint64_t coord_cp(cube_t);
cube_t invcoord_cp(uint64_t);

void run(void) {
	oriented_cube_t cube;
	uint64_t coord, coord2;

	cube.orientation = 0;

	/* Test all possible values for CP coordinate */
	for (coord = 0; coord < FACT_8; coord++) {
		cube.cube = invcoord_cp(coord);

		if (!isconsistent(cube)) {
			printf("Not consistent\n");
			return;
		}

		coord2 = coord_cp(cube.cube);
		if (coord != coord2) {
			printf("Error: invcoord of %" PRIu64
			    " returns %" PRIu64 "\n", coord, coord2);
			return;
		}
	}

	printf("All good\n");
}

Generated with cgit - Back to sebastiano.tronto.net