-// helper class setting the locale to "C" for its lifetime
-class CLocaleSetter
-{
-public:
- CLocaleSetter() : m_locOld(setlocale(LC_ALL, "C")) { }
- ~CLocaleSetter() { setlocale(LC_ALL, m_locOld); }
-
-private:
- const char * const m_locOld;
- wxDECLARE_NO_COPY_CLASS(CLocaleSetter);
-};
-
hour, min, sec,
wxDateTime::GetMonthName(month).c_str(),
day,
abs(wxDateTime::ConvertYearToBC(year)),
hour, min, sec,
wxDateTime::GetMonthName(month).c_str(),
day,
abs(wxDateTime::ConvertYearToBC(year)),
day,
wxDateTime::GetMonthName(month, wxDateTime::Name_Abbr).c_str(),
abs(wxDateTime::ConvertYearToBC(year)),
day,
wxDateTime::GetMonthName(month, wxDateTime::Name_Abbr).c_str(),
abs(wxDateTime::ConvertYearToBC(year)),
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DateTimeTestCase, "DateTimeTestCase" );
// ============================================================================
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DateTimeTestCase, "DateTimeTestCase" );
// ============================================================================
- case 1: which = _T("first"); break;
- case 2: which = _T("second"); break;
- case 3: which = _T("third"); break;
- case 4: which = _T("fourth"); break;
- case 5: which = _T("fifth"); break;
+ case 1: which = wxT("first"); break;
+ case 2: which = wxT("second"); break;
+ case 3: which = wxT("third"); break;
+ case 4: which = wxT("fourth"); break;
+ case 5: which = wxT("fifth"); break;
which.c_str(),
wxDateTime::GetWeekDayName(wday).c_str(),
wxDateTime::GetMonthName(month).c_str(),
which.c_str(),
wxDateTime::GetWeekDayName(wday).c_str(),
wxDateTime::GetMonthName(month).c_str(),
{ { 16, wxDateTime::Oct, 1942, 0, 0, 0, 0.0, wxDateTime::Inv_WeekDay, 0 }, 42, 3, 3, 289 },
{ { 30, wxDateTime::Dec, 2003, 0, 0, 0, 0.0, wxDateTime::Inv_WeekDay, 0 }, 1, 5, 5, 364 },
{ { 2, wxDateTime::Jan, 2004, 0, 0, 0, 0.0, wxDateTime::Inv_WeekDay, 0 }, 1, 1, 1, 2 },
{ { 16, wxDateTime::Oct, 1942, 0, 0, 0, 0.0, wxDateTime::Inv_WeekDay, 0 }, 42, 3, 3, 289 },
{ { 30, wxDateTime::Dec, 2003, 0, 0, 0, 0.0, wxDateTime::Inv_WeekDay, 0 }, 1, 5, 5, 364 },
{ { 2, wxDateTime::Jan, 2004, 0, 0, 0, 0.0, wxDateTime::Inv_WeekDay, 0 }, 1, 1, 1, 2 },
+ { { 5, wxDateTime::Jan, 2010, 0, 0, 0, 0.0, wxDateTime::Inv_WeekDay, 0 }, 1, 2, 2, 5 },
+ { { 3, wxDateTime::Jan, 2011, 0, 0, 0, 0.0, wxDateTime::Inv_WeekDay, 0 }, 1, 2, 2, 3 },
wmon2 = dt.GetWeekOfMonth(wxDateTime::Sunday_First),
dnum = dt.GetDayOfYear();
wmon2 = dt.GetWeekOfMonth(wxDateTime::Sunday_First),
dnum = dt.GetDayOfYear();
- CPPUNIT_ASSERT_EQUAL( wn.dnum, dnum );
- CPPUNIT_ASSERT_EQUAL( wn.wmon, wmon );
- CPPUNIT_ASSERT_EQUAL( wn.wmon2, wmon2 );
- CPPUNIT_ASSERT_EQUAL( wn.week, week );
+ WX_ASSERT_EQUAL_MESSAGE( ("day of year for %s", d.Format()),
+ wn.dnum, dnum );
+ WX_ASSERT_EQUAL_MESSAGE( ("week of month (Monday) for %s", d.Format()),
+ wn.wmon, wmon );
+ WX_ASSERT_EQUAL_MESSAGE( ("week of month (Sunday) for %s", d.Format()),
+ wn.wmon2, wmon2 );
+ WX_ASSERT_EQUAL_MESSAGE( ("week of year for %s", d.Format()),
+ wn.week, week );
CPPUNIT_ASSERT_EQUAL( wxDateTime::Today(), dt );
for ( size_t n = 0; n < WXSIZEOF(parseTestDates); n++ )
CPPUNIT_ASSERT_EQUAL( wxDateTime::Today(), dt );
for ( size_t n = 0; n < WXSIZEOF(parseTestDates); n++ )
- { "Thu 22 Nov 2007 07:40:00 PM",
- { 22, wxDateTime::Nov, 2007, 19, 40, 0}, true },
+ {
+ "Thu 22 Nov 2007 07:40:00 PM",
+ { 22, wxDateTime::Nov, 2007, 19, 40, 0 },
+ true
+ },
+
+ {
+ "2010-01-04 14:30",
+ { 4, wxDateTime::Jan, 2010, 14, 30, 0 },
+ true
+ },
+
+ {
+ "bloordyblop",
+ { 1, wxDateTime::Jan, 9999, 0, 0, 0},
+ false
+ },