Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:Update
iniparser
Fix-tests-on-32bit.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File Fix-tests-on-32bit.patch of Package iniparser
From 0f5a112836be0d9c7db59b8c9b832979298e14cc Mon Sep 17 00:00:00 2001 From: Michal Suchanek <msuchanek@suse.de> Date: Wed, 24 Aug 2022 20:49:08 +0200 Subject: [PATCH] Fix tests on 32bit The long has different width on 32bit and 64bit. Use predefined macro for the maximum value. Signed-off-by: Michal Suchanek <msuchanek@suse.de> --- test/test_iniparser.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/test_iniparser.c b/test/test_iniparser.c index b7cd5fc..020e6ae 100644 --- a/test/test_iniparser.c +++ b/test/test_iniparser.c @@ -4,6 +4,7 @@ #include <sys/stat.h> #include <sys/types.h> #include <stdarg.h> +#include <limits.h> #include "CuTest.h" #include "dictionary.h" @@ -15,6 +16,8 @@ #define GOOD_INI_PATH "ressources/good_ini" #define BAD_INI_PATH "ressources/bad_ini" +#define stringify_2(x...) #x +#define stringify(x...) stringify_2(x) /* Tool function to create and populate a generic non-empty dictionary */ static dictionary * generate_dictionary(unsigned sections, unsigned entries_per_section) @@ -350,8 +353,8 @@ void Test_iniparser_getlongint(CuTest *tc) { 1000, "1000" }, { 077, "077" }, { -01000, "-01000" }, - { 0x7FFFFFFFFFFFFFFF, "0x7FFFFFFFFFFFFFFF" }, - { -0x7FFFFFFFFFFFFFFF, "-0x7FFFFFFFFFFFFFFF" }, + { LONG_MAX, stringify(LONG_MAX) }, + { -LONG_MAX, stringify(-LONG_MAX) }, { 0x4242, "0x4242" }, { 0, NULL} /* must be last */ }; @@ -370,8 +373,8 @@ void Test_iniparser_getlongint(CuTest *tc) /* Check the def return element */ dic = dictionary_new(10); CuAssertLongIntEquals(tc, 42, iniparser_getlongint(dic, "dummy", 42)); - CuAssertLongIntEquals(tc, 0x7FFFFFFFFFFFFFFF, iniparser_getlongint(dic, NULL, 0x7FFFFFFFFFFFFFFF)); - CuAssertLongIntEquals(tc, -0x7FFFFFFFFFFFFFFF, iniparser_getlongint(dic, "dummy", -0x7FFFFFFFFFFFFFFF)); + CuAssertLongIntEquals(tc, LONG_MAX, iniparser_getlongint(dic, NULL, LONG_MAX)); + CuAssertLongIntEquals(tc, -LONG_MAX, iniparser_getlongint(dic, "dummy", -LONG_MAX)); dictionary_del(dic); /* Generic dictionary */ -- 2.37.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor