mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-770 Make the tests build and/or run faster
X-SVN-Rev: 5659
This commit is contained in:
parent
7543c1c470
commit
e29f4f62c4
83 changed files with 403 additions and 613 deletions
|
@ -13,23 +13,10 @@
|
|||
#ifndef _ALLCOLL
|
||||
#define _ALLCOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _TBLCOLL
|
||||
#include "unicode/tblcoll.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationDummyTest: public IntlTest {
|
||||
class CollationDummyTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -12,23 +12,10 @@
|
|||
#ifndef _APICOLL
|
||||
#define _APICOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _TBLCOLL
|
||||
#include "unicode/tblcoll.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationAPITest: public IntlTest {
|
||||
class CollationAPITest: public IntlTestCollator {
|
||||
public:
|
||||
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = NULL */);
|
||||
void doAssert(UBool condition, const char *message);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef __CalendarLimitTest__
|
||||
#define __CalendarLimitTest__
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "caltztst.h"
|
||||
class Calendar;
|
||||
class DateFormat;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _CALENDARREGRESSIONTEST_
|
||||
#define _CALENDARREGRESSIONTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/calendar.h"
|
||||
|
||||
#include "intltest.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef __CalendarTest__
|
||||
#define __CalendarTest__
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "caltztst.h"
|
||||
#include "unicode/calendar.h"
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#ifndef _CALTZTST
|
||||
#define _CALTZTST
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "intltest.h"
|
||||
class SimpleDateFormat;
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
#ifndef CHARITERTEST_H
|
||||
#define CHARITERTEST_H
|
||||
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
|
@ -33,5 +36,5 @@ public:
|
|||
void TestIterationUChar32(void);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#ifndef CPDTRTST_H
|
||||
#define CPDTRTST_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/cpdtrans.h"
|
||||
#include "intltest.h"
|
||||
|
|
|
@ -12,27 +12,10 @@
|
|||
#ifndef _CURRCOLL
|
||||
#define _CURRCOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _COLEITR
|
||||
#include "unicode/coleitr.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
#ifndef _UNISTR
|
||||
#include "unicode/unistr.h"
|
||||
#endif
|
||||
|
||||
class CollationCurrencyTest: public IntlTest
|
||||
class CollationCurrencyTest: public IntlTestCollator
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -14,19 +14,9 @@
|
|||
#ifndef _DACOLL
|
||||
#define _DACOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationDanishTest: public IntlTest {
|
||||
class CollationDanishTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#define _INTLTESTDECIMALFORMATAPI
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -12,19 +12,9 @@
|
|||
#ifndef _DECOLL
|
||||
#define _DECOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationGermanTest: public IntlTest {
|
||||
class CollationGermanTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define _INTLTESTDATEFORMATAPI
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _DATEFORMATREGRESSIONTEST_
|
||||
#define _DATEFORMATREGRESSIONTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "caltztst.h"
|
||||
|
||||
class SimpleDateFormat;
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
#include "locale.h"
|
||||
#include "unicode/unistr.h"
|
||||
|
||||
class DateFormat;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _DATEFORMATTEST_
|
||||
#define _DATEFORMATTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "caltztst.h"
|
||||
#include "unicode/datefmt.h"
|
||||
|
||||
|
|
|
@ -14,19 +14,9 @@
|
|||
#ifndef _ENCOLL
|
||||
#define _ENCOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationEnglishTest: public IntlTest {
|
||||
class CollationEnglishTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -14,19 +14,9 @@
|
|||
#ifndef _ESCOLL
|
||||
#define _ESCOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationSpanishTest: public IntlTest {
|
||||
class CollationSpanishTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -13,19 +13,9 @@
|
|||
#ifndef _FICOLL
|
||||
#define _FICOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationFinnishTest: public IntlTest {
|
||||
class CollationFinnishTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -12,19 +12,9 @@
|
|||
#ifndef _FRCOLL
|
||||
#define _FRCOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationFrenchTest: public IntlTest {
|
||||
class CollationFrenchTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -31,12 +31,10 @@
|
|||
#ifndef _G7COLL
|
||||
#define _G7COLL
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/coll.h"
|
||||
#include "unicode/tblcoll.h"
|
||||
#include "intltest.h"
|
||||
#include "tscoll.h"
|
||||
|
||||
class G7CollationTest: public IntlTest {
|
||||
class G7CollationTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#ifndef HANGTOJAMOTRTST_H
|
||||
#define HANGTOJAMOTRTST_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/hangjamo.h"
|
||||
#include "intltest.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#ifndef HEXTOUNITRTST_H
|
||||
#define HEXTOUNITRTST_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/hextouni.h"
|
||||
#include "intltest.h"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/ures.h"
|
||||
|
@ -169,79 +170,6 @@ UnicodeString operator+(const UnicodeString& left, float num)
|
|||
|
||||
//------------------
|
||||
|
||||
// used for collation result reporting, defined here for convenience
|
||||
// (maybe moved later)
|
||||
void
|
||||
IntlTest::reportCResult( UnicodeString &source, UnicodeString &target,
|
||||
CollationKey &sourceKey, CollationKey &targetKey,
|
||||
Collator::EComparisonResult compareResult,
|
||||
Collator::EComparisonResult keyResult,
|
||||
Collator::EComparisonResult incResult,
|
||||
Collator::EComparisonResult expectedResult )
|
||||
{
|
||||
if (expectedResult < -1 || expectedResult > 1)
|
||||
{
|
||||
errln("***** invalid call to reportCResult ****");
|
||||
return;
|
||||
}
|
||||
|
||||
UBool ok1 = (compareResult == expectedResult);
|
||||
UBool ok2 = (keyResult == expectedResult);
|
||||
UBool ok3 = (incResult == expectedResult);
|
||||
|
||||
|
||||
if (ok1 && ok2 && ok3 && !verbose) {
|
||||
// Keep non-verbose, passing tests fast
|
||||
return;
|
||||
} else {
|
||||
UnicodeString msg1(ok1 ? "Ok: compare(" : "FAIL: compare(");
|
||||
UnicodeString msg2(", "), msg3(") returned "), msg4("; expected ");
|
||||
UnicodeString prettySource, prettyTarget, sExpect, sResult;
|
||||
|
||||
prettify(source, prettySource);
|
||||
prettify(target, prettyTarget);
|
||||
appendCompareResult(compareResult, sResult);
|
||||
appendCompareResult(expectedResult, sExpect);
|
||||
|
||||
if (ok1) {
|
||||
logln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult);
|
||||
} else {
|
||||
errln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult + msg4 + sExpect);
|
||||
}
|
||||
|
||||
msg1 = UnicodeString(ok2 ? "Ok: key(" : "FAIL: key(");
|
||||
msg2 = ").compareTo(key(";
|
||||
msg3 = ")) returned ";
|
||||
|
||||
appendCompareResult(keyResult, sResult);
|
||||
|
||||
if (ok2) {
|
||||
logln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult);
|
||||
} else {
|
||||
errln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult + msg4 + sExpect);
|
||||
|
||||
msg1 = " ";
|
||||
msg2 = " vs. ";
|
||||
|
||||
prettify(sourceKey, prettySource);
|
||||
prettify(targetKey, prettyTarget);
|
||||
|
||||
errln(msg1 + prettySource + msg2 + prettyTarget);
|
||||
}
|
||||
msg1 = UnicodeString (ok3 ? "Ok: incCompare(" : "FAIL: incCompare(");
|
||||
msg2 = ", ";
|
||||
msg3 = ") returned ";
|
||||
|
||||
appendCompareResult(incResult, sResult);
|
||||
|
||||
if (ok3) {
|
||||
logln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult);
|
||||
} else {
|
||||
errln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult + msg4 + sExpect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Append a hex string to the target
|
||||
UnicodeString&
|
||||
IntlTest::appendHex(uint32_t number,
|
||||
|
@ -278,32 +206,6 @@ IntlTest::appendHex(uint32_t number,
|
|||
return target;
|
||||
}
|
||||
|
||||
UnicodeString&
|
||||
IntlTest::appendCompareResult(Collator::EComparisonResult result,
|
||||
UnicodeString& target)
|
||||
{
|
||||
if (result == Collator::LESS)
|
||||
{
|
||||
target += "LESS";
|
||||
}
|
||||
else if (result == Collator::EQUAL)
|
||||
{
|
||||
target += "EQUAL";
|
||||
}
|
||||
else if (result == Collator::GREATER)
|
||||
{
|
||||
target += "GREATER";
|
||||
}
|
||||
else
|
||||
{
|
||||
UnicodeString huh = "?";
|
||||
|
||||
target += (huh + (int32_t)result);
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
// Replace nonprintable characters with unicode escapes
|
||||
UnicodeString&
|
||||
IntlTest::prettify(const UnicodeString &source,
|
||||
|
@ -391,26 +293,6 @@ IntlTest::prettify(const UnicodeString &source, UBool parseBackslash)
|
|||
return target;
|
||||
}
|
||||
|
||||
// Produce a printable representation of a CollationKey
|
||||
UnicodeString &IntlTest::prettify(const CollationKey &source, UnicodeString &target)
|
||||
{
|
||||
int32_t i, byteCount;
|
||||
const uint8_t *bytes = source.getByteArray(byteCount);
|
||||
|
||||
target.remove();
|
||||
target += "[";
|
||||
|
||||
for (i = 0; i < byteCount; i += 1)
|
||||
{
|
||||
appendHex(bytes[i], 2, target);
|
||||
target += " ";
|
||||
}
|
||||
|
||||
target += "]";
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(WIN32) || defined(__OS2__) || defined(OS2)
|
||||
#define PREV_DIR ".."
|
||||
#else
|
||||
|
@ -878,29 +760,35 @@ void IntlTest::errln( const UnicodeString &message )
|
|||
/* convenience functions that include sprintf formatting */
|
||||
void IntlTest::log(const char *fmt, ...)
|
||||
{
|
||||
char buffer[300];
|
||||
char buffer[512];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
/* sprintf it just to make sure that the information is valid */
|
||||
vsprintf(buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
log(UnicodeString(buffer, ""));
|
||||
if( verbose ) {
|
||||
log(UnicodeString(buffer, ""));
|
||||
}
|
||||
}
|
||||
|
||||
void IntlTest::logln(const char *fmt, ...)
|
||||
{
|
||||
char buffer[300];
|
||||
char buffer[512];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
/* sprintf it just to make sure that the information is valid */
|
||||
vsprintf(buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
logln(UnicodeString(buffer, ""));
|
||||
if( verbose ) {
|
||||
logln(UnicodeString(buffer, ""));
|
||||
}
|
||||
}
|
||||
|
||||
void IntlTest::err(const char *fmt, ...)
|
||||
{
|
||||
char buffer[300];
|
||||
char buffer[512];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
@ -911,7 +799,7 @@ void IntlTest::err(const char *fmt, ...)
|
|||
|
||||
void IntlTest::errln(const char *fmt, ...)
|
||||
{
|
||||
char buffer[300];
|
||||
char buffer[512];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
|
|
@ -133,10 +133,6 @@ SOURCE=.\cppcnvt.cpp
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cputilst.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\currcoll.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -469,10 +465,6 @@ SOURCE=.\cppcnvt.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cputilst.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\currcoll.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -12,13 +12,11 @@
|
|||
#define _INTLTEST
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/coll.h"
|
||||
#include "unicode/sortkey.h"
|
||||
#include "unicode/fmtable.h" // liu
|
||||
|
||||
class Formattable;
|
||||
|
||||
#ifdef OS390
|
||||
// avoid collision with math.h/log()
|
||||
|
@ -137,18 +135,10 @@ protected:
|
|||
virtual void LL_message( UnicodeString message, UBool newline );
|
||||
|
||||
// used for collation result reporting, defined here for convenience
|
||||
virtual void reportCResult( UnicodeString &source, UnicodeString &target,
|
||||
CollationKey &sourceKey, CollationKey &targetKey,
|
||||
Collator::EComparisonResult compareResult,
|
||||
Collator::EComparisonResult keyResult,
|
||||
Collator::EComparisonResult incResult,
|
||||
Collator::EComparisonResult expectedResult );
|
||||
|
||||
static UnicodeString &prettify(const UnicodeString &source, UnicodeString &target);
|
||||
static UnicodeString prettify(const UnicodeString &source, UBool parseBackslash=FALSE);
|
||||
static UnicodeString &prettify(const CollationKey &source, UnicodeString &target);
|
||||
static UnicodeString &appendHex(uint32_t number, int8_t digits, UnicodeString &target);
|
||||
static UnicodeString &appendCompareResult(Collator::EComparisonResult result, UnicodeString &target);
|
||||
|
||||
/* complete a relative path to a full pathname, and convert to platform-specific syntax. */
|
||||
/* The character seperating directories for the relative path is '|'. */
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#define _INTLTESTCONVERT
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -12,31 +12,11 @@
|
|||
#ifndef _ITERCOLL
|
||||
#define _ITERCOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _TBLCOLL
|
||||
#include "unicode/tblcoll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _COLEITR
|
||||
#include "unicode/coleitr.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
#ifndef _UNISTR
|
||||
#include "unicode/unistr.h"
|
||||
#endif
|
||||
|
||||
class CollationIteratorTest: public IntlTest
|
||||
class CollationIteratorTest: public IntlTestCollator
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#define _INTLTESTFORMAT
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#define _INTLTESTMAJOR
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#define INTLTESTRBBI_H
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#define INTLTRANSLIT_H
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#define _INTLTESTTEXTBOUNDARY
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
#include "unicode/brkiter.h"
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#define _INTLTESTUTILITIES
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -13,19 +13,9 @@
|
|||
#ifndef _JACOLL
|
||||
#define _JACOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationKanaTest: public IntlTest {
|
||||
class CollationKanaTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#ifndef JAMOTOHANGTRTST_H
|
||||
#define JAMOTOHANGTRTST_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/jamohang.h"
|
||||
#include "intltest.h"
|
||||
|
|
|
@ -5,19 +5,12 @@
|
|||
********************************************************************/
|
||||
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
#ifndef LOTUSCOLLATIONKOREANTEST_H
|
||||
#define LOTUSCOLLATIONKOREANTEST_H
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class LotusCollationKoreanTest: public IntlTest {
|
||||
class LotusCollationKoreanTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
@ -40,3 +33,4 @@ private:
|
|||
|
||||
Collator *myCollation;
|
||||
};
|
||||
#endif
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _DATEFORMATMISCTEST_
|
||||
#define _DATEFORMATMISCTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,19 +14,9 @@
|
|||
#ifndef _MNKYTST
|
||||
#define _MNKYTST
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationMonkeyTest: public IntlTest {
|
||||
class CollationMonkeyTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _MESSAGEFORMATREGRESSIONTEST_
|
||||
#define _MESSAGEFORMATREGRESSIONTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define _INTLTESTNUMBERFORMATAPI
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define _NUMBERFORMATROUNDTRIPTEST_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
#include "unicode/fmtable.h"
|
||||
|
@ -24,59 +23,59 @@ class NumberFormatRoundTripTest : public IntlTest {
|
|||
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
|
||||
public:
|
||||
|
||||
static UBool verbose;
|
||||
static UBool STRING_COMPARE;
|
||||
static UBool EXACT_NUMERIC_COMPARE;
|
||||
static UBool DEBUG;
|
||||
static double MAX_ERROR;
|
||||
static double max_numeric_error;
|
||||
static double min_numeric_error;
|
||||
static UBool verbose;
|
||||
static UBool STRING_COMPARE;
|
||||
static UBool EXACT_NUMERIC_COMPARE;
|
||||
static UBool DEBUG;
|
||||
static double MAX_ERROR;
|
||||
static double max_numeric_error;
|
||||
static double min_numeric_error;
|
||||
|
||||
|
||||
void start(void);
|
||||
void start(void);
|
||||
|
||||
void test(NumberFormat *fmt);
|
||||
void test(NumberFormat *fmt, double value);
|
||||
void test(NumberFormat *fmt, int32_t value);
|
||||
void test(NumberFormat *fmt, const Formattable& value);
|
||||
void test(NumberFormat *fmt);
|
||||
void test(NumberFormat *fmt, double value);
|
||||
void test(NumberFormat *fmt, int32_t value);
|
||||
void test(NumberFormat *fmt, const Formattable& value);
|
||||
|
||||
static double randomDouble(double range);
|
||||
static double proportionalError(const Formattable& a, const Formattable& b);
|
||||
static UnicodeString& typeOf(const Formattable& n, UnicodeString& result);
|
||||
static UnicodeString& escape(UnicodeString& s);
|
||||
static double randomDouble(double range);
|
||||
static double proportionalError(const Formattable& a, const Formattable& b);
|
||||
static UnicodeString& typeOf(const Formattable& n, UnicodeString& result);
|
||||
static UnicodeString& escape(UnicodeString& s);
|
||||
|
||||
static UBool
|
||||
isDouble(const Formattable& n)
|
||||
{ return (n.getType() == Formattable::kDouble); }
|
||||
static inline UBool
|
||||
isDouble(const Formattable& n)
|
||||
{ return (n.getType() == Formattable::kDouble); }
|
||||
|
||||
static UBool
|
||||
isLong(const Formattable& n)
|
||||
{ return (n.getType() == Formattable::kLong); }
|
||||
static inline UBool
|
||||
isLong(const Formattable& n)
|
||||
{ return (n.getType() == Formattable::kLong); }
|
||||
|
||||
/*
|
||||
* Return a random uint32_t
|
||||
**/
|
||||
static uint32_t randLong()
|
||||
{
|
||||
// Assume 8-bit (or larger) rand values. Also assume
|
||||
// that the system rand() function is very poor, which it always is.
|
||||
uint32_t d;
|
||||
uint32_t i;
|
||||
char* poke = (char*)&d;
|
||||
for (i=0; i < sizeof(uint32_t); ++i)
|
||||
/*
|
||||
* Return a random uint32_t
|
||||
**/
|
||||
static uint32_t randLong()
|
||||
{
|
||||
poke[i] = (char)(rand() & 0xFF);
|
||||
// Assume 8-bit (or larger) rand values. Also assume
|
||||
// that the system rand() function is very poor, which it always is.
|
||||
uint32_t d;
|
||||
uint32_t i;
|
||||
char* poke = (char*)&d;
|
||||
for (i=0; i < sizeof(uint32_t); ++i)
|
||||
{
|
||||
poke[i] = (char)(rand() & 0xFF);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a random double 0 <= x < 1.0
|
||||
**/
|
||||
static double randFraction()
|
||||
{
|
||||
return (double)randLong() / (double)0xFFFFFFFF;
|
||||
}
|
||||
/**
|
||||
* Return a random double 0 <= x < 1.0
|
||||
**/
|
||||
static double randFraction()
|
||||
{
|
||||
return (double)randLong() / (double)0xFFFFFFFF;
|
||||
}
|
||||
|
||||
protected:
|
||||
UBool failure(UErrorCode status, const char* msg);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _NUMBERFORMATTEST_
|
||||
#define _NUMBERFORMATTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "caltztst.h"
|
||||
class NumberFormat;
|
||||
class DecimalFormat;
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
#ifndef _NUMBERFORMATREGRESSIONTEST_
|
||||
#define _NUMBERFORMATREGRESSIONTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/numfmt.h"
|
||||
|
||||
#include "intltest.h"
|
||||
|
||||
#include "unicode/numfmt.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _PARSEPOSITIONIONTEST_
|
||||
#define _PARSEPOSITIONIONTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#define RBBIAPITEST_H
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
#include "unicode/rbbi.h"
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#define RBBITEST_H
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
#include "unicode/brkiter.h"
|
||||
|
||||
|
|
|
@ -12,27 +12,10 @@
|
|||
#ifndef _REGCOLL
|
||||
#define _REGCOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _COLEITR
|
||||
#include "unicode/coleitr.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
#ifndef _UNISTR
|
||||
#include "unicode/unistr.h"
|
||||
#endif
|
||||
|
||||
class CollationRegressionTest: public IntlTest
|
||||
class CollationRegressionTest: public IntlTestCollator
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
#ifndef RESOURCEBUNDLETEST_H
|
||||
#define RESOURCEBUNDLETEST_H
|
||||
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
|
@ -46,3 +49,4 @@ private:
|
|||
IntlTest& OUT;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NEW_RESOURCEBUNDLETEST_H
|
||||
#define NEW_RESOURCEBUNDLETEST_H
|
||||
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
|
@ -50,3 +53,4 @@ private:
|
|||
IntlTest& OUT;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define _INTLTESTSIMPLEDATEFORMATAPI
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef SFDWCHIT_H
|
||||
#define SFDWCHIT_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/chariter.h"
|
||||
|
||||
class SimpleFwdCharIterator : public ForwardCharacterIterator {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _STRSRCH_H
|
||||
#define _STRSRCH_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/tblcoll.h"
|
||||
#include "unicode/brkiter.h"
|
||||
#include "intltest.h"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#ifndef __STRTEST_H__
|
||||
#define __STRTEST_H__
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
class StringTest : public IntlTest {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ int8_t TestUtility::getBlock(UChar c) {
|
|||
while (block < 0) { // take care of exceptions, blocks split across 128 boundaries
|
||||
const Split *tuple = &gTestUtilitySplit[-block-1];
|
||||
if (c < tuple->ch)
|
||||
block = tuple->i1;
|
||||
return tuple->i1; // Always positive or == 0
|
||||
else
|
||||
block = tuple->i2;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#ifndef TESTUTIL_H
|
||||
#define TESTUTIL_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
class UnicodeString;
|
||||
#include "unicode/unistr.h"
|
||||
|
||||
/**
|
||||
* Utility methods. Everything in this class is static -- do not
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#ifndef TESTFORMATSMALLCLASSES_H
|
||||
#define TESTFORMATSMALLCLASSES_H
|
||||
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
|
@ -20,3 +23,5 @@ class TestFormatSmallClasses: public IntlTest {
|
|||
**/
|
||||
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -136,7 +136,7 @@ void CollationThaiTest::TestDictionary(void) {
|
|||
++wordCount;
|
||||
if (wordCount <= 8) {
|
||||
UnicodeString str;
|
||||
logln((UnicodeString)"Word " + wordCount + ": " + prettify(word, str));
|
||||
logln((UnicodeString)"Word " + wordCount + ": " + IntlTest::prettify(word, str));
|
||||
}
|
||||
|
||||
if (lastWord.length() > 0) {
|
||||
|
@ -149,9 +149,9 @@ void CollationThaiTest::TestDictionary(void) {
|
|||
UnicodeString msg =
|
||||
UnicodeString("--------------------------------------------\n")
|
||||
+ line
|
||||
+ " compare(" + prettify(lastWord, str);
|
||||
+ " compare(" + IntlTest::prettify(lastWord, str);
|
||||
msg += UnicodeString(", ")
|
||||
+ prettify(word, str) + ") returned " + result
|
||||
+ IntlTest::prettify(word, str) + ") returned " + result
|
||||
+ ", expected -1\n";
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
CollationKey k1, k2;
|
||||
|
@ -265,8 +265,8 @@ void CollationThaiTest::compareArray(const Collator& c, const char* tests[],
|
|||
{
|
||||
UnicodeString t1, t2;
|
||||
errln(UnicodeString("") +
|
||||
i/3 + ": compare(" + prettify(s1, t1)
|
||||
+ " , " + prettify(s2, t2)
|
||||
i/3 + ": compare(" + IntlTest::prettify(s1, t1)
|
||||
+ " , " + IntlTest::prettify(s2, t2)
|
||||
+ ") got " + result + "; expected " + expect);
|
||||
|
||||
CollationKey k1, k2;
|
||||
|
@ -294,8 +294,8 @@ void CollationThaiTest::compareArray(const Collator& c, const char* tests[],
|
|||
if (sign(result) != sign(expect)) {
|
||||
UnicodeString t1, t2;
|
||||
errln(UnicodeString("") +
|
||||
i/3 + ": key(" + prettify(s1, t1)
|
||||
+ ").compareTo(key(" + prettify(s2, t2)
|
||||
i/3 + ": key(" + IntlTest::prettify(s1, t1)
|
||||
+ ").compareTo(key(" + IntlTest::prettify(s2, t2)
|
||||
+ ")) got " + result + "; expected " + expect);
|
||||
|
||||
errln((UnicodeString)" " + prettify(k1, t1) + " vs. " + prettify(k2, t2));
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
**********************************************************************
|
||||
*/
|
||||
|
||||
#include "intltest.h"
|
||||
#ifndef COLLATIONTHAITEST_H
|
||||
#define COLLATIONTHAITEST_H
|
||||
|
||||
class Collator;
|
||||
class UnicodeString;
|
||||
#include "tscoll.h"
|
||||
|
||||
class CollationThaiTest : public IntlTest {
|
||||
class CollationThaiTest : public IntlTestCollator {
|
||||
Collator* coll; // Thai collator
|
||||
|
||||
public:
|
||||
|
@ -53,3 +53,5 @@ private:
|
|||
UnicodeString& parseChars(UnicodeString& result,
|
||||
const char* chars);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#ifndef _TESTMESSAGEFORMAT
|
||||
#define _TESTMESSAGEFORMAT
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
class Formattable;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "unicode/rep.h"
|
||||
#include "unicode/locid.h"
|
||||
|
||||
int32_t getInt(UnicodeString str)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#ifndef TRANSAPI_H
|
||||
#define TRANSAPI_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/translit.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
|
|
@ -215,125 +215,6 @@ void RTTest::test(const UnicodeString& sourceRangeVal,
|
|||
}
|
||||
}
|
||||
|
||||
void RTTest::test2() {
|
||||
|
||||
UChar c;
|
||||
UnicodeString cs, targ, reverse;
|
||||
int8_t *type = new int8_t[0xFFFF];
|
||||
UParseError parseError;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
Transliterator* sourceToTarget = Transliterator::createInstance(transliteratorID, UTRANS_FORWARD, parseError, status);
|
||||
if (sourceToTarget == NULL) {
|
||||
log->errln("Fail: createInstance(" + transliteratorID +
|
||||
") returned NULL");
|
||||
return;
|
||||
}
|
||||
Transliterator* targetToSource = sourceToTarget->createInverse(status);
|
||||
if (targetToSource == NULL) {
|
||||
log->errln("Fail: " + transliteratorID +
|
||||
".createInverse() returned NULL");
|
||||
delete sourceToTarget;
|
||||
return;
|
||||
}
|
||||
|
||||
log->logln("Initializing type array");
|
||||
|
||||
for (c = 0; c < 0xFFFF; ++c) {
|
||||
type[c] = Unicode::getType(c);
|
||||
}
|
||||
|
||||
log->logln("Checking that all source characters convert to target - Singles");
|
||||
|
||||
for (c = 0; c < 0xFFFF; ++c) {
|
||||
if (type[c] == Unicode::UNASSIGNED || !isSource(c))
|
||||
continue;
|
||||
cs.remove(); cs.append(c);
|
||||
targ = cs;
|
||||
sourceToTarget->transliterate(targ);
|
||||
if (!isReceivingTarget(targ)) {
|
||||
logWrongScript("Source-Target", cs, targ);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
log->logln("Checking that all source characters convert to target - Doubles");
|
||||
|
||||
for (c = 0; c < 0xFFFF; ++c) {
|
||||
if (type[c] == Unicode::UNASSIGNED ||
|
||||
!isSource(c)) continue;
|
||||
for (UChar d = 0; d < 0xFFFF; ++d) {
|
||||
if (type[d] == Unicode::UNASSIGNED || !isSource(d))
|
||||
continue;
|
||||
cs.remove(); cs.append(c).append(d);
|
||||
targ = cs;
|
||||
sourceToTarget->transliterate(targ);
|
||||
if (!isReceivingTarget(targ)) {
|
||||
logWrongScript("Source-Target", cs, targ);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log->logln("Checking that target characters convert to source and back - Singles");
|
||||
|
||||
for (c = 0; c < 0xFFFF; ++c) {
|
||||
if (type[c] == Unicode::UNASSIGNED || !isTarget(c))
|
||||
continue;
|
||||
cs.remove(); cs.append(c);
|
||||
targ = cs;
|
||||
targetToSource->transliterate(targ);
|
||||
reverse = targ;
|
||||
sourceToTarget->transliterate(reverse);
|
||||
if (!isReceivingSource(targ)) {
|
||||
logWrongScript("Target-Source", cs, targ);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
} else if (cs != reverse) {
|
||||
logRoundTripFailure(cs, targ, reverse);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
log->logln("Checking that target characters convert to source and back - Doubles");
|
||||
int32_t count = 0;
|
||||
cs = UNICODE_STRING("aa", 2);
|
||||
for (c = 0; c < 0xFFFF; ++c) {
|
||||
if (type[c] == Unicode::UNASSIGNED || !isTarget(c))
|
||||
continue;
|
||||
if (++count > pairLimit) {
|
||||
//throw new TestTruncated("Test truncated at " + pairLimit + " x 64k pairs");
|
||||
log->logln("");
|
||||
log->logln((UnicodeString)"Test truncated at " + pairLimit + " x 64k pairs");
|
||||
return;
|
||||
}
|
||||
cs.setCharAt(0, c);
|
||||
log->logln(TestUtility::hex(c));
|
||||
for (UChar d = 0; d < 0xFFFF; ++d) {
|
||||
if (type[d] == Unicode::UNASSIGNED || !isTarget(d))
|
||||
continue;
|
||||
cs.setCharAt(1, d);
|
||||
targ = cs;
|
||||
targetToSource->transliterate(targ);
|
||||
reverse = targ;
|
||||
sourceToTarget->transliterate(reverse);
|
||||
if (!isReceivingSource(targ)) {
|
||||
logWrongScript("Target-Source", cs, targ);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
} else if (cs != reverse) {
|
||||
logRoundTripFailure(cs, targ, reverse);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
log->logln("");
|
||||
delete []type;
|
||||
}
|
||||
|
||||
void RTTest::logWrongScript(const UnicodeString& label,
|
||||
const UnicodeString& from,
|
||||
const UnicodeString& to) {
|
||||
|
@ -378,7 +259,7 @@ void RTTest::logRoundTripFailure(const UnicodeString& from,
|
|||
* Default is ASCII letters for Latin
|
||||
*/
|
||||
UBool RTTest::isSource(UChar c) {
|
||||
return (TestUtility::getScript(c) == sourceScript && Unicode::isLetter(c)
|
||||
return (TestUtility::getScript(c) == sourceScript && u_isalpha(c)
|
||||
&& sourceRange.contains(c));
|
||||
}
|
||||
|
||||
|
@ -398,7 +279,7 @@ RTTest::isReceivingSource(UChar c) {
|
|||
*/
|
||||
inline UBool
|
||||
RTTest::isTarget(UChar c) {
|
||||
return (TestUtility::getScript(c) == targetScript && Unicode::isLetter(c)
|
||||
return (TestUtility::getScript(c) == targetScript && u_isalpha(c)
|
||||
&& (targetRange.isEmpty() || targetRange.contains(c)));
|
||||
}
|
||||
|
||||
|
@ -465,9 +346,11 @@ RTHangulTest::RTHangulTest() : RTTest("Jamo-Hangul",
|
|||
|
||||
UBool RTHangulTest::isSource(UChar c)
|
||||
{
|
||||
if (0x1113 <= c && c <= 0x1160) return FALSE;
|
||||
if (0x1176 <= c && c <= 0x11F9) return FALSE;
|
||||
if (0x3131 <= c && c <= 0x318E) return FALSE;
|
||||
if ((0x1113 <= c && c <= 0x1160)
|
||||
|| (0x1176 <= c && c <= 0x11F9)
|
||||
|| (0x3131 <= c && c <= 0x318E)) {
|
||||
return FALSE;
|
||||
}
|
||||
return RTTest::isSource(c);
|
||||
}
|
||||
|
||||
|
@ -530,3 +413,126 @@ void TransliteratorRoundTripTest::TestCyrillic() {
|
|||
TestUtility::LATIN_SCRIPT, TestUtility::CYRILLIC_SCRIPT);
|
||||
test.test("", UnicodeString("[\\u0401\\u0410-\\u044F\\u0451]", ""), this);
|
||||
}
|
||||
|
||||
void RTTest::test2() {
|
||||
|
||||
UChar c;
|
||||
UnicodeString cs, targ, reverse;
|
||||
int8_t *type = new int8_t[0xFFFF];
|
||||
UParseError parseError;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
Transliterator* sourceToTarget = Transliterator::createInstance(transliteratorID, UTRANS_FORWARD, parseError, status);
|
||||
if (sourceToTarget == NULL) {
|
||||
log->errln("Fail: createInstance(" + transliteratorID +
|
||||
") returned NULL");
|
||||
return;
|
||||
}
|
||||
Transliterator* targetToSource = sourceToTarget->createInverse(status);
|
||||
if (targetToSource == NULL) {
|
||||
log->errln("Fail: " + transliteratorID +
|
||||
".createInverse() returned NULL");
|
||||
delete sourceToTarget;
|
||||
return;
|
||||
}
|
||||
|
||||
log->logln("Initializing type array");
|
||||
|
||||
for (c = 0; c < 0xFFFF; ++c) {
|
||||
type[c] = u_charType(c);
|
||||
}
|
||||
|
||||
log->logln("Checking that all source characters convert to target - Singles");
|
||||
|
||||
for (c = 0; c < 0xFFFF; ++c) {
|
||||
if (type[c] == U_UNASSIGNED || !isSource(c))
|
||||
continue;
|
||||
cs.remove();
|
||||
cs.append(c);
|
||||
targ = cs;
|
||||
sourceToTarget->transliterate(targ);
|
||||
if (!isReceivingTarget(targ)) {
|
||||
logWrongScript("Source-Target", cs, targ);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
log->logln("Checking that all source characters convert to target - Doubles");
|
||||
|
||||
for (c = 0; c < 0xFFFF; ++c) {
|
||||
if (type[c] == U_UNASSIGNED ||
|
||||
!isSource(c)) continue;
|
||||
for (UChar d = 0; d < 0xFFFF; ++d) {
|
||||
if (type[d] == U_UNASSIGNED || !isSource(d))
|
||||
continue;
|
||||
cs.remove();
|
||||
cs.append(c).append(d);
|
||||
targ = cs;
|
||||
sourceToTarget->transliterate(targ);
|
||||
if (!isReceivingTarget(targ)) {
|
||||
logWrongScript("Source-Target", cs, targ);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log->logln("Checking that target characters convert to source and back - Singles");
|
||||
|
||||
for (c = 0; c < 0xFFFF; ++c) {
|
||||
if (type[c] == U_UNASSIGNED || !isTarget(c))
|
||||
continue;
|
||||
cs.remove();
|
||||
cs.append(c);
|
||||
targ = cs;
|
||||
targetToSource->transliterate(targ);
|
||||
reverse = targ;
|
||||
sourceToTarget->transliterate(reverse);
|
||||
if (!isReceivingSource(targ)) {
|
||||
logWrongScript("Target-Source", cs, targ);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
} else if (cs != reverse) {
|
||||
logRoundTripFailure(cs, targ, reverse);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
log->logln("Checking that target characters convert to source and back - Doubles");
|
||||
int32_t count = 0;
|
||||
cs = UNICODE_STRING("aa", 2);
|
||||
for (c = 0; c < 0xFFFF; ++c) {
|
||||
if (type[c] == U_UNASSIGNED || !isTarget(c))
|
||||
continue;
|
||||
if (++count > pairLimit) {
|
||||
//throw new TestTruncated("Test truncated at " + pairLimit + " x 64k pairs");
|
||||
log->logln("");
|
||||
log->logln((UnicodeString)"Test truncated at " + pairLimit + " x 64k pairs");
|
||||
return;
|
||||
}
|
||||
cs.setCharAt(0, c);
|
||||
log->logln(TestUtility::hex(c));
|
||||
for (UChar d = 0; d < 0xFFFF; ++d) {
|
||||
if (type[d] == U_UNASSIGNED || !isTarget(d))
|
||||
continue;
|
||||
cs.setCharAt(1, d);
|
||||
targ = cs;
|
||||
targetToSource->transliterate(targ);
|
||||
reverse = targ;
|
||||
sourceToTarget->transliterate(reverse);
|
||||
if (!isReceivingSource(targ)) {
|
||||
logWrongScript("Target-Source", cs, targ);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
} else if (cs != reverse) {
|
||||
logRoundTripFailure(cs, targ, reverse);
|
||||
if (errorCount >= errorLimit)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
log->logln("");
|
||||
delete []type;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#ifndef TRANSRT_H
|
||||
#define TRANSRT_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
class Transliterator;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#ifndef TRANSTST_H
|
||||
#define TRANSTST_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/translit.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
|
|
@ -13,19 +13,9 @@
|
|||
#ifndef _TRCOLL
|
||||
#define _TRCOLL
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
#include "tscoll.h"
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class CollationTurkishTest: public IntlTest {
|
||||
class CollationTurkishTest: public IntlTestCollator {
|
||||
public:
|
||||
// If this is too small for the test data, just increase it.
|
||||
// Just don't make it too large, otherwise the executable will get too big
|
||||
|
|
|
@ -299,3 +299,122 @@ void IntlTestCollator::runIndexedTest( int32_t index, UBool exec, const char* &n
|
|||
}
|
||||
}
|
||||
|
||||
// used for collation result reporting, defined here for convenience
|
||||
// (maybe moved later)
|
||||
void
|
||||
IntlTestCollator::reportCResult( UnicodeString &source, UnicodeString &target,
|
||||
CollationKey &sourceKey, CollationKey &targetKey,
|
||||
Collator::EComparisonResult compareResult,
|
||||
Collator::EComparisonResult keyResult,
|
||||
Collator::EComparisonResult incResult,
|
||||
Collator::EComparisonResult expectedResult )
|
||||
{
|
||||
if (expectedResult < -1 || expectedResult > 1)
|
||||
{
|
||||
errln("***** invalid call to reportCResult ****");
|
||||
return;
|
||||
}
|
||||
|
||||
UBool ok1 = (compareResult == expectedResult);
|
||||
UBool ok2 = (keyResult == expectedResult);
|
||||
UBool ok3 = (incResult == expectedResult);
|
||||
|
||||
|
||||
if (ok1 && ok2 && ok3 && !verbose) {
|
||||
// Keep non-verbose, passing tests fast
|
||||
return;
|
||||
} else {
|
||||
UnicodeString msg1(ok1 ? "Ok: compare(" : "FAIL: compare(");
|
||||
UnicodeString msg2(", "), msg3(") returned "), msg4("; expected ");
|
||||
UnicodeString prettySource, prettyTarget, sExpect, sResult;
|
||||
|
||||
IntlTest::prettify(source, prettySource);
|
||||
IntlTest::prettify(target, prettyTarget);
|
||||
appendCompareResult(compareResult, sResult);
|
||||
appendCompareResult(expectedResult, sExpect);
|
||||
|
||||
if (ok1) {
|
||||
logln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult);
|
||||
} else {
|
||||
errln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult + msg4 + sExpect);
|
||||
}
|
||||
|
||||
msg1 = UnicodeString(ok2 ? "Ok: key(" : "FAIL: key(");
|
||||
msg2 = ").compareTo(key(";
|
||||
msg3 = ")) returned ";
|
||||
|
||||
appendCompareResult(keyResult, sResult);
|
||||
|
||||
if (ok2) {
|
||||
logln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult);
|
||||
} else {
|
||||
errln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult + msg4 + sExpect);
|
||||
|
||||
msg1 = " ";
|
||||
msg2 = " vs. ";
|
||||
|
||||
prettify(sourceKey, prettySource);
|
||||
prettify(targetKey, prettyTarget);
|
||||
|
||||
errln(msg1 + prettySource + msg2 + prettyTarget);
|
||||
}
|
||||
msg1 = UnicodeString (ok3 ? "Ok: incCompare(" : "FAIL: incCompare(");
|
||||
msg2 = ", ";
|
||||
msg3 = ") returned ";
|
||||
|
||||
appendCompareResult(incResult, sResult);
|
||||
|
||||
if (ok3) {
|
||||
logln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult);
|
||||
} else {
|
||||
errln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult + msg4 + sExpect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UnicodeString&
|
||||
IntlTestCollator::appendCompareResult(Collator::EComparisonResult result,
|
||||
UnicodeString& target)
|
||||
{
|
||||
if (result == Collator::LESS)
|
||||
{
|
||||
target += "LESS";
|
||||
}
|
||||
else if (result == Collator::EQUAL)
|
||||
{
|
||||
target += "EQUAL";
|
||||
}
|
||||
else if (result == Collator::GREATER)
|
||||
{
|
||||
target += "GREATER";
|
||||
}
|
||||
else
|
||||
{
|
||||
UnicodeString huh = "?";
|
||||
|
||||
target += (huh + (int32_t)result);
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
// Produce a printable representation of a CollationKey
|
||||
UnicodeString &IntlTestCollator::prettify(const CollationKey &source, UnicodeString &target)
|
||||
{
|
||||
int32_t i, byteCount;
|
||||
const uint8_t *bytes = source.getByteArray(byteCount);
|
||||
|
||||
target.remove();
|
||||
target += "[";
|
||||
|
||||
for (i = 0; i < byteCount; i += 1)
|
||||
{
|
||||
appendHex(bytes[i], 2, target);
|
||||
target += " ";
|
||||
}
|
||||
|
||||
target += "]";
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,12 +12,23 @@
|
|||
#define _INTLTESTCOLLATOR
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
#include "unicode/coll.h"
|
||||
#include "unicode/sortkey.h"
|
||||
|
||||
|
||||
class IntlTestCollator: public IntlTest {
|
||||
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
||||
protected:
|
||||
virtual void reportCResult( UnicodeString &source, UnicodeString &target,
|
||||
CollationKey &sourceKey, CollationKey &targetKey,
|
||||
Collator::EComparisonResult compareResult,
|
||||
Collator::EComparisonResult keyResult,
|
||||
Collator::EComparisonResult incResult,
|
||||
Collator::EComparisonResult expectedResult );
|
||||
|
||||
static UnicodeString &prettify(const CollationKey &source, UnicodeString &target);
|
||||
static UnicodeString &appendCompareResult(Collator::EComparisonResult result, UnicodeString &target);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define _INTLTESTDATEFORMAT
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define _INTLTESTDECIMALFORMATSYMBOLS
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
#include "unicode/dcfmtsym.h"
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define _INTLTESTDATEFORMATSYMBOLS
|
||||
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
********************************************************************/
|
||||
|
||||
|
||||
#ifndef MULTITHREADTEST_H
|
||||
#define MULTITHREADTEST_H
|
||||
|
||||
#include "intltest.h"
|
||||
#include "mutex.h"
|
||||
|
||||
|
@ -54,5 +57,5 @@ public:
|
|||
void TestThreadedIntl(void);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
* Copyright (c) 1997-2001, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
#ifndef _MUTEX
|
||||
|
||||
#ifndef MUTEXTEST_H
|
||||
#define MUTEXTEST_H
|
||||
|
||||
#include "intltest.h"
|
||||
#include "mutex.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Tests Mutex and MutexImplementation functionality using
|
||||
|
@ -35,5 +35,5 @@ public:
|
|||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
#include "unicode/fmtable.h"
|
||||
#include "unicode/locid.h"
|
||||
|
||||
class NumberFormat;
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#ifndef _PUTILTEST_
|
||||
#define _PUTILTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,21 +11,8 @@
|
|||
#ifndef _TSTNORM
|
||||
#define _TSTNORM
|
||||
|
||||
#ifndef _UTYPES
|
||||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
|
||||
#ifndef _COLL
|
||||
#include "unicode/coll.h"
|
||||
#endif
|
||||
|
||||
#ifndef _NORMLZR
|
||||
#include "unicode/normlzr.h"
|
||||
#endif
|
||||
|
||||
#ifndef _INTLTEST
|
||||
#include "intltest.h"
|
||||
#endif
|
||||
|
||||
class BasicNormalizerTest : public IntlTest {
|
||||
public:
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _TIMEZONEREGRESSIONTEST_
|
||||
#define _TIMEZONEREGRESSIONTEST_
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/timezone.h"
|
||||
|
||||
#include "intltest.h"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#ifndef __TimeZoneTest__
|
||||
#define __TimeZoneTest__
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "caltztst.h"
|
||||
class SimpleTimeZone;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#ifndef UNIFLTLOGICTST_H
|
||||
#define UNIFLTLOGICTST_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/unifltlg.h"
|
||||
#include "intltest.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#ifndef UNITOHEXTRTST_H
|
||||
#define UNITOHEXTRTST_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/unitohex.h"
|
||||
#include "intltest.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#ifndef _TESTUNISET
|
||||
#define _TESTUNISET
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "intltest.h"
|
||||
|
||||
class UnicodeSet;
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
#ifndef UNICODESTRINGTEST_H
|
||||
#define UNICODESTRINGTEST_H
|
||||
|
||||
#include "intltest.h"
|
||||
|
||||
/**
|
||||
|
@ -74,3 +77,4 @@ public:
|
|||
void TestUnescape(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue