From 14d138f34e64ba24f018c9550a22c15a03b41d1a Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 27 Feb 2016 09:52:44 +0300 Subject: [PATCH] Removed old tests --- build/Makefile | 18 +- projects/Win/vc14/cds.sln | 19 - projects/Win/vc14/unit-stack.vcxproj | 314 ----- projects/source.unit.stack.mk | 6 - tests/test-hdr/list/hdr_intrusive_lazy.h | 1096 ----------------- .../test-hdr/list/hdr_intrusive_lazy_dhp.cpp | 156 --- tests/test-hdr/list/hdr_intrusive_lazy_hp.cpp | 153 --- .../test-hdr/list/hdr_intrusive_lazy_nogc.cpp | 162 --- .../list/hdr_intrusive_lazy_nogc_unord.cpp | 194 --- .../list/hdr_intrusive_lazy_rcu_gpb.cpp | 160 --- .../list/hdr_intrusive_lazy_rcu_gpi.cpp | 161 --- .../list/hdr_intrusive_lazy_rcu_gpt.cpp | 161 --- .../list/hdr_intrusive_lazy_rcu_shb.cpp | 186 --- .../list/hdr_intrusive_lazy_rcu_sht.cpp | 179 --- tests/test-hdr/list/hdr_intrusive_michael.h | 938 -------------- .../list/hdr_intrusive_michael_dhp.cpp | 155 --- .../list/hdr_intrusive_michael_hp.cpp | 156 --- .../hdr_intrusive_michael_list_rcu_gpb.cpp | 160 --- .../hdr_intrusive_michael_list_rcu_gpi.cpp | 159 --- .../hdr_intrusive_michael_list_rcu_gpt.cpp | 160 --- .../hdr_intrusive_michael_list_rcu_shb.cpp | 178 --- .../hdr_intrusive_michael_list_rcu_sht.cpp | 178 --- .../list/hdr_intrusive_michael_nogc.cpp | 155 --- tests/test-hdr/list/hdr_lazy.h | 976 --------------- tests/test-hdr/list/hdr_lazy_dhp.cpp | 128 -- tests/test-hdr/list/hdr_lazy_hp.cpp | 130 -- tests/test-hdr/list/hdr_lazy_kv.h | 961 --------------- tests/test-hdr/list/hdr_lazy_kv_dhp.cpp | 128 -- tests/test-hdr/list/hdr_lazy_kv_hp.cpp | 132 -- tests/test-hdr/list/hdr_lazy_kv_nogc.cpp | 131 -- .../test-hdr/list/hdr_lazy_kv_nogc_unord.cpp | 159 --- tests/test-hdr/list/hdr_lazy_kv_rcu_gpb.cpp | 131 -- tests/test-hdr/list/hdr_lazy_kv_rcu_gpi.cpp | 131 -- tests/test-hdr/list/hdr_lazy_kv_rcu_gpt.cpp | 131 -- tests/test-hdr/list/hdr_lazy_kv_rcu_shb.cpp | 150 --- tests/test-hdr/list/hdr_lazy_kv_rcu_sht.cpp | 147 --- tests/test-hdr/list/hdr_lazy_nogc.cpp | 127 -- tests/test-hdr/list/hdr_lazy_nogc_unord.cpp | 180 --- tests/test-hdr/list/hdr_lazy_rcu_gpb.cpp | 131 -- tests/test-hdr/list/hdr_lazy_rcu_gpi.cpp | 131 -- tests/test-hdr/list/hdr_lazy_rcu_gpt.cpp | 131 -- tests/test-hdr/list/hdr_lazy_rcu_shb.cpp | 147 --- tests/test-hdr/list/hdr_lazy_rcu_sht.cpp | 147 --- tests/test-hdr/list/hdr_michael.h | 853 ------------- tests/test-hdr/list/hdr_michael_dhp.cpp | 128 -- tests/test-hdr/list/hdr_michael_hp.cpp | 130 -- tests/test-hdr/list/hdr_michael_kv.h | 773 ------------ tests/test-hdr/list/hdr_michael_kv_dhp.cpp | 128 -- tests/test-hdr/list/hdr_michael_kv_hp.cpp | 132 -- tests/test-hdr/list/hdr_michael_kv_nogc.cpp | 131 -- .../test-hdr/list/hdr_michael_kv_rcu_gpb.cpp | 130 -- .../test-hdr/list/hdr_michael_kv_rcu_gpi.cpp | 130 -- .../test-hdr/list/hdr_michael_kv_rcu_gpt.cpp | 130 -- .../test-hdr/list/hdr_michael_kv_rcu_shb.cpp | 145 --- .../test-hdr/list/hdr_michael_kv_rcu_sht.cpp | 145 --- tests/test-hdr/list/hdr_michael_nogc.cpp | 128 -- tests/test-hdr/list/hdr_michael_rcu_gpb.cpp | 132 -- tests/test-hdr/list/hdr_michael_rcu_gpi.cpp | 132 -- tests/test-hdr/list/hdr_michael_rcu_gpt.cpp | 132 -- tests/test-hdr/list/hdr_michael_rcu_shb.cpp | 147 --- tests/test-hdr/list/hdr_michael_rcu_sht.cpp | 147 --- tests/unit/CMakeLists.txt | 1 - tests/unit/stack/CMakeLists.txt | 10 - tests/unit/stack/intrusive_stack_defs.h | 169 --- tests/unit/stack/intrusive_stack_type.h | 424 ------- tests/unit/stack/stack_defs.h | 195 --- tests/unit/stack/stack_intrusive_pushpop.cpp | 404 ------ tests/unit/stack/stack_push.cpp | 238 ---- tests/unit/stack/stack_pushpop.cpp | 305 ----- tests/unit/stack/stack_type.h | 501 -------- 70 files changed, 2 insertions(+), 15651 deletions(-) delete mode 100644 projects/Win/vc14/unit-stack.vcxproj delete mode 100644 projects/source.unit.stack.mk delete mode 100644 tests/test-hdr/list/hdr_intrusive_lazy.h delete mode 100644 tests/test-hdr/list/hdr_intrusive_lazy_dhp.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_lazy_hp.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_lazy_nogc.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_lazy_nogc_unord.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpb.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpi.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpt.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_lazy_rcu_shb.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_lazy_rcu_sht.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_michael.h delete mode 100644 tests/test-hdr/list/hdr_intrusive_michael_dhp.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_michael_hp.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpb.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpi.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpt.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_michael_list_rcu_shb.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_michael_list_rcu_sht.cpp delete mode 100644 tests/test-hdr/list/hdr_intrusive_michael_nogc.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy.h delete mode 100644 tests/test-hdr/list/hdr_lazy_dhp.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_hp.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_kv.h delete mode 100644 tests/test-hdr/list/hdr_lazy_kv_dhp.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_kv_hp.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_kv_nogc.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_kv_nogc_unord.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_kv_rcu_gpb.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_kv_rcu_gpi.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_kv_rcu_gpt.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_kv_rcu_shb.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_kv_rcu_sht.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_nogc.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_nogc_unord.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_rcu_gpb.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_rcu_gpi.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_rcu_gpt.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_rcu_shb.cpp delete mode 100644 tests/test-hdr/list/hdr_lazy_rcu_sht.cpp delete mode 100644 tests/test-hdr/list/hdr_michael.h delete mode 100644 tests/test-hdr/list/hdr_michael_dhp.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_hp.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_kv.h delete mode 100644 tests/test-hdr/list/hdr_michael_kv_dhp.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_kv_hp.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_kv_nogc.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_kv_rcu_gpb.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_kv_rcu_gpi.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_kv_rcu_gpt.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_kv_rcu_shb.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_kv_rcu_sht.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_nogc.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_rcu_gpb.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_rcu_gpi.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_rcu_gpt.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_rcu_shb.cpp delete mode 100644 tests/test-hdr/list/hdr_michael_rcu_sht.cpp delete mode 100644 tests/unit/stack/CMakeLists.txt delete mode 100644 tests/unit/stack/intrusive_stack_defs.h delete mode 100644 tests/unit/stack/intrusive_stack_type.h delete mode 100644 tests/unit/stack/stack_defs.h delete mode 100644 tests/unit/stack/stack_intrusive_pushpop.cpp delete mode 100644 tests/unit/stack/stack_push.cpp delete mode 100644 tests/unit/stack/stack_pushpop.cpp delete mode 100644 tests/unit/stack/stack_type.h diff --git a/build/Makefile b/build/Makefile index 0cf129b6..2a0e1af4 100644 --- a/build/Makefile +++ b/build/Makefile @@ -152,10 +152,6 @@ include ../projects/source.unit.pqueue.mk CDSUNIT_PQUEUE_SOURCES := $(CDSUNIT_PQUEUE_SOURCES:%.cpp=../%.cpp) CDSUNIT_PQUEUE_OBJS := $(CDSUNIT_PQUEUE_SOURCES:%.cpp=%.o) -include ../projects/source.unit.stack.mk -CDSUNIT_STACK_SOURCES := $(CDSUNIT_STACK_SOURCES:%.cpp=../%.cpp) -CDSUNIT_STACK_OBJS := $(CDSUNIT_STACK_SOURCES:%.cpp=%.o) - include ../projects/source.unit.misc.mk CDSUNIT_MISC_SOURCES := $(CDSUNIT_MISC_SOURCES:%.cpp=../%.cpp) CDSUNIT_MISC_OBJS := $(CDSUNIT_MISC_SOURCES:%.cpp=%.o) @@ -172,15 +168,13 @@ CDSUNIT_MAP_EXE=$(BIN_PATH)/cdsu-map CDSUNIT_SET_EXE=$(BIN_PATH)/cdsu-set CDSUNIT_QUEUE_EXE=$(BIN_PATH)/cdsu-queue CDSUNIT_PQUEUE_EXE=$(BIN_PATH)/cdsu-pqueue -CDSUNIT_STACK_EXE=$(BIN_PATH)/cdsu-stack CDSUNIT_MISC_EXE=$(BIN_PATH)/cdsu-misc -CDSUNIT_EXE_FILES= $(CDSUNIT_MAP_EXE) $(CDSUNIT_SET_EXE) $(CDSUNIT_QUEUE_EXE) $(CDSUNIT_PQUEUE_EXE) $(CDSUNIT_STACK_EXE) $(CDSUNIT_MISC_EXE) +CDSUNIT_EXE_FILES= $(CDSUNIT_MAP_EXE) $(CDSUNIT_SET_EXE) $(CDSUNIT_QUEUE_EXE) $(CDSUNIT_PQUEUE_EXE) $(CDSUNIT_MISC_EXE) unit-map: $(CDSUNIT_MAP_EXE) unit-set: $(CDSUNIT_SET_EXE) unit-queue: $(CDSUNIT_QUEUE_EXE) unit-pqueue: $(CDSUNIT_PQUEUE_EXE) -unit-stack: $(CDSUNIT_STACK_EXE) ifeq ($(platform),mingw) make_test : $(BIN_PATH)/test-hdr $(CDSUNIT_EXE_FILES) @@ -209,9 +203,6 @@ $(CDSUNIT_QUEUE_EXE) : $(CDSUNIT_QUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMO $(CDSUNIT_PQUEUE_EXE) : $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) $(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_LIBS) $(LDLIBS) -$(CDSUNIT_STACK_EXE) : $(CDSUNIT_STACK_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) - $(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_STACK_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_LIBS) $(LDLIBS) - $(CDSUNIT_MISC_EXE) : $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) $(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_LIBS) $(LDLIBS) @@ -220,16 +211,14 @@ CDSUNIT_MAP_EXE_DBG=$(CDSUNIT_MAP_EXE)-d CDSUNIT_SET_EXE_DBG=$(CDSUNIT_SET_EXE)-d CDSUNIT_QUEUE_EXE_DBG=$(CDSUNIT_QUEUE_EXE)-d CDSUNIT_PQUEUE_EXE_DBG=$(CDSUNIT_PQUEUE_EXE)-d -CDSUNIT_STACK_EXE_DBG=$(CDSUNIT_STACK_EXE)-d CDSUNIT_MISC_EXE_DBG=$(CDSUNIT_MISC_EXE)-d CDSUNIT_EXE_DBG_FILES= $(CDSUNIT_MAP_EXE_DBG) $(CDSUNIT_SET_EXE_DBG) $(CDSUNIT_QUEUE_EXE_DBG) $(CDSUNIT_PQUEUE_EXE_DBG) \ - $(CDSUNIT_STACK_EXE_DBG) $(CDSUNIT_MISC_EXE_DBG) + $(CDSUNIT_MISC_EXE_DBG) unit-map-dbg: $(CDSUNIT_MAP_EXE_DBG) unit-set-dbg: $(CDSUNIT_SET_EXE_DBG) unit-queue-dbg: $(CDSUNIT_QUEUE_EXE_DBG) unit-pqueue-dbg: $(CDSUNIT_PQUEUE_EXE_DBG) -unit-stack-dbg: $(CDSUNIT_STACK_EXE_DBG) ifeq ($(platform),mingw) make_debug_test : $(BIN_PATH)/test-hdr-debug $(CDSUNIT_EXE_DBG_FILES) @@ -258,9 +247,6 @@ $(CDSUNIT_QUEUE_EXE_DBG) : $(CDSUNIT_QUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_C $(CDSUNIT_PQUEUE_EXE_DBG) : $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) $(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_DEBUG_LIBS) $(LDLIBS) -$(CDSUNIT_STACK_EXE_DBG) : $(CDSUNIT_STACK_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) - $(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_STACK_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_DEBUG_LIBS) $(LDLIBS) - $(CDSUNIT_MISC_EXE_DBG) : $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) $(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_DEBUG_LIBS) $(LDLIBS) diff --git a/projects/Win/vc14/cds.sln b/projects/Win/vc14/cds.sln index dd3385d2..8c1b24bf 100644 --- a/projects/Win/vc14/cds.sln +++ b/projects/Win/vc14/cds.sln @@ -35,12 +35,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit-queue", "unit-queue.vc {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit-stack", "unit-stack.vcxproj", "{E29DE1F7-AE8D-4AE6-98B1-147E5103D974}" - 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("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "single-threaded test", "single-threaded test", "{B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}" ProjectSection(SolutionItems) = preProject ..\..\..\tests\test-hdr\size_check.h = ..\..\..\tests\test-hdr\size_check.h @@ -268,18 +262,6 @@ Global {6C15AF8A-4A99-49F9-BCF0-1BF36771099A}.Release|Win32.Build.0 = Release|Win32 {6C15AF8A-4A99-49F9-BCF0-1BF36771099A}.Release|x64.ActiveCfg = Release|x64 {6C15AF8A-4A99-49F9-BCF0-1BF36771099A}.Release|x64.Build.0 = Release|x64 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Debug|Win32.ActiveCfg = Debug|Win32 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Debug|Win32.Build.0 = Debug|Win32 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Debug|x64.ActiveCfg = Debug|x64 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Debug|x64.Build.0 = Debug|x64 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.DebugVLD|Win32.ActiveCfg = Debug|Win32 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.DebugVLD|Win32.Build.0 = Debug|Win32 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.DebugVLD|x64.ActiveCfg = DebugVLD|x64 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.DebugVLD|x64.Build.0 = DebugVLD|x64 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Release|Win32.ActiveCfg = Release|Win32 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Release|Win32.Build.0 = Release|Win32 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Release|x64.ActiveCfg = Release|x64 - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974}.Release|x64.Build.0 = Release|x64 {282E9A9A-386A-40FB-A483-994BACE24830}.Debug|Win32.ActiveCfg = Debug|Win32 {282E9A9A-386A-40FB-A483-994BACE24830}.Debug|Win32.Build.0 = Debug|Win32 {282E9A9A-386A-40FB-A483-994BACE24830}.Debug|x64.ActiveCfg = Debug|x64 @@ -540,7 +522,6 @@ Global {61179F2F-07E1-490D-B64D-D85A90B6EF81} = {B30CA283-1796-4763-92C3-2E4848D443F7} {77350FDC-9E51-438B-9A8F-D2FEA11D46B2} = {B30CA283-1796-4763-92C3-2E4848D443F7} {6C15AF8A-4A99-49F9-BCF0-1BF36771099A} = {B30CA283-1796-4763-92C3-2E4848D443F7} - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974} = {B30CA283-1796-4763-92C3-2E4848D443F7} {282E9A9A-386A-40FB-A483-994BACE24830} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75} {C5E76975-B87B-4B9E-8596-B01DDA683FCA} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75} {6BB7A27F-FC59-4267-B6FA-D034176D1459} = {B30CA283-1796-4763-92C3-2E4848D443F7} diff --git a/projects/Win/vc14/unit-stack.vcxproj b/projects/Win/vc14/unit-stack.vcxproj deleted file mode 100644 index eeda16e5..00000000 --- a/projects/Win/vc14/unit-stack.vcxproj +++ /dev/null @@ -1,314 +0,0 @@ - - - - - DebugVLD - Win32 - - - DebugVLD - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {E29DE1F7-AE8D-4AE6-98B1-147E5103D974} - unitstack - Win32Proj - 8.1 - - - - Application - Unicode - true - v140 - - - Application - Unicode - v140 - - - Application - Unicode - v140 - - - Application - Unicode - true - v140 - - - Application - Unicode - v140 - - - Application - Unicode - v140 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - 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 - 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\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - MachineX86 - MultiplyDefinedSymbolOnly - - - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - MachineX86 - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - MachineX64 - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - MachineX64 - MultiplyDefinedSymbolOnly - - - - - /bigobj /Zc:inline %(AdditionalOptions) - MaxSpeed - AnySuitable - true - Speed - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - 4520 - - - unit-prerequisites.lib;%(AdditionalDependencies) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - true - true - MachineX86 - $(TargetPath) - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - MaxSpeed - AnySuitable - true - Speed - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - 4520 - - - unit-prerequisites.lib;%(AdditionalDependencies) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - true - true - MachineX64 - $(TargetPath) - MultiplyDefinedSymbolOnly - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/projects/source.unit.stack.mk b/projects/source.unit.stack.mk deleted file mode 100644 index a78ba9d9..00000000 --- a/projects/source.unit.stack.mk +++ /dev/null @@ -1,6 +0,0 @@ - -CDSUNIT_STACK_SOURCES := \ - tests/unit/stack/stack_push.cpp \ - tests/unit/stack/stack_pushpop.cpp \ - tests/unit/stack/stack_intrusive_pushpop.cpp - diff --git a/tests/test-hdr/list/hdr_intrusive_lazy.h b/tests/test-hdr/list/hdr_intrusive_lazy.h deleted file mode 100644 index 79de4ba2..00000000 --- a/tests/test-hdr/list/hdr_intrusive_lazy.h +++ /dev/null @@ -1,1096 +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_LAZY_H -#define CDSTEST_HDR_INTRUSIVE_LAZY_H - -#include "cppunit/cppunit_proxy.h" -#include - -namespace ordlist { - namespace ci = cds::intrusive; - namespace co = cds::opt; - - class IntrusiveLazyListHeaderTest: public CppUnitMini::TestCase - { - public: - - struct stat { - int nDisposeCount; - int nUpdateExistsCall; - int nUpdateNewCall; - int nFindCall; - int nEraseCall; - - stat() - : nDisposeCount(0) - , nUpdateExistsCall(0) - , nUpdateNewCall(0) - , nFindCall(0) - , nEraseCall(0) - {} - - stat( const stat& s ) - { - *this = s; - } - - stat& operator =(const stat& s) - { - memcpy( this, &s, sizeof(s)); - return *this; - } - }; - - template - struct base_int_item: public ci::lazy_list::node< GC > - { - int nKey; - int nVal; - - mutable stat s; - - base_int_item() - {} - - base_int_item(int key, int val) - : nKey( key ) - , nVal(val) - , s() - {} - - base_int_item(const base_int_item& v ) - : nKey( v.nKey ) - , nVal( v.nVal ) - , s() - {} - - const int& key() const - { - return nKey; - } - }; - - template - struct member_int_item - { - int nKey; - int nVal; - - ci::lazy_list::node< GC > hMember; - - mutable stat s; - - member_int_item() - {} - - member_int_item(int key, int val) - : nKey( key ) - , nVal(val) - , s() - {} - - member_int_item(const member_int_item& v ) - : nKey( v.nKey ) - , nVal( v.nVal ) - , s() - {} - - const int& key() const - { - return nKey; - } - }; - - template - struct less - { - bool operator ()(const T& v1, const T& v2 ) const - { - return v1.key() < v2.key(); - } - - template - bool operator ()(const T& v1, const Q& v2 ) const - { - return v1.key() < v2; - } - - template - bool operator ()(const Q& v1, const T& v2 ) const - { - return v1 < v2.key(); - } - }; - - template - struct cmp { - int operator ()(const T& v1, const T& v2 ) const - { - if ( v1.key() < v2.key() ) - return -1; - return v1.key() > v2.key() ? 1 : 0; - } - - template - int operator ()(const T& v1, const Q& v2 ) const - { - if ( v1.key() < v2 ) - return -1; - return v1.key() > v2 ? 1 : 0; - } - - template - int operator ()(const Q& v1, const T& v2 ) const - { - if ( v1 < v2.key() ) - return -1; - return v1 > v2.key() ? 1 : 0; - } - }; - - template - struct equal_to { - bool operator ()(const T& v1, const T& v2 ) const - { - return v1.key() == v2.key(); - } - - template - bool operator ()(const T& v1, const Q& v2 ) const - { - return v1.key() == v2; - } - - template - bool operator ()(const Q& v1, const T& v2 ) const - { - return v1 == v2.key(); - } - }; - - struct other_item { - int nKey; - - other_item( int n ) - : nKey(n) - {} - }; - - struct other_less { - template - bool operator()( T const& i1, Q const& i2) const - { - return i1.nKey < i2.nKey; - } - }; - - struct other_equal { - template - bool operator()( T const& i1, Q const& i2) const - { - return i1.nKey == i2.nKey; - } - }; - - struct faked_disposer - { - template - void operator ()( T * p ) - { - ++p->s.nDisposeCount; - } - }; - - struct update_functor - { - template - void operator ()(bool bNew, T& item, T& /*val*/ ) - { - if ( bNew ) - ++item.s.nUpdateNewCall; - else - ++item.s.nUpdateExistsCall; - } - }; - - struct find_functor - { - template - void operator ()( T& item, Q& /*val*/ ) - { - ++item.s.nFindCall; - } - }; - - struct erase_functor - { - template - void operator()( T const& item ) - { - item.s.nEraseCall++; - } - }; - - template - void test_int_common() - { - typedef typename OrdList::value_type value_type; - - value_type v1( 10, 50 ); - value_type v2( 5, 25 ); - value_type v3( 20, 100 ); - { - OrdList l; - CPPUNIT_ASSERT( l.empty() ); - - CPPUNIT_ASSERT( l.insert( v1 )) ; // true - CPPUNIT_ASSERT( l.contains( v1.key() )); - - CPPUNIT_ASSERT( v1.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); - CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( !l.contains( v2.key(), less() )); - CPPUNIT_ASSERT( !l.find( v3.key(), find_functor() )); - CPPUNIT_ASSERT( !l.empty() ); - - //CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is raised - - { - value_type v( v1 ); - CPPUNIT_ASSERT( !l.insert( v )) ; // false - } - - std::pair ret = l.update( v2, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 ); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 ); - - //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty" - - CPPUNIT_ASSERT( l.contains( v1.key() )) ; // true - - CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); - CPPUNIT_ASSERT( v1.s.nFindCall == 2 ); - - CPPUNIT_ASSERT( l.contains( v2.key() )); - - CPPUNIT_ASSERT( v2.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find_with( v2.key(), less(), find_functor() )); - CPPUNIT_ASSERT( v2.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( !l.contains( v3.key() )); - - { - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 ); - - value_type v( v2 ); - ret = l.update( v, update_functor() ); - - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( !ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 1 ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 ); - CPPUNIT_ASSERT( v.s.nUpdateExistsCall == 0 ); - CPPUNIT_ASSERT( v.s.nUpdateNewCall == 0 ); - } - - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.insert( v3 )) ; // true - CPPUNIT_ASSERT( l.contains( v3.key() )); - - CPPUNIT_ASSERT( v3.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v3.key(), find_functor() )); - CPPUNIT_ASSERT( v3.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( l.unlink( v2 ) ); - CPPUNIT_ASSERT( l.contains( v1.key() )) ; // true - CPPUNIT_ASSERT( !l.contains( v2.key() )) ; // true - CPPUNIT_ASSERT( l.contains( v3.key() )) ; // true - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( !l.unlink( v2 ) ); - - { - // v1 key is in the list but v NODE is not in the list - value_type v( v1 ); - CPPUNIT_ASSERT( !l.unlink( v ) ); - } - - CPPUNIT_ASSERT( l.unlink( v1 ) ); - CPPUNIT_ASSERT( !l.unlink( v1 ) ); - CPPUNIT_ASSERT( !l.contains( v1.key() )); - CPPUNIT_ASSERT( !l.contains( v2.key() )); - CPPUNIT_ASSERT( l.contains( v3.key() )); - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( !l.unlink( v1 ) ); - CPPUNIT_ASSERT( !l.unlink( v2 ) ); - - CPPUNIT_ASSERT( l.unlink( v3 ) ); - CPPUNIT_ASSERT( !l.contains( v1.key() )); - CPPUNIT_ASSERT( !l.contains( v2.key(), less() )); - CPPUNIT_ASSERT( !l.contains( v3.key() )); - CPPUNIT_ASSERT( l.empty() ); - CPPUNIT_ASSERT( !l.unlink( v1 ) ); - CPPUNIT_ASSERT( !l.unlink( v2 ) ); - CPPUNIT_ASSERT( !l.unlink( v3 ) ); - - // Apply retired pointer to clean links - OrdList::gc::force_dispose(); - - stat s( v3.s ); - ret = l.update( v3, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v3.s.nUpdateNewCall == s.nUpdateNewCall + 1); - CPPUNIT_ASSERT( v3.s.nUpdateExistsCall == s.nUpdateExistsCall ); - CPPUNIT_ASSERT( !l.empty() ); - - s = v2.s; - ret = l.update( v2, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == s.nUpdateNewCall + 1); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == s.nUpdateExistsCall ); - CPPUNIT_ASSERT( !l.empty() ); - - s = v1.s; - ret = l.update( v1, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v1.s.nUpdateNewCall == s.nUpdateNewCall + 1); - CPPUNIT_ASSERT( v1.s.nUpdateExistsCall == s.nUpdateExistsCall ); - CPPUNIT_ASSERT( !l.empty() ); - - // Erase test - CPPUNIT_ASSERT( l.erase( v1.key()) ); - //CPPUNIT_ASSERT( v1.s.nDisposeCount == 0 ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( v2.s.nEraseCall == 0 ); - CPPUNIT_ASSERT( l.erase_with( v2.key(), less(), erase_functor()) ); - CPPUNIT_ASSERT( v2.s.nEraseCall == 1 ); - CPPUNIT_ASSERT( !l.erase_with( v2.key(), less())); - CPPUNIT_ASSERT( v2.s.nEraseCall == 1 ); - //CPPUNIT_ASSERT( v2.s.nDisposeCount == 0 ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( !l.erase( v2 )); - CPPUNIT_ASSERT( !l.erase( v1 )); - //CPPUNIT_ASSERT( v2.s.nDisposeCount == 0 ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( v3.s.nEraseCall == 0 ); - CPPUNIT_ASSERT( l.erase( v3, erase_functor() )); - CPPUNIT_ASSERT( v3.s.nEraseCall == 1 ); - //CPPUNIT_ASSERT( v3.s.nDisposeCount == 0 ); - CPPUNIT_ASSERT( l.empty() ); - - // Apply retired pointer to clean links - OrdList::gc::force_dispose(); - - // Unlink test - CPPUNIT_ASSERT( l.insert( v1 )); - CPPUNIT_ASSERT( l.insert( v3 )); - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( !l.unlink( v2 )); - CPPUNIT_ASSERT( l.unlink( v1 )); - CPPUNIT_ASSERT( !l.unlink( v1 )); - CPPUNIT_ASSERT( l.unlink( v3 )); - CPPUNIT_ASSERT( !l.unlink( v3 )); - CPPUNIT_ASSERT( l.empty() ); - - // Apply retired pointer - OrdList::gc::force_dispose(); - CPPUNIT_ASSERT( v1.s.nDisposeCount == 3 ); - CPPUNIT_ASSERT( v2.s.nDisposeCount == 2 ); - CPPUNIT_ASSERT( v3.s.nDisposeCount == 3 ); - - // Destructor test (call disposer) - CPPUNIT_ASSERT( l.insert( v1 )); - CPPUNIT_ASSERT( l.insert( v3 )); - CPPUNIT_ASSERT( l.insert( v2 )); - - // Iterator test - { - typename OrdList::iterator it = l.begin(); - typename OrdList::const_iterator cit = l.cbegin(); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it != l.cend() ); - CPPUNIT_ASSERT( cit != l.end() ); - CPPUNIT_ASSERT( cit != l.cend() ); - CPPUNIT_ASSERT( cit == it ); - - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( ++it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( ++it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( ++it == l.end() ); - } - - { - OrdList const & lref = l; - typename OrdList::const_iterator it = lref.begin(); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( ++it != lref.end() ); - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( ++it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( ++it == l.end() ); - } - } - - // Apply retired pointer - OrdList::gc::force_dispose(); - - CPPUNIT_ASSERT( v1.s.nDisposeCount == 4 ); - CPPUNIT_ASSERT( v2.s.nDisposeCount == 3 ); - CPPUNIT_ASSERT( v3.s.nDisposeCount == 4 ); - } - - template - void test_int() - { - test_int_common(); - - OrdList l; - typename OrdList::guarded_ptr gp; - - static int const nLimit = 20; - typename OrdList::value_type arrItem[nLimit]; - - { - int a[nLimit]; - for (int i = 0; i < nLimit; ++i) - a[i]=i; - shuffle( a, a + nLimit ); - - for (int i = 0; i < nLimit; ++i) { - arrItem[i].nKey = a[i]; - arrItem[i].nVal = a[i] * 2; - } - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - CPPUNIT_ASSERT( l.insert( arrItem[i] ) ); - - for ( int i=0; i < nLimit; ++i ) { - gp = l.get( arrItem[i].nKey ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey ); - CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal ); - - gp = l.extract( arrItem[i].nKey ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey ); - CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal ); - - gp = l.get( arrItem[i].nKey ); - CPPUNIT_ASSERT( !gp ); - CPPUNIT_ASSERT( gp.empty()); - CPPUNIT_ASSERT( !l.extract( arrItem[i].nKey )); - CPPUNIT_ASSERT( gp.empty()); - } - CPPUNIT_ASSERT( l.empty() ); - CPPUNIT_ASSERT( !l.get( nLimit/2 )); - CPPUNIT_ASSERT( !l.extract( nLimit/2 )); - - // Apply retired pointer - OrdList::gc::force_dispose(); - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) - CPPUNIT_ASSERT( l.insert( arrItem[i] ) ); - - for ( int i=0; i < nLimit; ++i ) { - other_item itm( arrItem[i].nKey ); - gp = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey ); - CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal ); - - gp = l.extract_with( itm, other_less() ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey ); - CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal ); - - gp = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( !gp ); - CPPUNIT_ASSERT( gp.empty()); - CPPUNIT_ASSERT( !l.extract_with( itm, other_less() )); - CPPUNIT_ASSERT( gp.empty()); - } - CPPUNIT_ASSERT( l.empty() ); - CPPUNIT_ASSERT( !l.get_with( other_item(nLimit/2), other_less() )); - CPPUNIT_ASSERT( gp.empty()); - CPPUNIT_ASSERT( !l.extract_with( other_item(nLimit/2), other_less() )); - CPPUNIT_ASSERT( gp.empty()); - - // Apply retired pointer - OrdList::gc::force_dispose(); - - for ( int i=0; i < nLimit; i++ ) { - CPPUNIT_ASSERT( arrItem[i].s.nDisposeCount == 2 ); - } - } - } - - template - void test_rcu_int() - { - test_int_common(); - - OrdList l; - static int const nLimit = 20; - typename OrdList::value_type arrItem[nLimit]; - - typedef typename OrdList::rcu_lock rcu_lock; - typedef typename OrdList::value_type value_type; - typedef typename OrdList::gc rcu_type; - - { - int a[nLimit]; - for (int i = 0; i < nLimit; ++i) - a[i]=i; - shuffle( a, a + nLimit ); - - for (int i = 0; i < nLimit; ++i) { - arrItem[i].nKey = a[i]; - arrItem[i].nVal = a[i] * 2; - } - - typename OrdList::exempt_ptr ep; - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - CPPUNIT_ASSERT( l.insert( arrItem[i] ) ); - - for ( int i = 0; i < nLimit; ++i ) { - { - rcu_lock lock; - value_type * pGet = l.get( a[i] ); - CPPUNIT_ASSERT( pGet != nullptr ); - CPPUNIT_CHECK( pGet->nKey == a[i] ); - CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); - - ep = l.extract( a[i] ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->nKey == a[i] ); - CPPUNIT_CHECK( (*ep).nVal == a[i] * 2 ); - } - ep.release(); - { - rcu_lock lock; - CPPUNIT_CHECK( l.get( a[i] ) == nullptr ); - CPPUNIT_CHECK( !l.extract( a[i] ) ); - CPPUNIT_CHECK( ep.empty() ); - } - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( l.get( a[0] ) == nullptr ); - ep = l.extract( a[0] ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - // Apply retired pointer - OrdList::gc::force_dispose(); - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) { - CPPUNIT_ASSERT( l.insert( arrItem[i] ) ); - } - - for ( int i = 0; i < nLimit; ++i ) { - other_item itm( a[i] ); - { - rcu_lock lock; - value_type * pGet = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( pGet != nullptr ); - CPPUNIT_CHECK( pGet->nKey == a[i] ); - CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); - - ep = l.extract_with( itm, other_less() ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->nKey == a[i] ); - CPPUNIT_CHECK( ep->nVal == a[i] * 2 ); - } - ep.release(); - { - rcu_lock lock; - CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr ); - ep = l.extract_with( itm, other_less() ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( l.get_with( other_item( 0 ), other_less() ) == nullptr ); - CPPUNIT_CHECK( !l.extract_with( other_item(0), other_less() )); - CPPUNIT_CHECK( ep.empty() ); - } - // Apply retired pointer - OrdList::gc::force_dispose(); - } - } - - template - void test_nogc_int() - { - typedef typename OrdList::value_type value_type; - - { - value_type v1( 10, 50 ); - value_type v2( 5, 25 ); - value_type v3( 20, 100 ); - { - OrdList l; - CPPUNIT_ASSERT( l.empty() ); - - CPPUNIT_ASSERT( l.insert( v1 )) ; // true - CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 ); - - CPPUNIT_ASSERT( v1.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); - CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( l.contains( v2.key(), less() ) == nullptr ); - CPPUNIT_ASSERT( l.contains( v3.key() ) == nullptr ); - CPPUNIT_ASSERT( !l.empty() ); - - //CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is raised - - { - value_type v( v1 ); - CPPUNIT_ASSERT( !l.insert( v )) ; // false - } - - std::pair ret = l.update( v2, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 ); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 ); - - //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty" - - CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 ) ; // true - - CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); - CPPUNIT_ASSERT( v1.s.nFindCall == 2 ); - - CPPUNIT_ASSERT( l.contains( v2.key(), less() ) == &v2 ); - - CPPUNIT_ASSERT( v2.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find_with( v2.key(), less(), find_functor() )); - CPPUNIT_ASSERT( v2.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( !l.contains( v3.key() )); - - { - value_type v( v2 ); - ret = l.update( v, update_functor() ); - - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( !ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 1 ); - CPPUNIT_ASSERT( v.s.nUpdateExistsCall == 0 && v.s.nUpdateNewCall == 0 ); - } - - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.insert( v3 )) ; // true - CPPUNIT_ASSERT( l.contains( v3.key() ) == &v3 ); - - CPPUNIT_ASSERT( v3.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v3.key(), find_functor() )); - CPPUNIT_ASSERT( v3.s.nFindCall == 1 ); - - { - typename OrdList::iterator it = l.begin(); - typename OrdList::const_iterator cit = l.cbegin(); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it != l.cend() ); - CPPUNIT_ASSERT( cit != l.end() ); - CPPUNIT_ASSERT( cit != l.cend() ); - CPPUNIT_ASSERT( cit == it ); - - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( ++it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( it++ != l.end() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( it++ != l.end() ); - CPPUNIT_ASSERT( it == l.end() ); - } - - { - OrdList const & lref = l; - typename OrdList::const_iterator it = lref.begin(); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( ++it != lref.end() ); - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( it++ != l.end() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( it++ != lref.end() ); - CPPUNIT_ASSERT( it == l.end() ); - } - } - - // Disposer called on list destruction - CPPUNIT_ASSERT( v1.s.nDisposeCount == 1 ); - CPPUNIT_ASSERT( v2.s.nDisposeCount == 1 ); - CPPUNIT_ASSERT( v3.s.nDisposeCount == 1 ); - } - } - - template - void test_nogc_int_unordered() - { - typedef typename UnordList::value_type value_type; - { - value_type v1( 10, 50 ); - value_type v2( 5, 25 ); - value_type v3( 20, 100 ); - { - UnordList l; - CPPUNIT_ASSERT( l.empty() ); - - CPPUNIT_ASSERT( l.insert( v1 )); // true - CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 ); - - CPPUNIT_ASSERT( v1.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); - CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( l.contains( v2.key(), equal_to() ) == nullptr ); - CPPUNIT_ASSERT( l.contains( v3.key() ) == nullptr ); - CPPUNIT_ASSERT( !l.empty() ); - - //CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is raised - - { - value_type v( v1 ); - CPPUNIT_ASSERT( !l.insert( v )) ; // false - } - - std::pair ret = l.update( v2, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 ); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 ); - - //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty" - - CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 ) ; // true - - CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); - CPPUNIT_ASSERT( v1.s.nFindCall == 2 ); - - CPPUNIT_ASSERT( l.contains( v2.key(), equal_to() ) == &v2 ); - - CPPUNIT_ASSERT( v2.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find_with( v2.key(), equal_to(), find_functor() )); - CPPUNIT_ASSERT( v2.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( !l.contains( v3.key() )); - - { - value_type v( v2 ); - ret = l.update( v, update_functor() ); - - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( !ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 1 ); - CPPUNIT_ASSERT( v.s.nUpdateExistsCall == 0 && v.s.nUpdateNewCall == 0 ); - } - - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.insert( v3 )) ; // true - CPPUNIT_ASSERT( l.contains( v3.key() ) == &v3 ); - - CPPUNIT_ASSERT( v3.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v3.key(), find_functor() )); - CPPUNIT_ASSERT( v3.s.nFindCall == 1 ); - - { - typename UnordList::iterator it = l.begin(); - typename UnordList::const_iterator cit = l.cbegin(); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it != l.cend() ); - CPPUNIT_ASSERT( cit != l.end() ); - CPPUNIT_ASSERT( cit != l.cend() ); - CPPUNIT_ASSERT( cit == it ); - - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( ++it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( it++ != l.end() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( it++ != l.end() ); - CPPUNIT_ASSERT( it == l.end() ); - } - - { - UnordList const & lref = l; - typename UnordList::const_iterator it = lref.begin(); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( ++it != lref.end() ); - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( it++ != l.end() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( it++ != lref.end() ); - CPPUNIT_ASSERT( it == l.end() ); - } - } - - // Disposer called on list destruction - CPPUNIT_ASSERT( v1.s.nDisposeCount == 1 ); - CPPUNIT_ASSERT( v2.s.nDisposeCount == 1 ); - CPPUNIT_ASSERT( v3.s.nDisposeCount == 1 ); - } - } - - - void HP_base_cmp(); - void HP_base_less(); - void HP_base_cmpmix(); - void HP_base_ic(); - void HP_member_cmp(); - void HP_member_less(); - void HP_member_cmpmix(); - void HP_member_ic(); - - void DHP_base_cmp(); - void DHP_base_less(); - void DHP_base_cmpmix(); - void DHP_base_ic(); - void DHP_member_cmp(); - void DHP_member_less(); - void DHP_member_cmpmix(); - void DHP_member_ic(); - - void RCU_GPI_base_cmp(); - void RCU_GPI_base_less(); - void RCU_GPI_base_cmpmix(); - void RCU_GPI_base_ic(); - void RCU_GPI_member_cmp(); - void RCU_GPI_member_less(); - void RCU_GPI_member_cmpmix(); - void RCU_GPI_member_ic(); - - void RCU_GPB_base_cmp(); - void RCU_GPB_base_less(); - void RCU_GPB_base_cmpmix(); - void RCU_GPB_base_ic(); - void RCU_GPB_member_cmp(); - void RCU_GPB_member_less(); - void RCU_GPB_member_cmpmix(); - void RCU_GPB_member_ic(); - - void RCU_GPT_base_cmp(); - void RCU_GPT_base_less(); - void RCU_GPT_base_cmpmix(); - void RCU_GPT_base_ic(); - void RCU_GPT_member_cmp(); - void RCU_GPT_member_less(); - void RCU_GPT_member_cmpmix(); - void RCU_GPT_member_ic(); - - void RCU_SHB_base_cmp(); - void RCU_SHB_base_less(); - void RCU_SHB_base_cmpmix(); - void RCU_SHB_base_ic(); - void RCU_SHB_member_cmp(); - void RCU_SHB_member_less(); - void RCU_SHB_member_cmpmix(); - void RCU_SHB_member_ic(); - - void RCU_SHT_base_cmp(); - void RCU_SHT_base_less(); - void RCU_SHT_base_cmpmix(); - void RCU_SHT_base_ic(); - void RCU_SHT_member_cmp(); - void RCU_SHT_member_less(); - void RCU_SHT_member_cmpmix(); - void RCU_SHT_member_ic(); - - void nogc_base_cmp(); - void nogc_base_less(); - void nogc_base_cmpmix(); - void nogc_base_ic(); - void nogc_member_cmp(); - void nogc_member_less(); - void nogc_member_cmpmix(); - void nogc_member_ic(); - - void nogc_base_cmp_unord(); - void nogc_base_less_unord(); - void nogc_base_equal_to_unord(); - void nogc_base_cmpmix_unord(); - void nogc_base_equal_to_mix_unord(); - void nogc_base_ic_unord(); - void nogc_member_cmp_unord(); - void nogc_member_less_unord(); - void nogc_member_equal_to_unord(); - void nogc_member_cmpmix_unord(); - void nogc_member_equal_to_mix_unord(); - void nogc_member_ic_unord(); - - CPPUNIT_TEST_SUITE(IntrusiveLazyListHeaderTest) - CPPUNIT_TEST(HP_base_cmp) - CPPUNIT_TEST(HP_base_less) - CPPUNIT_TEST(HP_base_cmpmix) - CPPUNIT_TEST(HP_base_ic) - CPPUNIT_TEST(HP_member_cmp) - CPPUNIT_TEST(HP_member_less) - CPPUNIT_TEST(HP_member_cmpmix) - CPPUNIT_TEST(HP_member_ic) - - CPPUNIT_TEST(DHP_base_cmp) - CPPUNIT_TEST(DHP_base_less) - CPPUNIT_TEST(DHP_base_cmpmix) - CPPUNIT_TEST(DHP_base_ic) - CPPUNIT_TEST(DHP_member_cmp) - CPPUNIT_TEST(DHP_member_less) - CPPUNIT_TEST(DHP_member_cmpmix) - CPPUNIT_TEST(DHP_member_ic) - - CPPUNIT_TEST(RCU_GPI_base_cmp) - CPPUNIT_TEST(RCU_GPI_base_less) - CPPUNIT_TEST(RCU_GPI_base_cmpmix) - CPPUNIT_TEST(RCU_GPI_base_ic) - CPPUNIT_TEST(RCU_GPI_member_cmp) - CPPUNIT_TEST(RCU_GPI_member_less) - CPPUNIT_TEST(RCU_GPI_member_cmpmix) - CPPUNIT_TEST(RCU_GPI_member_ic) - - CPPUNIT_TEST(RCU_GPB_base_cmp) - CPPUNIT_TEST(RCU_GPB_base_less) - CPPUNIT_TEST(RCU_GPB_base_cmpmix) - CPPUNIT_TEST(RCU_GPB_base_ic) - CPPUNIT_TEST(RCU_GPB_member_cmp) - CPPUNIT_TEST(RCU_GPB_member_less) - CPPUNIT_TEST(RCU_GPB_member_cmpmix) - CPPUNIT_TEST(RCU_GPB_member_ic) - - CPPUNIT_TEST(RCU_GPT_base_cmp) - CPPUNIT_TEST(RCU_GPT_base_less) - CPPUNIT_TEST(RCU_GPT_base_cmpmix) - CPPUNIT_TEST(RCU_GPT_base_ic) - CPPUNIT_TEST(RCU_GPT_member_cmp) - CPPUNIT_TEST(RCU_GPT_member_less) - CPPUNIT_TEST(RCU_GPT_member_cmpmix) - CPPUNIT_TEST(RCU_GPT_member_ic) - - CPPUNIT_TEST(RCU_SHB_base_cmp) - CPPUNIT_TEST(RCU_SHB_base_less) - CPPUNIT_TEST(RCU_SHB_base_cmpmix) - CPPUNIT_TEST(RCU_SHB_base_ic) - CPPUNIT_TEST(RCU_SHB_member_cmp) - CPPUNIT_TEST(RCU_SHB_member_less) - CPPUNIT_TEST(RCU_SHB_member_cmpmix) - CPPUNIT_TEST(RCU_SHB_member_ic) - - CPPUNIT_TEST(RCU_SHT_base_cmp) - CPPUNIT_TEST(RCU_SHT_base_less) - CPPUNIT_TEST(RCU_SHT_base_cmpmix) - CPPUNIT_TEST(RCU_SHT_base_ic) - CPPUNIT_TEST(RCU_SHT_member_cmp) - CPPUNIT_TEST(RCU_SHT_member_less) - CPPUNIT_TEST(RCU_SHT_member_cmpmix) - CPPUNIT_TEST(RCU_SHT_member_ic) - - CPPUNIT_TEST(nogc_base_cmp) - CPPUNIT_TEST(nogc_base_less) - CPPUNIT_TEST(nogc_base_cmpmix) - CPPUNIT_TEST(nogc_base_ic) - CPPUNIT_TEST(nogc_member_cmp) - CPPUNIT_TEST(nogc_member_less) - CPPUNIT_TEST(nogc_member_cmpmix) - CPPUNIT_TEST(nogc_member_ic) - - CPPUNIT_TEST(nogc_base_cmp_unord) - CPPUNIT_TEST(nogc_base_less_unord) - CPPUNIT_TEST(nogc_base_equal_to_unord) - CPPUNIT_TEST(nogc_base_cmpmix_unord) - CPPUNIT_TEST(nogc_base_equal_to_mix_unord) - CPPUNIT_TEST(nogc_base_ic_unord) - CPPUNIT_TEST(nogc_member_cmp_unord) - CPPUNIT_TEST(nogc_member_less_unord) - CPPUNIT_TEST(nogc_member_equal_to_unord) - CPPUNIT_TEST(nogc_member_cmpmix_unord) - CPPUNIT_TEST(nogc_member_equal_to_mix_unord) - CPPUNIT_TEST(nogc_member_ic_unord) - - CPPUNIT_TEST_SUITE_END() - }; -} // namespace ordlist - -#endif // #ifndef CDSTEST_HDR_INTRUSIVE_LAZY_H diff --git a/tests/test-hdr/list/hdr_intrusive_lazy_dhp.cpp b/tests/test-hdr/list/hdr_intrusive_lazy_dhp.cpp deleted file mode 100644 index 43040bcd..00000000 --- a/tests/test-hdr/list/hdr_intrusive_lazy_dhp.cpp +++ /dev/null @@ -1,156 +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 "list/hdr_intrusive_lazy.h" -#include - -namespace ordlist { - void IntrusiveLazyListHeaderTest::DHP_base_cmp() - { - typedef base_int_item< cds::gc::DHP > item; - struct traits : public ci::lazy_list::traits - { - typedef ci::lazy_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::LazyList< cds::gc::DHP, item, traits > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::DHP_base_less() - { - typedef base_int_item< cds::gc::DHP > item; - typedef ci::LazyList< cds::gc::DHP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::DHP_base_cmpmix() - { - typedef base_int_item< cds::gc::DHP > item; - typedef ci::LazyList< cds::gc::DHP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::DHP_base_ic() - { - typedef base_int_item< cds::gc::DHP > item; - typedef ci::LazyList< cds::gc::DHP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::DHP_member_cmp() - { - typedef member_int_item< cds::gc::DHP > item; - typedef ci::LazyList< cds::gc::DHP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::DHP_member_less() - { - typedef member_int_item< cds::gc::DHP > item; - typedef ci::LazyList< cds::gc::DHP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::DHP_member_cmpmix() - { - typedef member_int_item< cds::gc::DHP > item; - typedef ci::LazyList< cds::gc::DHP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::DHP_member_ic() - { - typedef member_int_item< cds::gc::DHP > item; - typedef ci::LazyList< cds::gc::DHP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_int(); - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_intrusive_lazy_hp.cpp b/tests/test-hdr/list/hdr_intrusive_lazy_hp.cpp deleted file mode 100644 index f4ad2e3e..00000000 --- a/tests/test-hdr/list/hdr_intrusive_lazy_hp.cpp +++ /dev/null @@ -1,153 +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 "list/hdr_intrusive_lazy.h" -#include - -namespace ordlist { - void IntrusiveLazyListHeaderTest::HP_base_cmp() - { - typedef base_int_item< cds::gc::HP > item; - struct traits : public ci::lazy_list::traits - { - typedef ci::lazy_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::LazyList< cds::gc::HP, item, traits > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::HP_base_less() - { - typedef base_int_item< cds::gc::HP > item; - typedef ci::LazyList< cds::gc::HP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::HP_base_cmpmix() - { - typedef base_int_item< cds::gc::HP > item; - typedef ci::LazyList< cds::gc::HP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::HP_base_ic() - { - typedef base_int_item< cds::gc::HP > item; - typedef ci::LazyList< cds::gc::HP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::HP_member_cmp() - { - typedef member_int_item< cds::gc::HP > item; - typedef ci::LazyList< cds::gc::HP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::HP_member_less() - { - typedef member_int_item< cds::gc::HP > item; - struct traits : public ci::lazy_list::traits - { - typedef ci::lazy_list::member_hook< offsetof( item, hMember ), co::gc> hook; - typedef IntrusiveLazyListHeaderTest::less less; - typedef faked_disposer disposer; - }; - typedef ci::LazyList< cds::gc::HP, item, traits > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::HP_member_cmpmix() - { - typedef member_int_item< cds::gc::HP > item; - typedef ci::LazyList< cds::gc::HP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::HP_member_ic() - { - typedef member_int_item< cds::gc::HP > item; - typedef ci::LazyList< cds::gc::HP - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_int(); - } -} // namespace ordlist - -CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::IntrusiveLazyListHeaderTest); diff --git a/tests/test-hdr/list/hdr_intrusive_lazy_nogc.cpp b/tests/test-hdr/list/hdr_intrusive_lazy_nogc.cpp deleted file mode 100644 index f147fda4..00000000 --- a/tests/test-hdr/list/hdr_intrusive_lazy_nogc.cpp +++ /dev/null @@ -1,162 +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 "list/hdr_intrusive_lazy.h" -#include - -namespace ordlist { - void IntrusiveLazyListHeaderTest::nogc_base_cmp() - { - typedef base_int_item< cds::gc::nogc > item; - struct traits : public ci::lazy_list::traits { - typedef ci::lazy_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::LazyList< cds::gc::nogc, item, traits > list; - test_nogc_int(); - } - - void IntrusiveLazyListHeaderTest::nogc_base_less() - { - typedef base_int_item< cds::gc::nogc > item; - struct traits: public - ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - {}; - typedef ci::LazyList< cds::gc::nogc, item, traits > list; - test_nogc_int(); - } - - void IntrusiveLazyListHeaderTest::nogc_base_cmpmix() - { - typedef base_int_item< cds::gc::nogc > item; - typedef ci::LazyList< cds::gc::nogc - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_nogc_int(); - } - - void IntrusiveLazyListHeaderTest::nogc_base_ic() - { - typedef base_int_item< cds::gc::nogc > item; - typedef ci::LazyList< cds::gc::nogc - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_nogc_int(); - } - - void IntrusiveLazyListHeaderTest::nogc_member_cmp() - { - typedef member_int_item< cds::gc::nogc > item; - typedef ci::LazyList< cds::gc::nogc - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_nogc_int(); - } - - void IntrusiveLazyListHeaderTest::nogc_member_less() - { - typedef member_int_item< cds::gc::nogc > item; - typedef ci::LazyList< cds::gc::nogc - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_nogc_int(); - } - - void IntrusiveLazyListHeaderTest::nogc_member_cmpmix() - { - typedef member_int_item< cds::gc::nogc > item; - typedef ci::LazyList< cds::gc::nogc - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_nogc_int(); - } - - void IntrusiveLazyListHeaderTest::nogc_member_ic() - { - typedef member_int_item< cds::gc::nogc > item; - typedef ci::LazyList< cds::gc::nogc - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_nogc_int(); - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_intrusive_lazy_nogc_unord.cpp b/tests/test-hdr/list/hdr_intrusive_lazy_nogc_unord.cpp deleted file mode 100644 index 0286e943..00000000 --- a/tests/test-hdr/list/hdr_intrusive_lazy_nogc_unord.cpp +++ /dev/null @@ -1,194 +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 "list/hdr_intrusive_lazy.h" -#include - -namespace ordlist { - namespace { - typedef IntrusiveLazyListHeaderTest::base_int_item< cds::gc::nogc > base_item; - typedef IntrusiveLazyListHeaderTest::member_int_item< cds::gc::nogc > member_item; - - struct cmp_traits : public ci::lazy_list::traits { - typedef ci::lazy_list::base_hook< co::gc > hook; - typedef IntrusiveLazyListHeaderTest::cmp compare; - typedef IntrusiveLazyListHeaderTest::faked_disposer disposer; - static const bool sort = false; - }; - - struct less_traits: public ci::lazy_list::traits { - typedef ci::lazy_list::base_hook< co::gc > hook; - typedef IntrusiveLazyListHeaderTest::less less; - typedef IntrusiveLazyListHeaderTest::faked_disposer disposer; - static const bool sort = false; - }; - - struct equal_to_traits: public ci::lazy_list::traits { - typedef ci::lazy_list::base_hook< co::gc > hook; - typedef IntrusiveLazyListHeaderTest::equal_to equal_to; - typedef IntrusiveLazyListHeaderTest::faked_disposer disposer; - static const bool sort = false; - }; - - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< IntrusiveLazyListHeaderTest::less > - ,co::compare< IntrusiveLazyListHeaderTest::cmp > - ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer > - ,co::sort< false > >::type cmpmix_traits; - - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::compare< IntrusiveLazyListHeaderTest::cmp > - ,co::equal_to< IntrusiveLazyListHeaderTest::equal_to > - ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer > - ,co::sort< false > >::type equal_to_mix_traits; - - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::equal_to< IntrusiveLazyListHeaderTest::equal_to > - ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - ,co::sort< false > >::type ic_traits; - - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( member_item, hMember ) - ,co::gc > > - ,co::compare< IntrusiveLazyListHeaderTest::cmp > - ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer > - ,co::sort< false > >::type member_cmp_traits; - - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( member_item, hMember ) - ,co::gc > > - ,co::less< IntrusiveLazyListHeaderTest::less > - ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer > - ,co::sort< false > >::type member_less_traits; - - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( member_item, hMember ) - ,co::gc > > - ,co::equal_to< IntrusiveLazyListHeaderTest::equal_to > - ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer > - ,co::sort< false > >::type member_equal_to_traits; - - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( member_item, hMember ) - ,co::gc > > - ,co::less< IntrusiveLazyListHeaderTest::less > - ,co::compare< IntrusiveLazyListHeaderTest::cmp > - ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer > - ,co::sort< false > >::type member_cmpmix_traits; - - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( member_item, hMember ) - ,co::gc > > - ,co::compare< IntrusiveLazyListHeaderTest::cmp > - ,co::equal_to< IntrusiveLazyListHeaderTest::equal_to > - ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer > - ,co::sort< false > >::type member_equal_to_mix_traits; - - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( member_item, hMember ), - co::gc > > - ,co::equal_to< IntrusiveLazyListHeaderTest::equal_to > - ,ci::opt::disposer< IntrusiveLazyListHeaderTest::faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - ,co::sort< false > >::type member_ic_traits; - - } - void IntrusiveLazyListHeaderTest::nogc_base_cmp_unord() - { - typedef ci::LazyList< cds::gc::nogc, base_item, cmp_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_base_less_unord() - { - typedef ci::LazyList< cds::gc::nogc, base_item, less_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_base_equal_to_unord() - { - typedef ci::LazyList< cds::gc::nogc, base_item, equal_to_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_base_cmpmix_unord() - { - typedef ci::LazyList< cds::gc::nogc, base_item, cmpmix_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_base_equal_to_mix_unord() - { - typedef ci::LazyList< cds::gc::nogc, base_item, equal_to_mix_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_base_ic_unord() - { - typedef ci::LazyList< cds::gc::nogc, base_item, ic_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_member_cmp_unord() - { - typedef ci::LazyList< cds::gc::nogc, member_item, member_cmp_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_member_less_unord() - { - typedef ci::LazyList< cds::gc::nogc, member_item, member_less_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_member_equal_to_unord() - { - typedef ci::LazyList< cds::gc::nogc, member_item, member_equal_to_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_member_cmpmix_unord() - { - typedef ci::LazyList< cds::gc::nogc, member_item, member_cmpmix_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_member_equal_to_mix_unord() - { - typedef ci::LazyList< cds::gc::nogc, member_item, member_equal_to_mix_traits > list; - test_nogc_int_unordered(); - } - void IntrusiveLazyListHeaderTest::nogc_member_ic_unord() - { - typedef ci::LazyList< cds::gc::nogc, member_item, member_ic_traits > list; - test_nogc_int_unordered(); - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpb.cpp b/tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpb.cpp deleted file mode 100644 index 9595efcf..00000000 --- a/tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpb.cpp +++ /dev/null @@ -1,160 +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 "list/hdr_intrusive_lazy.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_buffered<> > RCU; - } - - void IntrusiveLazyListHeaderTest::RCU_GPB_base_cmp() - { - typedef base_int_item< RCU > item; - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type list_traits; - typedef ci::LazyList< RCU, item, list_traits > list; - - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPB_base_less() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPB_base_cmpmix() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPB_base_ic() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPB_member_cmp() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPB_member_less() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPB_member_cmpmix() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPB_member_ic() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpi.cpp b/tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpi.cpp deleted file mode 100644 index 1c0fad18..00000000 --- a/tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpi.cpp +++ /dev/null @@ -1,161 +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 "list/hdr_intrusive_lazy.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_instant<> > RCU; - } - - void IntrusiveLazyListHeaderTest::RCU_GPI_base_cmp() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPI_base_less() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPI_base_cmpmix() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPI_base_ic() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPI_member_cmp() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPI_member_less() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPI_member_cmpmix() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPI_member_ic() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpt.cpp b/tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpt.cpp deleted file mode 100644 index fd072807..00000000 --- a/tests/test-hdr/list/hdr_intrusive_lazy_rcu_gpt.cpp +++ /dev/null @@ -1,161 +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 "list/hdr_intrusive_lazy.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_threaded<> > RCU; - } - - void IntrusiveLazyListHeaderTest::RCU_GPT_base_cmp() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPT_base_less() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPT_base_cmpmix() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPT_base_ic() - { - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPT_member_cmp() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPT_member_less() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPT_member_cmpmix() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveLazyListHeaderTest::RCU_GPT_member_ic() - { - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_intrusive_lazy_rcu_shb.cpp b/tests/test-hdr/list/hdr_intrusive_lazy_rcu_shb.cpp deleted file mode 100644 index ec54a136..00000000 --- a/tests/test-hdr/list/hdr_intrusive_lazy_rcu_shb.cpp +++ /dev/null @@ -1,186 +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 "list/hdr_intrusive_lazy.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_buffered<> > RCU; - } -#endif - - void IntrusiveLazyListHeaderTest::RCU_SHB_base_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type list_traits; - typedef ci::LazyList< RCU, item, list_traits > list; - - test_rcu_int(); -#endif - } - - void IntrusiveLazyListHeaderTest::RCU_SHB_base_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - - void IntrusiveLazyListHeaderTest::RCU_SHB_base_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - - void IntrusiveLazyListHeaderTest::RCU_SHB_base_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); -#endif - } - - void IntrusiveLazyListHeaderTest::RCU_SHB_member_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - - void IntrusiveLazyListHeaderTest::RCU_SHB_member_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - - void IntrusiveLazyListHeaderTest::RCU_SHB_member_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - - void IntrusiveLazyListHeaderTest::RCU_SHB_member_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); -#endif - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_intrusive_lazy_rcu_sht.cpp b/tests/test-hdr/list/hdr_intrusive_lazy_rcu_sht.cpp deleted file mode 100644 index 6738b4b0..00000000 --- a/tests/test-hdr/list/hdr_intrusive_lazy_rcu_sht.cpp +++ /dev/null @@ -1,179 +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 "list/hdr_intrusive_lazy.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_threaded<> > RCU; - } -#endif - - void IntrusiveLazyListHeaderTest::RCU_SHT_base_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveLazyListHeaderTest::RCU_SHT_base_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveLazyListHeaderTest::RCU_SHT_base_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveLazyListHeaderTest::RCU_SHT_base_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveLazyListHeaderTest::RCU_SHT_member_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveLazyListHeaderTest::RCU_SHT_member_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveLazyListHeaderTest::RCU_SHT_member_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveLazyListHeaderTest::RCU_SHT_member_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::LazyList< RCU - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); -#endif - } -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_intrusive_michael.h b/tests/test-hdr/list/hdr_intrusive_michael.h deleted file mode 100644 index 4c701c23..00000000 --- a/tests/test-hdr/list/hdr_intrusive_michael.h +++ /dev/null @@ -1,938 +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_MICHAEL_H -#define CDSTEST_HDR_INTRUSIVE_MICHAEL_H - -#include "cppunit/cppunit_proxy.h" -#include - -namespace ordlist { - namespace ci = cds::intrusive; - namespace co = cds::opt; - - class IntrusiveMichaelListHeaderTest: public CppUnitMini::TestCase - { - public: - - struct stat { - int nDisposeCount; - int nUpdateExistsCall; - int nUpdateNewCall; - int nFindCall; - int nEraseCall; - - stat() - : nDisposeCount(0) - , nUpdateExistsCall(0) - , nUpdateNewCall(0) - , nFindCall(0) - , nEraseCall(0) - {} - - stat( const stat& s ) - { - *this = s; - } - - stat& operator =(const stat& s) - { - memcpy( this, &s, sizeof(s)); - return *this; - } - }; - - template - struct base_int_item: public ci::michael_list::node< GC > - { - int nKey; - int nVal; - - mutable stat s; - - base_int_item() - {} - - base_int_item(int key, int val) - : nKey( key ) - , nVal(val) - , s() - {} - - base_int_item(const base_int_item& v ) - : nKey( v.nKey ) - , nVal( v.nVal ) - , s() - {} - - const int& key() const - { - return nKey; - } - }; - - template - struct member_int_item - { - int nKey; - int nVal; - - ci::michael_list::node< GC > hMember; - - mutable stat s; - - member_int_item() - {} - - member_int_item(int key, int val) - : nKey( key ) - , nVal(val) - , s() - {} - - member_int_item(const member_int_item& v ) - : nKey( v.nKey ) - , nVal( v.nVal ) - , s() - {} - - const int& key() const - { - return nKey; - } - }; - - template - struct less - { - bool operator ()(const T& v1, const T& v2 ) const - { - return v1.key() < v2.key(); - } - - template - bool operator ()(const T& v1, const Q& v2 ) const - { - return v1.key() < v2; - } - - template - bool operator ()(const Q& v1, const T& v2 ) const - { - return v1 < v2.key(); - } - }; - - struct other_item { - int nKey; - - other_item( int n ) - : nKey(n) - {} - }; - - struct other_less { - template - bool operator()( T const& i1, Q const& i2) const - { - return i1.nKey < i2.nKey; - } - }; - - template - struct cmp { - int operator ()(const T& v1, const T& v2 ) const - { - if ( v1.key() < v2.key() ) - return -1; - return v1.key() > v2.key() ? 1 : 0; - } - - template - int operator ()(const T& v1, const Q& v2 ) const - { - if ( v1.key() < v2 ) - return -1; - return v1.key() > v2 ? 1 : 0; - } - - template - int operator ()(const Q& v1, const T& v2 ) const - { - if ( v1 < v2.key() ) - return -1; - return v1 > v2.key() ? 1 : 0; - } - }; - - struct faked_disposer - { - template - void operator ()( T * p ) - { - ++p->s.nDisposeCount; - } - }; - - struct update_functor - { - template - void operator ()(bool bNew, T& item, T& /*val*/ ) - { - if ( bNew ) - ++item.s.nUpdateNewCall; - else - ++item.s.nUpdateExistsCall; - } - }; - - struct find_functor - { - template - void operator ()( T& item, Q& /*val*/ ) - { - ++item.s.nFindCall; - } - }; - - struct erase_functor - { - template - void operator()( T const& item ) - { - item.s.nEraseCall++; - } - }; - - template - void test_int_common() - { - typedef typename OrdList::value_type value_type; - - value_type v1( 10, 50 ); - value_type v2( 5, 25 ); - value_type v3( 20, 100 ); - { - OrdList l; - CPPUNIT_ASSERT( l.empty() ); - - CPPUNIT_ASSERT( l.insert( v1 )) ; // true - CPPUNIT_ASSERT( l.contains( v1.key() )); - - CPPUNIT_ASSERT( v1.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); - CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( !l.contains( v2.key() )); - CPPUNIT_ASSERT( !l.contains( v3.key(), less() )); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is not raised since pNext is nullptr - - { - value_type v( v1 ); - CPPUNIT_ASSERT( !l.insert( v )) ; // false - } - - std::pair ret = l.update( v2, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 ); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 ); - - //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty" - - CPPUNIT_ASSERT( l.contains( v1.key(), less() )) ; // true - - CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - CPPUNIT_ASSERT( l.find_with( v1.key(), less(), find_functor() )); - CPPUNIT_ASSERT( v1.s.nFindCall == 2 ); - - CPPUNIT_ASSERT( l.contains( v2.key() )); - - CPPUNIT_ASSERT( v2.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v2.key(), find_functor() )); - CPPUNIT_ASSERT( v2.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( !l.contains( v3.key() )); - - { - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 ); - - value_type v( v2 ); - ret = l.update( v, update_functor() ); - - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( !ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 1 ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 ); - CPPUNIT_ASSERT( v.s.nUpdateExistsCall == 0 ); - CPPUNIT_ASSERT( v.s.nUpdateNewCall == 0 ); - } - - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.insert( v3 )) ; // true - CPPUNIT_ASSERT( l.contains( v3.key() )); - - CPPUNIT_ASSERT( v3.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v3.key(), find_functor() )); - CPPUNIT_ASSERT( v3.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( l.unlink( v2 ) ); - CPPUNIT_ASSERT( l.contains( v1.key() )) ; // true - CPPUNIT_ASSERT( !l.contains( v2.key() )) ; // true - CPPUNIT_ASSERT( l.contains( v3.key() )) ; // true - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( !l.unlink( v2 ) ); - - { - // v1 key is in the list but v NODE is not in the list - value_type v( v1 ); - CPPUNIT_ASSERT( !l.unlink( v ) ); - } - - CPPUNIT_ASSERT( l.unlink( v1 ) ); - CPPUNIT_ASSERT( !l.unlink( v1 ) ); - CPPUNIT_ASSERT( !l.contains( v1.key() )); - CPPUNIT_ASSERT( !l.contains( v2.key() )); - CPPUNIT_ASSERT( l.contains( v3.key() )); - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( !l.unlink( v1 ) ); - CPPUNIT_ASSERT( !l.unlink( v2 ) ); - - CPPUNIT_ASSERT( l.unlink( v3 ) ); - CPPUNIT_ASSERT( !l.contains( v1.key(), less() )); - CPPUNIT_ASSERT( !l.find_with( v2.key(), less(), find_functor() )); - CPPUNIT_ASSERT( !l.find( v3.key(), find_functor() )); - CPPUNIT_ASSERT( l.empty() ); - CPPUNIT_ASSERT( !l.unlink( v1 ) ); - CPPUNIT_ASSERT( !l.unlink( v2 ) ); - CPPUNIT_ASSERT( !l.unlink( v3 ) ); - - // Apply retired pointer to clean links - OrdList::gc::force_dispose(); - - stat s( v3.s ); - ret = l.update( v3, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v3.s.nUpdateNewCall == s.nUpdateNewCall + 1); - CPPUNIT_ASSERT( v3.s.nUpdateExistsCall == s.nUpdateExistsCall ); - CPPUNIT_ASSERT( !l.empty() ); - - s = v2.s; - ret = l.update( v2, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == s.nUpdateNewCall + 1); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == s.nUpdateExistsCall ); - CPPUNIT_ASSERT( !l.empty() ); - - s = v1.s; - ret = l.update( v1, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v1.s.nUpdateNewCall == s.nUpdateNewCall + 1); - CPPUNIT_ASSERT( v1.s.nUpdateExistsCall == s.nUpdateExistsCall ); - CPPUNIT_ASSERT( !l.empty() ); - - // Erase test - CPPUNIT_ASSERT( v1.s.nEraseCall == 0 ); - CPPUNIT_ASSERT( l.erase( v1.key(), erase_functor()) ); - CPPUNIT_ASSERT( v1.s.nEraseCall == 1 ); - //CPPUNIT_ASSERT( v1.s.nDisposeCount == 0 ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.erase_with( v2.key(), less() ) ); - CPPUNIT_ASSERT( !l.erase( v2.key())); - //CPPUNIT_ASSERT( v2.s.nDisposeCount == 0 ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( v2.s.nEraseCall == 0 ); - CPPUNIT_ASSERT( !l.erase( v2, erase_functor() )); - CPPUNIT_ASSERT( v2.s.nEraseCall == 0 ); - CPPUNIT_ASSERT( !l.erase( v1 )); - //CPPUNIT_ASSERT( v2.s.nDisposeCount == 0 ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( v3.s.nEraseCall == 0 ); - CPPUNIT_ASSERT( l.erase_with( v3, less(), erase_functor() )); - CPPUNIT_ASSERT( v3.s.nEraseCall == 1 ); - //CPPUNIT_ASSERT( v3.s.nDisposeCount == 0 ); - CPPUNIT_ASSERT( l.empty() ); - - // Apply retired pointer to clean links - OrdList::gc::force_dispose(); - - // Unlink test - CPPUNIT_ASSERT( l.insert( v1 )); - CPPUNIT_ASSERT( l.insert( v3 )); - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( !l.unlink( v2 )); - CPPUNIT_ASSERT( l.unlink( v1 )); - CPPUNIT_ASSERT( !l.unlink( v1 )); - CPPUNIT_ASSERT( l.unlink( v3 )); - CPPUNIT_ASSERT( !l.unlink( v3 )); - CPPUNIT_ASSERT( l.empty() ); - - // Apply retired pointer - OrdList::gc::force_dispose(); - CPPUNIT_ASSERT( v1.s.nDisposeCount == 3 ); - CPPUNIT_ASSERT( v2.s.nDisposeCount == 2 ); - CPPUNIT_ASSERT( v3.s.nDisposeCount == 3 ); - - // Destructor test (call disposer) - CPPUNIT_ASSERT( l.insert( v1 )); - CPPUNIT_ASSERT( l.insert( v3 )); - CPPUNIT_ASSERT( l.insert( v2 )); - - // Iterator test - // begin/end - { - typename OrdList::iterator it = l.begin(); - typename OrdList::const_iterator cit = l.cbegin(); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it != l.cend() ); - CPPUNIT_ASSERT( cit != l.end() ); - CPPUNIT_ASSERT( cit != l.cend() ); - CPPUNIT_ASSERT( cit == it ); - - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( ++it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( ++it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( ++it == l.end() ); - } - - // cbegin/cend - { - typename OrdList::const_iterator it = l.cbegin(); - CPPUNIT_ASSERT( it != l.cend() ); - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( ++it != l.cend() ); - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( ++it != l.cend() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( ++it == l.cend() ); - } - - // const begin/end - { - OrdList const & lref = l; - typename OrdList::const_iterator it = lref.begin(); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( ++it != lref.end() ); - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( ++it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( ++it == l.end() ); - } - } - - // Apply retired pointer - OrdList::gc::force_dispose(); - - CPPUNIT_ASSERT( v1.s.nDisposeCount == 4 ); - CPPUNIT_ASSERT( v2.s.nDisposeCount == 3 ); - CPPUNIT_ASSERT( v3.s.nDisposeCount == 4 ); - } - - template - void test_int() - { - test_int_common(); - - OrdList l; - typename OrdList::guarded_ptr gp; - - static int const nLimit = 20; - typename OrdList::value_type arrItem[nLimit]; - - { - int a[nLimit]; - for (int i = 0; i < nLimit; ++i) - a[i]=i; - shuffle( a, a + nLimit ); - - for (int i = 0; i < nLimit; ++i) { - arrItem[i].nKey = a[i]; - arrItem[i].nVal = a[i] * 2; - } - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - CPPUNIT_ASSERT( l.insert( arrItem[i] ) ); - - for ( int i=0; i < nLimit; ++i ) { - gp = l.get( arrItem[i].nKey ); - CPPUNIT_ASSERT_EX( gp, "i=" << i ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == arrItem[i].nKey ); - CPPUNIT_CHECK( gp->nVal == arrItem[i].nVal ); - gp.release(); - - gp = l.extract( arrItem[i].nKey ); - CPPUNIT_ASSERT_EX( gp, "i=" << i ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == arrItem[i].nKey ); - CPPUNIT_CHECK( gp->nVal == arrItem[i].nVal ); - gp.release(); - - gp = l.get( arrItem[i].nKey ); - CPPUNIT_CHECK( !gp ); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract( arrItem[i].nKey )); - CPPUNIT_CHECK( gp.empty()); - } - CPPUNIT_ASSERT( l.empty() ); - CPPUNIT_ASSERT( !l.get( nLimit/2 )); - CPPUNIT_ASSERT( gp.empty()); - CPPUNIT_ASSERT( !l.extract( nLimit/2 )); - CPPUNIT_ASSERT( gp.empty()); - - // Apply retired pointer - OrdList::gc::force_dispose(); - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) - CPPUNIT_ASSERT( l.insert( arrItem[i] ) ); - - for ( int i=0; i < nLimit; ++i ) { - other_item itm( arrItem[i].nKey ); - gp = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT_EX( gp, "i=" << i ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == arrItem[i].nKey ); - CPPUNIT_CHECK( gp->nVal == arrItem[i].nVal ); - gp.release(); - - gp = l.extract_with( itm, other_less() ); - CPPUNIT_ASSERT_EX( gp, "i=" << i ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == arrItem[i].nKey ); - CPPUNIT_CHECK( gp->nVal == arrItem[i].nVal ); - gp.release(); - - gp = l.get_with( itm, other_less() ); - CPPUNIT_CHECK( !gp ); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract_with( itm, other_less() )); - CPPUNIT_CHECK( gp.empty()); - } - CPPUNIT_ASSERT( l.empty() ); - CPPUNIT_ASSERT( !l.get_with( other_item(nLimit/2), other_less() )); - CPPUNIT_ASSERT( gp.empty()); - CPPUNIT_ASSERT( !l.extract_with( other_item(nLimit/2), other_less() )); - CPPUNIT_ASSERT( gp.empty()); - - // Apply retired pointer - OrdList::gc::force_dispose(); - - for ( int i=0; i < nLimit; i++ ) { - CPPUNIT_ASSERT( arrItem[i].s.nDisposeCount == 2 ); - } - } - } - - template - void test_rcu_int() - { - test_int_common(); - - OrdList l; - static int const nLimit = 20; - typename OrdList::value_type arrItem[nLimit]; - - typedef typename OrdList::rcu_lock rcu_lock; - typedef typename OrdList::value_type value_type; - typedef typename OrdList::gc rcu_type; - - { - int a[nLimit]; - for (int i = 0; i < nLimit; ++i) - a[i]=i; - shuffle( a, a + nLimit ); - - for (int i = 0; i < nLimit; ++i) { - arrItem[i].nKey = a[i]; - arrItem[i].nVal = a[i] * 2; - } - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - CPPUNIT_ASSERT( l.insert( arrItem[i] ) ); - - typename OrdList::exempt_ptr ep; - typename OrdList::raw_ptr rp; - - for ( int i = 0; i < nLimit; ++i ) { - { - rcu_lock lock; - rp = l.get( a[i] ); - CPPUNIT_ASSERT( rp ); - CPPUNIT_CHECK( rp->nKey == a[i] ); - CPPUNIT_CHECK( rp->nVal == a[i] * 2 ); - } - rp.release(); - - ep = l.extract( a[i] ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->nKey == a[i] ); - CPPUNIT_CHECK( (*ep).nVal == a[i] * 2 ); - ep.release(); - - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get( a[i] )); - } - CPPUNIT_CHECK( !l.extract( a[i] )); - CPPUNIT_CHECK( ep.empty() ); - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get( a[0] )); - } - ep = l.extract( a[0] ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - - // Apply retired pointer - OrdList::gc::force_dispose(); - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) { - CPPUNIT_ASSERT( l.insert( arrItem[i] ) ); - } - - for ( int i = 0; i < nLimit; ++i ) { - other_item itm( a[i] ); - { - rcu_lock lock; - rp = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( rp ); - CPPUNIT_CHECK( rp->nKey == a[i] ); - CPPUNIT_CHECK( rp->nVal == a[i] * 2 ); - } - rp.release(); - - ep = l.extract_with( itm, other_less() ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->nKey == a[i] ); - CPPUNIT_CHECK( ep->nVal == a[i] * 2 ); - ep.release(); - - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get_with( itm, other_less() )); - } - ep = l.extract_with( itm, other_less() ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get_with( other_item( 0 ), other_less() )); - } - CPPUNIT_CHECK( !l.extract_with( other_item(0), other_less() )); - CPPUNIT_CHECK( ep.empty() ); - - // Apply retired pointer - OrdList::gc::force_dispose(); - } - } - - template - void test_nogc_int() - { - typedef typename OrdList::value_type value_type; - { - value_type v1( 10, 50 ); - value_type v2( 5, 25 ); - value_type v3( 20, 100 ); - { - OrdList l; - CPPUNIT_ASSERT( l.empty() ); - - CPPUNIT_ASSERT( l.insert( v1 )) ; // true - CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 ); - - CPPUNIT_ASSERT( v1.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); - CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( l.contains( v2.key(), less() ) == nullptr ); - CPPUNIT_ASSERT( !l.find_with( v3.key(), less(), find_functor() )); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is not raised since pNext is nullptr - - { - value_type v( v1 ); - CPPUNIT_ASSERT( !l.insert( v )) ; // false - } - - std::pair ret = l.update( v2, update_functor() ); - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateNewCall == 1 ); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 0 ); - - //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty" - - CPPUNIT_ASSERT( l.contains( v1.key() ) == &v1 ) ; // true - - CPPUNIT_ASSERT( v1.s.nFindCall == 1 ); - CPPUNIT_ASSERT( l.find( v1.key(), find_functor() )); - CPPUNIT_ASSERT( v1.s.nFindCall == 2 ); - - CPPUNIT_ASSERT( l.contains( v2.key() ) == &v2 ); - - CPPUNIT_ASSERT( v2.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v2.key(), find_functor() )); - CPPUNIT_ASSERT( v2.s.nFindCall == 1 ); - - CPPUNIT_ASSERT( !l.contains( v3.key() )); - - { - value_type v( v2 ); - ret = l.update( v, update_functor() ); - - CPPUNIT_ASSERT( ret.first ); - CPPUNIT_ASSERT( !ret.second ); - CPPUNIT_ASSERT( v2.s.nUpdateExistsCall == 1 ); - CPPUNIT_ASSERT( v.s.nUpdateExistsCall == 0 && v.s.nUpdateNewCall == 0 ); - } - - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.insert( v3 )) ; // true - CPPUNIT_ASSERT( l.contains( v3.key() ) == &v3 ); - - CPPUNIT_ASSERT( v3.s.nFindCall == 0 ); - CPPUNIT_ASSERT( l.find( v3.key(), find_functor() )); - CPPUNIT_ASSERT( v3.s.nFindCall == 1 ); - - { - typename OrdList::iterator it = l.begin(); - typename OrdList::const_iterator cit = l.cbegin(); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it != l.cend() ); - CPPUNIT_ASSERT( cit != l.end() ); - CPPUNIT_ASSERT( cit != l.cend() ); - CPPUNIT_ASSERT( cit == it ); - - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( ++it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( it++ != l.end() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( it++ != l.end() ); - CPPUNIT_ASSERT( it == l.end() ); - } - - { - OrdList const & lref = l; - typename OrdList::const_iterator it = lref.begin(); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == v2.nKey ); - CPPUNIT_ASSERT( it->nVal == v2.nVal ); - CPPUNIT_ASSERT( ++it != lref.end() ); - CPPUNIT_ASSERT( it->nKey == v1.nKey ); - CPPUNIT_ASSERT( it->nVal == v1.nVal ); - CPPUNIT_ASSERT( it++ != l.end() ); - CPPUNIT_ASSERT( it->nKey == v3.nKey ); - CPPUNIT_ASSERT( it->nVal == v3.nVal ); - CPPUNIT_ASSERT( it++ != lref.end() ); - CPPUNIT_ASSERT( it == l.end() ); - } - } - - // Disposer called on list destruction - CPPUNIT_ASSERT( v1.s.nDisposeCount == 1 ); - CPPUNIT_ASSERT( v2.s.nDisposeCount == 1 ); - CPPUNIT_ASSERT( v3.s.nDisposeCount == 1 ); - } - } - - void HP_base_cmp(); - void HP_base_less(); - void HP_base_cmpmix(); - void HP_base_ic(); - void HP_member_cmp(); - void HP_member_less(); - void HP_member_cmpmix(); - void HP_member_ic(); - - void DHP_base_cmp(); - void DHP_base_less(); - void DHP_base_cmpmix(); - void DHP_base_ic(); - void DHP_member_cmp(); - void DHP_member_less(); - void DHP_member_cmpmix(); - void DHP_member_ic(); - - void RCU_GPI_base_cmp(); - void RCU_GPI_base_less(); - void RCU_GPI_base_cmpmix(); - void RCU_GPI_base_ic(); - void RCU_GPI_member_cmp(); - void RCU_GPI_member_less(); - void RCU_GPI_member_cmpmix(); - void RCU_GPI_member_ic(); - - void RCU_GPB_base_cmp(); - void RCU_GPB_base_less(); - void RCU_GPB_base_cmpmix(); - void RCU_GPB_base_ic(); - void RCU_GPB_member_cmp(); - void RCU_GPB_member_less(); - void RCU_GPB_member_cmpmix(); - void RCU_GPB_member_ic(); - - void RCU_GPT_base_cmp(); - void RCU_GPT_base_less(); - void RCU_GPT_base_cmpmix(); - void RCU_GPT_base_ic(); - void RCU_GPT_member_cmp(); - void RCU_GPT_member_less(); - void RCU_GPT_member_cmpmix(); - void RCU_GPT_member_ic(); - - void RCU_SHB_base_cmp(); - void RCU_SHB_base_less(); - void RCU_SHB_base_cmpmix(); - void RCU_SHB_base_ic(); - void RCU_SHB_member_cmp(); - void RCU_SHB_member_less(); - void RCU_SHB_member_cmpmix(); - void RCU_SHB_member_ic(); - - void RCU_SHT_base_cmp(); - void RCU_SHT_base_less(); - void RCU_SHT_base_cmpmix(); - void RCU_SHT_base_ic(); - void RCU_SHT_member_cmp(); - void RCU_SHT_member_less(); - void RCU_SHT_member_cmpmix(); - void RCU_SHT_member_ic(); - - void nogc_base_cmp(); - void nogc_base_less(); - void nogc_base_cmpmix(); - void nogc_base_ic(); - void nogc_member_cmp(); - void nogc_member_less(); - void nogc_member_cmpmix(); - void nogc_member_ic(); - - - CPPUNIT_TEST_SUITE(IntrusiveMichaelListHeaderTest) - CPPUNIT_TEST(HP_base_cmp) - CPPUNIT_TEST(HP_base_less) - CPPUNIT_TEST(HP_base_cmpmix) - CPPUNIT_TEST(HP_base_ic) - CPPUNIT_TEST(HP_member_cmp) - CPPUNIT_TEST(HP_member_less) - CPPUNIT_TEST(HP_member_cmpmix) - CPPUNIT_TEST(HP_member_ic) - - CPPUNIT_TEST(DHP_base_cmp) - CPPUNIT_TEST(DHP_base_less) - CPPUNIT_TEST(DHP_base_cmpmix) - CPPUNIT_TEST(DHP_base_ic) - CPPUNIT_TEST(DHP_member_cmp) - CPPUNIT_TEST(DHP_member_less) - CPPUNIT_TEST(DHP_member_cmpmix) - CPPUNIT_TEST(DHP_member_ic) - - CPPUNIT_TEST(RCU_GPI_base_cmp) - CPPUNIT_TEST(RCU_GPI_base_less) - CPPUNIT_TEST(RCU_GPI_base_cmpmix) - CPPUNIT_TEST(RCU_GPI_base_ic) - CPPUNIT_TEST(RCU_GPI_member_cmp) - CPPUNIT_TEST(RCU_GPI_member_less) - CPPUNIT_TEST(RCU_GPI_member_cmpmix) - CPPUNIT_TEST(RCU_GPI_member_ic) - - CPPUNIT_TEST(RCU_GPB_base_cmp) - CPPUNIT_TEST(RCU_GPB_base_less) - CPPUNIT_TEST(RCU_GPB_base_cmpmix) - CPPUNIT_TEST(RCU_GPB_base_ic) - CPPUNIT_TEST(RCU_GPB_member_cmp) - CPPUNIT_TEST(RCU_GPB_member_less) - CPPUNIT_TEST(RCU_GPB_member_cmpmix) - CPPUNIT_TEST(RCU_GPB_member_ic) - - CPPUNIT_TEST(RCU_GPT_base_cmp) - CPPUNIT_TEST(RCU_GPT_base_less) - CPPUNIT_TEST(RCU_GPT_base_cmpmix) - CPPUNIT_TEST(RCU_GPT_base_ic) - CPPUNIT_TEST(RCU_GPT_member_cmp) - CPPUNIT_TEST(RCU_GPT_member_less) - CPPUNIT_TEST(RCU_GPT_member_cmpmix) - CPPUNIT_TEST(RCU_GPT_member_ic) - - CPPUNIT_TEST(nogc_base_cmp) - CPPUNIT_TEST(nogc_base_less) - CPPUNIT_TEST(nogc_base_cmpmix) - CPPUNIT_TEST(nogc_base_ic) - CPPUNIT_TEST(nogc_member_cmp) - CPPUNIT_TEST(nogc_member_less) - CPPUNIT_TEST(nogc_member_cmpmix) - CPPUNIT_TEST(nogc_member_ic) - - CPPUNIT_TEST_SUITE_END() - }; -} // namespace ordlist - -#endif // CDSTEST_HDR_INTRUSIVE_MICHAEL_H diff --git a/tests/test-hdr/list/hdr_intrusive_michael_dhp.cpp b/tests/test-hdr/list/hdr_intrusive_michael_dhp.cpp deleted file mode 100644 index 61581bae..00000000 --- a/tests/test-hdr/list/hdr_intrusive_michael_dhp.cpp +++ /dev/null @@ -1,155 +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 "list/hdr_intrusive_michael.h" -#include - -namespace ordlist { - void IntrusiveMichaelListHeaderTest::DHP_base_cmp() - { - typedef base_int_item< cds::gc::DHP > item; - struct traits : public ci::michael_list::traits { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< cds::gc::DHP, item, traits > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::DHP_base_less() - { - typedef base_int_item< cds::gc::DHP > item; - typedef ci::MichaelList< cds::gc::DHP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::DHP_base_cmpmix() - { - typedef base_int_item< cds::gc::DHP > item; - typedef ci::MichaelList< cds::gc::DHP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::DHP_base_ic() - { - typedef base_int_item< cds::gc::DHP > item; - typedef ci::MichaelList< cds::gc::DHP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::DHP_member_cmp() - { - typedef member_int_item< cds::gc::DHP > item; - typedef ci::MichaelList< cds::gc::DHP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::DHP_member_less() - { - typedef member_int_item< cds::gc::DHP > item; - typedef ci::MichaelList< cds::gc::DHP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::DHP_member_cmpmix() - { - typedef member_int_item< cds::gc::DHP > item; - typedef ci::MichaelList< cds::gc::DHP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::DHP_member_ic() - { - typedef member_int_item< cds::gc::DHP > item; - typedef ci::MichaelList< cds::gc::DHP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_int(); - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_intrusive_michael_hp.cpp b/tests/test-hdr/list/hdr_intrusive_michael_hp.cpp deleted file mode 100644 index 11281e94..00000000 --- a/tests/test-hdr/list/hdr_intrusive_michael_hp.cpp +++ /dev/null @@ -1,156 +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 "list/hdr_intrusive_michael.h" -#include - -namespace ordlist { - void IntrusiveMichaelListHeaderTest::HP_base_cmp() - { - typedef base_int_item< cds::gc::HP > item; - struct traits : public ci::michael_list::traits { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< cds::gc::HP, item, traits > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::HP_base_less() - { - typedef base_int_item< cds::gc::HP > item; - typedef ci::MichaelList< cds::gc::HP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::HP_base_cmpmix() - { - typedef base_int_item< cds::gc::HP > item; - typedef ci::MichaelList< cds::gc::HP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::HP_base_ic() - { - typedef base_int_item< cds::gc::HP > item; - typedef ci::MichaelList< cds::gc::HP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::HP_member_cmp() - { - typedef member_int_item< cds::gc::HP > item; - typedef ci::MichaelList< cds::gc::HP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::HP_member_less() - { - typedef member_int_item< cds::gc::HP > item; - typedef ci::MichaelList< cds::gc::HP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::HP_member_cmpmix() - { - typedef member_int_item< cds::gc::HP > item; - typedef ci::MichaelList< cds::gc::HP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveMichaelListHeaderTest::HP_member_ic() - { - typedef member_int_item< cds::gc::HP > item; - typedef ci::MichaelList< cds::gc::HP - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_int(); - } -} // namespace ordlist - -CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::IntrusiveMichaelListHeaderTest); diff --git a/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpb.cpp b/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpb.cpp deleted file mode 100644 index f4750dd4..00000000 --- a/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpb.cpp +++ /dev/null @@ -1,160 +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 "list/hdr_intrusive_michael.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_buffered<> > RCU; - } - - void IntrusiveMichaelListHeaderTest::RCU_GPB_base_cmp() - { - typedef base_int_item< RCU > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPB_base_less() - { - typedef base_int_item< RCU > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef IntrusiveMichaelListHeaderTest::less less; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPB_base_cmpmix() - { - typedef base_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPB_base_ic() - { - typedef base_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPB_member_cmp() - { - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPB_member_less() - { - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPB_member_cmpmix() - { - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPB_member_ic() - { - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } - -} diff --git a/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpi.cpp b/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpi.cpp deleted file mode 100644 index 3853e266..00000000 --- a/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpi.cpp +++ /dev/null @@ -1,159 +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 "list/hdr_intrusive_michael.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_instant<> > RCU; - } - - void IntrusiveMichaelListHeaderTest::RCU_GPI_base_cmp() - { - typedef base_int_item< RCU > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPI_base_less() - { - typedef base_int_item< RCU > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef IntrusiveMichaelListHeaderTest::less less; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPI_base_cmpmix() - { - typedef base_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPI_base_ic() - { - typedef base_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPI_member_cmp() - { - typedef member_int_item< RCU > item; - struct traits: public - ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - {}; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPI_member_less() - { - typedef member_int_item< RCU > item; - struct traits: public - ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - {}; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPI_member_cmpmix() - { - typedef member_int_item< RCU > item; - struct traits: public - ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - {}; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPI_member_ic() - { - typedef member_int_item< RCU > item; - struct traits: public - ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - {}; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); - } -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpt.cpp b/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpt.cpp deleted file mode 100644 index c01b5f96..00000000 --- a/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_gpt.cpp +++ /dev/null @@ -1,160 +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 "list/hdr_intrusive_michael.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_threaded<> > RCU; - } - - void IntrusiveMichaelListHeaderTest::RCU_GPT_base_cmp() - { - typedef base_int_item< RCU > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPT_base_less() - { - typedef base_int_item< RCU > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef IntrusiveMichaelListHeaderTest::less less; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPT_base_cmpmix() - { - typedef base_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPT_base_ic() - { - typedef base_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPT_member_cmp() - { - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPT_member_less() - { - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPT_member_cmpmix() - { - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); - } - void IntrusiveMichaelListHeaderTest::RCU_GPT_member_ic() - { - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); - } - -} diff --git a/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_shb.cpp b/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_shb.cpp deleted file mode 100644 index edb95b92..00000000 --- a/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_shb.cpp +++ /dev/null @@ -1,178 +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 "list/hdr_intrusive_michael.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_buffered<> > RCU; - } -#endif - - void IntrusiveMichaelListHeaderTest::RCU_SHB_base_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHB_base_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef IntrusiveMichaelListHeaderTest::less less; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHB_base_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHB_base_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHB_member_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHB_member_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHB_member_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHB_member_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); -#endif - } - -} diff --git a/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_sht.cpp b/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_sht.cpp deleted file mode 100644 index 96a24249..00000000 --- a/tests/test-hdr/list/hdr_intrusive_michael_list_rcu_sht.cpp +++ /dev/null @@ -1,178 +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 "list/hdr_intrusive_michael.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_threaded<> > RCU; - } -#endif - - void IntrusiveMichaelListHeaderTest::RCU_SHT_base_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHT_base_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef IntrusiveMichaelListHeaderTest::less less; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< RCU, item, traits > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHT_base_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHT_base_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef base_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHT_member_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHT_member_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHT_member_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_rcu_int(); -#endif - } - void IntrusiveMichaelListHeaderTest::RCU_SHT_member_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - typedef member_int_item< RCU > item; - typedef ci::MichaelList< RCU - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_rcu_int(); -#endif - } - -} diff --git a/tests/test-hdr/list/hdr_intrusive_michael_nogc.cpp b/tests/test-hdr/list/hdr_intrusive_michael_nogc.cpp deleted file mode 100644 index 66262860..00000000 --- a/tests/test-hdr/list/hdr_intrusive_michael_nogc.cpp +++ /dev/null @@ -1,155 +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 "list/hdr_intrusive_michael.h" -#include - -namespace ordlist { - void IntrusiveMichaelListHeaderTest::nogc_base_cmp() - { - typedef base_int_item< cds::gc::nogc > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef cmp compare; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< cds::gc::nogc, item, traits > list; - test_nogc_int(); - } - void IntrusiveMichaelListHeaderTest::nogc_base_less() - { - typedef base_int_item< cds::gc::nogc > item; - struct traits : public ci::michael_list::traits - { - typedef ci::michael_list::base_hook< co::gc > hook; - typedef IntrusiveMichaelListHeaderTest::less less; - typedef faked_disposer disposer; - }; - typedef ci::MichaelList< cds::gc::nogc, item, traits > list; - test_nogc_int(); - } - void IntrusiveMichaelListHeaderTest::nogc_base_cmpmix() - { - typedef base_int_item< cds::gc::nogc > item; - typedef ci::MichaelList< cds::gc::nogc - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_nogc_int(); - } - void IntrusiveMichaelListHeaderTest::nogc_base_ic() - { - typedef base_int_item< cds::gc::nogc > item; - typedef ci::MichaelList< cds::gc::nogc - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_nogc_int(); - } - void IntrusiveMichaelListHeaderTest::nogc_member_cmp() - { - typedef member_int_item< cds::gc::nogc > item; - typedef ci::MichaelList< cds::gc::nogc - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_nogc_int(); - } - void IntrusiveMichaelListHeaderTest::nogc_member_less() - { - typedef member_int_item< cds::gc::nogc > item; - typedef ci::MichaelList< cds::gc::nogc - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_nogc_int(); - } - void IntrusiveMichaelListHeaderTest::nogc_member_cmpmix() - { - typedef member_int_item< cds::gc::nogc > item; - typedef ci::MichaelList< cds::gc::nogc - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_nogc_int(); - } - void IntrusiveMichaelListHeaderTest::nogc_member_ic() - { - typedef member_int_item< cds::gc::nogc > item; - typedef ci::MichaelList< cds::gc::nogc - ,item - ,ci::michael_list::make_traits< - ci::opt::hook< ci::michael_list::member_hook< - offsetof( item, hMember ), - co::gc - > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_nogc_int(); - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_lazy.h b/tests/test-hdr/list/hdr_lazy.h deleted file mode 100644 index ddc3f9b0..00000000 --- a/tests/test-hdr/list/hdr_lazy.h +++ /dev/null @@ -1,976 +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_LAZY_H -#define CDSTEST_HDR_LAZY_H - -#include "cppunit/cppunit_proxy.h" -#include - -namespace ordlist { - namespace cc = cds::container; - namespace co = cds::container::opt; - - class LazyListTestHeader: public CppUnitMini::TestCase - { - public: - struct stat { - int nUpdateExistsCall; - int nUpdateNewCall; - - stat() - { - nUpdateExistsCall - = nUpdateNewCall - = 0; - } - }; - - struct item { - int nKey; - int nVal; - - stat s; - - item(int key) - : nKey( key ) - , nVal( key * 2 ) - , s() - {} - - item(int key, int val) - : nKey( key ) - , nVal(val) - , s() - {} - - item( item const& v ) - : nKey( v.nKey ) - , nVal( v.nVal ) - , s() - {} - - int key() const - { - return nKey; - } - }; - - template - struct lt - { - bool operator ()(const T& v1, const T& v2 ) const - { - return v1.key() < v2.key(); - } - - template - bool operator ()(const T& v1, const Q& v2 ) const - { - return v1.key() < v2; - } - - template - bool operator ()(const Q& v1, const T& v2 ) const - { - return v1 < v2.key(); - } - }; - - template - struct equal_to - { - bool operator ()(const T& v1, const T& v2 ) const - { - return v1.key() == v2.key(); - } - - template - bool operator ()(const T& v1, const Q& v2 ) const - { - return v1.key() == v2; - } - - template - bool operator ()(const Q& v1, const T& v2 ) const - { - return v1 == v2.key(); - } - }; - - template - struct cmp { - int operator ()(const T& v1, const T& v2 ) const - { - if ( v1.key() < v2.key() ) - return -1; - return v1.key() > v2.key() ? 1 : 0; - } - - template - int operator ()(const T& v1, const Q& v2 ) const - { - if ( v1.key() < v2 ) - return -1; - return v1.key() > v2 ? 1 : 0; - } - - template - int operator ()(const Q& v1, const T& v2 ) const - { - if ( v1 < v2.key() ) - return -1; - return v1 > v2.key() ? 1 : 0; - } - }; - - struct insert_functor { - void operator ()( item& i ) - { - i.nVal = i.nKey * 1033; - } - }; - struct dummy_insert_functor { - void operator ()( item& /*i*/ ) - { - // This functor should not be called - TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_insert_functor should not be called", __FILE__, __LINE__ ); - } - }; - - static void insert_function( item& i ) - { - i.nVal = i.nKey * 1024; - } - static void dummy_insert_function( item& /*i*/ ) - { - // This function should not be called - TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_insert_function should not be called", __FILE__, __LINE__ ); - } - - struct erase_functor { - unsigned int nEraseCall; - - erase_functor() - : nEraseCall(0) - {} - - void operator()( item const& /*i*/) - { - ++nEraseCall; - } - }; - - struct check_value { - unsigned int m_nMultiplier; - - check_value( unsigned int nMultiplier ) - : m_nMultiplier( nMultiplier ) - {} - - check_value( const check_value& s ) - : m_nMultiplier( s.m_nMultiplier ) - {} - - void operator()( item& i, int ) - { - CPPUNIT_ASSERT_CURRENT( int(i.nKey * m_nMultiplier) == i.nVal ); - } - }; - - struct check_exact_value { - int m_nExpected; - - check_exact_value( int nExpected ) - : m_nExpected( nExpected ) - {} - - check_exact_value( check_exact_value const& s) - : m_nExpected( s.m_nExpected ) - {} - - void operator()( item& i, int ) - { - CPPUNIT_ASSERT_CURRENT( i.nVal == m_nExpected ); - } - }; - - struct dummy_check_value { - void operator()( item& /*i*/, int ) - { - // This functor should not be called - TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_check_value should not be called", __FILE__, __LINE__ ); - } - }; - - struct update_functor { - void operator()( bool /*bNew*/, item& i, int /*n*/ ) - { - i.nVal = i.nKey * 1024; - } - }; - - static void update_func( bool /*bNew*/, item& i, int n ) - { - i.nVal = n * 1033; - } - - struct other_item - { - int nKey; - - other_item() - {} - - other_item(int n) - : nKey(n) - {} - }; - - struct other_less - { - template - bool operator()( T1 const& t1, T2 const& t2 ) const - { - return t1.nKey < t2.nKey; - } - }; - - protected: - template - void test_with( OrdList& l ) - { - typedef typename OrdList::value_type value_type; - - // The list should be empty - CPPUNIT_ASSERT( l.empty() ); - - // insert test - CPPUNIT_ASSERT( l.insert( 50 ) ); - CPPUNIT_ASSERT( l.insert( item( 25 )) ); - CPPUNIT_ASSERT( l.insert( item( 100 )) ); - - // insert failed - such key exists - CPPUNIT_ASSERT( !l.insert( 50 ) ); - CPPUNIT_ASSERT( !l.insert( item( 100 )) ); - - // clear test - - // The list should not be empty - CPPUNIT_ASSERT( !l.empty() ); - l.clear(); - // and now the list is empty - CPPUNIT_ASSERT( l.empty() ); - - // Test insert with functor - - CPPUNIT_ASSERT( l.insert( 100, insert_functor() ) ); - // passed by ref - { - insert_functor f; - CPPUNIT_ASSERT( l.insert( item( 25 ), std::ref( f ) ) ); - CPPUNIT_ASSERT( !l.insert( item( 100 ), std::ref( f ) ) ); - } - // Test insert with function - CPPUNIT_ASSERT( l.insert( 50, insert_function )); - CPPUNIT_ASSERT( !l.insert( 25, dummy_insert_function )); - CPPUNIT_ASSERT( !l.insert( 100, dummy_insert_functor() )); - - // The list should not be empty - CPPUNIT_ASSERT( !l.empty() ); - - // Check inserted values - { - int i; - i = 100; - - CPPUNIT_ASSERT( l.contains( 100 )); - CPPUNIT_ASSERT( l.find( i, check_value(1033) )); - { - check_value f(1033); - i = 25; - CPPUNIT_ASSERT( l.contains( 25, lt() )); - CPPUNIT_ASSERT( l.find_with( i, lt(), std::ref( f ) ) ); - } - i = 50; - CPPUNIT_ASSERT( l.contains( 50 )); - CPPUNIT_ASSERT( l.find( i, check_value(1024) )); - - i = 10; - CPPUNIT_ASSERT( !l.contains( 10, lt() )); - CPPUNIT_ASSERT( !l.find_with( i, lt(), dummy_check_value() )); - i = 75; - CPPUNIT_ASSERT( !l.contains( 75 )); - CPPUNIT_ASSERT( !l.find( i, dummy_check_value() )); - i = 150; - CPPUNIT_ASSERT( !l.contains( 150 )); - CPPUNIT_ASSERT( !l.find( i, dummy_check_value() )); - } - - // The list should not be empty - CPPUNIT_ASSERT( !l.empty() ); - l.clear(); - // and now the list is empty - CPPUNIT_ASSERT( l.empty() ); - - // Update test - { - std::pair updateResult; - update_functor f; - updateResult = l.update( 100, update_functor() ); - CPPUNIT_ASSERT( updateResult.first ); - CPPUNIT_ASSERT( updateResult.second ); - - updateResult = l.update( 200, std::ref( f ) ); - CPPUNIT_ASSERT( updateResult.first ); - CPPUNIT_ASSERT( updateResult.second ); - - updateResult = l.update( 50, update_func ); - CPPUNIT_ASSERT( updateResult.first ); - CPPUNIT_ASSERT( updateResult.second ); - - int i; - i = 100; - CPPUNIT_ASSERT( l.find( i, check_value(1024) )); - i = 50; - CPPUNIT_ASSERT( l.find( i, check_value(1033) )); - i = 200; - CPPUNIT_ASSERT( l.find( i, check_value(1024) )); - - // update existing key - updateResult = l.update( 200, update_func ); - CPPUNIT_ASSERT( updateResult.first ); - CPPUNIT_ASSERT( !updateResult.second ); - i = 200; - CPPUNIT_ASSERT( l.find( i, check_value(1033) )); - - updateResult = l.update( 50, update_functor() ); - CPPUNIT_ASSERT( updateResult.first ); - CPPUNIT_ASSERT( !updateResult.second ); - i = 50; - CPPUNIT_ASSERT( l.find( i, check_value(1024) )); - } - - // erase test (list: 50, 100, 200) - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( l.insert(160)); - CPPUNIT_ASSERT( l.insert(250)); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( !l.erase( 150 )); - - CPPUNIT_ASSERT( l.erase( 100 )); - CPPUNIT_ASSERT( !l.erase( 100 )); - - CPPUNIT_ASSERT( l.erase_with( 200, lt() )); - CPPUNIT_ASSERT( !l.erase_with( 200, lt() )); - - { - erase_functor ef; - CPPUNIT_ASSERT( ef.nEraseCall == 0 ); - CPPUNIT_ASSERT( l.erase_with( 160, lt(), std::ref(ef) )); - CPPUNIT_ASSERT( ef.nEraseCall == 1 ); - CPPUNIT_ASSERT( !l.erase_with( 160, lt(), std::ref(ef) )); - CPPUNIT_ASSERT( ef.nEraseCall == 1 ); - - CPPUNIT_ASSERT( l.erase( 250, std::ref(ef) )); - CPPUNIT_ASSERT( ef.nEraseCall == 2 ); - CPPUNIT_ASSERT( !l.erase( 250, std::ref(ef) )); - CPPUNIT_ASSERT( ef.nEraseCall == 2 ); - } - - CPPUNIT_ASSERT( l.erase( 50 )); - CPPUNIT_ASSERT( !l.erase( 50 )); - - CPPUNIT_ASSERT( l.empty() ); - - // clear empty list - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - { - int i; - // insert test - CPPUNIT_ASSERT( l.emplace( 501 ) ); - CPPUNIT_ASSERT( l.emplace( 251, 152 )); - CPPUNIT_ASSERT( l.emplace( item( 1001 )) ); - - // insert failed - such key exists - CPPUNIT_ASSERT( !l.emplace( 501, 2 ) ); - CPPUNIT_ASSERT( !l.emplace( 251, 10) ); - - i = 501; - CPPUNIT_ASSERT( l.find( i, check_exact_value(501*2) )); - i = 251; - CPPUNIT_ASSERT( l.find( i, check_exact_value(152) )); - i = 1001; - CPPUNIT_ASSERT( l.find( i, check_exact_value(1001*2) )); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - - // Iterator test - { - int nCount = 100; - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert( i ) ); - - { - typename OrdList::iterator it( l.begin() ); - typename OrdList::const_iterator cit( l.cbegin() ); - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++it; - CPPUNIT_CHECK( it != cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++cit; - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - } - - int i = 0; - for ( typename OrdList::iterator it = l.begin(), itEnd = l.end(); it != itEnd; ++it, ++i ) { - it->nVal = i * 2; - CPPUNIT_ASSERT( it->nKey == i ); - } - - // Check that we have visited all items - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.find( i, check_value(2) )); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Const iterator - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i) ); - - i = 0; - const OrdList& rl = l; - for ( typename OrdList::const_iterator it = rl.begin(), itEnd = rl.end(); it != itEnd; ++it, ++i ) { - // it->nVal = i * 2 ; // not! - CPPUNIT_ASSERT( it->nKey == i ); - } - - // Check that we have visited all items - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.find_with( i, lt(), check_value(2) )); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - } - - template - void test() - { - typedef typename OrdList::guarded_ptr guarded_ptr; - typedef typename OrdList::value_type value_type; - - OrdList l; - test_with( l ); - - static int const nLimit = 20; - int arr[nLimit]; - for ( int i = 0; i < nLimit; i++ ) - arr[i] = i; - shuffle( arr, arr + nLimit ); - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - l.insert( arr[i] ); - { - guarded_ptr gp; - for ( int i = 0; i < nLimit; ++i ) { - int nKey = arr[i]; - - gp = l.get( nKey ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == nKey ); - CPPUNIT_CHECK( gp->nVal == nKey * 2 ); - gp.release(); - - gp = l.extract( nKey ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == nKey ); - CPPUNIT_CHECK( gp->nVal == nKey*2 ); - gp.release(); - - gp = l.get( nKey ); - CPPUNIT_CHECK( !gp ); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract( nKey)); - CPPUNIT_CHECK( gp.empty()); - } - CPPUNIT_ASSERT( l.empty()); - CPPUNIT_CHECK( !l.get(arr[0])); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract( arr[0])); - CPPUNIT_CHECK( gp.empty()); - } - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) - l.insert( arr[i] ); - { - guarded_ptr gp; - for ( int i = 0; i < nLimit; ++i ) { - int nKey = arr[i]; - other_item key( nKey ); - - gp = l.get_with( key, other_less() ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == nKey ); - CPPUNIT_CHECK( gp->nVal == nKey * 2 ); - gp.release(); - - gp = l.extract_with( key, other_less() ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == nKey ); - CPPUNIT_CHECK( gp->nVal == nKey*2 ); - gp.release(); - - gp = l.get_with( key, other_less() ); - CPPUNIT_CHECK( !gp ); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract_with( key, other_less())); - CPPUNIT_CHECK( gp.empty()); - } - CPPUNIT_ASSERT( l.empty()); - CPPUNIT_CHECK( !l.get_with(other_item(arr[0]), other_less())); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract_with( other_item(arr[0]), other_less())); - CPPUNIT_CHECK( gp.empty()); - } - - } - - template - void test_rcu() - { - OrdList l; - test_with( l ); - - static int const nLimit = 20; - - typedef typename OrdList::rcu_lock rcu_lock; - typedef typename OrdList::value_type value_type; - typedef typename OrdList::gc rcu_type; - - { - int a[nLimit]; - for (int i = 0; i < nLimit; ++i) - a[i]=i; - shuffle( a, a + nLimit ); - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - CPPUNIT_ASSERT( l.insert( a[i] ) ); - - typename OrdList::exempt_ptr ep; - - for ( int i = 0; i < nLimit; ++i ) { - { - rcu_lock lock; - value_type * pGet = l.get( a[i] ); - CPPUNIT_ASSERT( pGet != nullptr ); - CPPUNIT_CHECK( pGet->nKey == a[i] ); - CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); - - ep = l.extract( a[i] ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->nKey == a[i] ); - CPPUNIT_CHECK( (*ep).nVal == a[i] * 2 ); - } - ep.release(); - { - rcu_lock lock; - CPPUNIT_CHECK( l.get( a[i] ) == nullptr ); - CPPUNIT_CHECK( !l.extract( a[i] )); - } - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( l.get( a[0] ) == nullptr ); - ep = l.extract( a[0] ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) { - CPPUNIT_ASSERT( l.insert( a[i] ) ); - } - - for ( int i = 0; i < nLimit; ++i ) { - other_item itm( a[i] ); - { - rcu_lock lock; - value_type * pGet = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( pGet != nullptr ); - CPPUNIT_CHECK( pGet->nKey == a[i] ); - CPPUNIT_CHECK( pGet->nVal == a[i] * 2 ); - - ep = l.extract_with( itm, other_less() ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->nKey == a[i] ); - CPPUNIT_CHECK( ep->nVal == a[i] * 2 ); - } - ep.release(); - { - rcu_lock lock; - CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr ); - ep = l.extract_with( itm, other_less() ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( l.get_with( other_item( 0 ), other_less() ) == nullptr ); - CPPUNIT_CHECK( !l.extract_with( other_item(0), other_less() )); - CPPUNIT_CHECK( ep.empty() ); - } - } - } - - template - void nogc_test() - { - typedef OrdList list; - typedef typename list::value_type value_type; - typedef std::pair update_result; - - typename list::iterator it; - - list l; - CPPUNIT_ASSERT( l.empty() ); - CPPUNIT_ASSERT( l.insert(50) != l.end() ); - CPPUNIT_ASSERT( !l.empty() ); - - update_result eres = l.update( item(100, 33) ); - CPPUNIT_ASSERT( eres.second ); - CPPUNIT_ASSERT( eres.first != l.end() ); - CPPUNIT_ASSERT( l.insert( item(150) ) != l.end() ); - - CPPUNIT_ASSERT( l.insert(100) == l.end() ); - eres = l.update( item(50, 33) ); - CPPUNIT_ASSERT( !eres.second ); - CPPUNIT_ASSERT( eres.first->nVal == eres.first->nKey * 2 ); - eres.first->nVal = 63; - - it = l.contains( 33 ); - CPPUNIT_ASSERT( it == l.end() ); - - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 50 ); - CPPUNIT_ASSERT( it->nVal == 63 ); - - it = l.contains( 100 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 100 ); - CPPUNIT_ASSERT( it->nVal == 33 ); - - it = l.contains( 150, lt() ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 150 ); - CPPUNIT_ASSERT( it->nVal == it->nKey * 2 ); - - CPPUNIT_ASSERT( !l.empty() ); - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // insert test - CPPUNIT_ASSERT( l.emplace( 501 ) != l.end()); - CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end()); - CPPUNIT_ASSERT( l.emplace( item( 1001 )) != l.end()); - - // insert failed - such key exists - CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end()); - CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end()); - - it = l.contains( 501 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 501 ); - CPPUNIT_ASSERT( it->nVal == 501 * 2 ); - - it = l.contains( 251, lt() ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 251 ); - CPPUNIT_ASSERT( it->nVal == 152 ); - - it = l.contains( 1001 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 1001 ); - CPPUNIT_ASSERT( it->nVal == 1001 * 2 ); - - { - typename OrdList::iterator it( l.begin() ); - typename OrdList::const_iterator cit( l.cbegin() ); - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++it; - CPPUNIT_CHECK( it != cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++cit; - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - } - - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - - template - void nogc_unord_test() - { - typedef UnordList list; - typedef typename list::value_type value_type; - typedef std::pair update_result; - - typename list::iterator it; - - list l; - CPPUNIT_ASSERT( l.empty() ); - CPPUNIT_ASSERT( l.insert(50) != l.end() ); - CPPUNIT_ASSERT( !l.empty() ); - - update_result eres = l.update( item(100, 33) ); - CPPUNIT_ASSERT( eres.second ); - CPPUNIT_ASSERT( eres.first != l.end() ); - CPPUNIT_ASSERT( l.insert( item(150) ) != l.end() ); - - CPPUNIT_ASSERT( l.insert(100) == l.end() ); - eres = l.update( item(50, 33) ); - CPPUNIT_ASSERT( !eres.second ); - CPPUNIT_ASSERT( eres.first->nVal == eres.first->nKey * 2 ); - eres.first->nVal = 63; - - it = l.contains( 33 ); - CPPUNIT_ASSERT( it == l.end() ); - - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 50 ); - CPPUNIT_ASSERT( it->nVal == 63 ); - - it = l.contains( 100 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 100 ); - CPPUNIT_ASSERT( it->nVal == 33 ); - - it = l.contains( 150, equal_to() ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 150 ); - CPPUNIT_ASSERT( it->nVal == it->nKey * 2 ); - - CPPUNIT_ASSERT( !l.empty() ); - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // insert test - CPPUNIT_ASSERT( l.emplace( 501 ) != l.end()); - CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end()); - CPPUNIT_ASSERT( l.emplace( item( 1001 )) != l.end()); - - // insert failed - such key exists - CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end()); - CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end()); - - it = l.contains( 501 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 501 ); - CPPUNIT_ASSERT( it->nVal == 501 * 2 ); - - it = l.contains( 1001 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 1001 ); - CPPUNIT_ASSERT( it->nVal == 1001 * 2 ); - - { - typename UnordList::iterator it( l.begin() ); - typename UnordList::const_iterator cit( l.cbegin() ); - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++it; - CPPUNIT_CHECK( it != cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++cit; - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - } - - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - - void HP_cmp(); - void HP_less(); - void HP_cmpmix(); - void HP_ic(); - - void DHP_cmp(); - void DHP_less(); - void DHP_cmpmix(); - void DHP_ic(); - - void RCU_GPI_cmp(); - void RCU_GPI_less(); - void RCU_GPI_cmpmix(); - void RCU_GPI_ic(); - - void RCU_GPB_cmp(); - void RCU_GPB_less(); - void RCU_GPB_cmpmix(); - void RCU_GPB_ic(); - - void RCU_GPT_cmp(); - void RCU_GPT_less(); - void RCU_GPT_cmpmix(); - void RCU_GPT_ic(); - - void RCU_SHB_cmp(); - void RCU_SHB_less(); - void RCU_SHB_cmpmix(); - void RCU_SHB_ic(); - - void RCU_SHT_cmp(); - void RCU_SHT_less(); - void RCU_SHT_cmpmix(); - void RCU_SHT_ic(); - - void NOGC_cmp(); - void NOGC_less(); - void NOGC_cmpmix(); - void NOGC_ic(); - - void NOGC_cmp_unord(); - void NOGC_less_unord(); - void NOGC_equal_to_unord(); - void NOGC_cmpmix_unord(); - void NOGC_equal_to_mix_unord(); - void NOGC_ic_unord(); - - - CPPUNIT_TEST_SUITE(LazyListTestHeader) - CPPUNIT_TEST(HP_cmp) - CPPUNIT_TEST(HP_less) - CPPUNIT_TEST(HP_cmpmix) - CPPUNIT_TEST(HP_ic) - - CPPUNIT_TEST(DHP_cmp) - CPPUNIT_TEST(DHP_less) - CPPUNIT_TEST(DHP_cmpmix) - CPPUNIT_TEST(DHP_ic) - - CPPUNIT_TEST(RCU_GPI_cmp) - CPPUNIT_TEST(RCU_GPI_less) - CPPUNIT_TEST(RCU_GPI_cmpmix) - CPPUNIT_TEST(RCU_GPI_ic) - - CPPUNIT_TEST(RCU_GPB_cmp) - CPPUNIT_TEST(RCU_GPB_less) - CPPUNIT_TEST(RCU_GPB_cmpmix) - CPPUNIT_TEST(RCU_GPB_ic) - - CPPUNIT_TEST(RCU_GPT_cmp) - CPPUNIT_TEST(RCU_GPT_less) - CPPUNIT_TEST(RCU_GPT_cmpmix) - CPPUNIT_TEST(RCU_GPT_ic) - - CPPUNIT_TEST(RCU_SHB_cmp) - CPPUNIT_TEST(RCU_SHB_less) - CPPUNIT_TEST(RCU_SHB_cmpmix) - CPPUNIT_TEST(RCU_SHB_ic) - - CPPUNIT_TEST(RCU_SHT_cmp) - CPPUNIT_TEST(RCU_SHT_less) - CPPUNIT_TEST(RCU_SHT_cmpmix) - CPPUNIT_TEST(RCU_SHT_ic) - - CPPUNIT_TEST(NOGC_cmp) - CPPUNIT_TEST(NOGC_less) - CPPUNIT_TEST(NOGC_cmpmix) - CPPUNIT_TEST(NOGC_ic) - - CPPUNIT_TEST(NOGC_cmp_unord) - CPPUNIT_TEST(NOGC_less_unord) - CPPUNIT_TEST(NOGC_equal_to_unord) - CPPUNIT_TEST(NOGC_cmpmix_unord) - CPPUNIT_TEST(NOGC_equal_to_mix_unord) - CPPUNIT_TEST(NOGC_ic_unord) - - CPPUNIT_TEST_SUITE_END() - }; - -} // namespace ordlist - -#endif // #ifndef CDSTEST_HDR_LAZY_H diff --git a/tests/test-hdr/list/hdr_lazy_dhp.cpp b/tests/test-hdr/list/hdr_lazy_dhp.cpp deleted file mode 100644 index 22937199..00000000 --- a/tests/test-hdr/list/hdr_lazy_dhp.cpp +++ /dev/null @@ -1,128 +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 "list/hdr_lazy.h" -#include - -namespace ordlist { - namespace { - struct DHP_cmp_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - }; - } - void LazyListTestHeader::DHP_cmp() - { - // traits-based version - typedef cc::LazyList< cds::gc::DHP, item, DHP_cmp_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::DHP, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_less_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::DHP_less() - { - // traits-based version - typedef cc::LazyList< cds::gc::DHP, item, DHP_less_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::DHP, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_cmpmix_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::DHP_cmpmix() - { - // traits-based version - typedef cc::LazyList< cds::gc::DHP, item, DHP_cmpmix_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::DHP, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_ic_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyListTestHeader::DHP_ic() - { - // traits-based version - typedef cc::LazyList< cds::gc::DHP, item, DHP_ic_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::DHP, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_hp.cpp b/tests/test-hdr/list/hdr_lazy_hp.cpp deleted file mode 100644 index dbb909ee..00000000 --- a/tests/test-hdr/list/hdr_lazy_hp.cpp +++ /dev/null @@ -1,130 +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 "list/hdr_lazy.h" -#include - -namespace ordlist { - namespace { - struct HP_cmp_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - }; - - } - void LazyListTestHeader::HP_cmp() - { - // traits-based version - typedef cc::LazyList< cds::gc::HP, item, HP_cmp_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::HP, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_less_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::HP_less() - { - // traits-based version - typedef cc::LazyList< cds::gc::HP, item, HP_less_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::HP, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_cmpmix_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::HP_cmpmix() - { - // traits-based version - typedef cc::LazyList< cds::gc::HP, item, HP_cmpmix_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::HP, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_ic_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyListTestHeader::HP_ic() - { - // traits-based version - typedef cc::LazyList< cds::gc::HP, item, HP_ic_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::HP, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test< opt_list >(); - } - -} // namespace ordlist - -CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::LazyListTestHeader); diff --git a/tests/test-hdr/list/hdr_lazy_kv.h b/tests/test-hdr/list/hdr_lazy_kv.h deleted file mode 100644 index 8833a20e..00000000 --- a/tests/test-hdr/list/hdr_lazy_kv.h +++ /dev/null @@ -1,961 +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_LAZY_KV_H -#define CDSTEST_HDR_LAZY_KV_H - -#include "cppunit/cppunit_proxy.h" -#include - -namespace ordlist { - namespace cc = cds::container; - namespace co = cds::container::opt; - - class LazyKVListTestHeader: public CppUnitMini::TestCase - { - public: - typedef int key_type; - struct value_type { - int m_val; - - value_type() - : m_val(0) - {} - - value_type( int n ) - : m_val( n ) - {} - }; - - template - struct lt - { - bool operator ()(const T& v1, const T& v2 ) const - { - return v1 < v2; - } - }; - - template - struct cmp { - int operator ()(const T& v1, const T& v2 ) const - { - if ( v1 < v2 ) - return -1; - return v1 > v2 ? 1 : 0; - } - }; - - template - struct eq { - bool operator ()(const T& v1, const T& v2 ) const - { - return v1 == v2; - } - }; - - struct check_value { - int m_nExpected; - - check_value( int nExpected ) - : m_nExpected( nExpected ) - {} - - template - void operator ()( T& pair ) - { - CPPUNIT_ASSERT_CURRENT( pair.second.m_val == m_nExpected ); - } - }; - - struct insert_functor { - template - void operator()( T& pair ) - { - pair.second.m_val = pair.first * 10; - } - }; - - struct update_functor { - template - void operator()( bool /*bNew*/, T& pair ) - { - pair.second.m_val = pair.first * 50; - } - }; - - struct erase_functor { - int nKey; - int nVal; - - erase_functor() - : nKey(0) - , nVal(0) - {} - - template - void operator()( T& i ) - { - nKey = i.first; - nVal = i.second.m_val; - } - }; - - typedef float other_key; - struct other_less { - bool operator()( float f, int i ) const - { - return int(f) < i; - } - bool operator()( int i, float f ) const - { - return i < int(f); - } - }; - - protected: - template - void test_with( OrdList& l) - { - typedef typename OrdList::value_type value_type; - - typename OrdList::iterator itTest; - typename OrdList::const_iterator citTest; - - CPPUNIT_ASSERT( l.empty() ); - - // insert / find test - CPPUNIT_ASSERT( !l.contains( 100 )); - CPPUNIT_ASSERT( l.insert( 100 )); - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( l.contains( 100 )); - - check_value chk(0); - CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) ); - - CPPUNIT_ASSERT( !l.contains( 50, lt() )); - CPPUNIT_ASSERT( l.insert( 50, 500 )); - CPPUNIT_ASSERT( l.contains( 50, lt() )); - CPPUNIT_ASSERT( !l.insert( 50, 5 )); - chk.m_nExpected = 500; - CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) ); - chk.m_nExpected = 0; - CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( !l.contains( 150 )); - CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() )); - CPPUNIT_ASSERT( l.contains( 150 )); - chk.m_nExpected = 1500; - CPPUNIT_ASSERT( l.find_with( 150, lt(), std::ref( chk ) ) ); - chk.m_nExpected = 0; - CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) ); - chk.m_nExpected = 500; - CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) ); - CPPUNIT_ASSERT( !l.empty() ); - - // erase test - - CPPUNIT_ASSERT( !l.erase( 500 )); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.contains( 50 )); - { - erase_functor ef; - l.erase( 50, std::ref( ef ) ); - CPPUNIT_ASSERT( ef.nKey == 50 ); - CPPUNIT_ASSERT( ef.nVal == 500 ); - } - CPPUNIT_ASSERT( !l.contains( 50 )); - - // update test - std::pair bUpdateResult; - bUpdateResult = l.update( 100, update_functor() ); - CPPUNIT_ASSERT( bUpdateResult.first ); - CPPUNIT_ASSERT( !bUpdateResult.second ); - chk.m_nExpected = 5000; - CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) ); - - { - update_functor ef; - bUpdateResult = l.update( 50, std::ref( ef ) ); - } - CPPUNIT_ASSERT( bUpdateResult.first ); - CPPUNIT_ASSERT( bUpdateResult.second ); - chk.m_nExpected = 2500; - CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) ); - - // erase test - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( l.insert_with( 200, insert_functor() )); - CPPUNIT_ASSERT( l.insert( 25 )); - CPPUNIT_ASSERT( l.erase( 100 )); - CPPUNIT_ASSERT( l.erase( 150 )); - { - erase_functor ef; - CPPUNIT_ASSERT( l.erase_with( 200, lt(), std::ref(ef)) ); - CPPUNIT_ASSERT( ef.nKey == 200 ); - CPPUNIT_ASSERT( ef.nVal == 2000 ); - } - CPPUNIT_ASSERT( l.erase_with( 25, lt())) - CPPUNIT_ASSERT( l.erase( 50 )); - CPPUNIT_ASSERT( l.empty() ); - - // clear empty list - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // insert test - CPPUNIT_ASSERT( l.emplace( 501 ) ); - CPPUNIT_ASSERT( l.emplace( 251, 152 )); - - // insert failed - such key exists - CPPUNIT_ASSERT( !l.emplace( 501, 2 ) ); - CPPUNIT_ASSERT( !l.emplace( 251, 10) ); - - check_value cv(0); - CPPUNIT_ASSERT( l.find( 501, std::ref(cv) )); - cv.m_nExpected = 152; - CPPUNIT_ASSERT( l.find( 251, std::ref(cv) )); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Iterator test - { - int nCount = 100; - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i, i * 2 ) ); - - { - typename OrdList::iterator it( l.begin() ); - typename OrdList::const_iterator cit( l.cbegin() ); - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++it; - CPPUNIT_CHECK( it != cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++cit; - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - } - - int i = 0; - for ( typename OrdList::iterator it = l.begin(), itEnd = l.end(); it != itEnd; ++it, ++i ) { - CPPUNIT_ASSERT( it.key() == i ); - CPPUNIT_ASSERT( it.val().m_val == i * 2 ); - it.val().m_val = i * 3; - } - - // Check that we have visited all items - for ( int i = 0; i < nCount; ++i ) { - chk.m_nExpected = i * 3; - CPPUNIT_ASSERT( l.find( i, std::ref( chk ) ) ); - } - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Const iterator - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i, i * 7) ); - - i = 0; - const OrdList& rl = l; - for ( typename OrdList::const_iterator it = rl.begin(), itEnd = rl.end(); it != itEnd; ++it, ++i ) { - CPPUNIT_ASSERT( it.key() == i ); - CPPUNIT_ASSERT( it.val().m_val == i * 7 ); - } - - // Check that we have visited all items - for ( int i = nCount; i > 0; --i ) { - chk.m_nExpected = (i - 1) * 7; - CPPUNIT_ASSERT( l.find_with( i - 1, lt(), std::ref( chk ) ) ); - } - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - } - - template - void test() - { - OrdList l; - test_with(l); - - typedef typename OrdList::guarded_ptr guarded_ptr; - - static int const nLimit = 20; - int arr[nLimit]; - for ( int i = 0; i < nLimit; i++ ) - arr[i] = i; - shuffle( arr, arr + nLimit ); - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - l.insert( arr[i], arr[i] * 2 ); - { - guarded_ptr gp; - for ( int i = 0; i < nLimit; ++i ) { - int nKey = arr[i]; - - gp = l.get( nKey ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->first == nKey ); - CPPUNIT_CHECK( gp->second.m_val == nKey * 2 ); - gp.release(); - - gp = l.extract( nKey ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->first == nKey ); - CPPUNIT_CHECK( gp->second.m_val == nKey*2 ); - gp.release(); - - gp = l.get( nKey ); - CPPUNIT_CHECK( !gp ); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract( nKey)); - CPPUNIT_CHECK( gp.empty()); - } - CPPUNIT_ASSERT( l.empty()); - CPPUNIT_CHECK( !l.get(arr[0])); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract( arr[0])); - CPPUNIT_CHECK( gp.empty()); - } - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) - l.insert( arr[i], arr[i] * 2 ); - { - guarded_ptr gp; - for ( int i = 0; i < nLimit; ++i ) { - int nKey = arr[i]; - other_key key = float(nKey + 0.3); - - gp = l.get_with( key, other_less() ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->first == nKey ); - CPPUNIT_CHECK( gp->second.m_val == nKey * 2 ); - gp.release(); - - gp = l.extract_with( key, other_less() ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->first == nKey ); - CPPUNIT_CHECK( gp->second.m_val == nKey*2 ); - gp.release(); - - gp = l.get_with( key, other_less() ); - CPPUNIT_CHECK( !gp ); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract_with( key, other_less())); - CPPUNIT_CHECK( gp.empty()); - } - CPPUNIT_ASSERT( l.empty()); - CPPUNIT_CHECK( !l.get_with(3.4f, other_less())); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract_with( 3.4f, other_less())); - CPPUNIT_CHECK( gp.empty()); - } - } - - template - void test_rcu() - { - OrdList l; - test_with(l); - - static int const nLimit = 20; - - typedef typename OrdList::rcu_lock rcu_lock; - typedef typename OrdList::value_type value_type; - typedef typename OrdList::gc rcu_type; - - { - int a[nLimit]; - for (int i = 0; i < nLimit; ++i) - a[i]=i; - shuffle( a, a + nLimit ); - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - CPPUNIT_ASSERT( l.insert( a[i], a[i]*2 ) ); - - typename OrdList::exempt_ptr ep; - - for ( int i = 0; i < nLimit; ++i ) { - { - rcu_lock lock; - value_type * pGet = l.get( a[i] ); - CPPUNIT_ASSERT( pGet != nullptr ); - CPPUNIT_CHECK( pGet->first == a[i] ); - CPPUNIT_CHECK( pGet->second.m_val == a[i] * 2 ); - - ep = l.extract( a[i] ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->first == a[i] ); - CPPUNIT_CHECK( (*ep).second.m_val == a[i] * 2 ); - } - ep.release(); - { - rcu_lock lock; - CPPUNIT_CHECK( l.get( a[i] ) == nullptr ); - ep = l.extract( a[i] ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( l.get( a[0] ) == nullptr ); - CPPUNIT_CHECK( !l.extract( a[0] ) ); - } - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) { - CPPUNIT_ASSERT( l.insert( a[i], a[i]*2 ) ); - } - - for ( int i = 0; i < nLimit; ++i ) { - float itm = a[i] + 0.3f; - { - rcu_lock lock; - value_type * pGet = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( pGet != nullptr ); - CPPUNIT_CHECK( pGet->first == a[i] ); - CPPUNIT_CHECK( pGet->second.m_val == a[i] * 2 ); - - ep = l.extract_with( itm, other_less() ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->first == a[i] ); - CPPUNIT_CHECK( ep->second.m_val == a[i] * 2 ); - } - ep.release(); - { - rcu_lock lock; - CPPUNIT_CHECK( l.get_with( itm, other_less()) == nullptr ); - ep = l.extract_with( itm, other_less() ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( l.get_with( 3.14f, other_less() ) == nullptr ); - CPPUNIT_CHECK( !l.extract_with( 3.14f, other_less() )); - CPPUNIT_CHECK( ep.empty() ); - } - } - } - - template - void nogc_test() - { - typedef typename OrdList::value_type value_type; - typedef typename OrdList::iterator iterator; - - { - OrdList l; - iterator it; - - CPPUNIT_ASSERT( l.empty() ); - - // insert / find test - CPPUNIT_ASSERT( l.contains( 100 ) == l.end() ); - CPPUNIT_ASSERT( l.insert( 100 ) != l.end() ); - CPPUNIT_ASSERT( !l.empty() ); - it = l.contains( 100 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 100 ); - CPPUNIT_ASSERT( it.val().m_val == 0 ); - - CPPUNIT_ASSERT( l.contains( 50, lt() ) == l.end() ); - CPPUNIT_ASSERT( l.insert( 50, 500 ) != l.end()); - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 500 ); - - CPPUNIT_ASSERT( l.insert( 50, 5 ) == l.end() ); - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 500 ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.contains( 150 ) == l.end() ); - CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() ) != l.end() ); - it = l.contains( 150 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 150 ); - CPPUNIT_ASSERT( it.val().m_val == 1500 ); - it = l.contains( 100 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 100 ); - CPPUNIT_ASSERT( it.val().m_val == 0 ); - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 500 ); - it.val().m_val = 25; - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 25 ); - CPPUNIT_ASSERT( !l.empty() ); - - // update existing item - std::pair updateResult; - updateResult = l.update( 100 ); - CPPUNIT_ASSERT( !updateResult.second ); - CPPUNIT_ASSERT( updateResult.first.key() == 100 ); - CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 ); - updateResult.first.val().m_val = 5; - it = l.contains( 100 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 100 ); - CPPUNIT_ASSERT( it.val().m_val == 5 ); - - CPPUNIT_ASSERT( !l.empty() ); - - // update new item - updateResult = l.update( 1000 ); - CPPUNIT_ASSERT( updateResult.second ); - CPPUNIT_ASSERT( updateResult.first.key() == 1000 ); - CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 ); - updateResult.first.val().m_val = 33; - updateResult = l.update( 1000 ); - CPPUNIT_ASSERT( !updateResult.second ); - CPPUNIT_ASSERT( updateResult.first.key() == 1000 ); - CPPUNIT_ASSERT( updateResult.first.val().m_val == 33 ); - - // clear test - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // insert test - CPPUNIT_ASSERT( l.emplace( 501 ) != l.end()); - CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end()); - - // insert failed - such key exists - CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end()); - CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end()); - - it = l.contains(501); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 501 ); - CPPUNIT_ASSERT( it.val().m_val == 0 ); - - it = l.contains(251); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 251 ); - CPPUNIT_ASSERT( it.val().m_val == 152 ); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Iterator test - { - int nCount = 100; - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i, i * 2 ) != l.end() ); - - { - typename OrdList::iterator it( l.begin() ); - typename OrdList::const_iterator cit( l.cbegin() ); - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++it; - CPPUNIT_CHECK( it != cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++cit; - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - } - - int i = 0; - for ( typename OrdList::iterator iter = l.begin(), itEnd = l.end(); iter != itEnd; ++iter, ++i ) { - CPPUNIT_ASSERT( iter.key() == i ); - CPPUNIT_ASSERT( iter->first == i ); - CPPUNIT_ASSERT( (*iter).first == i ); - - CPPUNIT_ASSERT( iter.val().m_val == i * 2 ); - CPPUNIT_ASSERT( iter->second.m_val == i * 2 ); - CPPUNIT_ASSERT( (*iter).second.m_val == i * 2 ); - - iter.val().m_val = i * 3; - } - - // Check that we have visited all items - for ( int i = 0; i < nCount; ++i ) { - it = l.contains( i ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == i ); - CPPUNIT_ASSERT( it.val().m_val == i * 3 ); - } - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Const iterator - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i, i * 7) != l.end() ); - - i = 0; - const OrdList& rl = l; - for ( typename OrdList::const_iterator iter = rl.begin(), itEnd = rl.end(); iter != itEnd; ++iter, ++i ) { - CPPUNIT_ASSERT( iter.key() == i ); - CPPUNIT_ASSERT( iter->first == i ); - CPPUNIT_ASSERT( (*iter).first == i ); - - CPPUNIT_ASSERT( iter.val().m_val == i * 7 ); - CPPUNIT_ASSERT( iter->second.m_val == i * 7 ); - CPPUNIT_ASSERT( (*iter).second.m_val == i * 7 ); - // it.val().m_val = i * 3 ; // error: const-iterator - } - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - - } - } - - template - void nogc_unord_test() - { - typedef typename UnordList::value_type value_type; - typedef typename UnordList::iterator iterator; - - { - UnordList l; - iterator it; - - CPPUNIT_ASSERT( l.empty() ); - - // insert / find test - CPPUNIT_ASSERT( l.contains( 100 ) == l.end() ); - CPPUNIT_ASSERT( l.insert( 100 ) != l.end() ); - CPPUNIT_ASSERT( !l.empty() ); - it = l.contains( 100 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 100 ); - CPPUNIT_ASSERT( it.val().m_val == 0 ); - - CPPUNIT_ASSERT( l.contains( 50, eq() ) == l.end() ); - CPPUNIT_ASSERT( l.insert( 50, 500 ) != l.end()); - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 500 ); - - CPPUNIT_ASSERT( l.insert( 50, 5 ) == l.end() ); - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 500 ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.contains( 150 ) == l.end() ); - CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() ) != l.end() ); - it = l.contains( 150 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 150 ); - CPPUNIT_ASSERT( it.val().m_val == 1500 ); - it = l.contains( 100 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 100 ); - CPPUNIT_ASSERT( it.val().m_val == 0 ); - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 500 ); - it.val().m_val = 25; - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 25 ); - CPPUNIT_ASSERT( !l.empty() ); - - // update existing item - std::pair updateResult; - updateResult = l.update( 100 ); - CPPUNIT_ASSERT( !updateResult.second ); - CPPUNIT_ASSERT( updateResult.first.key() == 100 ); - CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 ); - updateResult.first.val().m_val = 5; - it = l.contains( 100 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 100 ); - CPPUNIT_ASSERT( it.val().m_val == 5 ); - - CPPUNIT_ASSERT( !l.empty() ); - - // update new item - updateResult = l.update( 1000 ); - CPPUNIT_ASSERT( updateResult.second ); - CPPUNIT_ASSERT( updateResult.first.key() == 1000 ); - CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 ); - updateResult.first.val().m_val = 33; - updateResult = l.update( 1000 ); - CPPUNIT_ASSERT( !updateResult.second ); - CPPUNIT_ASSERT( updateResult.first.key() == 1000 ); - CPPUNIT_ASSERT( updateResult.first.val().m_val == 33 ); - - // clear test - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // insert test - CPPUNIT_ASSERT( l.emplace( 501 ) != l.end()); - CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end()); - - // insert failed - such key exists - CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end()); - CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end()); - - it = l.contains(501); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 501 ); - CPPUNIT_ASSERT( it.val().m_val == 0 ); - - it = l.contains(251); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 251 ); - CPPUNIT_ASSERT( it.val().m_val == 152 ); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Iterator test - { - int nCount = 100; - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i, i * 2 ) != l.end() ); - - { - typename UnordList::iterator it( l.begin() ); - typename UnordList::const_iterator cit( l.cbegin() ); - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++it; - CPPUNIT_CHECK( it != cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++cit; - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - } - - int i = 0; - for ( typename UnordList::iterator iter = l.begin(), itEnd = l.end(); iter != itEnd; ++iter, ++i ) { - CPPUNIT_ASSERT( iter.key() == i ); - CPPUNIT_ASSERT( iter->first == i ); - CPPUNIT_ASSERT( (*iter).first == i ); - - CPPUNIT_ASSERT( iter.val().m_val == i * 2 ); - CPPUNIT_ASSERT( iter->second.m_val == i * 2 ); - CPPUNIT_ASSERT( (*iter).second.m_val == i * 2 ); - - iter.val().m_val = i * 3; - } - - // Check that we have visited all items - for ( int i = 0; i < nCount; ++i ) { - it = l.contains( i ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == i ); - CPPUNIT_ASSERT( it.val().m_val == i * 3 ); - } - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Const iterator - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i, i * 7) != l.end() ); - - i = 0; - const UnordList& rl = l; - for ( typename UnordList::const_iterator iter = rl.begin(), itEnd = rl.end(); iter != itEnd; ++iter, ++i ) { - CPPUNIT_ASSERT( iter.key() == i ); - CPPUNIT_ASSERT( iter->first == i ); - CPPUNIT_ASSERT( (*iter).first == i ); - - CPPUNIT_ASSERT( iter.val().m_val == i * 7 ); - CPPUNIT_ASSERT( iter->second.m_val == i * 7 ); - CPPUNIT_ASSERT( (*iter).second.m_val == i * 7 ); - // it.val().m_val = i * 3 ; // error: const-iterator - } - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - - } - } - - - void HP_cmp(); - void HP_less(); - void HP_cmpmix(); - void HP_ic(); - - void DHP_cmp(); - void DHP_less(); - void DHP_cmpmix(); - void DHP_ic(); - - void RCU_GPI_cmp(); - void RCU_GPI_less(); - void RCU_GPI_cmpmix(); - void RCU_GPI_ic(); - - void RCU_GPB_cmp(); - void RCU_GPB_less(); - void RCU_GPB_cmpmix(); - void RCU_GPB_ic(); - - void RCU_GPT_cmp(); - void RCU_GPT_less(); - void RCU_GPT_cmpmix(); - void RCU_GPT_ic(); - - void RCU_SHB_cmp(); - void RCU_SHB_less(); - void RCU_SHB_cmpmix(); - void RCU_SHB_ic(); - - void RCU_SHT_cmp(); - void RCU_SHT_less(); - void RCU_SHT_cmpmix(); - void RCU_SHT_ic(); - - void NOGC_cmp(); - void NOGC_less(); - void NOGC_cmpmix(); - void NOGC_ic(); - - void NOGC_cmp_unord(); - void NOGC_less_unord(); - void NOGC_equal_to_unord(); - void NOGC_cmpmix_unord(); - void NOGC_ic_unord(); - - CPPUNIT_TEST_SUITE(LazyKVListTestHeader) - CPPUNIT_TEST(HP_cmp) - CPPUNIT_TEST(HP_less) - CPPUNIT_TEST(HP_cmpmix) - CPPUNIT_TEST(HP_ic) - - CPPUNIT_TEST(DHP_cmp) - CPPUNIT_TEST(DHP_less) - CPPUNIT_TEST(DHP_cmpmix) - CPPUNIT_TEST(DHP_ic) - - CPPUNIT_TEST(RCU_GPI_cmp) - CPPUNIT_TEST(RCU_GPI_less) - CPPUNIT_TEST(RCU_GPI_cmpmix) - CPPUNIT_TEST(RCU_GPI_ic) - - CPPUNIT_TEST(RCU_GPB_cmp) - CPPUNIT_TEST(RCU_GPB_less) - CPPUNIT_TEST(RCU_GPB_cmpmix) - CPPUNIT_TEST(RCU_GPB_ic) - - CPPUNIT_TEST(RCU_GPT_cmp) - CPPUNIT_TEST(RCU_GPT_less) - CPPUNIT_TEST(RCU_GPT_cmpmix) - CPPUNIT_TEST(RCU_GPT_ic) - - CPPUNIT_TEST(RCU_SHB_cmp) - CPPUNIT_TEST(RCU_SHB_less) - CPPUNIT_TEST(RCU_SHB_cmpmix) - CPPUNIT_TEST(RCU_SHB_ic) - - CPPUNIT_TEST(RCU_SHT_cmp) - CPPUNIT_TEST(RCU_SHT_less) - CPPUNIT_TEST(RCU_SHT_cmpmix) - CPPUNIT_TEST(RCU_SHT_ic) - - CPPUNIT_TEST(NOGC_cmp) - CPPUNIT_TEST(NOGC_less) - CPPUNIT_TEST(NOGC_cmpmix) - CPPUNIT_TEST(NOGC_ic) - - CPPUNIT_TEST(NOGC_cmp_unord) - CPPUNIT_TEST(NOGC_less_unord) - CPPUNIT_TEST(NOGC_equal_to_unord) - CPPUNIT_TEST(NOGC_cmpmix_unord) - CPPUNIT_TEST(NOGC_ic_unord) - - CPPUNIT_TEST_SUITE_END() - }; - -} // namespace ordlist - -#endif // #ifndef CDSTEST_HDR_LAZY_KV_H diff --git a/tests/test-hdr/list/hdr_lazy_kv_dhp.cpp b/tests/test-hdr/list/hdr_lazy_kv_dhp.cpp deleted file mode 100644 index dc1b1723..00000000 --- a/tests/test-hdr/list/hdr_lazy_kv_dhp.cpp +++ /dev/null @@ -1,128 +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 "list/hdr_lazy_kv.h" -#include - -namespace ordlist { - namespace { - struct DHP_cmp_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - }; - } - void LazyKVListTestHeader::DHP_cmp() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, DHP_cmp_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_less_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::DHP_less() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, DHP_less_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::DHP_cmpmix() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, DHP_cmpmix_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_ic_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyKVListTestHeader::DHP_ic() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, DHP_ic_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::DHP, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_kv_hp.cpp b/tests/test-hdr/list/hdr_lazy_kv_hp.cpp deleted file mode 100644 index a8c4bffd..00000000 --- a/tests/test-hdr/list/hdr_lazy_kv_hp.cpp +++ /dev/null @@ -1,132 +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 "list/hdr_lazy_kv.h" -#include - -namespace ordlist { - namespace { - struct HP_cmp_traits: public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - }; - - } - void LazyKVListTestHeader::HP_cmp() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, HP_cmp_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::HP, - key_type, - value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_less_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::HP_less() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, HP_less_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::HP_cmpmix() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, HP_cmpmix_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_ic_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyKVListTestHeader::HP_ic() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, HP_ic_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::HP, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test< opt_list >(); - } - -} // namespace ordlist - -CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::LazyKVListTestHeader); diff --git a/tests/test-hdr/list/hdr_lazy_kv_nogc.cpp b/tests/test-hdr/list/hdr_lazy_kv_nogc.cpp deleted file mode 100644 index 673ce4a9..00000000 --- a/tests/test-hdr/list/hdr_lazy_kv_nogc.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 "list/hdr_lazy_kv.h" -#include - -namespace ordlist { - namespace { - struct NOGC_cmp_traits: public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - }; - - } - void LazyKVListTestHeader::NOGC_cmp() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_cmp_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::nogc, - key_type, - value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_less_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::NOGC_less() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_less_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::NOGC_cmpmix() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_cmpmix_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_ic_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyKVListTestHeader::NOGC_ic() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_ic_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - nogc_test< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_kv_nogc_unord.cpp b/tests/test-hdr/list/hdr_lazy_kv_nogc_unord.cpp deleted file mode 100644 index 7ed12020..00000000 --- a/tests/test-hdr/list/hdr_lazy_kv_nogc_unord.cpp +++ /dev/null @@ -1,159 +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 "list/hdr_lazy_kv.h" -#include - -namespace ordlist { - namespace { - struct NOGC_cmp_traits: public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - static const bool sort = false; - }; - - } - void LazyKVListTestHeader::NOGC_cmp_unord() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_cmp_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyKVList< cds::gc::nogc, - key_type, - value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - - namespace { - struct NOGC_less_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - static const bool sort = false; - }; - } - void LazyKVListTestHeader::NOGC_less_unord() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_less_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - - namespace { - struct NOGC_equal_to_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::eq equal_to; - static const bool sort = false; - }; - } - void LazyKVListTestHeader::NOGC_equal_to_unord() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_equal_to_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::equal_to< eq > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - - namespace { - struct NOGC_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - typedef LazyKVListTestHeader::lt less; - typedef LazyKVListTestHeader::eq equal_to; - static const bool sort = false; - }; - } - void LazyKVListTestHeader::NOGC_cmpmix_unord() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_cmpmix_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - ,cc::opt::equal_to< eq > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - - namespace { - struct NOGC_ic_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::eq equal_to; - typedef cds::atomicity::item_counter item_counter; - static const bool sort = false; - }; - } - void LazyKVListTestHeader::NOGC_ic_unord() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, NOGC_ic_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyKVList< cds::gc::nogc, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::equal_to< eq > - ,cc::opt::item_counter< cds::atomicity::item_counter > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_lazy_kv_rcu_gpb.cpp b/tests/test-hdr/list/hdr_lazy_kv_rcu_gpb.cpp deleted file mode 100644 index 48f555ec..00000000 --- a/tests/test-hdr/list/hdr_lazy_kv_rcu_gpb.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 "list/hdr_lazy_kv.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type; - - struct RCU_GPB_cmp_traits: public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - }; - } - void LazyKVListTestHeader::RCU_GPB_cmp() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPB_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_less_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::RCU_GPB_less() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPB_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::RCU_GPB_cmpmix() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPB_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_ic_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyKVListTestHeader::RCU_GPB_ic() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPB_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_kv_rcu_gpi.cpp b/tests/test-hdr/list/hdr_lazy_kv_rcu_gpi.cpp deleted file mode 100644 index c6a5c3ed..00000000 --- a/tests/test-hdr/list/hdr_lazy_kv_rcu_gpi.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 "list/hdr_lazy_kv.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type; - - struct RCU_GPI_cmp_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - }; - } - void LazyKVListTestHeader::RCU_GPI_cmp() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPI_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_less_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::RCU_GPI_less() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPI_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::RCU_GPI_cmpmix() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPI_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_ic_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyKVListTestHeader::RCU_GPI_ic() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPI_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_kv_rcu_gpt.cpp b/tests/test-hdr/list/hdr_lazy_kv_rcu_gpt.cpp deleted file mode 100644 index 7294c44c..00000000 --- a/tests/test-hdr/list/hdr_lazy_kv_rcu_gpt.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 "list/hdr_lazy_kv.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type; - - struct RCU_GPT_cmp_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - }; - } - void LazyKVListTestHeader::RCU_GPT_cmp() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPT_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_less_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::RCU_GPT_less() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPT_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::RCU_GPT_cmpmix() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPT_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_ic_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyKVListTestHeader::RCU_GPT_ic() - { - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_GPT_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_kv_rcu_shb.cpp b/tests/test-hdr/list/hdr_lazy_kv_rcu_shb.cpp deleted file mode 100644 index fa8ca52e..00000000 --- a/tests/test-hdr/list/hdr_lazy_kv_rcu_shb.cpp +++ /dev/null @@ -1,150 +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 "list/hdr_lazy_kv.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type; - - struct RCU_SHB_cmp_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - }; - } -#endif - - void LazyKVListTestHeader::RCU_SHB_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_less_traits: public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - }; - } -#endif - - void LazyKVListTestHeader::RCU_SHB_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_cmpmix_traits: public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - typedef LazyKVListTestHeader::lt less; - }; - } -#endif - - void LazyKVListTestHeader::RCU_SHB_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_ic_traits: public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } -#endif - - void LazyKVListTestHeader::RCU_SHB_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHB_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_lazy_kv_rcu_sht.cpp b/tests/test-hdr/list/hdr_lazy_kv_rcu_sht.cpp deleted file mode 100644 index 25a7891b..00000000 --- a/tests/test-hdr/list/hdr_lazy_kv_rcu_sht.cpp +++ /dev/null @@ -1,147 +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 "list/hdr_lazy_kv.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type; - - struct RCU_SHT_cmp_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - }; - } -#endif - void LazyKVListTestHeader::RCU_SHT_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHT_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_less_traits : public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - }; - } -#endif - void LazyKVListTestHeader::RCU_SHT_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHT_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_cmpmix_traits: public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::cmp compare; - typedef LazyKVListTestHeader::lt less; - }; - } -#endif - void LazyKVListTestHeader::RCU_SHT_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHT_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_ic_traits: public cc::lazy_list::traits - { - typedef LazyKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } -#endif - void LazyKVListTestHeader::RCU_SHT_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyKVList< rcu_type, key_type, value_type, RCU_SHT_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyKVList< rcu_type, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_nogc.cpp b/tests/test-hdr/list/hdr_lazy_nogc.cpp deleted file mode 100644 index d872a5c2..00000000 --- a/tests/test-hdr/list/hdr_lazy_nogc.cpp +++ /dev/null @@ -1,127 +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 "list/hdr_lazy.h" -#include - -namespace ordlist { - namespace { - struct NOGC_cmp_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - }; - } - void LazyListTestHeader::NOGC_cmp() - { - // traits-based version - typedef cc::LazyList< cds::gc::nogc, item, NOGC_cmp_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::nogc, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_less_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::NOGC_less() - { - // traits-based version - typedef cc::LazyList< cds::gc::nogc, item, NOGC_less_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::nogc, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::NOGC_cmpmix() - { - // traits-based version - typedef cc::LazyList< cds::gc::nogc, item, NOGC_cmpmix_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::nogc, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_ic_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyListTestHeader::NOGC_ic() - { - // traits-based version - typedef cc::LazyList< cds::gc::nogc, item, NOGC_ic_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::nogc, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - nogc_test< opt_list >(); - } -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_nogc_unord.cpp b/tests/test-hdr/list/hdr_lazy_nogc_unord.cpp deleted file mode 100644 index c07be9c1..00000000 --- a/tests/test-hdr/list/hdr_lazy_nogc_unord.cpp +++ /dev/null @@ -1,180 +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 "list/hdr_lazy.h" -#include - -namespace ordlist { - namespace { - struct NOGC_cmp_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - static const bool sort = false; - }; - } - void LazyListTestHeader::NOGC_cmp_unord() - { - // traits-based version - typedef cc::LazyList< cds::gc::nogc, item, NOGC_cmp_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyList< cds::gc::nogc, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - - namespace { - struct NOGC_less_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - static const bool sort = false; - }; - } - void LazyListTestHeader::NOGC_less_unord() - { - // traits-based version - typedef cc::LazyList< cds::gc::nogc, item, NOGC_less_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyList< cds::gc::nogc, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - - namespace { - struct NOGC_equal_to_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::equal_to equal_to; - static const bool sort = false; - }; - } - void LazyListTestHeader::NOGC_equal_to_unord() - { - // traits-based version - typedef cc::LazyList< cds::gc::nogc, item, NOGC_equal_to_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyList< cds::gc::nogc, item, - cc::lazy_list::make_traits< - cc::opt::equal_to< equal_to > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - - namespace { - struct NOGC_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - static const bool sort = false; - }; - } - void LazyListTestHeader::NOGC_cmpmix_unord() - { - // traits-based version - typedef cc::LazyList< cds::gc::nogc, item, NOGC_cmpmix_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyList< cds::gc::nogc, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - - namespace { - struct NOGC_equal_to_mix_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - typedef LazyListTestHeader::equal_to equal_to; - static const bool sort = false; - }; - } - void LazyListTestHeader::NOGC_equal_to_mix_unord() - { - // traits-based version - typedef cc::LazyList< cds::gc::nogc, item, NOGC_equal_to_mix_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyList< cds::gc::nogc, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - ,cc::opt::equal_to< equal_to > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - namespace { - struct NOGC_ic_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::equal_to equal_to; - typedef cds::atomicity::item_counter item_counter; - static const bool sort = false; - }; - } - void LazyListTestHeader::NOGC_ic_unord() - { - // traits-based version - typedef cc::LazyList< cds::gc::nogc, item, NOGC_ic_traits > list; - nogc_unord_test< list >(); - - // option-based version - typedef cc::LazyList< cds::gc::nogc, item, - cc::lazy_list::make_traits< - cc::opt::equal_to< equal_to > - ,cc::opt::item_counter< cds::atomicity::item_counter > - ,cc::opt::sort - >::type - > opt_list; - nogc_unord_test< opt_list >(); - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_lazy_rcu_gpb.cpp b/tests/test-hdr/list/hdr_lazy_rcu_gpb.cpp deleted file mode 100644 index 33c4a3e8..00000000 --- a/tests/test-hdr/list/hdr_lazy_rcu_gpb.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 "list/hdr_lazy.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type; - - struct RCU_GPB_cmp_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - }; - } - void LazyListTestHeader::RCU_GPB_cmp() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPB_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_less_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::RCU_GPB_less() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPB_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::RCU_GPB_cmpmix() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPB_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_ic_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyListTestHeader::RCU_GPB_ic() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPB_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_rcu_gpi.cpp b/tests/test-hdr/list/hdr_lazy_rcu_gpi.cpp deleted file mode 100644 index bc749d1d..00000000 --- a/tests/test-hdr/list/hdr_lazy_rcu_gpi.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 "list/hdr_lazy.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type; - - struct RCU_GPI_cmp_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - }; - } - void LazyListTestHeader::RCU_GPI_cmp() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPI_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_less_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::RCU_GPI_less() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPI_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::RCU_GPI_cmpmix() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPI_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_ic_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyListTestHeader::RCU_GPI_ic() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPI_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_rcu_gpt.cpp b/tests/test-hdr/list/hdr_lazy_rcu_gpt.cpp deleted file mode 100644 index d342376a..00000000 --- a/tests/test-hdr/list/hdr_lazy_rcu_gpt.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 "list/hdr_lazy.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type; - - struct RCU_GPT_cmp_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - }; - } - void LazyListTestHeader::RCU_GPT_cmp() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPT_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_less_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::RCU_GPT_less() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPT_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_cmpmix_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::RCU_GPT_cmpmix() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPT_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_ic_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyListTestHeader::RCU_GPT_ic() - { - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_GPT_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_rcu_shb.cpp b/tests/test-hdr/list/hdr_lazy_rcu_shb.cpp deleted file mode 100644 index 6f4c1fed..00000000 --- a/tests/test-hdr/list/hdr_lazy_rcu_shb.cpp +++ /dev/null @@ -1,147 +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 "list/hdr_lazy.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type; - - struct RCU_SHB_cmp_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - }; - } -#endif - void LazyListTestHeader::RCU_SHB_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_SHB_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_less_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - }; - } -#endif - void LazyListTestHeader::RCU_SHB_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_SHB_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_cmpmix_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - }; - } -#endif - void LazyListTestHeader::RCU_SHB_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_SHB_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_ic_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } -#endif - void LazyListTestHeader::RCU_SHB_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_SHB_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_lazy_rcu_sht.cpp b/tests/test-hdr/list/hdr_lazy_rcu_sht.cpp deleted file mode 100644 index 69c94d23..00000000 --- a/tests/test-hdr/list/hdr_lazy_rcu_sht.cpp +++ /dev/null @@ -1,147 +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 "list/hdr_lazy.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type; - - struct RCU_SHT_cmp_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - }; - } -#endif - void LazyListTestHeader::RCU_SHT_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_SHT_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_less_traits : public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - }; - } -#endif - void LazyListTestHeader::RCU_SHT_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_SHT_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_cmpmix_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - }; - } -#endif - void LazyListTestHeader::RCU_SHT_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_SHT_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_ic_traits: public cc::lazy_list::traits - { - typedef LazyListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } -#endif - void LazyListTestHeader::RCU_SHT_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::LazyList< rcu_type, item, RCU_SHT_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::LazyList< rcu_type, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael.h b/tests/test-hdr/list/hdr_michael.h deleted file mode 100644 index f5ad84d6..00000000 --- a/tests/test-hdr/list/hdr_michael.h +++ /dev/null @@ -1,853 +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_MICHAEL_H -#define CDSTEST_HDR_MICHAEL_H - -#include "cppunit/cppunit_proxy.h" -#include - -namespace ordlist { - namespace cc = cds::container; - namespace co = cds::container::opt; - - class MichaelListTestHeader: public CppUnitMini::TestCase - { - public: - struct stat { - int nUpdateExistsCall; - int nUpdateNewCall; - - stat() - { - nUpdateExistsCall - = nUpdateNewCall - = 0; - } - }; - - struct item { - int nKey; - int nVal; - - stat s; - - item(int key) - : nKey( key ) - , nVal( key * 2 ) - , s() - {} - - item(int key, int val) - : nKey( key ) - , nVal(val) - , s() - {} - - item( const item& v ) - : nKey( v.nKey ) - , nVal( v.nVal ) - , s() - {} - - int key() const - { - return nKey; - } - }; - - template - struct lt - { - bool operator ()(const T& v1, const T& v2 ) const - { - return v1.key() < v2.key(); - } - - template - bool operator ()(const T& v1, const Q& v2 ) const - { - return v1.key() < v2; - } - - template - bool operator ()(const Q& v1, const T& v2 ) const - { - return v1 < v2.key(); - } - }; - - template - struct cmp { - int operator ()(const T& v1, const T& v2 ) const - { - if ( v1.key() < v2.key() ) - return -1; - return v1.key() > v2.key() ? 1 : 0; - } - - template - int operator ()(const T& v1, const Q& v2 ) const - { - if ( v1.key() < v2 ) - return -1; - return v1.key() > v2 ? 1 : 0; - } - - template - int operator ()(const Q& v1, const T& v2 ) const - { - if ( v1 < v2.key() ) - return -1; - return v1 > v2.key() ? 1 : 0; - } - }; - - struct insert_functor { - void operator ()( item& i ) - { - i.nVal = i.nKey * 1033; - } - }; - struct dummy_insert_functor { - void operator ()( item& /*i*/ ) - { - // This functor should not be called - TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_insert_functor should not be called", __FILE__, __LINE__ ); - } - }; - - struct erase_functor { - unsigned int nEraseCall; - - erase_functor() - : nEraseCall(0) - {} - - void operator()( item const& /*i*/) - { - ++nEraseCall; - } - }; - - static void insert_function( item& i ) - { - i.nVal = i.nKey * 1024; - } - static void dummy_insert_function( item& /*i*/ ) - { - // This function should not be called - TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_insert_function should not be called", __FILE__, __LINE__ ); - } - - - struct check_value { - unsigned int m_nMultiplier; - - check_value( unsigned int nMultiplier ) - : m_nMultiplier( nMultiplier ) - {} - - check_value( const check_value& s ) - : m_nMultiplier( s.m_nMultiplier ) - {} - - void operator()( item& i, int ) - { - CPPUNIT_ASSERT_CURRENT( int(i.nKey * m_nMultiplier) == i.nVal ); - } - }; - - struct check_exact_value { - int m_nExpected; - - check_exact_value( int nExpected ) - : m_nExpected( nExpected ) - {} - - check_exact_value( check_exact_value const& s) - : m_nExpected( s.m_nExpected ) - {} - - void operator()( item& i, int ) - { - CPPUNIT_ASSERT_CURRENT( i.nVal == m_nExpected ); - } - }; - - struct dummy_check_value { - void operator()( item& /*i*/, int ) - { - // This functor should not be called - TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_check_value should not be called", __FILE__, __LINE__ ); - } - }; - - struct update_functor { - void operator()( bool /*bNew*/, item& i, int /*n*/ ) - { - i.nVal = i.nKey * 1024; - } - }; - - static void update_func( bool /*bNew*/, item& i, int n ) - { - i.nVal = n * 1033; - } - - struct other_item - { - int nKey; - - other_item() - {} - - other_item(int n) - : nKey(n) - {} - }; - - struct other_less - { - template - bool operator()( T1 const& t1, T2 const& t2 ) const - { - return t1.nKey < t2.nKey; - } - }; - - protected: - template - void test_with( OrdList& l ) - { - typedef typename OrdList::value_type value_type; - - // The list should be empty - CPPUNIT_ASSERT( l.empty() ); - - // insert test - CPPUNIT_ASSERT( l.insert( 50 ) ); - CPPUNIT_ASSERT( l.insert( item( 25 )) ); - CPPUNIT_ASSERT( l.insert( item( 100 )) ); - - // insert failed - such key exists - CPPUNIT_ASSERT( !l.insert( 50 ) ); - CPPUNIT_ASSERT( !l.insert( item( 100 )) ); - - // clear test - - // The list should not be empty - CPPUNIT_ASSERT( !l.empty() ); - l.clear(); - // and now the list is empty - CPPUNIT_ASSERT( l.empty() ); - - // Test insert with functor - - CPPUNIT_ASSERT( l.insert( 100, insert_functor() ) ); - // passed by ref - { - insert_functor f; - CPPUNIT_ASSERT( l.insert( item( 25 ), std::ref( f ) ) ); - CPPUNIT_ASSERT( !l.insert( item( 100 ), std::ref( f ) ) ); - } - // Test insert with function - CPPUNIT_ASSERT( l.insert( 50, insert_function )); - CPPUNIT_ASSERT( !l.insert( 25, dummy_insert_function )); - CPPUNIT_ASSERT( !l.insert( 100, dummy_insert_functor() )); - - // The list should not be empty - CPPUNIT_ASSERT( !l.empty() ); - - // Check inserted values - { - int i; - i = 100; - CPPUNIT_ASSERT( l.contains( 100 )); - CPPUNIT_ASSERT( l.find( i, check_value(1033) )); - { - check_value f(1033); - i = 25; - CPPUNIT_ASSERT( l.contains( 25, lt() )); - CPPUNIT_ASSERT( l.find_with( i, lt(), std::ref( f ) ) ); - } - i = 50; - CPPUNIT_ASSERT( l.contains( 50 )); - CPPUNIT_ASSERT( l.find( i, check_value(1024) )); - - i = 10; - CPPUNIT_ASSERT( !l.contains( 10, lt() )); - CPPUNIT_ASSERT( !l.find_with( i, lt(), dummy_check_value() )); - i = 75; - CPPUNIT_ASSERT( !l.contains( 75 )); - CPPUNIT_ASSERT( !l.find( i, dummy_check_value() )); - i = 150; - CPPUNIT_ASSERT( !l.contains( 150 )); - CPPUNIT_ASSERT( !l.find( i, dummy_check_value() )); - } - - // The list should not be empty - CPPUNIT_ASSERT( !l.empty() ); - l.clear(); - // and now the list is empty - CPPUNIT_ASSERT( l.empty() ); - - // Update test - { - std::pair updateResult; - update_functor f; - updateResult = l.update( 100, update_functor() ); - CPPUNIT_ASSERT( updateResult.first ); - CPPUNIT_ASSERT( updateResult.second ); - - updateResult = l.update( 200, std::ref( f ) ); - CPPUNIT_ASSERT( updateResult.first ); - CPPUNIT_ASSERT( updateResult.second ); - - updateResult = l.update( 50, update_func ); - CPPUNIT_ASSERT( updateResult.first ); - CPPUNIT_ASSERT( updateResult.second ); - - int i; - i = 100; - CPPUNIT_ASSERT( l.find( i, check_value(1024) )); - i = 50; - CPPUNIT_ASSERT( l.find( i, check_value(1033) )); - i = 200; - CPPUNIT_ASSERT( l.find( i, check_value(1024) )); - - // update existing key - updateResult = l.update( 200, update_func ); - CPPUNIT_ASSERT( updateResult.first ); - CPPUNIT_ASSERT( !updateResult.second ); - i = 200; - CPPUNIT_ASSERT( l.find( i, check_value(1033) )); - - updateResult = l.update( 50, update_functor() ); - CPPUNIT_ASSERT( updateResult.first ); - CPPUNIT_ASSERT( !updateResult.second ); - i = 50; - CPPUNIT_ASSERT( l.find( i, check_value(1024) )); - } - - // erase test (list: 50, 100, 200) - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( l.insert(160)); - CPPUNIT_ASSERT( l.insert(250)); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( !l.erase( 150 )); - - CPPUNIT_ASSERT( l.erase( 100 )); - CPPUNIT_ASSERT( !l.erase( 100 )); - - CPPUNIT_ASSERT( l.erase_with( 200, lt() )); - CPPUNIT_ASSERT( !l.erase_with( 200, lt() )); - - { - erase_functor ef; - CPPUNIT_ASSERT( ef.nEraseCall == 0 ); - CPPUNIT_ASSERT( l.erase_with( 160, lt(), std::ref(ef) )); - CPPUNIT_ASSERT( ef.nEraseCall == 1 ); - CPPUNIT_ASSERT( !l.erase_with( 160, lt(), std::ref(ef) )); - CPPUNIT_ASSERT( ef.nEraseCall == 1 ); - - CPPUNIT_ASSERT( l.erase( 250, std::ref(ef) )); - CPPUNIT_ASSERT( ef.nEraseCall == 2 ); - CPPUNIT_ASSERT( !l.erase( 250, std::ref(ef) )); - CPPUNIT_ASSERT( ef.nEraseCall == 2 ); - } - - CPPUNIT_ASSERT( l.erase( 50 )); - CPPUNIT_ASSERT( !l.erase( 50 )); - - CPPUNIT_ASSERT( l.empty() ); - - // clear empty list - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - { - int i; - - // insert test - CPPUNIT_ASSERT( l.emplace( 501 ) ); - CPPUNIT_ASSERT( l.emplace( 251, 152 )); - CPPUNIT_ASSERT( l.emplace( item( 1001 )) ); - - // insert failed - such key exists - CPPUNIT_ASSERT( !l.emplace( 501, 2 ) ); - CPPUNIT_ASSERT( !l.emplace( 251, 10) ); - - i = 501; - CPPUNIT_ASSERT( l.find( i, check_exact_value(501*2) )); - i = 251; - CPPUNIT_ASSERT( l.find( i, check_exact_value(152) )); - i = 1001; - CPPUNIT_ASSERT( l.find( i, check_exact_value(1001*2) )); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - - // Iterator test - { - int nCount = 100; - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i) ); - - { - typename OrdList::iterator it( l.begin() ); - typename OrdList::const_iterator cit( l.cbegin() ); - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++it; - CPPUNIT_CHECK( it != cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++cit; - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - } - - int i = 0; - for ( typename OrdList::iterator it = l.begin(), itEnd = l.end(); it != itEnd; ++it, ++i ) { - it->nVal = i * 2; - CPPUNIT_ASSERT( it->nKey == i ); - } - - // Check that we have visited all items - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.find( i, check_value(2) )); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Const iterator - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i) ); - - i = 0; - const OrdList& rl = l; - for ( typename OrdList::const_iterator it = rl.begin(), itEnd = rl.end(); it != itEnd; ++it, ++i ) { - // it->nVal = i * 2 ; // not! - CPPUNIT_ASSERT( it->nKey == i ); - } - - // Check that we have visited all items - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.find( i, check_value(2) )); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - } - - template - void test() - { - typedef typename OrdList::guarded_ptr guarded_ptr; - typedef typename OrdList::value_type value_type; - - OrdList l; - test_with(l); - - static int const nLimit = 20; - int arr[nLimit]; - for ( int i = 0; i < nLimit; i++ ) - arr[i] = i; - shuffle( arr, arr + nLimit ); - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - l.insert( arr[i] ); - { - guarded_ptr gp; - for ( int i = 0; i < nLimit; ++i ) { - int nKey = arr[i]; - - gp = l.get( nKey ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == nKey ); - CPPUNIT_CHECK( gp->nVal == nKey * 2 ); - gp.release(); - - gp = l.extract( nKey ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == nKey ); - CPPUNIT_CHECK( gp->nVal == nKey*2 ); - gp.release(); - - gp = l.get( nKey ); - CPPUNIT_CHECK( !gp ); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract( nKey)); - CPPUNIT_CHECK( gp.empty()); - } - CPPUNIT_ASSERT( l.empty()); - CPPUNIT_CHECK( !l.get(arr[0])); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract( arr[0])); - CPPUNIT_CHECK( gp.empty()); - } - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) - l.insert( arr[i] ); - { - guarded_ptr gp; - for ( int i = 0; i < nLimit; ++i ) { - int nKey = arr[i]; - other_item key( nKey ); - - gp = l.get_with( key, other_less() ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == nKey ); - CPPUNIT_CHECK( gp->nVal == nKey * 2 ); - gp.release(); - - gp = l.extract_with( key, other_less() ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->nKey == nKey ); - CPPUNIT_CHECK( gp->nVal == nKey*2 ); - gp.release(); - - gp = l.get_with( key, other_less() ); - CPPUNIT_CHECK( !gp ); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract_with( key, other_less())); - CPPUNIT_CHECK( gp.empty()); - } - CPPUNIT_ASSERT( l.empty()); - CPPUNIT_CHECK( !l.get_with(other_item(arr[0]), other_less())); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract_with( other_item(arr[0]), other_less())); - CPPUNIT_CHECK( gp.empty()); - } - } - - template - void test_rcu() - { - OrdList l; - test_with(l); - - static int const nLimit = 20; - - typedef typename OrdList::rcu_lock rcu_lock; - typedef typename OrdList::value_type value_type; - typedef typename OrdList::gc rcu_type; - - { - int a[nLimit]; - for (int i = 0; i < nLimit; ++i) - a[i]=i; - shuffle( a, a + nLimit ); - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - CPPUNIT_ASSERT( l.insert( a[i] ) ); - - typename OrdList::exempt_ptr ep; - typename OrdList::raw_ptr rp; - - for ( int i = 0; i < nLimit; ++i ) { - { - rcu_lock lock; - rp = l.get( a[i] ); - CPPUNIT_ASSERT( rp ); - CPPUNIT_CHECK( rp->nKey == a[i] ); - CPPUNIT_CHECK( rp->nVal == a[i] * 2 ); - } - rp.release(); - - ep = l.extract( a[i] ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->nKey == a[i] ); - CPPUNIT_CHECK( (*ep).nVal == a[i] * 2 ); - ep.release(); - - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get( a[i] )); - } - ep = l.extract( a[i] ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get( a[0] )); - } - CPPUNIT_CHECK( !l.extract( a[0] ) ); - CPPUNIT_CHECK( ep.empty() ); - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) { - CPPUNIT_ASSERT( l.insert( a[i] ) ); - } - - for ( int i = 0; i < nLimit; ++i ) { - other_item itm( a[i] ); - { - rcu_lock lock; - rp = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( rp ); - CPPUNIT_CHECK( rp->nKey == a[i] ); - CPPUNIT_CHECK( rp->nVal == a[i] * 2 ); - } - rp.release(); - - ep = l.extract_with( itm, other_less() ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->nKey == a[i] ); - CPPUNIT_CHECK( ep->nVal == a[i] * 2 ); - ep.release(); - - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get_with( itm, other_less())); - } - ep = l.extract_with( itm, other_less() ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get_with( other_item( 0 ), other_less())); - } - CPPUNIT_CHECK( !l.extract_with( other_item(0), other_less() )); - CPPUNIT_CHECK( ep.empty() ); - } - - } - - template - void nogc_test() - { - typedef OrdList list; - typedef typename list::value_type value_type; - typedef std::pair update_result; - - typename list::iterator it; - - list l; - CPPUNIT_ASSERT( l.empty() ); - CPPUNIT_ASSERT( l.insert(50) != l.end() ); - CPPUNIT_ASSERT( !l.empty() ); - - update_result eres = l.update( item(100, 33) ); - CPPUNIT_ASSERT( eres.second ); - CPPUNIT_ASSERT( eres.first != l.end() ); - CPPUNIT_ASSERT( l.insert( item(150) ) != l.end() ); - - CPPUNIT_ASSERT( l.insert(100) == l.end() ); - eres = l.update( item(50, 33) ); - CPPUNIT_ASSERT( !eres.second ); - CPPUNIT_ASSERT( eres.first->nVal == eres.first->nKey * 2 ); - eres.first->nVal = 63; - - it = l.contains( 33 ); - CPPUNIT_ASSERT( it == l.end() ); - - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 50 ); - CPPUNIT_ASSERT( it->nVal == 63 ); - - it = l.contains( 100, lt() ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 100 ); - CPPUNIT_ASSERT( it->nVal == 33 ); - - it = l.contains( 150 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 150 ); - CPPUNIT_ASSERT( it->nVal == it->nKey * 2 ); - - CPPUNIT_ASSERT( !l.empty() ); - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // insert test - CPPUNIT_ASSERT( l.emplace( 501 ) != l.end() ); - CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end()); - CPPUNIT_ASSERT( l.emplace( item( 1001 )) != l.end() ); - - // insert failed - such key exists - CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end() ); - CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end() ); - - it = l.contains( 501 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 501 ); - CPPUNIT_ASSERT( it->nVal == 501 * 2 ); - - it = l.contains( 251 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 251 ); - CPPUNIT_ASSERT( it->nVal == 152 ); - - it = l.contains( 1001 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it->nKey == 1001 ); - CPPUNIT_ASSERT( it->nVal == 1001 * 2 ); - - { - typename OrdList::iterator it( l.begin() ); - typename OrdList::const_iterator cit( l.cbegin() ); - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++it; - CPPUNIT_CHECK( it != cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++cit; - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - } - - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - - void HP_cmp(); - void HP_less(); - void HP_cmpmix(); - void HP_ic(); - - void DHP_cmp(); - void DHP_less(); - void DHP_cmpmix(); - void DHP_ic(); - - void RCU_GPI_cmp(); - void RCU_GPI_less(); - void RCU_GPI_cmpmix(); - void RCU_GPI_ic(); - - void RCU_GPB_cmp(); - void RCU_GPB_less(); - void RCU_GPB_cmpmix(); - void RCU_GPB_ic(); - - void RCU_GPT_cmp(); - void RCU_GPT_less(); - void RCU_GPT_cmpmix(); - void RCU_GPT_ic(); - - void RCU_SHB_cmp(); - void RCU_SHB_less(); - void RCU_SHB_cmpmix(); - void RCU_SHB_ic(); - - void RCU_SHT_cmp(); - void RCU_SHT_less(); - void RCU_SHT_cmpmix(); - void RCU_SHT_ic(); - - void NOGC_cmp(); - void NOGC_less(); - void NOGC_cmpmix(); - void NOGC_ic(); - - CPPUNIT_TEST_SUITE(MichaelListTestHeader) - CPPUNIT_TEST(HP_cmp) - CPPUNIT_TEST(HP_less) - CPPUNIT_TEST(HP_cmpmix) - CPPUNIT_TEST(HP_ic) - - CPPUNIT_TEST(DHP_cmp) - CPPUNIT_TEST(DHP_less) - CPPUNIT_TEST(DHP_cmpmix) - CPPUNIT_TEST(DHP_ic) - - CPPUNIT_TEST(RCU_GPI_cmp) - CPPUNIT_TEST(RCU_GPI_less) - CPPUNIT_TEST(RCU_GPI_cmpmix) - CPPUNIT_TEST(RCU_GPI_ic) - - CPPUNIT_TEST(RCU_GPB_cmp) - CPPUNIT_TEST(RCU_GPB_less) - CPPUNIT_TEST(RCU_GPB_cmpmix) - CPPUNIT_TEST(RCU_GPB_ic) - - CPPUNIT_TEST(RCU_GPT_cmp) - CPPUNIT_TEST(RCU_GPT_less) - CPPUNIT_TEST(RCU_GPT_cmpmix) - CPPUNIT_TEST(RCU_GPT_ic) - - CPPUNIT_TEST(RCU_SHB_cmp) - CPPUNIT_TEST(RCU_SHB_less) - CPPUNIT_TEST(RCU_SHB_cmpmix) - CPPUNIT_TEST(RCU_SHB_ic) - - CPPUNIT_TEST(RCU_SHT_cmp) - CPPUNIT_TEST(RCU_SHT_less) - CPPUNIT_TEST(RCU_SHT_cmpmix) - CPPUNIT_TEST(RCU_SHT_ic) - - CPPUNIT_TEST(NOGC_cmp) - CPPUNIT_TEST(NOGC_less) - CPPUNIT_TEST(NOGC_cmpmix) - CPPUNIT_TEST(NOGC_ic) - CPPUNIT_TEST_SUITE_END() - }; - -} // namespace ordlist - -#endif // #ifndef CDSTEST_HDR_MICHAEL_H diff --git a/tests/test-hdr/list/hdr_michael_dhp.cpp b/tests/test-hdr/list/hdr_michael_dhp.cpp deleted file mode 100644 index 50ba6cad..00000000 --- a/tests/test-hdr/list/hdr_michael_dhp.cpp +++ /dev/null @@ -1,128 +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 "list/hdr_michael.h" -#include - -namespace ordlist { - namespace { - struct DHP_cmp_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - }; - } - void MichaelListTestHeader::DHP_cmp() - { - // traits-based version - typedef cc::MichaelList< cds::gc::DHP, item, DHP_cmp_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::DHP, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_less_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::DHP_less() - { - // traits-based version - typedef cc::MichaelList< cds::gc::DHP, item, DHP_less_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::DHP, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_cmpmix_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::DHP_cmpmix() - { - // traits-based version - typedef cc::MichaelList< cds::gc::DHP, item, DHP_cmpmix_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::DHP, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_ic_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelListTestHeader::DHP_ic() - { - // traits-based version - typedef cc::MichaelList< cds::gc::DHP, item, DHP_ic_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::DHP, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael_hp.cpp b/tests/test-hdr/list/hdr_michael_hp.cpp deleted file mode 100644 index b1c6d5a6..00000000 --- a/tests/test-hdr/list/hdr_michael_hp.cpp +++ /dev/null @@ -1,130 +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 "list/hdr_michael.h" -#include - -namespace ordlist { - namespace { - struct HP_cmp_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - }; - - } - void MichaelListTestHeader::HP_cmp() - { - // traits-based version - typedef cc::MichaelList< cds::gc::HP, item, HP_cmp_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::HP, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_less_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::HP_less() - { - // traits-based version - typedef cc::MichaelList< cds::gc::HP, item, HP_less_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::HP, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_cmpmix_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::HP_cmpmix() - { - // traits-based version - typedef cc::MichaelList< cds::gc::HP, item, HP_cmpmix_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::HP, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_ic_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelListTestHeader::HP_ic() - { - // traits-based version - typedef cc::MichaelList< cds::gc::HP, item, HP_ic_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::HP, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test< opt_list >(); - } - -} // namespace ordlist - -CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::MichaelListTestHeader); diff --git a/tests/test-hdr/list/hdr_michael_kv.h b/tests/test-hdr/list/hdr_michael_kv.h deleted file mode 100644 index 2ec6d220..00000000 --- a/tests/test-hdr/list/hdr_michael_kv.h +++ /dev/null @@ -1,773 +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_MICHAEL_KV_H -#define CDSTEST_HDR_MICHAEL_KV_H - -#include "cppunit/cppunit_proxy.h" -#include - -namespace ordlist { - namespace cc = cds::container; - namespace co = cds::container::opt; - - class MichaelKVListTestHeader: public CppUnitMini::TestCase - { - public: - typedef int key_type; - struct value_type { - int m_val; - - value_type() - : m_val(0) - {} - - value_type( int n ) - : m_val( n ) - {} - }; - - template - struct lt - { - bool operator ()(const T& v1, const T& v2 ) const - { - return v1 < v2; - } - }; - - template - struct cmp { - int operator ()(const T& v1, const T& v2 ) const - { - if ( v1 < v2 ) - return -1; - return v1 > v2 ? 1 : 0; - } - }; - - struct check_value { - int m_nExpected; - - check_value( int nExpected ) - : m_nExpected( nExpected ) - {} - - template - void operator ()( T& pair ) - { - CPPUNIT_ASSERT_CURRENT( pair.second.m_val == m_nExpected ); - } - }; - - struct insert_functor { - template - void operator()( T& pair ) - { - pair.second.m_val = pair.first * 10; - } - }; - - struct update_functor { - template - void operator()( bool /*bNew*/, T& pair ) - { - pair.second.m_val = pair.first * 50; - } - }; - - struct erase_functor { - int nKey; - int nVal; - - erase_functor() - : nKey(0) - , nVal(0) - {} - - template - void operator()( T& i ) - { - nKey = i.first; - nVal = i.second.m_val; - } - }; - - typedef float other_key; - struct other_less { - bool operator()( float f, int i ) const - { - return int(f) < i; - } - bool operator()( int i, float f ) const - { - return i < int(f); - } - }; - - protected: - template - void test_with( OrdList& l) - { - typedef typename OrdList::value_type value_type; - - typename OrdList::iterator itTest; - typename OrdList::const_iterator citTest; - - CPPUNIT_ASSERT( l.empty() ); - - // insert / contains test - CPPUNIT_ASSERT( !l.contains( 100 )); - CPPUNIT_ASSERT( l.insert( 100 )); - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( l.contains( 100 )); - - check_value chk(0); - CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) ); - - CPPUNIT_ASSERT( !l.contains( 50, lt() )); - CPPUNIT_ASSERT( l.insert( 50, 500 )); - CPPUNIT_ASSERT( l.contains( 50, lt() )); - CPPUNIT_ASSERT( !l.insert( 50, 5 )); - chk.m_nExpected = 500; - CPPUNIT_ASSERT( l.find_with( 50, lt(), std::ref( chk ) ) ); - chk.m_nExpected = 0; - CPPUNIT_ASSERT( l.find_with( 100, lt(), std::ref( chk ) ) ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( !l.contains( 150 )); - CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() )); - CPPUNIT_ASSERT( l.contains( 150 )); - chk.m_nExpected = 1500; - CPPUNIT_ASSERT( l.find( 150, std::ref( chk ) ) ); - chk.m_nExpected = 0; - CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) ); - chk.m_nExpected = 500; - CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) ); - CPPUNIT_ASSERT( !l.empty() ); - - // erase test - - CPPUNIT_ASSERT( !l.erase( 500 )); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.contains( 50 )); - { - erase_functor ef; - l.erase( 50, std::ref( ef ) ); - CPPUNIT_ASSERT( ef.nKey == 50 ); - CPPUNIT_ASSERT( ef.nVal == 500 ); - } - CPPUNIT_ASSERT( !l.contains( 50 )); - - // update test - std::pair bupdateResult; - bupdateResult = l.update( 100, update_functor() ); - CPPUNIT_ASSERT( bupdateResult.first ); - CPPUNIT_ASSERT( !bupdateResult.second ); - chk.m_nExpected = 5000; - CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) ); - - { - update_functor ef; - bupdateResult = l.update( 50, std::ref( ef ) ); - } - CPPUNIT_ASSERT( bupdateResult.first ); - CPPUNIT_ASSERT( bupdateResult.second ); - chk.m_nExpected = 2500; - CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) ); - - // erase test - CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( l.insert_with( 200, insert_functor() )); - CPPUNIT_ASSERT( l.insert( 25 )); - CPPUNIT_ASSERT( l.erase( 100 )); - CPPUNIT_ASSERT( l.erase( 150 )); - { - erase_functor ef; - CPPUNIT_ASSERT( l.erase_with( 200, lt(), std::ref(ef)) ); - CPPUNIT_ASSERT( ef.nKey == 200 ); - CPPUNIT_ASSERT( ef.nVal == 2000 ); - } - CPPUNIT_ASSERT( l.erase_with( 25, lt())) - CPPUNIT_ASSERT( l.erase( 50 )); - CPPUNIT_ASSERT( l.empty() ); - - // clear empty list - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // insert test - CPPUNIT_ASSERT( l.emplace( 501 ) ); - CPPUNIT_ASSERT( l.emplace( 251, 152 )); - - // insert failed - such key exists - CPPUNIT_ASSERT( !l.emplace( 501, 2 ) ); - CPPUNIT_ASSERT( !l.emplace( 251, 10) ); - - check_value cv(0); - CPPUNIT_ASSERT( l.find( 501, std::ref(cv) )); - cv.m_nExpected = 152; - CPPUNIT_ASSERT( l.find( 251, std::ref(cv) )); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Iterator test - { - int nCount = 100; - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i, i * 2 ) ); - - { - typename OrdList::iterator it( l.begin() ); - typename OrdList::const_iterator cit( l.cbegin() ); - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++it; - CPPUNIT_CHECK( it != cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++cit; - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - } - - int i = 0; - for ( typename OrdList::iterator it = l.begin(), itEnd = l.end(); it != itEnd; ++it, ++i ) { - CPPUNIT_ASSERT( it.key() == i ); - CPPUNIT_ASSERT( it->first == i ); - CPPUNIT_ASSERT( (*it).first == i ); - - CPPUNIT_ASSERT( it.val().m_val == i * 2 ); - CPPUNIT_ASSERT( it->second.m_val == i * 2 ); - CPPUNIT_ASSERT( (*it).second.m_val == i * 2 ); - it.val().m_val = i * 3; - } - - // Check that we have visited all items - for ( int i = 0; i < nCount; ++i ) { - chk.m_nExpected = i * 3; - CPPUNIT_ASSERT( l.find( i, std::ref( chk ) ) ); - } - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Const iterator - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i, i * 7) ); - - i = 0; - const OrdList& rl = l; - for ( typename OrdList::const_iterator it = rl.begin(), itEnd = rl.end(); it != itEnd; ++it, ++i ) { - CPPUNIT_ASSERT( it.key() == i ); - CPPUNIT_ASSERT( it->first == i ); - CPPUNIT_ASSERT( (*it).first == i ); - - CPPUNIT_ASSERT( it.val().m_val == i * 7 ); - CPPUNIT_ASSERT( it->second.m_val == i * 7 ); - CPPUNIT_ASSERT( (*it).second.m_val == i * 7 ); - } - - // Check that we have visited all items - for ( int i = 0; i < nCount; ++i ) { - chk.m_nExpected = i * 7; - CPPUNIT_ASSERT( l.find_with( i, lt(), std::ref( chk ) ) ); - } - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - } - - template - void test() - { - OrdList l; - test_with(l); - - typedef typename OrdList::guarded_ptr guarded_ptr; - - static int const nLimit = 20; - int arr[nLimit]; - for ( int i = 0; i < nLimit; i++ ) - arr[i] = i; - shuffle( arr, arr + nLimit ); - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - l.insert( arr[i], arr[i] * 2 ); - { - guarded_ptr gp; - for ( int i = 0; i < nLimit; ++i ) { - int nKey = arr[i]; - - gp = l.get( nKey ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->first == nKey ); - CPPUNIT_CHECK( gp->second.m_val == nKey * 2 ); - gp.release(); - CPPUNIT_CHECK( gp.empty() ); - - gp = l.extract( nKey ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->first == nKey ); - CPPUNIT_CHECK( gp->second.m_val == nKey*2 ); - gp.release(); - - gp = l.get( nKey ); - CPPUNIT_CHECK( !gp ); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract( nKey)); - CPPUNIT_CHECK( gp.empty()); - } - CPPUNIT_ASSERT( l.empty()); - CPPUNIT_CHECK( !l.get(arr[0])); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract( arr[0])); - CPPUNIT_CHECK( gp.empty()); - } - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) - l.insert( arr[i], arr[i] * 2 ); - { - guarded_ptr gp; - for ( int i = 0; i < nLimit; ++i ) { - int nKey = arr[i]; - other_key key = float(nKey + 0.3); - - gp = l.get_with( key, other_less() ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->first == nKey ); - CPPUNIT_CHECK( gp->second.m_val == nKey * 2 ); - gp.release(); - - gp = l.extract_with( key, other_less() ); - CPPUNIT_ASSERT( gp ); - CPPUNIT_ASSERT( !gp.empty()); - CPPUNIT_CHECK( gp->first == nKey ); - CPPUNIT_CHECK( gp->second.m_val == nKey*2 ); - gp.release(); - - gp = l.get_with( key, other_less() ); - CPPUNIT_CHECK( !gp ); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract_with( key, other_less())); - CPPUNIT_CHECK( gp.empty()); - } - CPPUNIT_ASSERT( l.empty()); - CPPUNIT_CHECK( !l.get_with( 3.4f, other_less())); - CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !l.extract_with( 3.4f, other_less())); - CPPUNIT_CHECK( gp.empty()); - } - } - - template - void test_rcu() - { - OrdList l; - test_with(l); - - static int const nLimit = 20; - - typedef typename OrdList::rcu_lock rcu_lock; - typedef typename OrdList::value_type value_type; - typedef typename OrdList::gc rcu_type; - - { - int a[nLimit]; - for (int i = 0; i < nLimit; ++i) - a[i]=i; - shuffle( a, a + nLimit ); - - // extract/get - for ( int i = 0; i < nLimit; ++i ) - CPPUNIT_ASSERT( l.insert( a[i], a[i]*2 ) ); - - typename OrdList::exempt_ptr ep; - typename OrdList::raw_ptr rp; - - for ( int i = 0; i < nLimit; ++i ) { - { - rcu_lock lock; - rp = l.get( a[i] ); - CPPUNIT_ASSERT( rp ); - CPPUNIT_CHECK( rp->first == a[i] ); - CPPUNIT_CHECK( rp->second.m_val == a[i] * 2 ); - } - rp.release(); - - ep = l.extract( a[i] ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->first == a[i] ); - CPPUNIT_CHECK( (*ep).second.m_val == a[i] * 2 ); - ep.release(); - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get( a[i] )); - } - ep = l.extract( a[i] ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get( a[0] )); - } - CPPUNIT_CHECK( !l.extract( a[0] ) ); - CPPUNIT_CHECK( ep.empty() ); - - // extract_with/get_with - for ( int i = 0; i < nLimit; ++i ) { - CPPUNIT_ASSERT( l.insert( a[i], a[i]*2 ) ); - } - - for ( int i = 0; i < nLimit; ++i ) { - float itm = a[i] + 0.3f; - { - rcu_lock lock; - rp = l.get_with( itm, other_less() ); - CPPUNIT_ASSERT( rp ); - CPPUNIT_CHECK( rp->first == a[i] ); - CPPUNIT_CHECK( rp->second.m_val == a[i] * 2 ); - } - rp.release(); - - ep = l.extract_with( itm, other_less() ); - CPPUNIT_ASSERT( ep ); - CPPUNIT_ASSERT( !ep.empty() ); - CPPUNIT_CHECK( ep->first == a[i] ); - CPPUNIT_CHECK( ep->second.m_val == a[i] * 2 ); - ep.release(); - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get_with( itm, other_less())); - } - ep = l.extract_with( itm, other_less() ); - CPPUNIT_CHECK( !ep ); - CPPUNIT_CHECK( ep.empty() ); - } - CPPUNIT_ASSERT( l.empty() ); - - { - rcu_lock lock; - CPPUNIT_CHECK( !l.get_with( 3.14f, other_less() )); - } - CPPUNIT_CHECK( !l.extract_with( 3.14f, other_less() )); - CPPUNIT_CHECK( ep.empty() ); - } - } - - template - void nogc_test() - { - typedef typename OrdList::value_type value_type; - typedef typename OrdList::iterator iterator; - - { - OrdList l; - iterator it; - - CPPUNIT_ASSERT( l.empty() ); - - // insert / find test - CPPUNIT_ASSERT( l.contains( 100 ) == l.end() ); - CPPUNIT_ASSERT( l.insert( 100 ) != l.end() ); - CPPUNIT_ASSERT( !l.empty() ); - it = l.contains( 100, lt() ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 100 ); - CPPUNIT_ASSERT( it.val().m_val == 0 ); - - CPPUNIT_ASSERT( l.contains( 50, lt() ) == l.end() ); - CPPUNIT_ASSERT( l.insert( 50, 500 ) != l.end()); - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 500 ); - - CPPUNIT_ASSERT( l.insert( 50, 5 ) == l.end() ); - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 500 ); - CPPUNIT_ASSERT( !l.empty() ); - - CPPUNIT_ASSERT( l.contains( 150 ) == l.end() ); - CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() ) != l.end() ); - it = l.contains( 150 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 150 ); - CPPUNIT_ASSERT( it.val().m_val == 1500 ); - it = l.contains( 100 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 100 ); - CPPUNIT_ASSERT( it.val().m_val == 0 ); - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 500 ); - it.val().m_val = 25; - it = l.contains( 50 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 50 ); - CPPUNIT_ASSERT( it.val().m_val == 25 ); - CPPUNIT_ASSERT( !l.empty() ); - - // update existing item - std::pair updateResult; - updateResult = l.update( 100 ); - CPPUNIT_ASSERT( !updateResult.second ); - CPPUNIT_ASSERT( updateResult.first.key() == 100 ); - CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 ); - updateResult.first.val().m_val = 5; - it = l.contains( 100 ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == 100 ); - CPPUNIT_ASSERT( it.val().m_val == 5 ); - - CPPUNIT_ASSERT( !l.empty() ); - - // update new item - updateResult = l.update( 1000 ); - CPPUNIT_ASSERT( updateResult.second ); - CPPUNIT_ASSERT( updateResult.first.key() == 1000 ); - CPPUNIT_ASSERT( updateResult.first.val().m_val == 0 ); - updateResult.first.val().m_val = 33; - updateResult = l.update( 1000 ); - CPPUNIT_ASSERT( !updateResult.second ); - CPPUNIT_ASSERT( updateResult.first.key() == 1000 ); - CPPUNIT_ASSERT( updateResult.first.val().m_val == 33 ); - - // clear test - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // insert test - CPPUNIT_ASSERT( l.emplace( 501 ) != l.end()); - CPPUNIT_ASSERT( l.emplace( 251, 152 ) != l.end()); - - // insert failed - such key exists - CPPUNIT_ASSERT( l.emplace( 501, 2 ) == l.end()); - CPPUNIT_ASSERT( l.emplace( 251, 10) == l.end()); - - it = l.contains( 501 ); - CPPUNIT_ASSERT( it != l.end()); - CPPUNIT_ASSERT( it.key() == 501 ); - CPPUNIT_ASSERT( it.val().m_val == 0 ); - - it = l.contains( 251 ); - CPPUNIT_ASSERT( it != l.end()); - CPPUNIT_ASSERT( it.key() == 251 ); - CPPUNIT_ASSERT( it.val().m_val == 152 ); - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Iterator test - { - int nCount = 100; - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i, i * 2 ) != l.end() ); - - { - typename OrdList::iterator it( l.begin() ); - typename OrdList::const_iterator cit( l.cbegin() ); - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++it; - CPPUNIT_CHECK( it != cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - ++cit; - CPPUNIT_CHECK( it == cit ); - CPPUNIT_CHECK( it != l.end() ); - CPPUNIT_CHECK( it != l.cend() ); - CPPUNIT_CHECK( cit != l.end() ); - CPPUNIT_CHECK( cit != l.cend() ); - } - - int i = 0; - for ( typename OrdList::iterator iter = l.begin(), itEnd = l.end(); iter != itEnd; ++iter, ++i ) { - CPPUNIT_ASSERT( iter.key() == i ); - CPPUNIT_ASSERT( iter->first == i ); - CPPUNIT_ASSERT( (*iter).first == i ); - - CPPUNIT_ASSERT( iter.val().m_val == i * 2 ); - CPPUNIT_ASSERT( iter->second.m_val == i * 2 ); - CPPUNIT_ASSERT( (*iter).second.m_val == i * 2 ); - - iter.val().m_val = i * 3; - } - - // Check that we have visited all items - for ( int i = 0; i < nCount; ++i ) { - it = l.contains( i ); - CPPUNIT_ASSERT( it != l.end() ); - CPPUNIT_ASSERT( it.key() == i ); - CPPUNIT_ASSERT( it.val().m_val == i * 3 ); - } - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - - // Const iterator - for ( int i = 0; i < nCount; ++i ) - CPPUNIT_ASSERT( l.insert(i, i * 7) != l.end() ); - - i = 0; - const OrdList& rl = l; - for ( typename OrdList::const_iterator iter = rl.begin(), itEnd = rl.end(); iter != itEnd; ++iter, ++i ) { - CPPUNIT_ASSERT( iter.key() == i ); - CPPUNIT_ASSERT( iter->first == i ); - CPPUNIT_ASSERT( (*iter).first == i ); - - CPPUNIT_ASSERT( iter.val().m_val == i * 7 ); - CPPUNIT_ASSERT( iter->second.m_val == i * 7 ); - CPPUNIT_ASSERT( (*iter).second.m_val == i * 7 ); - - // it.val().m_val = i * 3 ; // error: const-iterator - } - - l.clear(); - CPPUNIT_ASSERT( l.empty() ); - } - - } - } - - void HP_cmp(); - void HP_less(); - void HP_cmpmix(); - void HP_ic(); - - void DHP_cmp(); - void DHP_less(); - void DHP_cmpmix(); - void DHP_ic(); - - void RCU_GPI_cmp(); - void RCU_GPI_less(); - void RCU_GPI_cmpmix(); - void RCU_GPI_ic(); - - void RCU_GPB_cmp(); - void RCU_GPB_less(); - void RCU_GPB_cmpmix(); - void RCU_GPB_ic(); - - void RCU_GPT_cmp(); - void RCU_GPT_less(); - void RCU_GPT_cmpmix(); - void RCU_GPT_ic(); - - void RCU_SHB_cmp(); - void RCU_SHB_less(); - void RCU_SHB_cmpmix(); - void RCU_SHB_ic(); - - void RCU_SHT_cmp(); - void RCU_SHT_less(); - void RCU_SHT_cmpmix(); - void RCU_SHT_ic(); - - void NOGC_cmp(); - void NOGC_less(); - void NOGC_cmpmix(); - void NOGC_ic(); - - CPPUNIT_TEST_SUITE(MichaelKVListTestHeader) - CPPUNIT_TEST(HP_cmp) - CPPUNIT_TEST(HP_less) - CPPUNIT_TEST(HP_cmpmix) - CPPUNIT_TEST(HP_ic) - - CPPUNIT_TEST(DHP_cmp) - CPPUNIT_TEST(DHP_less) - CPPUNIT_TEST(DHP_cmpmix) - CPPUNIT_TEST(DHP_ic) - - CPPUNIT_TEST(RCU_GPI_cmp) - CPPUNIT_TEST(RCU_GPI_less) - CPPUNIT_TEST(RCU_GPI_cmpmix) - CPPUNIT_TEST(RCU_GPI_ic) - - CPPUNIT_TEST(RCU_GPB_cmp) - CPPUNIT_TEST(RCU_GPB_less) - CPPUNIT_TEST(RCU_GPB_cmpmix) - CPPUNIT_TEST(RCU_GPB_ic) - - CPPUNIT_TEST(RCU_GPT_cmp) - CPPUNIT_TEST(RCU_GPT_less) - CPPUNIT_TEST(RCU_GPT_cmpmix) - CPPUNIT_TEST(RCU_GPT_ic) - - CPPUNIT_TEST(RCU_SHB_cmp) - CPPUNIT_TEST(RCU_SHB_less) - CPPUNIT_TEST(RCU_SHB_cmpmix) - CPPUNIT_TEST(RCU_SHB_ic) - - CPPUNIT_TEST(RCU_SHT_cmp) - CPPUNIT_TEST(RCU_SHT_less) - CPPUNIT_TEST(RCU_SHT_cmpmix) - CPPUNIT_TEST(RCU_SHT_ic) - - CPPUNIT_TEST(NOGC_cmp) - CPPUNIT_TEST(NOGC_less) - CPPUNIT_TEST(NOGC_cmpmix) - CPPUNIT_TEST(NOGC_ic) - CPPUNIT_TEST_SUITE_END() - }; - -} // namespace ordlist - -#endif // #ifndef CDSTEST_HDR_MICHAEL_KV_H diff --git a/tests/test-hdr/list/hdr_michael_kv_dhp.cpp b/tests/test-hdr/list/hdr_michael_kv_dhp.cpp deleted file mode 100644 index 55d76bab..00000000 --- a/tests/test-hdr/list/hdr_michael_kv_dhp.cpp +++ /dev/null @@ -1,128 +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 "list/hdr_michael_kv.h" -#include - -namespace ordlist { - namespace { - struct DHP_cmp_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - }; - } - void MichaelKVListTestHeader::DHP_cmp() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, DHP_cmp_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_less_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::DHP_less() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, DHP_less_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_cmpmix_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::DHP_cmpmix() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, DHP_cmpmix_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct DHP_ic_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelKVListTestHeader::DHP_ic() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, DHP_ic_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::DHP, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael_kv_hp.cpp b/tests/test-hdr/list/hdr_michael_kv_hp.cpp deleted file mode 100644 index 96c1709d..00000000 --- a/tests/test-hdr/list/hdr_michael_kv_hp.cpp +++ /dev/null @@ -1,132 +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 "list/hdr_michael_kv.h" -#include - -namespace ordlist { - namespace { - struct HP_cmp_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - }; - - } - void MichaelKVListTestHeader::HP_cmp() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, HP_cmp_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::HP, - key_type, - value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_less_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::HP_less() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, HP_less_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_cmpmix_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::HP_cmpmix() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, HP_cmpmix_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HP_ic_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelKVListTestHeader::HP_ic() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, HP_ic_traits > list; - test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::HP, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test< opt_list >(); - } - -} // namespace ordlist - -CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::MichaelKVListTestHeader); diff --git a/tests/test-hdr/list/hdr_michael_kv_nogc.cpp b/tests/test-hdr/list/hdr_michael_kv_nogc.cpp deleted file mode 100644 index ef5477ed..00000000 --- a/tests/test-hdr/list/hdr_michael_kv_nogc.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 "list/hdr_michael_kv.h" -#include - -namespace ordlist { - namespace { - struct NOGC_cmp_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - }; - - } - void MichaelKVListTestHeader::NOGC_cmp() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, NOGC_cmp_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::nogc, - key_type, - value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_less_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::NOGC_less() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, NOGC_less_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_cmpmix_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::NOGC_cmpmix() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, NOGC_cmpmix_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_ic_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelKVListTestHeader::NOGC_ic() - { - // traits-based version - typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, NOGC_ic_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::MichaelKVList< cds::gc::nogc, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - nogc_test< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael_kv_rcu_gpb.cpp b/tests/test-hdr/list/hdr_michael_kv_rcu_gpb.cpp deleted file mode 100644 index 6bcc565c..00000000 --- a/tests/test-hdr/list/hdr_michael_kv_rcu_gpb.cpp +++ /dev/null @@ -1,130 +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 "list/hdr_michael_kv.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type; - struct RCU_GPB_cmp_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - }; - } - void MichaelKVListTestHeader::RCU_GPB_cmp() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPB_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_less_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::RCU_GPB_less() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPB_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_cmpmix_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::RCU_GPB_cmpmix() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPB_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_ic_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelKVListTestHeader::RCU_GPB_ic() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPB_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael_kv_rcu_gpi.cpp b/tests/test-hdr/list/hdr_michael_kv_rcu_gpi.cpp deleted file mode 100644 index da326379..00000000 --- a/tests/test-hdr/list/hdr_michael_kv_rcu_gpi.cpp +++ /dev/null @@ -1,130 +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 "list/hdr_michael_kv.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type; - struct RCU_GPI_cmp_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - }; - } - void MichaelKVListTestHeader::RCU_GPI_cmp() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPI_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_less_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::RCU_GPI_less() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPI_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_cmpmix_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::RCU_GPI_cmpmix() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPI_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_ic_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelKVListTestHeader::RCU_GPI_ic() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPI_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael_kv_rcu_gpt.cpp b/tests/test-hdr/list/hdr_michael_kv_rcu_gpt.cpp deleted file mode 100644 index 0faee96d..00000000 --- a/tests/test-hdr/list/hdr_michael_kv_rcu_gpt.cpp +++ /dev/null @@ -1,130 +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 "list/hdr_michael_kv.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type; - struct RCU_GPT_cmp_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - }; - } - void MichaelKVListTestHeader::RCU_GPT_cmp() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPT_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_less_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::RCU_GPT_less() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPT_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_cmpmix_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - typedef MichaelKVListTestHeader::lt less; - }; - } - void MichaelKVListTestHeader::RCU_GPT_cmpmix() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPT_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_ic_traits : public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelKVListTestHeader::RCU_GPT_ic() - { - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_GPT_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael_kv_rcu_shb.cpp b/tests/test-hdr/list/hdr_michael_kv_rcu_shb.cpp deleted file mode 100644 index a8275bfe..00000000 --- a/tests/test-hdr/list/hdr_michael_kv_rcu_shb.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 "list/hdr_michael_kv.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type; - struct RCU_SHB_cmp_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - }; - } -#endif - void MichaelKVListTestHeader::RCU_SHB_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHB_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_less_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - }; - } -#endif - void MichaelKVListTestHeader::RCU_SHB_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHB_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_cmpmix_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - typedef MichaelKVListTestHeader::lt less; - }; - } -#endif - void MichaelKVListTestHeader::RCU_SHB_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHB_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_ic_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } -#endif - void MichaelKVListTestHeader::RCU_SHB_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHB_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_michael_kv_rcu_sht.cpp b/tests/test-hdr/list/hdr_michael_kv_rcu_sht.cpp deleted file mode 100644 index 93f486a9..00000000 --- a/tests/test-hdr/list/hdr_michael_kv_rcu_sht.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 "list/hdr_michael_kv.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type; - struct RCU_SHT_cmp_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - }; - } -#endif - void MichaelKVListTestHeader::RCU_SHT_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHT_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_less_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - }; - } -#endif - void MichaelKVListTestHeader::RCU_SHT_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHT_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_cmpmix_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::cmp compare; - typedef MichaelKVListTestHeader::lt less; - }; - } -#endif - void MichaelKVListTestHeader::RCU_SHT_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHT_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_ic_traits: public cc::michael_list::traits - { - typedef MichaelKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } -#endif - void MichaelKVListTestHeader::RCU_SHT_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelKVList< rcu_type, key_type, value_type, RCU_SHT_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelKVList< rcu_type, key_type, value_type, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_michael_nogc.cpp b/tests/test-hdr/list/hdr_michael_nogc.cpp deleted file mode 100644 index 870f414f..00000000 --- a/tests/test-hdr/list/hdr_michael_nogc.cpp +++ /dev/null @@ -1,128 +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 "list/hdr_michael.h" -#include - -namespace ordlist { - namespace { - struct NOGC_cmp_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - }; - } - void MichaelListTestHeader::NOGC_cmp() - { - // traits-based version - typedef cc::MichaelList< cds::gc::nogc, item, NOGC_cmp_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::nogc, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_less_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::NOGC_less() - { - // traits-based version - typedef cc::MichaelList< cds::gc::nogc, item, NOGC_less_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::nogc, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_cmpmix_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::NOGC_cmpmix() - { - // traits-based version - typedef cc::MichaelList< cds::gc::nogc, item, NOGC_cmpmix_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::nogc, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - nogc_test< opt_list >(); - } - - namespace { - struct NOGC_ic_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelListTestHeader::NOGC_ic() - { - // traits-based version - typedef cc::MichaelList< cds::gc::nogc, item, NOGC_ic_traits > list; - nogc_test< list >(); - - // option-based version - - typedef cc::MichaelList< cds::gc::nogc, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - nogc_test< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael_rcu_gpb.cpp b/tests/test-hdr/list/hdr_michael_rcu_gpb.cpp deleted file mode 100644 index 4a8dad7d..00000000 --- a/tests/test-hdr/list/hdr_michael_rcu_gpb.cpp +++ /dev/null @@ -1,132 +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 "list/hdr_michael.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type; - - struct RCU_GPB_cmp_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - }; - } - - void MichaelListTestHeader::RCU_GPB_cmp() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPB_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_less_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::RCU_GPB_less() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPB_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_cmpmix_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::RCU_GPB_cmpmix() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPB_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPB_ic_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelListTestHeader::RCU_GPB_ic() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPB_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael_rcu_gpi.cpp b/tests/test-hdr/list/hdr_michael_rcu_gpi.cpp deleted file mode 100644 index 3a93da3d..00000000 --- a/tests/test-hdr/list/hdr_michael_rcu_gpi.cpp +++ /dev/null @@ -1,132 +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 "list/hdr_michael.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type; - - struct RCU_GPI_cmp_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - }; - } - - void MichaelListTestHeader::RCU_GPI_cmp() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPI_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_less_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::RCU_GPI_less() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPI_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_cmpmix_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::RCU_GPI_cmpmix() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPI_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPI_ic_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelListTestHeader::RCU_GPI_ic() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPI_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael_rcu_gpt.cpp b/tests/test-hdr/list/hdr_michael_rcu_gpt.cpp deleted file mode 100644 index 49ceab8a..00000000 --- a/tests/test-hdr/list/hdr_michael_rcu_gpt.cpp +++ /dev/null @@ -1,132 +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 "list/hdr_michael.h" -#include -#include - -namespace ordlist { - namespace { - typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type; - - struct RCU_GPT_cmp_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - }; - } - - void MichaelListTestHeader::RCU_GPT_cmp() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPT_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_less_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::RCU_GPT_less() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPT_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_cmpmix_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - typedef MichaelListTestHeader::lt less; - }; - } - void MichaelListTestHeader::RCU_GPT_cmpmix() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPT_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); - } - - namespace { - struct RCU_GPT_ic_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void MichaelListTestHeader::RCU_GPT_ic() - { - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_GPT_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/list/hdr_michael_rcu_shb.cpp b/tests/test-hdr/list/hdr_michael_rcu_shb.cpp deleted file mode 100644 index a60d88b9..00000000 --- a/tests/test-hdr/list/hdr_michael_rcu_shb.cpp +++ /dev/null @@ -1,147 +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 "list/hdr_michael.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_type; - - struct RCU_SHB_cmp_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - }; - } -#endif - - void MichaelListTestHeader::RCU_SHB_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_SHB_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_less_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - }; - } -#endif - void MichaelListTestHeader::RCU_SHB_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_SHB_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_cmpmix_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - typedef MichaelListTestHeader::lt less; - }; - } -#endif - void MichaelListTestHeader::RCU_SHB_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_SHB_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHB_ic_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } -#endif - void MichaelListTestHeader::RCU_SHB_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_SHB_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -} // namespace ordlist diff --git a/tests/test-hdr/list/hdr_michael_rcu_sht.cpp b/tests/test-hdr/list/hdr_michael_rcu_sht.cpp deleted file mode 100644 index 3cd2ec65..00000000 --- a/tests/test-hdr/list/hdr_michael_rcu_sht.cpp +++ /dev/null @@ -1,147 +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 "list/hdr_michael.h" -#include -#include - -namespace ordlist { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type; - - struct RCU_SHT_cmp_traits : public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - }; - } -#endif - - void MichaelListTestHeader::RCU_SHT_cmp() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_SHT_cmp_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_less_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - }; - } -#endif - void MichaelListTestHeader::RCU_SHT_less() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_SHT_less_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_cmpmix_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::cmp compare; - typedef MichaelListTestHeader::lt less; - }; - } -#endif - void MichaelListTestHeader::RCU_SHT_cmpmix() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_SHT_cmpmix_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - namespace { - struct RCU_SHT_ic_traits: public cc::michael_list::traits - { - typedef MichaelListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } -#endif - void MichaelListTestHeader::RCU_SHT_ic() - { -#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - // traits-based version - typedef cc::MichaelList< rcu_type, item, RCU_SHT_ic_traits > list; - test_rcu< list >(); - - // option-based version - - typedef cc::MichaelList< rcu_type, item, - cc::michael_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test_rcu< opt_list >(); -#endif - } - -} // namespace ordlist diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 1d3063c7..8ba101ad 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -18,4 +18,3 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/map2) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pqueue) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/queue) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/set2) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stack) \ No newline at end of file diff --git a/tests/unit/stack/CMakeLists.txt b/tests/unit/stack/CMakeLists.txt deleted file mode 100644 index ea341729..00000000 --- a/tests/unit/stack/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -set(PACKAGE_NAME cdsu-stack) - -set(CDSUNIT_STACK_SOURCES - stack_push.cpp - stack_pushpop.cpp - stack_intrusive_pushpop.cpp) - -add_executable(${PACKAGE_NAME} ${CDSUNIT_STACK_SOURCES} $) -target_link_libraries(${PACKAGE_NAME} ${CDS_SHARED_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) -add_test(NAME ${PACKAGE_NAME} COMMAND ${PACKAGE_NAME} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) \ No newline at end of file diff --git a/tests/unit/stack/intrusive_stack_defs.h b/tests/unit/stack/intrusive_stack_defs.h deleted file mode 100644 index dc315889..00000000 --- a/tests/unit/stack/intrusive_stack_defs.h +++ /dev/null @@ -1,169 +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 CDSUNIT_INTRUSIVE_STACK_DEFS_H -#define CDSUNIT_INTRUSIVE_STACK_DEFS_H - -#define CDSUNIT_DECLARE_TreiberStack \ - TEST_CASE( Treiber_HP, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_CASE( Treiber_HP_seqcst, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - /*TEST_CASE( Treiber_HP_yield, cds::intrusive::treiber_stack::node< cds::gc::HP > )*/ \ - TEST_CASE( Treiber_HP_pause, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_CASE( Treiber_HP_exp, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_CASE( Treiber_HP_stat, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_CASE( Treiber_DHP, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - /*TEST_CASE( Treiber_DHP_yield, cds::intrusive::treiber_stack::node< cds::gc::DHP > )*/ \ - TEST_CASE( Treiber_DHP_pause, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - TEST_CASE( Treiber_DHP_exp, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - TEST_CASE( Treiber_DHP_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) - -#define CDSUNIT_TEST_TreiberStack \ - CPPUNIT_TEST( Treiber_HP ) \ - CPPUNIT_TEST( Treiber_HP_seqcst ) \ - /*CPPUNIT_TEST( Treiber_HP_yield )*/ \ - CPPUNIT_TEST( Treiber_HP_pause ) \ - CPPUNIT_TEST( Treiber_HP_exp ) \ - CPPUNIT_TEST( Treiber_HP_stat ) \ - CPPUNIT_TEST( Treiber_DHP ) \ - /*CPPUNIT_TEST( Treiber_DHP_yield )*/ \ - CPPUNIT_TEST( Treiber_DHP_pause ) \ - CPPUNIT_TEST( Treiber_DHP_exp ) \ - CPPUNIT_TEST( Treiber_DHP_stat ) - -#define CDSUNIT_DECLARE_EliminationStack \ - TEST_ELIMINATION( Elimination_HP, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_ELIMINATION( Elimination_HP_2ms, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_ELIMINATION( Elimination_HP_2ms_stat, cds::intrusive::treiber_stack::node< cds::gc::HP >) \ - TEST_ELIMINATION( Elimination_HP_5ms, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_ELIMINATION( Elimination_HP_5ms_stat, cds::intrusive::treiber_stack::node< cds::gc::HP >) \ - TEST_ELIMINATION( Elimination_HP_10ms, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_ELIMINATION( Elimination_HP_10ms_stat, cds::intrusive::treiber_stack::node< cds::gc::HP >) \ - TEST_ELIMINATION( Elimination_HP_seqcst, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - /*TEST_ELIMINATION( Elimination_HP_yield, cds::intrusive::treiber_stack::node< cds::gc::HP > )*/ \ - TEST_ELIMINATION( Elimination_HP_pause, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_ELIMINATION( Elimination_HP_exp, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_ELIMINATION( Elimination_HP_stat, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_ELIMINATION( Elimination_HP_dyn, cds::intrusive::treiber_stack::node< cds::gc::HP > ) \ - TEST_ELIMINATION( Elimination_HP_dyn_stat, cds::intrusive::treiber_stack::node< cds::gc::HP >) \ - TEST_ELIMINATION( Elimination_DHP, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - TEST_ELIMINATION( Elimination_DHP_2ms, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - TEST_ELIMINATION( Elimination_DHP_2ms_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP >) \ - TEST_ELIMINATION( Elimination_DHP_5ms, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - TEST_ELIMINATION( Elimination_DHP_5ms_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP >) \ - TEST_ELIMINATION( Elimination_DHP_10ms, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - TEST_ELIMINATION( Elimination_DHP_10ms_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP >) \ - TEST_ELIMINATION( Elimination_DHP_seqcst, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - /*TEST_ELIMINATION( Elimination_DHP_yield, cds::intrusive::treiber_stack::node< cds::gc::DHP > )*/ \ - TEST_ELIMINATION( Elimination_DHP_pause, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - TEST_ELIMINATION( Elimination_DHP_exp, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - TEST_ELIMINATION( Elimination_DHP_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - TEST_ELIMINATION( Elimination_DHP_dyn, cds::intrusive::treiber_stack::node< cds::gc::DHP > ) \ - TEST_ELIMINATION( Elimination_DHP_dyn_stat, cds::intrusive::treiber_stack::node< cds::gc::DHP >) - -#define CDSUNIT_TEST_EliminationStack \ - CPPUNIT_TEST( Elimination_HP ) \ - CPPUNIT_TEST( Elimination_HP_2ms ) \ - CPPUNIT_TEST( Elimination_HP_2ms_stat) \ - CPPUNIT_TEST( Elimination_HP_5ms ) \ - CPPUNIT_TEST( Elimination_HP_5ms_stat) \ - CPPUNIT_TEST( Elimination_HP_10ms ) \ - CPPUNIT_TEST( Elimination_HP_10ms_stat) \ - CPPUNIT_TEST( Elimination_HP_seqcst ) \ - /*CPPUNIT_TEST( Elimination_HP_yield )*/ \ - CPPUNIT_TEST( Elimination_HP_pause ) \ - CPPUNIT_TEST( Elimination_HP_exp ) \ - CPPUNIT_TEST( Elimination_HP_stat ) \ - CPPUNIT_TEST( Elimination_HP_dyn ) \ - CPPUNIT_TEST( Elimination_HP_dyn_stat) \ - CPPUNIT_TEST( Elimination_DHP ) \ - CPPUNIT_TEST( Elimination_DHP_seqcst ) \ - CPPUNIT_TEST( Elimination_DHP_2ms ) \ - CPPUNIT_TEST( Elimination_DHP_2ms_stat) \ - CPPUNIT_TEST( Elimination_DHP_5ms ) \ - CPPUNIT_TEST( Elimination_DHP_5ms_stat) \ - CPPUNIT_TEST( Elimination_DHP_10ms ) \ - CPPUNIT_TEST( Elimination_DHP_10ms_stat) \ - /*CPPUNIT_TEST( Elimination_DHP_yield )*/ \ - CPPUNIT_TEST( Elimination_DHP_pause ) \ - CPPUNIT_TEST( Elimination_DHP_exp ) \ - CPPUNIT_TEST( Elimination_DHP_stat ) \ - CPPUNIT_TEST( Elimination_DHP_dyn ) \ - CPPUNIT_TEST( Elimination_DHP_dyn_stat) - -#define CDSUNIT_DECLARE_FCStack \ - TEST_FCSTACK( FCStack_slist, boost::intrusive::slist_base_hook<> ) \ - TEST_FCSTACK( FCStack_slist_stat, boost::intrusive::slist_base_hook<> ) \ - TEST_FCSTACK( FCStack_slist_elimination, boost::intrusive::slist_base_hook<> ) \ - TEST_FCSTACK( FCStack_slist_elimination_stat, boost::intrusive::slist_base_hook<> ) \ - TEST_FCSTACK( FCStack_slist_mutex_stat, boost::intrusive::slist_base_hook<> ) \ - TEST_FCSTACK( FCStack_slist_mutex_elimination, boost::intrusive::slist_base_hook<> ) \ - TEST_FCSTACK( FCStack_slist_mutex_elimination_stat, boost::intrusive::slist_base_hook<> ) \ - TEST_FCSTACK( FCStack_list, boost::intrusive::list_base_hook<> ) \ - TEST_FCSTACK( FCStack_list_stat, boost::intrusive::list_base_hook<> ) \ - TEST_FCSTACK( FCStack_list_elimination, boost::intrusive::list_base_hook<> ) \ - TEST_FCSTACK( FCStack_list_elimination_stat, boost::intrusive::list_base_hook<> ) \ - TEST_FCSTACK( FCStack_list_mutex_stat, boost::intrusive::list_base_hook<> ) \ - TEST_FCSTACK( FCStack_list_mutex_elimination, boost::intrusive::list_base_hook<> ) \ - TEST_FCSTACK( FCStack_list_mutex_elimination_stat, boost::intrusive::list_base_hook<> ) - -#define CDSUNIT_TEST_FCStack \ - CPPUNIT_TEST( FCStack_slist ) \ - CPPUNIT_TEST( FCStack_slist_stat ) \ - CPPUNIT_TEST( FCStack_slist_elimination ) \ - CPPUNIT_TEST( FCStack_slist_elimination_stat ) \ - CPPUNIT_TEST( FCStack_slist_mutex_stat ) \ - CPPUNIT_TEST( FCStack_slist_mutex_elimination ) \ - CPPUNIT_TEST( FCStack_slist_mutex_elimination_stat ) \ - CPPUNIT_TEST( FCStack_list ) \ - CPPUNIT_TEST( FCStack_list_stat ) \ - CPPUNIT_TEST( FCStack_list_elimination ) \ - CPPUNIT_TEST( FCStack_list_elimination_stat ) \ - CPPUNIT_TEST( FCStack_list_mutex_stat ) \ - CPPUNIT_TEST( FCStack_list_mutex_elimination ) \ - CPPUNIT_TEST( FCStack_list_mutex_elimination_stat ) - - -#define CDSUNIT_DECLARE_StdStack \ - TEST_STDSTACK( StdStack_Deque_Mutex ) \ - TEST_STDSTACK( StdStack_Deque_Spin ) \ - TEST_STDSTACK( StdStack_Vector_Mutex ) \ - TEST_STDSTACK( StdStack_Vector_Spin ) \ - TEST_STDSTACK( StdStack_List_Mutex ) \ - TEST_STDSTACK( StdStack_List_Spin ) - -#define CDSUNIT_TEST_StdStack \ - CPPUNIT_TEST( StdStack_Deque_Mutex ) \ - CPPUNIT_TEST( StdStack_Deque_Spin ) \ - CPPUNIT_TEST( StdStack_Vector_Mutex ) \ - CPPUNIT_TEST( StdStack_Vector_Spin ) \ - CPPUNIT_TEST( StdStack_List_Mutex ) \ - CPPUNIT_TEST( StdStack_List_Spin ) - -#endif // #ifndef CDSUNIT_INTRUSIVE_STACK_DEFS_H diff --git a/tests/unit/stack/intrusive_stack_type.h b/tests/unit/stack/intrusive_stack_type.h deleted file mode 100644 index 13083e1d..00000000 --- a/tests/unit/stack/intrusive_stack_type.h +++ /dev/null @@ -1,424 +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 CDSUNIT_INTRUSIVE_STACK_TYPES_H -#define CDSUNIT_INTRUSIVE_STACK_TYPES_H - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace istack { - - namespace details { - - template < typename T, typename Stack, typename Lock> - class StdStack - { - Stack m_Impl; - mutable Lock m_Lock; - cds::intrusive::treiber_stack::empty_stat m_stat; - - typedef std::unique_lock unique_lock; - - public: - typedef T value_type; - - bool push( T& v ) - { - unique_lock l( m_Lock ); - m_Impl.push( &v ); - return true; - } - - T * pop() - { - unique_lock l( m_Lock ); - if ( !m_Impl.empty() ) { - T * v = m_Impl.top(); - m_Impl.pop(); - return v; - } - return nullptr; - } - - bool empty() const - { - unique_lock l( m_Lock ); - return m_Impl.empty(); - } - - cds::intrusive::treiber_stack::empty_stat const& statistics() const - { - return m_stat; - } - }; - } - - template - struct Types { - - template - using base_hook = cds::intrusive::treiber_stack::base_hook < cds::opt::gc< GC > >; - - // TreiberStack - typedef cds::intrusive::TreiberStack< cds::gc::HP, T > Treiber_HP; - struct traits_Treiber_DHP: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_DHP >Treiber_DHP; - - template struct traits_Treiber_seqcst : public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::memory_model - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Treiber_seqcst > Treiber_HP_seqcst; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_seqcst > Treiber_DHP_seqcst; - - template struct traits_Treiber_stat: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::stat > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Treiber_stat > Treiber_HP_stat; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_stat > Treiber_DHP_stat; - - template struct traits_Treiber_yield: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::back_off - , cds::opt::memory_model - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Treiber_yield > Treiber_HP_yield; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_yield > Treiber_DHP_yield; - - template struct traits_Treiber_pause: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::back_off - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Treiber_pause > Treiber_HP_pause; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_pause > Treiber_DHP_pause; - - template struct traits_Treiber_exp: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - ,cds::opt::back_off< - cds::backoff::exponential< - cds::backoff::pause, - cds::backoff::yield - > - > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Treiber_exp > Treiber_HP_exp; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Treiber_exp > Treiber_DHP_exp; - - - // Elimination stack - template struct traits_Elimination_on : public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_on > Elimination_HP; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_on > Elimination_DHP; - - template struct traits_Elimination_seqcst : public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::memory_model< cds::opt::v::sequential_consistent > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_seqcst > Elimination_HP_seqcst; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_seqcst > Elimination_DHP_seqcst; - - template struct traits_Elimination_2ms: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<2> > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_2ms > Elimination_HP_2ms; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_2ms > Elimination_DHP_2ms; - - template struct traits_Elimination_2ms_stat: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<2> > - , cds::opt::stat > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_2ms_stat > Elimination_HP_2ms_stat; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_2ms_stat > Elimination_DHP_2ms_stat; - - template struct traits_Elimination_5ms: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<5> > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_5ms > Elimination_HP_5ms; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_5ms > Elimination_DHP_5ms; - - template struct traits_Elimination_5ms_stat: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<5> > - , cds::opt::stat > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_5ms_stat > Elimination_HP_5ms_stat; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_5ms_stat > Elimination_DHP_5ms_stat; - - template struct traits_Elimination_10ms: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<10> > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_10ms > Elimination_HP_10ms; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_10ms > Elimination_DHP_10ms; - - template struct traits_Elimination_10ms_stat: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<10> > - , cds::opt::stat > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_10ms_stat > Elimination_HP_10ms_stat; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_10ms_stat > Elimination_DHP_10ms_stat; - - template struct traits_Elimination_dyn: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::buffer< cds::opt::v::dynamic_buffer > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_dyn > Elimination_HP_dyn; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_dyn > Elimination_DHP_dyn; - - template struct traits_Elimination_stat: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::stat > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_stat > Elimination_HP_stat; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_stat > Elimination_DHP_stat; - - template struct traits_Elimination_dyn_stat: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::buffer< cds::opt::v::dynamic_buffer > - , cds::opt::stat > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_dyn_stat > Elimination_HP_dyn_stat; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_dyn_stat > Elimination_DHP_dyn_stat; - - template struct traits_Elimination_yield: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::back_off - , cds::opt::memory_model - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_yield > Elimination_HP_yield; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_yield > Elimination_DHP_yield; - - template struct traits_Elimination_pause: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - , cds::opt::back_off - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_pause > Elimination_HP_pause; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_pause > Elimination_DHP_pause; - - template struct traits_Elimination_exp: public - cds::intrusive::treiber_stack::make_traits < - cds::intrusive::opt::hook< base_hook > - , cds::opt::enable_elimination - ,cds::opt::back_off< - cds::backoff::exponential< - cds::backoff::pause, - cds::backoff::yield - > - > - > ::type - {}; - typedef cds::intrusive::TreiberStack< cds::gc::HP, T, traits_Elimination_exp > Elimination_HP_exp; - typedef cds::intrusive::TreiberStack< cds::gc::DHP, T, traits_Elimination_exp > Elimination_DHP_exp; - - // FCStack - typedef cds::intrusive::FCStack< T > FCStack_slist; - - struct traits_FCStack_stat: - public cds::intrusive::fcstack::make_traits< - cds::opt::stat< cds::intrusive::fcstack::stat<> > - >::type - {}; - struct traits_FCStack_elimination: - public cds::intrusive::fcstack::make_traits< - cds::opt::enable_elimination< true > - >::type - {}; - struct traits_FCStack_elimination_stat: - public cds::intrusive::fcstack::make_traits< - cds::opt::stat< cds::intrusive::fcstack::stat<> >, - cds::opt::enable_elimination< true > - >::type - {}; - - struct traits_FCStack_mutex_stat: - public cds::intrusive::fcstack::make_traits< - cds::opt::stat< cds::intrusive::fcstack::stat<> > - ,cds::opt::lock_type< std::mutex > - >::type - {}; - struct traits_FCStack_mutex_elimination: - public cds::intrusive::fcstack::make_traits< - cds::opt::enable_elimination< true > - ,cds::opt::lock_type< std::mutex > - >::type - {}; - struct traits_FCStack_mutex_elimination_stat: - public cds::intrusive::fcstack::make_traits< - cds::opt::stat< cds::intrusive::fcstack::stat<> > - ,cds::opt::enable_elimination< true > - ,cds::opt::lock_type< std::mutex > - >::type - {}; - - typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_stat > FCStack_slist_stat; - typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_elimination > FCStack_slist_elimination; - typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_elimination_stat > FCStack_slist_elimination_stat; - typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_mutex_stat > FCStack_slist_mutex_stat; - typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_mutex_elimination > FCStack_slist_mutex_elimination; - typedef cds::intrusive::FCStack< T, boost::intrusive::slist< T >, traits_FCStack_mutex_elimination_stat > FCStack_slist_mutex_elimination_stat; - typedef cds::intrusive::FCStack< T, boost::intrusive::list< T > > FCStack_list; - typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_stat > FCStack_list_stat; - typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_elimination > FCStack_list_elimination; - typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_elimination_stat > FCStack_list_elimination_stat; - typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_mutex_stat > FCStack_list_mutex_stat; - typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_mutex_elimination > FCStack_list_mutex_elimination; - typedef cds::intrusive::FCStack< T, boost::intrusive::list< T >, traits_FCStack_mutex_elimination_stat > FCStack_list_mutex_elimination_stat; - - - // std::stack - typedef details::StdStack< T, std::stack< T* >, std::mutex > StdStack_Deque_Mutex; - typedef details::StdStack< T, std::stack< T* >, cds::sync::spin > StdStack_Deque_Spin; - typedef details::StdStack< T, std::stack< T*, std::vector >, std::mutex > StdStack_Vector_Mutex; - typedef details::StdStack< T, std::stack< T*, std::vector >, cds::sync::spin > StdStack_Vector_Spin; - typedef details::StdStack< T, std::stack< T*, std::list >, std::mutex > StdStack_List_Mutex; - typedef details::StdStack< T, std::stack< T*, std::list >, cds::sync::spin > StdStack_List_Spin; - - }; -} // namespace istack - -namespace std { - static inline ostream& operator <<( ostream& o, cds::intrusive::treiber_stack::stat<> const& s ) - { - return o << "\tStatistics:\n" - << "\t Push: " << s.m_PushCount.get() << "\n" - << "\t Pop: " << s.m_PopCount.get() << "\n" - << "\t Push contention: " << s.m_PushRace.get() << "\n" - << "\t Pop contention: " << s.m_PopRace.get() << "\n" - << "\t m_ActivePushCollision: " << s.m_ActivePushCollision.get() << "\n" - << "\t m_PassivePopCollision: " << s.m_PassivePopCollision.get() << "\n" - << "\t m_ActivePopCollision: " << s.m_ActivePopCollision.get() << "\n" - << "\t m_PassivePushCollision: " << s.m_PassivePushCollision.get() << "\n" - << "\t m_EliminationFailed: " << s.m_EliminationFailed.get() << "\n"; - } - - static inline ostream& operator <<( ostream& o, cds::intrusive::treiber_stack::empty_stat const& /*s*/ ) - { - return o; - } - - static inline ostream& operator <<( ostream& o, cds::intrusive::fcstack::empty_stat const& /*s*/ ) - { - return o; - } - - static inline ostream& operator <<( ostream& o, cds::intrusive::fcstack::stat<> const& s ) - { - return o << "\tStatistics:\n" - << "\t Push: " << s.m_nPush.get() << "\n" - << "\t Pop: " << s.m_nPop.get() << "\n" - << "\t FailedPop: " << s.m_nFailedPop.get() << "\n" - << "\t Collided push/pop pair: " << s.m_nCollided.get() << "\n" - << "\tFlat combining statistics:\n" - << "\t Combining factor: " << s.combining_factor() << "\n" - << "\t Operation count: " << s.m_nOperationCount.get() << "\n" - << "\t Combine call count: " << s.m_nCombiningCount.get() << "\n" - << "\t Compact pub-list: " << s.m_nCompactPublicationList.get() << "\n" - << "\t Deactivate pub-record: " << s.m_nDeactivatePubRecord.get() << "\n" - << "\t Activate pub-record: " << s.m_nActivatePubRecord.get() << "\n" - << "\t Create pub-record: " << s.m_nPubRecordCreated.get() << "\n" - << "\t Delete pub-record: " << s.m_nPubRecordDeteted.get() << "\n" - << "\t Acquire pub-record: " << s.m_nAcquirePubRecCount.get()<< "\n" - << "\t Release pub-record: " << s.m_nReleasePubRecCount.get()<< "\n"; - } - -} // namespace std - -#endif // #ifndef CDSUNIT_INTRUSIVE_STACK_TYPES_H diff --git a/tests/unit/stack/stack_defs.h b/tests/unit/stack/stack_defs.h deleted file mode 100644 index 84734bb3..00000000 --- a/tests/unit/stack/stack_defs.h +++ /dev/null @@ -1,195 +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 CDSUNIT_STACK_DEFS_H -#define CDSUNIT_STACK_DEFS_H - -#define CDSUNIT_DECLARE_TreiberStack \ - TEST_CASE( Treiber_HP ) \ - TEST_CASE( Treiber_HP_seqcst ) \ - /*TEST_CASE( Treiber_HP_yield )*/ \ - TEST_CASE( Treiber_HP_pause ) \ - TEST_CASE( Treiber_HP_exp ) \ - TEST_CASE( Treiber_HP_stat ) \ - TEST_CASE( Treiber_DHP ) \ - /*TEST_CASE( Treiber_DHP_yield )*/ \ - TEST_CASE( Treiber_DHP_pause ) \ - TEST_CASE( Treiber_DHP_exp ) \ - TEST_CASE( Treiber_DHP_stat ) - -#define CDSUNIT_TEST_TreiberStack \ - CPPUNIT_TEST( Treiber_HP ) \ - CPPUNIT_TEST( Treiber_HP_seqcst ) \ - /*CPPUNIT_TEST( Treiber_HP_yield )*/ \ - CPPUNIT_TEST( Treiber_HP_pause ) \ - CPPUNIT_TEST( Treiber_HP_exp ) \ - CPPUNIT_TEST( Treiber_HP_stat ) \ - CPPUNIT_TEST( Treiber_DHP ) \ - /*CPPUNIT_TEST( Treiber_DHP_yield )*/ \ - CPPUNIT_TEST( Treiber_DHP_pause ) \ - CPPUNIT_TEST( Treiber_DHP_exp ) \ - CPPUNIT_TEST( Treiber_DHP_stat ) - -#define CDSUNIT_DECLARE_EliminationStack \ - TEST_ELIMINATION( Elimination_HP ) \ - TEST_ELIMINATION( Elimination_HP_2ms ) \ - TEST_ELIMINATION( Elimination_HP_2ms_stat) \ - TEST_ELIMINATION( Elimination_HP_5ms ) \ - TEST_ELIMINATION( Elimination_HP_5ms_stat) \ - TEST_ELIMINATION( Elimination_HP_10ms ) \ - TEST_ELIMINATION( Elimination_HP_10ms_stat) \ - TEST_ELIMINATION( Elimination_HP_seqcst ) \ - /*TEST_ELIMINATION( Elimination_HP_yield )*/ \ - TEST_ELIMINATION( Elimination_HP_pause ) \ - TEST_ELIMINATION( Elimination_HP_exp ) \ - TEST_ELIMINATION( Elimination_HP_stat ) \ - TEST_ELIMINATION( Elimination_HP_dyn ) \ - TEST_ELIMINATION( Elimination_HP_dyn_stat) \ - TEST_ELIMINATION( Elimination_DHP ) \ - TEST_ELIMINATION( Elimination_DHP_2ms ) \ - TEST_ELIMINATION( Elimination_DHP_2ms_stat) \ - TEST_ELIMINATION( Elimination_DHP_5ms ) \ - TEST_ELIMINATION( Elimination_DHP_5ms_stat) \ - TEST_ELIMINATION( Elimination_DHP_10ms ) \ - TEST_ELIMINATION( Elimination_DHP_10ms_stat) \ - /*TEST_ELIMINATION( Elimination_DHP_yield )*/ \ - TEST_ELIMINATION( Elimination_DHP_pause ) \ - TEST_ELIMINATION( Elimination_DHP_exp ) \ - TEST_ELIMINATION( Elimination_DHP_stat ) \ - TEST_ELIMINATION( Elimination_DHP_dyn ) \ - TEST_ELIMINATION( Elimination_DHP_dyn_stat) - -#define CDSUNIT_TEST_EliminationStack \ - CPPUNIT_TEST( Elimination_HP ) \ - CPPUNIT_TEST( Elimination_HP_2ms ) \ - CPPUNIT_TEST( Elimination_HP_2ms_stat) \ - CPPUNIT_TEST( Elimination_HP_5ms ) \ - CPPUNIT_TEST( Elimination_HP_5ms_stat) \ - CPPUNIT_TEST( Elimination_HP_10ms ) \ - CPPUNIT_TEST( Elimination_HP_10ms_stat) \ - CPPUNIT_TEST( Elimination_HP_seqcst ) \ - /*CPPUNIT_TEST( Elimination_HP_yield )*/ \ - CPPUNIT_TEST( Elimination_HP_pause ) \ - CPPUNIT_TEST( Elimination_HP_exp ) \ - CPPUNIT_TEST( Elimination_HP_stat ) \ - CPPUNIT_TEST( Elimination_HP_dyn ) \ - CPPUNIT_TEST( Elimination_HP_dyn_stat) \ - CPPUNIT_TEST( Elimination_DHP ) \ - CPPUNIT_TEST( Elimination_DHP_2ms ) \ - CPPUNIT_TEST( Elimination_DHP_2ms_stat) \ - CPPUNIT_TEST( Elimination_DHP_5ms ) \ - CPPUNIT_TEST( Elimination_DHP_5ms_stat) \ - CPPUNIT_TEST( Elimination_DHP_10ms ) \ - CPPUNIT_TEST( Elimination_DHP_10ms_stat) \ - /*CPPUNIT_TEST( Elimination_DHP_yield )*/ \ - CPPUNIT_TEST( Elimination_DHP_pause ) \ - CPPUNIT_TEST( Elimination_DHP_exp ) \ - CPPUNIT_TEST( Elimination_DHP_stat ) \ - CPPUNIT_TEST( Elimination_DHP_dyn ) \ - CPPUNIT_TEST( Elimination_DHP_dyn_stat) - - -#define CDSUNIT_DECLARE_FCStack \ - TEST_CASE( FCStack_deque ) \ - TEST_CASE( FCStack_deque_mutex ) \ - TEST_CASE( FCStack_deque_stat ) \ - TEST_CASE( FCStack_deque_elimination ) \ - TEST_CASE( FCStack_deque_elimination_stat ) \ - TEST_CASE( FCStack_vector ) \ - TEST_CASE( FCStack_vector_mutex ) \ - TEST_CASE( FCStack_vector_stat ) \ - TEST_CASE( FCStack_vector_elimination ) \ - TEST_CASE( FCStack_vector_elimination_stat ) \ - TEST_CASE( FCStack_list ) \ - TEST_CASE( FCStack_list_mutex ) \ - TEST_CASE( FCStack_list_stat ) \ - TEST_CASE( FCStack_list_elimination ) \ - TEST_CASE( FCStack_list_elimination_stat ) - -#define CDSUNIT_TEST_FCStack \ - CPPUNIT_TEST( FCStack_deque ) \ - CPPUNIT_TEST( FCStack_deque_mutex ) \ - CPPUNIT_TEST( FCStack_deque_stat ) \ - CPPUNIT_TEST( FCStack_deque_elimination ) \ - CPPUNIT_TEST( FCStack_deque_elimination_stat ) \ - CPPUNIT_TEST( FCStack_vector ) \ - CPPUNIT_TEST( FCStack_vector_mutex ) \ - CPPUNIT_TEST( FCStack_vector_stat ) \ - CPPUNIT_TEST( FCStack_vector_elimination ) \ - CPPUNIT_TEST( FCStack_vector_elimination_stat ) \ - CPPUNIT_TEST( FCStack_list ) \ - CPPUNIT_TEST( FCStack_list_mutex ) \ - CPPUNIT_TEST( FCStack_list_stat ) \ - CPPUNIT_TEST( FCStack_list_elimination ) \ - CPPUNIT_TEST( FCStack_list_elimination_stat ) - - -#define CDSUNIT_DECLARE_FCDeque \ - TEST_CASE( FCDequeL_default ) \ - TEST_CASE( FCDequeL_mutex ) \ - TEST_CASE( FCDequeL_stat ) \ - TEST_CASE( FCDequeL_elimination ) \ - TEST_CASE( FCDequeL_elimination_stat ) \ - TEST_CASE( FCDequeR_default ) \ - TEST_CASE( FCDequeR_mutex ) \ - TEST_CASE( FCDequeR_stat ) \ - TEST_CASE( FCDequeR_elimination ) \ - TEST_CASE( FCDequeR_elimination_stat ) - -#define CDSUNIT_TEST_FCDeque \ - CPPUNIT_TEST( FCDequeL_default ) \ - CPPUNIT_TEST( FCDequeL_mutex ) \ - CPPUNIT_TEST( FCDequeL_stat ) \ - CPPUNIT_TEST( FCDequeL_elimination ) \ - CPPUNIT_TEST( FCDequeL_elimination_stat ) \ - CPPUNIT_TEST( FCDequeR_default ) \ - CPPUNIT_TEST( FCDequeR_mutex ) \ - CPPUNIT_TEST( FCDequeR_stat ) \ - CPPUNIT_TEST( FCDequeR_elimination ) \ - CPPUNIT_TEST( FCDequeR_elimination_stat ) - - -#define CDSUNIT_DECLARE_StdStack \ - TEST_CASE( StdStack_Deque_Mutex ) \ - TEST_CASE( StdStack_Deque_Spin ) \ - TEST_CASE( StdStack_Vector_Mutex ) \ - TEST_CASE( StdStack_Vector_Spin ) \ - TEST_CASE( StdStack_List_Mutex ) \ - TEST_CASE( StdStack_List_Spin ) - -#define CDSUNIT_TEST_StdStack \ - CPPUNIT_TEST( StdStack_Deque_Mutex ) \ - CPPUNIT_TEST( StdStack_Deque_Spin ) \ - CPPUNIT_TEST( StdStack_Vector_Mutex ) \ - CPPUNIT_TEST( StdStack_Vector_Spin ) \ - CPPUNIT_TEST( StdStack_List_Mutex ) \ - CPPUNIT_TEST( StdStack_List_Spin ) - -#endif // #ifndef CDSUNIT_STACK_DEFS_H diff --git a/tests/unit/stack/stack_intrusive_pushpop.cpp b/tests/unit/stack/stack_intrusive_pushpop.cpp deleted file mode 100644 index f9b25e6e..00000000 --- a/tests/unit/stack/stack_intrusive_pushpop.cpp +++ /dev/null @@ -1,404 +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/thread.h" -#include "stack/intrusive_stack_type.h" - -// Multi-threaded stack test for push/pop operation -namespace istack { - -#define TEST_CASE( Q, HOOK ) void Q() { test_unbounded< Types >::Q >(); } -#define TEST_ELIMINATION( Q, HOOK ) void Q() { test_elimination< Types >::Q >(); } -#define TEST_BOUNDED( Q, HOOK ) void Q() { test_bounded< Types >::Q >(); } -#define TEST_FCSTACK( Q, HOOK ) void Q() { test_fcstack< Types >::Q >(); } -#define TEST_STDSTACK( Q ) void Q() { test_stdstack< Types >::Q >(); } - - namespace { - static size_t s_nPushThreadCount = 4; - static size_t s_nPopThreadCount = 4; - static size_t s_nStackSize = 10000000; - static size_t s_nEliminationSize = 4; - static bool s_bFCIterative = false; - static unsigned int s_nFCCombinePassCount = 64; - static unsigned int s_nFCCompactFactor = 1024; - - struct empty {}; - - template - struct SimpleValue: public Base - { - atomics::atomic nNo; - size_t nProducer; - size_t nConsumer; - - SimpleValue() {} - SimpleValue( size_t n ): nNo(n) {} - }; - - } // namespace - - class IntrusiveStack_PushPop: public CppUnitMini::TestCase - { - atomics::atomic m_nWorkingProducers; - static CDS_CONSTEXPR const size_t c_nValArraySize = 1024; - static CDS_CONSTEXPR const size_t c_nBadConsumer = 0xbadc0ffe; - - template - class Producer: public CppUnitMini::TestThread - { - virtual TestThread * clone() - { - return new Producer( *this ); - } - public: - Stack& m_Stack; - size_t m_nPushError; - size_t m_arrPush[c_nValArraySize]; - - // Interval in m_arrValue - typename Stack::value_type * m_pStart; - typename Stack::value_type * m_pEnd; - - public: - Producer( CppUnitMini::ThreadPool& pool, Stack& s ) - : CppUnitMini::TestThread( pool ) - , m_Stack( s ) - {} - Producer( Producer& src ) - : CppUnitMini::TestThread( src ) - , m_Stack( src.m_Stack ) - {} - - IntrusiveStack_PushPop& getTest() - { - return static_cast( m_Pool.m_Test ); - } - - virtual void init() - { - cds::threading::Manager::attachThread(); - } - virtual void fini() - { - cds::threading::Manager::detachThread(); - } - - virtual void test() - { - m_nPushError = 0; - memset( m_arrPush, 0, sizeof(m_arrPush)); - - size_t i = 0; - for ( typename Stack::value_type * p = m_pStart; p < m_pEnd; ++p, ++i ) { - p->nProducer = m_nThreadNo; - size_t no; - p->nNo.store( no = i % c_nValArraySize, atomics::memory_order_release ); - if ( m_Stack.push( *p )) - ++m_arrPush[ no ]; - else - ++m_nPushError; - } - - getTest().m_nWorkingProducers.fetch_sub( 1, atomics::memory_order_release ); - } - }; - - template - class Consumer: public CppUnitMini::TestThread - { - virtual TestThread * clone() - { - return new Consumer( *this ); - } - public: - Stack& m_Stack; - size_t m_nPopCount; - size_t m_nPopEmpty; - size_t m_arrPop[c_nValArraySize]; - size_t m_nDirtyPop; - public: - Consumer( CppUnitMini::ThreadPool& pool, Stack& s ) - : CppUnitMini::TestThread( pool ) - , m_Stack( s ) - {} - Consumer( Consumer& src ) - : CppUnitMini::TestThread( src ) - , m_Stack( src.m_Stack ) - {} - - IntrusiveStack_PushPop& getTest() - { - return static_cast( m_Pool.m_Test ); - } - - virtual void init() - { - cds::threading::Manager::attachThread(); - } - virtual void fini() - { - cds::threading::Manager::detachThread(); - } - - virtual void test() - { - m_nPopEmpty = 0; - m_nPopCount = 0; - m_nDirtyPop = 0; - memset( m_arrPop, 0, sizeof(m_arrPop)); - - while ( !(getTest().m_nWorkingProducers.load(atomics::memory_order_acquire) == 0 && m_Stack.empty()) ) { - typename Stack::value_type * p = m_Stack.pop(); - if ( p ) { - p->nConsumer = m_nThreadNo; - ++m_nPopCount; - size_t no = p->nNo.load( atomics::memory_order_acquire ); - if ( no < sizeof(m_arrPop)/sizeof(m_arrPop[0]) ) - ++m_arrPop[no]; - else - ++m_nDirtyPop; - } - else - ++m_nPopEmpty; - } - } - }; - - template - class value_array - { - T * m_pArr; - public: - value_array( size_t nSize ) - : m_pArr( new T[nSize] ) - {} - - ~value_array() - { - delete [] m_pArr; - } - - T * get() const { return m_pArr; } - }; - - protected: - void setUpParams( const CppUnitMini::TestCfg& cfg ) { - s_nPushThreadCount = cfg.getULong("PushThreadCount", 4 ); - s_nPopThreadCount = cfg.getULong("PopThreadCount", 4 ); - s_nStackSize = cfg.getULong("StackSize", 1000000 ); - s_nEliminationSize = cfg.getULong("EliminationSize", 4 ); - s_bFCIterative = cfg.getBool( "FCIterate", false ); - s_nFCCombinePassCount = cfg.getUInt( "FCCombinePassCount", 64 ); - s_nFCCompactFactor = cfg.getUInt( "FCCompactFactor", 1024 ); - } - - template - void analyze( CppUnitMini::ThreadPool& pool, Stack& /*testStack*/ ) - { - size_t nPushError = 0; - size_t nPopEmpty = 0; - size_t nPopCount = 0; - size_t arrVal[c_nValArraySize]; - memset( arrVal, 0, sizeof(arrVal)); - size_t nDirtyPop = 0; - - for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) { - CppUnitMini::TestThread * pThread = *it; - Producer * pPusher = dynamic_cast< Producer *>( pThread ); - if ( pPusher ) { - nPushError += pPusher->m_nPushError; - for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i ) - arrVal[i] += pPusher->m_arrPush[i]; - } - else { - Consumer * pPopper = dynamic_cast *>( pThread ); - assert( pPopper ); - nPopEmpty += pPopper->m_nPopEmpty; - nPopCount += pPopper->m_nPopCount; - nDirtyPop += pPopper->m_nDirtyPop; - for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i ) - arrVal[i] -= pPopper->m_arrPop[i]; - } - } - - CPPUNIT_MSG( "Push count=" << s_nStackSize - << " push error=" << nPushError - << " pop count=" << nPopCount - << " pop empty=" << nPopEmpty - << " dirty pop=" << nDirtyPop - ); - CPPUNIT_CHECK( nPopCount == s_nStackSize ); - CPPUNIT_CHECK( nDirtyPop == 0 ); - for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i ) { - CPPUNIT_CHECK_EX( arrVal[i] == 0, "arrVal[" << i << "]=" << long(arrVal[i]) ); - } - } - - template - void test( Stack& testStack, value_array& arrValue ) - { - m_nWorkingProducers.store( s_nPushThreadCount, atomics::memory_order_release ); - size_t const nPushCount = s_nStackSize / s_nPushThreadCount; - - typename Stack::value_type * pValStart = arrValue.get(); - typename Stack::value_type * pValEnd = pValStart + s_nStackSize; - - CppUnitMini::ThreadPool pool( *this ); - pool.add( new Producer( pool, testStack ), s_nPushThreadCount ); - { - for ( typename Stack::value_type * it = pValStart; it != pValEnd; ++it ) - it->nConsumer = c_nBadConsumer; - - typename Stack::value_type * pStart = pValStart; - for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) { - static_cast* >( *it )->m_pStart = pStart; - pStart += nPushCount; - static_cast* >( *it )->m_pEnd = pStart; - } - } - pool.add( new Consumer( pool, testStack ), s_nPopThreadCount ); - - CPPUNIT_MSG( " Push/Pop test, push thread count=" << s_nPushThreadCount - << " pop thread count=" << s_nPopThreadCount - << " items=" << (nPushCount * s_nPushThreadCount) - << "..."); - pool.run(); - CPPUNIT_MSG( " Duration=" << pool.avgDuration() ); - - s_nStackSize = nPushCount * s_nPushThreadCount; - - { - typename Stack::value_type * pEnd = pValStart + s_nStackSize; - for ( typename Stack::value_type * it = pValStart; it != pEnd; ++it ) - CPPUNIT_CHECK( it->nConsumer != c_nBadConsumer ); - } - - analyze( pool, testStack ); - CPPUNIT_MSG( testStack.statistics() ); - } - - public: - // Unbounded stack test - template - void test_unbounded() - { - value_array arrValue( s_nStackSize ); - { - Stack testStack; - test( testStack, arrValue ); - } - Stack::gc::force_dispose(); - } - - template - void test_fcstack() - { - if ( s_bFCIterative ) { - for (unsigned int nCompactFactor = 1; nCompactFactor <= s_nFCCompactFactor; nCompactFactor *= 2 ) { - for ( unsigned int nPass = 1; nPass <= s_nFCCombinePassCount; nPass *= 2 ) { - CPPUNIT_MSG( "Compact factor=" << nCompactFactor << ", combine pass count=" << nPass ); - value_array arrValue( s_nStackSize ); - Stack testStack( nCompactFactor, nPass ); - test( testStack, arrValue ); - } - } - } - else { - if ( s_nFCCompactFactor && s_nFCCombinePassCount ) { - CPPUNIT_MSG( "Compact factor=" << s_nFCCompactFactor << ", combine pass count=" << s_nFCCombinePassCount ); - value_array arrValue( s_nStackSize ); - Stack testStack( s_nFCCompactFactor, s_nFCCombinePassCount ); - test( testStack, arrValue ); - } - else { - value_array arrValue( s_nStackSize ); - Stack testStack; - test( testStack, arrValue ); - } - } - } - - // Unbounded elimination stack test - template - void test_elimination() - { - value_array arrValue( s_nStackSize ); - { - Stack testStack( s_nEliminationSize ); - test( testStack, arrValue ); - check_elimination_stat( testStack.statistics() ); - } - Stack::gc::force_dispose(); - } - void check_elimination_stat( cds::intrusive::treiber_stack::empty_stat const& ) - {} - void check_elimination_stat( cds::intrusive::treiber_stack::stat<> const& s ) - { - CPPUNIT_CHECK( s.m_PushCount.get() + s.m_ActivePushCollision.get() + s.m_PassivePushCollision.get() == s_nStackSize ); - CPPUNIT_CHECK( s.m_PopCount.get() + s.m_ActivePopCollision.get() + s.m_PassivePopCollision.get() == s_nStackSize ); - CPPUNIT_CHECK( s.m_PushCount.get() == s.m_PopCount.get() ); - CPPUNIT_CHECK( s.m_ActivePopCollision.get() == s.m_PassivePushCollision.get() ); - CPPUNIT_CHECK( s.m_ActivePushCollision.get() == s.m_PassivePopCollision.get() ); - } - - // Bounded stack test - template - void test_bounded() - { - value_array arrValue( s_nStackSize ); - Stack testStack( s_nStackSize ); - test( testStack, arrValue ); - } - - template - void test_stdstack() - { - value_array arrValue( s_nStackSize ); - Stack testStack; - test( testStack, arrValue ); - } - - protected: -# include "stack/intrusive_stack_defs.h" - CDSUNIT_DECLARE_TreiberStack - CDSUNIT_DECLARE_EliminationStack - CDSUNIT_DECLARE_FCStack - CDSUNIT_DECLARE_StdStack - - CPPUNIT_TEST_SUITE(IntrusiveStack_PushPop) - CDSUNIT_TEST_TreiberStack - CDSUNIT_TEST_EliminationStack - CDSUNIT_TEST_FCStack - CDSUNIT_TEST_StdStack - CPPUNIT_TEST_SUITE_END(); - }; -} // namespace istack - -CPPUNIT_TEST_SUITE_REGISTRATION(istack::IntrusiveStack_PushPop); diff --git a/tests/unit/stack/stack_push.cpp b/tests/unit/stack/stack_push.cpp deleted file mode 100644 index 9da71ef0..00000000 --- a/tests/unit/stack/stack_push.cpp +++ /dev/null @@ -1,238 +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/thread.h" -#include "stack/stack_type.h" - -// Multi-threaded stack test for push operation -namespace stack { - -#define TEST_CASE( Q ) void Q() { test_unbounded< Types::Q >(); } -#define TEST_ELIMINATION( Q ) void Q() { test_elimination< Types::Q >(); } -#define TEST_BOUNDED( Q ) void Q() { test_bounded< Types::Q >(); } - - namespace { - static size_t s_nThreadCount = 8; - static size_t s_nStackSize = 10000000; - static size_t s_nEliminationSize = 4; - - struct SimpleValue { - size_t nNo; - size_t nThread; - - SimpleValue(): nNo(0), nThread(0) {} - SimpleValue( size_t n ): nNo(n), nThread(0) {} - size_t getNo() const { return nNo; } - }; - } - - class Stack_Push: public CppUnitMini::TestCase - { - template - class Thread: public CppUnitMini::TestThread - { - virtual TestThread * clone() - { - return new Thread( *this ); - } - public: - Stack& m_Stack; - double m_fTime; - size_t m_nStartItem; - size_t m_nEndItem; - size_t m_nPushError; - - public: - Thread( CppUnitMini::ThreadPool& pool, Stack& s ) - : CppUnitMini::TestThread( pool ) - , m_Stack( s ) - {} - Thread( Thread& src ) - : CppUnitMini::TestThread( src ) - , m_Stack( src.m_Stack ) - {} - - Stack_Push& getTest() - { - return reinterpret_cast( m_Pool.m_Test ); - } - - virtual void init() - { - cds::threading::Manager::attachThread(); - } - virtual void fini() - { - cds::threading::Manager::detachThread(); - } - - virtual void test() - { - m_fTime = m_Timer.duration(); - - m_nPushError = 0; - SimpleValue v; - v.nThread = m_nThreadNo; - for ( v.nNo = m_nStartItem; v.nNo < m_nEndItem; ++v.nNo ) { - if ( !m_Stack.push( v )) - ++m_nPushError; - } - - m_fTime = m_Timer.duration() - m_fTime; - } - }; - - protected: - void setUpParams( const CppUnitMini::TestCfg& cfg ) { - s_nThreadCount = cfg.getULong("ThreadCount", 8 ); - s_nStackSize = cfg.getULong("StackSize", 10000000 ); - s_nEliminationSize = cfg.getULong("EliminationSize", 4 ); - } - - template - void analyze( CppUnitMini::ThreadPool& pool, Stack& testStack ) - { - size_t nThreadItems = s_nStackSize / s_nThreadCount; - std::vector aThread; - aThread.resize(s_nThreadCount); - - double fTime = 0; - for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) { - Thread * pThread = reinterpret_cast *>(*it); - fTime += pThread->m_fTime; - if ( pThread->m_nPushError != 0 ) - CPPUNIT_MSG(" ERROR: thread push error count=" << pThread->m_nPushError ); - aThread[ pThread->m_nThreadNo] = pThread->m_nEndItem - 1; - } - CPPUNIT_MSG( " Duration=" << (fTime / s_nThreadCount) ); - CPPUNIT_ASSERT( !testStack.empty() ) - - size_t * arr = new size_t[ s_nStackSize ]; - memset(arr, 0, sizeof(arr[0]) * s_nStackSize ); - - cds::OS::Timer timer; - CPPUNIT_MSG( " Pop (single-threaded)..." ); - size_t nPopped = 0; - SimpleValue val; - while ( testStack.pop( val )) { - nPopped++; - ++arr[ val.getNo() ]; - CPPUNIT_ASSERT( val.nThread < s_nThreadCount); - CPPUNIT_ASSERT( aThread[val.nThread] == val.nNo ); - aThread[val.nThread]--; - } - CPPUNIT_MSG( " Duration=" << timer.duration() ); - - size_t nTotalItems = nThreadItems * s_nThreadCount; - size_t nError = 0; - for ( size_t i = 0; i < nTotalItems; ++i ) { - if ( arr[i] != 1 ) { - CPPUNIT_MSG( " ERROR: Item " << i << " has not been pushed" ); - CPPUNIT_ASSERT( ++nError > 10 ); - } - } - - delete [] arr; - } - - // Unbounded stack test - template - void test_unbounded() - { - Stack testStack; - test( testStack ); - } - - // Unbounded elimination stack test - template - void test_elimination() - { - Stack testStack( s_nEliminationSize ); - test( testStack ); - check_elimination_stat( testStack.statistics() ); - } - void check_elimination_stat( cds::container::treiber_stack::empty_stat const& ) - {} - void check_elimination_stat( cds::container::treiber_stack::stat<> const& s ) - { - CPPUNIT_CHECK( s.m_PushCount.get() == s.m_PopCount.get() ); - } - - // Bounded stack test - template - void test_bounded() - { - Stack testStack( s_nStackSize ); - test( testStack ); - } - - template - void test( Stack& testStack ) - { - CppUnitMini::ThreadPool pool( *this ); - pool.add( new Thread( pool, testStack ), s_nThreadCount ); - - size_t nStart = 0; - size_t nThreadItemCount = s_nStackSize / s_nThreadCount; - for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) { - Thread * pThread = reinterpret_cast *>(*it); - pThread->m_nStartItem = nStart; - nStart += nThreadItemCount; - pThread->m_nEndItem = nStart; - } - - CPPUNIT_MSG( " Push test, thread count=" << s_nThreadCount - << " items=" << (nThreadItemCount * s_nThreadCount) - << "..."); - pool.run(); - - analyze( pool, testStack ); - CPPUNIT_MSG( testStack.statistics() ); - } - - protected: -# include "stack/stack_defs.h" - CDSUNIT_DECLARE_TreiberStack - CDSUNIT_DECLARE_EliminationStack - CDSUNIT_DECLARE_FCStack - CDSUNIT_DECLARE_FCDeque - CDSUNIT_DECLARE_StdStack - - CPPUNIT_TEST_SUITE(Stack_Push) - CDSUNIT_TEST_TreiberStack - CDSUNIT_TEST_EliminationStack - CDSUNIT_TEST_FCStack - CDSUNIT_TEST_FCDeque - CDSUNIT_TEST_StdStack - CPPUNIT_TEST_SUITE_END(); - }; -} // namespace stack - -CPPUNIT_TEST_SUITE_REGISTRATION(stack::Stack_Push); diff --git a/tests/unit/stack/stack_pushpop.cpp b/tests/unit/stack/stack_pushpop.cpp deleted file mode 100644 index 6cb0ab9f..00000000 --- a/tests/unit/stack/stack_pushpop.cpp +++ /dev/null @@ -1,305 +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/thread.h" -#include "stack/stack_type.h" - -// Multi-threaded stack test for push/pop operation -namespace stack { - -#define TEST_CASE( Q ) void Q() { test_unbounded< Types::Q >(); } -#define TEST_ELIMINATION( Q ) void Q() { test_elimination< Types::Q >(); } -#define TEST_BOUNDED( Q ) void Q() { test_bounded< Types::Q >(); } - - namespace { - static size_t s_nPushThreadCount = 4; - static size_t s_nPopThreadCount = 4; - static size_t s_nStackSize = 1000000; - static size_t s_nEliminationSize = 4; - - struct SimpleValue { - size_t nNo; - size_t nThread; - - SimpleValue(): nNo(0), nThread(0) {} - SimpleValue( size_t n ): nNo(n), nThread(0) {} - size_t getNo() const { return nNo; } - }; - } - - class Stack_PushPop: public CppUnitMini::TestCase - { - atomics::atomic m_nWorkingProducers; - static size_t const c_nValArraySize = 1024; - - template - class Pusher: public CppUnitMini::TestThread - { - virtual TestThread * clone() - { - return new Pusher( *this ); - } - public: - Stack& m_Stack; - size_t m_nItemCount; - size_t m_nPushError; - size_t m_arrPush[c_nValArraySize]; - - public: - Pusher( CppUnitMini::ThreadPool& pool, Stack& s ) - : CppUnitMini::TestThread( pool ) - , m_Stack( s ) - {} - Pusher( Pusher& src ) - : CppUnitMini::TestThread( src ) - , m_Stack( src.m_Stack ) - {} - - Stack_PushPop& getTest() - { - return reinterpret_cast( m_Pool.m_Test ); - } - - virtual void init() - { - cds::threading::Manager::attachThread(); - } - virtual void fini() - { - cds::threading::Manager::detachThread(); - } - - virtual void test() - { - m_nPushError = 0; - memset( m_arrPush, 0, sizeof(m_arrPush)); - - SimpleValue v; - v.nThread = m_nThreadNo; - for ( size_t i = 0; i < m_nItemCount; ++i ) { - v.nNo = i % c_nValArraySize; - if ( m_Stack.push( v )) - ++m_arrPush[v.nNo]; - else - ++m_nPushError; - } - - - getTest().m_nWorkingProducers.fetch_sub(1, atomics::memory_order_release); - } - }; - - template - class Popper: public CppUnitMini::TestThread - { - virtual TestThread * clone() - { - return new Popper( *this ); - } - public: - Stack& m_Stack; - size_t m_nPopCount; - size_t m_nPopEmpty; - size_t m_arrPop[c_nValArraySize]; - size_t m_nDirtyPop; - public: - Popper( CppUnitMini::ThreadPool& pool, Stack& s ) - : CppUnitMini::TestThread( pool ) - , m_Stack( s ) - {} - Popper( Popper& src ) - : CppUnitMini::TestThread( src ) - , m_Stack( src.m_Stack ) - {} - - Stack_PushPop& getTest() - { - return reinterpret_cast( m_Pool.m_Test ); - } - - virtual void init() - { - cds::threading::Manager::attachThread(); - } - virtual void fini() - { - cds::threading::Manager::detachThread(); - } - - virtual void test() - { - m_nPopEmpty = 0; - m_nPopCount = 0; - m_nDirtyPop = 0; - memset( m_arrPop, 0, sizeof(m_arrPop)); - - SimpleValue v; - while ( !(getTest().m_nWorkingProducers.load(atomics::memory_order_acquire) == 0 && m_Stack.empty()) ) { - if ( m_Stack.pop( v )) { - ++m_nPopCount; - if ( v.nNo < sizeof(m_arrPop)/sizeof(m_arrPop[0]) ) - ++m_arrPop[v.nNo]; - else - ++m_nDirtyPop; - } - else - ++m_nPopEmpty; - } - } - }; - - protected: - void setUpParams( const CppUnitMini::TestCfg& cfg ) { - s_nPushThreadCount = cfg.getULong("PushThreadCount", 4 ); - s_nPopThreadCount = cfg.getULong("PopThreadCount", 4 ); - s_nStackSize = cfg.getULong("StackSize", 1000000 ); - s_nEliminationSize = cfg.getULong("EliminationSize", 4 ); - } - - template - void analyze( CppUnitMini::ThreadPool& pool, Stack& /*testStack*/ ) - { - size_t nPushError = 0; - size_t nPopEmpty = 0; - size_t nPopCount = 0; - size_t arrVal[c_nValArraySize]; - memset( arrVal, 0, sizeof(arrVal)); - size_t nDirtyPop = 0; - - for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) { - CppUnitMini::TestThread * pThread = *it; - Pusher * pPusher = dynamic_cast< Pusher *>( pThread ); - if ( pPusher ) { - nPushError += pPusher->m_nPushError; - for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i ) - arrVal[i] += pPusher->m_arrPush[i]; - } - else { - Popper * pPopper = dynamic_cast *>( pThread ); - assert( pPopper ); - nPopEmpty += pPopper->m_nPopEmpty; - nPopCount += pPopper->m_nPopCount; - nDirtyPop += pPopper->m_nDirtyPop; - for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i ) - arrVal[i] -= pPopper->m_arrPop[i]; - } - } - - CPPUNIT_MSG( "Push count=" << s_nStackSize - << " push error=" << nPushError - << " pop count=" << nPopCount - << " pop empty=" << nPopEmpty - << " dirty pop=" << nDirtyPop - ); - CPPUNIT_CHECK( nPopCount == s_nStackSize ); - CPPUNIT_CHECK( nDirtyPop == 0 ); - for ( size_t i = 0; i < sizeof(arrVal)/sizeof(arrVal[0]); ++i ) { - CPPUNIT_CHECK_EX( arrVal[i] == 0, "arrVal[" << i << "]=" << long(arrVal[i]) ); - } - } - - // Unbounded stack test - template - void test_unbounded() - { - Stack testStack; - test( testStack ); - } - - // Unbounded elimination stack test - template - void test_elimination() - { - Stack testStack( s_nEliminationSize ); - test( testStack ); - check_elimination_stat( testStack.statistics() ); - } - void check_elimination_stat( cds::container::treiber_stack::empty_stat const& ) - {} - void check_elimination_stat( cds::container::treiber_stack::stat<> const& s ) - { - CPPUNIT_CHECK( s.m_PushCount.get() + s.m_ActivePushCollision.get() + s.m_PassivePushCollision.get() == s_nStackSize ); - CPPUNIT_CHECK( s.m_PopCount.get() + s.m_ActivePopCollision.get() + s.m_PassivePopCollision.get() == s_nStackSize ); - CPPUNIT_CHECK( s.m_PushCount.get() == s.m_PopCount.get() ); - CPPUNIT_CHECK( s.m_ActivePopCollision.get() == s.m_PassivePushCollision.get() ); - CPPUNIT_CHECK( s.m_ActivePushCollision.get() == s.m_PassivePopCollision.get() ); - } - - // Bounded stack test - template - void test_bounded() - { - Stack testStack( s_nStackSize ); - test( testStack ); - } - - template - void test( Stack& testStack ) - { - m_nWorkingProducers.store(s_nPushThreadCount, atomics::memory_order_release); - size_t const nPushCount = s_nStackSize / s_nPushThreadCount; - - CppUnitMini::ThreadPool pool( *this ); - pool.add( new Pusher( pool, testStack ), s_nPushThreadCount ); - for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) - static_cast* >( *it )->m_nItemCount = nPushCount; - pool.add( new Popper( pool, testStack ), s_nPopThreadCount ); - - CPPUNIT_MSG( " Push/Pop test, push thread count=" << s_nPushThreadCount - << " pop thread count=" << s_nPopThreadCount - << " items=" << (nPushCount * s_nPushThreadCount) - << "..."); - pool.run(); - CPPUNIT_MSG( " Duration=" << pool.avgDuration() ); - - s_nStackSize = nPushCount * s_nPushThreadCount; - analyze( pool, testStack ); - CPPUNIT_MSG( testStack.statistics() ); - } - - protected: -# include "stack/stack_defs.h" - CDSUNIT_DECLARE_TreiberStack - CDSUNIT_DECLARE_EliminationStack - CDSUNIT_DECLARE_FCStack - CDSUNIT_DECLARE_FCDeque - CDSUNIT_DECLARE_StdStack - - CPPUNIT_TEST_SUITE(Stack_PushPop) - CDSUNIT_TEST_TreiberStack - CDSUNIT_TEST_EliminationStack - CDSUNIT_TEST_FCStack - CDSUNIT_TEST_FCDeque - CDSUNIT_TEST_StdStack - CPPUNIT_TEST_SUITE_END(); - }; -} // namespace stack - -CPPUNIT_TEST_SUITE_REGISTRATION(stack::Stack_PushPop); diff --git a/tests/unit/stack/stack_type.h b/tests/unit/stack/stack_type.h deleted file mode 100644 index a9a78fad..00000000 --- a/tests/unit/stack/stack_type.h +++ /dev/null @@ -1,501 +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 CDSUNIT_STACK_TYPES_H -#define CDSUNIT_STACK_TYPES_H - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -namespace stack { - - namespace details { - - template - class FCDequeL: public cds::container::FCDeque, Traits > - { - typedef cds::container::FCDeque, Traits > base_class; - public: - FCDequeL() - {} - - FCDequeL( - unsigned int nCompactFactor ///< Flat combining: publication list compacting factor - ,unsigned int nCombinePassCount ///< Flat combining: number of combining passes for combiner thread - ) - : base_class( nCompactFactor, nCombinePassCount ) - {} - - bool push( T const& v ) - { - return base_class::push_front( v ); - } - - bool pop( T& v ) - { - return base_class::pop_front( v ); - } - }; - - template - class FCDequeR: public cds::container::FCDeque, Traits > - { - typedef cds::container::FCDeque, Traits > base_class; - public: - FCDequeR() - {} - - FCDequeR( - unsigned int nCompactFactor ///< Flat combining: publication list compacting factor - ,unsigned int nCombinePassCount ///< Flat combining: number of combining passes for combiner thread - ) - : base_class( nCompactFactor, nCombinePassCount ) - {} - - bool push( T const& v ) - { - return base_class::push_back( v ); - } - - bool pop( T& v ) - { - return base_class::pop_back( v ); - } - }; - - template < typename T, typename Stack, typename Lock> - class StdStack - { - Stack m_Impl; - mutable Lock m_Lock; - cds::container::treiber_stack::empty_stat m_stat; - - typedef std::unique_lock unique_lock; - - public: - bool push( T const& v ) - { - unique_lock l( m_Lock ); - m_Impl.push( v ); - return true; - } - - bool pop( T& v ) - { - unique_lock l( m_Lock ); - if ( !m_Impl.empty() ) { - v = m_Impl.top(); - m_Impl.pop(); - return true; - } - return false; - } - - bool empty() const - { - unique_lock l( m_Lock ); - return m_Impl.empty(); - } - - cds::container::treiber_stack::empty_stat const& statistics() const - { - return m_stat; - } - }; - } - - template - struct Types { - - // TreiberStack - typedef cds::container::TreiberStack< cds::gc::HP, T > Treiber_HP; - typedef cds::container::TreiberStack< cds::gc::DHP, T > Treiber_DHP; - - struct traits_Treiber_seqcst: public - cds::container::treiber_stack::make_traits< - cds::opt::memory_model - >::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_seqcst > Treiber_HP_seqcst; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_seqcst > Treiber_DHP_seqcst; - - struct traits_Treiber_stat: public - cds::container::treiber_stack::make_traits< - cds::opt::stat > - >::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_stat > Treiber_HP_stat; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_stat > Treiber_DHP_stat; - - struct traits_Treiber_yield: public - cds::container::treiber_stack::make_traits< - cds::opt::back_off - , cds::opt::memory_model - >::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_yield > Treiber_HP_yield; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_yield > Treiber_DHP_yield; - - struct traits_Treiber_pause: public - cds::container::treiber_stack::make_traits< - cds::opt::back_off - >::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_pause > Treiber_HP_pause; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_pause > Treiber_DHP_pause; - - struct traits_Treiber_exp: public - cds::container::treiber_stack::make_traits< - cds::opt::back_off< - cds::backoff::exponential< - cds::backoff::pause, - cds::backoff::yield - > - > - >::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_exp > Treiber_HP_exp; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_exp > Treiber_DHP_exp; - - - // Elimination stack - struct traits_Elimination_on : public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_on > Elimination_HP; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_on > Elimination_DHP; - - struct traits_Elimination_stat : public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - ,cds::opt::stat > - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_stat > Elimination_HP_stat; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_stat > Elimination_DHP_stat; - - struct traits_Elimination_2ms: public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - ,cds::opt::elimination_backoff< cds::backoff::delay_of<2> > - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_2ms > Elimination_HP_2ms; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_2ms > Elimination_DHP_2ms; - - struct traits_Elimination_2ms_stat : public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<2> > - , cds::opt::stat > - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_2ms_stat > Elimination_HP_2ms_stat; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_2ms_stat > Elimination_DHP_2ms_stat; - - struct traits_Elimination_5ms : public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<5> > - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_5ms > Elimination_HP_5ms; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_5ms > Elimination_DHP_5ms; - - struct traits_Elimination_5ms_stat : public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<5> > - , cds::opt::stat > - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_5ms_stat > Elimination_HP_5ms_stat; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_5ms_stat > Elimination_DHP_5ms_stat; - - struct traits_Elimination_10ms : public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<10> > - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_10ms > Elimination_HP_10ms; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_10ms > Elimination_DHP_10ms; - - struct traits_Elimination_10ms_stat : public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - , cds::opt::elimination_backoff< cds::backoff::delay_of<10> > - , cds::opt::stat > - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_10ms_stat > Elimination_HP_10ms_stat; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_10ms_stat > Elimination_DHP_10ms_stat; - - struct traits_Elimination_dyn: public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - , cds::opt::buffer< cds::opt::v::dynamic_buffer > - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_dyn > Elimination_HP_dyn; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_dyn > Elimination_DHP_dyn; - - struct traits_Elimination_seqcst: public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - , cds::opt::memory_model - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_seqcst > Elimination_HP_seqcst; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_seqcst > Elimination_DHP_seqcst; - - struct traits_Elimination_dyn_stat: public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - , cds::opt::stat > - , cds::opt::buffer< cds::opt::v::dynamic_buffer > - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_dyn_stat > Elimination_HP_dyn_stat; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_dyn_stat > Elimination_DHP_dyn_stat; - - struct traits_Elimination_yield: public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - , cds::opt::back_off - , cds::opt::memory_model - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_yield > Elimination_HP_yield; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_yield > Elimination_DHP_yield; - - struct traits_Elimination_pause: public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - , cds::opt::back_off - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_pause > Elimination_HP_pause; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_pause > Elimination_DHP_pause; - - struct traits_Elimination_exp: public - cds::container::treiber_stack::make_traits < - cds::opt::enable_elimination - ,cds::opt::back_off< - cds::backoff::exponential< - cds::backoff::pause, - cds::backoff::yield - > - > - > ::type - {}; - typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Elimination_exp > Elimination_HP_exp; - typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_exp > Elimination_DHP_exp; - - - // FCStack - typedef cds::container::FCStack< T > FCStack_deque; - - struct traits_FCStack_stat: - public cds::container::fcstack::make_traits< - cds::opt::stat< cds::container::fcstack::stat<> > - >::type - {}; - struct traits_FCStack_elimination: - public cds::container::fcstack::make_traits< - cds::opt::enable_elimination< true > - >::type - {}; - struct traits_FCStack_elimination_stat: - public cds::container::fcstack::make_traits< - cds::opt::stat< cds::container::fcstack::stat<> >, - cds::opt::enable_elimination< true > - >::type - {}; - struct traits_FCStack_mutex: - public cds::container::fcstack::make_traits< - cds::opt::lock_type< std::mutex > - >::type - {}; - - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_mutex > FCStack_deque_mutex; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_stat > FCStack_deque_stat; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_elimination > FCStack_deque_elimination; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_elimination_stat > FCStack_deque_elimination_stat; - typedef cds::container::FCStack< T, std::stack > > FCStack_vector; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_mutex > FCStack_vector_mutex; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_stat > FCStack_vector_stat; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_elimination > FCStack_vector_elimination; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_elimination_stat > FCStack_vector_elimination_stat; - typedef cds::container::FCStack< T, std::stack > > FCStack_list; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_mutex > FCStack_list_mutex; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_stat > FCStack_list_stat; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_elimination > FCStack_list_elimination; - typedef cds::container::FCStack< T, std::stack >, traits_FCStack_elimination_stat > FCStack_list_elimination_stat; - - // FCDeque - struct traits_FCDeque_stat: - public cds::container::fcdeque::make_traits< - cds::opt::stat< cds::container::fcdeque::stat<> > - >::type - {}; - struct traits_FCDeque_elimination: - public cds::container::fcdeque::make_traits< - cds::opt::enable_elimination< true > - >::type - {}; - struct traits_FCDeque_elimination_stat: - public cds::container::fcdeque::make_traits< - cds::opt::stat< cds::container::fcdeque::stat<> >, - cds::opt::enable_elimination< true > - >::type - {}; - struct traits_FCDeque_mutex: - public cds::container::fcdeque::make_traits< - cds::opt::lock_type< std::mutex > - >::type - {}; - - - typedef details::FCDequeL< T > FCDequeL_default; - typedef details::FCDequeL< T, traits_FCDeque_mutex > FCDequeL_mutex; - typedef details::FCDequeL< T, traits_FCDeque_stat > FCDequeL_stat; - typedef details::FCDequeL< T, traits_FCDeque_elimination > FCDequeL_elimination; - typedef details::FCDequeL< T, traits_FCDeque_elimination_stat > FCDequeL_elimination_stat; - - typedef details::FCDequeR< T > FCDequeR_default; - typedef details::FCDequeR< T, traits_FCDeque_mutex > FCDequeR_mutex; - typedef details::FCDequeR< T, traits_FCDeque_stat > FCDequeR_stat; - typedef details::FCDequeR< T, traits_FCDeque_elimination > FCDequeR_elimination; - typedef details::FCDequeR< T, traits_FCDeque_elimination_stat > FCDequeR_elimination_stat; - - - // std::stack - typedef details::StdStack< T, std::stack< T >, std::mutex > StdStack_Deque_Mutex; - typedef details::StdStack< T, std::stack< T >, cds::sync::spin > StdStack_Deque_Spin; - typedef details::StdStack< T, std::stack< T, std::vector >, std::mutex > StdStack_Vector_Mutex; - typedef details::StdStack< T, std::stack< T, std::vector >, cds::sync::spin > StdStack_Vector_Spin; - typedef details::StdStack< T, std::stack< T, std::list >, std::mutex > StdStack_List_Mutex; - typedef details::StdStack< T, std::stack< T, std::list >, cds::sync::spin > StdStack_List_Spin; - - }; -} // namespace stack - -namespace std { - static inline ostream& operator <<( ostream& o, cds::container::treiber_stack::stat<> const& s ) - { - return o << "\tStatistics:\n" - << "\t Push: " << s.m_PushCount.get() << "\n" - << "\t Pop: " << s.m_PopCount.get() << "\n" - << "\t Push contention: " << s.m_PushRace.get() << "\n" - << "\t Pop contention: " << s.m_PopRace.get() << "\n" - << "\t m_ActivePushCollision: " << s.m_ActivePushCollision.get() << "\n" - << "\t m_PassivePopCollision: " << s.m_PassivePopCollision.get() << "\n" - << "\t m_ActivePopCollision: " << s.m_ActivePopCollision.get() << "\n" - << "\t m_PassivePushCollision: " << s.m_PassivePushCollision.get() << "\n" - << "\t m_EliminationFailed: " << s.m_EliminationFailed.get() << "\n"; - } - - static inline ostream& operator <<(ostream& o, cds::container::treiber_stack::empty_stat const& /*s*/) - { - return o; - } - - static inline ostream& operator <<( ostream& o, cds::container::fcstack::empty_stat const& /*s*/ ) - { - return o; - } - - static inline ostream& operator <<( ostream& o, cds::container::fcstack::stat<> const& s ) - { - return o << "\tStatistics:\n" - << "\t Push: " << s.m_nPush.get() << "\n" - << "\t PushMove: " << s.m_nPushMove.get() << "\n" - << "\t Pop: " << s.m_nPop.get() << "\n" - << "\t FailedPop: " << s.m_nFailedPop.get() << "\n" - << "\t Collided push/pop pair: " << s.m_nCollided.get() << "\n" - << "\tFlat combining statistics:\n" - << "\t Combining factor: " << s.combining_factor() << "\n" - << "\t Operation count: " << s.m_nOperationCount.get() << "\n" - << "\t Combine call count: " << s.m_nCombiningCount.get() << "\n" - << "\t Compact pub-list: " << s.m_nCompactPublicationList.get() << "\n" - << "\t Deactivate pub-record: " << s.m_nDeactivatePubRecord.get() << "\n" - << "\t Activate pub-record: " << s.m_nActivatePubRecord.get() << "\n" - << "\t Create pub-record: " << s.m_nPubRecordCreated.get() << "\n" - << "\t Delete pub-record: " << s.m_nPubRecordDeteted.get() << "\n" - << "\t Acquire pub-record: " << s.m_nAcquirePubRecCount.get()<< "\n" - << "\t Release pub-record: " << s.m_nReleasePubRecCount.get()<< "\n"; - } - - static inline ostream& operator <<( ostream& o, cds::container::fcdeque::empty_stat const& /*s*/ ) - { - return o; - } - - static inline ostream& operator <<( ostream& o, cds::container::fcdeque::stat<> const& s ) - { - return o << "\tStatistics:\n" - << "\t Push front: " << s.m_nPushFront.get() << "\n" - << "\t Push front move: " << s.m_nPushFrontMove.get() << "\n" - << "\t Push back: " << s.m_nPushBack.get() << "\n" - << "\t Push back move: " << s.m_nPushBackMove.get() << "\n" - << "\t Pop front: " << s.m_nPopFront.get() << "\n" - << "\t Failed pop front: " << s.m_nFailedPopFront.get() << "\n" - << "\t Pop back: " << s.m_nPopBack.get() << "\n" - << "\t Failed pop back: " << s.m_nFailedPopBack.get() << "\n" - << "\t Collided push/pop pair: " << s.m_nCollided.get() << "\n" - << "\tFlat combining statistics:\n" - << "\t Combining factor: " << s.combining_factor() << "\n" - << "\t Operation count: " << s.m_nOperationCount.get() << "\n" - << "\t Combine call count: " << s.m_nCombiningCount.get() << "\n" - << "\t Compact pub-list: " << s.m_nCompactPublicationList.get() << "\n" - << "\t Deactivate pub-record: " << s.m_nDeactivatePubRecord.get() << "\n" - << "\t Activate pub-record: " << s.m_nActivatePubRecord.get() << "\n" - << "\t Create pub-record: " << s.m_nPubRecordCreated.get() << "\n" - << "\t Delete pub-record: " << s.m_nPubRecordDeteted.get() << "\n" - << "\t Acquire pub-record: " << s.m_nAcquirePubRecCount.get()<< "\n" - << "\t Release pub-record: " << s.m_nReleasePubRecCount.get()<< "\n"; - } - -} // namespace std - -#endif // #ifndef CDSUNIT_STACK_TYPES_H -- 2.34.1