Fix warnings in test suite.

This commit is contained in:
Patrick Pelissier committed 2020-06-22 00:14:55 +02:00
1 parent cc6da8941c
commit 70de571dc8
5 files changed
+22 -22

No files matched your search

+1 -1
View File
@@ -185,7 +185,7 @@ static void test_uint(void)
assert (x == 1478963);
assert (s == *array_uint_back(v));
s = array_uint_size (v);
s = (unsigned int) array_uint_size (v);
bool b = array_uint_erase (v, 12459);
assert (b == false);
assert (s == array_uint_size (v));
+2 -2
View File
@@ -157,7 +157,7 @@ static void test_stack(void)
buffer_floats_init(buff, 100);
assert (buffer_floats_capacity(buff) == 100);
for(unsigned int i = 0; i < 100; i++) {
float f = i;
float f = (float) i;
buffer_floats_push(buff, f);
assert (buffer_floats_empty_p(buff) == false);
}
@@ -361,7 +361,7 @@ static void prod2(void *arg)
size_t n = *p_n;
size_t r = n;
for(unsigned int i = 0; i < n;i++) {
while (!queue_uint_push(g_buff2, r ));
while (!queue_uint_push(g_buff2, (unsigned int) r ));
r = r * 31421U + 6927U;
}
}
+4 -4
View File
@@ -33,7 +33,7 @@ static void test(size_t n)
genint_t s;
size_t i;
genint_init(s, n);
genint_init(s, (unsigned int) n);
for(int k = 0; k < 3; k++) {
for(size_t j = 0; j< n ; j++) {
i = genint_pop(s);
@@ -44,7 +44,7 @@ static void test(size_t n)
assert (genint_pop(s) == GENINT_ERROR);
for(size_t j = 0; j< n ; j++) {
genint_push(s, ((j + (size_t) k) % n ));
genint_push(s, (unsigned int) ((j + (size_t) k) % n ));
}
}
@@ -84,7 +84,7 @@ static void test2(size_t n)
{
m_thread_t idx[4];
genint_init(global, n);
genint_init(global, (unsigned int) n);
for(int i = 0; i < MAX_N; i++)
atomic_init(&tab_g[i], false);
@@ -116,7 +116,7 @@ static void test3(size_t n)
m_thread_t idx[MAX_N];
assert (n <= MAX_N);
genint_init(global, n);
genint_init(global, (unsigned int) n);
for(size_t i = 0; i < n; i++) {
m_thread_create (idx[i], conso2, (void*)&n);
}
+1 -1
View File
@@ -27,7 +27,7 @@
static bool uint_in_str(unsigned int *u, FILE *f)
{
int n = fscanf(f, "%u", u);
int n = m_core_fscanf(f, "%u", u);
return n == 1;
}
+14 -14
View File
@@ -301,11 +301,11 @@ static void test0(void)
assert (string_cmp_str(s1, "Hello \"world\"") == 0);
string_set_str(s1, "Hello \"world\"");
FILE *f = fopen ("a-mstring.dat", "wt");
FILE *f = m_core_fopen ("a-mstring.dat", "wt");
assert (f != NULL);
string_out_str (f, s1);
fclose (f);
f = fopen("a-mstring.dat", "rt");
f = m_core_fopen("a-mstring.dat", "rt");
assert (f != NULL);
b = string_in_str(s2, f);
assert(b);
@@ -316,11 +316,11 @@ static void test0(void)
string_get_str(s2, s1, false);
assert (string_cmp_str(s2, "\"\\tHell\\\\o\\n\\\"World\\\"\\r\\001\"") == 0);
f = fopen ("a-mstring.dat", "wt");
f = m_core_fopen ("a-mstring.dat", "wt");
assert (f != NULL);
string_out_str (f, s1);
fclose (f);
f = fopen("a-mstring.dat", "rt");
f = m_core_fopen("a-mstring.dat", "rt");
assert (f != NULL);
b = string_in_str(s2, f);
assert(b);
@@ -392,11 +392,11 @@ static void test0(void)
string_printf (s1, "Hello %d worlds. How do you do? I'm fine. Thank you! The weather is bad today. I should had brought my umbrella. Oh! You can lend me one! Thank you very much! No really thank you. I wouldn't be able to get in time for my job.", 2);
assert (string_equal_str_p(s1, "Hello 2 worlds. How do you do? I'm fine. Thank you! The weather is bad today. I should had brought my umbrella. Oh! You can lend me one! Thank you very much! No really thank you. I wouldn't be able to get in time for my job."));
f = fopen ("a-mstring.dat", "wt");
f = m_core_fopen ("a-mstring.dat", "wt");
assert (f != NULL);
string_fputs (f, s1);
fclose (f);
f = fopen("a-mstring.dat", "rt");
f = m_core_fopen("a-mstring.dat", "rt");
assert (f != NULL);
string_fgets(s2, f, STRING_READ_FILE);
fclose(f);
@@ -406,12 +406,12 @@ static void test0(void)
string_init(s2);
string_set_str(s2, "I'm ok");
f = fopen ("a-mstring.dat", "wt");
f = m_core_fopen ("a-mstring.dat", "wt");
assert (f != NULL);
string_fputs (f, s1);
fprintf (f, "\n");
fclose (f);
f = fopen("a-mstring.dat", "rt");
f = m_core_fopen("a-mstring.dat", "rt");
assert (f != NULL);
string_fgets(s2, f, STRING_READ_PURE_LINE);
fclose(f);
@@ -419,11 +419,11 @@ static void test0(void)
string_clear(s1);
string_init(s1);
f = fopen("a-mstring.dat", "wt");
f = m_core_fopen("a-mstring.dat", "wt");
assert(f != NULL);
fprintf(f, "hello world...\n\tHowwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww do you do?");
fclose(f);
f = fopen("a-mstring.dat", "rt");
f = m_core_fopen("a-mstring.dat", "rt");
b = string_fget_word(s1, " \t.\n?", f);
assert(b);
assert(string_equal_str_p(s1, "hello"));
@@ -446,11 +446,11 @@ static void test0(void)
assert(b == false);
fclose(f);
f = fopen("a-mstring.dat", "wt");
f = m_core_fopen("a-mstring.dat", "wt");
assert(f != NULL);
fprintf(f, "word");
fclose(f);
f = fopen("a-mstring.dat", "rt");
f = m_core_fopen("a-mstring.dat", "rt");
b = string_fget_word(s1, " \t.\n?", f);
assert(b);
assert(string_equal_str_p(s1, "word"));
@@ -549,11 +549,11 @@ static void test_bounded_io(void)
string16_init(d);
string16_set_str(s, "Hello \"world\"");
f = fopen ("a-mstring.dat", "wt");
f = m_core_fopen ("a-mstring.dat", "wt");
assert (f != NULL);
string16_out_str (f, s);
fclose (f);
f = fopen("a-mstring.dat", "rt");
f = m_core_fopen("a-mstring.dat", "rt");
assert (f != NULL);
b = string16_in_str(d, f);
assert(b);