mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-150 renaming default -> root changes
X-SVN-Rev: 1366
This commit is contained in:
parent
c786b21d52
commit
d4d8a6da75
5 changed files with 179 additions and 99 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "unicode/utypes.h"
|
||||
#include "unicode/ustring.h"
|
||||
#include "string.h"
|
||||
#include "cstring.h"
|
||||
#include <time.h>
|
||||
|
||||
#define RESTEST_HEAP_CHECK 0
|
||||
|
@ -73,7 +74,7 @@ const UChar kERROR[] = { 0x0045 /*E*/, 0x0052 /*'R'*/, 0x0052 /*'R'*/,
|
|||
|
||||
enum E_Where
|
||||
{
|
||||
e_Default,
|
||||
e_Root,
|
||||
e_te,
|
||||
e_te_IN,
|
||||
e_Where_count
|
||||
|
@ -102,12 +103,12 @@ param[] =
|
|||
/* "IN" means inherits */
|
||||
/* "NE" or "ne" means "does not exist" */
|
||||
|
||||
{ "default", U_ZERO_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } },
|
||||
{ "root", U_ZERO_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } },
|
||||
{ "te", U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN", U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "te_NE", U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN_NE", U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "ne", U_USING_DEFAULT_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
{ "ne", U_USING_DEFAULT_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
};
|
||||
|
||||
static int32_t bundles_count = sizeof(param) / sizeof(param[0]);
|
||||
|
@ -126,19 +127,39 @@ void addResourceBundleTest(TestNode** root)
|
|||
addTest(root, &TestConstruction2, "tsutil/crestst/TestConstruction2");
|
||||
addTest(root, &TestResourceBundles, "tsutil/crestst/TestResourceBundle");
|
||||
addTest(root, &TestFallback, "tsutil/crestst/TestFallback");
|
||||
addTest(root, &TestAliasConflict, "tsutil/crestst/TestAlias");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************/
|
||||
void TestAliasConflict(void) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UResourceBundle *he = NULL;
|
||||
UResourceBundle *iw = NULL;
|
||||
const UChar *result = NULL;
|
||||
|
||||
he = ures_open(NULL, "he", &status);
|
||||
iw = ures_open(NULL, "iw", &status);
|
||||
if(U_FAILURE(status)) {
|
||||
log_err("Failed to get resource with %s", myErrorName(status));
|
||||
}
|
||||
ures_close(iw);
|
||||
result = ures_get(he, "ShortLanguage", &status);
|
||||
if(U_FAILURE(status) || result == NULL) {
|
||||
log_err("Failed to get resource with %s", myErrorName(status));
|
||||
}
|
||||
ures_close(he);
|
||||
}
|
||||
|
||||
|
||||
void TestResourceBundles()
|
||||
{
|
||||
|
||||
testTag("only_in_Default", TRUE, FALSE, FALSE);
|
||||
testTag("in_Default_te", TRUE, TRUE, FALSE);
|
||||
testTag("in_Default_te_te_IN", TRUE, TRUE, TRUE);
|
||||
testTag("in_Default_te_IN", TRUE, FALSE, TRUE);
|
||||
testTag("only_in_Root", TRUE, FALSE, FALSE);
|
||||
testTag("in_Root_te", TRUE, TRUE, FALSE);
|
||||
testTag("in_Root_te_te_IN", TRUE, TRUE, TRUE);
|
||||
testTag("in_Root_te_IN", TRUE, FALSE, TRUE);
|
||||
testTag("only_in_te", FALSE, TRUE, FALSE);
|
||||
testTag("only_in_te_IN", FALSE, FALSE, TRUE);
|
||||
testTag("in_te_te_IN", FALSE, TRUE, TRUE);
|
||||
|
@ -155,13 +176,20 @@ void TestConstruction1()
|
|||
const UChar *result1, *result2;
|
||||
UErrorCode status= U_ZERO_ERROR;
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
const char* directory;
|
||||
const char* directory=NULL;
|
||||
const char* locale="te_IN";
|
||||
char testdatapath[256];
|
||||
|
||||
directory= ctest_getTestDirectory();
|
||||
uprv_strcpy(testdatapath, directory);
|
||||
uprv_strcat(testdatapath, "testdata");
|
||||
log_verbose("Testing ures_open()......\n");
|
||||
test1=ures_open(directory, NULL, &err);
|
||||
test2=ures_open(directory, locale, &err);
|
||||
/*
|
||||
test1=ures_open("c:\\icu\\icu\\source\\test\\testdata\\testdata", NULL, &err);
|
||||
test2=ures_open("c:\\icu\\icu\\source\\test\\testdata\\testdata", locale, &err);
|
||||
*/
|
||||
test1=ures_open(testdatapath, NULL, &err);
|
||||
test2=ures_open(testdatapath, locale, &err);
|
||||
|
||||
if(U_FAILURE(err))
|
||||
{
|
||||
|
@ -169,8 +197,8 @@ void TestConstruction1()
|
|||
return;
|
||||
}
|
||||
|
||||
result1= ures_get(test1, "string_in_Default_te_te_IN", &err);
|
||||
result2= ures_get(test2, "string_in_Default_te_te_IN", &err);
|
||||
result1= ures_get(test1, "string_in_Root_te_te_IN", &err);
|
||||
result2= ures_get(test2, "string_in_Root_te_te_IN", &err);
|
||||
|
||||
|
||||
if (U_FAILURE(err)) {
|
||||
|
@ -180,8 +208,8 @@ void TestConstruction1()
|
|||
}
|
||||
|
||||
|
||||
log_verbose("for string_in_Default_te_te_IN, default.txt had %s\n", austrdup(result1));
|
||||
log_verbose("for string_in_Default_te_te_IN, te_IN.txt had %s\n", austrdup(result2));
|
||||
log_verbose("for string_in_Root_te_te_IN, default.txt had %s\n", austrdup(result1));
|
||||
log_verbose("for string_in_Root_te_te_IN, te_IN.txt had %s\n", austrdup(result2));
|
||||
|
||||
|
||||
/* Test getVersionNumber*/
|
||||
|
@ -202,8 +230,13 @@ void TestConstruction2()
|
|||
const char* directory;
|
||||
const char* locale="te_IN";
|
||||
wchar_t widedirectory[256];
|
||||
char testdatapath[256];
|
||||
|
||||
directory= ctest_getTestDirectory();
|
||||
mbstowcs(widedirectory, directory, 256);
|
||||
uprv_strcpy(testdatapath, directory);
|
||||
uprv_strcat(testdatapath, "testdata");
|
||||
mbstowcs(widedirectory, testdatapath, 256);
|
||||
/*mbstowcs(widedirectory, "c:\\icu\\icu\\source\\test\\testdata\\testdata", 256);*/
|
||||
|
||||
log_verbose("Testing ures_openW().......\n");
|
||||
|
||||
|
@ -213,14 +246,14 @@ void TestConstruction2()
|
|||
return;
|
||||
}
|
||||
|
||||
result4=ures_get(test4, "string_in_Default_te_te_IN", &err);
|
||||
result4=ures_get(test4, "string_in_Root_te_te_IN", &err);
|
||||
|
||||
if (U_FAILURE(err)) {
|
||||
log_err("Something threw an error in TestConstruction() %s\n", myErrorName(err));
|
||||
return;
|
||||
}
|
||||
|
||||
log_verbose("for string_in_Default_te_te_IN, te_IN.txt had %s\n", austrdup(result4));
|
||||
log_verbose("for string_in_Root_te_te_IN, te_IN.txt had %s\n", austrdup(result4));
|
||||
u_uastrcpy(temp, "TE_IN");
|
||||
|
||||
if(u_strcmp(result4, temp)!=0)
|
||||
|
@ -253,7 +286,7 @@ void TestConstruction2()
|
|||
/*****************************************************************************/
|
||||
|
||||
bool_t testTag(const char* frag,
|
||||
bool_t in_Default,
|
||||
bool_t in_Root,
|
||||
bool_t in_te,
|
||||
bool_t in_te_IN)
|
||||
{
|
||||
|
@ -262,7 +295,7 @@ bool_t testTag(const char* frag,
|
|||
/* Make array from input params */
|
||||
|
||||
bool_t is_in[3];
|
||||
const char *NAME[] = { "DEFAULT", "TE", "TE_IN" };
|
||||
const char *NAME[] = { "ROOT", "TE", "TE_IN" };
|
||||
|
||||
/* Now try to load the desired items */
|
||||
UResourceBundle* theBundle = NULL;
|
||||
|
@ -280,9 +313,14 @@ bool_t testTag(const char* frag,
|
|||
int32_t row_count=0;
|
||||
int32_t column_count=0;
|
||||
int32_t index = 0;
|
||||
char testdatapath[256];
|
||||
|
||||
const char* directory = ctest_getTestDirectory();
|
||||
|
||||
is_in[0] = in_Default;
|
||||
uprv_strcpy(testdatapath, directory);
|
||||
uprv_strcat(testdatapath, "testdata");
|
||||
|
||||
is_in[0] = in_Root;
|
||||
is_in[1] = in_te;
|
||||
is_in[2] = in_te_IN;
|
||||
|
||||
|
@ -296,8 +334,8 @@ bool_t testTag(const char* frag,
|
|||
|
||||
status = U_ZERO_ERROR;
|
||||
|
||||
|
||||
theBundle = ures_open(directory, param[i].name, &status);
|
||||
theBundle = ures_open(testdatapath, param[i].name, &status);
|
||||
/*theBundle = ures_open("c:\\icu\\icu\\source\\test\\testdata\\testdata", param[i].name, &status);*/
|
||||
|
||||
CONFIRM_ErrorCode(status,param[i].expected_constructor_status);
|
||||
|
||||
|
@ -311,7 +349,7 @@ bool_t testTag(const char* frag,
|
|||
actual_bundle = i;
|
||||
|
||||
expected_resource_status = U_MISSING_RESOURCE_ERROR;
|
||||
for (j=e_te_IN; j>=e_Default; --j)
|
||||
for (j=e_te_IN; j>=e_Root; --j)
|
||||
{
|
||||
if (is_in[j] && param[i].inherits[j])
|
||||
{
|
||||
|
|
|
@ -32,12 +32,14 @@
|
|||
void TestConstruction1(void);
|
||||
|
||||
void TestConstruction2(void);
|
||||
|
||||
void TestAliasConflict(void);
|
||||
/**
|
||||
* extensive subtests called by TestResourceBundles
|
||||
**/
|
||||
|
||||
void setUpDataTable(void);
|
||||
bool_t testTag(const char* frag, bool_t in_Default, bool_t in_te, bool_t in_te_IN);
|
||||
bool_t testTag(const char* frag, bool_t in_Root, bool_t in_te, bool_t in_te_IN);
|
||||
|
||||
void record_pass(void);
|
||||
void record_fail(void);
|
||||
|
|
|
@ -24,14 +24,16 @@
|
|||
|
||||
//***************************************************************************************
|
||||
|
||||
const UnicodeString kERROR = "ERROR";
|
||||
const int32_t kERROR_COUNT = -1234567;
|
||||
static const UnicodeString kERROR = UNICODE_STRING("ERROR", 5);
|
||||
static const UChar kErrorUChars[] = { 0x45, 0x52, 0x52, 0x4f, 0x52, 0 };
|
||||
static const kErrorLength = 5;
|
||||
static const int32_t kERROR_COUNT = -1234567;
|
||||
|
||||
//***************************************************************************************
|
||||
|
||||
enum E_Where
|
||||
{
|
||||
e_Default,
|
||||
e_Root,
|
||||
e_te,
|
||||
e_te_IN,
|
||||
e_Where_count
|
||||
|
@ -104,12 +106,12 @@ param[] =
|
|||
// "IN" means inherits
|
||||
// "NE" or "ne" means "does not exist"
|
||||
|
||||
{ "default", 0, U_ZERO_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } },
|
||||
{ "root", 0, U_ZERO_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } },
|
||||
{ "te", 0, U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN", 0, U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "te_NE", 0, U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } },
|
||||
{ "te_IN_NE", 0, U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } },
|
||||
{ "ne", 0, U_USING_DEFAULT_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
{ "ne", 0, U_USING_DEFAULT_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }
|
||||
};
|
||||
|
||||
int32_t bundles_count = sizeof(param) / sizeof(param[0]);
|
||||
|
@ -159,7 +161,7 @@ ResourceBundleTest::ResourceBundleTest()
|
|||
fail(0),
|
||||
OUT(it_out)
|
||||
{
|
||||
param[0].locale = new Locale("default");
|
||||
param[0].locale = new Locale("root");
|
||||
param[1].locale = new Locale("te");
|
||||
param[2].locale = new Locale("te", "IN");
|
||||
param[3].locale = new Locale("te", "NE");
|
||||
|
@ -206,12 +208,12 @@ ResourceBundleTest::TestResourceBundles()
|
|||
#endif
|
||||
#endif
|
||||
|
||||
testTag("only_in_Default", TRUE, FALSE, FALSE);
|
||||
testTag("only_in_Root", TRUE, FALSE, FALSE);
|
||||
testTag("only_in_te", FALSE, TRUE, FALSE);
|
||||
testTag("only_in_te_IN", FALSE, FALSE, TRUE);
|
||||
testTag("in_Default_te", TRUE, TRUE, FALSE);
|
||||
testTag("in_Default_te_te_IN", TRUE, TRUE, TRUE);
|
||||
testTag("in_Default_te_IN", TRUE, FALSE, TRUE);
|
||||
testTag("in_Root_te", TRUE, TRUE, FALSE);
|
||||
testTag("in_Root_te_te_IN", TRUE, TRUE, TRUE);
|
||||
testTag("in_Root_te_IN", TRUE, FALSE, TRUE);
|
||||
testTag("in_te_te_IN", FALSE, TRUE, TRUE);
|
||||
testTag("nonexistent", FALSE, FALSE, FALSE);
|
||||
OUT << "Passed: " << pass << "\nFailed: " << fail << endl;
|
||||
|
@ -241,28 +243,33 @@ ResourceBundleTest::TestConstruction()
|
|||
{
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
const char *directory;
|
||||
char testdatapath[256];
|
||||
Locale locale("te", "IN");
|
||||
|
||||
directory=IntlTest::getTestDirectory();
|
||||
uprv_strcpy(testdatapath, directory);
|
||||
uprv_strcat(testdatapath, "testdata");
|
||||
|
||||
ResourceBundle test1(directory, err);
|
||||
ResourceBundle test2(directory, locale, err);
|
||||
ResourceBundle test1(testdatapath, err);
|
||||
ResourceBundle test2(testdatapath, locale, err);
|
||||
//ResourceBundle test1("c:\\icu\\icu\\source\\test\\testdata\\testdata", err);
|
||||
//ResourceBundle test2("c:\\icu\\icu\\source\\test\\testdata\\testdata", locale, err);
|
||||
|
||||
UnicodeString result1;
|
||||
UnicodeString result2;
|
||||
|
||||
test1.getString("string_in_Default_te_te_IN", result1, err);
|
||||
test2.getString("string_in_Default_te_te_IN", result2, err);
|
||||
result1 = *test1.getString("string_in_Root_te_te_IN", err);
|
||||
result2 = *test2.getString("string_in_Root_te_te_IN", err);
|
||||
|
||||
if (U_FAILURE(err)) {
|
||||
errln("Something threw an error in TestConstruction()");
|
||||
return;
|
||||
}
|
||||
|
||||
logln("for string_in_Default_te_te_IN, default.txt had " + result1);
|
||||
logln("for string_in_Default_te_te_IN, te_IN.txt had " + result2);
|
||||
logln("for string_in_Root_te_te_IN, default.txt had " + result1);
|
||||
logln("for string_in_Root_te_te_IN, te_IN.txt had " + result2);
|
||||
|
||||
if (result1 != "DEFAULT" || result2 != "TE_IN")
|
||||
if (result1 != "ROOT" || result2 != "TE_IN")
|
||||
errln("Construction test failed; run verbose for more information");
|
||||
|
||||
const char* version1;
|
||||
|
@ -289,26 +296,30 @@ ResourceBundleTest::TestConstruction()
|
|||
{
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
const char *directory;
|
||||
char testdatapath[256];
|
||||
Locale locale("te", "IN");
|
||||
|
||||
directory=IntlTest::getTestDirectory();
|
||||
uprv_strcpy(testdatapath, directory);
|
||||
uprv_strcat(testdatapath, "testdata");
|
||||
|
||||
|
||||
wchar_t* wideDirectory = new wchar_t[256];
|
||||
mbstowcs(wideDirectory, directory, 256);
|
||||
mbstowcs(wideDirectory, testdatapath, 256);
|
||||
//mbstowcs(wideDirectory, "c:\\icu\\icu\\source\\test\\testdata\\testdata", 256);
|
||||
|
||||
ResourceBundle test2(wideDirectory, locale, err);
|
||||
|
||||
UnicodeString result2;
|
||||
|
||||
test2.getString("string_in_Default_te_te_IN", result2, err);
|
||||
result2 = *test2.getString("string_in_Root_te_te_IN", err);
|
||||
|
||||
if (U_FAILURE(err)) {
|
||||
errln("Something threw an error in TestConstruction()");
|
||||
return;
|
||||
}
|
||||
|
||||
logln("for string_in_Default_te_te_IN, te_IN.txt had " + result2);
|
||||
logln("for string_in_Root_te_te_IN, te_IN.txt had " + result2);
|
||||
|
||||
if (result2 != "TE_IN")
|
||||
errln("Construction test failed; run verbose for more information");
|
||||
|
@ -319,7 +330,7 @@ ResourceBundleTest::TestConstruction()
|
|||
|
||||
bool_t
|
||||
ResourceBundleTest::testTag(const char* frag,
|
||||
bool_t in_Default,
|
||||
bool_t in_Root,
|
||||
bool_t in_te,
|
||||
bool_t in_te_IN)
|
||||
{
|
||||
|
@ -327,9 +338,9 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
|
||||
// Make array from input params
|
||||
|
||||
bool_t is_in[] = { in_Default, in_te, in_te_IN };
|
||||
bool_t is_in[] = { in_Root, in_te, in_te_IN };
|
||||
|
||||
const char* NAME[] = { "DEFAULT", "TE", "TE_IN" };
|
||||
const char* NAME[] = { "ROOT", "TE", "TE_IN" };
|
||||
|
||||
// Now try to load the desired items
|
||||
|
||||
|
@ -339,8 +350,11 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
int32_t i,j,row,col, actual_bundle;
|
||||
int32_t index;
|
||||
const char *directory;
|
||||
char testdatapath[256];
|
||||
|
||||
directory=IntlTest::getTestDirectory();
|
||||
uprv_strcpy(testdatapath, directory);
|
||||
uprv_strcat(testdatapath, "testdata");
|
||||
|
||||
for (i=0; i<bundles_count; ++i)
|
||||
{
|
||||
|
@ -348,7 +362,8 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
action += param[i].name;
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
ResourceBundle theBundle( directory, *param[i].locale, status);
|
||||
ResourceBundle theBundle( testdatapath, *param[i].locale, status);
|
||||
//ResourceBundle theBundle( "c:\\icu\\icu\\source\\test\\testdata\\testdata", *param[i].locale, status);
|
||||
CONFIRM_UErrorCode(status,param[i].expected_constructor_status);
|
||||
|
||||
if(i == 5)
|
||||
|
@ -362,7 +377,7 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
|
||||
|
||||
UErrorCode expected_resource_status = U_MISSING_RESOURCE_ERROR;
|
||||
for (j=e_te_IN; j>=e_Default; --j)
|
||||
for (j=e_te_IN; j>=e_Root; --j)
|
||||
{
|
||||
if (is_in[j] && param[i].inherits[j])
|
||||
{
|
||||
|
@ -392,17 +407,29 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
//--------------------------------------------------------------------------
|
||||
// string
|
||||
|
||||
uprv_strcpy(tag, "string_");
|
||||
uprv_strcat(tag, frag);
|
||||
|
||||
action = param[i].name;
|
||||
action += ".getString(";
|
||||
action += tag;
|
||||
action += ")";
|
||||
|
||||
uprv_strcpy(tag, "string_");
|
||||
uprv_strcat(tag, frag);
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
|
||||
UnicodeString string(kERROR);
|
||||
status = U_ZERO_ERROR;
|
||||
theBundle.getString(tag, string, status);
|
||||
|
||||
const UnicodeString *t = theBundle.getString(tag, status);
|
||||
if(t != NULL) {
|
||||
string = *t;
|
||||
}
|
||||
|
||||
//UnicodeString string = theBundle.getStringEx(tag, status);
|
||||
|
||||
if(U_FAILURE(status)) {
|
||||
string.setTo(TRUE, kErrorUChars, kErrorLength);
|
||||
}
|
||||
|
||||
CONFIRM_UErrorCode(status, expected_resource_status);
|
||||
|
||||
|
@ -414,14 +441,14 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
//--------------------------------------------------------------------------
|
||||
// array
|
||||
|
||||
uprv_strcpy(tag, "array_");
|
||||
uprv_strcat(tag, frag);
|
||||
|
||||
action = param[i].name;
|
||||
action += ".getStringArray(";
|
||||
action += tag;
|
||||
action += ")";
|
||||
|
||||
uprv_strcpy(tag, "array_");
|
||||
uprv_strcat(tag, frag);
|
||||
|
||||
int32_t count = kERROR_COUNT;
|
||||
status = U_ZERO_ERROR;
|
||||
const UnicodeString* array = theBundle.getStringArray(tag, count, status);
|
||||
|
@ -460,7 +487,10 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
index = count ? (randi(count * 3) - count) : (randi(200) - 100);
|
||||
status = U_ZERO_ERROR;
|
||||
string = kERROR;
|
||||
theBundle.getArrayItem(tag, index, string, status);
|
||||
const UnicodeString *t = theBundle.getArrayItem(tag, index, status);
|
||||
if(t!=NULL) {
|
||||
string = *t;
|
||||
}
|
||||
expected_status = (index >= 0 && index < count) ? expected_resource_status : U_MISSING_RESOURCE_ERROR;
|
||||
CONFIRM_UErrorCode(status,expected_status);
|
||||
|
||||
|
@ -480,13 +510,14 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
//--------------------------------------------------------------------------
|
||||
// 2dArray
|
||||
|
||||
uprv_strcpy(tag, "array_2d_");
|
||||
uprv_strcat(tag, frag);
|
||||
|
||||
action = param[i].name;
|
||||
action += ".get2dArray(";
|
||||
action += tag;
|
||||
action += ")";
|
||||
|
||||
uprv_strcpy(tag, "array_2d_");
|
||||
uprv_strcat(tag, frag);
|
||||
|
||||
int32_t row_count = kERROR_COUNT, column_count = kERROR_COUNT;
|
||||
status = U_ZERO_ERROR;
|
||||
|
@ -533,7 +564,10 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
col = column_count ? (randi(column_count * 3) - column_count) : (randi(200) - 100);
|
||||
status = U_ZERO_ERROR;
|
||||
string = kERROR;
|
||||
theBundle.get2dArrayItem(tag, row, col, string, status);
|
||||
const UnicodeString *t = theBundle.get2dArrayItem(tag, row, col, status);
|
||||
if(t!=NULL) {
|
||||
string = *t;
|
||||
}
|
||||
expected_status = (row >= 0 && row < row_count && col >= 0 && col < column_count) ?
|
||||
expected_resource_status: U_MISSING_RESOURCE_ERROR;
|
||||
CONFIRM_UErrorCode(status,expected_status);
|
||||
|
@ -607,7 +641,10 @@ ResourceBundleTest::testTag(const char* frag,
|
|||
|
||||
status = U_ZERO_ERROR;
|
||||
string = kERROR;
|
||||
theBundle.getTaggedArrayItem(tag,item_tag,string,status);
|
||||
const UnicodeString *t = theBundle.getTaggedArrayItem(tag,item_tag,status);
|
||||
if(t!=NULL) {
|
||||
string = *t;
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
CONFIRM_UErrorCode(status,U_MISSING_RESOURCE_ERROR);
|
||||
|
|
|
@ -29,7 +29,7 @@ private:
|
|||
/**
|
||||
* extensive subtests called by TestResourceBundles
|
||||
**/
|
||||
bool_t testTag(const char* frag, bool_t in_Default, bool_t in_te, bool_t in_te_IN);
|
||||
bool_t testTag(const char* frag, bool_t in_Root, bool_t in_te, bool_t in_te_IN);
|
||||
|
||||
void record_pass(void);
|
||||
void record_fail(void);
|
||||
|
|
|
@ -21,40 +21,43 @@
|
|||
#
|
||||
#
|
||||
|
||||
GENRB_SOURCE = default.txt index.txt ar.txt ar_AE.txt \
|
||||
ar_BH.txt ar_DZ.txt ar_EG.txt ar_IQ.txt ar_JO.txt \
|
||||
ar_KW.txt ar_LB.txt ar_LY.txt ar_MA.txt ar_OM.txt \
|
||||
ar_QA.txt ar_SA.txt ar_SD.txt ar_SY.txt ar_TN.txt \
|
||||
ar_YE.txt be.txt be_BY.txt bg.txt bg_BG.txt \
|
||||
ca.txt ca_ES.txt ca_ES_EURO.txt cs.txt cs_CZ.txt \
|
||||
da.txt da_DK.txt de.txt de_AT.txt de_AT_EURO.txt \
|
||||
de_CH.txt de_DE.txt de_DE_EURO.txt de_LU.txt \
|
||||
de_LU_EURO.txt el.txt el_GR.txt en.txt en_AU.txt \
|
||||
en_CA.txt en_GB.txt en_IE.txt en_IE_EURO.txt \
|
||||
en_NZ.txt en_US.txt en_ZA.txt es.txt es_AR.txt \
|
||||
es_BO.txt es_CL.txt es_CO.txt es_CR.txt es_DO.txt \
|
||||
es_EC.txt es_ES.txt es_ES_EURO.txt es_GT.txt \
|
||||
es_HN.txt es_MX.txt es_NI.txt es_PA.txt es_PE.txt \
|
||||
es_PR.txt es_PY.txt es_SV.txt es_UY.txt es_VE.txt \
|
||||
et.txt et_EE.txt fi.txt fi_FI.txt fi_FI_EURO.txt \
|
||||
fr.txt fr_BE.txt fr_BE_EURO.txt fr_CA.txt fr_CH.txt \
|
||||
fr_FR.txt fr_FR_EURO.txt fr_LU.txt fr_LU_EURO.txt \
|
||||
he.txt he_IL.txt \
|
||||
hr.txt hr_HR.txt hu.txt hu_HU.txt is.txt \
|
||||
is_IS.txt it.txt it_CH.txt it_IT.txt it_IT_EURO.txt \
|
||||
iw.txt iw_IL.txt ja.txt ja_JP.txt ko.txt \
|
||||
ko_KR.txt lt.txt lt_LT.txt lv.txt lv_LV.txt \
|
||||
mk.txt mk_MK.txt nl.txt nl_BE.txt nl_BE_EURO.txt \
|
||||
nl_NL.txt nl_NL_EURO.txt no.txt no_NO.txt no_NO_NY.txt \
|
||||
pl.txt pl_PL.txt pt.txt pt_BR.txt pt_PT.txt \
|
||||
pt_PT_EURO.txt ro.txt ro_RO.txt ru.txt ru_RU.txt \
|
||||
sh.txt sh_YU.txt sk.txt sk_SK.txt sl.txt \
|
||||
sl_SI.txt sq.txt sq_AL.txt sr.txt sr_YU.txt \
|
||||
sv.txt sv_SE.txt th.txt th_TH.txt tr.txt \
|
||||
tr_TR.txt uk.txt uk_UA.txt vi.txt vi_VN.txt \
|
||||
zh.txt zh_CN.txt zh_HK.txt zh_TW.txt \
|
||||
$(TRANS)fullhalf.txt $(TRANS)index.txt $(TRANS)kbdescl1.txt \
|
||||
$(TRANS)larabic.txt $(TRANS)lcyril.txt $(TRANS)ldevan.txt \
|
||||
$(TRANS)lgreek.txt $(TRANS)lhebrew.txt $(TRANS)ljamo.txt \
|
||||
$(TRANS)lkana.txt $(TRANS)quotes.txt $(TRANS)ucname.txt \
|
||||
$(TEST)default.txt $(TEST)te.txt $(TEST)te_IN.txt
|
||||
GENRB_SOURCE = root.txt index.txt ar.txt ar_AE.txt\
|
||||
ar_BH.txt ar_DZ.txt ar_EG.txt ar_IQ.txt ar_JO.txt\
|
||||
ar_KW.txt ar_LB.txt ar_LY.txt ar_MA.txt ar_OM.txt\
|
||||
ar_QA.txt ar_SA.txt ar_SD.txt ar_SY.txt ar_TN.txt\
|
||||
ar_YE.txt be.txt be_BY.txt bg.txt bg_BG.txt\
|
||||
ca.txt ca_ES.txt ca_ES_EURO.txt cs.txt cs_CZ.txt\
|
||||
da.txt da_DK.txt de.txt de_AT.txt de_AT_EURO.txt\
|
||||
de_CH.txt de_DE.txt de_DE_EURO.txt de_LU.txt\
|
||||
de_LU_EURO.txt el.txt el_GR.txt en.txt en_AU.txt\
|
||||
en_CA.txt en_BE.txt en_GB.txt en_IE.txt en_IE_EURO.txt\
|
||||
en_NZ.txt en_US.txt en_ZA.txt es.txt es_AR.txt\
|
||||
es_BO.txt es_CL.txt es_CO.txt es_CR.txt es_DO.txt\
|
||||
es_EC.txt es_ES.txt es_ES_EURO.txt es_GT.txt\
|
||||
es_HN.txt es_MX.txt es_NI.txt es_PA.txt es_PE.txt\
|
||||
es_PR.txt es_PY.txt es_SV.txt es_UY.txt es_VE.txt\
|
||||
et.txt et_EE.txt fi.txt fi_FI.txt fi_FI_EURO.txt\
|
||||
fr.txt fr_BE.txt fr_BE_EURO.txt fr_CA.txt fr_CH.txt\
|
||||
fr_FR.txt fr_FR_EURO.txt fr_LU.txt fr_LU_EURO.txt\
|
||||
he.txt he_IL.txt\
|
||||
hr.txt hr_HR.txt hu.txt hu_HU.txt is.txt\
|
||||
is_IS.txt it.txt it_CH.txt it_IT.txt it_IT_EURO.txt\
|
||||
iw.txt iw_IL.txt ja.txt ja_JP.txt ko.txt\
|
||||
ko_KR.txt lt.txt lt_LT.txt lv.txt lv_LV.txt\
|
||||
mk.txt mk_MK.txt nl.txt nl_BE.txt nl_BE_EURO.txt\
|
||||
nl_NL.txt nl_NL_EURO.txt no.txt no_NO.txt no_NO_NY.txt\
|
||||
pl.txt pl_PL.txt pt.txt pt_BR.txt pt_PT.txt\
|
||||
pt_PT_EURO.txt ro.txt ro_RO.txt ru.txt ru_RU.txt\
|
||||
sh.txt sh_YU.txt sk.txt sk_SK.txt sl.txt\
|
||||
sl_SI.txt sq.txt sq_AL.txt sr.txt sr_YU.txt\
|
||||
sv.txt sv_SE.txt th.txt th_TH.txt tr.txt\
|
||||
tr_TR.txt uk.txt uk_UA.txt vi.txt vi_VN.txt\
|
||||
zh.txt zh_CN.txt zh_HK.txt zh_TW.txt
|
||||
|
||||
TRANSLIT_SOURCE = fullhalf.txt translit_index.txt kbdescl1.txt\
|
||||
larabic.txt lcyril.txt ldevan.txt\
|
||||
lgreek.txt lhebrew.txt ljamo.txt\
|
||||
lkana.txt quotes.txt ucname.txt
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue