mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-7237 adjust BiDiConformanceTest for Unicode 6 BidiTest.txt (auto-RTL in bit set)
X-SVN-Rev: 28285
This commit is contained in:
parent
7d5ca333f1
commit
d84415e717
3 changed files with 15 additions and 15 deletions
|
@ -115,9 +115,6 @@ char *BiDiConformanceTest::getUnidataPath(char path[]) {
|
|||
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalStdioFilePointer, FILE, fclose);
|
||||
|
||||
// TODO: Make "public" in uparse.h.
|
||||
#define U_IS_INV_WHITESPACE(c) ((c)==' ' || (c)=='\t' || (c)=='\r' || (c)=='\n')
|
||||
|
||||
UBool BiDiConformanceTest::parseLevels(const char *start) {
|
||||
directionBits=0;
|
||||
levelsCount=0;
|
||||
|
@ -336,15 +333,15 @@ void BiDiConformanceTest::TestBidiTest() {
|
|||
}
|
||||
start=u_skipWhitespace(start+1);
|
||||
char *end;
|
||||
uint32_t bitset=(uint32_t)strtoul(start, &end, 10);
|
||||
uint32_t bitset=(uint32_t)strtoul(start, &end, 16);
|
||||
if(end<=start || (!U_IS_INV_WHITESPACE(*end) && *end!=';' && *end!=0)) {
|
||||
errln("input bitset parse error at %s", start);
|
||||
return;
|
||||
}
|
||||
// Loop over the bitset.
|
||||
static const UBiDiLevel paraLevels[]={ UBIDI_DEFAULT_LTR, 0, 1 };
|
||||
static const char *const paraLevelNames[]={ "auto/LTR", "LTR", "RTL" };
|
||||
for(int i=0; i<=2; ++i) {
|
||||
static const UBiDiLevel paraLevels[]={ UBIDI_DEFAULT_LTR, 0, 1, UBIDI_DEFAULT_RTL };
|
||||
static const char *const paraLevelNames[]={ "auto/LTR", "LTR", "RTL", "auto/RTL" };
|
||||
for(int i=0; i<=3; ++i) {
|
||||
if(bitset&(1<<i)) {
|
||||
ubidi_setPara(ubidi.getAlias(), inputString.getBuffer(), inputString.length(),
|
||||
paraLevels[i], NULL, errorCode);
|
||||
|
|
|
@ -28,12 +28,9 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Is c a whitespace character? */
|
||||
#define IS_INV_WHITESPACE(c) ((c)==' ' || (c)=='\t' || (c)=='\r' || (c)=='\n')
|
||||
|
||||
U_CAPI const char * U_EXPORT2
|
||||
u_skipWhitespace(const char *s) {
|
||||
while(IS_INV_WHITESPACE(*s)) {
|
||||
while(U_IS_INV_WHITESPACE(*s)) {
|
||||
++s;
|
||||
}
|
||||
return s;
|
||||
|
@ -42,7 +39,7 @@ u_skipWhitespace(const char *s) {
|
|||
U_CAPI char * U_EXPORT2
|
||||
u_rtrim(char *s) {
|
||||
char *end=uprv_strchr(s, 0);
|
||||
while(s<end && IS_INV_WHITESPACE(*(end-1))) {
|
||||
while(s<end && U_IS_INV_WHITESPACE(*(end-1))) {
|
||||
*--end = 0;
|
||||
}
|
||||
return end;
|
||||
|
@ -126,7 +123,7 @@ u_parseDelimitedFile(const char *filename, char delimiter,
|
|||
limit=uprv_strchr(start, '#');
|
||||
if(limit!=NULL) {
|
||||
/* get white space before the pound sign */
|
||||
while(limit>start && IS_INV_WHITESPACE(*(limit-1))) {
|
||||
while(limit>start && U_IS_INV_WHITESPACE(*(limit-1))) {
|
||||
--limit;
|
||||
}
|
||||
|
||||
|
@ -210,7 +207,7 @@ u_parseCodePoints(const char *s,
|
|||
|
||||
/* read one code point */
|
||||
value=(uint32_t)uprv_strtoul(s, &end, 16);
|
||||
if(end<=s || (!IS_INV_WHITESPACE(*end) && *end!=';' && *end!=0) || value>=0x110000) {
|
||||
if(end<=s || (!U_IS_INV_WHITESPACE(*end) && *end!=';' && *end!=0) || value>=0x110000) {
|
||||
*pErrorCode=U_PARSE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -269,7 +266,7 @@ u_parseString(const char *s,
|
|||
|
||||
/* read one code point */
|
||||
value=(uint32_t)uprv_strtoul(s, &end, 16);
|
||||
if(end<=s || (!IS_INV_WHITESPACE(*end) && *end!=';' && *end!=0) || value>=0x110000) {
|
||||
if(end<=s || (!U_IS_INV_WHITESPACE(*end) && *end!=';' && *end!=0) || value>=0x110000) {
|
||||
*pErrorCode=U_PARSE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
/**
|
||||
* Is c an invariant-character whitespace?
|
||||
* @param c invariant character
|
||||
*/
|
||||
#define U_IS_INV_WHITESPACE(c) ((c)==' ' || (c)=='\t' || (c)=='\r' || (c)=='\n')
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue