aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-11-10 14:44:48 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-11-10 14:44:48 +0100
commitfb9ae9e41eaf01b3651395fdd450ac1a4743e592 (patch)
tree8fb29e9b62d40d6407f082f55a7164775154bf78 /test
parent04c3ee1f5acac47650be8d0ffbf90e238df0d12b (diff)
downloadnissy-core-fb9ae9e41eaf01b3651395fdd450ac1a4743e592.tar.gz
nissy-core-fb9ae9e41eaf01b3651395fdd450ac1a4743e592.zip
Big changes to the interface
Diffstat (limited to 'test')
-rw-r--r--test/010_io_H48_read_write/io_H48_tests.c4
-rw-r--r--test/011_io_SRC_write/01_solved.out4
-rw-r--r--test/011_io_SRC_write/02_scrambled.out4
-rw-r--r--test/011_io_SRC_write/io_SRC_tests.c4
-rw-r--r--test/012_io_AVX_write/io_AVX_tests.c4
-rw-r--r--test/020_move/move_tests.c24
-rw-r--r--test/030_inverse_cube/inverse_tests.c4
-rw-r--r--test/040_compose/compose_tests.c6
-rw-r--r--test/050_transform/transform_tests.c22
-rw-r--r--test/061_coord_eo/coord_eo_tests.c2
10 files changed, 30 insertions, 48 deletions
diff --git a/test/010_io_H48_read_write/io_H48_tests.c b/test/010_io_H48_read_write/io_H48_tests.c
index 758124e..70d1a91 100644
--- a/test/010_io_H48_read_write/io_H48_tests.c
+++ b/test/010_io_H48_read_write/io_H48_tests.c
@@ -17,14 +17,14 @@ int main() {
17 for (c = str; (*c = getchar()) != EOF; c++) ; 17 for (c = str; (*c = getchar()) != EOF; c++) ;
18 *c = '\0'; 18 *c = '\0';
19 19
20 cube = readcube(H48, str); 20 cube = readcube("H48", str);
21 21
22 if (iserror(cube)) { 22 if (iserror(cube)) {
23 printf("Error reading cube\n"); 23 printf("Error reading cube\n");
24 } else if (!issolvable(cube)) { 24 } else if (!issolvable(cube)) {
25 printf("Cube is not solvable\n"); 25 printf("Cube is not solvable\n");
26 } else { 26 } else {
27 writecube(H48, cube, str); 27 writecube("H48", cube, str);
28 printf("%s\n", str); 28 printf("%s\n", str);
29 } 29 }
30 30
diff --git a/test/011_io_SRC_write/01_solved.out b/test/011_io_SRC_write/01_solved.out
index 3853027..3c21bcc 100644
--- a/test/011_io_SRC_write/01_solved.out
+++ b/test/011_io_SRC_write/01_solved.out
@@ -1,4 +1,4 @@
1{ 1{
2 .c = {0, 1, 2, 3, 4, 5, 6, 7}, 2 .corner = {0, 1, 2, 3, 4, 5, 6, 7},
3 .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} 3 .edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
4} 4}
diff --git a/test/011_io_SRC_write/02_scrambled.out b/test/011_io_SRC_write/02_scrambled.out
index 44d3d04..b899386 100644
--- a/test/011_io_SRC_write/02_scrambled.out
+++ b/test/011_io_SRC_write/02_scrambled.out
@@ -1,4 +1,4 @@
1{ 1{
2 .c = {38, 32, 37, 68, 67, 2, 71, 1}, 2 .corner = {38, 32, 37, 68, 67, 2, 71, 1},
3 .e = {9, 2, 17, 8, 4, 3, 0, 27, 21, 26, 6, 7} 3 .edge = {9, 2, 17, 8, 4, 3, 0, 27, 21, 26, 6, 7}
4} 4}
diff --git a/test/011_io_SRC_write/io_SRC_tests.c b/test/011_io_SRC_write/io_SRC_tests.c
index dd1bb7c..c2d10f6 100644
--- a/test/011_io_SRC_write/io_SRC_tests.c
+++ b/test/011_io_SRC_write/io_SRC_tests.c
@@ -17,14 +17,14 @@ int main() {
17 for (c = str; (*c = getchar()) != EOF; c++) ; 17 for (c = str; (*c = getchar()) != EOF; c++) ;
18 *c = '\0'; 18 *c = '\0';
19 19
20 cube = readcube(H48, str); 20 cube = readcube("H48", str);
21 21
22 if (iserror(cube)) { 22 if (iserror(cube)) {
23 printf("Error reading cube\n"); 23 printf("Error reading cube\n");
24 } else if (!issolvable(cube)) { 24 } else if (!issolvable(cube)) {
25 printf("Cube is not solvable\n"); 25 printf("Cube is not solvable\n");
26 } else { 26 } else {
27 writecube(SRC, cube, str); 27 writecube("SRC", cube, str);
28 printf("%s\n", str); 28 printf("%s\n", str);
29 } 29 }
30 30
diff --git a/test/012_io_AVX_write/io_AVX_tests.c b/test/012_io_AVX_write/io_AVX_tests.c
index e2fa3e4..cbe6ef0 100644
--- a/test/012_io_AVX_write/io_AVX_tests.c
+++ b/test/012_io_AVX_write/io_AVX_tests.c
@@ -17,14 +17,14 @@ int main() {
17 for (c = str; (*c = getchar()) != EOF; c++) ; 17 for (c = str; (*c = getchar()) != EOF; c++) ;
18 *c = '\0'; 18 *c = '\0';
19 19
20 cube = readcube(H48, str); 20 cube = readcube("H48", str);
21 21
22 if (iserror(cube)) { 22 if (iserror(cube)) {
23 printf("Error reading cube\n"); 23 printf("Error reading cube\n");
24 } else if (!issolvable(cube)) { 24 } else if (!issolvable(cube)) {
25 printf("Cube is not solvable\n"); 25 printf("Cube is not solvable\n");
26 } else { 26 } else {
27 writecube(AVX, cube, str); 27 writecube("AVX", cube, str);
28 printf("%s\n", str); 28 printf("%s\n", str);
29 } 29 }
30 30
diff --git a/test/020_move/move_tests.c b/test/020_move/move_tests.c
index 4a010f1..9e414cc 100644
--- a/test/020_move/move_tests.c
+++ b/test/020_move/move_tests.c
@@ -12,32 +12,22 @@
12#define MOVESMAX 1000 12#define MOVESMAX 1000
13 13
14int main() { 14int main() {
15 char str[STRLENMAX]; 15 char movestr[STRLENMAX], cubestr[STRLENMAX];
16 int i, n;
17 move_t moves[MOVESMAX];
18 cube_t cube; 16 cube_t cube;
19 17
20 fgets(str, STRLENMAX, stdin); 18 fgets(movestr, STRLENMAX, stdin);
21 n = readmoves(str, moves); 19 fgets(cubestr, STRLENMAX, stdin);
20 cube = readcube("H48", cubestr);
22 21
23 if (n == -1) { 22 cube = applymoves(cube, movestr);
24 printf("Error reading moves\n");
25 return 1;
26 }
27
28 fgets(str, STRLENMAX, stdin);
29 cube = readcube(H48, str);
30
31 for (i = 0; i < n; i++)
32 cube = move(cube, moves[i]);
33 23
34 if (iserror(cube)) { 24 if (iserror(cube)) {
35 printf("Error moving cube\n"); 25 printf("Error moving cube\n");
36 } else if (!issolvable(cube)) { 26 } else if (!issolvable(cube)) {
37 printf("Moved cube is not solvable\n"); 27 printf("Moved cube is not solvable\n");
38 } else { 28 } else {
39 writecube(H48, cube, str); 29 writecube("H48", cube, cubestr);
40 printf("%s\n", str); 30 printf("%s\n", cubestr);
41 } 31 }
42 32
43 return 0; 33 return 0;
diff --git a/test/030_inverse_cube/inverse_tests.c b/test/030_inverse_cube/inverse_tests.c
index b07ab87..9151e42 100644
--- a/test/030_inverse_cube/inverse_tests.c
+++ b/test/030_inverse_cube/inverse_tests.c
@@ -15,7 +15,7 @@ int main() {
15 cube_t cube, inv; 15 cube_t cube, inv;
16 16
17 fgets(str, STRLENMAX, stdin); 17 fgets(str, STRLENMAX, stdin);
18 cube = readcube(H48, str); 18 cube = readcube("H48", str);
19 inv = inverse(cube); 19 inv = inverse(cube);
20 20
21 if (iserror(inv)) { 21 if (iserror(inv)) {
@@ -23,7 +23,7 @@ int main() {
23 } else if (!issolvable(inv)) { 23 } else if (!issolvable(inv)) {
24 printf("Inverted cube is not solvable\n"); 24 printf("Inverted cube is not solvable\n");
25 } else { 25 } else {
26 writecube(H48, inv, str); 26 writecube("H48", inv, str);
27 printf("%s\n", str); 27 printf("%s\n", str);
28 } 28 }
29 29
diff --git a/test/040_compose/compose_tests.c b/test/040_compose/compose_tests.c
index 62f636e..c9c11af 100644
--- a/test/040_compose/compose_tests.c
+++ b/test/040_compose/compose_tests.c
@@ -15,9 +15,9 @@ int main() {
15 cube_t c1, c2, c3; 15 cube_t c1, c2, c3;
16 16
17 fgets(str, STRLENMAX, stdin); 17 fgets(str, STRLENMAX, stdin);
18 c1 = readcube(H48, str); 18 c1 = readcube("H48", str);
19 fgets(str, STRLENMAX, stdin); 19 fgets(str, STRLENMAX, stdin);
20 c2 = readcube(H48, str); 20 c2 = readcube("H48", str);
21 21
22 c3 = compose(c1, c2); 22 c3 = compose(c1, c2);
23 23
@@ -26,7 +26,7 @@ int main() {
26 } else if (!issolvable(c3)) { 26 } else if (!issolvable(c3)) {
27 printf("Composed cube is not solvable\n"); 27 printf("Composed cube is not solvable\n");
28 } else { 28 } else {
29 writecube(H48, c3, str); 29 writecube("H48", c3, str);
30 printf("%s\n", str); 30 printf("%s\n", str);
31 } 31 }
32 32
diff --git a/test/050_transform/transform_tests.c b/test/050_transform/transform_tests.c
index 30d62da..e22a4a1 100644
--- a/test/050_transform/transform_tests.c
+++ b/test/050_transform/transform_tests.c
@@ -11,30 +11,22 @@
11#define STRLENMAX 10000 11#define STRLENMAX 10000
12 12
13int main() { 13int main() {
14 char str[STRLENMAX]; 14 char cubestr[STRLENMAX], transtr[STRLENMAX];
15 trans_t t;
16 cube_t cube; 15 cube_t cube;
17 16
18 fgets(str, STRLENMAX, stdin); 17 fgets(transtr, STRLENMAX, stdin);
19 t = readtrans(str); 18 fgets(cubestr, STRLENMAX, stdin);
19 cube = readcube("H48", cubestr);
20 20
21 if (t >= 48) { 21 cube = applytrans(cube, transtr);
22 printf("Error reading trans\n");
23 return 1;
24 }
25
26 fgets(str, STRLENMAX, stdin);
27 cube = readcube(H48, str);
28
29 cube = transform(cube, t);
30 22
31 if (iserror(cube)) { 23 if (iserror(cube)) {
32 printf("Error transforming cube\n"); 24 printf("Error transforming cube\n");
33 } else if (!issolvable(cube)) { 25 } else if (!issolvable(cube)) {
34 printf("Transformed cube is not solvable\n"); 26 printf("Transformed cube is not solvable\n");
35 } else { 27 } else {
36 writecube(H48, cube, str); 28 writecube("H48", cube, cubestr);
37 printf("%s\n", str); 29 printf("%s\n", cubestr);
38 } 30 }
39 31
40 return 0; 32 return 0;
diff --git a/test/061_coord_eo/coord_eo_tests.c b/test/061_coord_eo/coord_eo_tests.c
index 65119ef..30989e8 100644
--- a/test/061_coord_eo/coord_eo_tests.c
+++ b/test/061_coord_eo/coord_eo_tests.c
@@ -16,7 +16,7 @@ int main() {
16 int16_t result; 16 int16_t result;
17 17
18 fgets(str, STRLENMAX, stdin); 18 fgets(str, STRLENMAX, stdin);
19 cube = readcube(H48, str); 19 cube = readcube("H48", str);
20 20
21 result = coord_eo(cube); 21 result = coord_eo(cube);
22 22

Generated with cgit - Back to sebastiano.tronto.net