diff --git a/icu4c/source/test/cintltst/cdtdptst.c b/icu4c/source/test/cintltst/cdtdptst.c index 3d65f3fe46..2c4206bbf3 100644 --- a/icu4c/source/test/cintltst/cdtdptst.c +++ b/icu4c/source/test/cintltst/cdtdptst.c @@ -108,6 +108,7 @@ void TestPartialParse994() UDateFormat *f; UErrorCode status = U_ZERO_ERROR; UChar *s; + UChar *fmtChars; UDate d, null; null=0; @@ -123,7 +124,17 @@ void TestPartialParse994() u_uastrcpy(s, "01/01/1997 10:11:42 AM"); pos=0; d = udat_parse(f, s, u_strlen(s), &pos, &status); - log_verbose("%s\n", austrdup(myDateFormat(f, d)) ); + if(U_FAILURE(status)) { + log_data_err("FAIL: could not parse - exitting"); + return; + } + fmtChars = myDateFormat(f, d); + if(fmtChars) { + log_verbose("%s\n", fmtChars); + } else { + log_data_err("FAIL: could not format \n"); + return; + } tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/01 10:11:42", d); tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/01 10:", null); tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/01 10", null); @@ -246,6 +257,10 @@ void TestCzechMonths459() juneStr = myDateFormat(fmt, june); julyStr = myDateFormat(fmt, july); pos=0; + if(juneStr == NULL) { + log_data_err("Can't load juneStr. Quitting.\n"); + return; + } d = udat_parse(fmt, juneStr, u_strlen(juneStr), &pos, &status); date = myDateFormat(fmt, d); u_UCharsToChars(date, buffer, (int32_t)(u_strlen(date)+1)); diff --git a/icu4c/source/test/cintltst/cdtrgtst.c b/icu4c/source/test/cintltst/cdtrgtst.c index ffa20a7e23..55e44e5ab4 100644 --- a/icu4c/source/test/cintltst/cdtrgtst.c +++ b/icu4c/source/test/cintltst/cdtrgtst.c @@ -79,7 +79,12 @@ void Test4029195() fmdt = myFormatit(df, today); - log_verbose("today: %s\n", austrdup(fmdt)); + if(fmdt) { + log_verbose("today: %s\n", austrdup(fmdt)); + } else { + log_data_err("ERROR: couldn't format, exitting test"); + return; + } temp=(UChar*)malloc(sizeof(UChar) * 10); u_uastrcpy(temp, "M yyyy dd"); @@ -411,6 +416,10 @@ void Test4073003() result =myFormatit(fmt, d); result2 =myFormatit(fmt, dd); + if(!result || !result2) { + log_data_err("Fail: could not format - exitting test"); + return; + } if (u_strcmp(result, result2)!=0){ log_err("Fail: %s != %s\n", austrdup(result), austrdup(result2) ); } @@ -473,6 +482,10 @@ void Test714(void) return; } result =myFormatit(fmt, d); + if(!result) { + log_data_err("Fail: could not format - exitting test\n"); + return; + } u_uastrcpy(temp, expect); if (u_strcmp(result, temp)!=0){ log_err("Fail: %s != %s\n", austrdup(result), expect);