+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") },
+ { -1, -2, -3, 0, _T("%S"), _T("-3723") },
+ { -1, -2, -3, 0, _T("%H:%M:%S"), _T("-01:02:03") },
+ { 26, 0, 0, 0, _T("%H"), _T("26") },
+ { 26, 0, 0, 0, _T("%D, %H"), _T("1, 02") },
+ { -26, 0, 0, 0, _T("%H"), _T("-26") },
+ { -26, 0, 0, 0, _T("%D, %H"), _T("-1, 02") },
+ { 219, 0, 0, 0, _T("%H"), _T("219") },
+ { 219, 0, 0, 0, _T("%D, %H"), _T("9, 03") },
+ { 219, 0, 0, 0, _T("%E, %D, %H"), _T("1, 2, 03") },
+ };
+
+ 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) );
+ }
+}
+