<ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_vyukov_mpmc_cyclic.cpp" />\r
</ItemGroup>\r
<ItemGroup>\r
+ <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_fcqueue.h" />\r
<ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_msqueue.h" />\r
<ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue.h" />\r
- <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_queue.h" />\r
<ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_queue_new.h" />\r
<ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue.h" />\r
</ItemGroup>\r
<ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue.h">\r
<Filter>container</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_queue.h">\r
+ <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_queue_new.h">\r
<Filter>container</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_queue_new.h">\r
+ <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_fcqueue.h">\r
<Filter>container</Filter>\r
</ClInclude>\r
</ItemGroup>\r
//$$CDS-header$$
#include <cds/container/fcqueue.h>
-#include "queue/hdr_queue.h"
+#include "queue/hdr_fcqueue.h"
#include <list>
namespace queue {
- void Queue_TestHeader::FCQueue_deque()
+ void HdrFCQueue::FCQueue_deque()
{
typedef cds::container::FCQueue<int> queue_type;
testFCQueue<queue_type>();
}
- void Queue_TestHeader::FCQueue_deque_elimination()
+ void HdrFCQueue::FCQueue_deque_elimination()
{
typedef cds::container::FCQueue<int, std::queue< int, std::deque<int> >,
cds::container::fcqueue::make_traits<
testFCQueue<queue_type>();
}
- void Queue_TestHeader::FCQueue_deque_mutex()
+ void HdrFCQueue::FCQueue_deque_mutex()
{
typedef cds::container::FCQueue<int, std::queue< int, std::deque<int> >,
cds::container::fcqueue::make_traits<
testFCQueue<queue_type>();
}
- void Queue_TestHeader::FCQueue_deque_stat()
+ void HdrFCQueue::FCQueue_deque_stat()
{
typedef cds::container::FCQueue<int, std::queue< int, std::deque<int> >,
cds::container::fcqueue::make_traits<
}
//
- void Queue_TestHeader::FCQueue_list()
+ void HdrFCQueue::FCQueue_list()
{
typedef cds::container::FCQueue<int, std::queue< int, std::list<int> > > queue_type;
testFCQueue<queue_type>();
}
- void Queue_TestHeader::FCQueue_list_elimination()
+ void HdrFCQueue::FCQueue_list_elimination()
{
typedef cds::container::FCQueue<int, std::queue< int, std::list<int> >,
cds::container::fcqueue::make_traits<
testFCQueue<queue_type>();
}
- void Queue_TestHeader::FCQueue_list_mutex()
+ void HdrFCQueue::FCQueue_list_mutex()
{
typedef cds::container::FCQueue<int, std::queue<int, std::list<int> >,
cds::container::fcqueue::make_traits<
testFCQueue<queue_type>();
}
- void Queue_TestHeader::FCQueue_list_stat()
+ void HdrFCQueue::FCQueue_list_stat()
{
struct queue_traits : public cds::container::fcqueue::traits
{
--- /dev/null
+//$$CDS-header$$
+
+#ifndef __UNIT_QUEUE_SIMPLE_H
+#define __UNIT_QUEUE_SIMPLE_H
+
+#include "cppunit/cppunit_proxy.h"
+#include <cds/details/defs.h>
+
+namespace queue {
+
+ //
+ // Test queue operation in single thread mode
+ //
+ class HdrFCQueue: public CppUnitMini::TestCase
+ {
+ protected:
+ template <class Queue>
+ void testNoItemCounter()
+ {
+ Queue q;
+ test_with( q );
+ test_emplace( q );
+ }
+
+ template <class Queue>
+ void test_with( Queue& q )
+ {
+ int it;
+ int nPrev;
+
+ for ( size_t i = 0; i < 3; ++i ) {
+ CPPUNIT_ASSERT( q.empty() );
+#ifndef _DEBUG
+ CPPUNIT_ASSERT( q.size() == 0 );
+#endif
+ CPPUNIT_ASSERT( q.enqueue( 1 ) );
+ CPPUNIT_ASSERT( !q.empty() );
+ CPPUNIT_ASSERT( q.push( 10 ) );
+ CPPUNIT_ASSERT( !q.empty() );
+#ifndef _DEBUG
+ CPPUNIT_ASSERT( q.size() == 0 ) ; // no queue's item counter!
+#endif
+
+ it = -1;
+ CPPUNIT_ASSERT( q.pop( it ) );
+ CPPUNIT_ASSERT( it == 1 );
+ CPPUNIT_ASSERT( !q.empty() );
+ CPPUNIT_ASSERT( q.dequeue( it ) );
+ CPPUNIT_ASSERT( it == 10 );
+#ifndef _DEBUG
+ CPPUNIT_ASSERT( q.size() == 0 );
+#endif
+ CPPUNIT_ASSERT( q.empty() );
+ it += 2009;
+ nPrev = it;
+ CPPUNIT_ASSERT( !q.dequeue( it ) );
+ CPPUNIT_ASSERT( it == nPrev ) ; // it must not be changed!
+ }
+ }
+
+ template <class Queue>
+ void test_emplace( Queue& q )
+ {
+ int it;
+ for ( size_t i = 0; i < 3; ++i ) {
+ CPPUNIT_ASSERT( q.emplace( static_cast<int>( i * 42 )) );
+ CPPUNIT_ASSERT( !q.empty() );
+ it = -1;
+ CPPUNIT_ASSERT( q.pop( it ));
+ CPPUNIT_ASSERT( it == static_cast<int>( i * 42 ));
+ CPPUNIT_ASSERT( q.empty() );
+ }
+ }
+
+ template <class Queue>
+ void testWithItemCounter()
+ {
+ Queue q;
+ test_ic_with( q );
+ test_emplace_ic( q );
+ }
+
+ template <class Queue>
+ void testFCQueue()
+ {
+ Queue q;
+ test_ic_with( q );
+ }
+
+ template <class Queue>
+ void test_ic_with( Queue& q )
+ {
+ int it;
+ int nPrev;
+
+ for ( size_t i = 0; i < 3; ++i ) {
+ CPPUNIT_ASSERT( q.empty() );
+ CPPUNIT_ASSERT( q.size() == 0 );
+ CPPUNIT_ASSERT( q.enqueue( 1 ) );
+ CPPUNIT_ASSERT( q.size() == 1 );
+ CPPUNIT_ASSERT( !q.empty() );
+ CPPUNIT_ASSERT( q.push( 10 ) );
+ CPPUNIT_ASSERT( !q.empty() );
+ CPPUNIT_ASSERT( q.size() == 2 );
+
+ it = -1;
+ CPPUNIT_ASSERT( q.pop( it ) );
+ CPPUNIT_ASSERT( it == 1 );
+ CPPUNIT_ASSERT( !q.empty() );
+ CPPUNIT_ASSERT( q.size() == 1 );
+ CPPUNIT_ASSERT( q.dequeue( it ) );
+ CPPUNIT_ASSERT( it == 10 );
+ CPPUNIT_ASSERT( q.size() == 0 );
+ CPPUNIT_ASSERT( q.empty() );
+ CPPUNIT_ASSERT( q.size() == 0 );
+ it += 2009;
+ nPrev = it;
+ CPPUNIT_ASSERT( !q.dequeue( it ) );
+ CPPUNIT_ASSERT( it == nPrev ) ; // it must not be changed!
+
+ CPPUNIT_ASSERT( q.empty() );
+ CPPUNIT_ASSERT( q.size() == 0 );
+ }
+ }
+
+ template <class Queue>
+ void test_emplace_ic( Queue& q )
+ {
+ int it = 0;
+ for ( size_t i = 0; i < 3; ++i ) {
+ CPPUNIT_ASSERT( q.emplace( (int) i * 10 ) );
+ CPPUNIT_ASSERT( !q.empty() );
+ CPPUNIT_ASSERT( q.size() == 1 );
+ CPPUNIT_ASSERT( q.pop( it ));
+ CPPUNIT_ASSERT( it == (int) i * 10 );
+ CPPUNIT_ASSERT( q.empty() );
+ CPPUNIT_ASSERT( q.size() == 0 );
+ }
+ }
+
+ public:
+ void FCQueue_deque();
+ void FCQueue_deque_elimination();
+ void FCQueue_deque_mutex();
+ void FCQueue_deque_stat();
+ void FCQueue_list();
+ void FCQueue_list_elimination();
+ void FCQueue_list_mutex();
+ void FCQueue_list_stat();
+
+ CPPUNIT_TEST_SUITE(HdrFCQueue)
+ CPPUNIT_TEST(FCQueue_deque)
+ CPPUNIT_TEST(FCQueue_deque_elimination)
+ CPPUNIT_TEST(FCQueue_deque_mutex)
+ CPPUNIT_TEST(FCQueue_deque_stat)
+ CPPUNIT_TEST(FCQueue_list)
+ CPPUNIT_TEST(FCQueue_list_elimination)
+ CPPUNIT_TEST(FCQueue_list_mutex)
+ CPPUNIT_TEST(FCQueue_list_stat)
+ CPPUNIT_TEST_SUITE_END();
+
+ };
+} // namespace queue
+
+#endif // #ifndef __UNIT_QUEUE_SIMPLE_H
+++ /dev/null
-//$$CDS-header$$
-
-#ifndef __UNIT_QUEUE_SIMPLE_H
-#define __UNIT_QUEUE_SIMPLE_H
-
-#include "cppunit/cppunit_proxy.h"
-#include <cds/details/defs.h>
-
-namespace queue {
-
- //
- // Test queue operation in single thread mode
- //
- class Queue_TestHeader: public CppUnitMini::TestCase
- {
- protected:
- template <class Queue>
- void testNoItemCounter()
- {
- Queue q;
- test_with( q );
- test_emplace( q );
- }
-
- template <class Queue>
- void test_with( Queue& q )
- {
- int it;
- int nPrev;
-
- for ( size_t i = 0; i < 3; ++i ) {
- CPPUNIT_ASSERT( q.empty() );
-#ifndef _DEBUG
- CPPUNIT_ASSERT( q.size() == 0 );
-#endif
- CPPUNIT_ASSERT( q.enqueue( 1 ) );
- CPPUNIT_ASSERT( !q.empty() );
- CPPUNIT_ASSERT( q.push( 10 ) );
- CPPUNIT_ASSERT( !q.empty() );
-#ifndef _DEBUG
- CPPUNIT_ASSERT( q.size() == 0 ) ; // no queue's item counter!
-#endif
-
- it = -1;
- CPPUNIT_ASSERT( q.pop( it ) );
- CPPUNIT_ASSERT( it == 1 );
- CPPUNIT_ASSERT( !q.empty() );
- CPPUNIT_ASSERT( q.dequeue( it ) );
- CPPUNIT_ASSERT( it == 10 );
-#ifndef _DEBUG
- CPPUNIT_ASSERT( q.size() == 0 );
-#endif
- CPPUNIT_ASSERT( q.empty() );
- it += 2009;
- nPrev = it;
- CPPUNIT_ASSERT( !q.dequeue( it ) );
- CPPUNIT_ASSERT( it == nPrev ) ; // it must not be changed!
- }
- }
-
- template <class Queue>
- void test_emplace( Queue& q )
- {
- int it;
- for ( size_t i = 0; i < 3; ++i ) {
- CPPUNIT_ASSERT( q.emplace( static_cast<int>( i * 42 )) );
- CPPUNIT_ASSERT( !q.empty() );
- it = -1;
- CPPUNIT_ASSERT( q.pop( it ));
- CPPUNIT_ASSERT( it == static_cast<int>( i * 42 ));
- CPPUNIT_ASSERT( q.empty() );
- }
- }
-
- template <class Queue>
- void testWithItemCounter()
- {
- Queue q;
- test_ic_with( q );
- test_emplace_ic( q );
- }
-
- template <class Queue>
- void testFCQueue()
- {
- Queue q;
- test_ic_with( q );
- }
-
- template <class Queue>
- void test_ic_with( Queue& q )
- {
- int it;
- int nPrev;
-
- for ( size_t i = 0; i < 3; ++i ) {
- CPPUNIT_ASSERT( q.empty() );
- CPPUNIT_ASSERT( q.size() == 0 );
- CPPUNIT_ASSERT( q.enqueue( 1 ) );
- CPPUNIT_ASSERT( q.size() == 1 );
- CPPUNIT_ASSERT( !q.empty() );
- CPPUNIT_ASSERT( q.push( 10 ) );
- CPPUNIT_ASSERT( !q.empty() );
- CPPUNIT_ASSERT( q.size() == 2 );
-
- it = -1;
- CPPUNIT_ASSERT( q.pop( it ) );
- CPPUNIT_ASSERT( it == 1 );
- CPPUNIT_ASSERT( !q.empty() );
- CPPUNIT_ASSERT( q.size() == 1 );
- CPPUNIT_ASSERT( q.dequeue( it ) );
- CPPUNIT_ASSERT( it == 10 );
- CPPUNIT_ASSERT( q.size() == 0 );
- CPPUNIT_ASSERT( q.empty() );
- CPPUNIT_ASSERT( q.size() == 0 );
- it += 2009;
- nPrev = it;
- CPPUNIT_ASSERT( !q.dequeue( it ) );
- CPPUNIT_ASSERT( it == nPrev ) ; // it must not be changed!
-
- CPPUNIT_ASSERT( q.empty() );
- CPPUNIT_ASSERT( q.size() == 0 );
- }
- }
-
- template <class Queue>
- void test_emplace_ic( Queue& q )
- {
- int it = 0;
- for ( size_t i = 0; i < 3; ++i ) {
- CPPUNIT_ASSERT( q.emplace( (int) i * 10 ) );
- CPPUNIT_ASSERT( !q.empty() );
- CPPUNIT_ASSERT( q.size() == 1 );
- CPPUNIT_ASSERT( q.pop( it ));
- CPPUNIT_ASSERT( it == (int) i * 10 );
- CPPUNIT_ASSERT( q.empty() );
- CPPUNIT_ASSERT( q.size() == 0 );
- }
- }
-
- public:
- void FCQueue_deque();
- void FCQueue_deque_elimination();
- void FCQueue_deque_mutex();
- void FCQueue_deque_stat();
- void FCQueue_list();
- void FCQueue_list_elimination();
- void FCQueue_list_mutex();
- void FCQueue_list_stat();
-
- CPPUNIT_TEST_SUITE(Queue_TestHeader)
- CPPUNIT_TEST(FCQueue_deque)
- CPPUNIT_TEST(FCQueue_deque_elimination)
- CPPUNIT_TEST(FCQueue_deque_mutex)
- CPPUNIT_TEST(FCQueue_deque_stat)
- CPPUNIT_TEST(FCQueue_list)
- CPPUNIT_TEST(FCQueue_list_elimination)
- CPPUNIT_TEST(FCQueue_list_mutex)
- CPPUNIT_TEST(FCQueue_list_stat)
- CPPUNIT_TEST_SUITE_END();
-
- };
-} // namespace queue
-
-#endif // #ifndef __UNIT_QUEUE_SIMPLE_H
#include "hdr_intrusive_msqueue.h"
#include "hdr_intrusive_segmented_queue.h"
#include "hdr_queue_new.h"
-#include "hdr_queue.h" //TODO must be removed after refactoring
+#include "hdr_fcqueue.h"
#include "hdr_segmented_queue.h"
CPPUNIT_TEST_SUITE_REGISTRATION_( queue::HdrTestQueue, s_HdrTestQueue );
-CPPUNIT_TEST_SUITE_REGISTRATION_( queue::Queue_TestHeader, s_Queue_TestHeader ); //TODO must be removed after refactoring
+CPPUNIT_TEST_SUITE_REGISTRATION_( queue::HdrFCQueue, s_Queue_TestHeader ); //TODO must be removed after refactoring
CPPUNIT_TEST_SUITE_REGISTRATION_( queue::HdrSegmentedQueue, s_HdrSegmentedQueue );
CPPUNIT_TEST_SUITE_REGISTRATION_( queue::IntrusiveQueueHeaderTest, s_IntrusiveQueueHeaderTest );
CPPUNIT_TEST_SUITE_REGISTRATION_( queue::HdrIntrusiveSegmentedQueue, s_HdrIntrusiveSegmentedQueue );