From: Rhodri James Date: Tue, 22 Aug 2017 11:48:00 +0000 (+0100) Subject: Fix whitespace normalization tests for UTF-16 X-Git-Tag: R_2_2_5~24^2~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd6e43f64ac11f2d93afdf63a2e5edad0e4d7bcc;p=libexpat Fix whitespace normalization tests for UTF-16 --- diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 59c94aa9..cac93d35 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -1350,9 +1350,9 @@ is_whitespace_normalized(const XML_Char *s, int is_cdata) int blanks = 0; int at_start = 1; while (*s) { - if (*s == ' ') + if (*s == XCS(' ')) ++blanks; - else if (*s == '\t' || *s == '\n' || *s == '\r') + else if (*s == XCS('\t') || *s == XCS('\n') || *s == XCS('\r')) return 0; else { if (at_start) { @@ -1376,25 +1376,25 @@ is_whitespace_normalized(const XML_Char *s, int is_cdata) static void testhelper_is_whitespace_normalized(void) { - assert(is_whitespace_normalized("abc", 0)); - assert(is_whitespace_normalized("abc", 1)); - assert(is_whitespace_normalized("abc def ghi", 0)); - assert(is_whitespace_normalized("abc def ghi", 1)); - assert(!is_whitespace_normalized(" abc def ghi", 0)); - assert(is_whitespace_normalized(" abc def ghi", 1)); - assert(!is_whitespace_normalized("abc def ghi", 0)); - assert(is_whitespace_normalized("abc def ghi", 1)); - assert(!is_whitespace_normalized("abc def ghi ", 0)); - assert(is_whitespace_normalized("abc def ghi ", 1)); - assert(!is_whitespace_normalized(" ", 0)); - assert(is_whitespace_normalized(" ", 1)); - assert(!is_whitespace_normalized("\t", 0)); - assert(!is_whitespace_normalized("\t", 1)); - assert(!is_whitespace_normalized("\n", 0)); - assert(!is_whitespace_normalized("\n", 1)); - assert(!is_whitespace_normalized("\r", 0)); - assert(!is_whitespace_normalized("\r", 1)); - assert(!is_whitespace_normalized("abc\t def", 1)); + assert(is_whitespace_normalized(XCS("abc"), 0)); + assert(is_whitespace_normalized(XCS("abc"), 1)); + assert(is_whitespace_normalized(XCS("abc def ghi"), 0)); + assert(is_whitespace_normalized(XCS("abc def ghi"), 1)); + assert(!is_whitespace_normalized(XCS(" abc def ghi"), 0)); + assert(is_whitespace_normalized(XCS(" abc def ghi"), 1)); + assert(!is_whitespace_normalized(XCS("abc def ghi"), 0)); + assert(is_whitespace_normalized(XCS("abc def ghi"), 1)); + assert(!is_whitespace_normalized(XCS("abc def ghi "), 0)); + assert(is_whitespace_normalized(XCS("abc def ghi "), 1)); + assert(!is_whitespace_normalized(XCS(" "), 0)); + assert(is_whitespace_normalized(XCS(" "), 1)); + assert(!is_whitespace_normalized(XCS("\t"), 0)); + assert(!is_whitespace_normalized(XCS("\t"), 1)); + assert(!is_whitespace_normalized(XCS("\n"), 0)); + assert(!is_whitespace_normalized(XCS("\n"), 1)); + assert(!is_whitespace_normalized(XCS("\r"), 0)); + assert(!is_whitespace_normalized(XCS("\r"), 1)); + assert(!is_whitespace_normalized(XCS("abc\t def"), 1)); } static void XMLCALL