3 #include "cppunit/cppunit_proxy.h"
7 class TestStack: public CppUnitMini::TestCase
16 template <class Stack>
17 void test_elimination()
23 template <class Stack>
24 void test_with( Stack& stack)
26 typedef typename Stack::value_type value_type;
29 CPPUNIT_ASSERT( stack.empty() );
31 CPPUNIT_ASSERT( stack.push(1));
32 CPPUNIT_ASSERT( !stack.empty() );
33 CPPUNIT_ASSERT( stack.push(2));
34 CPPUNIT_ASSERT( !stack.empty() );
35 CPPUNIT_ASSERT( stack.push(3));
36 CPPUNIT_ASSERT( !stack.empty() );
38 CPPUNIT_ASSERT( stack.pop(v) );
39 CPPUNIT_ASSERT( v == 3 );
40 CPPUNIT_ASSERT( !stack.empty() );
41 CPPUNIT_ASSERT( stack.pop(v) );
42 CPPUNIT_ASSERT( v == 2 );
43 CPPUNIT_ASSERT( !stack.empty() );
44 CPPUNIT_ASSERT( stack.pop(v) );
45 CPPUNIT_ASSERT( v == 1 );
46 CPPUNIT_ASSERT( stack.empty() );
48 CPPUNIT_ASSERT( !stack.pop(v) );
49 CPPUNIT_ASSERT( v == 1000 );
50 CPPUNIT_ASSERT( stack.empty() );
52 CPPUNIT_ASSERT( stack.push(10));
53 CPPUNIT_ASSERT( stack.push(20));
54 CPPUNIT_ASSERT( stack.push(30));
55 CPPUNIT_ASSERT( !stack.empty());
57 #ifdef CDS_EMPLACE_SUPPORT
58 CPPUNIT_ASSERT( stack.emplace(100));
59 CPPUNIT_ASSERT( stack.pop(v));
60 CPPUNIT_ASSERT( v == 100 );
64 CPPUNIT_ASSERT( stack.empty() );
72 void Treiber_HP_yield();
73 void Treiber_HRC_yield();
74 void Treiber_PTB_yield();
75 void Treiber_HP_pause_alloc();
76 void Treiber_HRC_pause_alloc();
77 void Treiber_PTB_pause_alloc();
79 void Treiber_HP_relaxed();
80 void Treiber_HRC_relaxed();
81 void Treiber_PTB_relaxed();
82 void Treiber_HP_yield_relaxed();
83 void Treiber_HRC_yield_relaxed();
84 void Treiber_PTB_yield_relaxed();
85 void Treiber_HP_pause_alloc_relaxed();
86 void Treiber_HRC_pause_alloc_relaxed();
87 void Treiber_PTB_pause_alloc_relaxed();
89 void Elimination_HP();
90 void Elimination_HP_dyn();
91 void Elimination_HP_stat();
92 void Elimination_HRC();
93 void Elimination_HRC_dyn();
94 void Elimination_HRC_stat();
95 void Elimination_PTB();
96 void Elimination_PTB_dyn();
97 void Elimination_PTB_stat();
98 void Elimination_HP_yield();
99 void Elimination_HRC_yield();
100 void Elimination_PTB_yield();
101 void Elimination_HP_pause_alloc();
102 void Elimination_HRC_pause_alloc();
103 void Elimination_PTB_pause_alloc();
105 void Elimination_HP_relaxed();
106 void Elimination_HRC_relaxed();
107 void Elimination_PTB_relaxed();
108 void Elimination_HP_yield_relaxed();
109 void Elimination_HRC_yield_relaxed();
110 void Elimination_PTB_yield_relaxed();
111 void Elimination_HP_pause_alloc_relaxed();
112 void Elimination_HRC_pause_alloc_relaxed();
113 void Elimination_PTB_pause_alloc_relaxed();
115 CPPUNIT_TEST_SUITE(TestStack);
116 CPPUNIT_TEST(Treiber_HP)
117 CPPUNIT_TEST(Treiber_HP_relaxed)
118 CPPUNIT_TEST(Treiber_HRC)
119 CPPUNIT_TEST(Treiber_HRC_relaxed)
120 CPPUNIT_TEST(Treiber_PTB)
121 CPPUNIT_TEST(Treiber_PTB_relaxed)
122 CPPUNIT_TEST(Treiber_HP_yield)
123 CPPUNIT_TEST(Treiber_HP_yield_relaxed)
124 CPPUNIT_TEST(Treiber_HRC_yield)
125 CPPUNIT_TEST(Treiber_HRC_yield_relaxed)
126 CPPUNIT_TEST(Treiber_PTB_yield)
127 CPPUNIT_TEST(Treiber_PTB_yield_relaxed)
128 CPPUNIT_TEST(Treiber_HP_pause_alloc)
129 CPPUNIT_TEST(Treiber_HP_pause_alloc_relaxed)
130 CPPUNIT_TEST(Treiber_HRC_pause_alloc)
131 CPPUNIT_TEST(Treiber_HRC_pause_alloc_relaxed)
132 CPPUNIT_TEST(Treiber_PTB_pause_alloc)
133 CPPUNIT_TEST(Treiber_PTB_pause_alloc_relaxed)
135 CPPUNIT_TEST(Elimination_HP)
136 CPPUNIT_TEST(Elimination_HP_dyn)
137 CPPUNIT_TEST(Elimination_HP_stat)
138 CPPUNIT_TEST(Elimination_HP_relaxed)
139 CPPUNIT_TEST(Elimination_HRC)
140 CPPUNIT_TEST(Elimination_HRC_dyn)
141 CPPUNIT_TEST(Elimination_HRC_stat)
142 CPPUNIT_TEST(Elimination_HRC_relaxed)
143 CPPUNIT_TEST(Elimination_PTB)
144 CPPUNIT_TEST(Elimination_PTB_dyn)
145 CPPUNIT_TEST(Elimination_PTB_stat)
146 CPPUNIT_TEST(Elimination_PTB_relaxed)
147 CPPUNIT_TEST(Elimination_HP_yield)
148 CPPUNIT_TEST(Elimination_HP_yield_relaxed)
149 CPPUNIT_TEST(Elimination_HRC_yield)
150 CPPUNIT_TEST(Elimination_HRC_yield_relaxed)
151 CPPUNIT_TEST(Elimination_PTB_yield)
152 CPPUNIT_TEST(Elimination_PTB_yield_relaxed)
153 CPPUNIT_TEST(Elimination_HP_pause_alloc)
154 CPPUNIT_TEST(Elimination_HP_pause_alloc_relaxed)
155 CPPUNIT_TEST(Elimination_HRC_pause_alloc)
156 CPPUNIT_TEST(Elimination_HRC_pause_alloc_relaxed)
157 CPPUNIT_TEST(Elimination_PTB_pause_alloc)
158 CPPUNIT_TEST(Elimination_PTB_pause_alloc_relaxed)
159 CPPUNIT_TEST_SUITE_END();