From: khizmax Date: Tue, 14 Oct 2014 18:34:02 +0000 (+0400) Subject: rename test-hdr/queue/hdr_queue.h to hdr_fcqueue.h X-Git-Tag: v2.0.0~199 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=357e174bd35ba693db4e7ea5f5cf5dcc426352c7;p=libcds.git rename test-hdr/queue/hdr_queue.h to hdr_fcqueue.h --- diff --git a/projects/Win/vc12/hdr-test-queue.vcxproj b/projects/Win/vc12/hdr-test-queue.vcxproj index b05883a5..b5ace015 100644 --- a/projects/Win/vc12/hdr-test-queue.vcxproj +++ b/projects/Win/vc12/hdr-test-queue.vcxproj @@ -565,9 +565,9 @@ + - diff --git a/projects/Win/vc12/hdr-test-queue.vcxproj.filters b/projects/Win/vc12/hdr-test-queue.vcxproj.filters index d377ec6a..0f478f03 100644 --- a/projects/Win/vc12/hdr-test-queue.vcxproj.filters +++ b/projects/Win/vc12/hdr-test-queue.vcxproj.filters @@ -94,10 +94,10 @@ container - + container - + container diff --git a/tests/test-hdr/queue/hdr_fcqueue.cpp b/tests/test-hdr/queue/hdr_fcqueue.cpp index 096b7d14..00576abd 100644 --- a/tests/test-hdr/queue/hdr_fcqueue.cpp +++ b/tests/test-hdr/queue/hdr_fcqueue.cpp @@ -1,19 +1,19 @@ //$$CDS-header$$ #include -#include "queue/hdr_queue.h" +#include "queue/hdr_fcqueue.h" #include namespace queue { - void Queue_TestHeader::FCQueue_deque() + void HdrFCQueue::FCQueue_deque() { typedef cds::container::FCQueue queue_type; testFCQueue(); } - void Queue_TestHeader::FCQueue_deque_elimination() + void HdrFCQueue::FCQueue_deque_elimination() { typedef cds::container::FCQueue >, cds::container::fcqueue::make_traits< @@ -23,7 +23,7 @@ namespace queue { testFCQueue(); } - void Queue_TestHeader::FCQueue_deque_mutex() + void HdrFCQueue::FCQueue_deque_mutex() { typedef cds::container::FCQueue >, cds::container::fcqueue::make_traits< @@ -33,7 +33,7 @@ namespace queue { testFCQueue(); } - void Queue_TestHeader::FCQueue_deque_stat() + void HdrFCQueue::FCQueue_deque_stat() { typedef cds::container::FCQueue >, cds::container::fcqueue::make_traits< @@ -44,13 +44,13 @@ namespace queue { } // - void Queue_TestHeader::FCQueue_list() + void HdrFCQueue::FCQueue_list() { typedef cds::container::FCQueue > > queue_type; testFCQueue(); } - void Queue_TestHeader::FCQueue_list_elimination() + void HdrFCQueue::FCQueue_list_elimination() { typedef cds::container::FCQueue >, cds::container::fcqueue::make_traits< @@ -60,7 +60,7 @@ namespace queue { testFCQueue(); } - void Queue_TestHeader::FCQueue_list_mutex() + void HdrFCQueue::FCQueue_list_mutex() { typedef cds::container::FCQueue >, cds::container::fcqueue::make_traits< @@ -70,7 +70,7 @@ namespace queue { testFCQueue(); } - void Queue_TestHeader::FCQueue_list_stat() + void HdrFCQueue::FCQueue_list_stat() { struct queue_traits : public cds::container::fcqueue::traits { diff --git a/tests/test-hdr/queue/hdr_fcqueue.h b/tests/test-hdr/queue/hdr_fcqueue.h new file mode 100644 index 00000000..25b6417e --- /dev/null +++ b/tests/test-hdr/queue/hdr_fcqueue.h @@ -0,0 +1,165 @@ +//$$CDS-header$$ + +#ifndef __UNIT_QUEUE_SIMPLE_H +#define __UNIT_QUEUE_SIMPLE_H + +#include "cppunit/cppunit_proxy.h" +#include + +namespace queue { + + // + // Test queue operation in single thread mode + // + class HdrFCQueue: public CppUnitMini::TestCase + { + protected: + template + void testNoItemCounter() + { + Queue q; + test_with( q ); + test_emplace( q ); + } + + template + 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 + void test_emplace( Queue& q ) + { + int it; + for ( size_t i = 0; i < 3; ++i ) { + CPPUNIT_ASSERT( q.emplace( static_cast( i * 42 )) ); + CPPUNIT_ASSERT( !q.empty() ); + it = -1; + CPPUNIT_ASSERT( q.pop( it )); + CPPUNIT_ASSERT( it == static_cast( i * 42 )); + CPPUNIT_ASSERT( q.empty() ); + } + } + + template + void testWithItemCounter() + { + Queue q; + test_ic_with( q ); + test_emplace_ic( q ); + } + + template + void testFCQueue() + { + Queue q; + test_ic_with( q ); + } + + template + 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 + 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 diff --git a/tests/test-hdr/queue/hdr_queue.h b/tests/test-hdr/queue/hdr_queue.h deleted file mode 100644 index c7c0c9a8..00000000 --- a/tests/test-hdr/queue/hdr_queue.h +++ /dev/null @@ -1,165 +0,0 @@ -//$$CDS-header$$ - -#ifndef __UNIT_QUEUE_SIMPLE_H -#define __UNIT_QUEUE_SIMPLE_H - -#include "cppunit/cppunit_proxy.h" -#include - -namespace queue { - - // - // Test queue operation in single thread mode - // - class Queue_TestHeader: public CppUnitMini::TestCase - { - protected: - template - void testNoItemCounter() - { - Queue q; - test_with( q ); - test_emplace( q ); - } - - template - 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 - void test_emplace( Queue& q ) - { - int it; - for ( size_t i = 0; i < 3; ++i ) { - CPPUNIT_ASSERT( q.emplace( static_cast( i * 42 )) ); - CPPUNIT_ASSERT( !q.empty() ); - it = -1; - CPPUNIT_ASSERT( q.pop( it )); - CPPUNIT_ASSERT( it == static_cast( i * 42 )); - CPPUNIT_ASSERT( q.empty() ); - } - } - - template - void testWithItemCounter() - { - Queue q; - test_ic_with( q ); - test_emplace_ic( q ); - } - - template - void testFCQueue() - { - Queue q; - test_ic_with( q ); - } - - template - 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 - 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 diff --git a/tests/test-hdr/queue/hdr_queue_register.cpp b/tests/test-hdr/queue/hdr_queue_register.cpp index 5f5e2beb..334d6be4 100644 --- a/tests/test-hdr/queue/hdr_queue_register.cpp +++ b/tests/test-hdr/queue/hdr_queue_register.cpp @@ -3,11 +3,11 @@ #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 );