diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-09-08 18:28:30 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-09-08 18:28:30 +0200 |
| commit | 4d08bf731a099de2d174c73489636e1a12935aee (patch) | |
| tree | c751858cb6e33172c97a1123432f7c59d7d94d7e /test/03_inverse/inverse_tests.c | |
| parent | c5dfc897160bc9bbc6a91c77b5d58d421fd1cfe1 (diff) | |
| download | nissy-core-4d08bf731a099de2d174c73489636e1a12935aee.tar.gz nissy-core-4d08bf731a099de2d174c73489636e1a12935aee.zip | |
New implementation, moved old to experiments/
Diffstat (limited to 'test/03_inverse/inverse_tests.c')
| -rw-r--r-- | test/03_inverse/inverse_tests.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/03_inverse/inverse_tests.c b/test/03_inverse/inverse_tests.c new file mode 100644 index 0000000..5fab71a --- /dev/null +++ b/test/03_inverse/inverse_tests.c | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #include <stdbool.h> | ||
| 2 | #include <stdint.h> | ||
| 3 | #include <stdio.h> | ||
| 4 | |||
| 5 | #include "../../src/cube.h" | ||
| 6 | |||
| 7 | #define STRLENMAX 10000 | ||
| 8 | |||
| 9 | int main() { | ||
| 10 | char str[STRLENMAX]; | ||
| 11 | cube_t cube, inv; | ||
| 12 | |||
| 13 | fgets(str, STRLENMAX, stdin); | ||
| 14 | cube = readcube(str); | ||
| 15 | inv = inverse(cube); | ||
| 16 | |||
| 17 | if (iserror(inv)) { | ||
| 18 | printf("Error inverting cube\n"); | ||
| 19 | } else if (!isconsistent(inv)) { | ||
| 20 | printf("Inverted cube is inconsistent\n"); | ||
| 21 | } else { | ||
| 22 | writecube(inv, str); | ||
| 23 | printf("%s\n", str); | ||
| 24 | } | ||
| 25 | |||
| 26 | return 0; | ||
| 27 | } | ||
