X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdlib%2Fstrtol.c;h=05271e05054e8cc877b79eb94326c1a42a900987;hb=8fca29703edff11c81af1e6039bcf115a83b6bbc;hp=ea54b98c6ebc0442a87870b5b7bb9289db8bc322;hpb=87ff5a50c66f55bccfd6df91ea8a7fe080fa8c2e;p=pdclib.old diff --git a/functions/stdlib/strtol.c b/functions/stdlib/strtol.c index ea54b98..05271e0 100644 --- a/functions/stdlib/strtol.c +++ b/functions/stdlib/strtol.c @@ -37,11 +37,6 @@ long int strtol( const char * s, char ** endptr, int base ) #ifdef TEST #include <_PDCLIB_test.h> -#ifndef _PDCLIB_INT_H -#define _PDCLIB_INT_H -#include <_PDCLIB_int.h> -#endif - #include int main( void ) @@ -93,7 +88,7 @@ int main( void ) /* one-complement and signed magnitude just as well. Anyone having a */ /* platform to test this on? */ errno = 0; -#if _PDCLIB_LONG_BYTES == 4 +#if LONG_MAX == 0x7fffffffL /* testing "even" overflow, i.e. base is power of two */ TESTCASE( strtol( "0x7FFFFFFF", NULL, 0 ) == 0x7fffffff ); TESTCASE( errno == 0 ); @@ -107,7 +102,7 @@ int main( void ) TESTCASE( strtol( "-0x80000001", NULL, 0 ) == LONG_MIN ); TESTCASE( errno == ERANGE ); /* TODO: test "odd" overflow, i.e. base is not power of two */ -#elif _PDCLIB_LONG_BYTES == 8 +#elif LONG_MAX == 0x7fffffffffffffffL /* testing "even" overflow, i.e. base is power of two */ TESTCASE( strtol( "0x7FFFFFFFFFFFFFFF", NULL, 0 ) == 0x7fffffffffffffff ); TESTCASE( errno == 0 );