inttypes: add brief tests for strtoimax and strtoumax

All the tests are done in strtol/strtoll and strtoul/strtoull, the only
important thing is to check that the correct size type is used.
This commit is contained in:
Lephenixnoir 2021-05-20 16:03:33 +02:00
parent e8c2e8dae6
commit b8c83ce9b4
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,12 @@ static void _ft_inttypes_functions(ft_test *t)
ft_assert(t, imd.quot == -9ll && imd.rem == 1ll);
imd = imaxdiv(-73ll, -8ll);
ft_assert(t, imd.quot == 9ll && imd.rem == -1ll);
ft_log(t, "\nstrtoimax and strtoumax:\n");
ft_assert_eval(t, strtoimax("-281474976710656", NULL, 0),
-281474976710656ll, "%" PRIdMAX);
ft_assert_eval(t, strtoumax("281474976710656", NULL, 0),
281474976710656ll, "%" PRIuMAX);
}
ft_test ft_inttypes_functions = {