From 6cf7cd87a90a1314332aace1d25b9c0f230dc227 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 29 Jul 2025 16:57:21 +0200 Subject: added drslice coordinate --- test/133_coordata_drfinnoe/00_all.in | 0 test/133_coordata_drfinnoe/00_all.out | 1 + test/133_coordata_drfinnoe/coorddata_drfinnoe.c | 60 +++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 test/133_coordata_drfinnoe/00_all.in create mode 100644 test/133_coordata_drfinnoe/00_all.out create mode 100644 test/133_coordata_drfinnoe/coorddata_drfinnoe.c (limited to 'test/133_coordata_drfinnoe') 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 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 @@ +#include "../test.h" + +#define BOUND 100000 +#define TGROUP UINT64_C(4278190335) + +cube_t transform(cube_t, uint8_t); +uint64_t coordinate_drfinnoe_coord(cube_t, const unsigned char *); +cube_t coordinate_drfinnoe_cube(uint64_t, const unsigned char *); +size_t coordinate_drfinnoe_gendata(unsigned char *); + +void run(void) { + bool found; + uint64_t t; + char str[STRLENMAX]; + unsigned char *data; + size_t size; + cube_t cube; + oriented_cube_t oc; + uint64_t coord, coord2; + + size = coordinate_drfinnoe_gendata(NULL); + data = malloc(size); + coordinate_drfinnoe_gendata(data); + + for (coord = 0; coord < BOUND; coord++) { + cube = coordinate_drfinnoe_cube(coord, data); + + oc = (oriented_cube_t) { .cube = cube, .orientation = 0 }; + if (!isconsistent(oc)) { + printf("Error: invcoord of %" PRId64 + " is not consistent\n", coord); + goto cleanup; + } + + for (t = 0, found = false; t < 48; t++) { + if (!((UINT64_C(1) << t) & TGROUP)) + continue; + + coord2 = coordinate_drfinnoe_coord(transform(cube, t), data); + if (coord == coord2) { + found = true; + break; + } + } + + if (!found) { + oc = (oriented_cube_t){.cube = cube, .orientation = 0}; + printf("Error: invcoord of %" PRId64 " returns %" + PRId64 " with cube:\n", coord, coord2); + writecube(oc, STRLENMAX, str); + printf("%s\n", str); + goto cleanup; + } + } + + printf("All good\n"); + +cleanup: + free(data); +} -- cgit v1.3