diff --git a/tests/test-marray.c b/tests/test-marray.c index b54012e6..c331b168 100644 --- a/tests/test-marray.c +++ b/tests/test-marray.c @@ -207,12 +207,12 @@ static void test_mpz(void) testobj_init (z); // Test empty - FILE *f = fopen ("a-marray.dat", "wt"); + FILE *f = m_core_fopen ("a-marray.dat", "wt"); if (!f) abort(); array_mpz_out_str(f, array1); fclose (f); - f = fopen ("a-marray.dat", "rt"); + f = m_core_fopen ("a-marray.dat", "rt"); if (!f) abort(); bool b = array_mpz_in_str (array2, f); assert (b == true); @@ -225,12 +225,12 @@ static void test_mpz(void) array_mpz_push_back (array1, z); } - f = fopen ("a-marray.dat", "wt"); + f = m_core_fopen ("a-marray.dat", "wt"); if (!f) abort(); array_mpz_out_str(f, array1); fclose (f); - f = fopen ("a-marray.dat", "rt"); + f = m_core_fopen ("a-marray.dat", "rt"); if (!f) abort(); b = array_mpz_in_str (array2, f); assert (b == true); diff --git a/tests/test-mbitset.c b/tests/test-mbitset.c index f62194ee..01504948 100644 --- a/tests/test-mbitset.c +++ b/tests/test-mbitset.c @@ -231,12 +231,12 @@ static void test_str(void) for(int i = 0; i < 200; i++) bitset_push_back(set1, ((size_t) i*17547854547UL >> 4)&1) ; - FILE *f = fopen ("a-mbitset.dat", "wt"); + FILE *f = m_core_fopen ("a-mbitset.dat", "wt"); if (!f) abort(); bitset_out_str(f, set1); fclose (f); - f = fopen ("a-mbitset.dat", "rt"); + f = m_core_fopen ("a-mbitset.dat", "rt"); if (!f) abort(); bool b = bitset_in_str (set2, f); assert (b == true); diff --git a/tests/test-mbptree.c b/tests/test-mbptree.c index 57c83f33..0ffc31de 100644 --- a/tests/test-mbptree.c +++ b/tests/test-mbptree.c @@ -405,12 +405,12 @@ static void test_io(void) assert(*endp == 0); assert (btree_my_equal_p (tree1, tree2)); - FILE *f = fopen ("a-mbptree.dat", "wt"); + FILE *f = m_core_fopen ("a-mbptree.dat", "wt"); if (!f) abort(); btree_my_out_str(f, tree1); fclose (f); - f = fopen ("a-mbptree.dat", "rt"); + f = m_core_fopen ("a-mbptree.dat", "rt"); if (!f) abort(); b = btree_my_in_str (tree2, f); assert (b == true); @@ -431,12 +431,12 @@ static void test_io(void) assert(*endp == 0); assert (btree_my_equal_p (tree1, tree2)); - f = fopen ("a-mbptree.dat", "wt"); + f = m_core_fopen ("a-mbptree.dat", "wt"); if (!f) abort(); btree_my_out_str(f, tree1); fclose (f); - f = fopen ("a-mbptree.dat", "rt"); + f = m_core_fopen ("a-mbptree.dat", "rt"); if (!f) abort(); b = btree_my_in_str (tree2, f); assert (b == true); @@ -458,12 +458,12 @@ static void test_io_set(void) assert(*endp == 0); assert (btree_myset_equal_p (tree1, tree2)); - FILE *f = fopen ("a-mbptree.dat", "wt"); + FILE *f = m_core_fopen ("a-mbptree.dat", "wt"); if (!f) abort(); btree_myset_out_str(f, tree1); fclose (f); - f = fopen ("a-mbptree.dat", "rt"); + f = m_core_fopen ("a-mbptree.dat", "rt"); if (!f) abort(); b = btree_myset_in_str (tree2, f); assert (b == true); @@ -485,12 +485,12 @@ static void test_io_set(void) assert(*endp == 0); assert (btree_myset_equal_p (tree1, tree2)); - f = fopen ("a-mbptree.dat", "wt"); + f = m_core_fopen ("a-mbptree.dat", "wt"); if (!f) abort(); btree_myset_out_str(f, tree1); fclose (f); - f = fopen ("a-mbptree.dat", "rt"); + f = m_core_fopen ("a-mbptree.dat", "rt"); if (!f) abort(); b = btree_myset_in_str (tree2, f); assert (b == true); diff --git a/tests/test-mdeque.c b/tests/test-mdeque.c index eb9c3303..5251fc8c 100644 --- a/tests/test-mdeque.c +++ b/tests/test-mdeque.c @@ -276,12 +276,12 @@ static void test_io(void) M_LET(z, TESTOBJ_OPLIST) M_LET(str, STRING_OPLIST) { // Test empty - FILE *f = fopen ("a-marray.dat", "wt"); + FILE *f = m_core_fopen ("a-marray.dat", "wt"); if (!f) abort(); deque_mpz_out_str(f, d1); fclose (f); - f = fopen ("a-marray.dat", "rt"); + f = m_core_fopen ("a-marray.dat", "rt"); if (!f) abort(); bool b = deque_mpz_in_str (d2, f); assert (b == true); @@ -294,12 +294,12 @@ static void test_io(void) deque_mpz_push_back (d1, z); } - f = fopen ("a-marray.dat", "wt"); + f = m_core_fopen ("a-marray.dat", "wt"); if (!f) abort(); deque_mpz_out_str(f, d1); fclose (f); - f = fopen ("a-marray.dat", "rt"); + f = m_core_fopen ("a-marray.dat", "rt"); if (!f) abort(); b = deque_mpz_in_str (d2, f); assert (b == true); diff --git a/tests/test-mdict.c b/tests/test-mdict.c index f9f5bfbf..ff321ff6 100644 --- a/tests/test-mdict.c +++ b/tests/test-mdict.c @@ -119,11 +119,11 @@ static void check_io(void) assert (*sp == 0); assert (dict_str_equal_p(dict, dict2)); - FILE *f = fopen ("a-mdict.dat", "wt"); + FILE *f = m_core_fopen ("a-mdict.dat", "wt"); if (!f) abort(); dict_str_out_str(f, dict); fclose (f); - f = fopen ("a-mdict.dat", "rt"); + f = m_core_fopen ("a-mdict.dat", "rt"); if (!f) abort(); b = dict_str_in_str(dict2, f); assert (b == true); @@ -270,7 +270,7 @@ static void test1(void) string_init(key); string_init(ref); - FILE *f = fopen("dict.txt", "rt"); + FILE *f = m_core_fopen("dict.txt", "rt"); if (!f) abort(); dict_str_set_at(dict, STRING_CTE("LICENCE"), STRING_CTE("BSD3")); assert(string_equal_p(*dict_str_cget(dict, STRING_CTE("LICENCE")), STRING_CTE("BSD3"))); @@ -286,7 +286,7 @@ static void test1(void) fclose(f); assert(dict_str_size(dict) == 19); - f = fopen("dict.txt", "rt"); + f = m_core_fopen("dict.txt", "rt"); if (!f) abort(); while (!feof(f) && !ferror(f)) { string_fgets(key, f, STRING_READ_PURE_LINE); diff --git a/tests/test-mlist.c b/tests/test-mlist.c index fb78cb47..c7918937 100644 --- a/tests/test-mlist.c +++ b/tests/test-mlist.c @@ -251,14 +251,14 @@ static void test_mpz(void) } assert (testobj_get_ui(s) == 1000*999/2); - FILE *f = fopen ("a-mlist.dat", "wt"); + FILE *f = m_core_fopen ("a-mlist.dat", "wt"); if (!f) abort(); list_mpz_out_str(f, v); fclose (f); list_mpz_t list2; list_mpz_init(list2); - f = fopen ("a-mlist.dat", "rt"); + f = m_core_fopen ("a-mlist.dat", "rt"); bool b = list_mpz_in_str (list2, f); assert (b == true); fclose(f); @@ -603,13 +603,13 @@ static void test_out_default_oplist(void) { M_LET(str, string_t) M_LET(list, l2, list_int_t) { - FILE *f = fopen ("a-mlist.dat", "wt"); + FILE *f = m_core_fopen ("a-mlist.dat", "wt"); if (!f) abort(); list_int_push_back(list, 2); list_int_push_back(list, 3); list_int_out_str(f, list); fclose(f); - f = fopen("a-mlist.dat", "rt"); + f = m_core_fopen("a-mlist.dat", "rt"); if (!f) abort(); char buffer[1024]; assert (fgets(buffer, 1024, f) == buffer); @@ -617,7 +617,7 @@ static void test_out_default_oplist(void) fclose(f); list_int_get_str(str, list, false); assert (string_equal_str_p(str, "[3,2]")); - f = fopen("a-mlist.dat", "rt"); + f = m_core_fopen("a-mlist.dat", "rt"); if (!f) abort(); assert (list_int_in_str(l2, f) == true); assert (list_int_equal_p(l2, list)); diff --git a/tests/test-mrbtree.c b/tests/test-mrbtree.c index 3ef28d4a..3b78b3af 100644 --- a/tests/test-mrbtree.c +++ b/tests/test-mrbtree.c @@ -195,7 +195,7 @@ static void test_uint_permut(void) static void test_float(void) { M_LET(tree, FLOAT_OP) { - for(float f = -17.42; f < 17.42; f+=0.01) + for(float f = -17.42f; f < 17.42f; f+=0.01f) rbtree_float_push (tree, f); bool p = false; float g; @@ -214,12 +214,12 @@ static void test_io(void) M_LET(str, STRING_OPLIST) M_LET(tree1, tree2, UINT_OPLIST) { // Empty one - FILE *f = fopen ("a-mrbtree.dat", "wt"); + FILE *f = m_core_fopen ("a-mrbtree.dat", "wt"); if (!f) abort(); rbtree_uint_out_str(f, tree1); fclose (f); - f = fopen ("a-mrbtree.dat", "rt"); + f = m_core_fopen ("a-mrbtree.dat", "rt"); if (!f) abort(); bool b = rbtree_uint_in_str (tree2, f); assert (b == true); @@ -238,12 +238,12 @@ static void test_io(void) for(unsigned int i = 0 ; i < 10; i++) rbtree_uint_push(tree1, i); - f = fopen ("a-mrbtree.dat", "wt"); + f = m_core_fopen ("a-mrbtree.dat", "wt"); if (!f) abort(); rbtree_uint_out_str(f, tree1); fclose (f); - f = fopen ("a-mrbtree.dat", "rt"); + f = m_core_fopen ("a-mrbtree.dat", "rt"); if (!f) abort(); b = rbtree_uint_in_str (tree2, f); assert (b == true); diff --git a/tests/test-mserial-bin.c b/tests/test-mserial-bin.c index 9bbb424b..94f064de 100644 --- a/tests/test-mserial-bin.c +++ b/tests/test-mserial-bin.c @@ -67,7 +67,7 @@ static void test_out_empty(void) my2_init(el1); my2_init(el2); - FILE *f = fopen ("a-mbin.dat", "wt"); + FILE *f = m_core_fopen ("a-mbin.dat", "wt"); if (!f) abort(); M_LET( (serial, f), m_serial_bin_write_t) { ret = my2_out_serial(serial, el1); @@ -75,7 +75,7 @@ static void test_out_empty(void) } fclose(f); - f = fopen ("a-mbin.dat", "rt"); + f = m_core_fopen ("a-mbin.dat", "rt"); if (!f) abort(); M_LET( (serial, f), m_serial_bin_read_t) { ret = my2_in_serial(el2, serial); @@ -116,7 +116,7 @@ static void test_out_fill(void) d2_set_at(el2->data->valh, STRING_CTE("Paul"), 1); d2_set_at(el2->data->valh, STRING_CTE("Smith"), 2); - f = fopen ("a-mbin.dat", "wt"); + f = m_core_fopen ("a-mbin.dat", "wt"); if (!f) abort(); m_serial_bin_write_init(out, f); ret = my2_out_serial(out, el2); @@ -124,7 +124,7 @@ static void test_out_fill(void) m_serial_bin_write_clear(out); fclose(f); - f = fopen ("a-mbin.dat", "rt"); + f = m_core_fopen ("a-mbin.dat", "rt"); if (!f) abort(); m_serial_bin_read_init(in, f); ret = my2_in_serial(el1, in); diff --git a/tests/test-mserial-json.c b/tests/test-mserial-json.c index db913c2d..9c3fbadf 100644 --- a/tests/test-mserial-json.c +++ b/tests/test-mserial-json.c @@ -69,7 +69,7 @@ static void test_out_empty(void) my2_init(el1); my2_init(el2); - FILE *f = fopen ("a-mjson.dat", "wt"); + FILE *f = m_core_m_core_fopen ("a-mjson.dat", "wt"); if (!f) abort(); m_serial_json_write_init(out, f); ret = my2_out_serial(out, el1); @@ -77,7 +77,7 @@ static void test_out_empty(void) m_serial_json_write_clear(out); fclose(f); - f = fopen ("a-mjson.dat", "rt"); + f = m_core_m_core_fopen ("a-mjson.dat", "rt"); if (!f) abort(); static const char expected[] = "{ \"activated\":false,\"data\":{ \"vala\":0,\"valb\":0.000000,\"valc\":false,\"vald\":\"\",\"vale\":[],\"valf\":{},\"valg\":[],\"valh\":{}}"; char get[sizeof expected]; @@ -85,7 +85,7 @@ static void test_out_empty(void) assert (strcmp(get, expected) == 0); fclose(f); - f = fopen ("a-mjson.dat", "rt"); + f = m_core_m_core_fopen ("a-mjson.dat", "rt"); if (!f) abort(); m_serial_json_read_init(in, f); ret = my2_in_serial(el2, in); @@ -108,7 +108,7 @@ static void test_out_fill(void) my2_init(el1); my2_init(el2); - FILE *f = fopen("a-mjson.dat", "wt"); + FILE *f = m_core_m_core_fopen("a-mjson.dat", "wt"); if (!f) abort(); fprintf(f, "{\n" @@ -124,7 +124,7 @@ static void test_out_fill(void) " \"valc\": true } }\n"); fclose(f); - f = fopen ("a-mjson.dat", "rt"); + f = m_core_m_core_fopen ("a-mjson.dat", "rt"); if (!f) abort(); m_serial_json_read_init(in, f); ret = my2_in_serial(el2, in); @@ -132,7 +132,7 @@ static void test_out_fill(void) m_serial_json_read_clear(in); fclose(f); - f = fopen ("a-mjson.dat", "wt"); + f = m_core_m_core_fopen ("a-mjson.dat", "wt"); if (!f) abort(); m_serial_json_write_init(out, f); ret = my2_out_serial(out, el2); @@ -140,7 +140,7 @@ static void test_out_fill(void) m_serial_json_write_clear(out); fclose(f); - f = fopen ("a-mjson.dat", "rt"); + f = m_core_m_core_fopen ("a-mjson.dat", "rt"); if (!f) abort(); static const char expected[] = "{ \"activated\":false,\"data\":{ \"vala\":1742,\"valb\":-2.300000,\"valc\":true,\"vald\":\"This is a test\",\"vale\":[1,2,3],\"valf\":{\"is_bool\":true},\"valg\":[1,2,3,4,5,6],\"valh\":{\"steeve\":-4,\"jane\":3}}}"; static const char expected2[] = "{ \"activated\":false,\"data\":{ \"vala\":1742,\"valb\":-2.300000,\"valc\":true,\"vald\":\"This is a test\",\"vale\":[1,2,3],\"valf\":{\"is_bool\":true},\"valg\":[1,2,3,4,5,6],\"valh\":{\"jane\":3,\"steeve\":-4}}}"; @@ -149,7 +149,7 @@ static void test_out_fill(void) assert (strcmp(get, expected) == 0 || strcmp(get, expected2) == 0); fclose(f); - f = fopen ("a-mjson.dat", "rt"); + f = m_core_m_core_fopen ("a-mjson.dat", "rt"); if (!f) abort(); m_serial_json_read_init(in, f); ret = my2_in_serial(el1, in); diff --git a/tests/test-mtuple.c b/tests/test-mtuple.c index 8d4830fc..54c481e3 100644 --- a/tests/test-mtuple.c +++ b/tests/test-mtuple.c @@ -132,12 +132,12 @@ static void check_io(void) assert (pair_str_equal_p(pair, pair2) == true); assert(*end == 0); - FILE *f = fopen("a-mtuple.dat", "wt"); + FILE *f = m_core_fopen("a-mtuple.dat", "wt"); if (!f) abort(); pair_str_out_str(f, pair); fclose(f); - f = fopen("a-mtuple.dat", "rt"); + f = m_core_fopen("a-mtuple.dat", "rt"); if (!f) abort(); b = pair_str_in_str(pair2, f); assert (b); diff --git a/tests/test-mvariant.c b/tests/test-mvariant.c index 3f4973fc..5e83fc3b 100644 --- a/tests/test-mvariant.c +++ b/tests/test-mvariant.c @@ -219,12 +219,12 @@ test_io(void) M_LET(s, STRING_OPLIST) M_LET(x, y, VARIANT_OPLIST(single, STRING_OPLIST)) { // Check empty - FILE *f = fopen ("a-mvariant.dat", "wt"); + FILE *f = m_core_fopen ("a-mvariant.dat", "wt"); if (!f) abort(); single_out_str(f, x); fclose (f); - f = fopen ("a-mvariant.dat", "rt"); + f = m_core_fopen ("a-mvariant.dat", "rt"); bool b = single_in_str (y, f); assert (b == true); fclose(f); @@ -241,12 +241,12 @@ test_io(void) // Fill in the variant single_set_s (x, s); - f = fopen ("a-mvariant.dat", "wt"); + f = m_core_fopen ("a-mvariant.dat", "wt"); if (!f) abort(); single_out_str(f, x); fclose (f); - f = fopen ("a-mvariant.dat", "rt"); + f = m_core_fopen ("a-mvariant.dat", "rt"); b = single_in_str (y, f); assert (b == true); fclose(f); diff --git a/tests/test-obj.h b/tests/test-obj.h index 0a2e2b3a..51477a2e 100644 --- a/tests/test-obj.h +++ b/tests/test-obj.h @@ -103,7 +103,7 @@ static void testobj_out_str(FILE *f, const testobj_t z) static bool testobj_in_str(testobj_t z, FILE *f) { z->n = 1; - return fscanf(f, "%u", &z->ptr[0]) == 1; + return m_core_fscanf(f, "%u", &z->ptr[0]) == 1; } static bool testobj_parse_str(testobj_t z, const char str[], const char **endptr)