Refactors sequential test cases
[libcds.git] / test / stress / sequential / sequential_stack.cpp
index 48287ef8de7d31d1da605ccb2f0f5bb3dc08a9a0..b3598e3dcdfe0f784eb3dbd67dfc44875c2ad1ca 100644 (file)
@@ -40,15 +40,16 @@ namespace {
 #define CDSSTRESS_SequentialTreiberStack_F(test_fixture, type_name)            \
   TEST_F(test_fixture, type_name) {                                            \
     typedef stack::Types<value_type>::type_name stack_type;                    \
-    stack_type stack;                                                          \
-    test(stack);                                                               \
+    std::unique_ptr<stack_type> stack(new stack_type());                       \
+    test(*stack);                                                              \
   }
 
 #define CDSSTRESS_SequentialEliminationStack_F(test_fixture, type_name)        \
   TEST_F(test_fixture, type_name) {                                            \
     typedef stack::Types<value_type>::type_name stack_type;                    \
-    stack_type stack(s_nSequentialEliminationSize);                            \
-    test(stack);                                                               \
+    std::unique_ptr<stack_type> stack(                                         \
+        new stack_type(s_nSequentialEliminationSize));                         \
+    test(*stack);                                                              \
   }
 
 #define CDSSTRESS_SequentialTreiberStack(test_fixture)                         \
@@ -81,7 +82,8 @@ protected:
     GetConfig(SequentialEliminationSize);
   }
 
-  template <typename Stack> void test(Stack &stack) {
+  template <typename Stack>
+  void test(Stack &stack) {
     size_t push_error_cnt = 0;
     size_t pop_sum = 0;
     value_type v;
@@ -109,7 +111,7 @@ protected:
   }
 };
 
-CDSSTRESS_SequentialTreiberStack(sequential_stack)
-    CDSSTRESS_SequentialEliminationStack(sequential_stack)
+CDSSTRESS_SequentialTreiberStack(sequential_stack);
+CDSSTRESS_SequentialEliminationStack(sequential_stack);
 
 } // namespace