diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-05 17:52:41 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-05 17:52:41 +0200 |
| commit | f85ac77efc0feeeab183e509a7baca1c507da3c5 (patch) | |
| tree | 7bc6cee6059b97e41dc58982ef8c9b4c624d9824 /test | |
| parent | 35237ef2621d8e5a2387426067c2ec9a75f03836 (diff) | |
| download | nissy-core-f85ac77efc0feeeab183e509a7baca1c507da3c5.tar.gz nissy-core-f85ac77efc0feeeab183e509a7baca1c507da3c5.zip | |
Added test for invermoves and small refactor
Diffstat (limited to 'test')
| -rw-r--r-- | test/032_invertmoves/001_onemove.in | 1 | ||||
| -rw-r--r-- | test/032_invertmoves/001_onemove.out | 1 | ||||
| -rw-r--r-- | test/032_invertmoves/002_20moves.in | 1 | ||||
| -rw-r--r-- | test/032_invertmoves/002_20moves.out | 1 | ||||
| -rw-r--r-- | test/032_invertmoves/invertmoves_tests.c | 21 |
5 files changed, 25 insertions, 0 deletions
diff --git a/test/032_invertmoves/001_onemove.in b/test/032_invertmoves/001_onemove.in new file mode 100644 index 0000000..cf84443 --- /dev/null +++ b/test/032_invertmoves/001_onemove.in | |||
| @@ -0,0 +1 @@ | |||
| F | |||
diff --git a/test/032_invertmoves/001_onemove.out b/test/032_invertmoves/001_onemove.out new file mode 100644 index 0000000..6ab6e07 --- /dev/null +++ b/test/032_invertmoves/001_onemove.out | |||
| @@ -0,0 +1 @@ | |||
| F' | |||
diff --git a/test/032_invertmoves/002_20moves.in b/test/032_invertmoves/002_20moves.in new file mode 100644 index 0000000..052ed94 --- /dev/null +++ b/test/032_invertmoves/002_20moves.in | |||
| @@ -0,0 +1 @@ | |||
| B2 R D2 B2 R D2 F2 L2 F2 R' F2 D' L D2 L U2 L B2 F2 U | |||
diff --git a/test/032_invertmoves/002_20moves.out b/test/032_invertmoves/002_20moves.out new file mode 100644 index 0000000..bc6a079 --- /dev/null +++ b/test/032_invertmoves/002_20moves.out | |||
| @@ -0,0 +1 @@ | |||
| U' F2 B2 L' U2 L' D2 L' D F2 R F2 L2 F2 D2 R' B2 D2 R' B2 | |||
diff --git a/test/032_invertmoves/invertmoves_tests.c b/test/032_invertmoves/invertmoves_tests.c new file mode 100644 index 0000000..acb2adc --- /dev/null +++ b/test/032_invertmoves/invertmoves_tests.c | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #include "../test.h" | ||
| 2 | |||
| 3 | #define MAXMOVES 20 | ||
| 4 | |||
| 5 | int64_t readmoves(const char *, int, uint8_t *); | ||
| 6 | void writemoves(uint8_t *, int, char *); | ||
| 7 | void invertmoves(uint8_t *, uint8_t, uint8_t *); | ||
| 8 | |||
| 9 | void run(void) { | ||
| 10 | char movestr[STRLENMAX], outstr[STRLENMAX]; | ||
| 11 | uint8_t moves[MAXMOVES], ret[MAXMOVES]; | ||
| 12 | int c; | ||
| 13 | |||
| 14 | fgets(movestr, STRLENMAX, stdin); | ||
| 15 | c = readmoves(movestr, MAXMOVES, moves); | ||
| 16 | |||
| 17 | invertmoves(moves, c, ret); | ||
| 18 | writemoves(ret, c, outstr); | ||
| 19 | |||
| 20 | printf("%s\n", outstr); | ||
| 21 | } | ||
