tizen 2.4 release
[framework/web/wrt-commons.git] / modules / test / include / dpl / test / test_runner.h
@@ -25,8 +25,9 @@
 
 #include <dpl/singleton.h>
 #include <dpl/availability.h>
-#include <dpl/atomic.h>
 #include <dpl/test/test_results_collector.h>
+
+#include <atomic>
 #include <sstream>
 #include <string>
 #include <vector>
@@ -46,9 +47,11 @@ class TestRunner
     bool m_runIgnored;
 
   public:
-    TestRunner() :
-        m_terminate(false)
-      , m_allowChildLogs(false)
+    TestRunner()
+        : m_runIgnored(false)
+        , m_allowChildLogs(false)
+        , m_terminate(false)
+        , m_totalAssertions(0)
     {}
 
     typedef void (*TestCase)();
@@ -85,13 +88,13 @@ class TestRunner
     SelectedTestGroupSet m_selectedTestGroupSet;
     std::string m_currentGroup;
 
-    DPL::Atomic m_totalAssertions;
-
     // Terminate without any logs.
     // Some test requires to call fork function.
     // Child process must not produce any logs and should die quietly.
-    bool m_terminate;
     bool m_allowChildLogs;
+    bool m_terminate;
+
+    std::atomic<int> m_totalAssertions;
 
     void Banner();
     void InvalidArgs(const std::string& message = "Invalid arguments!");
@@ -182,10 +185,10 @@ typedef DPL::Singleton<TestRunner> TestRunnerSingleton;
 #define RUNNER_TEST_GROUP_INIT(GroupName)                                \
     static int Static##GroupName##Init()                                 \
     {                                                                    \
-        DPL::Test::TestRunnerSingleton::Instance().InitGroup(#GroupName); \
+        DPL::Test::TestRunnerSingleton::Instance().InitGroup(#GroupName);\
         return 0;                                                        \
     }                                                                    \
-    const int DPL_UNUSED Static##GroupName##InitVar =                   \
+    const int DPL_UNUSED Static##GroupName##InitVar =                    \
         Static##GroupName##Init();
 
 #define RUNNER_TEST(Proc)                                                \
@@ -195,35 +198,34 @@ typedef DPL::Singleton<TestRunner> TestRunnerSingleton;
         DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc); \
         return 0;                                                        \
     }                                                                    \
-    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();  \
+    const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init();   \
     void Proc()
 
-//! \brief Returns base name for path
-
-#define RUNNER_ASSERT_MSG(test, message)                                               \
-    do                                                                                     \
-    {                                                                                      \
-        DPL::Test::TestRunnerSingleton::Instance().MarkAssertion();                        \
-                                                                                       \
-        if (!(test))                                                                       \
-        {                                                                                  \
-            std::ostringstream assertMsg;                                                  \
-            assertMsg << message;                                                          \
-            throw DPL::Test::TestRunner::TestFailed(#test, \
-                                                    __FILE__, \
-                                                    __LINE__, \
-                                                    assertMsg.str()); \
-        }                                                                                  \
+#define RUNNER_ASSERT_MSG(test, message)                                      \
+    do                                                                        \
+    {                                                                         \
+        DPL::Test::TestRunnerSingleton::Instance().MarkAssertion();           \
+                                                                              \
+        if (!(test))                                                          \
+        {                                                                     \
+            std::ostringstream assertMsg;                                     \
+            assertMsg << message;                                             \
+            throw DPL::Test::TestRunner::TestFailed(#test,                    \
+                                                    __FILE__,                 \
+                                                    __LINE__,                 \
+                                                    assertMsg.str());         \
+        }                                                                     \
     } while (0)
 
 #define RUNNER_ASSERT(test) RUNNER_ASSERT_MSG(test, "")
 
 #define RUNNER_FAIL RUNNER_ASSERT(false)
 
-#define RUNNER_IGNORED_MSG(message) do { std::ostringstream assertMsg; \
-                                         assertMsg << message; \
-                                         throw DPL::Test::TestRunner::Ignored( \
-                                                   assertMsg.str()); \
+#define RUNNER_IGNORED_MSG(message)                                           \
+    do {                                                                      \
+        std::ostringstream assertMsg;                                         \
+        assertMsg << message;                                                 \
+        throw DPL::Test::TestRunner::Ignored( assertMsg.str() );              \
 } while (0)
 
 #endif // DPL_TEST_RUNNER_H