X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=test%2Fctype_internal_test.c;h=f1e392ebbb9d60efdfed91d02fa5e77a187f7cfe;hp=04ab14d73f219c6ff4f2b3538b82d11ad53fcad8;hb=fce1b86f61e183d3b73a51d2077ec2719291b756;hpb=678c462e213c3bf479bc93e4df5899ecfd914f91 diff --git a/test/ctype_internal_test.c b/test/ctype_internal_test.c index 04ab14d73f..f1e392ebbb 100644 --- a/test/ctype_internal_test.c +++ b/test/ctype_internal_test.c @@ -9,16 +9,16 @@ #include "testutil.h" #include "internal/ctype.h" -#include "../e_os.h" +#include "internal/nelem.h" #include #include /* * Even though the VMS C RTL claims to be C99 compatible, it's not entirely - * so far (C RTL version 8.4). For the sake of these tests, we therefore - * define our own. + * so far (C RTL version 8.4). Same applies to OSF. For the sake of these + * tests, we therefore define our own. */ -#if defined(__VMS) && __CRTL_VER <= 80400000 +#if (defined(__VMS) && __CRTL_VER <= 80400000) || defined(__osf__) static int isblank(int c) { return c == ' ' || c == '\t'; @@ -27,10 +27,17 @@ static int isblank(int c) static int test_ctype_chars(int n) { - return TEST_int_eq(isalnum(n) != 0, ossl_isalnum(n) != 0) - && TEST_int_eq(isalpha(n) != 0, ossl_isalpha(n) != 0) - && TEST_int_eq(isascii(n) != 0, ossl_isascii(n) != 0) + if (!TEST_int_eq(isascii((unsigned char)n) != 0, ossl_isascii(n) != 0)) + return 0; + + if (!ossl_isascii(n)) + return 1; + + return TEST_int_eq(isalpha(n) != 0, ossl_isalpha(n) != 0) + && TEST_int_eq(isalnum(n) != 0, ossl_isalnum(n) != 0) +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && TEST_int_eq(isblank(n) != 0, ossl_isblank(n) != 0) +#endif && TEST_int_eq(iscntrl(n) != 0, ossl_iscntrl(n) != 0) && TEST_int_eq(isdigit(n) != 0, ossl_isdigit(n) != 0) && TEST_int_eq(isgraph(n) != 0, ossl_isgraph(n) != 0) @@ -75,7 +82,7 @@ static int test_ctype_eof(void) int setup_tests(void) { - ADD_ALL_TESTS(test_ctype_chars, 128); + ADD_ALL_TESTS(test_ctype_chars, 256); ADD_ALL_TESTS(test_ctype_toupper, OSSL_NELEM(case_change)); ADD_ALL_TESTS(test_ctype_tolower, OSSL_NELEM(case_change)); ADD_TEST(test_ctype_eof);