aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/133_coordata_drfinnoe/00_all.in0
-rw-r--r--test/133_coordata_drfinnoe/00_all.out1
-rw-r--r--test/133_coordata_drfinnoe/coorddata_drfinnoe.c60
3 files changed, 61 insertions, 0 deletions
diff --git a/test/133_coordata_drfinnoe/00_all.in b/test/133_coordata_drfinnoe/00_all.in
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/133_coordata_drfinnoe/00_all.in
diff --git a/test/133_coordata_drfinnoe/00_all.out b/test/133_coordata_drfinnoe/00_all.out
new file mode 100644
index 0000000..d6109db
--- /dev/null
+++ b/test/133_coordata_drfinnoe/00_all.out
@@ -0,0 +1 @@
All good
diff --git a/test/133_coordata_drfinnoe/coorddata_drfinnoe.c b/test/133_coordata_drfinnoe/coorddata_drfinnoe.c
new file mode 100644
index 0000000..11ae9f7
--- /dev/null
+++ b/test/133_coordata_drfinnoe/coorddata_drfinnoe.c
@@ -0,0 +1,60 @@
1#include "../test.h"
2
3#define BOUND 100000
4#define TGROUP UINT64_C(4278190335)
5
6cube_t transform(cube_t, uint8_t);
7uint64_t coordinate_drfinnoe_coord(cube_t, const unsigned char *);
8cube_t coordinate_drfinnoe_cube(uint64_t, const unsigned char *);
9size_t coordinate_drfinnoe_gendata(unsigned char *);
10
11void run(void) {
12 bool found;
13 uint64_t t;
14 char str[STRLENMAX];
15 unsigned char *data;
16 size_t size;
17 cube_t cube;
18 oriented_cube_t oc;
19 uint64_t coord, coord2;
20
21 size = coordinate_drfinnoe_gendata(NULL);
22 data = malloc(size);
23 coordinate_drfinnoe_gendata(data);
24
25 for (coord = 0; coord < BOUND; coord++) {
26 cube = coordinate_drfinnoe_cube(coord, data);
27
28 oc = (oriented_cube_t) { .cube = cube, .orientation = 0 };
29 if (!isconsistent(oc)) {
30 printf("Error: invcoord of %" PRId64
31 " is not consistent\n", coord);
32 goto cleanup;
33 }
34
35 for (t = 0, found = false; t < 48; t++) {
36 if (!((UINT64_C(1) << t) & TGROUP))
37 continue;
38
39 coord2 = coordinate_drfinnoe_coord(transform(cube, t), data);
40 if (coord == coord2) {
41 found = true;
42 break;
43 }
44 }
45
46 if (!found) {
47 oc = (oriented_cube_t){.cube = cube, .orientation = 0};
48 printf("Error: invcoord of %" PRId64 " returns %"
49 PRId64 " with cube:\n", coord, coord2);
50 writecube(oc, STRLENMAX, str);
51 printf("%s\n", str);
52 goto cleanup;
53 }
54 }
55
56 printf("All good\n");
57
58cleanup:
59 free(data);
60}

Generated with cgit - Back to sebastiano.tronto.net