added wxTimeSpan::Format() test

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40199 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-07-20 13:20:00 +00:00
parent 0bcd4039e2
commit 1bf29a7a6c

View File

@@ -187,6 +187,7 @@ private:
CPPUNIT_TEST( TestTimeWDays );
CPPUNIT_TEST( TestTimeDST );
CPPUNIT_TEST( TestTimeFormat );
CPPUNIT_TEST( TestTimeSpanFormat );
CPPUNIT_TEST( TestTimeTicks );
CPPUNIT_TEST( TestParceRFC822 );
CPPUNIT_TEST( TestDateParse );
@@ -201,6 +202,7 @@ private:
void TestTimeWDays();
void TestTimeDST();
void TestTimeFormat();
void TestTimeSpanFormat();
void TestTimeTicks();
void TestParceRFC822();
void TestDateParse();
@@ -669,6 +671,28 @@ void DateTimeTestCase::TestTimeFormat()
}
}
void DateTimeTestCase::TestTimeSpanFormat()
{
static const struct TimeSpanFormatTestData
{
long h, min, sec, msec;
const wxChar *fmt;
const wxChar *result;
} testSpans[] =
{
{ 12, 34, 56, 789, _T("%H:%M:%S.%l"), _T("12:34:56.789") },
{ 1, 2, 3, 0, _T("%H:%M:%S"), _T("01:02:03") },
{ 1, 2, 3, 0, _T("%S"), _T("3723") },
};
for ( size_t n = 0; n < WXSIZEOF(testSpans); n++ )
{
const TimeSpanFormatTestData& td = testSpans[n];
wxTimeSpan ts(td.h, td.min, td.sec, td.msec);
CPPUNIT_ASSERT_EQUAL( wxString(td.result), ts.Format(td.fmt) );
}
}
void DateTimeTestCase::TestTimeTicks()
{
for ( size_t n = 0; n < WXSIZEOF(testDates); n++ )