From 79637baca18a95ee87a2f2e85c406fa93efbaba2 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Tue, 25 Apr 2006 23:28:06 +0000 Subject: [PATCH] ICU-5032 Improve code coverage, and improve testing X-SVN-Rev: 19592 --- icu4c/source/test/cintltst/udatatst.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/icu4c/source/test/cintltst/udatatst.c b/icu4c/source/test/cintltst/udatatst.c index bda9ec77f8..26cada315c 100644 --- a/icu4c/source/test/cintltst/udatatst.c +++ b/icu4c/source/test/cintltst/udatatst.c @@ -601,10 +601,12 @@ static void TestUDataOpenChoiceDemo1() { const char* name[]={ "cnvalias", "unames", - "test" + "test", + "nam" }; const char* type="icu"; const char* testPath="testdata"; + const char* fullTestDataPath = loadTestData(&status); result=udata_openChoice(NULL, "icu", name[0], isAcceptable1, NULL, &status); if(U_FAILURE(status)){ @@ -614,6 +616,7 @@ static void TestUDataOpenChoiceDemo1() { udata_close(result); } + status=U_ZERO_ERROR; result=udata_openChoice(NULL, type, name[1], isAcceptable1, NULL, &status); if(U_FAILURE(status)){ status=U_ZERO_ERROR; @@ -622,11 +625,15 @@ static void TestUDataOpenChoiceDemo1() { log_err("FAIL: udata_openChoice() failed name=%s, type=%s, \n errorcode=%s\n", name[1], type, myErrorName(status)); } } + else { + log_err("FAIL: udata_openChoice() unexpectedly passed. name=%s, type=%s, \n errorcode=%s\n", name[1], type, myErrorName(status)); + } if(U_SUCCESS(status)){ udata_close(result); } + status=U_ZERO_ERROR; result=udata_openChoice(testPath, type, name[2], isAcceptable1, NULL, &status); if(U_FAILURE(status)){ status=U_ZERO_ERROR; @@ -635,10 +642,26 @@ static void TestUDataOpenChoiceDemo1() { log_err("FAIL: udata_openChoice() failed path=%s name=%s, type=%s, \n errorcode=%s\n", testPath, name[2], type, myErrorName(status)); } } + else { + log_err("FAIL: udata_openChoice() unexpectedly passed. name=%s, type=%s, \n errorcode=%s\n", name[2], type, myErrorName(status)); + } if(U_SUCCESS(status)){ udata_close(result); } + + status=U_ZERO_ERROR; + type="typ"; + result=udata_openChoice(fullTestDataPath, type, name[3], isAcceptable1, NULL, &status); + if(status != U_INVALID_FORMAT_ERROR){ + log_err("FAIL: udata_openChoice() did not fail as expected. name=%s, type=%s, \n errorcode=%s\n", name[3], type, myErrorName(status)); + } + + status=U_USELESS_COLLATOR_ERROR; + result=udata_openChoice(fullTestDataPath, type, name[3], isAcceptable1, NULL, &status); + if(status != U_USELESS_COLLATOR_ERROR){ + log_err("FAIL: udata_openChoice() did not fail as expected. name=%s, type=%s, \n errorcode=%s\n", name[3], type, myErrorName(status)); + } } static UBool U_CALLCONV