aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-04-06 14:48:54 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2026-04-06 14:48:54 +0100
commita1ad0db8a6d829eddf1478cee44ae976bbcd325f (patch)
treea6e62232e05e7779034c5f9d1bf743b6f1c198e3 /test
parent0d4fa9ebbfcadfff4baf8fc3cd32a63dcfd7dd43 (diff)
downloadnissy-core-c-portability.tar.gz
nissy-core-c-portability.zip
Fix integer conversions in code, tests and some toolsc-portability
Diffstat (limited to 'test')
-rw-r--r--test/010_math_permtoindex/permtoindex_tests.c2
-rw-r--r--test/012_math_permsign/permsign_tests.c2
-rw-r--r--test/013_math_digitstosumzero/digitstosumzero_tests.c4
-rw-r--r--test/014_math_sumzerotodigits/sumzerotodigits.c4
-rw-r--r--test/090_allowedmoves/allowedmoves_tests.c4
-rw-r--r--test/114_cocsep_ttrep/cocsep_ttrep_tests.c4
-rw-r--r--test/122_gendata_h48short/gendata_h48short_tests.c2
-rw-r--r--test/131_coorddata_dr/coorddata_dr.c6
-rw-r--r--test/132_coorddata_dreo/coorddata_dreo.c6
-rw-r--r--test/133_coordata_drfinnoe/coorddata_drfinnoe.c6
-rw-r--r--test/140_appendsolution/appendsolution_tests.c8
11 files changed, 24 insertions, 24 deletions
diff --git a/test/010_math_permtoindex/permtoindex_tests.c b/test/010_math_permtoindex/permtoindex_tests.c
index 383150d..2a7ecf3 100644
--- a/test/010_math_permtoindex/permtoindex_tests.c
+++ b/test/010_math_permtoindex/permtoindex_tests.c
@@ -11,7 +11,7 @@ void run(void) {
11 n = atoll(str); 11 n = atoll(str);
12 for (i = 0; i < n; i++) { 12 for (i = 0; i < n; i++) {
13 fgets(str, STRLENMAX, stdin); 13 fgets(str, STRLENMAX, stdin);
14 a[i] = atoi(str); 14 a[i] = (uint8_t)atoi(str);
15 } 15 }
16 16
17 p = permtoindex(n, a); 17 p = permtoindex(n, a);
diff --git a/test/012_math_permsign/permsign_tests.c b/test/012_math_permsign/permsign_tests.c
index 8c652b5..f5a52d0 100644
--- a/test/012_math_permsign/permsign_tests.c
+++ b/test/012_math_permsign/permsign_tests.c
@@ -13,7 +13,7 @@ void run(void) {
13 13
14 for (i = 0; i < n; i++) { 14 for (i = 0; i < n; i++) {
15 fgets(str, STRLENMAX, stdin); 15 fgets(str, STRLENMAX, stdin);
16 a[i] = atoi(str); 16 a[i] = (uint8_t)atoi(str);
17 } 17 }
18 18
19 p = permsign(n, a); 19 p = permsign(n, a);
diff --git a/test/013_math_digitstosumzero/digitstosumzero_tests.c b/test/013_math_digitstosumzero/digitstosumzero_tests.c
index ced466a..8df1848 100644
--- a/test/013_math_digitstosumzero/digitstosumzero_tests.c
+++ b/test/013_math_digitstosumzero/digitstosumzero_tests.c
@@ -11,10 +11,10 @@ void run(void) {
11 fgets(str, STRLENMAX, stdin); 11 fgets(str, STRLENMAX, stdin);
12 n = atoi(str); 12 n = atoi(str);
13 fgets(str, STRLENMAX, stdin); 13 fgets(str, STRLENMAX, stdin);
14 b = atoi(str); 14 b = (uint8_t)atoi(str);
15 for (i = 0; i < n; i++) { 15 for (i = 0; i < n; i++) {
16 fgets(str, STRLENMAX, stdin); 16 fgets(str, STRLENMAX, stdin);
17 a[i] = atoi(str); 17 a[i] = (uint8_t)atoi(str);
18 } 18 }
19 19
20 p = digitstosumzero(n, a, b); 20 p = digitstosumzero(n, a, b);
diff --git a/test/014_math_sumzerotodigits/sumzerotodigits.c b/test/014_math_sumzerotodigits/sumzerotodigits.c
index 401d157..256ca5a 100644
--- a/test/014_math_sumzerotodigits/sumzerotodigits.c
+++ b/test/014_math_sumzerotodigits/sumzerotodigits.c
@@ -8,9 +8,9 @@ void run(void) {
8 uint64_t d; 8 uint64_t d;
9 9
10 fgets(str, STRLENMAX, stdin); 10 fgets(str, STRLENMAX, stdin);
11 n = atoi(str); 11 n = (uint8_t)atoi(str);
12 fgets(str, STRLENMAX, stdin); 12 fgets(str, STRLENMAX, stdin);
13 b = atoi(str); 13 b = (uint8_t)atoi(str);
14 fgets(str, STRLENMAX, stdin); 14 fgets(str, STRLENMAX, stdin);
15 d = atoll(str); 15 d = atoll(str);
16 16
diff --git a/test/090_allowedmoves/allowedmoves_tests.c b/test/090_allowedmoves/allowedmoves_tests.c
index 6bc0e33..cff8303 100644
--- a/test/090_allowedmoves/allowedmoves_tests.c
+++ b/test/090_allowedmoves/allowedmoves_tests.c
@@ -13,8 +13,8 @@ static char *moves[] = {
13 13
14void run(void) { 14void run(void) {
15 char movestr[STRLENMAX]; 15 char movestr[STRLENMAX];
16 uint8_t m[100]; 16 uint8_t j, m[100];
17 int n, i, j; 17 int n, i;
18 18
19 fgets(movestr, STRLENMAX, stdin); 19 fgets(movestr, STRLENMAX, stdin);
20 n = atoi(movestr); 20 n = atoi(movestr);
diff --git a/test/114_cocsep_ttrep/cocsep_ttrep_tests.c b/test/114_cocsep_ttrep/cocsep_ttrep_tests.c
index c5c1bb5..936dac3 100644
--- a/test/114_cocsep_ttrep/cocsep_ttrep_tests.c
+++ b/test/114_cocsep_ttrep/cocsep_ttrep_tests.c
@@ -6,9 +6,9 @@ uint64_t coord_cocsep(cube_t);
6size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); 6size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *);
7 7
8void run(void) { 8void run(void) {
9 uint8_t t; 9 uint8_t t, tt;
10 unsigned char buf[2000000]; 10 unsigned char buf[2000000];
11 uint32_t *cocsepdata, tt; 11 uint32_t *cocsepdata;
12 uint64_t i, selfsim[COCSEP_CLASSES]; 12 uint64_t i, selfsim[COCSEP_CLASSES];
13 uint64_t j, k, l; 13 uint64_t j, k, l;
14 cube_t rep[COCSEP_CLASSES], c, d; 14 cube_t rep[COCSEP_CLASSES], c, d;
diff --git a/test/122_gendata_h48short/gendata_h48short_tests.c b/test/122_gendata_h48short/gendata_h48short_tests.c
index efd378b..0996f8c 100644
--- a/test/122_gendata_h48short/gendata_h48short_tests.c
+++ b/test/122_gendata_h48short/gendata_h48short_tests.c
@@ -34,7 +34,7 @@ void run(void) {
34 34
35 capacity = readl(); 35 capacity = readl();
36 randomizer = readl(); 36 randomizer = readl();
37 arg.maxdepth = readl(); 37 arg.maxdepth = (uint8_t)readl();
38 arg.crep = crep; 38 arg.crep = crep;
39 arg.selfsim = selfsim; 39 arg.selfsim = selfsim;
40 arg.map = &map; 40 arg.map = &map;
diff --git a/test/131_coorddata_dr/coorddata_dr.c b/test/131_coorddata_dr/coorddata_dr.c
index d8ac94a..d262fe3 100644
--- a/test/131_coorddata_dr/coorddata_dr.c
+++ b/test/131_coorddata_dr/coorddata_dr.c
@@ -11,7 +11,7 @@ size_t coordinate_dr_gendata(unsigned char *);
11 11
12void run(void) { 12void run(void) {
13 bool found; 13 bool found;
14 uint64_t t; 14 uint8_t t;
15 char str[STRLENMAX]; 15 char str[STRLENMAX];
16 unsigned char *data; 16 unsigned char *data;
17 size_t size; 17 size_t size;
@@ -33,8 +33,8 @@ void run(void) {
33 goto cleanup; 33 goto cleanup;
34 } 34 }
35 35
36 for (t = 0, found = false; t < 48; t++) { 36 for (t = 0, found = false, coord2 = UINT64_MAX; t < 48; t++) {
37 if (!((UINT64_C(1) << t) & TGROUP)) 37 if (!((UINT64_C(1) << (uint8_t)t) & TGROUP))
38 continue; 38 continue;
39 39
40 coord2 = coordinate_dr_coord(transform(cube, t), data); 40 coord2 = coordinate_dr_coord(transform(cube, t), data);
diff --git a/test/132_coorddata_dreo/coorddata_dreo.c b/test/132_coorddata_dreo/coorddata_dreo.c
index 2b99b7f..50294ff 100644
--- a/test/132_coorddata_dreo/coorddata_dreo.c
+++ b/test/132_coorddata_dreo/coorddata_dreo.c
@@ -11,7 +11,7 @@ size_t coordinate_dreo_gendata(unsigned char *);
11 11
12void run(void) { 12void run(void) {
13 bool found; 13 bool found;
14 uint64_t t; 14 uint8_t t;
15 char str[STRLENMAX]; 15 char str[STRLENMAX];
16 unsigned char *data; 16 unsigned char *data;
17 size_t size; 17 size_t size;
@@ -33,8 +33,8 @@ void run(void) {
33 goto cleanup; 33 goto cleanup;
34 } 34 }
35 35
36 for (t = 0, found = false; t < 48; t++) { 36 for (t = 0, found = false, coord2 = UINT64_MAX; t < 48; t++) {
37 if (!((UINT64_C(1) << t) & TGROUP)) 37 if (!((UINT64_C(1) << (uint64_t)t) & TGROUP))
38 continue; 38 continue;
39 39
40 coord2 = coordinate_dreo_coord(transform(cube, t), data); 40 coord2 = coordinate_dreo_coord(transform(cube, t), data);
diff --git a/test/133_coordata_drfinnoe/coorddata_drfinnoe.c b/test/133_coordata_drfinnoe/coorddata_drfinnoe.c
index 11ae9f7..7d19361 100644
--- a/test/133_coordata_drfinnoe/coorddata_drfinnoe.c
+++ b/test/133_coordata_drfinnoe/coorddata_drfinnoe.c
@@ -10,7 +10,7 @@ size_t coordinate_drfinnoe_gendata(unsigned char *);
10 10
11void run(void) { 11void run(void) {
12 bool found; 12 bool found;
13 uint64_t t; 13 uint8_t t;
14 char str[STRLENMAX]; 14 char str[STRLENMAX];
15 unsigned char *data; 15 unsigned char *data;
16 size_t size; 16 size_t size;
@@ -32,8 +32,8 @@ void run(void) {
32 goto cleanup; 32 goto cleanup;
33 } 33 }
34 34
35 for (t = 0, found = false; t < 48; t++) { 35 for (t = 0, found = false, coord2 = UINT64_MAX; t < 48; t++) {
36 if (!((UINT64_C(1) << t) & TGROUP)) 36 if (!((UINT64_C(1) << (uint64_t)t) & TGROUP))
37 continue; 37 continue;
38 38
39 coord2 = coordinate_drfinnoe_coord(transform(cube, t), data); 39 coord2 = coordinate_drfinnoe_coord(transform(cube, t), data);
diff --git a/test/140_appendsolution/appendsolution_tests.c b/test/140_appendsolution/appendsolution_tests.c
index 9f9e9f4..3f4fb15 100644
--- a/test/140_appendsolution/appendsolution_tests.c
+++ b/test/140_appendsolution/appendsolution_tests.c
@@ -39,7 +39,7 @@ void run(void) {
39 .unniss = false, 39 .unniss = false,
40 .maxmoves = 20, 40 .maxmoves = 20,
41 .maxsolutions = 100, 41 .maxsolutions = 100,
42 .optimal = -1, 42 .optimal = 0,
43 }; 43 };
44 44
45 fgets(str, STRLENMAX, stdin); 45 fgets(str, STRLENMAX, stdin);
@@ -48,8 +48,8 @@ void run(void) {
48 printf("Test error reading moves\n"); 48 printf("Test error reading moves\n");
49 return; 49 return;
50 } 50 }
51 moves.nmoves = nm; 51 moves.nmoves = (uint8_t)nm;
52 moves.npremoves = np; 52 moves.npremoves = (uint8_t)np;
53 fgets(str, STRLENMAX, stdin); 53 fgets(str, STRLENMAX, stdin);
54 settings.unniss = (bool)atoi(str); 54 settings.unniss = (bool)atoi(str);
55 55
@@ -64,7 +64,7 @@ void run(void) {
64 } 64 }
65 } 65 }
66 fgets(str, STRLENMAX, stdin); 66 fgets(str, STRLENMAX, stdin);
67 settings.orientation = atoi(str); 67 settings.orientation = (uint8_t)atoi(str);
68 68
69 appendsolution(&moves, nnt, tmask, &settings, &list); 69 appendsolution(&moves, nnt, tmask, &settings, &list);
70 70

Generated with cgit - Back to sebastiano.tronto.net