mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 00:43:32 +00:00
ICU-10379 fixes for IBM i - asciism, fix some test cases
X-SVN-Rev: 34281
This commit is contained in:
parent
8abaebe06e
commit
fd0e17c682
7 changed files with 82 additions and 84 deletions
|
@ -886,17 +886,17 @@ static void TestDateFormatCalendar() {
|
|||
|
||||
|
||||
/**
|
||||
* Test parsing two digit year against "YY" vs. "YYYY" patterns
|
||||
* Test parsing two digit year against "YY" vs. "YYYY" patterns
|
||||
*/
|
||||
static void TestCalendarDateParse() {
|
||||
|
||||
int32_t result;
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
int32_t result;
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
UDateFormat* simpleDateFormat = 0;
|
||||
int parsePos = 0;
|
||||
int twoDigitCenturyStart = 75;
|
||||
int currentTwoDigitYear = 0;
|
||||
int startCentury = 0;
|
||||
int32_t parsePos = 0;
|
||||
int32_t twoDigitCenturyStart = 75;
|
||||
int32_t currentTwoDigitYear = 0;
|
||||
int32_t startCentury = 0;
|
||||
UCalendar* tempCal = 0;
|
||||
UCalendar* calendar = 0;
|
||||
|
||||
|
@ -919,18 +919,18 @@ static void TestCalendarDateParse() {
|
|||
currentTwoDigitYear = getCurrentYear() % 100;
|
||||
startCentury = getCurrentYear() - currentTwoDigitYear;
|
||||
if (twoDigitCenturyStart > currentTwoDigitYear) {
|
||||
startCentury -= 100;
|
||||
startCentury -= 100;
|
||||
}
|
||||
tempCal = ucal_open(NULL, -1, NULL, UCAL_GREGORIAN, &ec);
|
||||
ucal_setMillis(tempCal, 0, &ec);
|
||||
ucal_setDateTime(tempCal, startCentury + twoDigitCenturyStart, UCAL_JANUARY, 1, 0, 0, 0, &ec);
|
||||
udat_set2DigitYearStart(simpleDateFormat, ucal_getMillis(tempCal, &ec), &ec);
|
||||
tempCal = ucal_open(NULL, -1, NULL, UCAL_GREGORIAN, &ec);
|
||||
ucal_setMillis(tempCal, 0, &ec);
|
||||
ucal_setDateTime(tempCal, startCentury + twoDigitCenturyStart, UCAL_JANUARY, 1, 0, 0, 0, &ec);
|
||||
udat_set2DigitYearStart(simpleDateFormat, ucal_getMillis(tempCal, &ec), &ec);
|
||||
|
||||
calendar = ucal_open(NULL, -1, NULL, UCAL_GREGORIAN, &ec);
|
||||
ucal_setMillis(calendar, 0, &ec);
|
||||
ucal_setDateTime(calendar, twoDigitCenturyStart, UCAL_JANUARY, 1, 0, 0, 0, &ec);
|
||||
calendar = ucal_open(NULL, -1, NULL, UCAL_GREGORIAN, &ec);
|
||||
ucal_setMillis(calendar, 0, &ec);
|
||||
ucal_setDateTime(calendar, twoDigitCenturyStart, UCAL_JANUARY, 1, 0, 0, 0, &ec);
|
||||
|
||||
udat_parseCalendar(simpleDateFormat, calendar, text, u_strlen(text), &parsePos, &ec);
|
||||
udat_parseCalendar(simpleDateFormat, calendar, text, u_strlen(text), &parsePos, &ec);
|
||||
|
||||
/* Check result */
|
||||
result = ucal_get(calendar, UCAL_YEAR, &ec);
|
||||
|
@ -946,7 +946,7 @@ static void TestCalendarDateParse() {
|
|||
|
||||
parsePos = 0;
|
||||
udat_applyPattern(simpleDateFormat, 0, pattern2, u_strlen(pattern2));
|
||||
udat_parseCalendar(simpleDateFormat, calendar, text, u_strlen(text), &parsePos, &ec);
|
||||
udat_parseCalendar(simpleDateFormat, calendar, text, u_strlen(text), &parsePos, &ec);
|
||||
|
||||
/* Check result */
|
||||
result = ucal_get(calendar, UCAL_YEAR, &ec);
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
// file: alphaindex.cpp
|
||||
// Alphabetic Index Tests.
|
||||
//
|
||||
// Note: please... no character literals cast to UChars.. use (UChar)0xZZZZ
|
||||
|
||||
#include <stdio.h> // for sprintf
|
||||
|
||||
#include "intltest.h"
|
||||
|
@ -579,18 +581,18 @@ void AlphabeticIndexTest::TestPinyinFirst() {
|
|||
}
|
||||
int32_t reorderCodes[] = { USCRIPT_HAN };
|
||||
coll->setReorderCodes(reorderCodes, LENGTHOF(reorderCodes), status);
|
||||
TEST_CHECK_STATUS;
|
||||
TEST_CHECK_STATUS;
|
||||
AlphabeticIndex index(coll.orphan(), status);
|
||||
TEST_CHECK_STATUS;
|
||||
TEST_CHECK_STATUS;
|
||||
assertEquals("getBucketCount()", 1, index.getBucketCount(status)); // ... (underflow only)
|
||||
index.addLabels(Locale::getChinese(), status);
|
||||
assertEquals("getBucketCount()", 28, index.getBucketCount(status)); // ... A-Z ...
|
||||
int bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x897f), status);
|
||||
assertEquals("getBucketIndex(U+897F)", 'X' - 'A' + 1, bucketIndex);
|
||||
int32_t bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x897f), status);
|
||||
assertEquals("getBucketIndex(U+897F)", (int32_t)((UChar)0x0058/*X*/ - (UChar)0x0041/*A*/ + 1), (int32_t)bucketIndex);
|
||||
bucketIndex = index.getBucketIndex("i", status);
|
||||
assertEquals("getBucketIndex(i)", 9, bucketIndex);
|
||||
bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x03B1), status);
|
||||
assertEquals("getBucketIndex(Greek alpha)", 27, bucketIndex);
|
||||
assertEquals("getBucketIndex(Greek alpha)", (int32_t)27, bucketIndex);
|
||||
// TODO: Test with an unassigned code point (not just U+FFFF)
|
||||
// when unassigned code points are not in the Hani reordering group any more.
|
||||
// String unassigned = UTF16.valueOf(0x50005);
|
||||
|
@ -645,16 +647,16 @@ void AlphabeticIndexTest::TestNoLabels() {
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
LocalPointer<RuleBasedCollator> coll(
|
||||
static_cast<RuleBasedCollator *>(Collator::createInstance(Locale::getRoot(), status)));
|
||||
TEST_CHECK_STATUS;
|
||||
TEST_CHECK_STATUS;
|
||||
AlphabeticIndex index(coll.orphan(), status);
|
||||
TEST_CHECK_STATUS;
|
||||
TEST_CHECK_STATUS;
|
||||
index.addRecord(UnicodeString((UChar)0x897f), NULL, status);
|
||||
index.addRecord("i", NULL, status);
|
||||
index.addRecord(UnicodeString((UChar)0x03B1), NULL, status);
|
||||
assertEquals("getBucketCount()", 1, index.getBucketCount(status)); // ...
|
||||
TEST_ASSERT(index.nextBucket(status));
|
||||
assertEquals("underflow label type", U_ALPHAINDEX_UNDERFLOW, index.getBucketLabelType());
|
||||
assertEquals("all records in the underflow bucket", 3, index.getBucketRecordCount());
|
||||
assertEquals("underflow label type", (int32_t)U_ALPHAINDEX_UNDERFLOW, index.getBucketLabelType());
|
||||
assertEquals("all records in the underflow bucket", (int32_t)3, index.getBucketRecordCount());
|
||||
}
|
||||
|
||||
void AlphabeticIndexTest::TestChineseZhuyin() {
|
||||
|
|
|
@ -2768,11 +2768,8 @@ void CalendarTest::Test8449() {
|
|||
|
||||
|
||||
int32_t firstYear = 1318;
|
||||
//* use either 1 or 2 leading slashes to toggle
|
||||
int32_t lastYear = 1368; // just enough to be pretty sure
|
||||
/*/
|
||||
int32_t lastYear = 1480; // the whole shootin' match
|
||||
//*/
|
||||
//int32_t lastYear = 1480; // the whole shootin' match
|
||||
|
||||
tstCal->clear();
|
||||
tstCal->setLenient(FALSE);
|
||||
|
@ -2796,7 +2793,7 @@ void CalendarTest::Test8449() {
|
|||
month = tstCal->get(UCAL_MONTH,status);
|
||||
year = tstCal->get(UCAL_YEAR,status);
|
||||
TEST_CHECK_STATUS;
|
||||
tstCal->roll(UCAL_DAY_OF_MONTH, TRUE, status);
|
||||
tstCal->roll(UCAL_DAY_OF_MONTH, (UBool)TRUE, status);
|
||||
TEST_CHECK_STATUS;
|
||||
}
|
||||
|
||||
|
|
|
@ -576,28 +576,23 @@ void IntlTestDecimalFormatAPI::TestScale()
|
|||
}
|
||||
|
||||
|
||||
#define ASSERT_SUCCESS(status) {if (U_FAILURE(status)) { \
|
||||
errln("file %s, line %d: Error status is %s", __FILE__, __LINE__, u_errorName(status)); \
|
||||
status = U_ZERO_ERROR; }}
|
||||
|
||||
#define ASSERT_EQUAL(expect, actual) {if ((expect) != (actual)) { \
|
||||
errln("file %s, line %d: Expected %g, got %g", __FILE__, __LINE__, (double)(expect), (double)(actual)); }}
|
||||
|
||||
#define ASSERT_EQUAL(expect, actual) { char tmp[200]; sprintf(tmp, "(%g==%g)", (double)(expect), (double)(actual)); \
|
||||
assertTrue(tmp, ((expect)==(actual)), FALSE, FALSE, __FILE__, __LINE__); }
|
||||
|
||||
void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
LocalPointer<DecimalFormat> df(new DecimalFormat("###", status));
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
FixedDecimal fd = df->getFixedDecimal(44, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(44, fd.source);
|
||||
ASSERT_EQUAL(0, fd.visibleDecimalDigitCount);
|
||||
|
||||
df.adoptInstead(new DecimalFormat("###.00##", status));
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(123.456, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(3, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(456, fd.decimalDigits);
|
||||
ASSERT_EQUAL(456, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -606,9 +601,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
ASSERT_EQUAL(FALSE, fd.isNegative);
|
||||
|
||||
df.adoptInstead(new DecimalFormat("###", status));
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(123.456, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(0, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(0, fd.decimalDigits);
|
||||
ASSERT_EQUAL(0, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -617,9 +612,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
ASSERT_EQUAL(FALSE, fd.isNegative);
|
||||
|
||||
df.adoptInstead(new DecimalFormat("###.0", status));
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(123.01, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(1, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(0, fd.decimalDigits);
|
||||
ASSERT_EQUAL(0, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -628,9 +623,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
ASSERT_EQUAL(FALSE, fd.isNegative);
|
||||
|
||||
df.adoptInstead(new DecimalFormat("###.0", status));
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(123.06, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(1, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(1, fd.decimalDigits);
|
||||
ASSERT_EQUAL(1, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -639,9 +634,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
ASSERT_EQUAL(FALSE, fd.isNegative);
|
||||
|
||||
df.adoptInstead(new DecimalFormat("@@@@@", status)); // Significant Digits
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(123, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(2, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(0, fd.decimalDigits);
|
||||
ASSERT_EQUAL(0, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -650,9 +645,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
ASSERT_EQUAL(FALSE, fd.isNegative);
|
||||
|
||||
df.adoptInstead(new DecimalFormat("@@@@@", status)); // Significant Digits
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(1.23, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(4, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(2300, fd.decimalDigits);
|
||||
ASSERT_EQUAL(23, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -661,23 +656,23 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
ASSERT_EQUAL(FALSE, fd.isNegative);
|
||||
|
||||
fd = df->getFixedDecimal(uprv_getInfinity(), status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(TRUE, fd.isNanOrInfinity);
|
||||
fd = df->getFixedDecimal(0.0, status);
|
||||
ASSERT_EQUAL(FALSE, fd.isNanOrInfinity);
|
||||
fd = df->getFixedDecimal(uprv_getNaN(), status);
|
||||
ASSERT_EQUAL(TRUE, fd.isNanOrInfinity);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
|
||||
// Test Big Decimal input.
|
||||
// 22 digits before and after decimal, will exceed the precision of a double
|
||||
// and force DecimalFormat::getFixedDecimal() to work with a digit list.
|
||||
df.adoptInstead(new DecimalFormat("#####################0.00####################", status));
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
Formattable fable("12.34", status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(fable, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(2, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(34, fd.decimalDigits);
|
||||
ASSERT_EQUAL(34, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -686,9 +681,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
ASSERT_EQUAL(FALSE, fd.isNegative);
|
||||
|
||||
fable.setDecimalNumber("12.345678901234567890123456789", status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(fable, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(22, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(345678901234567890LL, fd.decimalDigits);
|
||||
ASSERT_EQUAL(34567890123456789LL, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -698,9 +693,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
|
||||
// On field overflow, Integer part is truncated on the left, fraction part on the right.
|
||||
fable.setDecimalNumber("123456789012345678901234567890.123456789012345678901234567890", status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(fable, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(22, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(123456789012345678LL, fd.decimalDigits);
|
||||
ASSERT_EQUAL(123456789012345678LL, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -710,9 +705,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
|
||||
// Digits way to the right of the decimal but within the format's precision aren't truncated
|
||||
fable.setDecimalNumber("1.0000000000000000000012", status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(fable, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(22, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(12, fd.decimalDigits);
|
||||
ASSERT_EQUAL(12, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -722,9 +717,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
|
||||
// Digits beyond the precision of the format are rounded away
|
||||
fable.setDecimalNumber("1.000000000000000000000012", status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(fable, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(2, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(0, fd.decimalDigits);
|
||||
ASSERT_EQUAL(0, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -734,9 +729,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
|
||||
// Negative numbers come through
|
||||
fable.setDecimalNumber("-1.0000000000000000000012", status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(fable, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(22, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(12, fd.decimalDigits);
|
||||
ASSERT_EQUAL(12, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -746,9 +741,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
|
||||
// MinFractionDigits from format larger than from number.
|
||||
fable.setDecimalNumber("1000000000000000000000.3", status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(fable, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(2, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(30, fd.decimalDigits);
|
||||
ASSERT_EQUAL(3, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -758,9 +753,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
|
||||
// Test some int64_t values that are out of the range of a double
|
||||
fable.setInt64(4503599627370496LL);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(fable, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(2, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(0, fd.decimalDigits);
|
||||
ASSERT_EQUAL(0, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -769,9 +764,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
ASSERT_EQUAL(FALSE, fd.isNegative);
|
||||
|
||||
fable.setInt64(4503599627370497LL);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(fable, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(2, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(0, fd.decimalDigits);
|
||||
ASSERT_EQUAL(0, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
@ -780,9 +775,9 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
|
|||
ASSERT_EQUAL(FALSE, fd.isNegative);
|
||||
|
||||
fable.setInt64(9223372036854775807LL);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
fd = df->getFixedDecimal(fable, status);
|
||||
ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_STATUS(status);
|
||||
ASSERT_EQUAL(2, fd.visibleDecimalDigitCount);
|
||||
ASSERT_EQUAL(0, fd.decimalDigits);
|
||||
ASSERT_EQUAL(0, fd.decimalDigitsWithoutTrailingZeros);
|
||||
|
|
|
@ -1724,15 +1724,16 @@ UBool IntlTest::assertFalse(const char* message, UBool condition, UBool quiet) {
|
|||
return !condition;
|
||||
}
|
||||
|
||||
UBool IntlTest::assertSuccess(const char* message, UErrorCode ec, UBool possibleDataError) {
|
||||
UBool IntlTest::assertSuccess(const char* message, UErrorCode ec, UBool possibleDataError, const char *file, int line) {
|
||||
if (U_FAILURE(ec)) {
|
||||
if (possibleDataError) {
|
||||
dataerrln("FAIL: %s (%s)", message, u_errorName(ec));
|
||||
dataerrln("FAIL: %s:%d: %s (%s)", file, line, message, u_errorName(ec));
|
||||
} else {
|
||||
errcheckln(ec, "FAIL: %s (%s)", message, u_errorName(ec));
|
||||
errcheckln(ec, "FAIL: %s:%d: %s (%s)", file, line, message, u_errorName(ec));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
} else {
|
||||
logln("OK: %s:%d: %s - (%s)", file, line, message, u_errorName(ec));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -125,6 +125,9 @@ UnicodeString toString(UBool b);
|
|||
#define TEST_ASSERT_TRUE(x) \
|
||||
assertTrue(#x, (x), FALSE, FALSE, __FILE__, __LINE__)
|
||||
|
||||
#define TEST_ASSERT_STATUS(x) \
|
||||
assertSuccess(#x, (x), FALSE, __FILE__, __LINE__)
|
||||
|
||||
class IntlTest : public TestLog {
|
||||
public:
|
||||
|
||||
|
@ -249,7 +252,7 @@ protected:
|
|||
* @param possibleDataError - if TRUE, use dataerrln instead of errcheckln on failure
|
||||
* @return TRUE on success, FALSE on failure.
|
||||
*/
|
||||
UBool assertSuccess(const char* message, UErrorCode ec, UBool possibleDataError=FALSE);
|
||||
UBool assertSuccess(const char* message, UErrorCode ec, UBool possibleDataError=FALSE, const char *file=NULL, int line=0);
|
||||
UBool assertEquals(const char* message, const UnicodeString& expected,
|
||||
const UnicodeString& actual, UBool possibleDataError=FALSE);
|
||||
UBool assertEquals(const char* message, const char* expected,
|
||||
|
|
|
@ -477,10 +477,10 @@ void UnicodeTest::TestScriptMetadata() {
|
|||
UChar32 firstChar = sample.char32At(0);
|
||||
UScriptCode charScript = getCharScript(sc);
|
||||
assertEquals("script(sample(script))",
|
||||
charScript, uscript_getScript(firstChar, errorCode));
|
||||
assertEquals("RTL vs. set", rtl.contains(firstChar), uscript_isRightToLeft(sc));
|
||||
assertEquals("cased vs. set", cased.contains(firstChar), uscript_isCased(sc));
|
||||
assertEquals("encoded, has characters", sc == charScript, !scriptSet.isEmpty());
|
||||
(int32_t)charScript, (int32_t)uscript_getScript(firstChar, errorCode));
|
||||
assertEquals("RTL vs. set", (UBool)rtl.contains(firstChar), (UBool)uscript_isRightToLeft(sc));
|
||||
assertEquals("cased vs. set", (UBool)cased.contains(firstChar), (UBool)uscript_isCased(sc));
|
||||
assertEquals("encoded, has characters", (UBool)(sc == charScript), (UBool)(!scriptSet.isEmpty()));
|
||||
if(uscript_isRightToLeft(sc)) {
|
||||
rtl.removeAll(scriptSet);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue