summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-02-29 14:08:17 +0100
committerMichael Stahl <mstahl@redhat.com>2012-02-29 14:28:44 +0100
commiteebc3e941131ffb09439f69313e697e0ed660135 (patch)
treed07945bc2ecbb47188f2eb016c621845b8316dd5
parentff47b3717ca8bc561917c8ad5cd8bb5749638270 (diff)
sax: ConverterTest: add leap year tests
(cherry picked from commit 0d9757e43217929fa172c1feecd161873cd7019b) Signed-off-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sax/qa/cppunit/test_converter.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index dcd5bb7e5c..4e3a56fc57 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -212,6 +212,10 @@ void ConverterTest::testDateTime()
doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333)
/*(0, 0, 0, 0, 2, 1, 333)*/,
"0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ );
+ doTest( util::DateTime(0, 0, 0, 0, 29, 2, 2000), // leap year
+ "2000-02-29T00:00:00-00:00", "2000-02-29T00:00:00" );
+ doTest( util::DateTime(0, 0, 0, 0, 29, 2, 1600), // leap year
+ "1600-02-29T00:00:00-00:00", "1600-02-29T00:00:00" );
doTestDateTimeF( "+0001-01-01T00:00:00" ); // invalid: ^+
doTestDateTimeF( "1-01-01T00:00:00" ); // invalid: < 4 Y
doTestDateTimeF( "0001-1-01T00:00:00" ); // invalid: < 2 M
@@ -234,6 +238,8 @@ void ConverterTest::testDateTime()
doTestDateTimeF( "0001-01-02T00:00:00+14:01" ); // invalid: TZ > +14:00
doTestDateTimeF( "0001-01-02T00:00:00-15:00" ); // invalid: TZ < -14:00
doTestDateTimeF( "0001-01-02T00:00:00-14:01" ); // invalid: TZ < -14:00
+ doTestDateTimeF( "2100-02-29T00:00:00-00:00" ); // invalid: no leap year
+ doTestDateTimeF( "1900-02-29T00:00:00-00:00" ); // invalid: no leap year
OSL_TRACE("\nSAX CONVERTER TEST END\n");
}