better ParseDate() test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
//#define TEST_ARRAYS
|
//#define TEST_ARRAYS
|
||||||
//#define TEST_CMDLINE
|
//#define TEST_CMDLINE
|
||||||
//#define TEST_DATETIME
|
#define TEST_DATETIME
|
||||||
//#define TEST_DIR
|
//#define TEST_DIR
|
||||||
//#define TEST_DLLLOADER
|
//#define TEST_DLLLOADER
|
||||||
//#define TEST_EXECUTE
|
//#define TEST_EXECUTE
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
//#define TEST_STRINGS
|
//#define TEST_STRINGS
|
||||||
//#define TEST_THREADS
|
//#define TEST_THREADS
|
||||||
//#define TEST_TIMER
|
//#define TEST_TIMER
|
||||||
#define TEST_VCARD
|
//#define TEST_VCARD
|
||||||
//#define TEST_WCHAR
|
//#define TEST_WCHAR
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -2260,16 +2260,24 @@ static void TestInteractive()
|
|||||||
if ( !fgets(buf, WXSIZEOF(buf), stdin) )
|
if ( !fgets(buf, WXSIZEOF(buf), stdin) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// kill the last '\n'
|
||||||
|
buf[strlen(buf) - 1] = 0;
|
||||||
|
|
||||||
wxDateTime dt;
|
wxDateTime dt;
|
||||||
if ( !dt.ParseDate(buf) )
|
const char *p = dt.ParseDate(buf);
|
||||||
|
if ( !p )
|
||||||
{
|
{
|
||||||
puts("failed to parse the date");
|
printf("ERROR: failed to parse the date '%s'.\n", buf);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if ( *p )
|
||||||
|
{
|
||||||
|
printf("WARNING: parsed only first %u characters.\n", p - buf);
|
||||||
|
}
|
||||||
|
|
||||||
printf("%s: day %u, week of month %u/%u, week of year %u\n",
|
printf("%s: day %u, week of month %u/%u, week of year %u\n",
|
||||||
dt.FormatISODate().c_str(),
|
dt.Format("%b %d, %Y").c_str(),
|
||||||
dt.GetDayOfYear(),
|
dt.GetDayOfYear(),
|
||||||
dt.GetWeekOfMonth(wxDateTime::Monday_First),
|
dt.GetWeekOfMonth(wxDateTime::Monday_First),
|
||||||
dt.GetWeekOfMonth(wxDateTime::Sunday_First),
|
dt.GetWeekOfMonth(wxDateTime::Sunday_First),
|
||||||
@@ -3318,9 +3326,9 @@ int main(int argc, char **argv)
|
|||||||
TestTimeArithmetics();
|
TestTimeArithmetics();
|
||||||
TestTimeHolidays();
|
TestTimeHolidays();
|
||||||
|
|
||||||
}
|
|
||||||
TestTimeZoneBug();
|
TestTimeZoneBug();
|
||||||
if ( 0 )
|
}
|
||||||
|
if ( 1 )
|
||||||
TestInteractive();
|
TestInteractive();
|
||||||
#endif // TEST_DATETIME
|
#endif // TEST_DATETIME
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user