diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-17 08:54:44 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-17 08:54:44 +0200 |
| commit | 270e5b0444f67781856bf80db51650af9cb89b0c (patch) | |
| tree | 1f895ca8fdbf256dcdf550dd0a28ca99993efc08 /test/120_coord_invcoord_h48 | |
| parent | 2d0ab15ac1f81c76cb6bb31bbdad3d2ee339e062 (diff) | |
| download | nissy-core-270e5b0444f67781856bf80db51650af9cb89b0c.tar.gz nissy-core-270e5b0444f67781856bf80db51650af9cb89b0c.zip | |
Renamed tests to make space for more coordinate tests
Diffstat (limited to 'test/120_coord_invcoord_h48')
| -rw-r--r-- | test/120_coord_invcoord_h48/00_all.in | 8 | ||||
| -rw-r--r-- | test/120_coord_invcoord_h48/00_all.out | 8 | ||||
| -rw-r--r-- | test/120_coord_invcoord_h48/coord_invcoord_h48_tests.c | 37 |
3 files changed, 53 insertions, 0 deletions
diff --git a/test/120_coord_invcoord_h48/00_all.in b/test/120_coord_invcoord_h48/00_all.in new file mode 100644 index 0000000..0480485 --- /dev/null +++ b/test/120_coord_invcoord_h48/00_all.in | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | ABCDEFGH=BDCAEFGHIJKL=A | ||
| 2 | ABCDEFGH=ABCDEFGHIJKL=A | ||
| 3 | BACDFEGH=BACDFEGHIJKL=A | ||
| 4 | CILVXGMR=FKbGIDSXBJAU=A | ||
| 5 | WBCVEILH=ABCDIFGLHJKE=A | ||
| 6 | MBODSFQH=ZBCYEFGHQTKL=A | ||
| 7 | ABCDEFGH=ILKJEFGHDABC=A | ||
| 8 | ABCDEFGH=EFGHBADCIJKL=A | ||
diff --git a/test/120_coord_invcoord_h48/00_all.out b/test/120_coord_invcoord_h48/00_all.out new file mode 100644 index 0000000..e84be4b --- /dev/null +++ b/test/120_coord_invcoord_h48/00_all.out | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | 1 ok | ||
| 2 | 2 ok | ||
| 3 | 3 ok | ||
| 4 | 4 ok | ||
| 5 | 5 ok | ||
| 6 | 6 ok | ||
| 7 | 7 ok | ||
| 8 | 8 ok | ||
diff --git a/test/120_coord_invcoord_h48/coord_invcoord_h48_tests.c b/test/120_coord_invcoord_h48/coord_invcoord_h48_tests.c new file mode 100644 index 0000000..0333f27 --- /dev/null +++ b/test/120_coord_invcoord_h48/coord_invcoord_h48_tests.c | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); | ||
| 4 | int64_t coord_h48(cube_t, const uint32_t *, uint8_t); | ||
| 5 | cube_t invcoord_h48(int64_t, const cube_t *, uint8_t); | ||
| 6 | cube_t transform(cube_t, uint8_t); | ||
| 7 | |||
| 8 | void run(void) { | ||
| 9 | char str[STRLENMAX]; | ||
| 10 | int i; | ||
| 11 | bool found; | ||
| 12 | uint8_t h, t; | ||
| 13 | unsigned char buf[2000000]; | ||
| 14 | uint32_t *cocsepdata; | ||
| 15 | uint64_t selfsim[COCSEP_CLASSES]; | ||
| 16 | int64_t c, cc; | ||
| 17 | oriented_cube_t cube; | ||
| 18 | cube_t invc, rep[COCSEP_CLASSES]; | ||
| 19 | |||
| 20 | gendata_cocsep(buf, selfsim, rep); | ||
| 21 | cocsepdata = (uint32_t *)(buf + INFOSIZE); | ||
| 22 | |||
| 23 | i = 1; | ||
| 24 | h = 11; | ||
| 25 | while (fgets(str, STRLENMAX, stdin) != NULL) { | ||
| 26 | cube = readcube(str); | ||
| 27 | c = coord_h48(cube.cube, cocsepdata, h); | ||
| 28 | invc = invcoord_h48(c, rep, h); | ||
| 29 | for (t = 0, found = false; t < 48; t++) { | ||
| 30 | cube.cube = transform(invc, t); | ||
| 31 | cc = coord_h48(cube.cube, cocsepdata, h); | ||
| 32 | found = found || cc == c; | ||
| 33 | } | ||
| 34 | printf("%d %s\n", i, found ? "ok" : "ERROR"); | ||
| 35 | i++; | ||
| 36 | } | ||
| 37 | } | ||
