Improve coverage of the test suite

This commit is contained in:
Patrick Pelissier committed 2023-04-05 22:22:49 +02:00
1 parent a6993ab758
commit 352d7cf725
3 files changed
+25 -1

No files matched your search

+8
View File
@@ -277,6 +277,14 @@ static void test_mpz(void)
assert(b);
assert(strcmp(sp, "") == 0);
assert(array_mpz_equal_p(array1, array2));
b = array_mpz_parse_str(array2, "[", &sp);
assert(!b);
b = array_mpz_parse_str(array2, "[17,", &sp);
assert(!b);
b = array_mpz_parse_str(array2, "[17,18", &sp);
assert(!b);
// NOTE: Not the same order than list...
}
+16
View File
@@ -174,6 +174,22 @@ static void check_io(void)
string_set_str (str, " { ] ");
b = dict_str_parse_str(dict2, string_get_cstr(str), &sp);
assert (!b);
string_set_str (str, " { \"LICENCE\" : \"BSD3\" ");
b = dict_str_parse_str(dict2, string_get_cstr(str), &sp);
assert (!b);
string_set_str (str, " { \"LICENCE\" :");
b = dict_str_parse_str(dict2, string_get_cstr(str), &sp);
assert (!b);
string_set_str (str, " { \"LICENCE\"");
b = dict_str_parse_str(dict2, string_get_cstr(str), &sp);
assert (!b);
string_set_str (str, " { ");
b = dict_str_parse_str(dict2, string_get_cstr(str), &sp);
assert (!b);
}
}
+1 -1
View File
@@ -38,7 +38,7 @@ typedef struct {
} data_t;
static void data_crc(data_t *p) { p->p = 0-p->n; p->c = ~p->n; }
static void data_init(data_t *p) { p->n = 0; p->spare1 = 0; p->spare2 = 0; data_crc(p); p->v = calloc(1, 1); assert(p->v); }
static void data_init(data_t *p) { p->n = 0; p->spare1 = 0; p->spare2 = 0; data_crc(p); p->v = calloc(1, 1); assert(p->v != NULL); }
static void data_valid_p(const data_t *p) { assert (p->n == (0-p->p) && p->n == ~p->c); }
static void data_clear(data_t *p) { free(p->v); }
static void data_set(data_t *p, data_t o) { p->n = o.n; data_crc(p); }