Commit 758dad03 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vnum: Add test coverage for 32bit unsigned limits

parent 0e75d463
......@@ -486,7 +486,7 @@ static struct test_case {
uintmax_t rel;
uintmax_t val;
const char *err;
} test_cases[] = {
} test_vnum_2bytes[] = {
{ "1", (uintmax_t)0, (uintmax_t)1 },
{ "1B", (uintmax_t)0, (uintmax_t)1<<0 },
{ "1 B", (uintmax_t)0, (uintmax_t)1<<0 },
......@@ -530,6 +530,10 @@ static struct test_case {
{ "2%", (uintmax_t)1024, (uintmax_t)20 },
{ "3%", (uintmax_t)1024, (uintmax_t)30 },
/* 32bit limits */
{ "4294967295b", (uintmax_t)0, (uintmax_t)4294967295ULL},
{ "4294967294b", (uintmax_t)0, (uintmax_t)4294967294ULL},
/* Check the error checks */
{ "", 0, 0, err_invalid_num },
{ "-1", 0, 0, err_invalid_num },
......@@ -674,7 +678,7 @@ main(int argc, char *argv[])
}
}
for (tc = test_cases; tc->str; ++tc) {
for (tc = test_vnum_2bytes; tc->str; ++tc) {
e = VNUM_2bytes(tc->str, &val, tc->rel);
if (e != NULL)
val = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment