X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1de532f57e9a7d25158edb8aed633fb1099a04ea..f0fbbe236452ae27a7577deafbbc44ace2c209e7:/tests/datetime/datetimetest.cpp diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index 6add06a431..f4f87df2f4 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -281,10 +281,10 @@ void DateTimeTestCase::TestTimeJDN() // JDNs must be computed for UTC times double jdn = dt.FromUTC().GetJulianDayNumber(); - CPPUNIT_ASSERT( jdn == d.jdn ); + CPPUNIT_ASSERT_EQUAL( d.jdn, jdn ); dt.Set(jdn); - CPPUNIT_ASSERT( dt.GetJulianDayNumber() == jdn ); + CPPUNIT_ASSERT_EQUAL( jdn, dt.GetJulianDayNumber() ); } } @@ -645,7 +645,7 @@ void DateTimeTestCase::TestTimeFormat() const char *result = dt2.ParseFormat(s, fmt); if ( !result ) { - // converion failed - should it have? + // conversion failed - should it have? CPPUNIT_ASSERT( kind == CompareNone ); } else // conversion succeeded @@ -685,9 +685,15 @@ void DateTimeTestCase::TestTimeFormat() } } + wxDateTime dt; + + // test partially specified dates too + wxDateTime dtDef(26, wxDateTime::Sep, 2008); + CPPUNIT_ASSERT( dt.ParseFormat("17", "%d") ); + CPPUNIT_ASSERT_EQUAL( 17, dt.GetDay() ); + // test compilation of some calls which should compile (and not result in // ambiguity because of char*<->wxCStrData<->wxString conversions) - wxDateTime dt; wxString s("foo"); CPPUNIT_ASSERT( !dt.ParseFormat("foo") ); CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo")) ); @@ -761,7 +767,7 @@ void DateTimeTestCase::TestTimeTicks() // GetValue() returns internal UTC-based representation, we need to // convert it to local TZ before comparing - long ticks = (dt.GetValue() / 1000).ToLong() + TZ_LOCAL.GetOffset(); + time_t ticks = (dt.GetValue() / 1000).ToLong() + TZ_LOCAL.GetOffset(); if ( dt.IsDST() ) ticks += 3600; CPPUNIT_ASSERT_EQUAL( d.gmticks, ticks + tzOffset ); @@ -873,7 +879,6 @@ void DateTimeTestCase::TestDateParse() for ( size_t n = 0; n < WXSIZEOF(parseTestDates); n++ ) { - wxDateTime dt; if ( dt.ParseDate(parseTestDates[n].str) ) { CPPUNIT_ASSERT( parseTestDates[n].good ); @@ -978,7 +983,6 @@ void DateTimeTestCase::TestDateTimeParse() wxDateTime dt; for ( size_t n = 0; n < WXSIZEOF(parseTestDates); n++ ) { - wxDateTime dt; if ( dt.ParseDateTime(parseTestDates[n].str) ) { CPPUNIT_ASSERT( parseTestDates[n].good );