mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-953 Do less static initialization/destruction
X-SVN-Rev: 5227
This commit is contained in:
parent
8730035cc6
commit
2a1edde771
6 changed files with 22 additions and 21 deletions
|
@ -17,10 +17,9 @@
|
|||
|
||||
static UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
const UnicodeString CollationIteratorTest::test1("What subset of all possible test cases?", "");
|
||||
const UnicodeString CollationIteratorTest::test2("has the highest probability of detecting", "");
|
||||
|
||||
CollationIteratorTest::CollationIteratorTest()
|
||||
: test1("What subset of all possible test cases?", ""),
|
||||
test2("has the highest probability of detecting", "")
|
||||
{
|
||||
en_us = (RuleBasedCollator *)Collator::createInstance(Locale::US, status);
|
||||
}
|
||||
|
|
|
@ -132,8 +132,8 @@ private:
|
|||
void assertEqual(CollationElementIterator &i1, CollationElementIterator &i2);
|
||||
|
||||
RuleBasedCollator *en_us;
|
||||
static const UnicodeString test1;
|
||||
static const UnicodeString test2;
|
||||
const UnicodeString test1;
|
||||
const UnicodeString test2;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -38,10 +38,9 @@
|
|||
#define MAX(x,y) ((x) > (y) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
const UnicodeString CollationMonkeyTest::source("-abcdefghijklmnopqrstuvwxyz#&^$@", "");
|
||||
|
||||
CollationMonkeyTest::CollationMonkeyTest()
|
||||
: myCollator(0)
|
||||
: myCollator(0),
|
||||
source("-abcdefghijklmnopqrstuvwxyz#&^$@", "")
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
myCollator = Collator::createInstance("en_US", status);
|
||||
|
|
|
@ -52,7 +52,7 @@ private:
|
|||
|
||||
void doTest(RuleBasedCollator *myCollation, UnicodeString source, UnicodeString target, Collator::EComparisonResult result);
|
||||
|
||||
static const UnicodeString source;
|
||||
const UnicodeString source;
|
||||
|
||||
Collator *myCollator;
|
||||
};
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
//***************************************************************************************
|
||||
|
||||
static const UnicodeString kERROR = UNICODE_STRING("ERROR", 5);
|
||||
static const UChar kErrorUChars[] = { 0x45, 0x52, 0x52, 0x4f, 0x52, 0 };
|
||||
static const int32_t kErrorLength = 5;
|
||||
static const int32_t kERROR_COUNT = -1234567;
|
||||
|
@ -439,7 +438,10 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
|
||||
CONFIRM_UErrorCode(status, expected_resource_status, action);
|
||||
|
||||
UnicodeString expected_string = U_SUCCESS(status) ? base : kERROR;
|
||||
UnicodeString expected_string(kErrorUChars);
|
||||
if (U_SUCCESS(status)) {
|
||||
expected_string = base;
|
||||
}
|
||||
|
||||
CONFIRM_EQ(string, expected_string, action);
|
||||
|
||||
|
@ -481,7 +483,7 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
{
|
||||
index = count ? (randi(count * 3) - count) : (randi(200) - 100);
|
||||
status = U_ZERO_ERROR;
|
||||
string = kERROR;
|
||||
string = kErrorUChars;
|
||||
UnicodeString t(arrayBundle.getStringEx(index, status));
|
||||
expected_status = (index >= 0 && index < count) ? expected_resource_status : U_MISSING_RESOURCE_ERROR;
|
||||
CONFIRM_UErrorCode(status, expected_status, action);
|
||||
|
@ -494,7 +496,7 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
}
|
||||
else
|
||||
{
|
||||
expected_string = kERROR;
|
||||
expected_string = kErrorUChars;
|
||||
}
|
||||
CONFIRM_EQ(string, expected_string, action);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
//***************************************************************************************
|
||||
|
||||
static const UnicodeString kERROR = UNICODE_STRING("ERROR", 5);
|
||||
static const UChar kErrorUChars[] = { 0x45, 0x52, 0x52, 0x4f, 0x52, 0 };
|
||||
static const int32_t kErrorLength = 5;
|
||||
static const int32_t kERROR_COUNT = -1234567;
|
||||
|
@ -597,8 +596,10 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
|
||||
CONFIRM_UErrorCode(status, expected_resource_status);
|
||||
|
||||
UnicodeString expected_string;
|
||||
expected_string = U_SUCCESS(status) ? base : kERROR;
|
||||
UnicodeString expected_string(kErrorUChars);
|
||||
if (U_SUCCESS(status)) {
|
||||
expected_string = base;
|
||||
}
|
||||
|
||||
CONFIRM_EQ(string, expected_string);
|
||||
|
||||
|
@ -652,7 +653,7 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
{
|
||||
index = count ? (randi(count * 3) - count) : (randi(200) - 100);
|
||||
status = U_ZERO_ERROR;
|
||||
string = kERROR;
|
||||
string = kErrorUChars;
|
||||
ResourceBundle array = theBundle.get(tag, status);
|
||||
if(!U_FAILURE(status)){
|
||||
UnicodeString t = array.getStringEx(index, status);
|
||||
|
@ -669,7 +670,7 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
expected_string = base;
|
||||
expected_string += itoa(index,buf);
|
||||
} else {
|
||||
expected_string = kERROR;
|
||||
expected_string = kErrorUChars;
|
||||
}
|
||||
CONFIRM_EQ(string,expected_string);
|
||||
|
||||
|
@ -739,7 +740,7 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
row = row_count ? (randi(row_count * 3) - row_count) : (randi(200) - 100);
|
||||
col = column_count ? (randi(column_count * 3) - column_count) : (randi(200) - 100);
|
||||
status = U_ZERO_ERROR;
|
||||
string = kERROR;
|
||||
string = kErrorUChars;
|
||||
ResourceBundle array2d=theBundle.get(tag, status);
|
||||
if(U_SUCCESS(status)){
|
||||
ResourceBundle tablerow=array2d.get(row, status);
|
||||
|
@ -760,7 +761,7 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
expected_string += itoa(row,buf);
|
||||
expected_string += itoa(col,buf);
|
||||
} else {
|
||||
expected_string = kERROR;
|
||||
expected_string = kErrorUChars;
|
||||
}
|
||||
CONFIRM_EQ(string,expected_string);
|
||||
|
||||
|
@ -822,7 +823,7 @@ NewResourceBundleTest::testTag(const char* frag,
|
|||
{
|
||||
char buf[32];
|
||||
status = U_ZERO_ERROR;
|
||||
string = kERROR;
|
||||
string = kErrorUChars;
|
||||
char item_tag[8];
|
||||
uprv_strcpy(item_tag, "tag");
|
||||
uprv_strcat(item_tag, itoa(index,buf));
|
||||
|
|
Loading…
Add table
Reference in a new issue