From a26da236f1cfc45b9ee41c77a274ffb94ca8fc3a Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 6 Feb 2016 00:38:17 +0300 Subject: [PATCH] Moved queue unit tests to gtest framework --- projects/Win/vc14/cds.sln | 19 - projects/Win/vc14/gtest-queue.vcxproj | 3 + projects/Win/vc14/gtest-queue.vcxproj.filters | 9 + projects/Win/vc14/hdr-test-queue.vcxproj | 370 ------------ .../Win/vc14/hdr-test-queue.vcxproj.filters | 106 ---- projects/source.test-hdr.mk | 23 - projects/source.test-hdr.offsetof.mk | 21 - test/unit/queue/CMakeLists.txt | 2 + test/unit/queue/intrusive_tsigas_queue.cpp | 112 ++++ test/unit/queue/intrusive_vyukov_queue.cpp | 112 ++++ .../unit/queue/test_intrusive_bounded_queue.h | 151 +++++ test/unit/queue/tsigas_queue.cpp | 2 +- tests/test-hdr/queue/hdr_basketqueue_dhp.cpp | 143 ----- tests/test-hdr/queue/hdr_basketqueue_hp.cpp | 143 ----- tests/test-hdr/queue/hdr_fcqueue.cpp | 111 ---- tests/test-hdr/queue/hdr_fcqueue.h | 193 ------ .../queue/hdr_intrusive_basketqueue_dhp.cpp | 198 ------- .../queue/hdr_intrusive_basketqueue_hp.cpp | 227 -------- .../test-hdr/queue/hdr_intrusive_fcqueue.cpp | 327 ----------- .../queue/hdr_intrusive_moirqueue_dhp.cpp | 190 ------ .../queue/hdr_intrusive_moirqueue_hp.cpp | 215 ------- tests/test-hdr/queue/hdr_intrusive_msqueue.h | 551 ------------------ .../queue/hdr_intrusive_msqueue_dhp.cpp | 190 ------ .../queue/hdr_intrusive_msqueue_hp.cpp | 218 ------- .../hdr_intrusive_optimisticqueue_dhp.cpp | 214 ------- .../hdr_intrusive_optimisticqueue_hp.cpp | 240 -------- .../queue/hdr_intrusive_segmented_queue.h | 296 ---------- .../hdr_intrusive_segmented_queue_dhp.cpp | 253 -------- .../hdr_intrusive_segmented_queue_hp.cpp | 253 -------- .../hdr_intrusive_tsigas_cycle_queue.cpp | 110 ---- .../hdr_intrusive_vyukovmpmc_cycle_queue.cpp | 101 ---- tests/test-hdr/queue/hdr_moirqueue_dhp.cpp | 148 ----- tests/test-hdr/queue/hdr_moirqueue_hp.cpp | 149 ----- tests/test-hdr/queue/hdr_msqueue_dhp.cpp | 149 ----- tests/test-hdr/queue/hdr_msqueue_hp.cpp | 149 ----- tests/test-hdr/queue/hdr_optimistic_dhp.cpp | 145 ----- tests/test-hdr/queue/hdr_optimistic_hp.cpp | 145 ----- tests/test-hdr/queue/hdr_queue.h | 492 ---------------- tests/test-hdr/queue/hdr_queue_register.cpp | 41 -- tests/test-hdr/queue/hdr_rwqueue.cpp | 83 --- tests/test-hdr/queue/hdr_segmented_queue.h | 262 --------- .../queue/hdr_segmented_queue_dhp.cpp | 131 ----- .../test-hdr/queue/hdr_segmented_queue_hp.cpp | 131 ----- .../test-hdr/queue/hdr_tsigas_cycle_queue.cpp | 106 ---- .../test-hdr/queue/hdr_vyukov_mpmc_cyclic.cpp | 90 --- 45 files changed, 390 insertions(+), 6934 deletions(-) delete mode 100644 projects/Win/vc14/hdr-test-queue.vcxproj delete mode 100644 projects/Win/vc14/hdr-test-queue.vcxproj.filters create mode 100644 test/unit/queue/intrusive_tsigas_queue.cpp create mode 100644 test/unit/queue/intrusive_vyukov_queue.cpp create mode 100644 test/unit/queue/test_intrusive_bounded_queue.h delete mode 100644 tests/test-hdr/queue/hdr_basketqueue_dhp.cpp delete mode 100644 tests/test-hdr/queue/hdr_basketqueue_hp.cpp delete mode 100644 tests/test-hdr/queue/hdr_fcqueue.cpp delete mode 100644 tests/test-hdr/queue/hdr_fcqueue.h delete mode 100644 tests/test-hdr/queue/hdr_intrusive_basketqueue_dhp.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_basketqueue_hp.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_moirqueue_dhp.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_moirqueue_hp.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_msqueue.h delete mode 100644 tests/test-hdr/queue/hdr_intrusive_msqueue_dhp.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_msqueue_hp.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_optimisticqueue_dhp.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_optimisticqueue_hp.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_segmented_queue.h delete mode 100644 tests/test-hdr/queue/hdr_intrusive_segmented_queue_dhp.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_segmented_queue_hp.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_tsigas_cycle_queue.cpp delete mode 100644 tests/test-hdr/queue/hdr_intrusive_vyukovmpmc_cycle_queue.cpp delete mode 100644 tests/test-hdr/queue/hdr_moirqueue_dhp.cpp delete mode 100644 tests/test-hdr/queue/hdr_moirqueue_hp.cpp delete mode 100644 tests/test-hdr/queue/hdr_msqueue_dhp.cpp delete mode 100644 tests/test-hdr/queue/hdr_msqueue_hp.cpp delete mode 100644 tests/test-hdr/queue/hdr_optimistic_dhp.cpp delete mode 100644 tests/test-hdr/queue/hdr_optimistic_hp.cpp delete mode 100644 tests/test-hdr/queue/hdr_queue.h delete mode 100644 tests/test-hdr/queue/hdr_queue_register.cpp delete mode 100644 tests/test-hdr/queue/hdr_rwqueue.cpp delete mode 100644 tests/test-hdr/queue/hdr_segmented_queue.h delete mode 100644 tests/test-hdr/queue/hdr_segmented_queue_dhp.cpp delete mode 100644 tests/test-hdr/queue/hdr_segmented_queue_hp.cpp delete mode 100644 tests/test-hdr/queue/hdr_tsigas_cycle_queue.cpp delete mode 100644 tests/test-hdr/queue/hdr_vyukov_mpmc_cyclic.cpp diff --git a/projects/Win/vc14/cds.sln b/projects/Win/vc14/cds.sln index b400e54a..48067e57 100644 --- a/projects/Win/vc14/cds.sln +++ b/projects/Win/vc14/cds.sln @@ -129,12 +129,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit-set-insdel", "unit-set {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hdr-test-queue", "hdr-test-queue.vcxproj", "{33664E63-8D24-4FF4-A744-9782EB711509}" - ProjectSection(ProjectDependencies) = postProject - {61179F2F-07E1-490D-B64D-D85A90B6EF81} = {61179F2F-07E1-490D-B64D-D85A90B6EF81} - {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hdr-test-set", "hdr-test-set.vcxproj", "{E5E9DB4A-7816-45D4-A116-6BBBA0EE8EE7}" ProjectSection(ProjectDependencies) = postProject {61179F2F-07E1-490D-B64D-D85A90B6EF81} = {61179F2F-07E1-490D-B64D-D85A90B6EF81} @@ -363,18 +357,6 @@ Global {BA23811C-D4CB-4836-B2F3-6791BD6FFCD1}.Release|Win32.Build.0 = Release|Win32 {BA23811C-D4CB-4836-B2F3-6791BD6FFCD1}.Release|x64.ActiveCfg = Release|x64 {BA23811C-D4CB-4836-B2F3-6791BD6FFCD1}.Release|x64.Build.0 = Release|x64 - {33664E63-8D24-4FF4-A744-9782EB711509}.Debug|Win32.ActiveCfg = Debug|Win32 - {33664E63-8D24-4FF4-A744-9782EB711509}.Debug|Win32.Build.0 = Debug|Win32 - {33664E63-8D24-4FF4-A744-9782EB711509}.Debug|x64.ActiveCfg = Debug|x64 - {33664E63-8D24-4FF4-A744-9782EB711509}.Debug|x64.Build.0 = Debug|x64 - {33664E63-8D24-4FF4-A744-9782EB711509}.DebugVLD|Win32.ActiveCfg = DebugVLD|Win32 - {33664E63-8D24-4FF4-A744-9782EB711509}.DebugVLD|Win32.Build.0 = DebugVLD|Win32 - {33664E63-8D24-4FF4-A744-9782EB711509}.DebugVLD|x64.ActiveCfg = DebugVLD|x64 - {33664E63-8D24-4FF4-A744-9782EB711509}.DebugVLD|x64.Build.0 = DebugVLD|x64 - {33664E63-8D24-4FF4-A744-9782EB711509}.Release|Win32.ActiveCfg = Release|Win32 - {33664E63-8D24-4FF4-A744-9782EB711509}.Release|Win32.Build.0 = Release|Win32 - {33664E63-8D24-4FF4-A744-9782EB711509}.Release|x64.ActiveCfg = Release|x64 - {33664E63-8D24-4FF4-A744-9782EB711509}.Release|x64.Build.0 = Release|x64 {E5E9DB4A-7816-45D4-A116-6BBBA0EE8EE7}.Debug|Win32.ActiveCfg = Debug|Win32 {E5E9DB4A-7816-45D4-A116-6BBBA0EE8EE7}.Debug|Win32.Build.0 = Debug|Win32 {E5E9DB4A-7816-45D4-A116-6BBBA0EE8EE7}.Debug|x64.ActiveCfg = Debug|x64 @@ -526,7 +508,6 @@ Global {CA25BDBF-B354-4597-B6D2-220ABBB0D2F4} = {6BB7A27F-FC59-4267-B6FA-D034176D1459} {AF7B2253-2E6D-4992-94D9-4B3699C54929} = {A64449B7-90FB-4E2B-A686-9EFC0E298644} {BA23811C-D4CB-4836-B2F3-6791BD6FFCD1} = {A64449B7-90FB-4E2B-A686-9EFC0E298644} - {33664E63-8D24-4FF4-A744-9782EB711509} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75} {E5E9DB4A-7816-45D4-A116-6BBBA0EE8EE7} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75} {A38E5597-6916-4480-A343-C9846EF544E4} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75} {6F834EAD-7B94-4979-A0F1-A662E3D30145} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75} diff --git a/projects/Win/vc14/gtest-queue.vcxproj b/projects/Win/vc14/gtest-queue.vcxproj index 713f1c8a..d3c69d22 100644 --- a/projects/Win/vc14/gtest-queue.vcxproj +++ b/projects/Win/vc14/gtest-queue.vcxproj @@ -42,6 +42,8 @@ + + @@ -59,6 +61,7 @@ + diff --git a/projects/Win/vc14/gtest-queue.vcxproj.filters b/projects/Win/vc14/gtest-queue.vcxproj.filters index 723ac426..133fc42c 100644 --- a/projects/Win/vc14/gtest-queue.vcxproj.filters +++ b/projects/Win/vc14/gtest-queue.vcxproj.filters @@ -93,6 +93,12 @@ Source Files + + Source Files + + + Source Files + @@ -110,5 +116,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/projects/Win/vc14/hdr-test-queue.vcxproj b/projects/Win/vc14/hdr-test-queue.vcxproj deleted file mode 100644 index b604c0bf..00000000 --- a/projects/Win/vc14/hdr-test-queue.vcxproj +++ /dev/null @@ -1,370 +0,0 @@ - - - - - DebugVLD - Win32 - - - DebugVLD - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {33664E63-8D24-4FF4-A744-9782EB711509} - hdrtestqueue - Win32Proj - 8.1 - - - - Application - MultiByte - v140 - - - Application - MultiByte - true - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - true - v140 - - - Application - MultiByte - v140 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - $(ProjectName)_d - $(ProjectName)_d - $(ProjectName)_d - $(ProjectName)_d - - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - Cdecl - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - false - - - MachineX86 - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - Cdecl - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - false - - - MachineX64 - MultiplyDefinedSymbolOnly - - - - - /bigobj /Zc:inline %(AdditionalOptions) - Full - AnySuitable - true - Speed - false - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - MultiThreadedDLL - StreamingSIMDExtensions2 - - - Level3 - ProgramDatabase - Cdecl - false - 4520 - - - unit-prerequisites.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - true - true - false - - - MachineX86 - true - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - Full - AnySuitable - true - Speed - false - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - MultiThreadedDLL - - - Level3 - ProgramDatabase - Cdecl - false - 4520 - - - unit-prerequisites.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - true - true - UseLinkTimeCodeGeneration - false - - - MachineX64 - true - MultiplyDefinedSymbolOnly - - - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - Cdecl - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - false - - - MachineX86 - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - Cdecl - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - false - - - MachineX64 - MultiplyDefinedSymbolOnly - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/projects/Win/vc14/hdr-test-queue.vcxproj.filters b/projects/Win/vc14/hdr-test-queue.vcxproj.filters deleted file mode 100644 index c99471b3..00000000 --- a/projects/Win/vc14/hdr-test-queue.vcxproj.filters +++ /dev/null @@ -1,106 +0,0 @@ - - - - - intrusive - - - intrusive - - - intrusive - - - intrusive - - - intrusive - - - intrusive - - - intrusive - - - intrusive - - - container - - - container - - - container - - - intrusive - - - intrusive - - - container - - - container - - - container - - - container - - - - intrusive - - - container - - - container - - - intrusive - - - container - - - container - - - intrusive - - - container - - - container - - - - - intrusive - - - intrusive - - - container - - - container - - - - - {68aaf08b-6544-4d6a-b912-0935954efdf2} - - - {a466b6f6-2b88-4c6e-84df-1f9d53122909} - - - \ No newline at end of file diff --git a/projects/source.test-hdr.mk b/projects/source.test-hdr.mk index 012f9460..c6a5f399 100644 --- a/projects/source.test-hdr.mk +++ b/projects/source.test-hdr.mk @@ -100,28 +100,6 @@ CDS_TESTHDR_LIST := \ tests/test-hdr/list/hdr_michael_kv_rcu_shb.cpp \ tests/test-hdr/list/hdr_michael_kv_rcu_sht.cpp -CDS_TESTHDR_QUEUE := \ - tests/test-hdr/queue/hdr_queue_register.cpp \ - tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp \ - tests/test-hdr/queue/hdr_intrusive_segmented_queue_hp.cpp \ - tests/test-hdr/queue/hdr_intrusive_segmented_queue_dhp.cpp \ - tests/test-hdr/queue/hdr_intrusive_tsigas_cycle_queue.cpp \ - tests/test-hdr/queue/hdr_intrusive_vyukovmpmc_cycle_queue.cpp \ - tests/test-hdr/queue/hdr_basketqueue_hp.cpp \ - tests/test-hdr/queue/hdr_basketqueue_dhp.cpp \ - tests/test-hdr/queue/hdr_fcqueue.cpp \ - tests/test-hdr/queue/hdr_moirqueue_hp.cpp \ - tests/test-hdr/queue/hdr_moirqueue_dhp.cpp \ - tests/test-hdr/queue/hdr_msqueue_hp.cpp \ - tests/test-hdr/queue/hdr_msqueue_dhp.cpp \ - tests/test-hdr/queue/hdr_optimistic_hp.cpp \ - tests/test-hdr/queue/hdr_optimistic_dhp.cpp \ - tests/test-hdr/queue/hdr_rwqueue.cpp \ - tests/test-hdr/queue/hdr_segmented_queue_hp.cpp \ - tests/test-hdr/queue/hdr_segmented_queue_dhp.cpp \ - tests/test-hdr/queue/hdr_tsigas_cycle_queue.cpp \ - tests/test-hdr/queue/hdr_vyukov_mpmc_cyclic.cpp - CDS_TESTHDR_SET := \ tests/test-hdr/set/hdr_intrusive_feldman_hashset_hp.cpp \ tests/test-hdr/set/hdr_intrusive_feldman_hashset_dhp.cpp \ @@ -273,7 +251,6 @@ CDS_TESTHDR_MISC := \ tests/test-hdr/misc/thread_init_fini.cpp CDS_TESTHDR_SOURCES := \ - $(CDS_TESTHDR_QUEUE) \ $(CDS_TESTHDR_MAP) \ $(CDS_TESTHDR_LIST) \ $(CDS_TESTHDR_SET) \ diff --git a/projects/source.test-hdr.offsetof.mk b/projects/source.test-hdr.offsetof.mk index 2a6eb523..37f0c3a9 100644 --- a/projects/source.test-hdr.offsetof.mk +++ b/projects/source.test-hdr.offsetof.mk @@ -1,5 +1,3 @@ -CDS_TESTHDR_OFFSETOF_DEQUE := \ - CDS_TESTHDR_OFFSETOF_MAP := \ tests/test-hdr/map/hdr_cuckoo_map.cpp @@ -67,22 +65,6 @@ CDS_TESTHDR_OFFSETOF_LIST := \ tests/test-hdr/list/hdr_intrusive_michael_list_rcu_shb.cpp \ tests/test-hdr/list/hdr_intrusive_michael_list_rcu_sht.cpp -CDS_TESTHDR_OFFSETOF_QUEUE := \ - tests/test-hdr/queue/hdr_intrusive_basketqueue_hp.cpp \ - tests/test-hdr/queue/hdr_intrusive_basketqueue_dhp.cpp \ - tests/test-hdr/queue/hdr_intrusive_moirqueue_hp.cpp \ - tests/test-hdr/queue/hdr_intrusive_moirqueue_dhp.cpp \ - tests/test-hdr/queue/hdr_intrusive_msqueue_hp.cpp \ - tests/test-hdr/queue/hdr_intrusive_msqueue_dhp.cpp \ - tests/test-hdr/queue/hdr_intrusive_optimisticqueue_hp.cpp \ - tests/test-hdr/queue/hdr_intrusive_optimisticqueue_dhp.cpp - -CDS_TESTHDR_OFFSETOF_STACK := \ - tests/test-hdr/stack/hdr_intrusive_treiber_stack_hp.cpp \ - tests/test-hdr/stack/hdr_intrusive_treiber_stack_dhp.cpp \ - tests/test-hdr/stack/hdr_intrusive_elimination_stack_hp.cpp \ - tests/test-hdr/stack/hdr_intrusive_elimination_stack_dhp.cpp - CDS_TESTHDR_OFFSETOF_TREE := \ tests/test-hdr/tree/hdr_intrusive_ellen_bintree_hp_member.cpp \ tests/test-hdr/tree/hdr_intrusive_ellen_bintree_dhp_member.cpp \ @@ -93,9 +75,6 @@ CDS_TESTHDR_OFFSETOF_TREE := \ tests/test-hdr/tree/hdr_intrusive_ellen_bintree_rcu_sht_member.cpp CDS_TESTHDR_OFFSETOF_SOURCES := \ - $(CDS_TESTHDR_OFFSETOF_QUEUE) \ - $(CDS_TESTHDR_OFFSETOF_STACK) \ - $(CDS_TESTHDR_OFFSETOF_DEQUE) \ $(CDS_TESTHDR_OFFSETOF_MAP) \ $(CDS_TESTHDR_OFFSETOF_SET) \ $(CDS_TESTHDR_OFFSETOF_LIST) \ diff --git a/test/unit/queue/CMakeLists.txt b/test/unit/queue/CMakeLists.txt index 62f6c2c0..00310999 100644 --- a/test/unit/queue/CMakeLists.txt +++ b/test/unit/queue/CMakeLists.txt @@ -27,6 +27,8 @@ set(CDSGTEST_QUEUE_SOURCES intrusive_optqueue_dhp.cpp intrusive_segmented_queue_hp.cpp intrusive_segmented_queue_dhp.cpp + intrusive_tsigas_queue.cpp + intrusive_vyukov_queue.cpp ) include_directories( diff --git a/test/unit/queue/intrusive_tsigas_queue.cpp b/test/unit/queue/intrusive_tsigas_queue.cpp new file mode 100644 index 00000000..526d836f --- /dev/null +++ b/test/unit/queue/intrusive_tsigas_queue.cpp @@ -0,0 +1,112 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include "test_intrusive_bounded_queue.h" + +namespace { + + class IntrusiveTsigasQueue : public cds_test::intrusive_bounded_queue + { + protected: + struct disposer { + void operator()( item * p ) + { + ++p->nDisposeCount; + } + }; + }; + + static const size_t c_Capacity = 64; + static const size_t c_RealCapacity = c_Capacity - 2; + + TEST_F( IntrusiveTsigasQueue, defaulted ) + { + cds::intrusive::TsigasCycleQueue< item > q( c_Capacity ); + ASSERT_EQ( q.capacity(), c_RealCapacity ); + test( q ); + } + + TEST_F( IntrusiveTsigasQueue, disposer ) + { + struct traits : public cds::intrusive::tsigas_queue::traits + { + typedef IntrusiveTsigasQueue::disposer disposer; + typedef cds::atomicity::item_counter item_counter; + }; + + cds::intrusive::TsigasCycleQueue< item, traits > q( c_Capacity ); + ASSERT_EQ( q.capacity(), c_RealCapacity ); + test( q ); + } + + TEST_F( IntrusiveTsigasQueue, static_buffer ) + { + struct traits : public cds::intrusive::tsigas_queue::traits + { + typedef cds::opt::v::static_buffer< int, c_Capacity > buffer; + typedef IntrusiveTsigasQueue::disposer disposer; + }; + + cds::intrusive::TsigasCycleQueue< item, traits > q; + ASSERT_EQ( q.capacity(), c_RealCapacity ); + test( q ); + } + + TEST_F( IntrusiveTsigasQueue, dynamic_buffer ) + { + typedef typename cds::intrusive::tsigas_queue::make_traits< + cds::opt::buffer< cds::opt::v::dynamic_buffer< int >> + ,cds::opt::item_counter< cds::atomicity::item_counter > + ,cds::opt::back_off< cds::backoff::pause > + ,cds::intrusive::opt::disposer< disposer > + >::type traits; + + cds::intrusive::TsigasCycleQueue< item, traits > q( c_Capacity ); + ASSERT_EQ( q.capacity(), c_RealCapacity ); + test( q ); + } + + TEST_F( IntrusiveTsigasQueue, padding ) + { + struct traits : public cds::intrusive::tsigas_queue::traits + { + typedef cds::opt::v::static_buffer< int, c_Capacity > buffer; + typedef IntrusiveTsigasQueue::disposer disposer; + enum { padding = 16 | cds::opt::padding_tiny_data_only }; + }; + + cds::intrusive::TsigasCycleQueue< item, traits > q; + ASSERT_EQ( q.capacity(), c_RealCapacity ); + test( q ); + } + + +} // namespace diff --git a/test/unit/queue/intrusive_vyukov_queue.cpp b/test/unit/queue/intrusive_vyukov_queue.cpp new file mode 100644 index 00000000..98204040 --- /dev/null +++ b/test/unit/queue/intrusive_vyukov_queue.cpp @@ -0,0 +1,112 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include "test_intrusive_bounded_queue.h" + +namespace { + + class IntrusiveVyukovQueue : public cds_test::intrusive_bounded_queue + { + protected: + struct disposer { + void operator()( item * p ) + { + ++p->nDisposeCount; + } + }; + }; + + static const size_t c_Capacity = 64; + static const size_t c_RealCapacity = c_Capacity; + + TEST_F( IntrusiveVyukovQueue, defaulted ) + { + cds::intrusive::VyukovMPMCCycleQueue< item > q( c_Capacity ); + ASSERT_EQ( q.capacity(), c_RealCapacity ); + test( q ); + } + + TEST_F( IntrusiveVyukovQueue, disposer ) + { + struct traits : public cds::intrusive::vyukov_queue::traits + { + typedef IntrusiveVyukovQueue::disposer disposer; + typedef cds::atomicity::item_counter item_counter; + }; + + cds::intrusive::VyukovMPMCCycleQueue< item, traits > q( c_Capacity ); + ASSERT_EQ( q.capacity(), c_RealCapacity ); + test( q ); + } + + TEST_F( IntrusiveVyukovQueue, static_buffer ) + { + struct traits : public cds::intrusive::vyukov_queue::traits + { + typedef cds::opt::v::static_buffer< int, c_Capacity > buffer; + typedef IntrusiveVyukovQueue::disposer disposer; + }; + + cds::intrusive::VyukovMPMCCycleQueue< item, traits > q; + ASSERT_EQ( q.capacity(), c_RealCapacity ); + test( q ); + } + + TEST_F( IntrusiveVyukovQueue, dynamic_buffer ) + { + typedef typename cds::intrusive::vyukov_queue::make_traits< + cds::opt::buffer< cds::opt::v::dynamic_buffer< int >> + ,cds::opt::item_counter< cds::atomicity::item_counter > + ,cds::opt::back_off< cds::backoff::pause > + ,cds::intrusive::opt::disposer< disposer > + >::type traits; + + cds::intrusive::VyukovMPMCCycleQueue< item, traits > q( c_Capacity ); + ASSERT_EQ( q.capacity(), c_RealCapacity ); + test( q ); + } + + TEST_F( IntrusiveVyukovQueue, padding ) + { + struct traits : public cds::intrusive::vyukov_queue::traits + { + typedef cds::opt::v::static_buffer< int, c_Capacity > buffer; + typedef IntrusiveVyukovQueue::disposer disposer; + enum { padding = 16 | cds::opt::padding_tiny_data_only }; + }; + + cds::intrusive::VyukovMPMCCycleQueue< item, traits > q; + ASSERT_EQ( q.capacity(), c_RealCapacity ); + test( q ); + } + + +} // namespace diff --git a/test/unit/queue/test_intrusive_bounded_queue.h b/test/unit/queue/test_intrusive_bounded_queue.h new file mode 100644 index 00000000..3c445f8f --- /dev/null +++ b/test/unit/queue/test_intrusive_bounded_queue.h @@ -0,0 +1,151 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_QUEUE_TEST_INTRUSIVE_BOUNDED_QUEUE_H +#define CDSUNIT_QUEUE_TEST_INTRUSIVE_BOUNDED_QUEUE_H + +#include +#include + +namespace cds_test { + + class intrusive_bounded_queue : public ::testing::Test + { + protected: + struct item { + int nVal; + int nDisposeCount; + + item() + : nDisposeCount( 0 ) + {} + }; + + protected: + template + void test( Queue& q ) + { + typedef typename Queue::value_type value_type; + value_type it; + + const size_t nSize = q.capacity(); + + ASSERT_TRUE( q.empty() ); + ASSERT_CONTAINER_SIZE( q, 0 ); + + std::vector< value_type > arr; + arr.resize( nSize ); + for ( size_t i = 0; i < nSize; ++i ) + arr[i].nVal = static_cast(i); + + // push + for ( auto& i : arr ) { + if ( i.nVal & 1 ) { + ASSERT_TRUE( q.push( i )); + } + else { + ASSERT_TRUE( q.enqueue( i )); + } + ASSERT_CONTAINER_SIZE( q, i.nVal + 1 ); + ASSERT_FALSE( q.empty() ); + } + + ASSERT_CONTAINER_SIZE( q, q.capacity() ); + + // pop + int val = 0; + while ( !q.empty() ) { + value_type * v; + if ( val & 1 ) + v = q.pop(); + else + v = q.dequeue(); + + ASSERT_TRUE( v != nullptr ); + ASSERT_EQ( v->nVal, val ); + ++val; + ASSERT_CONTAINER_SIZE( q, nSize - static_cast( val )); + } + ASSERT_EQ( val, static_cast( nSize )); + + ASSERT_TRUE( q.empty() ); + ASSERT_CONTAINER_SIZE( q, 0 ); + + // pop from empty queue + { + value_type * v = q.pop(); + ASSERT_TRUE( v == nullptr ); + ASSERT_TRUE( q.empty() ); + ASSERT_CONTAINER_SIZE( q, 0 ); + } + + // clear + for ( auto& i : arr ) { + ASSERT_TRUE( q.push( i ) ); + } + ASSERT_FALSE( q.empty() ); + ASSERT_CONTAINER_SIZE( q, q.capacity() ); + q.clear(); + ASSERT_TRUE( q.empty() ); + ASSERT_CONTAINER_SIZE( q, 0 ); + + if ( std::is_same::value ) { + // no disposer + for ( auto& i : arr ) { + ASSERT_EQ( i.nDisposeCount, 0 ); + } + } + else { + // check the disposer has been called + for ( auto& i : arr ) { + ASSERT_EQ( i.nDisposeCount, 1 ); + } + } + + // clear with disposer + for ( auto& i : arr ) { + ASSERT_TRUE( q.push( i ) ); + i.nDisposeCount = 0; + } + ASSERT_FALSE( q.empty() ); + ASSERT_CONTAINER_SIZE( q, q.capacity() ); + q.clear( []( value_type * p ) { p->nDisposeCount = p->nVal + 1; } ); + ASSERT_TRUE( q.empty() ); + ASSERT_CONTAINER_SIZE( q, 0 ); + // check the disposer has not been called + for ( auto& i : arr ) { + ASSERT_EQ( i.nDisposeCount, i.nVal + 1 ); + } + } + }; + +} // namespace cds_test + +#endif // CDSUNIT_QUEUE_TEST_INTRUSIVE_BOUNDED_QUEUE_H diff --git a/test/unit/queue/tsigas_queue.cpp b/test/unit/queue/tsigas_queue.cpp index f82e2d5c..6ab9b689 100644 --- a/test/unit/queue/tsigas_queue.cpp +++ b/test/unit/queue/tsigas_queue.cpp @@ -102,7 +102,7 @@ namespace { struct traits : public cds::container::tsigas_queue::traits { typedef cds::opt::v::dynamic_buffer buffer; - enum { alignment = 16 }; + enum { padding = 16 }; }; typedef cds::container::TsigasCycleQueue< int, traits > test_queue; diff --git a/tests/test-hdr/queue/hdr_basketqueue_dhp.cpp b/tests/test-hdr/queue/hdr_basketqueue_dhp.cpp deleted file mode 100644 index 597cee1e..00000000 --- a/tests/test-hdr/queue/hdr_basketqueue_dhp.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -#include "queue/hdr_queue.h" - -namespace queue { - - void HdrTestQueue::BasketQueue_DHP() - { - typedef cds::container::BasketQueue< cds::gc::DHP, int > queue_type; - test_no_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_DHP_Counted() - { - struct traits : public cds::container::basket_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - }; - typedef cds::container::BasketQueue< cds::gc::DHP, int, traits > queue_type; - test_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_DHP_relax() - { - struct traits : public - cds::container::basket_queue::make_traits < - cds::opt::memory_model< cds::opt::v::relaxed_ordering> - > ::type - {}; - typedef cds::container::BasketQueue< cds::gc::DHP, int, traits > queue_type; - test_no_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_DHP_Counted_relax() - { - typedef cds::container::BasketQueue< cds::gc::DHP, int, - typename cds::container::basket_queue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::relaxed_ordering> - >::type - > queue_type; - test_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_DHP_seqcst() - { - struct traits : public cds::container::basket_queue::traits - { - typedef cds::opt::v::sequential_consistent memory_model; - }; - typedef cds::container::BasketQueue< cds::gc::DHP, int, traits > queue_type; - test_no_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_DHP_Counted_seqcst() - { - typedef cds::container::BasketQueue < cds::gc::DHP, int, - typename cds::container::basket_queue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::sequential_consistent> - >::type - > queue_type; - test_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_DHP_relax_align() - { - typedef cds::container::BasketQueue < cds::gc::DHP, int, - typename cds::container::basket_queue::make_traits < - cds::opt::memory_model< cds::opt::v::relaxed_ordering> - ,cds::opt::padding< 16 > - >::type - > queue_type; - test_no_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_DHP_Counted_relax_align() - { - struct traits : public cds::container::basket_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - typedef cds::opt::v::relaxed_ordering memory_model; - enum { padding = 32 }; - }; - typedef cds::container::BasketQueue < cds::gc::DHP, int, traits > queue_type; - test_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_DHP_seqcst_align() - { - typedef cds::container::BasketQueue < cds::gc::DHP, int, - typename cds::container::basket_queue::make_traits < - cds::opt::memory_model< cds::opt::v::sequential_consistent> - , cds::opt::padding< cds::opt::no_special_padding > - > ::type - > queue_type; - test_no_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_DHP_Counted_seqcst_align() - { - typedef cds::container::BasketQueue < cds::gc::DHP, int, - typename cds::container::basket_queue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::sequential_consistent> - ,cds::opt::padding< cds::opt::cache_line_padding > - > ::type - > queue_type; - test_ic< queue_type >(); - } - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_basketqueue_hp.cpp b/tests/test-hdr/queue/hdr_basketqueue_hp.cpp deleted file mode 100644 index d2f062af..00000000 --- a/tests/test-hdr/queue/hdr_basketqueue_hp.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -#include "queue/hdr_queue.h" - -namespace queue { - - void HdrTestQueue::BasketQueue_HP() - { - typedef cds::container::BasketQueue< cds::gc::HP, int > queue_type; - test_no_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_HP_Counted() - { - struct traits : public cds::container::basket_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - }; - typedef cds::container::BasketQueue< cds::gc::HP, int, traits > queue_type; - test_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_HP_relax() - { - struct traits : public - cds::container::basket_queue::make_traits < - cds::opt::memory_model< cds::opt::v::relaxed_ordering> - > ::type - {}; - typedef cds::container::BasketQueue< cds::gc::HP, int, traits > queue_type; - test_no_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_HP_Counted_relax() - { - typedef cds::container::BasketQueue< cds::gc::HP, int, - typename cds::container::basket_queue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::relaxed_ordering> - >::type - > queue_type; - test_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_HP_seqcst() - { - struct traits : public cds::container::basket_queue::traits - { - typedef cds::opt::v::sequential_consistent memory_model; - }; - typedef cds::container::BasketQueue< cds::gc::HP, int, traits > queue_type; - test_no_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_HP_Counted_seqcst() - { - typedef cds::container::BasketQueue < cds::gc::HP, int, - typename cds::container::basket_queue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::sequential_consistent> - >::type - > queue_type; - test_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_HP_relax_align() - { - typedef cds::container::BasketQueue < cds::gc::HP, int, - typename cds::container::basket_queue::make_traits < - cds::opt::memory_model< cds::opt::v::relaxed_ordering> - ,cds::opt::padding< 16 > - >::type - > queue_type; - test_no_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_HP_Counted_relax_align() - { - struct traits : public cds::container::basket_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - typedef cds::opt::v::relaxed_ordering memory_model; - enum { padding = 32 }; - }; - typedef cds::container::BasketQueue < cds::gc::HP, int, traits > queue_type; - test_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_HP_seqcst_align() - { - typedef cds::container::BasketQueue < cds::gc::HP, int, - typename cds::container::basket_queue::make_traits < - cds::opt::memory_model< cds::opt::v::sequential_consistent> - , cds::opt::padding< cds::opt::no_special_padding > - > ::type - > queue_type; - test_no_ic< queue_type >(); - } - - void HdrTestQueue::BasketQueue_HP_Counted_seqcst_align() - { - typedef cds::container::BasketQueue < cds::gc::HP, int, - typename cds::container::basket_queue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::sequential_consistent> - ,cds::opt::padding< cds::opt::cache_line_padding > - > ::type - > queue_type; - test_ic< queue_type >(); - } - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_fcqueue.cpp b/tests/test-hdr/queue/hdr_fcqueue.cpp deleted file mode 100644 index f93e54e9..00000000 --- a/tests/test-hdr/queue/hdr_fcqueue.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include "queue/hdr_fcqueue.h" - -#include - -namespace queue { - - void HdrFCQueue::FCQueue_deque() - { - typedef cds::container::FCQueue queue_type; - testFCQueue(); - } - - void HdrFCQueue::FCQueue_deque_elimination() - { - typedef cds::container::FCQueue >, - cds::container::fcqueue::make_traits< - cds::opt::enable_elimination< true > - >::type - > queue_type; - testFCQueue(); - } - - void HdrFCQueue::FCQueue_deque_mutex() - { - typedef cds::container::FCQueue >, - cds::container::fcqueue::make_traits< - cds::opt::lock_type< std::mutex > - >::type - > queue_type; - testFCQueue(); - } - - void HdrFCQueue::FCQueue_deque_stat() - { - typedef cds::container::FCQueue >, - cds::container::fcqueue::make_traits< - cds::opt::stat< cds::container::fcqueue::stat<> > - >::type - > queue_type; - testFCQueue(); - } - - // - void HdrFCQueue::FCQueue_list() - { - typedef cds::container::FCQueue > > queue_type; - testFCQueue(); - } - - void HdrFCQueue::FCQueue_list_elimination() - { - typedef cds::container::FCQueue >, - cds::container::fcqueue::make_traits< - cds::opt::enable_elimination< true > - >::type - > queue_type; - testFCQueue(); - } - - void HdrFCQueue::FCQueue_list_mutex() - { - typedef cds::container::FCQueue >, - cds::container::fcqueue::make_traits< - cds::opt::lock_type< std::mutex > - >::type - > queue_type; - testFCQueue(); - } - - void HdrFCQueue::FCQueue_list_stat() - { - struct queue_traits : public cds::container::fcqueue::traits - { - typedef cds::container::fcqueue::stat<> stat; - }; - typedef cds::container::FCQueue >, queue_traits > queue_type; - testFCQueue(); - } - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_fcqueue.h b/tests/test-hdr/queue/hdr_fcqueue.h deleted file mode 100644 index cd15a21e..00000000 --- a/tests/test-hdr/queue/hdr_fcqueue.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef CDSTEST_HDR_FCQUEUE_H -#define CDSTEST_HDR_FCQUEUE_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 CDSTEST_HDR_FCQUEUE_H diff --git a/tests/test-hdr/queue/hdr_intrusive_basketqueue_dhp.cpp b/tests/test-hdr/queue/hdr_intrusive_basketqueue_dhp.cpp deleted file mode 100644 index 4c99c10c..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_basketqueue_dhp.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" -#include -#include - -namespace queue { - -#define TEST(X) void IntrusiveQueueHeaderTest::test_##X() { test_basket(); } - - namespace { - typedef IntrusiveQueueHeaderTest::base_hook_item < ci::basket_queue::node > base_hook_item; - typedef IntrusiveQueueHeaderTest::member_hook_item < ci::basket_queue::node > member_hook_item; - - // DHP base hook - struct traits_BasketQueue_disposer : public - ci::basket_queue::make_traits < ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > >::type - { - typedef ci::basket_queue::base_hook< ci::opt::gc < cds::gc::DHP > > hook; - }; - typedef ci::BasketQueue< cds::gc::DHP, base_hook_item, traits_BasketQueue_disposer > BasketQueue_DHP_base; - - // DHP member hook - struct traits_BasketQueue_member : public traits_BasketQueue_disposer - { - typedef ci::basket_queue::member_hook< offsetof( member_hook_item, hMember ), ci::opt::gc < cds::gc::DHP > > hook; - }; - typedef ci::BasketQueue< cds::gc::DHP, member_hook_item, traits_BasketQueue_member >BasketQueue_DHP_member; - - /// DHP base hook + item counter - typedef ci::BasketQueue< cds::gc::DHP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::basket_queue::base_hook< ci::opt::gc > - > - ,co::item_counter< cds::atomicity::item_counter > - ,co::memory_model< co::v::relaxed_ordering > - >::type - > BasketQueue_DHP_base_ic; - - // DHP member hook + item counter - typedef ci::BasketQueue< cds::gc::DHP, member_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::member_hook< - offsetof( member_hook_item, hMember), - ci::opt::gc - > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > BasketQueue_DHP_member_ic; - - // DHP base hook + stat - typedef ci::BasketQueue< cds::gc::DHP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::basket_queue::stat<> > - >::type - > BasketQueue_DHP_base_stat; - - // DHP member hook + stat - typedef ci::BasketQueue< cds::gc::DHP, member_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::basket_queue::stat<> > - >::type - > BasketQueue_DHP_member_stat; - - // DHP base hook + padding - typedef ci::BasketQueue< cds::gc::DHP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::basket_queue::base_hook< ci::opt::gc > - > - ,co::padding< 32 > - >::type - > BasketQueue_DHP_base_align; - - // DHP member hook + padding - typedef ci::BasketQueue< cds::gc::DHP, member_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< 32 > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > BasketQueue_DHP_member_align; - - // DHP base hook + no padding - typedef ci::BasketQueue< cds::gc::DHP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::padding< co::no_special_padding > - >::type - > BasketQueue_DHP_base_noalign; - - // DHP member hook + no padding - typedef ci::BasketQueue< cds::gc::DHP, member_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::basket_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< co::no_special_padding > - >::type - > BasketQueue_DHP_member_noalign; - - - // DHP base hook + cache padding - typedef ci::BasketQueue< cds::gc::DHP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::base_hook< ci::opt::gc > - > - ,co::padding< co::cache_line_padding > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > BasketQueue_DHP_base_cachealign; - - // DHP member hook + cache padding - typedef ci::BasketQueue< cds::gc::DHP, member_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< co::cache_line_padding > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > BasketQueue_DHP_member_cachealign; - } // namespace - - TEST(BasketQueue_DHP_base) - TEST(BasketQueue_DHP_member) - TEST(BasketQueue_DHP_base_ic) - TEST(BasketQueue_DHP_member_ic) - TEST(BasketQueue_DHP_base_stat) - TEST(BasketQueue_DHP_member_stat) - TEST(BasketQueue_DHP_base_align) - TEST(BasketQueue_DHP_member_align) - TEST(BasketQueue_DHP_base_noalign) - TEST(BasketQueue_DHP_member_noalign) - TEST(BasketQueue_DHP_base_cachealign) - TEST(BasketQueue_DHP_member_cachealign) -} diff --git a/tests/test-hdr/queue/hdr_intrusive_basketqueue_hp.cpp b/tests/test-hdr/queue/hdr_intrusive_basketqueue_hp.cpp deleted file mode 100644 index 1028f2de..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_basketqueue_hp.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" -#include -#include - -namespace queue { - -#define TEST(X) void IntrusiveQueueHeaderTest::test_##X() { test_basket(); } - - namespace { - typedef IntrusiveQueueHeaderTest::base_hook_item< ci::basket_queue::node > base_hook_item; - typedef IntrusiveQueueHeaderTest::member_hook_item< ci::basket_queue::node > member_hook_item; - - struct traits_BasketQueue_HP_default : public ci::basket_queue::traits - { - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - }; - typedef ci::BasketQueue< cds::gc::HP, base_hook_item, traits_BasketQueue_HP_default > BasketQueue_HP_default; - - /// HP + item counter - struct traits_BasketQueue_HP_default_ic : public traits_BasketQueue_HP_default - { - typedef cds::atomicity::item_counter item_counter; - typedef co::v::sequential_consistent memory_model; - }; - typedef ci::BasketQueue< cds::gc::HP, base_hook_item, traits_BasketQueue_HP_default_ic > BasketQueue_HP_default_ic; - - /// HP + stat - typedef ci::BasketQueue< cds::gc::HP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::basket_queue::stat<> > - >::type - > BasketQueue_HP_default_stat; - - // HP base hook - struct traits_BasketQueue_HP_base : public ci::basket_queue::traits - { - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - typedef ci::basket_queue::base_hook< ci::opt::gc > hook; - }; - typedef ci::BasketQueue< cds::gc::HP, base_hook_item, traits_BasketQueue_HP_base > BasketQueue_HP_base; - - // HP member hook - struct traits_BasketQueue_HP_member : public traits_BasketQueue_HP_base - { - typedef ci::basket_queue::member_hook < - offsetof( member_hook_item, hMember ), - ci::opt::gc < cds::gc::HP > - > hook; - - }; - typedef ci::BasketQueue< cds::gc::HP, member_hook_item, traits_BasketQueue_HP_member > BasketQueue_HP_member; - - /// HP base hook + item counter - typedef ci::BasketQueue< cds::gc::HP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::basket_queue::base_hook< ci::opt::gc > - > - ,co::item_counter< cds::atomicity::item_counter > - ,co::memory_model< co::v::relaxed_ordering > - >::type - > BasketQueue_HP_base_ic; - - // HP member hook + item counter - typedef ci::BasketQueue< cds::gc::HP, member_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::member_hook< - offsetof( member_hook_item, hMember), - ci::opt::gc - > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > BasketQueue_HP_member_ic; - - // HP base hook + stat - typedef ci::BasketQueue< cds::gc::HP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::basket_queue::stat<> > - >::type - > BasketQueue_HP_base_stat; - - // HP member hook + stat - typedef ci::BasketQueue< cds::gc::HP, member_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::basket_queue::stat<> > - >::type - > BasketQueue_HP_member_stat; - - // HP base hook + padding - typedef ci::BasketQueue< cds::gc::HP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::basket_queue::base_hook< ci::opt::gc > - > - ,co::padding< 32 > - >::type - > BasketQueue_HP_base_align; - - // HP member hook + padding - typedef ci::BasketQueue< cds::gc::HP, member_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< 32 > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > BasketQueue_HP_member_align; - - // HP base hook + no padding - typedef ci::BasketQueue< cds::gc::HP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::padding< co::no_special_padding > - >::type - > BasketQueue_HP_base_noalign; - - // HP member hook + no padding - typedef ci::BasketQueue< cds::gc::HP, member_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::basket_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< co::no_special_padding > - >::type - > BasketQueue_HP_member_noalign; - - - // HP base hook + cache padding - typedef ci::BasketQueue< cds::gc::HP, base_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::base_hook< ci::opt::gc > - > - ,co::padding< co::cache_line_padding > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > BasketQueue_HP_base_cachealign; - - // HP member hook + cache padding - typedef ci::BasketQueue< cds::gc::HP, member_hook_item, - typename ci::basket_queue::make_traits< - ci::opt::hook< - ci::basket_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< co::cache_line_padding > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > BasketQueue_HP_member_cachealign; - } // namespace - - TEST(BasketQueue_HP_default) - TEST(BasketQueue_HP_default_ic) - TEST(BasketQueue_HP_default_stat) - TEST(BasketQueue_HP_base) - TEST(BasketQueue_HP_member) - TEST(BasketQueue_HP_base_ic) - TEST(BasketQueue_HP_member_ic) - TEST(BasketQueue_HP_base_stat) - TEST(BasketQueue_HP_member_stat) - TEST(BasketQueue_HP_base_align) - TEST(BasketQueue_HP_member_align) - TEST(BasketQueue_HP_base_noalign) - TEST(BasketQueue_HP_member_noalign) - TEST(BasketQueue_HP_base_cachealign) - TEST(BasketQueue_HP_member_cachealign) -} diff --git a/tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp b/tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp deleted file mode 100644 index 7ec8c5f5..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "cppunit/cppunit_proxy.h" -#include - -namespace queue { - - class TestIntrusiveFCQueue: public CppUnitMini::TestCase - { - template - struct base_hook_item: public Hook - { - int nVal; - int nDisposeCount; - - base_hook_item() - : nDisposeCount(0) - {} - }; - - template - struct member_hook_item - { - int nVal; - int nDisposeCount; - Hook hMember; - - member_hook_item() - : nDisposeCount(0) - {} - }; - - struct disposer - { - template - void operator ()( T * p ) - { - ++p->nDisposeCount; - } - }; - - template - void test() - { - Queue q; - test_with(q); - } - - template - void test_with( Queue& q ) - { - typedef typename Queue::value_type value_type; - value_type v1, v2, v3; - CPPUNIT_ASSERT( q.empty() ); - - v1.nVal = 1; - v2.nVal = 2; - v3.nVal = 3; - CPPUNIT_ASSERT( q.push(v1)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v2)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v3)); - CPPUNIT_ASSERT( !q.empty() ); - - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - value_type * pv; - pv = q.pop(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 1 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - pv = q.pop(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 2 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - pv = q.dequeue(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 3 ); - CPPUNIT_ASSERT( q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - pv = q.dequeue(); - CPPUNIT_ASSERT( pv == nullptr ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - CPPUNIT_ASSERT( q.enqueue(v1)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.enqueue(v2)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.enqueue(v3)); - CPPUNIT_ASSERT( !q.empty() ); - - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - q.clear( true ); // call disposer - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 1 ); - CPPUNIT_CHECK( v2.nDisposeCount == 1 ); - CPPUNIT_CHECK( v3.nDisposeCount == 1 ); - - CPPUNIT_ASSERT( q.push(v1)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v2)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v3)); - CPPUNIT_ASSERT( !q.empty() ); - q.clear( false ); // no disposer called - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 1 ); - CPPUNIT_CHECK( v2.nDisposeCount == 1 ); - CPPUNIT_CHECK( v3.nDisposeCount == 1 ); - } - - void FCQueue_base(); - void FCQueue_base_stat(); - void FCQueue_base_elimination(); - void FCQueue_base_elimination_mutex(); - void FCQueue_base_seqcst(); - void FCQueue_member(); - void FCQueue_member_stat(); - void FCQueue_member_elimination(); - void FCQueue_member_elimination_mutex(); - void FCQueue_member_seqcst(); - - CPPUNIT_TEST_SUITE(TestIntrusiveFCQueue) - CPPUNIT_TEST(FCQueue_base) - CPPUNIT_TEST(FCQueue_base_stat) - CPPUNIT_TEST(FCQueue_base_elimination) - CPPUNIT_TEST(FCQueue_base_elimination_mutex) - CPPUNIT_TEST(FCQueue_base_seqcst) - CPPUNIT_TEST(FCQueue_member) - CPPUNIT_TEST(FCQueue_member_stat) - CPPUNIT_TEST(FCQueue_member_elimination) - CPPUNIT_TEST(FCQueue_member_elimination_mutex) - CPPUNIT_TEST(FCQueue_member_seqcst) - CPPUNIT_TEST_SUITE_END() - }; - - - void TestIntrusiveFCQueue::FCQueue_base() - { - typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type; - typedef cds::intrusive::FCQueue< value_type, boost::intrusive::list< value_type >, - cds::intrusive::fcqueue::make_traits< - cds::intrusive::opt::disposer< disposer > - >::type - > queue_type; - - test(); - } - - void TestIntrusiveFCQueue::FCQueue_base_stat() - { - typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type; - struct queue_traits : public cds::intrusive::fcqueue::traits - { - typedef TestIntrusiveFCQueue::disposer disposer; - typedef cds::intrusive::fcqueue::stat<> stat; - }; - typedef cds::intrusive::FCQueue< value_type, boost::intrusive::list< value_type >, queue_traits > queue_type; - - test(); - } - - void TestIntrusiveFCQueue::FCQueue_base_elimination() - { - typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type; - struct queue_traits : public - cds::intrusive::fcqueue::make_traits < - cds::intrusive::opt::disposer< disposer > - ,cds::opt::enable_elimination < true > - > ::type - {}; - typedef cds::intrusive::FCQueue< value_type, boost::intrusive::list< value_type >, queue_traits > queue_type; - - test(); - } - - void TestIntrusiveFCQueue::FCQueue_base_elimination_mutex() - { - typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type; - typedef cds::intrusive::FCQueue< value_type, boost::intrusive::list< value_type >, - cds::intrusive::fcqueue::make_traits< - cds::intrusive::opt::disposer< disposer > - ,cds::opt::enable_elimination< true > - ,cds::opt::lock_type< std::mutex > - >::type - > queue_type; - - test(); - } - - void TestIntrusiveFCQueue::FCQueue_base_seqcst() - { - typedef base_hook_item< boost::intrusive::list_base_hook<> > value_type; - typedef cds::intrusive::FCQueue< value_type, boost::intrusive::list< value_type >, - cds::intrusive::fcqueue::make_traits< - cds::intrusive::opt::disposer< disposer > - ,cds::opt::memory_model< cds::opt::v::sequential_consistent > - >::type - > queue_type; - - test(); - } - - void TestIntrusiveFCQueue::FCQueue_member() - { - typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type; - typedef boost::intrusive::member_hook, &value_type::hMember> member_option; - - typedef cds::intrusive::FCQueue< value_type, boost::intrusive::list< value_type, member_option >, - cds::intrusive::fcqueue::make_traits< - cds::intrusive::opt::disposer< disposer > - >::type - > queue_type; - - test(); - } - - void TestIntrusiveFCQueue::FCQueue_member_stat() - { - typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type; - typedef boost::intrusive::member_hook, &value_type::hMember> member_option; - - typedef cds::intrusive::FCQueue< value_type, boost::intrusive::list< value_type, member_option >, - cds::intrusive::fcqueue::make_traits< - cds::intrusive::opt::disposer< disposer > - ,cds::opt::stat< cds::intrusive::fcqueue::stat<> > - >::type - > queue_type; - - test(); - } - - void TestIntrusiveFCQueue::FCQueue_member_elimination() - { - typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type; - typedef boost::intrusive::member_hook, &value_type::hMember> member_option; - - typedef cds::intrusive::FCQueue< value_type, boost::intrusive::list< value_type, member_option >, - cds::intrusive::fcqueue::make_traits< - cds::intrusive::opt::disposer< disposer > - ,cds::opt::enable_elimination< true > - >::type - > queue_type; - - test(); - } - - void TestIntrusiveFCQueue::FCQueue_member_elimination_mutex() - { - typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type; - typedef boost::intrusive::member_hook, &value_type::hMember> member_option; - - typedef cds::intrusive::FCQueue< value_type, boost::intrusive::list< value_type, member_option >, - cds::intrusive::fcqueue::make_traits< - cds::intrusive::opt::disposer< disposer > - ,cds::opt::enable_elimination< true > - ,cds::opt::lock_type< std::mutex > - >::type - > queue_type; - - test(); - } - - void TestIntrusiveFCQueue::FCQueue_member_seqcst() - { - typedef member_hook_item< boost::intrusive::list_member_hook<> > value_type; - typedef boost::intrusive::member_hook, &value_type::hMember> member_option; - - typedef cds::intrusive::FCQueue< value_type, boost::intrusive::list< value_type, member_option >, - cds::intrusive::fcqueue::make_traits< - cds::intrusive::opt::disposer< disposer > - ,cds::opt::memory_model< cds::opt::v::sequential_consistent > - >::type - > queue_type; - - test(); - } - -} // namespace queue - -CPPUNIT_TEST_SUITE_REGISTRATION(queue::TestIntrusiveFCQueue); diff --git a/tests/test-hdr/queue/hdr_intrusive_moirqueue_dhp.cpp b/tests/test-hdr/queue/hdr_intrusive_moirqueue_dhp.cpp deleted file mode 100644 index 5095d838..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_moirqueue_dhp.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" -#include -#include - -namespace queue { - -#define TEST(X) void IntrusiveQueueHeaderTest::test_##X() { test(); } - - namespace { - typedef IntrusiveQueueHeaderTest::base_hook_item< ci::msqueue::node > base_item_type; - typedef IntrusiveQueueHeaderTest::member_hook_item< ci::msqueue::node > member_item_type; - - // DHP base hook - typedef ci::MoirQueue< cds::gc::DHP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MoirQueue_DHP_base; - - // DHP member hook - typedef ci::MoirQueue< cds::gc::DHP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MoirQueue_DHP_member; - - /// DHP base hook + item counter - typedef ci::MoirQueue< cds::gc::DHP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - , co::item_counter< cds::atomicity::item_counter > - , co::memory_model< co::v::relaxed_ordering > - >::type - > MoirQueue_DHP_base_ic; - - // DHP member hook + item counter - typedef ci::MoirQueue< cds::gc::DHP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , co::item_counter< cds::atomicity::item_counter > - >::type - > MoirQueue_DHP_member_ic; - - // DHP base hook + stat - typedef ci::MoirQueue< cds::gc::DHP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , co::stat< ci::msqueue::stat<> > - >::type - > MoirQueue_DHP_base_stat; - - // DHP member hook + stat - typedef ci::MoirQueue< cds::gc::DHP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , co::stat< ci::msqueue::stat<> > - >::type - > MoirQueue_DHP_member_stat; - - // DHP base hook + padding - typedef ci::MoirQueue< cds::gc::DHP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - , co::padding< 32 > - >::type - > MoirQueue_DHP_base_align; - - // DHP member hook + padding - typedef ci::MoirQueue< cds::gc::DHP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - , co::padding< 32 > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MoirQueue_DHP_member_align; - - // DHP base hook + no padding - struct traits_MoirQueue_DHP_base_noalign : public ci::msqueue::traits { - typedef ci::msqueue::base_hook< ci::opt::gc > hook; - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - enum { padding = co::no_special_padding }; - }; - typedef ci::MoirQueue< cds::gc::DHP, base_item_type, traits_MoirQueue_DHP_base_noalign > MoirQueue_DHP_base_noalign; - - // DHP member hook + no padding - struct traits_MoirQueue_DHP_member_noalign : public ci::msqueue::traits { - typedef ci::msqueue::member_hook < - offsetof( member_item_type, hMember ), - ci::opt::gc < cds::gc::DHP > - > hook; - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - enum { padding = co::no_special_padding }; - }; - typedef ci::MoirQueue< cds::gc::DHP, member_item_type, traits_MoirQueue_DHP_member_noalign > MoirQueue_DHP_member_noalign; - - - // DHP base hook + cache padding - struct traits_MoirQueue_DHP_base_cachealign : public traits_MoirQueue_DHP_base_noalign - { - enum { padding = co::cache_line_padding }; - }; - typedef ci::MoirQueue< cds::gc::DHP, base_item_type, traits_MoirQueue_DHP_base_cachealign > MoirQueue_DHP_base_cachealign; - - // DHP member hook + cache padding - struct traits_MoirQueue_DHP_member_cachealign : public traits_MoirQueue_DHP_member_noalign - { - enum { padding = co::cache_line_padding }; - }; - typedef ci::MoirQueue< cds::gc::DHP, member_item_type, traits_MoirQueue_DHP_member_cachealign > MoirQueue_DHP_member_cachealign; - } // namespace - - TEST(MoirQueue_DHP_base) - TEST(MoirQueue_DHP_member) - TEST(MoirQueue_DHP_base_ic) - TEST(MoirQueue_DHP_member_ic) - TEST(MoirQueue_DHP_base_stat) - TEST(MoirQueue_DHP_member_stat) - TEST(MoirQueue_DHP_base_align) - TEST(MoirQueue_DHP_member_align) - TEST(MoirQueue_DHP_base_noalign) - TEST(MoirQueue_DHP_member_noalign) - TEST(MoirQueue_DHP_base_cachealign) - TEST(MoirQueue_DHP_member_cachealign) - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_intrusive_moirqueue_hp.cpp b/tests/test-hdr/queue/hdr_intrusive_moirqueue_hp.cpp deleted file mode 100644 index a79cde59..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_moirqueue_hp.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" -#include -#include - -namespace queue { - -#define TEST(X) void IntrusiveQueueHeaderTest::test_##X() { test(); } - - namespace { - typedef IntrusiveQueueHeaderTest::base_hook_item< ci::msqueue::node > base_item_type; - typedef IntrusiveQueueHeaderTest::member_hook_item< ci::msqueue::node > member_item_type; - - typedef ci::MoirQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MoirQueue_HP_default; - - /// HP + item counter - typedef ci::MoirQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - ,co::memory_model< co::v::sequential_consistent > - >::type - > MoirQueue_HP_default_ic; - - /// HP + stat - typedef ci::MoirQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::msqueue::stat<> > - >::type - > MoirQueue_HP_default_stat; - - // HP base hook - typedef ci::MoirQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MoirQueue_HP_base; - - // HP member hook - typedef ci::MoirQueue< cds::gc::HP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MoirQueue_HP_member; - - /// HP base hook + item counter - typedef ci::MoirQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - ,co::item_counter< cds::atomicity::item_counter > - ,co::memory_model< co::v::relaxed_ordering > - >::type - > MoirQueue_HP_base_ic; - - // HP member hook + item counter - typedef ci::MoirQueue< cds::gc::HP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > MoirQueue_HP_member_ic; - - // HP base hook + stat - typedef ci::MoirQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::msqueue::stat<> > - >::type - > MoirQueue_HP_base_stat; - - // HP member hook + stat - typedef ci::MoirQueue< cds::gc::HP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::msqueue::stat<> > - >::type - > MoirQueue_HP_member_stat; - - // HP base hook + padding - typedef ci::MoirQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - ,co::padding< 32 > - >::type - > MoirQueue_HP_base_align; - - // HP member hook + padding - typedef ci::MoirQueue< cds::gc::HP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - ,co::padding< 32 > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MoirQueue_HP_member_align; - - // HP base hook + no padding - struct traits_MoirQueue_HP_base_noalign : public ci::msqueue::traits { - typedef ci::msqueue::base_hook< ci::opt::gc > hook; - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - enum { padding = co::no_special_padding }; - }; - typedef ci::MoirQueue< cds::gc::HP, base_item_type, traits_MoirQueue_HP_base_noalign > MoirQueue_HP_base_noalign; - - // HP member hook + no padding - struct traits_MoirQueue_HP_member_noalign : public ci::msqueue::traits { - typedef ci::msqueue::member_hook < - offsetof( member_item_type, hMember ), - ci::opt::gc < cds::gc::HP > - > hook; - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - enum { padding = co::no_special_padding }; - }; - typedef ci::MoirQueue< cds::gc::HP, member_item_type, traits_MoirQueue_HP_member_noalign > MoirQueue_HP_member_noalign; - - - // HP base hook + cache padding - struct traits_MoirQueue_HP_base_cachealign : public traits_MoirQueue_HP_base_noalign - { - enum { padding = co::cache_line_padding }; - }; - typedef ci::MoirQueue< cds::gc::HP, base_item_type, traits_MoirQueue_HP_base_cachealign > MoirQueue_HP_base_cachealign; - - // HP member hook + cache padding - struct traits_MoirQueue_HP_member_cachealign : public traits_MoirQueue_HP_member_noalign - { - enum { padding = co::cache_line_padding }; - }; - typedef ci::MoirQueue< cds::gc::HP, member_item_type, traits_MoirQueue_HP_member_cachealign > MoirQueue_HP_member_cachealign; - } - - TEST(MoirQueue_HP_default) - TEST(MoirQueue_HP_default_ic) - TEST(MoirQueue_HP_default_stat) - TEST(MoirQueue_HP_base) - TEST(MoirQueue_HP_member) - TEST(MoirQueue_HP_base_ic) - TEST(MoirQueue_HP_member_ic) - TEST(MoirQueue_HP_base_stat) - TEST(MoirQueue_HP_member_stat) - TEST(MoirQueue_HP_base_align) - TEST(MoirQueue_HP_member_align) - TEST(MoirQueue_HP_base_noalign) - TEST(MoirQueue_HP_member_noalign) - TEST(MoirQueue_HP_base_cachealign) - TEST(MoirQueue_HP_member_cachealign) -} diff --git a/tests/test-hdr/queue/hdr_intrusive_msqueue.h b/tests/test-hdr/queue/hdr_intrusive_msqueue.h deleted file mode 100644 index 24b4a980..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_msqueue.h +++ /dev/null @@ -1,551 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef CDSTEST_HDR_INTRSUSIVE_MSQUEUE_H -#define CDSTEST_HDR_INTRSUSIVE_MSQUEUE_H - -#include "cppunit/cppunit_proxy.h" -#include - -namespace queue { - namespace ci = cds::intrusive; - namespace co = cds::opt; - - class IntrusiveQueueHeaderTest: public CppUnitMini::TestCase - { - public: - - template - struct base_hook_item : public Base - { - int nVal; - int nDisposeCount; - - base_hook_item() - : nDisposeCount( 0 ) - {} - }; - - template - struct member_hook_item - { - int nVal; - int nDisposeCount; - Member hMember; - - member_hook_item() - : nDisposeCount( 0 ) - {} - }; - - struct faked_disposer - { - template - void operator ()( T * p ) - { - ++p->nDisposeCount; - } - }; - - - // Test for MSQueue and derivatives - template - void test() - { - typedef typename Queue::value_type value_type; - value_type v1, v2, v3; - - { - Queue q; - CPPUNIT_ASSERT( q.empty() ); - - v1.nVal = 1; - v2.nVal = 2; - v3.nVal = 3; - CPPUNIT_ASSERT( q.push(v1)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v2)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v3)); - CPPUNIT_ASSERT( !q.empty() ); - - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - value_type * pv; - pv = q.pop(); - Queue::gc::scan(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 1 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - pv = q.pop(); - Queue::gc::scan(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 2 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 1 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - pv = q.pop(); - Queue::gc::scan(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 3 ); - CPPUNIT_ASSERT( q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 1 ); - CPPUNIT_CHECK( v2.nDisposeCount == 1 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - pv = q.pop(); - CPPUNIT_ASSERT( pv == nullptr ); - CPPUNIT_CHECK( v1.nDisposeCount == 1 ); - CPPUNIT_CHECK( v2.nDisposeCount == 1 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - } - - Queue::gc::scan(); - CPPUNIT_CHECK( v1.nDisposeCount == 1 ); - CPPUNIT_CHECK( v2.nDisposeCount == 1 ); - CPPUNIT_CHECK( v3.nDisposeCount == 1 ); - } - - // Test for BasketQueue and derivatives - template - void test_basket() - { - typedef typename Queue::value_type value_type; - value_type v1, v2, v3, v4; - - { - Queue q; - CPPUNIT_ASSERT( q.empty() ); - - v1.nVal = 1; - v2.nVal = 2; - v3.nVal = 3; - v4.nVal = 4; - CPPUNIT_ASSERT( q.push(v1)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v2)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v3)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v4)); - CPPUNIT_ASSERT( !q.empty() ); - - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - CPPUNIT_CHECK( v4.nDisposeCount == 0 ); - - value_type * pv; - pv = q.pop(); - Queue::gc::scan(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 1 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - CPPUNIT_CHECK( v4.nDisposeCount == 0 ); - - pv = q.pop(); - Queue::gc::scan(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 2 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - CPPUNIT_CHECK( v4.nDisposeCount == 0 ); - - pv = q.pop(); - Queue::gc::scan(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 3 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - CPPUNIT_CHECK( v4.nDisposeCount == 0 ); - - pv = q.pop(); - Queue::gc::scan(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 4 ); - CPPUNIT_ASSERT( q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 1 ); - CPPUNIT_CHECK( v2.nDisposeCount == 1 ); - CPPUNIT_CHECK( v3.nDisposeCount == 1 ); - CPPUNIT_CHECK( v4.nDisposeCount == 0 ); - - pv = q.pop(); - Queue::gc::scan(); - CPPUNIT_CHECK( pv == nullptr ); - CPPUNIT_CHECK( v1.nDisposeCount == 1 ); - CPPUNIT_CHECK( v2.nDisposeCount == 1 ); - CPPUNIT_CHECK( v3.nDisposeCount == 1 ); - CPPUNIT_CHECK( v4.nDisposeCount == 0 ); - } - - Queue::gc::scan(); - CPPUNIT_CHECK( v1.nDisposeCount == 1 ); - CPPUNIT_CHECK( v2.nDisposeCount == 1 ); - CPPUNIT_CHECK( v3.nDisposeCount == 1 ); - CPPUNIT_CHECK( v4.nDisposeCount == 1 ); - } - - // Test for a queue in what dequeued item should be manually disposed - template - void test2() - { - typedef typename Queue::value_type value_type; - value_type v1, v2, v3; - Queue q; - CPPUNIT_ASSERT( q.empty() ); - - v1.nVal = 1; - v2.nVal = 2; - v3.nVal = 3; - CPPUNIT_ASSERT( q.push(v1)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v2)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v3)); - CPPUNIT_ASSERT( !q.empty() ); - - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - value_type * pv; - pv = q.pop(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 1 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - pv = q.pop(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 2 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - pv = q.pop(); - CPPUNIT_ASSERT( pv != nullptr ); - CPPUNIT_ASSERT( pv->nVal == 3 ); - CPPUNIT_ASSERT( q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - pv = q.pop(); - CPPUNIT_ASSERT( pv == nullptr ); - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - - CPPUNIT_ASSERT( q.push(v1)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v2)); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push(v3)); - CPPUNIT_ASSERT( !q.empty() ); - - CPPUNIT_CHECK( v1.nDisposeCount == 0 ); - CPPUNIT_CHECK( v2.nDisposeCount == 0 ); - CPPUNIT_CHECK( v3.nDisposeCount == 0 ); - q.clear(); - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_CHECK( v1.nDisposeCount == 1 ); - CPPUNIT_CHECK( v2.nDisposeCount == 1 ); - CPPUNIT_CHECK( v3.nDisposeCount == 1 ); - } - - - void test_MSQueue_HP_default(); - void test_MSQueue_HP_default_ic(); - void test_MSQueue_HP_default_stat(); - void test_MSQueue_HP_base(); - void test_MSQueue_HP_member(); - void test_MSQueue_HP_base_ic(); - void test_MSQueue_HP_member_ic(); - void test_MSQueue_HP_base_stat(); - void test_MSQueue_HP_member_stat(); - void test_MSQueue_HP_base_align(); - void test_MSQueue_HP_member_align(); - void test_MSQueue_HP_base_noalign(); - void test_MSQueue_HP_member_noalign(); - void test_MSQueue_HP_base_cachealign(); - void test_MSQueue_HP_member_cachealign(); - void test_MSQueue_DHP_base(); - void test_MSQueue_DHP_member(); - void test_MSQueue_DHP_base_ic(); - void test_MSQueue_DHP_member_ic(); - void test_MSQueue_DHP_base_stat(); - void test_MSQueue_DHP_member_stat(); - void test_MSQueue_DHP_base_align(); - void test_MSQueue_DHP_member_align(); - void test_MSQueue_DHP_base_noalign(); - void test_MSQueue_DHP_member_noalign(); - void test_MSQueue_DHP_base_cachealign(); - void test_MSQueue_DHP_member_cachealign(); - - void test_MoirQueue_HP_default(); - void test_MoirQueue_HP_default_ic(); - void test_MoirQueue_HP_default_stat(); - void test_MoirQueue_HP_base(); - void test_MoirQueue_HP_member(); - void test_MoirQueue_HP_base_ic(); - void test_MoirQueue_HP_member_ic(); - void test_MoirQueue_HP_base_stat(); - void test_MoirQueue_HP_member_stat(); - void test_MoirQueue_HP_base_align(); - void test_MoirQueue_HP_member_align(); - void test_MoirQueue_HP_base_noalign(); - void test_MoirQueue_HP_member_noalign(); - void test_MoirQueue_HP_base_cachealign(); - void test_MoirQueue_HP_member_cachealign(); - void test_MoirQueue_DHP_base(); - void test_MoirQueue_DHP_member(); - void test_MoirQueue_DHP_base_ic(); - void test_MoirQueue_DHP_member_ic(); - void test_MoirQueue_DHP_base_stat(); - void test_MoirQueue_DHP_member_stat(); - void test_MoirQueue_DHP_base_align(); - void test_MoirQueue_DHP_member_align(); - void test_MoirQueue_DHP_base_noalign(); - void test_MoirQueue_DHP_member_noalign(); - void test_MoirQueue_DHP_base_cachealign(); - void test_MoirQueue_DHP_member_cachealign(); - - void test_OptimisticQueue_HP_default(); - void test_OptimisticQueue_HP_default_ic(); - void test_OptimisticQueue_HP_default_stat(); - void test_OptimisticQueue_HP_base(); - void test_OptimisticQueue_HP_member(); - void test_OptimisticQueue_HP_base_ic(); - void test_OptimisticQueue_HP_member_ic(); - void test_OptimisticQueue_HP_base_stat(); - void test_OptimisticQueue_HP_member_stat(); - void test_OptimisticQueue_HP_base_align(); - void test_OptimisticQueue_HP_member_align(); - void test_OptimisticQueue_HP_base_noalign(); - void test_OptimisticQueue_HP_member_noalign(); - void test_OptimisticQueue_HP_base_cachealign(); - void test_OptimisticQueue_HP_member_cachealign(); - void test_OptimisticQueue_DHP_base(); - void test_OptimisticQueue_DHP_member(); - void test_OptimisticQueue_DHP_base_ic(); - void test_OptimisticQueue_DHP_member_ic(); - void test_OptimisticQueue_DHP_base_stat(); - void test_OptimisticQueue_DHP_member_stat(); - void test_OptimisticQueue_DHP_base_align(); - void test_OptimisticQueue_DHP_member_align(); - void test_OptimisticQueue_DHP_base_noalign(); - void test_OptimisticQueue_DHP_member_noalign(); - void test_OptimisticQueue_DHP_base_cachealign(); - void test_OptimisticQueue_DHP_member_cachealign(); - - void test_BasketQueue_HP_default(); - void test_BasketQueue_HP_default_ic(); - void test_BasketQueue_HP_default_stat(); - void test_BasketQueue_HP_base(); - void test_BasketQueue_HP_member(); - void test_BasketQueue_HP_base_ic(); - void test_BasketQueue_HP_member_ic(); - void test_BasketQueue_HP_base_stat(); - void test_BasketQueue_HP_member_stat(); - void test_BasketQueue_HP_base_align(); - void test_BasketQueue_HP_member_align(); - void test_BasketQueue_HP_base_noalign(); - void test_BasketQueue_HP_member_noalign(); - void test_BasketQueue_HP_base_cachealign(); - void test_BasketQueue_HP_member_cachealign(); - void test_BasketQueue_DHP_base(); - void test_BasketQueue_DHP_member(); - void test_BasketQueue_DHP_base_ic(); - void test_BasketQueue_DHP_member_ic(); - void test_BasketQueue_DHP_base_stat(); - void test_BasketQueue_DHP_member_stat(); - void test_BasketQueue_DHP_base_align(); - void test_BasketQueue_DHP_member_align(); - void test_BasketQueue_DHP_base_noalign(); - void test_BasketQueue_DHP_member_noalign(); - void test_BasketQueue_DHP_base_cachealign(); - void test_BasketQueue_DHP_member_cachealign(); - - void test_TsigasCycleQueue_static(); - void test_TsigasCycleQueue_static_ic(); - void test_TsigasCycleQueue_dyn(); - void test_TsigasCycleQueue_dyn_ic(); - - void test_VyukovMPMCCycleQueue_static(); - void test_VyukovMPMCCycleQueue_static_ic(); - void test_VyukovMPMCCycleQueue_dyn(); - void test_VyukovMPMCCycleQueue_dyn_ic(); - - CPPUNIT_TEST_SUITE(IntrusiveQueueHeaderTest) - CPPUNIT_TEST(test_MSQueue_HP_default) - CPPUNIT_TEST(test_MSQueue_HP_default_ic) - CPPUNIT_TEST(test_MSQueue_HP_default_stat) - CPPUNIT_TEST(test_MSQueue_HP_base) - CPPUNIT_TEST(test_MSQueue_HP_member) - CPPUNIT_TEST(test_MSQueue_HP_base_ic) - CPPUNIT_TEST(test_MSQueue_HP_member_ic) - CPPUNIT_TEST(test_MSQueue_HP_base_stat) - CPPUNIT_TEST(test_MSQueue_HP_member_stat) - CPPUNIT_TEST(test_MSQueue_HP_base_align) - CPPUNIT_TEST(test_MSQueue_HP_member_align) - CPPUNIT_TEST(test_MSQueue_HP_base_noalign) - CPPUNIT_TEST(test_MSQueue_HP_member_noalign) - CPPUNIT_TEST(test_MSQueue_HP_base_cachealign) - CPPUNIT_TEST(test_MSQueue_HP_member_cachealign) - CPPUNIT_TEST(test_MSQueue_DHP_base) - CPPUNIT_TEST(test_MSQueue_DHP_member) - CPPUNIT_TEST(test_MSQueue_DHP_base_ic) - CPPUNIT_TEST(test_MSQueue_DHP_member_ic) - CPPUNIT_TEST(test_MSQueue_DHP_base_stat) - CPPUNIT_TEST(test_MSQueue_DHP_member_stat) - CPPUNIT_TEST(test_MSQueue_DHP_base_align) - CPPUNIT_TEST(test_MSQueue_DHP_member_align) - CPPUNIT_TEST(test_MSQueue_DHP_base_noalign) - CPPUNIT_TEST(test_MSQueue_DHP_member_noalign) - CPPUNIT_TEST(test_MSQueue_DHP_base_cachealign) - CPPUNIT_TEST(test_MSQueue_DHP_member_cachealign) - - CPPUNIT_TEST(test_MoirQueue_HP_default) - CPPUNIT_TEST(test_MoirQueue_HP_default_ic) - CPPUNIT_TEST(test_MoirQueue_HP_default_stat) - CPPUNIT_TEST(test_MoirQueue_HP_base) - CPPUNIT_TEST(test_MoirQueue_HP_member) - CPPUNIT_TEST(test_MoirQueue_HP_base_ic) - CPPUNIT_TEST(test_MoirQueue_HP_member_ic) - CPPUNIT_TEST(test_MoirQueue_HP_base_stat) - CPPUNIT_TEST(test_MoirQueue_HP_member_stat) - CPPUNIT_TEST(test_MoirQueue_HP_base_align) - CPPUNIT_TEST(test_MoirQueue_HP_member_align) - CPPUNIT_TEST(test_MoirQueue_HP_base_noalign) - CPPUNIT_TEST(test_MoirQueue_HP_member_noalign) - CPPUNIT_TEST(test_MoirQueue_HP_base_cachealign) - CPPUNIT_TEST(test_MoirQueue_HP_member_cachealign) - CPPUNIT_TEST(test_MoirQueue_DHP_base) - CPPUNIT_TEST(test_MoirQueue_DHP_member) - CPPUNIT_TEST(test_MoirQueue_DHP_base_ic) - CPPUNIT_TEST(test_MoirQueue_DHP_member_ic) - CPPUNIT_TEST(test_MoirQueue_DHP_base_stat) - CPPUNIT_TEST(test_MoirQueue_DHP_member_stat) - CPPUNIT_TEST(test_MoirQueue_DHP_base_align) - CPPUNIT_TEST(test_MoirQueue_DHP_member_align) - CPPUNIT_TEST(test_MoirQueue_DHP_base_noalign) - CPPUNIT_TEST(test_MoirQueue_DHP_member_noalign) - CPPUNIT_TEST(test_MoirQueue_DHP_base_cachealign) - CPPUNIT_TEST(test_MoirQueue_DHP_member_cachealign) - - CPPUNIT_TEST(test_OptimisticQueue_HP_default) - CPPUNIT_TEST(test_OptimisticQueue_HP_default_ic) - CPPUNIT_TEST(test_OptimisticQueue_HP_default_stat) - CPPUNIT_TEST(test_OptimisticQueue_HP_base) - CPPUNIT_TEST(test_OptimisticQueue_HP_member) - CPPUNIT_TEST(test_OptimisticQueue_HP_base_ic) - CPPUNIT_TEST(test_OptimisticQueue_HP_member_ic) - CPPUNIT_TEST(test_OptimisticQueue_HP_base_stat) - CPPUNIT_TEST(test_OptimisticQueue_HP_member_stat) - CPPUNIT_TEST(test_OptimisticQueue_HP_base_align) - CPPUNIT_TEST(test_OptimisticQueue_HP_member_align) - CPPUNIT_TEST(test_OptimisticQueue_HP_base_noalign) - CPPUNIT_TEST(test_OptimisticQueue_HP_member_noalign) - CPPUNIT_TEST(test_OptimisticQueue_HP_base_cachealign) - CPPUNIT_TEST(test_OptimisticQueue_HP_member_cachealign) - CPPUNIT_TEST(test_OptimisticQueue_DHP_base) - CPPUNIT_TEST(test_OptimisticQueue_DHP_member) - CPPUNIT_TEST(test_OptimisticQueue_DHP_base_ic) - CPPUNIT_TEST(test_OptimisticQueue_DHP_member_ic) - CPPUNIT_TEST(test_OptimisticQueue_DHP_base_stat) - CPPUNIT_TEST(test_OptimisticQueue_DHP_member_stat) - CPPUNIT_TEST(test_OptimisticQueue_DHP_base_align) - CPPUNIT_TEST(test_OptimisticQueue_DHP_member_align) - CPPUNIT_TEST(test_OptimisticQueue_DHP_base_noalign) - CPPUNIT_TEST(test_OptimisticQueue_DHP_member_noalign) - CPPUNIT_TEST(test_OptimisticQueue_DHP_base_cachealign) - CPPUNIT_TEST(test_OptimisticQueue_DHP_member_cachealign) - - CPPUNIT_TEST(test_BasketQueue_HP_default) - CPPUNIT_TEST(test_BasketQueue_HP_default_ic) - CPPUNIT_TEST(test_BasketQueue_HP_default_stat) - CPPUNIT_TEST(test_BasketQueue_HP_base) - CPPUNIT_TEST(test_BasketQueue_HP_member) - CPPUNIT_TEST(test_BasketQueue_HP_base_ic) - CPPUNIT_TEST(test_BasketQueue_HP_member_ic) - CPPUNIT_TEST(test_BasketQueue_HP_base_stat) - CPPUNIT_TEST(test_BasketQueue_HP_member_stat) - CPPUNIT_TEST(test_BasketQueue_HP_base_align) - CPPUNIT_TEST(test_BasketQueue_HP_member_align) - CPPUNIT_TEST(test_BasketQueue_HP_base_noalign) - CPPUNIT_TEST(test_BasketQueue_HP_member_noalign) - CPPUNIT_TEST(test_BasketQueue_HP_base_cachealign) - CPPUNIT_TEST(test_BasketQueue_HP_member_cachealign) - CPPUNIT_TEST(test_BasketQueue_DHP_base) - CPPUNIT_TEST(test_BasketQueue_DHP_member) - CPPUNIT_TEST(test_BasketQueue_DHP_base_ic) - CPPUNIT_TEST(test_BasketQueue_DHP_member_ic) - CPPUNIT_TEST(test_BasketQueue_DHP_base_stat) - CPPUNIT_TEST(test_BasketQueue_DHP_member_stat) - CPPUNIT_TEST(test_BasketQueue_DHP_base_align) - CPPUNIT_TEST(test_BasketQueue_DHP_member_align) - CPPUNIT_TEST(test_BasketQueue_DHP_base_noalign) - CPPUNIT_TEST(test_BasketQueue_DHP_member_noalign) - CPPUNIT_TEST(test_BasketQueue_DHP_base_cachealign) - CPPUNIT_TEST(test_BasketQueue_DHP_member_cachealign) - - CPPUNIT_TEST(test_TsigasCycleQueue_static) - CPPUNIT_TEST(test_TsigasCycleQueue_static_ic) - CPPUNIT_TEST(test_TsigasCycleQueue_dyn) - CPPUNIT_TEST(test_TsigasCycleQueue_dyn_ic) - - CPPUNIT_TEST(test_VyukovMPMCCycleQueue_static); - CPPUNIT_TEST(test_VyukovMPMCCycleQueue_static_ic); - CPPUNIT_TEST(test_VyukovMPMCCycleQueue_dyn); - CPPUNIT_TEST(test_VyukovMPMCCycleQueue_dyn_ic); - - CPPUNIT_TEST_SUITE_END() - }; -} // namespace queue - -#endif // #ifndef CDSTEST_HDR_INTRSUSIVE_MSQUEUE_H diff --git a/tests/test-hdr/queue/hdr_intrusive_msqueue_dhp.cpp b/tests/test-hdr/queue/hdr_intrusive_msqueue_dhp.cpp deleted file mode 100644 index 748e078e..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_msqueue_dhp.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" -#include -#include - -namespace queue { - -#define TEST(X) void IntrusiveQueueHeaderTest::test_##X() { test(); } - - namespace { - typedef IntrusiveQueueHeaderTest::base_hook_item< ci::msqueue::node > base_item_type; - typedef IntrusiveQueueHeaderTest::member_hook_item< ci::msqueue::node > member_item_type; - - // DHP base hook - typedef ci::MSQueue< cds::gc::DHP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MSQueue_DHP_base; - - // DHP member hook - typedef ci::MSQueue< cds::gc::DHP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MSQueue_DHP_member; - - /// DHP base hook + item counter - typedef ci::MSQueue< cds::gc::DHP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - , co::item_counter< cds::atomicity::item_counter > - , co::memory_model< co::v::relaxed_ordering > - >::type - > MSQueue_DHP_base_ic; - - // DHP member hook + item counter - typedef ci::MSQueue< cds::gc::DHP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , co::item_counter< cds::atomicity::item_counter > - >::type - > MSQueue_DHP_member_ic; - - // DHP base hook + stat - typedef ci::MSQueue< cds::gc::DHP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , co::stat< ci::msqueue::stat<> > - >::type - > MSQueue_DHP_base_stat; - - // DHP member hook + stat - typedef ci::MSQueue< cds::gc::DHP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , co::stat< ci::msqueue::stat<> > - >::type - > MSQueue_DHP_member_stat; - - // DHP base hook + padding - typedef ci::MSQueue< cds::gc::DHP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - , co::padding< 32 > - >::type - > MSQueue_DHP_base_align; - - // DHP member hook + padding - typedef ci::MSQueue< cds::gc::DHP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - , co::padding< 32 > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MSQueue_DHP_member_align; - - // DHP base hook + no padding - struct traits_MSQueue_DHP_base_noalign : public ci::msqueue::traits { - typedef ci::msqueue::base_hook< ci::opt::gc > hook; - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - enum { padding = co::no_special_padding }; - }; - typedef ci::MSQueue< cds::gc::DHP, base_item_type, traits_MSQueue_DHP_base_noalign > MSQueue_DHP_base_noalign; - - // DHP member hook + no padding - struct traits_MSQueue_DHP_member_noalign : public ci::msqueue::traits { - typedef ci::msqueue::member_hook < - offsetof( member_item_type, hMember ), - ci::opt::gc < cds::gc::DHP > - > hook; - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - enum { padding = co::no_special_padding }; - }; - typedef ci::MSQueue< cds::gc::DHP, member_item_type, traits_MSQueue_DHP_member_noalign > MSQueue_DHP_member_noalign; - - - // DHP base hook + cache padding - struct traits_MSQueue_DHP_base_cachealign : public traits_MSQueue_DHP_base_noalign - { - enum { padding = co::cache_line_padding }; - }; - typedef ci::MSQueue< cds::gc::DHP, base_item_type, traits_MSQueue_DHP_base_cachealign > MSQueue_DHP_base_cachealign; - - // DHP member hook + cache padding - struct traits_MSQueue_DHP_member_cachealign : public traits_MSQueue_DHP_member_noalign - { - enum { padding = co::cache_line_padding }; - }; - typedef ci::MSQueue< cds::gc::DHP, member_item_type, traits_MSQueue_DHP_member_cachealign > MSQueue_DHP_member_cachealign; - } // namespace - - TEST(MSQueue_DHP_base) - TEST(MSQueue_DHP_member) - TEST(MSQueue_DHP_base_ic) - TEST(MSQueue_DHP_member_ic) - TEST(MSQueue_DHP_base_stat) - TEST(MSQueue_DHP_member_stat) - TEST(MSQueue_DHP_base_align) - TEST(MSQueue_DHP_member_align) - TEST(MSQueue_DHP_base_noalign) - TEST(MSQueue_DHP_member_noalign) - TEST(MSQueue_DHP_base_cachealign) - TEST(MSQueue_DHP_member_cachealign) - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_intrusive_msqueue_hp.cpp b/tests/test-hdr/queue/hdr_intrusive_msqueue_hp.cpp deleted file mode 100644 index fa11fa48..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_msqueue_hp.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" - -#include -#include - -namespace queue { - -#define TEST(X) void IntrusiveQueueHeaderTest::test_##X() { test(); } - - namespace { - typedef IntrusiveQueueHeaderTest::base_hook_item< ci::msqueue::node > base_item_type; - typedef IntrusiveQueueHeaderTest::member_hook_item< ci::msqueue::node > member_item_type; - - typedef ci::MSQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MSQueue_HP_default; - - /// HP + item counter - typedef ci::MSQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - ,co::memory_model< co::v::sequential_consistent > - >::type - > MSQueue_HP_default_ic; - - /// HP + stat - typedef ci::MSQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::msqueue::stat<> > - >::type - > MSQueue_HP_default_stat; - - // HP base hook - typedef ci::MSQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MSQueue_HP_base; - - // HP member hook - typedef ci::MSQueue< cds::gc::HP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MSQueue_HP_member; - - /// HP base hook + item counter - typedef ci::MSQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - ,co::item_counter< cds::atomicity::item_counter > - ,co::memory_model< co::v::relaxed_ordering > - >::type - > MSQueue_HP_base_ic; - - // HP member hook + item counter - typedef ci::MSQueue< cds::gc::HP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > MSQueue_HP_member_ic; - - // HP base hook + stat - typedef ci::MSQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::msqueue::stat<> > - >::type - > MSQueue_HP_base_stat; - - // HP member hook + stat - typedef ci::MSQueue< cds::gc::HP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::msqueue::stat<> > - >::type - > MSQueue_HP_member_stat; - - // HP base hook + padding - typedef ci::MSQueue< cds::gc::HP, base_item_type, - typename ci::msqueue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::msqueue::base_hook< ci::opt::gc > - > - ,co::padding< 32 > - >::type - > MSQueue_HP_base_align; - - // HP member hook + padding - typedef ci::MSQueue< cds::gc::HP, member_item_type, - typename ci::msqueue::make_traits< - ci::opt::hook< - ci::msqueue::member_hook< - offsetof( member_item_type, hMember ), - ci::opt::gc - > - > - ,co::padding< 32 > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > MSQueue_HP_member_align; - - // HP base hook + no padding - struct traits_MSQueue_HP_base_noalign : public ci::msqueue::traits { - typedef ci::msqueue::base_hook< ci::opt::gc > hook; - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - enum { padding = co::no_special_padding }; - }; - typedef ci::MSQueue< cds::gc::HP, base_item_type, traits_MSQueue_HP_base_noalign > MSQueue_HP_base_noalign; - - // HP member hook + no padding - struct traits_MSQueue_HP_member_noalign : public ci::msqueue::traits { - typedef ci::msqueue::member_hook < - offsetof( member_item_type, hMember ), - ci::opt::gc < cds::gc::HP > - > hook; - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - enum { padding = co::no_special_padding }; - }; - typedef ci::MSQueue< cds::gc::HP, member_item_type, traits_MSQueue_HP_member_noalign > MSQueue_HP_member_noalign; - - - // HP base hook + cache padding - struct traits_MSQueue_HP_base_cachealign : public traits_MSQueue_HP_base_noalign - { - enum { padding = co::cache_line_padding }; - }; - typedef ci::MSQueue< cds::gc::HP, base_item_type, traits_MSQueue_HP_base_cachealign > MSQueue_HP_base_cachealign; - - // HP member hook + cache padding - struct traits_MSQueue_HP_member_cachealign : public traits_MSQueue_HP_member_noalign - { - enum { padding = co::cache_line_padding }; - }; - typedef ci::MSQueue< cds::gc::HP, member_item_type, traits_MSQueue_HP_member_cachealign > MSQueue_HP_member_cachealign; - - } - - TEST(MSQueue_HP_default) - TEST(MSQueue_HP_default_ic) - TEST(MSQueue_HP_default_stat) - TEST(MSQueue_HP_base) - TEST(MSQueue_HP_member) - TEST(MSQueue_HP_base_ic) - TEST(MSQueue_HP_member_ic) - TEST(MSQueue_HP_base_stat) - TEST(MSQueue_HP_member_stat) - TEST(MSQueue_HP_base_align) - TEST(MSQueue_HP_member_align) - TEST(MSQueue_HP_base_noalign) - TEST(MSQueue_HP_member_noalign) - TEST(MSQueue_HP_base_cachealign) - TEST(MSQueue_HP_member_cachealign) -} - diff --git a/tests/test-hdr/queue/hdr_intrusive_optimisticqueue_dhp.cpp b/tests/test-hdr/queue/hdr_intrusive_optimisticqueue_dhp.cpp deleted file mode 100644 index d62e6834..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_optimisticqueue_dhp.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" -#include -#include - -namespace queue { - -#define TEST(X) void IntrusiveQueueHeaderTest::test_##X() { test(); } - - namespace { - struct base_hook_item: public ci::optimistic_queue::node< cds::gc::DHP > - { - int nVal; - int nDisposeCount; - - base_hook_item() - : nDisposeCount(0) - {} - }; - - struct member_hook_item - { - int nVal; - int nDisposeCount; - ci::optimistic_queue::node< cds::gc::DHP > hMember; - - member_hook_item() - : nDisposeCount(0) - {} - }; - - // DHP base hook - typedef ci::OptimisticQueue< cds::gc::DHP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::memory_model< co::v::relaxed_ordering > - >::type - > OptimisticQueue_DHP_base; - - // DHP member hook - struct traits_OptimisticQueue_DHP_member : public OptimisticQueue_DHP_base::traits - { - typedef ci::optimistic_queue::member_hook < - offsetof( member_hook_item, hMember ), - ci::opt::gc < cds::gc::DHP > - > hook; - }; - typedef ci::OptimisticQueue< cds::gc::DHP, member_hook_item, traits_OptimisticQueue_DHP_member > OptimisticQueue_DHP_member; - - /// DHP base hook + item counter - typedef ci::OptimisticQueue< cds::gc::DHP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > OptimisticQueue_DHP_base_ic; - - // DHP member hook + item counter - typedef ci::OptimisticQueue< cds::gc::DHP, member_hook_item, - typename ci::optimistic_queue::make_traits< - cds::opt::type_traits< traits_OptimisticQueue_DHP_member > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > OptimisticQueue_DHP_member_ic; - - // DHP base hook + stat - typedef ci::OptimisticQueue< cds::gc::DHP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::optimistic_queue::stat<> > - >::type - > OptimisticQueue_DHP_base_stat; - - // DHP member hook + stat - typedef ci::OptimisticQueue< cds::gc::DHP, member_hook_item, - typename ci::optimistic_queue::make_traits< - cds::opt::type_traits< OptimisticQueue_DHP_base_stat::traits > - , ci::opt::hook< - ci::optimistic_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - >::type - > OptimisticQueue_DHP_member_stat; - - // DHP base hook + padding - typedef ci::OptimisticQueue< cds::gc::DHP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,co::padding< 32 > - >::type - > OptimisticQueue_DHP_base_align; - - // DHP member hook + padding - typedef ci::OptimisticQueue< cds::gc::DHP, member_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< 32 > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > OptimisticQueue_DHP_member_align; - - // DHP base hook + no padding - typedef ci::OptimisticQueue< cds::gc::DHP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::padding< co::no_special_padding > - >::type - > OptimisticQueue_DHP_base_noalign; - - // DHP member hook + no padding - typedef ci::OptimisticQueue< cds::gc::DHP, member_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::optimistic_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< co::no_special_padding > - >::type - > OptimisticQueue_DHP_member_noalign; - - - // DHP base hook + cache padding - typedef ci::OptimisticQueue< cds::gc::DHP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,co::padding< co::cache_line_padding > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > OptimisticQueue_DHP_base_cachealign; - - // DHP member hook + cache padding - typedef ci::OptimisticQueue< cds::gc::DHP, member_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< co::cache_line_padding > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > OptimisticQueue_DHP_member_cachealign; - } - - TEST(OptimisticQueue_DHP_base) - TEST(OptimisticQueue_DHP_member) - TEST(OptimisticQueue_DHP_base_ic) - TEST(OptimisticQueue_DHP_member_ic) - TEST(OptimisticQueue_DHP_base_stat) - TEST(OptimisticQueue_DHP_member_stat) - TEST(OptimisticQueue_DHP_base_align) - TEST(OptimisticQueue_DHP_member_align) - TEST(OptimisticQueue_DHP_base_noalign) - TEST(OptimisticQueue_DHP_member_noalign) - TEST(OptimisticQueue_DHP_base_cachealign) - TEST(OptimisticQueue_DHP_member_cachealign) -} diff --git a/tests/test-hdr/queue/hdr_intrusive_optimisticqueue_hp.cpp b/tests/test-hdr/queue/hdr_intrusive_optimisticqueue_hp.cpp deleted file mode 100644 index fc18065d..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_optimisticqueue_hp.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" -#include -#include - -namespace queue { - -#define TEST(X) void IntrusiveQueueHeaderTest::test_##X() { test(); } - - namespace { - struct base_hook_item: public ci::optimistic_queue::node< cds::gc::HP > - { - int nVal; - int nDisposeCount; - - base_hook_item() - : nDisposeCount(0) - {} - }; - - struct member_hook_item - { - int nVal; - int nDisposeCount; - ci::optimistic_queue::node< cds::gc::HP > hMember; - - member_hook_item() - : nDisposeCount(0) - {} - }; - - struct traits_OptimisticQueue_HP_default : public ci::optimistic_queue::traits - { - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - }; - typedef ci::OptimisticQueue< cds::gc::HP, base_hook_item, traits_OptimisticQueue_HP_default > OptimisticQueue_HP_default; - - /// HP + item counter - struct traits_OptimisticQueue_HP_default_ic : public traits_OptimisticQueue_HP_default - { - typedef cds::atomicity::item_counter item_counter; - }; - typedef ci::OptimisticQueue< cds::gc::HP, base_hook_item, traits_OptimisticQueue_HP_default_ic > OptimisticQueue_HP_default_ic; - - /// HP + stat - struct traits_OptimisticQueue_HP_default_stat : public - ci::optimistic_queue::make_traits < - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , co::stat< ci::optimistic_queue::stat<> > - , co::memory_model< co::v::sequential_consistent > - > ::type - {}; - typedef ci::OptimisticQueue< cds::gc::HP, base_hook_item, traits_OptimisticQueue_HP_default_stat > OptimisticQueue_HP_default_stat; - - // HP base hook - typedef ci::OptimisticQueue< cds::gc::HP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::memory_model< co::v::relaxed_ordering > - >::type - > OptimisticQueue_HP_base; - - // HP member hook - struct traits_OptimisticQueue_HP_member : public OptimisticQueue_HP_base::traits - { - typedef ci::optimistic_queue::member_hook < - offsetof( member_hook_item, hMember ), - ci::opt::gc < cds::gc::HP > - > hook; - }; - typedef ci::OptimisticQueue< cds::gc::HP, member_hook_item, traits_OptimisticQueue_HP_member > OptimisticQueue_HP_member; - - /// HP base hook + item counter - typedef ci::OptimisticQueue< cds::gc::HP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > OptimisticQueue_HP_base_ic; - - // HP member hook + item counter - typedef ci::OptimisticQueue< cds::gc::HP, member_hook_item, - typename ci::optimistic_queue::make_traits< - cds::opt::type_traits< traits_OptimisticQueue_HP_member > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > OptimisticQueue_HP_member_ic; - - // HP base hook + stat - typedef ci::OptimisticQueue< cds::gc::HP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::stat< ci::optimistic_queue::stat<> > - >::type - > OptimisticQueue_HP_base_stat; - - // HP member hook + stat - typedef ci::OptimisticQueue< cds::gc::HP, member_hook_item, - typename ci::optimistic_queue::make_traits< - cds::opt::type_traits< OptimisticQueue_HP_base_stat::traits > - , ci::opt::hook< - ci::optimistic_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - >::type - > OptimisticQueue_HP_member_stat; - - // HP base hook + padding - typedef ci::OptimisticQueue< cds::gc::HP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,co::padding< 32 > - >::type - > OptimisticQueue_HP_base_align; - - // HP member hook + padding - typedef ci::OptimisticQueue< cds::gc::HP, member_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< 32 > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > OptimisticQueue_HP_member_align; - - // HP base hook + no padding - typedef ci::OptimisticQueue< cds::gc::HP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::padding< co::no_special_padding > - >::type - > OptimisticQueue_HP_base_noalign; - - // HP member hook + no padding - typedef ci::OptimisticQueue< cds::gc::HP, member_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,ci::opt::hook< - ci::optimistic_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< co::no_special_padding > - >::type - > OptimisticQueue_HP_member_noalign; - - - // HP base hook + cache padding - typedef ci::OptimisticQueue< cds::gc::HP, base_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::base_hook< ci::opt::gc > - > - ,co::padding< co::cache_line_padding > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > OptimisticQueue_HP_base_cachealign; - - // HP member hook + cache padding - typedef ci::OptimisticQueue< cds::gc::HP, member_hook_item, - typename ci::optimistic_queue::make_traits< - ci::opt::hook< - ci::optimistic_queue::member_hook< - offsetof(member_hook_item, hMember), - ci::opt::gc - > - > - ,co::padding< co::cache_line_padding > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > OptimisticQueue_HP_member_cachealign; - } - - TEST(OptimisticQueue_HP_default) - TEST(OptimisticQueue_HP_default_ic) - TEST(OptimisticQueue_HP_default_stat) - TEST(OptimisticQueue_HP_base) - TEST(OptimisticQueue_HP_member) - TEST(OptimisticQueue_HP_base_ic) - TEST(OptimisticQueue_HP_member_ic) - TEST(OptimisticQueue_HP_base_stat) - TEST(OptimisticQueue_HP_member_stat) - TEST(OptimisticQueue_HP_base_align) - TEST(OptimisticQueue_HP_member_align) - TEST(OptimisticQueue_HP_base_noalign) - TEST(OptimisticQueue_HP_member_noalign) - TEST(OptimisticQueue_HP_base_cachealign) - TEST(OptimisticQueue_HP_member_cachealign) -} diff --git a/tests/test-hdr/queue/hdr_intrusive_segmented_queue.h b/tests/test-hdr/queue/hdr_intrusive_segmented_queue.h deleted file mode 100644 index ae6ffde0..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_segmented_queue.h +++ /dev/null @@ -1,296 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef CDSTEST_HDR_INTRUSIVE_SEGMENTED_QUEUE_H -#define CDSTEST_HDR_INTRUSIVE_SEGMENTED_QUEUE_H - -#include "cppunit/cppunit_proxy.h" -#include -#include "size_check.h" - -namespace queue { - - class HdrIntrusiveSegmentedQueue : public CppUnitMini::TestCase - { - struct item { - int nValue; - - size_t nDisposeCount; - size_t nDispose2Count; - - item() - : nValue( 0 ) - , nDisposeCount( 0 ) - , nDispose2Count( 0 ) - {} - - item( int nVal ) - : nValue( nVal ) - , nDisposeCount( 0 ) - , nDispose2Count( 0 ) - {} - }; - - struct big_item : public item - { - big_item() - {} - - big_item( int nVal ) - : item( nVal ) - {} - - int arr[80]; - }; - - struct Disposer - { - void operator()( item * p ) - { - ++p->nDisposeCount; - } - }; - - struct Disposer2 - { - void operator()( item * p ) - { - ++p->nDispose2Count; - } - }; - - template - void test() - { - for ( size_t nQuasiFactor = 2; nQuasiFactor <= 256; ++nQuasiFactor ) { - CPPUNIT_MSG( "QuasiFactor=" << nQuasiFactor << "..." ); - test_qf( nQuasiFactor ); - } - } - - template - void test_qf( size_t nQuasiFactor ) - { - typedef typename Queue::value_type value_type; - - static size_t const c_nItemCount = 1000; - value_type val[c_nItemCount]; - for ( int i = 0; i < static_cast(sizeof(val)/sizeof(val[0])); ++i ) - val[i].nValue = i; - - { - Queue q( nQuasiFactor ); - CPPUNIT_CHECK( q.quasi_factor() == cds::beans::ceil2(nQuasiFactor) ); - CPPUNIT_CHECK( misc::check_size( q, 0 )); - CPPUNIT_CHECK( q.empty() ); - - // push/enqueue - for ( size_t i = 0; i < sizeof(val)/sizeof(val[0]); ++i ) { - if ( i & 1 ) { - CPPUNIT_ASSERT( q.push( val[i] )); - } - else { - CPPUNIT_ASSERT( q.enqueue( val[i] )); - } - - CPPUNIT_CHECK( misc::check_size( q, i + 1 )); - } - CPPUNIT_CHECK( !q.empty() ); - - // pop/dequeue - size_t nCount = 0; - while ( !q.empty() ) { - value_type * pVal; - if ( nCount & 1 ) - pVal = q.pop(); - else - pVal = q.dequeue(); - - CPPUNIT_ASSERT( pVal != nullptr ); - - int nSegment = int( nCount / q.quasi_factor() ); - int nMin = nSegment * int(q.quasi_factor()); - int nMax = nMin + int(q.quasi_factor()) - 1; - CPPUNIT_CHECK_EX( nMin <= pVal->nValue && pVal->nValue <= nMax, nMin << " <= " << pVal->nValue << " <= " << nMax ); - - ++nCount; - CPPUNIT_CHECK( misc::check_size( q, sizeof(val)/sizeof(val[0]) - nCount )); - } - CPPUNIT_CHECK( nCount == sizeof(val)/sizeof(val[0]) ); - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_CHECK( misc::check_size( q, 0 )); - - // pop from empty queue - CPPUNIT_ASSERT( q.pop() == nullptr ); - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_CHECK( misc::check_size( q, 0 )); - - // check if Disposer has not been called - Queue::gc::force_dispose(); - for ( int i = 0; i < static_cast( sizeof(val)/sizeof(val[0]) ); ++i ) { - CPPUNIT_CHECK( val[i].nDisposeCount == 0 ); - CPPUNIT_CHECK( val[i].nDispose2Count == 0 ); - } - - // Manually dispose the items - for ( int i = 0; i < static_cast( sizeof(val)/sizeof(val[0])); ++i ) - Queue::gc::template retire( &(val[i]) ); - - // check if Disposer has been called - Queue::gc::force_dispose(); - for ( int i = 0; i < static_cast( sizeof(val)/sizeof(val[0])); ++i ) { - CPPUNIT_CHECK( val[i].nDisposeCount == 1 ); - CPPUNIT_CHECK( val[i].nDispose2Count == 0 ); - } - - - // clear - for ( int i = 0; i < static_cast( sizeof(val)/sizeof(val[0])); ++i ) - CPPUNIT_CHECK( q.push( val[i] ) ); - CPPUNIT_CHECK( misc::check_size( q, sizeof(val)/sizeof(val[0]) )); - CPPUNIT_CHECK( !q.empty() ); - - q.clear(); - CPPUNIT_CHECK( misc::check_size( q, 0)); - CPPUNIT_CHECK( q.empty() ); - - // check if Disposer has been called - Queue::gc::force_dispose(); - for ( int i = 0; i < static_cast( sizeof(val)/sizeof(val[0])); ++i ) { - CPPUNIT_CHECK( val[i].nDisposeCount == 2 ); - CPPUNIT_CHECK( val[i].nDispose2Count == 0 ); - } - - // clear_with - for ( int i = 0; i < static_cast( sizeof(val)/sizeof(val[0])); ++i ) - CPPUNIT_CHECK( q.push( val[i] ) ); - CPPUNIT_CHECK( misc::check_size( q, sizeof(val)/sizeof(val[0]) )); - CPPUNIT_CHECK( !q.empty() ); - - q.clear_with( Disposer2() ); - CPPUNIT_CHECK( misc::check_size( q, 0)); - CPPUNIT_CHECK( q.empty() ); - - // check if Disposer has been called - Queue::gc::force_dispose(); - for ( int i = 0; i < static_cast( sizeof(val)/sizeof(val[0])); ++i ) { - CPPUNIT_CHECK( val[i].nDisposeCount == 2 ); - CPPUNIT_CHECK( val[i].nDispose2Count == 1 ); - } - - // check clear on destruct - for ( int i = 0; i < static_cast( sizeof(val)/sizeof(val[0])); ++i ) - CPPUNIT_CHECK( q.push( val[i] ) ); - CPPUNIT_CHECK( misc::check_size( q, sizeof(val)/sizeof(val[0]) )); - CPPUNIT_CHECK( !q.empty() ); - } - - // check if Disposer has been called - Queue::gc::force_dispose(); - for ( int i = 0; i < static_cast( sizeof(val)/sizeof(val[0])); ++i ) { - CPPUNIT_CHECK( val[i].nDisposeCount == 3 ); - CPPUNIT_CHECK( val[i].nDispose2Count == 1 ); - } - } - - void SegmQueue_HP(); - void SegmQueue_HP_mutex(); - void SegmQueue_HP_shuffle(); - void SegmQueue_HP_stat(); - void SegmQueue_HP_cacheline_padding(); - void SegmQueue_HP_mutex_cacheline_padding(); - void SegmQueue_HP_shuffle_cacheline_padding(); - void SegmQueue_HP_stat_cacheline_padding(); - void SegmQueue_HP_256_padding(); - void SegmQueue_HP_mutex_256_padding(); - void SegmQueue_HP_shuffle_256_padding(); - void SegmQueue_HP_stat_256_padding(); - void SegmQueue_HP_cacheline_padding_bigdata(); - void SegmQueue_HP_mutex_cacheline_padding_bigdata(); - void SegmQueue_HP_shuffle_cacheline_padding_bigdata(); - void SegmQueue_HP_stat_cacheline_padding_bigdata(); - - void SegmQueue_DHP(); - void SegmQueue_DHP_mutex(); - void SegmQueue_DHP_shuffle(); - void SegmQueue_DHP_stat(); - void SegmQueue_DHP_cacheline_padding(); - void SegmQueue_DHP_mutex_cacheline_padding(); - void SegmQueue_DHP_shuffle_cacheline_padding(); - void SegmQueue_DHP_stat_cacheline_padding(); - void SegmQueue_DHP_256_padding(); - void SegmQueue_DHP_mutex_256_padding(); - void SegmQueue_DHP_shuffle_256_padding(); - void SegmQueue_DHP_stat_256_padding(); - void SegmQueue_DHP_cacheline_padding_bigdata(); - void SegmQueue_DHP_mutex_cacheline_padding_bigdata(); - void SegmQueue_DHP_shuffle_cacheline_padding_bigdata(); - void SegmQueue_DHP_stat_cacheline_padding_bigdata(); - - CPPUNIT_TEST_SUITE(HdrIntrusiveSegmentedQueue) - CPPUNIT_TEST( SegmQueue_HP ) - CPPUNIT_TEST( SegmQueue_HP_mutex ) - CPPUNIT_TEST( SegmQueue_HP_shuffle ) - CPPUNIT_TEST( SegmQueue_HP_stat ) - CPPUNIT_TEST( SegmQueue_HP_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_HP_mutex_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_HP_shuffle_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_HP_stat_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_HP_256_padding ) - CPPUNIT_TEST( SegmQueue_HP_mutex_256_padding ) - CPPUNIT_TEST( SegmQueue_HP_shuffle_256_padding ) - CPPUNIT_TEST( SegmQueue_HP_stat_256_padding ) - CPPUNIT_TEST( SegmQueue_HP_cacheline_padding_bigdata ) - CPPUNIT_TEST( SegmQueue_HP_mutex_cacheline_padding_bigdata ) - CPPUNIT_TEST( SegmQueue_HP_shuffle_cacheline_padding_bigdata ) - CPPUNIT_TEST( SegmQueue_HP_stat_cacheline_padding_bigdata ) - - CPPUNIT_TEST( SegmQueue_DHP ) - CPPUNIT_TEST( SegmQueue_DHP_mutex ) - CPPUNIT_TEST( SegmQueue_DHP_shuffle ) - CPPUNIT_TEST( SegmQueue_DHP_stat ) - CPPUNIT_TEST( SegmQueue_DHP_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_DHP_mutex_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_DHP_shuffle_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_DHP_stat_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_DHP_256_padding ) - CPPUNIT_TEST( SegmQueue_DHP_mutex_256_padding ) - CPPUNIT_TEST( SegmQueue_DHP_shuffle_256_padding ) - CPPUNIT_TEST( SegmQueue_DHP_stat_256_padding ) - CPPUNIT_TEST( SegmQueue_DHP_cacheline_padding_bigdata ) - CPPUNIT_TEST( SegmQueue_DHP_mutex_cacheline_padding_bigdata ) - CPPUNIT_TEST( SegmQueue_DHP_shuffle_cacheline_padding_bigdata ) - CPPUNIT_TEST( SegmQueue_DHP_stat_cacheline_padding_bigdata ) - CPPUNIT_TEST_SUITE_END() - }; - -} // namespace queue - -#endif // CDSTEST_HDR_INTRUSIVE_SEGMENTED_QUEUE_H diff --git a/tests/test-hdr/queue/hdr_intrusive_segmented_queue_dhp.cpp b/tests/test-hdr/queue/hdr_intrusive_segmented_queue_dhp.cpp deleted file mode 100644 index 29232560..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_segmented_queue_dhp.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_segmented_queue.h" -#include -#include - -namespace queue { - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP() - { - struct queue_traits : public cds::intrusive::segmented_queue::traits - { - typedef Disposer disposer; - }; - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_mutex() - { - struct queue_traits : public - cds::intrusive::segmented_queue::make_traits < - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::lock_type < std::mutex > - > ::type - {}; - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_shuffle() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_stat() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - ,cds::opt::stat< cds::intrusive::segmented_queue::stat<> > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_cacheline_padding() - { - struct queue_traits : public cds::intrusive::segmented_queue::traits - { - typedef Disposer disposer; - enum { padding = cds::opt::cache_line_padding }; - }; - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_mutex_cacheline_padding() - { - struct queue_traits : public - cds::intrusive::segmented_queue::make_traits < - cds::intrusive::opt::disposer< Disposer > - , cds::opt::padding< cds::opt::cache_line_padding > - ,cds::opt::lock_type < std::mutex > - > ::type - {}; - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_shuffle_cacheline_padding() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> > - , cds::opt::padding< cds::opt::cache_line_padding > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_stat_cacheline_padding() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - ,cds::opt::stat< cds::intrusive::segmented_queue::stat<> > - , cds::opt::padding< cds::opt::cache_line_padding > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_256_padding() - { - struct queue_traits : public cds::intrusive::segmented_queue::traits - { - typedef Disposer disposer; - enum { padding = 256 }; - }; - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_mutex_256_padding() - { - struct queue_traits : public - cds::intrusive::segmented_queue::make_traits < - cds::intrusive::opt::disposer< Disposer > - , cds::opt::padding< 256 > - ,cds::opt::lock_type < std::mutex > - > ::type - {}; - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_shuffle_256_padding() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> > - , cds::opt::padding< 256 > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_stat_256_padding() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - ,cds::opt::stat< cds::intrusive::segmented_queue::stat<> > - , cds::opt::padding< 256 > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_cacheline_padding_bigdata() - { - struct queue_traits : public cds::intrusive::segmented_queue::traits - { - typedef Disposer disposer; - enum { padding = cds::opt::cache_line_padding }; - }; - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, big_item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_mutex_cacheline_padding_bigdata() - { - struct queue_traits : public - cds::intrusive::segmented_queue::make_traits < - cds::intrusive::opt::disposer< Disposer > - , cds::opt::padding< cds::opt::cache_line_padding > - ,cds::opt::lock_type < std::mutex > - > ::type - {}; - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, big_item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_shuffle_cacheline_padding_bigdata() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, big_item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> > - , cds::opt::padding< cds::opt::cache_line_padding > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_stat_cacheline_padding_bigdata() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, big_item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - ,cds::opt::stat< cds::intrusive::segmented_queue::stat<> > - , cds::opt::padding< cds::opt::cache_line_padding > - >::type - > queue_type; - - test(); - } - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_intrusive_segmented_queue_hp.cpp b/tests/test-hdr/queue/hdr_intrusive_segmented_queue_hp.cpp deleted file mode 100644 index 9624f092..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_segmented_queue_hp.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_segmented_queue.h" -#include -#include - -namespace queue { - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP() - { - struct queue_traits : public cds::intrusive::segmented_queue::traits - { - typedef Disposer disposer; - }; - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_mutex() - { - struct queue_traits : public - cds::intrusive::segmented_queue::make_traits < - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::lock_type < std::mutex > - > ::type - {}; - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_shuffle() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_stat() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - ,cds::opt::stat< cds::intrusive::segmented_queue::stat<> > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_cacheline_padding() - { - struct queue_traits : public cds::intrusive::segmented_queue::traits - { - typedef Disposer disposer; - enum { padding = cds::opt::cache_line_padding }; - }; - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_mutex_cacheline_padding() - { - struct queue_traits : public - cds::intrusive::segmented_queue::make_traits < - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::lock_type < std::mutex > - ,cds::opt::padding< cds::opt::cache_line_padding > - > ::type - {}; - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_shuffle_cacheline_padding() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::padding< cds::opt::cache_line_padding > - ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_stat_cacheline_padding() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - , cds::opt::padding< cds::opt::cache_line_padding > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - ,cds::opt::stat< cds::intrusive::segmented_queue::stat<> > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_256_padding() - { - struct queue_traits : public cds::intrusive::segmented_queue::traits - { - typedef Disposer disposer; - enum { padding = 256 }; - }; - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_mutex_256_padding() - { - struct queue_traits : public - cds::intrusive::segmented_queue::make_traits < - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::lock_type < std::mutex > - ,cds::opt::padding< 256 > - > ::type - {}; - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_shuffle_256_padding() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::padding< 256 > - ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_stat_256_padding() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - , cds::opt::padding< 256 > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - ,cds::opt::stat< cds::intrusive::segmented_queue::stat<> > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_cacheline_padding_bigdata() - { - struct queue_traits : public cds::intrusive::segmented_queue::traits - { - typedef Disposer disposer; - enum { padding = cds::opt::cache_line_padding | cds::opt::padding_tiny_data_only }; - }; - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, big_item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_mutex_cacheline_padding_bigdata() - { - struct queue_traits : public - cds::intrusive::segmented_queue::make_traits < - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::lock_type < std::mutex > - , cds::opt::padding< cds::opt::cache_line_padding | cds::opt::padding_tiny_data_only > - > ::type - {}; - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, big_item, queue_traits > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_shuffle_cacheline_padding_bigdata() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, big_item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - ,cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::padding< cds::opt::cache_line_padding | cds::opt::padding_tiny_data_only > - ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> > - >::type - > queue_type; - - test(); - } - - void HdrIntrusiveSegmentedQueue::SegmQueue_HP_stat_cacheline_padding_bigdata() - { - typedef cds::intrusive::SegmentedQueue< cds::gc::HP, big_item, - cds::intrusive::segmented_queue::make_traits< - cds::intrusive::opt::disposer< Disposer > - , cds::opt::padding< cds::opt::cache_line_padding | cds::opt::padding_tiny_data_only > - ,cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - ,cds::opt::stat< cds::intrusive::segmented_queue::stat<> > - >::type - > queue_type; - - test(); - } - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_intrusive_tsigas_cycle_queue.cpp b/tests/test-hdr/queue/hdr_intrusive_tsigas_cycle_queue.cpp deleted file mode 100644 index f6b2a3fd..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_tsigas_cycle_queue.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" -#include - -namespace queue { - -#define TEST(X) void IntrusiveQueueHeaderTest::test_##X() { test2(); } - - namespace { - struct item { - int nVal; - int nDisposeCount; - - item() - : nDisposeCount(0) - {} - }; - - struct traits_TsigasCycleQueue_static : public cds::intrusive::tsigas_queue::traits - { - typedef co::v::static_buffer< int, 1024 > buffer; - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - typedef co::v::sequential_consistent memory_model; - }; - typedef ci::TsigasCycleQueue< item, traits_TsigasCycleQueue_static > TsigasCycleQueue_static; - - struct traits_traits_TsigasCycleQueue_static_ic : public traits_TsigasCycleQueue_static - { - typedef cds::atomicity::item_counter item_counter; - }; - typedef ci::TsigasCycleQueue< item, traits_traits_TsigasCycleQueue_static_ic > TsigasCycleQueue_static_ic; - - class TsigasCycleQueue_dyn - : public ci::TsigasCycleQueue< item, - typename ci::tsigas_queue::make_traits< - co::buffer< co::v::dynamic_buffer< int > > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > - { - typedef ci::TsigasCycleQueue< item, - typename ci::tsigas_queue::make_traits< - co::buffer< co::v::dynamic_buffer< int > > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - > base_class; - public: - TsigasCycleQueue_dyn() - : base_class( 1024 ) - {} - }; - - class TsigasCycleQueue_dyn_ic - : public ci::TsigasCycleQueue< item, - typename ci::tsigas_queue::make_traits< - co::buffer< co::v::dynamic_buffer< int > > - ,ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > - { - typedef ci::TsigasCycleQueue< item, - typename ci::tsigas_queue::make_traits< - co::buffer< co::v::dynamic_buffer< int > > - , ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , co::item_counter< cds::atomicity::item_counter > - >::type - > base_class; - public: - TsigasCycleQueue_dyn_ic() - : base_class( 1024 ) - {} - }; - } - - TEST(TsigasCycleQueue_static) - TEST(TsigasCycleQueue_static_ic) - TEST(TsigasCycleQueue_dyn) - TEST(TsigasCycleQueue_dyn_ic) - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_intrusive_vyukovmpmc_cycle_queue.cpp b/tests/test-hdr/queue/hdr_intrusive_vyukovmpmc_cycle_queue.cpp deleted file mode 100644 index 6bee4f0f..00000000 --- a/tests/test-hdr/queue/hdr_intrusive_vyukovmpmc_cycle_queue.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" -#include - -namespace queue { - -#define TEST(X) void IntrusiveQueueHeaderTest::test_##X() { test2(); } - - namespace { - struct item { - int nVal; - int nDisposeCount; - - item() - : nDisposeCount(0) - {} - }; - - struct traits_VyukovMPMCCycleQueue_static : public ci::vyukov_queue::traits - { - typedef co::v::static_buffer< int, 1024 > buffer; - typedef IntrusiveQueueHeaderTest::faked_disposer disposer; - typedef co::v::sequential_consistent memory_model; - }; - typedef ci::VyukovMPMCCycleQueue< item, traits_VyukovMPMCCycleQueue_static > VyukovMPMCCycleQueue_static; - - struct traits_VyukovMPMCCycleQueue_static_ic : public traits_VyukovMPMCCycleQueue_static - { - typedef cds::atomicity::item_counter item_counter; - }; - typedef ci::VyukovMPMCCycleQueue< item, traits_VyukovMPMCCycleQueue_static_ic > VyukovMPMCCycleQueue_static_ic; - - struct traits_VyukovMPMCCycleQueue_dyn : - public ci::vyukov_queue::make_traits < - co::buffer< co::v::dynamic_buffer< int > >, - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - >::type - {}; - class VyukovMPMCCycleQueue_dyn - : public ci::VyukovMPMCCycleQueue< item, traits_VyukovMPMCCycleQueue_dyn > - { - typedef ci::VyukovMPMCCycleQueue< item, traits_VyukovMPMCCycleQueue_dyn > base_class; - - public: - VyukovMPMCCycleQueue_dyn() - : base_class( 1024 ) - {} - }; - - struct traits_VyukovMPMCCycleQueue_dyn_ic : - public ci::vyukov_queue::make_traits < - ci::opt::disposer< IntrusiveQueueHeaderTest::faked_disposer > - , co::item_counter< cds::atomicity::item_counter > - >::type - {}; - class VyukovMPMCCycleQueue_dyn_ic - : public ci::VyukovMPMCCycleQueue< item, traits_VyukovMPMCCycleQueue_dyn_ic > - { - typedef ci::VyukovMPMCCycleQueue< item, traits_VyukovMPMCCycleQueue_dyn_ic > base_class; - public: - VyukovMPMCCycleQueue_dyn_ic() - : base_class( 1024 ) - {} - }; - } - - TEST(VyukovMPMCCycleQueue_static) - TEST(VyukovMPMCCycleQueue_static_ic) - TEST(VyukovMPMCCycleQueue_dyn) - TEST(VyukovMPMCCycleQueue_dyn_ic) - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_moirqueue_dhp.cpp b/tests/test-hdr/queue/hdr_moirqueue_dhp.cpp deleted file mode 100644 index aae052cb..00000000 --- a/tests/test-hdr/queue/hdr_moirqueue_dhp.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include -#include "queue/hdr_queue.h" - -namespace queue { - - void HdrTestQueue::MoirQueue_DHP() - { - typedef cds::container::MoirQueue< cds::gc::DHP, int > test_queue; - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_DHP_Counted() - { - typedef cds::container::MoirQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter < cds::atomicity::item_counter > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_DHP_relax() - { - typedef cds::container::MoirQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model < cds::opt::v::relaxed_ordering > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_DHP_Counted_relax() - { - typedef cds::container::MoirQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model < cds::opt::v::relaxed_ordering > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_DHP_seqcst() - { - typedef cds::container::MoirQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model < cds::opt::v::sequential_consistent > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_DHP_Counted_seqcst() - { - typedef cds::container::MoirQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model < cds::opt::v::sequential_consistent > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_DHP_relax_align() - { - typedef cds::container::MoirQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model< cds::opt::v::relaxed_ordering> - , cds::opt::padding < 16 > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_DHP_Counted_relax_align() - { - typedef cds::container::MoirQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model< cds::opt::v::relaxed_ordering> - , cds::opt::padding < 32 > - >::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_DHP_seqcst_align() - { - typedef cds::container::MoirQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model< cds::opt::v::sequential_consistent> - ,cds::opt::padding < cds::opt::no_special_padding > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_DHP_Counted_seqcst_align() - { - typedef cds::container::MoirQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model< cds::opt::v::sequential_consistent> - , cds::opt::padding < cds::opt::cache_line_padding > - > ::type - > test_queue; - test_ic< test_queue >(); - } -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_moirqueue_hp.cpp b/tests/test-hdr/queue/hdr_moirqueue_hp.cpp deleted file mode 100644 index 2e40806f..00000000 --- a/tests/test-hdr/queue/hdr_moirqueue_hp.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -#include "queue/hdr_queue.h" - -namespace queue { - - void HdrTestQueue::MoirQueue_HP() - { - typedef cds::container::MoirQueue< cds::gc::HP, int > test_queue; - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_HP_Counted() - { - typedef cds::container::MoirQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter < cds::atomicity::item_counter > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_HP_relax() - { - typedef cds::container::MoirQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model < cds::opt::v::relaxed_ordering > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_HP_Counted_relax() - { - typedef cds::container::MoirQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model < cds::opt::v::relaxed_ordering > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_HP_seqcst() - { - typedef cds::container::MoirQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model < cds::opt::v::sequential_consistent > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_HP_Counted_seqcst() - { - typedef cds::container::MoirQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model < cds::opt::v::sequential_consistent > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_HP_relax_align() - { - typedef cds::container::MoirQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model< cds::opt::v::relaxed_ordering> - , cds::opt::padding < 16 > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_HP_Counted_relax_align() - { - typedef cds::container::MoirQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model< cds::opt::v::relaxed_ordering> - , cds::opt::padding < 32 > - >::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_HP_seqcst_align() - { - typedef cds::container::MoirQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model< cds::opt::v::sequential_consistent> - ,cds::opt::padding < cds::opt::no_special_padding > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MoirQueue_HP_Counted_seqcst_align() - { - typedef cds::container::MoirQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model< cds::opt::v::sequential_consistent> - , cds::opt::padding < cds::opt::cache_line_padding > - > ::type - > test_queue; - test_ic< test_queue >(); - } -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_msqueue_dhp.cpp b/tests/test-hdr/queue/hdr_msqueue_dhp.cpp deleted file mode 100644 index fc677580..00000000 --- a/tests/test-hdr/queue/hdr_msqueue_dhp.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -#include "queue/hdr_queue.h" - -namespace queue { - - void HdrTestQueue::MSQueue_DHP() - { - typedef cds::container::MSQueue< cds::gc::DHP, int > test_queue; - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_DHP_Counted() - { - typedef cds::container::MSQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter < cds::atomicity::item_counter > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_DHP_relax() - { - typedef cds::container::MSQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model < cds::opt::v::relaxed_ordering > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_DHP_Counted_relax() - { - typedef cds::container::MSQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model < cds::opt::v::relaxed_ordering > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_DHP_seqcst() - { - typedef cds::container::MSQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model < cds::opt::v::sequential_consistent > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_DHP_Counted_seqcst() - { - typedef cds::container::MSQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model < cds::opt::v::sequential_consistent > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_DHP_relax_align() - { - typedef cds::container::MSQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model< cds::opt::v::relaxed_ordering> - , cds::opt::padding < 16 > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_DHP_Counted_relax_align() - { - typedef cds::container::MSQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model< cds::opt::v::relaxed_ordering> - , cds::opt::padding < 32 > - >::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_DHP_seqcst_align() - { - typedef cds::container::MSQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model< cds::opt::v::sequential_consistent> - ,cds::opt::padding < cds::opt::no_special_padding > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_DHP_Counted_seqcst_align() - { - typedef cds::container::MSQueue < cds::gc::DHP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model< cds::opt::v::sequential_consistent> - , cds::opt::padding < cds::opt::cache_line_padding > - > ::type - > test_queue; - test_ic< test_queue >(); - } -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_msqueue_hp.cpp b/tests/test-hdr/queue/hdr_msqueue_hp.cpp deleted file mode 100644 index e36d3b8d..00000000 --- a/tests/test-hdr/queue/hdr_msqueue_hp.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -#include "queue/hdr_queue.h" - -namespace queue { - - void HdrTestQueue::MSQueue_HP() - { - typedef cds::container::MSQueue< cds::gc::HP, int > test_queue; - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_HP_Counted() - { - typedef cds::container::MSQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter < cds::atomicity::item_counter > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_HP_relax() - { - typedef cds::container::MSQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model < cds::opt::v::relaxed_ordering > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_HP_Counted_relax() - { - typedef cds::container::MSQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model < cds::opt::v::relaxed_ordering > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_HP_seqcst() - { - typedef cds::container::MSQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model < cds::opt::v::sequential_consistent > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_HP_Counted_seqcst() - { - typedef cds::container::MSQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model < cds::opt::v::sequential_consistent > - > ::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_HP_relax_align() - { - typedef cds::container::MSQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model< cds::opt::v::relaxed_ordering> - , cds::opt::padding < 16 > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_HP_Counted_relax_align() - { - typedef cds::container::MSQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model< cds::opt::v::relaxed_ordering> - , cds::opt::padding < 32 > - >::type - > test_queue; - - test_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_HP_seqcst_align() - { - typedef cds::container::MSQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::memory_model< cds::opt::v::sequential_consistent> - ,cds::opt::padding < cds::opt::no_special_padding > - > ::type - > test_queue; - - test_no_ic< test_queue >(); - } - - void HdrTestQueue::MSQueue_HP_Counted_seqcst_align() - { - typedef cds::container::MSQueue < cds::gc::HP, int, - typename cds::container::msqueue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::memory_model< cds::opt::v::sequential_consistent> - , cds::opt::padding < cds::opt::cache_line_padding > - > ::type - > test_queue; - test_ic< test_queue >(); - } -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_optimistic_dhp.cpp b/tests/test-hdr/queue/hdr_optimistic_dhp.cpp deleted file mode 100644 index 60def331..00000000 --- a/tests/test-hdr/queue/hdr_optimistic_dhp.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -#include "queue/hdr_queue.h" - -namespace queue { - - void HdrTestQueue::OptimisticQueue_DHP() - { - test_no_ic >(); - } - - void HdrTestQueue::OptimisticQueue_DHP_Counted() - { - struct queue_traits : public cds::container::optimistic_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - }; - test_ic >(); - } - - void HdrTestQueue::OptimisticQueue_DHP_relax() - { - struct queue_traits : public cds::container::optimistic_queue::traits - { - typedef cds::opt::v::relaxed_ordering memory_model; - }; - test_no_ic >(); - } - - void HdrTestQueue::OptimisticQueue_DHP_Counted_relax() - { - struct queue_traits : public cds::container::optimistic_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - typedef cds::opt::v::relaxed_ordering memory_model; - }; - test_ic < - cds::container::OptimisticQueue< cds::gc::DHP, int, queue_traits > >(); - } - - void HdrTestQueue::OptimisticQueue_DHP_seqcst() - { - test_no_ic< - cds::container::OptimisticQueue< cds::gc::DHP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::memory_model< cds::opt::v::sequential_consistent> - >::type - > - >(); - } - - void HdrTestQueue::OptimisticQueue_DHP_Counted_seqcst() - { - test_ic< - cds::container::OptimisticQueue< cds::gc::DHP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::sequential_consistent> - >::type - > - >(); - } - - void HdrTestQueue::OptimisticQueue_DHP_relax_align() - { - test_no_ic< - cds::container::OptimisticQueue< cds::gc::DHP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::memory_model< cds::opt::v::relaxed_ordering> - ,cds::opt::padding< 16 > - >::type - > - >(); - } - - void HdrTestQueue::OptimisticQueue_DHP_Counted_relax_align() - { - test_ic< - cds::container::OptimisticQueue< cds::gc::DHP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::relaxed_ordering> - ,cds::opt::padding< 32 > - >::type - > - >(); - } - - void HdrTestQueue::OptimisticQueue_DHP_seqcst_align() - { - test_no_ic< - cds::container::OptimisticQueue< cds::gc::DHP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::memory_model< cds::opt::v::sequential_consistent> - ,cds::opt::padding< cds::opt::no_special_padding > - >::type - > - >(); - } - - void HdrTestQueue::OptimisticQueue_DHP_Counted_seqcst_align() - { - test_ic< - cds::container::OptimisticQueue< cds::gc::DHP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::sequential_consistent> - ,cds::opt::padding< cds::opt::cache_line_padding > - >::type - > - >(); - } - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_optimistic_hp.cpp b/tests/test-hdr/queue/hdr_optimistic_hp.cpp deleted file mode 100644 index 6bf354c2..00000000 --- a/tests/test-hdr/queue/hdr_optimistic_hp.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -#include "queue/hdr_queue.h" - -namespace queue { - - void HdrTestQueue::OptimisticQueue_HP() - { - test_no_ic >(); - } - - void HdrTestQueue::OptimisticQueue_HP_Counted() - { - struct queue_traits : public cds::container::optimistic_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - }; - test_ic >(); - } - - void HdrTestQueue::OptimisticQueue_HP_relax() - { - struct queue_traits : public cds::container::optimistic_queue::traits - { - typedef cds::opt::v::relaxed_ordering memory_model; - }; - test_no_ic >(); - } - - void HdrTestQueue::OptimisticQueue_HP_Counted_relax() - { - struct queue_traits : public cds::container::optimistic_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - typedef cds::opt::v::relaxed_ordering memory_model; - }; - test_ic < - cds::container::OptimisticQueue< cds::gc::HP, int, queue_traits > >(); - } - - void HdrTestQueue::OptimisticQueue_HP_seqcst() - { - test_no_ic< - cds::container::OptimisticQueue< cds::gc::HP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::memory_model< cds::opt::v::sequential_consistent> - >::type - > - >(); - } - - void HdrTestQueue::OptimisticQueue_HP_Counted_seqcst() - { - test_ic< - cds::container::OptimisticQueue< cds::gc::HP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::sequential_consistent> - >::type - > - >(); - } - - void HdrTestQueue::OptimisticQueue_HP_relax_align() - { - test_no_ic< - cds::container::OptimisticQueue< cds::gc::HP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::memory_model< cds::opt::v::relaxed_ordering> - ,cds::opt::padding< 16 > - >::type - > - >(); - } - - void HdrTestQueue::OptimisticQueue_HP_Counted_relax_align() - { - test_ic< - cds::container::OptimisticQueue< cds::gc::HP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::relaxed_ordering> - ,cds::opt::padding< 32 > - >::type - > - >(); - } - - void HdrTestQueue::OptimisticQueue_HP_seqcst_align() - { - test_no_ic< - cds::container::OptimisticQueue< cds::gc::HP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::memory_model< cds::opt::v::sequential_consistent> - ,cds::opt::padding< cds::opt::no_special_padding > - >::type - > - >(); - } - - void HdrTestQueue::OptimisticQueue_HP_Counted_seqcst_align() - { - test_ic< - cds::container::OptimisticQueue< cds::gc::HP, int, - typename cds::container::optimistic_queue::make_traits< - cds::opt::item_counter< cds::atomicity::item_counter > - ,cds::opt::memory_model< cds::opt::v::sequential_consistent> - ,cds::opt::padding< cds::opt::cache_line_padding > - >::type - > - >(); - } - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_queue.h b/tests/test-hdr/queue/hdr_queue.h deleted file mode 100644 index bc8b8ec1..00000000 --- a/tests/test-hdr/queue/hdr_queue.h +++ /dev/null @@ -1,492 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef CDSTEST_HDR_QUEUE_H -#define CDSTEST_HDR_QUEUE_H - -#include "cppunit/cppunit_proxy.h" -#include - -namespace queue { - - // - // Test queue operation in single thread mode - // - class HdrTestQueue: public CppUnitMini::TestCase - { - protected: - template - void test_no_ic() - { - Queue q; - test_with( q ); - test_emplace( q ); - } - - template - void test_with( Queue& q ) - { - int it; - int nPrev; - - // push/pop - 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! - } - - // push_with/pop_with - for ( size_t i = 0; i < 3; ++i ) { - CPPUNIT_ASSERT( q.empty() ); -#ifndef _DEBUG - CPPUNIT_ASSERT( q.size() == 0 ); -#endif - CPPUNIT_ASSERT( q.enqueue_with( []( int& dest ) { dest = 1; } )); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.push_with( []( int& dest ) { dest = 10; } )); - CPPUNIT_ASSERT( !q.empty() ); -#ifndef _DEBUG - CPPUNIT_ASSERT( q.size() == 0 ); // no queue's item counter! -#endif - - it = -1; - CPPUNIT_ASSERT( q.pop_with( [&it]( int src ) { it = src; } )); - CPPUNIT_ASSERT( it == 1 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.dequeue_with( [&it]( int src ) { it = src; } )); - CPPUNIT_ASSERT( it == 10 ); -#ifndef _DEBUG - CPPUNIT_ASSERT( q.size() == 0 ); -#endif - CPPUNIT_ASSERT( q.empty() ); - it += 2009; - nPrev = it; - CPPUNIT_ASSERT( !q.dequeue_with( [&it]( int src ) { it = src; } )); - 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 test_ic() - { - 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; - - // push/pop - 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 ); - } - - // push_with/pop_with - for ( size_t i = 0; i < 3; ++i ) { - CPPUNIT_ASSERT( q.empty() ); - CPPUNIT_ASSERT( q.size() == 0 ); - CPPUNIT_ASSERT( q.enqueue_with( []( int& dest ) { dest = 1; } ) ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.size() == 1 ); - CPPUNIT_ASSERT( q.push_with( []( int& dest ) { dest = 10; } ) ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.size() == 2 ); - - it = -1; - CPPUNIT_ASSERT( q.pop_with( [&it]( int src ) { it = src; } ) ); - CPPUNIT_ASSERT( it == 1 ); - CPPUNIT_ASSERT( !q.empty() ); - CPPUNIT_ASSERT( q.size() == 1 ); - CPPUNIT_ASSERT( q.dequeue_with( [&it]( int src ) { it = src; } ) ); - CPPUNIT_ASSERT( it == 10 ); - CPPUNIT_ASSERT( q.size() == 0 ); - CPPUNIT_ASSERT( q.empty() ); - it += 2009; - nPrev = it; - CPPUNIT_ASSERT( !q.dequeue_with( [&it]( int src ) { it = src; } ) ); - CPPUNIT_ASSERT( it == nPrev ); // it must not be changed! - - CPPUNIT_ASSERT( q.size() == 0 ); - CPPUNIT_ASSERT( q.empty() ); - } - } - - 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 ); - } - } - - template - void test_bounded_no_ic() - { - Queue q; - test_with( q ); - test_emplace( q ); - - CPPUNIT_ASSERT( q.empty() ); - size_t nCapacity = q.capacity(); - for ( size_t i = 0; i < nCapacity; ++i ) { - CPPUNIT_CHECK_EX( q.push( static_cast(i) ), "capacity=" << nCapacity << ", i=" << i ); - } - // The queue is full - CPPUNIT_CHECK( !q.empty() ); - CPPUNIT_ASSERT( !q.push_with( [nCapacity]( int& itm ) { itm = static_cast(nCapacity); } ) ); - int n = -1; - CPPUNIT_CHECK( q.pop(n) ); - CPPUNIT_CHECK( n == 0 ); - CPPUNIT_ASSERT( q.push( static_cast(nCapacity) ) ); - CPPUNIT_ASSERT( !q.push( static_cast(nCapacity) ) ); - } - - template - void test_bounded_ic() - { - Queue q; - test_ic_with( q ); - test_emplace_ic( q ); - - CPPUNIT_ASSERT( q.empty() ); - size_t nCapacity = q.capacity(); - for ( size_t i = 0; i < nCapacity; ++i ) { - CPPUNIT_CHECK_EX( q.push( static_cast(i) ), "capacity=" << nCapacity << ", i=" << i ); - } - // The queue is full - CPPUNIT_CHECK( !q.empty() ); - CPPUNIT_CHECK( q.size() == nCapacity ); - CPPUNIT_ASSERT( !q.push_with( [nCapacity]( int& itm ) { itm = static_cast(nCapacity); } )); - int n = -1; - CPPUNIT_CHECK( q.pop( n ) ); - CPPUNIT_CHECK( n == 0 ); - CPPUNIT_ASSERT( q.push( static_cast(nCapacity) ) ); - CPPUNIT_CHECK( q.size() == nCapacity ); - CPPUNIT_ASSERT( !q.push( static_cast(nCapacity) ) ); - CPPUNIT_CHECK( q.size() == nCapacity ); - } - - public: - void MSQueue_HP(); - void MSQueue_HP_relax(); - void MSQueue_HP_seqcst(); - void MSQueue_HP_relax_align(); - void MSQueue_HP_seqcst_align(); - void MSQueue_HP_Counted(); - void MSQueue_HP_Counted_relax(); - void MSQueue_HP_Counted_seqcst(); - void MSQueue_HP_Counted_relax_align(); - void MSQueue_HP_Counted_seqcst_align(); - - void MSQueue_DHP(); - void MSQueue_DHP_relax(); - void MSQueue_DHP_seqcst(); - void MSQueue_DHP_relax_align(); - void MSQueue_DHP_seqcst_align(); - void MSQueue_DHP_Counted(); - void MSQueue_DHP_Counted_relax(); - void MSQueue_DHP_Counted_seqcst(); - void MSQueue_DHP_Counted_relax_align(); - void MSQueue_DHP_Counted_seqcst_align(); - - void MoirQueue_HP(); - void MoirQueue_HP_relax(); - void MoirQueue_HP_seqcst(); - void MoirQueue_HP_relax_align(); - void MoirQueue_HP_seqcst_align(); - void MoirQueue_HP_Counted(); - void MoirQueue_HP_Counted_relax(); - void MoirQueue_HP_Counted_seqcst(); - void MoirQueue_HP_Counted_relax_align(); - void MoirQueue_HP_Counted_seqcst_align(); - - void MoirQueue_DHP(); - void MoirQueue_DHP_relax(); - void MoirQueue_DHP_seqcst(); - void MoirQueue_DHP_relax_align(); - void MoirQueue_DHP_seqcst_align(); - void MoirQueue_DHP_Counted(); - void MoirQueue_DHP_Counted_relax(); - void MoirQueue_DHP_Counted_seqcst(); - void MoirQueue_DHP_Counted_relax_align(); - void MoirQueue_DHP_Counted_seqcst_align(); - - void OptimisticQueue_HP(); - void OptimisticQueue_HP_relax(); - void OptimisticQueue_HP_seqcst(); - void OptimisticQueue_HP_relax_align(); - void OptimisticQueue_HP_seqcst_align(); - void OptimisticQueue_HP_Counted(); - void OptimisticQueue_HP_Counted_relax(); - void OptimisticQueue_HP_Counted_seqcst(); - void OptimisticQueue_HP_Counted_relax_align(); - void OptimisticQueue_HP_Counted_seqcst_align(); - - void OptimisticQueue_DHP(); - void OptimisticQueue_DHP_relax(); - void OptimisticQueue_DHP_seqcst(); - void OptimisticQueue_DHP_relax_align(); - void OptimisticQueue_DHP_seqcst_align(); - void OptimisticQueue_DHP_Counted(); - void OptimisticQueue_DHP_Counted_relax(); - void OptimisticQueue_DHP_Counted_seqcst(); - void OptimisticQueue_DHP_Counted_relax_align(); - void OptimisticQueue_DHP_Counted_seqcst_align(); - - void BasketQueue_HP(); - void BasketQueue_HP_relax(); - void BasketQueue_HP_seqcst(); - void BasketQueue_HP_relax_align(); - void BasketQueue_HP_seqcst_align(); - void BasketQueue_HP_Counted(); - void BasketQueue_HP_Counted_relax(); - void BasketQueue_HP_Counted_seqcst(); - void BasketQueue_HP_Counted_relax_align(); - void BasketQueue_HP_Counted_seqcst_align(); - - void BasketQueue_DHP(); - void BasketQueue_DHP_relax(); - void BasketQueue_DHP_seqcst(); - void BasketQueue_DHP_relax_align(); - void BasketQueue_DHP_seqcst_align(); - void BasketQueue_DHP_Counted(); - void BasketQueue_DHP_Counted_relax(); - void BasketQueue_DHP_Counted_seqcst(); - void BasketQueue_DHP_Counted_relax_align(); - void BasketQueue_DHP_Counted_seqcst_align(); - - void RWQueue_default(); - void RWQueue_mutex(); - void RWQueue_ic(); - void RWQueue_ic_mutex(); - void RWQueue_padding(); - - void TsigasCycleQueue_static(); - void TsigasCycleQueue_static_ic(); - void TsigasCycleQueue_dyn(); - void TsigasCycleQueue_dyn_ic(); - - void VyukovMPMCCycleQueue_static(); - void VyukovMPMCCycleQueue_static_ic(); - void VyukovMPMCCycleQueue_dyn(); - void VyukovMPMCCycleQueue_dyn_ic(); - - CPPUNIT_TEST_SUITE( HdrTestQueue ) - CPPUNIT_TEST(MSQueue_HP); - CPPUNIT_TEST(MSQueue_HP_relax); - CPPUNIT_TEST(MSQueue_HP_seqcst); - CPPUNIT_TEST(MSQueue_HP_relax_align); - CPPUNIT_TEST(MSQueue_HP_seqcst_align); - CPPUNIT_TEST(MSQueue_HP_Counted); - CPPUNIT_TEST(MSQueue_HP_Counted_relax); - CPPUNIT_TEST(MSQueue_HP_Counted_seqcst); - CPPUNIT_TEST(MSQueue_HP_Counted_relax_align); - CPPUNIT_TEST(MSQueue_HP_Counted_seqcst_align); - - CPPUNIT_TEST(MSQueue_DHP); - CPPUNIT_TEST(MSQueue_DHP_relax); - CPPUNIT_TEST(MSQueue_DHP_seqcst); - CPPUNIT_TEST(MSQueue_DHP_relax_align); - CPPUNIT_TEST(MSQueue_DHP_seqcst_align); - CPPUNIT_TEST(MSQueue_DHP_Counted); - CPPUNIT_TEST(MSQueue_DHP_Counted_relax); - CPPUNIT_TEST(MSQueue_DHP_Counted_seqcst); - CPPUNIT_TEST(MSQueue_DHP_Counted_relax_align); - CPPUNIT_TEST(MSQueue_DHP_Counted_seqcst_align); - - CPPUNIT_TEST(MoirQueue_HP); - CPPUNIT_TEST(MoirQueue_HP_relax); - CPPUNIT_TEST(MoirQueue_HP_seqcst); - CPPUNIT_TEST(MoirQueue_HP_relax_align); - CPPUNIT_TEST(MoirQueue_HP_seqcst_align); - CPPUNIT_TEST(MoirQueue_HP_Counted); - CPPUNIT_TEST(MoirQueue_HP_Counted_relax); - CPPUNIT_TEST(MoirQueue_HP_Counted_seqcst); - CPPUNIT_TEST(MoirQueue_HP_Counted_relax_align); - CPPUNIT_TEST(MoirQueue_HP_Counted_seqcst_align); - - CPPUNIT_TEST(MoirQueue_DHP); - CPPUNIT_TEST(MoirQueue_DHP_relax); - CPPUNIT_TEST(MoirQueue_DHP_seqcst); - CPPUNIT_TEST(MoirQueue_DHP_relax_align); - CPPUNIT_TEST(MoirQueue_DHP_seqcst_align); - CPPUNIT_TEST(MoirQueue_DHP_Counted); - CPPUNIT_TEST(MoirQueue_DHP_Counted_relax); - CPPUNIT_TEST(MoirQueue_DHP_Counted_seqcst); - CPPUNIT_TEST(MoirQueue_DHP_Counted_relax_align); - CPPUNIT_TEST(MoirQueue_DHP_Counted_seqcst_align); - - CPPUNIT_TEST(OptimisticQueue_HP); - CPPUNIT_TEST(OptimisticQueue_HP_relax); - CPPUNIT_TEST(OptimisticQueue_HP_seqcst); - CPPUNIT_TEST(OptimisticQueue_HP_relax_align); - CPPUNIT_TEST(OptimisticQueue_HP_seqcst_align); - CPPUNIT_TEST(OptimisticQueue_HP_Counted); - CPPUNIT_TEST(OptimisticQueue_HP_Counted_relax); - CPPUNIT_TEST(OptimisticQueue_HP_Counted_seqcst); - CPPUNIT_TEST(OptimisticQueue_HP_Counted_relax_align); - CPPUNIT_TEST(OptimisticQueue_HP_Counted_seqcst_align); - - CPPUNIT_TEST(OptimisticQueue_DHP); - CPPUNIT_TEST(OptimisticQueue_DHP_relax); - CPPUNIT_TEST(OptimisticQueue_DHP_seqcst); - CPPUNIT_TEST(OptimisticQueue_DHP_relax_align); - CPPUNIT_TEST(OptimisticQueue_DHP_seqcst_align); - CPPUNIT_TEST(OptimisticQueue_DHP_Counted); - CPPUNIT_TEST(OptimisticQueue_DHP_Counted_relax); - CPPUNIT_TEST(OptimisticQueue_DHP_Counted_seqcst); - CPPUNIT_TEST(OptimisticQueue_DHP_Counted_relax_align); - CPPUNIT_TEST(OptimisticQueue_DHP_Counted_seqcst_align); - - CPPUNIT_TEST(BasketQueue_HP); - CPPUNIT_TEST(BasketQueue_HP_relax); - CPPUNIT_TEST(BasketQueue_HP_seqcst); - CPPUNIT_TEST(BasketQueue_HP_relax_align); - CPPUNIT_TEST(BasketQueue_HP_seqcst_align); - CPPUNIT_TEST(BasketQueue_HP_Counted); - CPPUNIT_TEST(BasketQueue_HP_Counted_relax); - CPPUNIT_TEST(BasketQueue_HP_Counted_seqcst); - CPPUNIT_TEST(BasketQueue_HP_Counted_relax_align); - CPPUNIT_TEST(BasketQueue_HP_Counted_seqcst_align); - - CPPUNIT_TEST(BasketQueue_DHP); - CPPUNIT_TEST(BasketQueue_DHP_relax); - CPPUNIT_TEST(BasketQueue_DHP_seqcst); - CPPUNIT_TEST(BasketQueue_DHP_relax_align); - CPPUNIT_TEST(BasketQueue_DHP_seqcst_align); - CPPUNIT_TEST(BasketQueue_DHP_Counted); - CPPUNIT_TEST(BasketQueue_DHP_Counted_relax); - CPPUNIT_TEST(BasketQueue_DHP_Counted_seqcst); - CPPUNIT_TEST(BasketQueue_DHP_Counted_relax_align); - CPPUNIT_TEST(BasketQueue_DHP_Counted_seqcst_align); - - CPPUNIT_TEST( TsigasCycleQueue_static ) - CPPUNIT_TEST( TsigasCycleQueue_static_ic ) - CPPUNIT_TEST( TsigasCycleQueue_dyn ) - CPPUNIT_TEST( TsigasCycleQueue_dyn_ic ) - - CPPUNIT_TEST( VyukovMPMCCycleQueue_static ) - CPPUNIT_TEST( VyukovMPMCCycleQueue_static_ic ) - CPPUNIT_TEST( VyukovMPMCCycleQueue_dyn ) - CPPUNIT_TEST( VyukovMPMCCycleQueue_dyn_ic ) - - CPPUNIT_TEST( RWQueue_default) - CPPUNIT_TEST( RWQueue_mutex ) - CPPUNIT_TEST( RWQueue_ic ) - CPPUNIT_TEST( RWQueue_ic_mutex ) - CPPUNIT_TEST( RWQueue_padding ) - - CPPUNIT_TEST_SUITE_END(); - - }; -} // namespace queue - -#endif // #ifndef CDSTEST_HDR_QUEUE_H diff --git a/tests/test-hdr/queue/hdr_queue_register.cpp b/tests/test-hdr/queue/hdr_queue_register.cpp deleted file mode 100644 index 23105dd2..00000000 --- a/tests/test-hdr/queue/hdr_queue_register.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_intrusive_msqueue.h" -#include "hdr_intrusive_segmented_queue.h" -#include "hdr_queue.h" -#include "hdr_fcqueue.h" -#include "hdr_segmented_queue.h" - -CPPUNIT_TEST_SUITE_REGISTRATION_( queue::HdrTestQueue, s_HdrTestQueue ); -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 ); diff --git a/tests/test-hdr/queue/hdr_rwqueue.cpp b/tests/test-hdr/queue/hdr_rwqueue.cpp deleted file mode 100644 index 62b5b6fa..00000000 --- a/tests/test-hdr/queue/hdr_rwqueue.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include - -#include "queue/hdr_queue.h" - -namespace queue { - void HdrTestQueue::RWQueue_default() - { - test_no_ic< cds::container::RWQueue< int > >(); - } - - void HdrTestQueue::RWQueue_mutex() - { - struct queue_traits : public cds::container::rwqueue::traits - { - typedef std::mutex lock_type; - }; - - test_no_ic< cds::container::RWQueue< int, queue_traits > >(); - } - - void HdrTestQueue::RWQueue_ic() - { - struct queue_traits : public cds::container::rwqueue::traits - { - typedef cds::atomicity::item_counter item_counter; - }; - - test_ic< cds::container::RWQueue< int, queue_traits > >(); - } - - void HdrTestQueue::RWQueue_ic_mutex() - { - struct queue_traits : public cds::container::rwqueue::traits - { - typedef cds::atomicity::item_counter item_counter; - typedef std::mutex lock_type; - }; - - test_ic< cds::container::RWQueue< int, queue_traits > >(); - } - - void HdrTestQueue::RWQueue_padding() - { - struct queue_traits : public cds::container::rwqueue::traits - { - enum { padding = 16 }; - }; - - test_no_ic< cds::container::RWQueue< int, queue_traits > >(); - } - -} diff --git a/tests/test-hdr/queue/hdr_segmented_queue.h b/tests/test-hdr/queue/hdr_segmented_queue.h deleted file mode 100644 index 5f9c0cee..00000000 --- a/tests/test-hdr/queue/hdr_segmented_queue.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef CDSTEST_HDR_QUEUE_SEGMENTED_QUEUE_H -#define CDSTEST_HDR_QUEUE_SEGMENTED_QUEUE_H - -#include "cppunit/cppunit_proxy.h" -#include -#include "size_check.h" - -namespace queue { - - class HdrSegmentedQueue: public CppUnitMini::TestCase - { - struct item { - size_t nVal; - - item() {} - item( size_t v ): nVal(v) {} - item( size_t nMajor, size_t nMinor ): nVal( nMajor * 16 + nMinor ) {} - }; - - struct other_item { - size_t nVal; - }; - - template - void test() - { - for ( size_t nQuasiFactor = 2; nQuasiFactor <= 256; ++nQuasiFactor ) { - CPPUNIT_MSG( "QuasiFactor=" << nQuasiFactor << "..." ); - test_qf( nQuasiFactor ); - } - } - - template - void test_qf( size_t nQuasiFactor ) - { - typedef typename Queue::value_type value_type; - - static size_t const c_nItemCount = 1000; - - { - Queue q( nQuasiFactor ); - CPPUNIT_CHECK( q.quasi_factor() == cds::beans::ceil2(nQuasiFactor) ); - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_CHECK( misc::check_size( q, 0 )); - - // push/enqueue - for ( size_t i = 0; i < c_nItemCount; ++i ) { - if ( i & 1 ) { - CPPUNIT_ASSERT( q.push(item(i)) ); - } - else { - CPPUNIT_ASSERT( q.enqueue(item(i)) ); - } - CPPUNIT_CHECK( misc::check_size( q, i + 1 )); - CPPUNIT_CHECK( !q.empty() ); - } - - // pop/dequeue - size_t nCount = 0; - while ( !q.empty() ) { - value_type v; - if ( nCount & 1 ) { - CPPUNIT_ASSERT( q.pop( v ) ); - } - else { - CPPUNIT_ASSERT( q.dequeue( v )); - } - - int nSegment = int( nCount / q.quasi_factor() ); - int nMin = nSegment * int(q.quasi_factor()); - int nMax = nMin + int(q.quasi_factor()) - 1; - CPPUNIT_CHECK_EX( nMin <= static_cast(v.nVal) && static_cast( v.nVal ) <= nMax, nMin << " <= " << v.nVal << " <= " << nMax ); - - ++nCount; - CPPUNIT_CHECK( misc::check_size( q, c_nItemCount - nCount )); - } - CPPUNIT_CHECK( nCount == c_nItemCount ); - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_CHECK( misc::check_size( q, 0 )); - - - // push/pop with functor - for ( size_t i = 0; i < c_nItemCount; ++i ) { - other_item itm; - itm.nVal = i; - if ( i & 1 ) { - CPPUNIT_ASSERT( q.push_with( [&itm]( item& dest ) { dest.nVal = itm.nVal; } )); - } - else { - CPPUNIT_ASSERT( q.enqueue_with( [&itm]( item& dest ) { dest.nVal = itm.nVal; } )); - } - CPPUNIT_CHECK( misc::check_size( q, i + 1 )); - CPPUNIT_CHECK( !q.empty() ); - } - - { - other_item v; - - nCount = 0; - size_t nFuncCount = 0; - while ( !q.empty() ) { - if ( nCount & 1 ) { - CPPUNIT_ASSERT( q.pop_with( [&v, &nFuncCount]( item& src ) {v.nVal = src.nVal; ++nFuncCount; } )); - } - else { - CPPUNIT_ASSERT( q.dequeue_with( [&v, &nFuncCount]( item& src ) {v.nVal = src.nVal; ++nFuncCount; } )); - } - - // It is possible c_nItemCount % quasi_factor() != 0 - // In this case the segment cannot be calculated here - size_t nMin = nCount > q.quasi_factor() ? nCount - q.quasi_factor() : 0; - size_t nMax = nCount + q.quasi_factor(); - CPPUNIT_CHECK_EX( nMin <= v.nVal && v.nVal <= nMax, nMin << " <= " << v.nVal << " <= " << nMax ); - - ++nCount; - CPPUNIT_CHECK( nFuncCount == nCount ); - CPPUNIT_CHECK( misc::check_size( q, c_nItemCount - nCount )); - } - CPPUNIT_CHECK( nCount == c_nItemCount ); - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_CHECK( misc::check_size( q, 0 )); - } - - //emplace - { - size_t nMajor = 0; - size_t nMinor = 0; - for ( size_t i = 0; i < c_nItemCount; ++i ) { - CPPUNIT_CHECK( q.emplace( nMajor, nMinor )); - if ( nMinor == 15 ) { - ++nMajor; - nMinor = 0; - } - else - ++nMinor; - CPPUNIT_CHECK( !q.empty() ); - } - CPPUNIT_CHECK( misc::check_size( q, c_nItemCount )); - - nCount = 0; - while ( !q.empty() ) { - value_type v; - if ( nCount & 1 ) { - CPPUNIT_ASSERT( q.pop( v ) ); - } - else { - CPPUNIT_ASSERT( q.dequeue( v )); - } - - size_t nMin = nCount > q.quasi_factor() ? nCount - q.quasi_factor() : 0; - size_t nMax = nCount + q.quasi_factor(); - CPPUNIT_CHECK_EX( nMin <= v.nVal && v.nVal <= nMax, nMin << " <= " << v.nVal << " <= " << nMax ); - - ++nCount; - CPPUNIT_CHECK( misc::check_size( q, c_nItemCount - nCount )); - } - CPPUNIT_CHECK( nCount == c_nItemCount ); - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_CHECK( misc::check_size( q, 0 )); - } - - // pop from empty queue - { - value_type v; - v.nVal = c_nItemCount + 1; - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_ASSERT( !q.pop( v )); - CPPUNIT_CHECK( q.empty() ); - CPPUNIT_CHECK( misc::check_size( q, 0 )); - CPPUNIT_CHECK( v.nVal == c_nItemCount + 1 ); - } - - // clear - for ( size_t i = 0; i < c_nItemCount; ++i ) { - if ( i & 1 ) { - CPPUNIT_ASSERT( q.push(item(i)) ); - } - else { - CPPUNIT_ASSERT( q.enqueue(item(i)) ); - } - CPPUNIT_CHECK( misc::check_size( q, i + 1 )); - CPPUNIT_CHECK( !q.empty() ); - } - - q.clear(); - CPPUNIT_CHECK( misc::check_size( q, 0 )); - CPPUNIT_CHECK( q.empty() ); - } - } - - void SegmQueue_HP(); - void SegmQueue_HP_mutex(); - void SegmQueue_HP_shuffle(); - void SegmQueue_HP_stat(); - void SegmQueue_HP_cacheline_padding(); - void SegmQueue_HP_mutex_cacheline_padding(); - void SegmQueue_HP_shuffle_cacheline_padding(); - void SegmQueue_HP_stat_cacheline_padding(); - - void SegmQueue_DHP(); - void SegmQueue_DHP_mutex(); - void SegmQueue_DHP_shuffle(); - void SegmQueue_DHP_stat(); - void SegmQueue_DHP_cacheline_padding(); - void SegmQueue_DHP_mutex_cacheline_padding(); - void SegmQueue_DHP_shuffle_cacheline_padding(); - void SegmQueue_DHP_stat_cacheline_padding(); - - CPPUNIT_TEST_SUITE(HdrSegmentedQueue) - CPPUNIT_TEST( SegmQueue_HP ) - CPPUNIT_TEST( SegmQueue_HP_mutex ) - CPPUNIT_TEST( SegmQueue_HP_shuffle ) - CPPUNIT_TEST( SegmQueue_HP_stat ) - CPPUNIT_TEST( SegmQueue_HP_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_HP_mutex_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_HP_shuffle_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_HP_stat_cacheline_padding ) - - CPPUNIT_TEST( SegmQueue_DHP ) - CPPUNIT_TEST( SegmQueue_DHP_mutex ) - CPPUNIT_TEST( SegmQueue_DHP_shuffle ) - CPPUNIT_TEST( SegmQueue_DHP_stat ) - CPPUNIT_TEST( SegmQueue_DHP_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_DHP_mutex_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_DHP_shuffle_cacheline_padding ) - CPPUNIT_TEST( SegmQueue_DHP_stat_cacheline_padding ) - CPPUNIT_TEST_SUITE_END() - - }; -} // namespace queue - -#endif //#ifndef CDSTEST_HDR_QUEUE_SEGMENTED_QUEUE_H diff --git a/tests/test-hdr/queue/hdr_segmented_queue_dhp.cpp b/tests/test-hdr/queue/hdr_segmented_queue_dhp.cpp deleted file mode 100644 index a702767a..00000000 --- a/tests/test-hdr/queue/hdr_segmented_queue_dhp.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_segmented_queue.h" -#include -#include - -namespace queue { - - void HdrSegmentedQueue::SegmQueue_DHP() - { - typedef cds::container::SegmentedQueue< cds::gc::DHP, item > queue_type; - test(); - } - - void HdrSegmentedQueue::SegmQueue_DHP_mutex() - { - typedef cds::container::SegmentedQueue< cds::gc::DHP, item, - cds::container::segmented_queue::make_traits< - cds::opt::lock_type< std::mutex > - >::type - > queue_type; - - test(); - } - - void HdrSegmentedQueue::SegmQueue_DHP_shuffle() - { - struct queue_traits : public cds::container::segmented_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - typedef cds::opt::v::random_shuffle_permutation<> permutation_generator; - }; - typedef cds::container::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - - test(); - } - - void HdrSegmentedQueue::SegmQueue_DHP_stat() - { - struct queue_traits : public - cds::container::segmented_queue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - , cds::opt::stat < cds::container::segmented_queue::stat<> > - > ::type - {}; - typedef cds::container::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - - test(); - } - - void HdrSegmentedQueue::SegmQueue_DHP_cacheline_padding() - { - struct queue_traits : public cds::container::segmented_queue::traits - { - enum { padding = cds::opt::cache_line_padding }; - }; - - typedef cds::container::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - test(); - } - - void HdrSegmentedQueue::SegmQueue_DHP_mutex_cacheline_padding() - { - typedef cds::container::SegmentedQueue< cds::gc::DHP, item, - cds::container::segmented_queue::make_traits< - cds::opt::lock_type< std::mutex > - , cds::opt::padding< cds::opt::cache_line_padding > - >::type - > queue_type; - - test(); - } - - void HdrSegmentedQueue::SegmQueue_DHP_shuffle_cacheline_padding() - { - struct queue_traits : public cds::container::segmented_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - typedef cds::opt::v::random_shuffle_permutation<> permutation_generator; - enum { padding = cds::opt::cache_line_padding }; - }; - typedef cds::container::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - - test(); - } - - void HdrSegmentedQueue::SegmQueue_DHP_stat_cacheline_padding() - { - struct queue_traits : public - cds::container::segmented_queue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - , cds::opt::stat < cds::container::segmented_queue::stat<> > - , cds::opt::padding< cds::opt::cache_line_padding > - > ::type - {}; - typedef cds::container::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type; - - test(); - } - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_segmented_queue_hp.cpp b/tests/test-hdr/queue/hdr_segmented_queue_hp.cpp deleted file mode 100644 index d45c0eb3..00000000 --- a/tests/test-hdr/queue/hdr_segmented_queue_hp.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_segmented_queue.h" -#include -#include - -namespace queue { - - void HdrSegmentedQueue::SegmQueue_HP() - { - typedef cds::container::SegmentedQueue< cds::gc::HP, item > queue_type; - test(); - } - - void HdrSegmentedQueue::SegmQueue_HP_mutex() - { - typedef cds::container::SegmentedQueue< cds::gc::HP, item, - cds::container::segmented_queue::make_traits< - cds::opt::lock_type< std::mutex > - >::type - > queue_type; - - test(); - } - - void HdrSegmentedQueue::SegmQueue_HP_shuffle() - { - struct queue_traits : public cds::container::segmented_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - typedef cds::opt::v::random_shuffle_permutation<> permutation_generator; - }; - typedef cds::container::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - - test(); - } - - void HdrSegmentedQueue::SegmQueue_HP_stat() - { - struct queue_traits : public - cds::container::segmented_queue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - , cds::opt::stat < cds::container::segmented_queue::stat<> > - > ::type - {}; - typedef cds::container::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - - test(); - } - - void HdrSegmentedQueue::SegmQueue_HP_cacheline_padding() - { - struct queue_traits : public cds::container::segmented_queue::traits - { - enum { padding = cds::opt::cache_line_padding }; - }; - - typedef cds::container::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - test(); - } - - void HdrSegmentedQueue::SegmQueue_HP_mutex_cacheline_padding() - { - typedef cds::container::SegmentedQueue< cds::gc::HP, item, - cds::container::segmented_queue::make_traits< - cds::opt::lock_type< std::mutex > - , cds::opt::padding< cds::opt::cache_line_padding > - >::type - > queue_type; - - test(); - } - - void HdrSegmentedQueue::SegmQueue_HP_shuffle_cacheline_padding() - { - struct queue_traits : public cds::container::segmented_queue::traits - { - typedef cds::atomicity::item_counter item_counter; - typedef cds::opt::v::random_shuffle_permutation<> permutation_generator; - enum { padding = cds::opt::cache_line_padding }; - }; - typedef cds::container::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - - test(); - } - - void HdrSegmentedQueue::SegmQueue_HP_stat_cacheline_padding() - { - struct queue_traits : public - cds::container::segmented_queue::make_traits < - cds::opt::item_counter< cds::atomicity::item_counter > - , cds::opt::permutation_generator< cds::opt::v::random_permutation<> > - , cds::opt::stat < cds::container::segmented_queue::stat<> > - , cds::opt::padding< cds::opt::cache_line_padding > - > ::type - {}; - typedef cds::container::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type; - - test(); - } - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_tsigas_cycle_queue.cpp b/tests/test-hdr/queue/hdr_tsigas_cycle_queue.cpp deleted file mode 100644 index 05f0bf54..00000000 --- a/tests/test-hdr/queue/hdr_tsigas_cycle_queue.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "hdr_queue.h" -#include - -namespace queue { - - void HdrTestQueue::TsigasCycleQueue_static() - { - struct queue_traits : public cds::container::tsigas_queue::traits - { - typedef cds::opt::v::static_buffer< int, 1024 > buffer; - typedef cds::opt::v::sequential_consistent memory_model; - }; - typedef cds::container::TsigasCycleQueue< int, queue_traits > queue_type; - - test_bounded_no_ic(); - } - - void HdrTestQueue::TsigasCycleQueue_static_ic() - { - struct queue_traits : public cds::container::tsigas_queue::traits - { - typedef cds::opt::v::static_buffer< int, 1024 > buffer; - typedef cds::atomicity::item_counter item_counter; - }; - typedef cds::container::TsigasCycleQueue< int, queue_traits > queue_type; - - test_bounded_ic(); - } - void HdrTestQueue::TsigasCycleQueue_dyn() - { - class queue_type - : public cds::container::TsigasCycleQueue< int, - typename cds::container::tsigas_queue::make_traits< - cds::opt::buffer< cds::opt::v::dynamic_buffer< int > > - >::type - > - { - typedef cds::container::TsigasCycleQueue< int, - typename cds::container::tsigas_queue::make_traits< - cds::opt::buffer< cds::opt::v::dynamic_buffer< int > > - >::type - > base_class; - public: - queue_type() - : base_class( 1024 ) - {} - }; - - test_bounded_no_ic(); - } - void HdrTestQueue::TsigasCycleQueue_dyn_ic() - { - class queue_type - : public cds::container::TsigasCycleQueue< int, - typename cds::container::tsigas_queue::make_traits< - cds::opt::buffer< cds::opt::v::dynamic_buffer< int > > - , cds::opt::item_counter< cds::atomicity::item_counter > - >::type - > - { - typedef cds::container::TsigasCycleQueue< int, - typename cds::container::tsigas_queue::make_traits< - cds::opt::buffer< cds::opt::v::dynamic_buffer< int > > - , cds::opt::item_counter< cds::atomicity::item_counter > - >::type - > base_class; - public: - queue_type() - : base_class( 1024 ) - {} - }; - - test_bounded_ic(); - } - -} // namespace queue diff --git a/tests/test-hdr/queue/hdr_vyukov_mpmc_cyclic.cpp b/tests/test-hdr/queue/hdr_vyukov_mpmc_cyclic.cpp deleted file mode 100644 index a5a5b590..00000000 --- a/tests/test-hdr/queue/hdr_vyukov_mpmc_cyclic.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include - -#include "queue/hdr_queue.h" - -namespace queue { - namespace{ - struct traits_VyukovMPMCCyclicQueue_static : public cds::container::vyukov_queue::traits - { - typedef cds::opt::v::static_buffer buffer; - }; - struct traits_VyukovMPMCCyclicQueue_static_ic : public traits_VyukovMPMCCyclicQueue_static - { - typedef cds::atomicity::item_counter item_counter; - }; - } - void HdrTestQueue::VyukovMPMCCycleQueue_static() - { - typedef cds::container::VyukovMPMCCycleQueue< int, traits_VyukovMPMCCyclicQueue_static > queue_type; - - test_bounded_no_ic< queue_type >(); - } - - void HdrTestQueue::VyukovMPMCCycleQueue_static_ic() - { - typedef cds::container::VyukovMPMCCycleQueue< int, traits_VyukovMPMCCyclicQueue_static_ic > queue_type; - test_bounded_ic< queue_type >(); - } - - void HdrTestQueue::VyukovMPMCCycleQueue_dyn() - { - class queue_type : public cds::container::VyukovMPMCCycleQueue < int > - { - typedef cds::container::VyukovMPMCCycleQueue < int > base_class; - public: - queue_type() : base_class( 1024 ) {} - }; - test_bounded_no_ic< queue_type >(); - } - - void HdrTestQueue::VyukovMPMCCycleQueue_dyn_ic() - { - class queue_type : - public cds::container::VyukovMPMCCycleQueue < int, - typename cds::container::vyukov_queue::make_traits < - cds::opt::item_counter < cds::atomicity::item_counter > - > ::type - > - { - typedef cds::container::VyukovMPMCCycleQueue < int, - typename cds::container::vyukov_queue::make_traits < - cds::opt::item_counter < cds::atomicity::item_counter > - > ::type - > base_class; - public: - queue_type() : base_class( 1024 ) {} - }; - test_bounded_ic< queue_type >(); - } - -} -- 2.34.1