TESTCASE(0, testAPI);
TESTCASE(1, testFormat);
TESTCASE(2, testFormatUserDII);
- TESTCASE(3, testStress);
+ TESTCASE(3, testSetIntervalPatternNoSideEffect);
+ TESTCASE(4, testStress);
default: name = ""; break;
}
}
}
+void DateIntervalFormatTest::testSetIntervalPatternNoSideEffect() {
+ UErrorCode ec = U_ZERO_ERROR;
+ DateIntervalInfo* dtitvinf = new DateIntervalInfo(ec);
+ UnicodeString expected;
+ dtitvinf->getIntervalPattern(ctou("yMd"), UCAL_DATE, expected, ec);
+ dtitvinf->setIntervalPattern(ctou("yMd"), UCAL_DATE, ctou("M/d/y \\u2013 d"), ec);
+ delete dtitvinf;
+ dtitvinf = new DateIntervalInfo(ec);
+ UnicodeString actual;
+ dtitvinf->getIntervalPattern(ctou("yMd"), UCAL_DATE, actual, ec);
+ delete dtitvinf;
+ if (expected != actual) {
+ errln("DateIntervalInfo.setIntervalPattern should have no side effects.");
+ }
+}
+
+
void DateIntervalFormatTest::expectUserDII(const char** data,
int32_t data_length) {
int32_t i = 0;
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2008, International Business Machines Corporation and
+ * Copyright (c) 2008-2013 International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
*/
void testFormatUserDII();
+ /**
+ * Test for no unwanted side effects when setting
+ * interval patterns.
+ */
+ void testSetIntervalPatternNoSideEffect();
+
/**
* Stress test -- stress test formatting on 40 locales
*/