+void DateTimeTestCase::TestTimeSpanFormat()
+{
+ static const struct TimeSpanFormatTestData
+ {
+ long h, min, sec, msec;
+ const char *fmt;
+ const char *result;
+ } testSpans[] =
+ {
+ { 12, 34, 56, 789, "%H:%M:%S.%l", "12:34:56.789" },
+ { 1, 2, 3, 0, "%H:%M:%S", "01:02:03" },
+ { 1, 2, 3, 0, "%S", "3723" },
+ { -1, -2, -3, 0, "%S", "-3723" },
+ { -1, -2, -3, 0, "%H:%M:%S", "-01:02:03" },
+ { 26, 0, 0, 0, "%H", "26" },
+ { 26, 0, 0, 0, "%D, %H", "1, 02" },
+ { -26, 0, 0, 0, "%H", "-26" },
+ { -26, 0, 0, 0, "%D, %H", "-1, 02" },
+ { 219, 0, 0, 0, "%H", "219" },
+ { 219, 0, 0, 0, "%D, %H", "9, 03" },
+ { 219, 0, 0, 0, "%E, %D, %H", "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) );
+ }
+}
+