/*
*******************************************************************************
*
- * Copyright (C) 2003, International Business Machines
+ * Copyright (C) 2003-2008, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
static void Test_nfs4_cs_prep(void);
static void Test_nfs4_cis_prep(void);
static void Test_nfs4_mixed_prep(void);
+static void TestBEAMWarning(void);
+static void TestCoverage(void);
void
addUStringPrepTest(TestNode** root)
addTest(root, &Test_nfs4_cs_prep, "spreptst/Test_nfs4_cs_prep");
addTest(root, &Test_nfs4_cis_prep, "spreptst/Test_nfs4_cis_prep");
addTest(root, &Test_nfs4_mixed_prep, "spreptst/Test_nfs4_mixed_prep");
+ addTest(root, &TestBEAMWarning, "spreptst/TestBEAMWarning");
+ addTest(root, &TestCoverage, "spreptst/TestCoverage");
}
static void
Test_nfs4_cs_prep_data(void){
UErrorCode errorCode = U_ZERO_ERROR;
+ loadTestData(&errorCode);
+ if(U_FAILURE(errorCode)) {
+ log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode));
+ return;
+ }
+
log_verbose("Testing nfs4_cs_prep_ci.txt\n");
doStringPrepTest("nfscsi","nfs4_cs_prep_ci.txt", USPREP_DEFAULT, &errorCode);
static void
Test_nfs4_mixed_prep_data(void){
UErrorCode errorCode = U_ZERO_ERROR;
+ loadTestData(&errorCode);
+ if(U_FAILURE(errorCode)) {
+ log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode));
+ return;
+ }
+
log_verbose("Testing nfs4_mixed_prep_s.txt\n");
doStringPrepTest("nfsmxs","nfs4_mixed_prep_s.txt", USPREP_DEFAULT, &errorCode);
}
-static struct ConformanceTestCases
+static const struct ConformanceTestCases
{
const char *comment;
const char *in;
static void Test_nfs4_cis_prep(void){
int32_t i=0;
+ UErrorCode loadStatus = U_ZERO_ERROR;
+ loadTestData(&loadStatus);
+ if (U_FAILURE(loadStatus)) {
+ log_data_err("Test could not initialize. Got %s\n", u_errorName(loadStatus));
+ return;
+ }
for(i=0;i< (int32_t)(sizeof(conformanceTestCases)/sizeof(conformanceTestCases[0]));i++){
const char* src = conformanceTestCases[i].in;
static void
Test_nfs4_mixed_prep(void){
+ UErrorCode loadStatus = U_ZERO_ERROR;
+ loadTestData(&loadStatus);
+ if (U_FAILURE(loadStatus)) {
+ log_data_err("Test could not initialize. Got %s\n", u_errorName(loadStatus));
+ return;
+ }
+
{
int32_t i=0;
char src[MAX_BUFFER_SIZE];
static void
Test_nfs4_cs_prep(void){
+ UErrorCode errorCode = U_ZERO_ERROR;
+ loadTestData(&errorCode);
+ if(U_FAILURE(errorCode)) {
+ log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(errorCode));
+ return;
+ }
+
{
/* BiDi checking is turned off */
const char *source = "\\uC138\\uACC4\\uC758\\uBAA8\\uB4E0\\uC0AC\\uB78C\\uB4E4\\uC774\\u0644\\u064A\\u0647\\uD55C\\uAD6D\\uC5B4\\uB97C\\uC774\\uD574\\uD55C\\uB2E4\\uBA74";
}
}
+
+
+static void TestBEAMWarning(){
+ UErrorCode status = U_ZERO_ERROR;
+ UParseError parseError;
+ UStringPrepProfile* profile = NULL;
+ /* get the test data path */
+ const char *testdatapath = NULL;
+ UChar src =0x0000;
+ testdatapath = loadTestData(&status);
+ if(U_FAILURE(status)) {
+ log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status));
+ return;
+ }
+ /* open the profile */
+ profile = usprep_open(testdatapath, "nfscis", &status);
+ usprep_prepare(profile,&src , 0, NULL, 0, USPREP_DEFAULT, &parseError, &status);
+
+ usprep_close(profile);
+}
+
+static void TestCoverage(void) {
+ UErrorCode status = U_USELESS_COLLATOR_ERROR;
+ UParseError parseError;
+
+ usprep_open(NULL, NULL, &status);
+ if (status != U_USELESS_COLLATOR_ERROR) {
+ log_err("usprep_open didn't react correctly to a bad UErrorCode\n");
+ }
+ usprep_prepare(NULL, NULL, 0, NULL, 0, USPREP_DEFAULT, &parseError, &status);
+ if (status != U_USELESS_COLLATOR_ERROR) {
+ log_err("usprep_prepare didn't react correctly to a bad UErrorCode\n");
+ }
+ status = U_ZERO_ERROR;
+ usprep_prepare(NULL, NULL, 0, NULL, 0, USPREP_DEFAULT, &parseError, &status);
+ if (status != U_ILLEGAL_ARGUMENT_ERROR) {
+ log_err("usprep_prepare didn't check its arguments\n");
+ }
+
+ /* Don't crash */
+ usprep_close(NULL);
+}
+
#endif
/*