ICU-3785 Test case to expose the error.

X-SVN-Rev: 25646
This commit is contained in:
Jason Spieth 2009-03-24 04:43:23 +00:00
parent f8efff95be
commit ca4c5623ce
2 changed files with 44 additions and 1 deletions
icu4c/source/test/intltest

View file

@ -14,6 +14,10 @@
#include "unicode/smpdtfmt.h"
#include "unicode/simpletz.h"
#include "unicode/dbgutil.h"
#include "unicode/udat.h"
#include "unicode/ustring.h"
#define mkcstr(U) u_austrcpy(calloc(8, u_strlen(U) + 1), U)
// *****************************************************************************
// class CalendarTest
@ -210,6 +214,13 @@ void CalendarTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
Test6703();
}
break;
case 23:
name = "Test3785";
if(exec) {
logln("Test3785---"); logln("");
Test3785();
}
break;
default: name = ""; break;
}
}
@ -2013,6 +2024,38 @@ void CalendarTest::Test6703()
return;
}
void CalendarTest::Test3785()
{
UErrorCode status = U_ZERO_ERROR;
UChar uzone[] = {'E', 'u', 'r', 'o', 'p', 'e', '/', 'P', 'a', 'r', 'i', 's', 0};
UDateFormat * df = udat_open(UDAT_NONE, UDAT_NONE, "en@calendar=islamic", uzone,
u_strlen(uzone), NULL, 0, &status);
if (NULL == df || U_FAILURE(status)) return;
UChar upattern[64];
u_uastrcpy(upattern, "EEE d MMMM y G, HH:mm:ss");
udat_applyPattern(df, FALSE, upattern, u_strlen(upattern));
UChar ubuffer[1024];
UDate ud0 = 1337557623000.0;
status = U_ZERO_ERROR;
udat_format(df, ud0, ubuffer, 1024, NULL, &status);
if (U_FAILURE(status)) return;
//printf("formatted: '%s'\n", mkcstr(ubuffer));
ud0 += 1000.0; // add one second
status = U_ZERO_ERROR;
udat_format(df, ud0, ubuffer, 1024, NULL, &status);
if (U_FAILURE(status)) return;
//printf("formatted: '%s'\n", mkcstr(ubuffer));
return;
}
#endif /* #if !UCONFIG_NO_FORMATTING */

View file

@ -217,7 +217,7 @@ public: // package
// internal - for other test use
public:
void Test6703(void);
void Test3785(void);
};
#endif /* #if !UCONFIG_NO_FORMATTING */