From b8c83ce9b445dd2190b983ac94bb856e23b8fad2 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Thu, 20 May 2021 16:03:33 +0200 Subject: [PATCH] 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. --- src/inttypes/functions.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/inttypes/functions.c b/src/inttypes/functions.c index 49e7610..acd7cd8 100644 --- a/src/inttypes/functions.c +++ b/src/inttypes/functions.c @@ -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 = {