diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/121_coorddata_dr/coorddata_dr.c | 1 | ||||
| -rw-r--r-- | test/122_coorddata_dreo/00_all.in | 0 | ||||
| -rw-r--r-- | test/122_coorddata_dreo/00_all.out | 1 | ||||
| -rw-r--r-- | test/122_coorddata_dreo/coorddata_dreo.c | 58 |
4 files changed, 59 insertions, 1 deletions
diff --git a/test/121_coorddata_dr/coorddata_dr.c b/test/121_coorddata_dr/coorddata_dr.c index 92e7c2a..707d605 100644 --- a/test/121_coorddata_dr/coorddata_dr.c +++ b/test/121_coorddata_dr/coorddata_dr.c | |||
| @@ -22,7 +22,6 @@ void run(void) { | |||
| 22 | data = malloc(size); | 22 | data = malloc(size); |
| 23 | coordinate_dr_gendata(data); | 23 | coordinate_dr_gendata(data); |
| 24 | 24 | ||
| 25 | /* Test all possible values for CO coordinate */ | ||
| 26 | for (coord = 0; coord < BOUND; coord++) { | 25 | for (coord = 0; coord < BOUND; coord++) { |
| 27 | cube = coordinate_dr_cube(coord, data); | 26 | cube = coordinate_dr_cube(coord, data); |
| 28 | 27 | ||
diff --git a/test/122_coorddata_dreo/00_all.in b/test/122_coorddata_dreo/00_all.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/122_coorddata_dreo/00_all.in | |||
diff --git a/test/122_coorddata_dreo/00_all.out b/test/122_coorddata_dreo/00_all.out new file mode 100644 index 0000000..d6109db --- /dev/null +++ b/test/122_coorddata_dreo/00_all.out | |||
| @@ -0,0 +1 @@ | |||
| All good | |||
diff --git a/test/122_coorddata_dreo/coorddata_dreo.c b/test/122_coorddata_dreo/coorddata_dreo.c new file mode 100644 index 0000000..0c75c5e --- /dev/null +++ b/test/122_coorddata_dreo/coorddata_dreo.c | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | #define POW_3_7 2187 | ||
| 4 | #define BOUND 45 * POW_3_7 | ||
| 5 | #define TGROUP UINT64_C(4278190335) | ||
| 6 | |||
| 7 | cube_t transform(cube_t, uint8_t); | ||
| 8 | uint64_t coordinate_dreo_coord(cube_t, const void *); | ||
| 9 | cube_t coordinate_dreo_cube(uint64_t, const void *); | ||
| 10 | uint64_t coordinate_dreo_gendata(void *); | ||
| 11 | |||
| 12 | void run(void) { | ||
| 13 | bool found; | ||
| 14 | uint64_t t; | ||
| 15 | char str[STRLENMAX]; | ||
| 16 | void *data; | ||
| 17 | size_t size; | ||
| 18 | cube_t cube; | ||
| 19 | uint64_t coord, coord2; | ||
| 20 | |||
| 21 | size = coordinate_dreo_gendata(NULL); | ||
| 22 | data = malloc(size); | ||
| 23 | coordinate_dreo_gendata(data); | ||
| 24 | |||
| 25 | for (coord = 0; coord < BOUND; coord++) { | ||
| 26 | cube = coordinate_dreo_cube(coord, data); | ||
| 27 | |||
| 28 | if (!isconsistent(cube)) { | ||
| 29 | printf("Error: invcoord of %" PRId64 | ||
| 30 | " is not consistent\n", coord); | ||
| 31 | goto cleanup; | ||
| 32 | } | ||
| 33 | |||
| 34 | for (t = 0, found = false; t < 48; t++) { | ||
| 35 | if (!((UINT64_C(1) << t) & TGROUP)) | ||
| 36 | continue; | ||
| 37 | |||
| 38 | coord2 = coordinate_dreo_coord(transform(cube, t), data); | ||
| 39 | if (coord == coord2) { | ||
| 40 | found = true; | ||
| 41 | break; | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | if (!found) { | ||
| 46 | printf("Error: invcoord of %" PRId64 " returns %" | ||
| 47 | PRId64 " with cube:\n", coord, coord2); | ||
| 48 | writecube("H48", cube, STRLENMAX, str); | ||
| 49 | printf("%s\n", str); | ||
| 50 | goto cleanup; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | printf("All good\n"); | ||
| 55 | |||
| 56 | cleanup: | ||
| 57 | free(data); | ||
| 58 | } | ||
