]> git.saurik.com Git - wxWidgets.git/commitdiff
Extract wxDateTime-related cppunit helpers in a separate header file.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 19 Jun 2011 22:46:42 +0000 (22:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 19 Jun 2011 22:46:42 +0000 (22:46 +0000)
No real changes, just refactor the code to allow using CPPUNIT_ASSERT_EQUAL
with wxDateTime in other tests in the future.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67989 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/datetime/datetimetest.cpp
tests/testdate.h [new file with mode: 0644]

index 8d1d4aa38b9bf0f3b5b32adace3b6b0a08d2a90f..f5af743b0c92019f52558a7ca5b923940fe839b1 100644 (file)
 
 #if wxUSE_DATETIME
 
-#include "wx/datetime.h"
 #include "wx/wxcrt.h"       // for wxStrstr()
 
-// need this to be able to use CPPUNIT_ASSERT_EQUAL with wxDateTime objects
-static std::ostream& operator<<(std::ostream& ostr, const wxDateTime& dt)
-{
-    ostr << dt.FormatISOCombined(' ');
-
-    return ostr;
-}
-
-WX_CPPUNIT_ALLOW_EQUALS_TO_INT(wxDateTime::wxDateTime_t)
+#include "testdate.h"
 
 // to test Today() meaningfully we must be able to change the system date which
 // is not usually the case, but if we're under Win32 we can try it -- define
diff --git a/tests/testdate.h b/tests/testdate.h
new file mode 100644 (file)
index 0000000..5d28568
--- /dev/null
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        tests/testdate.h
+// Purpose:     Unit test helpers for dealing with wxDateTime.
+// Author:      Vadim Zeitlin
+// RCS-ID:      $Id$
+// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TESTS_TESTDATE_H_
+#define _WX_TESTS_TESTDATE_H_
+
+#include "wx/datetime.h"
+
+// need this to be able to use CPPUNIT_ASSERT_EQUAL with wxDateTime objects
+inline std::ostream& operator<<(std::ostream& ostr, const wxDateTime& dt)
+{
+    ostr << dt.FormatISOCombined(' ');
+
+    return ostr;
+}
+
+WX_CPPUNIT_ALLOW_EQUALS_TO_INT(wxDateTime::wxDateTime_t)
+
+#endif // _WX_TESTS_TESTDATE_H_