diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-17 09:00:38 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-17 09:00:38 +0200 |
| commit | de6fa5b9122758f261675aa31fe3cb6e7bab92e5 (patch) | |
| tree | 6545109b6197596440ab7ec19f92ed235f93812c /test | |
| parent | 270e5b0444f67781856bf80db51650af9cb89b0c (diff) | |
| download | nissy-core-de6fa5b9122758f261675aa31fe3cb6e7bab92e5.tar.gz nissy-core-de6fa5b9122758f261675aa31fe3cb6e7bab92e5.zip | |
Added unit tests for coord cp and epud
Diffstat (limited to 'test')
| -rw-r--r-- | test/080_invcoord_cp/00_all.in | 0 | ||||
| -rw-r--r-- | test/080_invcoord_cp/00_all.out | 1 | ||||
| -rw-r--r-- | test/080_invcoord_cp/invcoord_cp_tests.c | 32 | ||||
| -rw-r--r-- | test/081_invcoord_epud/00_all.in | 0 | ||||
| -rw-r--r-- | test/081_invcoord_epud/00_all.out | 1 | ||||
| -rw-r--r-- | test/081_invcoord_epud/invcoord_epud_tests.c | 32 |
6 files changed, 66 insertions, 0 deletions
diff --git a/test/080_invcoord_cp/00_all.in b/test/080_invcoord_cp/00_all.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/080_invcoord_cp/00_all.in | |||
diff --git a/test/080_invcoord_cp/00_all.out b/test/080_invcoord_cp/00_all.out new file mode 100644 index 0000000..d6109db --- /dev/null +++ b/test/080_invcoord_cp/00_all.out | |||
| @@ -0,0 +1 @@ | |||
| All good | |||
diff --git a/test/080_invcoord_cp/invcoord_cp_tests.c b/test/080_invcoord_cp/invcoord_cp_tests.c new file mode 100644 index 0000000..2eb9ae2 --- /dev/null +++ b/test/080_invcoord_cp/invcoord_cp_tests.c | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | #define FACT_8 40320 | ||
| 4 | |||
| 5 | int64_t coord_cp(cube_t); | ||
| 6 | cube_t invcoord_cp(int64_t); | ||
| 7 | |||
| 8 | void run(void) { | ||
| 9 | oriented_cube_t cube; | ||
| 10 | int64_t coord, coord2; | ||
| 11 | |||
| 12 | cube.orientation = 0; | ||
| 13 | |||
| 14 | /* Test all possible values for CP coordinate */ | ||
| 15 | for (coord = 0; coord < FACT_8; coord++) { | ||
| 16 | cube.cube = invcoord_cp(coord); | ||
| 17 | |||
| 18 | if (!isconsistent(cube)) { | ||
| 19 | printf("Not consistent\n"); | ||
| 20 | return; | ||
| 21 | } | ||
| 22 | |||
| 23 | coord2 = coord_cp(cube.cube); | ||
| 24 | if (coord != coord2) { | ||
| 25 | printf("Error: invcoord of %" PRId64 | ||
| 26 | " returns %" PRId64 "\n", coord, coord2); | ||
| 27 | return; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | printf("All good\n"); | ||
| 32 | } | ||
diff --git a/test/081_invcoord_epud/00_all.in b/test/081_invcoord_epud/00_all.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/081_invcoord_epud/00_all.in | |||
diff --git a/test/081_invcoord_epud/00_all.out b/test/081_invcoord_epud/00_all.out new file mode 100644 index 0000000..d6109db --- /dev/null +++ b/test/081_invcoord_epud/00_all.out | |||
| @@ -0,0 +1 @@ | |||
| All good | |||
diff --git a/test/081_invcoord_epud/invcoord_epud_tests.c b/test/081_invcoord_epud/invcoord_epud_tests.c new file mode 100644 index 0000000..bf444cc --- /dev/null +++ b/test/081_invcoord_epud/invcoord_epud_tests.c | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | #define FACT_8 40320 | ||
| 4 | |||
| 5 | int64_t coord_epud(cube_t); | ||
| 6 | cube_t invcoord_epud(int64_t); | ||
| 7 | |||
| 8 | void run(void) { | ||
| 9 | oriented_cube_t cube; | ||
| 10 | int64_t coord, coord2; | ||
| 11 | |||
| 12 | cube.orientation = 0; | ||
| 13 | |||
| 14 | /* Test all possible values for CP coordinate */ | ||
| 15 | for (coord = 0; coord < FACT_8; coord++) { | ||
| 16 | cube.cube = invcoord_epud(coord); | ||
| 17 | |||
| 18 | if (!isconsistent(cube)) { | ||
| 19 | printf("Not consistent\n"); | ||
| 20 | return; | ||
| 21 | } | ||
| 22 | |||
| 23 | coord2 = coord_epud(cube.cube); | ||
| 24 | if (coord != coord2) { | ||
| 25 | printf("Error: invcoord of %" PRId64 | ||
| 26 | " returns %" PRId64 "\n", coord, coord2); | ||
| 27 | return; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | printf("All good\n"); | ||
| 32 | } | ||
