Index: source/test/intltest/regiontst.cpp |
diff --git a/source/test/intltest/regiontst.cpp b/source/test/intltest/regiontst.cpp |
index 635a1b5623585a09bd4c75ae5714cd826d53dcdd..d2da87fec67c0ca515c374bc44b4f3697cc894ca 100644 |
--- a/source/test/intltest/regiontst.cpp |
+++ b/source/test/intltest/regiontst.cpp |
@@ -1,6 +1,6 @@ |
/*********************************************************************** |
* COPYRIGHT: |
- * Copyright (c) 2013, International Business Machines Corporation |
+ * Copyright (c) 2013-2014, International Business Machines Corporation |
* and others. All Rights Reserved. |
***********************************************************************/ |
@@ -25,8 +25,6 @@ typedef struct KnownRegion { |
const char *containingContinent; |
} KnownRegion; |
-#define LENGTHOF(array) (int32_t)(sizeof(array) / sizeof((array)[0])) |
- |
static KnownRegion knownRegions[] = { |
// Code, Num, Parent, Type, Containing Continent |
{ "TP" , 626, "035", URGN_TERRITORY, "142" }, |
@@ -364,7 +362,7 @@ RegionTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* |
void RegionTest::TestKnownRegions() { |
- for (int32_t i = 0 ; i < LENGTHOF(knownRegions) ; i++ ) { |
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) { |
KnownRegion rd = knownRegions[i]; |
UErrorCode status = U_ZERO_ERROR; |
const Region *r = Region::getInstance(rd.code,status); |
@@ -415,17 +413,17 @@ void RegionTest::TestGetInstanceString() { |
UErrorCode status = U_ZERO_ERROR; |
const Region *r = Region::getInstance((const char *)NULL,status); |
if ( status != U_ILLEGAL_ARGUMENT_ERROR ) { |
- errln("Calling Region::getInstance(NULL) should have triggered an U_ILLEGAL_ARGUMENT_ERROR, but didn't."); |
+ errcheckln(status, "Calling Region::getInstance(NULL) should have triggered an U_ILLEGAL_ARGUMENT_ERROR, but didn't. - %s", u_errorName(status)); |
} |
status = U_ZERO_ERROR; |
r = Region::getInstance("BOGUS",status); |
if ( status != U_ILLEGAL_ARGUMENT_ERROR ) { |
- errln("Calling Region::getInstance(\"BOGUS\") should have triggered an U_ILLEGAL_ARGUMENT_ERROR, but didn't."); |
+ errcheckln(status, "Calling Region::getInstance(\"BOGUS\") should have triggered an U_ILLEGAL_ARGUMENT_ERROR, but didn't. - %s", u_errorName(status)); |
} |
- for (int32_t i = 0 ; i < LENGTHOF(testData) ; i++ ) { |
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(testData) ; i++ ) { |
TestData data = testData[i]; |
status = U_ZERO_ERROR; |
r = Region::getInstance(data.inputID,status); |
@@ -466,10 +464,10 @@ void RegionTest::TestGetInstanceInt() { |
UErrorCode status = U_ZERO_ERROR; |
Region::getInstance(-123,status); |
if ( status != U_ILLEGAL_ARGUMENT_ERROR ) { |
- errln("Calling Region::getInstance(-123) should have triggered an U_ILLEGAL_ARGUMENT_ERROR, but didn't."); |
+ errcheckln(status, "Calling Region::getInstance(-123) should have triggered an U_ILLEGAL_ARGUMENT_ERROR, but didn't. - %s", u_errorName(status)); |
} |
- for (int32_t i = 0 ; i < LENGTHOF(testData) ; i++ ) { |
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(testData) ; i++ ) { |
TestData data = testData[i]; |
status = U_ZERO_ERROR; |
const Region *r = Region::getInstance(data.inputID,status); |
@@ -492,7 +490,7 @@ void RegionTest::TestGetInstanceInt() { |
} |
void RegionTest::TestGetContainedRegions() { |
- for (int32_t i = 0 ; i < LENGTHOF(knownRegions) ; i++ ) { |
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) { |
KnownRegion rd = knownRegions[i]; |
UErrorCode status = U_ZERO_ERROR; |
@@ -519,7 +517,7 @@ void RegionTest::TestGetContainedRegions() { |
} |
void RegionTest::TestGetContainedRegionsWithType() { |
- for (int32_t i = 0 ; i < LENGTHOF(knownRegions) ; i++ ) { |
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) { |
KnownRegion rd = knownRegions[i]; |
UErrorCode status = U_ZERO_ERROR; |
@@ -546,7 +544,7 @@ void RegionTest::TestGetContainedRegionsWithType() { |
} |
void RegionTest::TestGetContainingRegion() { |
- for (int32_t i = 0 ; i < LENGTHOF(knownRegions) ; i++ ) { |
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) { |
KnownRegion rd = knownRegions[i]; |
UErrorCode status = U_ZERO_ERROR; |
const Region *r = Region::getInstance(rd.code,status); |
@@ -570,7 +568,7 @@ void RegionTest::TestGetContainingRegion() { |
} |
void RegionTest::TestGetContainingRegionWithType() { |
- for (int32_t i = 0 ; i < LENGTHOF(knownRegions) ; i++ ) { |
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) { |
KnownRegion rd = knownRegions[i]; |
UErrorCode status = U_ZERO_ERROR; |
@@ -632,7 +630,7 @@ void RegionTest::TestGetPreferredValues() { |
} |
void RegionTest::TestContains() { |
- for (int32_t i = 0 ; i < LENGTHOF(knownRegions) ; i++ ) { |
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) { |
KnownRegion rd = knownRegions[i]; |
UErrorCode status = U_ZERO_ERROR; |