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
}
}
+ 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")) );
// 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;
- WX_ASSERT_TIME_T_EQUAL( d.gmticks, ticks + tzOffset );
+ CPPUNIT_ASSERT_EQUAL( d.gmticks, ticks + tzOffset );
dt = d.DT().FromTimezone(wxDateTime::UTC);
ticks = (dt.GetValue() / 1000).ToLong();
- WX_ASSERT_TIME_T_EQUAL( d.gmticks, ticks );
+ CPPUNIT_ASSERT_EQUAL( d.gmticks, ticks );
}
}