+ wxString s = dt.Format(formatTestFormats[n].format);
+ printf("%s", s.c_str());
+
+ // what can we recover?
+ int kind = formatTestFormats[n].compareKind;
+
+ // convert back
+ wxDateTime dt2;
+ const wxChar *result = dt2.ParseFormat(s, formatTestFormats[n].format);
+ if ( !result )
+ {
+ // converion failed - should it have?
+ if ( kind == CompareNone )
+ puts(" (ok)");
+ else
+ puts(" (ERROR: conversion back failed)");
+ }
+ else if ( *result )
+ {
+ // should have parsed the entire string
+ puts(" (ERROR: conversion back stopped too soon)");
+ }
+ else
+ {
+ bool equal = FALSE; // suppress compilaer warning
+ switch ( kind )
+ {
+ case CompareBoth:
+ equal = dt2 == dt;
+ break;
+
+ case CompareDate:
+ equal = dt.IsSameDate(dt2);
+ break;
+
+ case CompareTime:
+ equal = dt.IsSameTime(dt2);
+ break;
+ }
+
+ if ( !equal )
+ {
+ printf(" (ERROR: got back '%s' instead of '%s')\n",
+ dt2.Format().c_str(), dt.Format().c_str());
+ }
+ else
+ {
+ puts(" (ok)");
+ }
+ }