From 17c7912c49c0135e232fe669e561808bc5373db2 Mon Sep 17 00:00:00 2001 From: Jakub Filak Date: Wed, 10 Jun 2015 08:11:29 +0200 Subject: [PATCH] testsuite: fix parse_numbers on i686 Signed-off-by: Jakub Filak --- tests/xfuncs.at | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/xfuncs.at b/tests/xfuncs.at index dbcc602..222824c 100644 --- a/tests/xfuncs.at +++ b/tests/xfuncs.at @@ -86,23 +86,23 @@ int main(void) assert(try_atou("foo54321", &uint_value) != 0); assert(uint_value == 12345); - char buf[sizeof(unsigned long) * 3 + 1]; + char buf[sizeof(unsigned long long) * 3 + 1]; - snprintf(buf, sizeof(buf), "%lu", 1LU + UINT_MAX); + snprintf(buf, sizeof(buf), "%llu", 1LLU + UINT_MAX); assert(try_atou(buf, &uint_value) != 0 || !"Above UINT_MAX"); assert(uint_value == 12345); assert(try_atou("-1", &uint_value) != 0); assert(uint_value == 12345); - snprintf(buf, sizeof(buf), "%lu", (long unsigned)UINT_MAX); + snprintf(buf, sizeof(buf), "%llu", (unsigned long long)UINT_MAX); assert(try_atou(buf, &uint_value) == 0); assert(uint_value == UINT_MAX); - assert(xatou(buf) == UINT_MAX); + assert(xatou(buf) == UINT_MAX); assert(try_atou("0", &uint_value) == 0); assert(uint_value == 0); - assert(xatou("0") == 0); + assert(xatou("0") == 0); } { @@ -113,22 +113,22 @@ int main(void) assert(try_atoi("foo54321", &int_value) != 0); assert(int_value == 12345); - char buf[sizeof(long) * 3 + 1]; + char buf[sizeof(long long) * 3 + 1]; - snprintf(buf, sizeof(buf), "%ld", 1L + INT_MAX); + snprintf(buf, sizeof(buf), "%lld", 1LL + INT_MAX); assert(try_atoi(buf, &int_value) != 0 || !"Parse INT_MAX+1"); assert(int_value == 12345 || !"Above INT_MAX"); - snprintf(buf, sizeof(buf), "%ld", -1L + INT_MIN); + snprintf(buf, sizeof(buf), "%lld", -1LL + INT_MIN); assert(try_atoi(buf, &int_value) != 0 || !"Parse INT_MIN-1"); assert(int_value == 12345 || !"Belove INT_MIN"); - snprintf(buf, sizeof(buf), "%ld", (long unsigned)INT_MAX); + snprintf(buf, sizeof(buf), "%lld", (unsigned long long)INT_MAX); assert(try_atoi(buf, &int_value) == 0 || !"Parse INT_MAX"); assert(int_value == INT_MAX); assert(xatoi(buf) == INT_MAX); - snprintf(buf, sizeof(buf), "%ld", (long unsigned)INT_MIN); + snprintf(buf, sizeof(buf), "%lld", (unsigned long long)INT_MIN); assert(try_atoi(buf, &int_value) == 0 || !"Parse INT_MIN"); assert(int_value == INT_MIN); assert(xatoi(buf) == INT_MIN); @@ -142,16 +142,16 @@ int main(void) assert(try_atoi_positive("foo54321", &positive_value) != 0); assert(positive_value == 12345); - char buf[sizeof(long) * 3 + 1]; + char buf[sizeof(long long) * 3 + 1]; - snprintf(buf, sizeof(buf), "%ld", 1L + INT_MAX); + snprintf(buf, sizeof(buf), "%lld", 1LL + INT_MAX); assert(try_atoi_positive(buf, &positive_value) != 0); assert(positive_value == 12345 || !"Above INT_MAX"); assert(try_atoi_positive("-1", &positive_value) != 0); assert(positive_value == 12345 || !"After -1"); - snprintf(buf, sizeof(buf), "%ld", (long unsigned)INT_MAX); + snprintf(buf, sizeof(buf), "%lld", (unsigned long long)INT_MAX); assert(try_atoi_positive(buf, &positive_value) == 0 || !"Parse INT_MAX"); assert(positive_value == INT_MAX); assert(xatoi_positive(buf) == INT_MAX); -- 2.1.0