]> git.saurik.com Git - wxWidgets.git/commitdiff
no changes, just some cleanup (use compile-time asserts instead of run-time ones...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 26 Mar 2009 15:35:30 +0000 (15:35 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 26 Mar 2009 15:35:30 +0000 (15:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59867 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/test.cpp

index 077a95829c8c4a5b417fc11212bf0b356c104837..54f56612f62b56ea5c5aac52e6da93b6bf6ebe2f 100644 (file)
@@ -143,7 +143,8 @@ public:
         m_watch.Start();
     }
 
         m_watch.Start();
     }
 
-    virtual void addFailure(const CppUnit::TestFailure& failure) {
+    virtual void addFailure(const CppUnit::TestFailure& failure)
+    {
         m_result = failure.isError() ? RESULT_ERROR : RESULT_FAIL;
     }
 
         m_result = failure.isError() ? RESULT_ERROR : RESULT_FAIL;
     }
 
@@ -157,21 +158,27 @@ public:
     }
 
 protected :
     }
 
 protected :
-    enum ResultType {
+    enum ResultType
+    {
         RESULT_OK = 0,
         RESULT_FAIL,
         RESULT_OK = 0,
         RESULT_FAIL,
-        RESULT_ERROR
+        RESULT_ERROR,
+        RESULT_MAX
     };
 
     };
 
-    wxString GetResultStr(ResultType type) const {
-        static const wxChar* ResultTypeNames[] = {
-            wxT("OK"),
-            wxT(" F"),
-            wxT("ER")
+    wxString GetResultStr(ResultType type) const
+    {
+        static const char *resultTypeNames[] =
+        {
+            "  OK",
+            "FAIL",
+            " ERR"
         };
         };
-        wxCHECK_MSG(static_cast<size_t>(type) < WXSIZEOF(ResultTypeNames),
-            ResultTypeNames[RESULT_ERROR], "invalid entry type");
-        return ResultTypeNames[type];
+
+        wxCOMPILE_TIME_ASSERT( WXSIZEOF(resultTypeNames) == RESULT_MAX,
+                               ResultTypeNamesMismatch );
+
+        return resultTypeNames[type];
     }
 
     bool m_timing;
     }
 
     bool m_timing;