testdate.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: tests/testdate.h
  3. // Purpose: Unit test helpers for dealing with wxDateTime.
  4. // Author: Vadim Zeitlin
  5. // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
  6. // Licence: wxWindows licence
  7. ///////////////////////////////////////////////////////////////////////////////
  8. #ifndef _WX_TESTS_TESTDATE_H_
  9. #define _WX_TESTS_TESTDATE_H_
  10. #include "wx/datetime.h"
  11. // need this to be able to use CPPUNIT_ASSERT_EQUAL with wxDateTime objects
  12. inline std::ostream& operator<<(std::ostream& ostr, const wxDateTime& dt)
  13. {
  14. ostr << dt.FormatISOCombined(' ');
  15. return ostr;
  16. }
  17. // need this to be able to use CPPUNIT_ASSERT_EQUAL with wxDateSpan objects
  18. inline std::ostream& operator<<(std::ostream& ostr, const wxDateSpan& span)
  19. {
  20. ostr << span.GetYears() << "Y, "
  21. << span.GetMonths() << "M, "
  22. << span.GetWeeks() << "W, "
  23. << span.GetDays() << "D";
  24. return ostr;
  25. }
  26. WX_CPPUNIT_ALLOW_EQUALS_TO_INT(wxDateTime::wxDateTime_t)
  27. #endif // _WX_TESTS_TESTDATE_H_