mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-1775 Test for exemplar characters
X-SVN-Rev: 8133
This commit is contained in:
parent
1d263414fa
commit
f7ba75d9af
2 changed files with 31 additions and 1 deletions
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "cstring.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/uniset.h"
|
||||
#include "unicode/resbund.h"
|
||||
#include "restest.h"
|
||||
#include <limits.h>
|
||||
|
@ -192,7 +193,7 @@ void ResourceBundleTest::runIndexedTest( int32_t index, UBool exec, const char*
|
|||
switch (index) {
|
||||
case 0: name = "TestResourceBundles"; if (exec) TestResourceBundles(); break;
|
||||
case 1: name = "TestConstruction"; if (exec) TestConstruction(); break;
|
||||
|
||||
case 2: name = "TestExemplar"; if (exec) TestExemplar(); break;
|
||||
default: name = ""; break; //needed to end loop
|
||||
}
|
||||
}
|
||||
|
@ -529,5 +530,32 @@ ResourceBundleTest::record_fail(UnicodeString errMessage)
|
|||
err(errMessage);
|
||||
++fail;
|
||||
}
|
||||
|
||||
void
|
||||
ResourceBundleTest::TestExemplar(){
|
||||
|
||||
int32_t locCount = uloc_countAvailable();
|
||||
int32_t locIndex=0;
|
||||
int num=0;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
for(;locIndex<locCount;locIndex++){
|
||||
const char* locale = uloc_getAvailable(locIndex);
|
||||
UResourceBundle *resb =ures_open(NULL,locale,&status);
|
||||
if(U_SUCCESS(status) && status!=U_USING_FALLBACK_WARNING && status!=U_USING_DEFAULT_WARNING){
|
||||
int32_t len=0;
|
||||
const UChar* strSet = ures_getStringByKey(resb,"ExemplarCharacters",&len,&status);
|
||||
UnicodeSet set(strSet,status);
|
||||
if(U_FAILURE(status)){
|
||||
errln("Could not construct UnicodeSet from pattern for ExemplarCharacters in locale : %s. Error: %s",locale,u_errorName(status));
|
||||
status=U_ZERO_ERROR;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
ures_close(resb);
|
||||
}
|
||||
logln("Number of installed locales with exemplar characters that could be tested: %d",num);
|
||||
|
||||
}
|
||||
|
||||
//eof
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ public:
|
|||
**/
|
||||
void TestConstruction(void);
|
||||
|
||||
void TestExemplar(void);
|
||||
|
||||
private:
|
||||
/**
|
||||
* The assignment operator has no real implementation.
|
||||
|
|
Loading…
Add table
Reference in a new issue