From afc79b07299f1445e826102d817e014b3783ae19 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 16 Jan 2016 18:53:26 +0300 Subject: [PATCH] Moved deque unit test to gtest framework --- projects/Win/vc14/cds.sln | 34 +- projects/Win/vc14/gtest-deque.vcxproj | 243 +++++++++++++ projects/Win/vc14/gtest-deque.vcxproj.filters | 25 ++ projects/Win/vc14/gtest-pqueue.vcxproj | 2 +- .../Win/vc14/gtest-pqueue.vcxproj.filters | 6 +- projects/Win/vc14/gtest-stack.vcxproj | 2 +- projects/Win/vc14/gtest-stack.vcxproj.filters | 6 +- projects/Win/vc14/hdr-test-deque.vcxproj | 342 ------------------ projects/source.test-hdr.mk | 4 - test/unit/CMakeLists.txt | 1 + test/unit/deque/CMakeLists.txt | 21 ++ test/unit/deque/fcdeque.cpp | 201 ++++++++++ test/unit/main.cpp | 44 +++ test/unit/pqueue/CMakeLists.txt | 2 +- test/unit/stack/CMakeLists.txt | 2 +- tests/test-hdr/CMakeLists.txt | 4 - tests/test-hdr/deque/hdr_fcdeque.cpp | 205 ----------- 17 files changed, 560 insertions(+), 584 deletions(-) create mode 100644 projects/Win/vc14/gtest-deque.vcxproj create mode 100644 projects/Win/vc14/gtest-deque.vcxproj.filters delete mode 100644 projects/Win/vc14/hdr-test-deque.vcxproj create mode 100644 test/unit/deque/CMakeLists.txt create mode 100644 test/unit/deque/fcdeque.cpp create mode 100644 test/unit/main.cpp delete mode 100644 tests/test-hdr/deque/hdr_fcdeque.cpp diff --git a/projects/Win/vc14/cds.sln b/projects/Win/vc14/cds.sln index 9404ae70..9674e163 100644 --- a/projects/Win/vc14/cds.sln +++ b/projects/Win/vc14/cds.sln @@ -46,12 +46,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "single-threaded test", "sin ..\..\..\tests\test-hdr\size_check.h = ..\..\..\tests\test-hdr\size_check.h EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hdr-test-deque", "hdr-test-deque.vcxproj", "{CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}" - ProjectSection(ProjectDependencies) = postProject - {61179F2F-07E1-490D-B64D-D85A90B6EF81} = {61179F2F-07E1-490D-B64D-D85A90B6EF81} - {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hdr-test-map", "hdr-test-map.vcxproj", "{282E9A9A-386A-40FB-A483-994BACE24830}" ProjectSection(ProjectDependencies) = postProject {61179F2F-07E1-490D-B64D-D85A90B6EF81} = {61179F2F-07E1-490D-B64D-D85A90B6EF81} @@ -200,6 +194,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cds_test", "cds_test", "{3A ..\..\..\test\include\cds_test\fixture.h = ..\..\..\test\include\cds_test\fixture.h EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-deque", "gtest-deque.vcxproj", "{20A9F084-D01F-47E5-B775-4F4B48504FCC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -270,18 +266,6 @@ Global {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 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.Debug|Win32.ActiveCfg = Debug|Win32 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.Debug|Win32.Build.0 = Debug|Win32 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.Debug|x64.ActiveCfg = Debug|x64 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.Debug|x64.Build.0 = Debug|x64 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.DebugVLD|Win32.ActiveCfg = DebugVLD|Win32 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.DebugVLD|Win32.Build.0 = DebugVLD|Win32 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.DebugVLD|x64.ActiveCfg = DebugVLD|x64 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.DebugVLD|x64.Build.0 = DebugVLD|x64 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.Release|Win32.ActiveCfg = Release|Win32 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.Release|Win32.Build.0 = Release|Win32 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.Release|x64.ActiveCfg = Release|x64 - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026}.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 @@ -498,6 +482,18 @@ Global {EAD522BF-E7DA-4A20-94FF-4D3EAF0A540A}.Release|Win32.Build.0 = Release|Win32 {EAD522BF-E7DA-4A20-94FF-4D3EAF0A540A}.Release|x64.ActiveCfg = Release|x64 {EAD522BF-E7DA-4A20-94FF-4D3EAF0A540A}.Release|x64.Build.0 = Release|x64 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.Debug|Win32.ActiveCfg = Debug|Win32 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.Debug|Win32.Build.0 = Debug|Win32 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.Debug|x64.ActiveCfg = Debug|x64 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.Debug|x64.Build.0 = Debug|x64 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.DebugVLD|Win32.ActiveCfg = DebugVLD|Win32 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.DebugVLD|Win32.Build.0 = DebugVLD|Win32 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.DebugVLD|x64.ActiveCfg = DebugVLD|x64 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.DebugVLD|x64.Build.0 = DebugVLD|x64 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.Release|Win32.ActiveCfg = Release|Win32 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.Release|Win32.Build.0 = Release|Win32 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.Release|x64.ActiveCfg = Release|x64 + {20A9F084-D01F-47E5-B775-4F4B48504FCC}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -507,7 +503,6 @@ Global {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} - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75} {282E9A9A-386A-40FB-A483-994BACE24830} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75} {C5E76975-B87B-4B9E-8596-B01DDA683FCA} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75} {EFCBBADE-2CF4-4E2B-ADB2-98C8D139E805} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75} @@ -528,6 +523,7 @@ Global {DE256E91-EE96-412E-82EE-DD7BD1A1130D} = {A64449B7-90FB-4E2B-A686-9EFC0E298644} {5407E9D2-67D9-4266-976E-7A90BDE2541D} = {810490B7-31E5-49AE-8455-CAF99A9658B6} {EAD522BF-E7DA-4A20-94FF-4D3EAF0A540A} = {810490B7-31E5-49AE-8455-CAF99A9658B6} + {20A9F084-D01F-47E5-B775-4F4B48504FCC} = {810490B7-31E5-49AE-8455-CAF99A9658B6} EndGlobalSection GlobalSection(DPCodeReviewSolutionGUID) = preSolution DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} diff --git a/projects/Win/vc14/gtest-deque.vcxproj b/projects/Win/vc14/gtest-deque.vcxproj new file mode 100644 index 00000000..2aaeadba --- /dev/null +++ b/projects/Win/vc14/gtest-deque.vcxproj @@ -0,0 +1,243 @@ + + + + + DebugVLD + Win32 + + + DebugVLD + x64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + {20A9F084-D01F-47E5-B775-4F4B48504FCC} + Win32Proj + stack + 8.1 + + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ + $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ + $(ProjectName)_d + + + true + $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ + $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ + $(ProjectName)_d + + + true + $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ + $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ + $(ProjectName)_d + + + true + $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ + $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ + $(ProjectName)_d + + + 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)\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) + + + Console + true + $(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtestd.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) + + + Console + true + $(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtestd.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) + + + Console + true + $(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtestd.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) + + + Console + true + $(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtestd.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) + + + Console + true + true + true + $(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtest.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) + + + Console + true + true + true + $(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtest.lib;%(AdditionalDependencies) + + + + + + \ No newline at end of file diff --git a/projects/Win/vc14/gtest-deque.vcxproj.filters b/projects/Win/vc14/gtest-deque.vcxproj.filters new file mode 100644 index 00000000..f8df4a76 --- /dev/null +++ b/projects/Win/vc14/gtest-deque.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/projects/Win/vc14/gtest-pqueue.vcxproj b/projects/Win/vc14/gtest-pqueue.vcxproj index 7aa5b944..1348a782 100644 --- a/projects/Win/vc14/gtest-pqueue.vcxproj +++ b/projects/Win/vc14/gtest-pqueue.vcxproj @@ -27,11 +27,11 @@ + - diff --git a/projects/Win/vc14/gtest-pqueue.vcxproj.filters b/projects/Win/vc14/gtest-pqueue.vcxproj.filters index 228156a9..d7dd0581 100644 --- a/projects/Win/vc14/gtest-pqueue.vcxproj.filters +++ b/projects/Win/vc14/gtest-pqueue.vcxproj.filters @@ -15,9 +15,6 @@ - - Source Files - Source Files @@ -33,6 +30,9 @@ Source Files + + Source Files + diff --git a/projects/Win/vc14/gtest-stack.vcxproj b/projects/Win/vc14/gtest-stack.vcxproj index 3741d2e1..39cd7ea8 100644 --- a/projects/Win/vc14/gtest-stack.vcxproj +++ b/projects/Win/vc14/gtest-stack.vcxproj @@ -27,11 +27,11 @@ + - diff --git a/projects/Win/vc14/gtest-stack.vcxproj.filters b/projects/Win/vc14/gtest-stack.vcxproj.filters index 621b653c..86b7995a 100644 --- a/projects/Win/vc14/gtest-stack.vcxproj.filters +++ b/projects/Win/vc14/gtest-stack.vcxproj.filters @@ -18,9 +18,6 @@ Source Files - - Source Files - Source Files @@ -36,6 +33,9 @@ Source Files + + Source Files + diff --git a/projects/Win/vc14/hdr-test-deque.vcxproj b/projects/Win/vc14/hdr-test-deque.vcxproj deleted file mode 100644 index 2161382e..00000000 --- a/projects/Win/vc14/hdr-test-deque.vcxproj +++ /dev/null @@ -1,342 +0,0 @@ - - - - - DebugVLD - Win32 - - - DebugVLD - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {CD0BC7FC-9BFF-40B0-8E66-99D244A8A026} - hdrtestdeque - Win32Proj - 8.1 - - - - Application - MultiByte - v140 - - - Application - MultiByte - true - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - true - v140 - - - Application - MultiByte - v140 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - $(ProjectName)_d - $(ProjectName)_d - $(ProjectName)_d - $(ProjectName)_d - - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - Cdecl - NotSet - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - false - - - MachineX86 - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - Cdecl - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - false - - - MachineX64 - MultiplyDefinedSymbolOnly - - - - - /bigobj /Zc:inline %(AdditionalOptions) - Full - AnySuitable - true - Speed - false - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - MultiThreadedDLL - NotSet - - - Level3 - ProgramDatabase - Cdecl - false - 4520 - - - unit-prerequisites.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - true - true - false - - - MachineX86 - true - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - Full - AnySuitable - true - Speed - false - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - MultiThreadedDLL - - - Level3 - ProgramDatabase - Cdecl - false - NotSet - 4520 - - - unit-prerequisites.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - true - true - UseLinkTimeCodeGeneration - false - - - MachineX64 - true - MultiplyDefinedSymbolOnly - - - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - Cdecl - NotSet - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - false - - - MachineX86 - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\test-hdr;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - Cdecl - NotSet - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - false - - - MachineX64 - MultiplyDefinedSymbolOnly - - - - - - - - - \ No newline at end of file diff --git a/projects/source.test-hdr.mk b/projects/source.test-hdr.mk index 65171891..012f9460 100644 --- a/projects/source.test-hdr.mk +++ b/projects/source.test-hdr.mk @@ -64,9 +64,6 @@ CDS_TESTHDR_MAP := \ tests/test-hdr/map/hdr_striped_hashmap_slist.cpp \ tests/test-hdr/map/hdr_striped_map_reg.cpp -CDS_TESTHDR_DEQUE := \ - tests/test-hdr/deque/hdr_fcdeque.cpp - CDS_TESTHDR_LIST := \ tests/test-hdr/list/hdr_lazy_dhp.cpp \ tests/test-hdr/list/hdr_lazy_hp.cpp \ @@ -278,7 +275,6 @@ CDS_TESTHDR_MISC := \ CDS_TESTHDR_SOURCES := \ $(CDS_TESTHDR_QUEUE) \ $(CDS_TESTHDR_MAP) \ - $(CDS_TESTHDR_DEQUE) \ $(CDS_TESTHDR_LIST) \ $(CDS_TESTHDR_SET) \ $(CDS_TESTHDR_TREE) \ diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index c25c24e0..8fe813be 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -1,2 +1,3 @@ +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deque) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pqueue) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stack) diff --git a/test/unit/deque/CMakeLists.txt b/test/unit/deque/CMakeLists.txt new file mode 100644 index 00000000..462d6c6e --- /dev/null +++ b/test/unit/deque/CMakeLists.txt @@ -0,0 +1,21 @@ +set(PACKAGE_NAME unit-deque) + +set(CDSGTEST_DEQUE_SOURCES + ../main.cpp + fcdeque.cpp +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_executable(${PACKAGE_NAME} ${CDSGTEST_DEQUE_SOURCES}) +target_link_libraries(${PACKAGE_NAME} + ${CDS_SHARED_LIBRARY} + ${GTEST_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/test/unit/deque/fcdeque.cpp b/test/unit/deque/fcdeque.cpp new file mode 100644 index 00000000..3c6ad1ab --- /dev/null +++ b/test/unit/deque/fcdeque.cpp @@ -0,0 +1,201 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include +#include + +namespace { + + class FCDeque: public ::testing::Test + { + protected: + template + void test( Deque& dq ) + { + size_t const c_nSize = 100; + + // push_front/pop_front + for ( int i = 0; i < static_cast( c_nSize ); ++i ) + EXPECT_TRUE( dq.push_front( i ) ); + EXPECT_EQ( dq.size(), c_nSize ); + + size_t nCount = 0; + int val; + while ( !dq.empty() ) { + EXPECT_TRUE( dq.pop_front( val ) ); + ++nCount; + EXPECT_EQ( static_cast(c_nSize - nCount), val ); + } + EXPECT_EQ( nCount, c_nSize ); + + // push_back/pop_back + for ( int i = 0; i < static_cast( c_nSize ); ++i ) + EXPECT_TRUE( dq.push_back( i ) ); + EXPECT_EQ( dq.size(), c_nSize ); + + nCount = 0; + while ( !dq.empty() ) { + EXPECT_TRUE( dq.pop_back( val ) ); + ++nCount; + EXPECT_EQ( static_cast(c_nSize - nCount), val ); + } + EXPECT_EQ( nCount, c_nSize ); + + // push_back/pop_front + for ( int i = 0; i < static_cast( c_nSize ); ++i ) + EXPECT_TRUE( dq.push_back( i ) ); + EXPECT_EQ( dq.size(), c_nSize ); + + nCount = 0; + while ( !dq.empty() ) { + EXPECT_TRUE( dq.pop_front( val ) ); + EXPECT_EQ( static_cast( nCount ), val ); + ++nCount; + } + EXPECT_EQ( nCount, c_nSize ); + + // push_front/pop_back + for ( int i = 0; i < static_cast( c_nSize ); ++i ) + EXPECT_TRUE( dq.push_front( i ) ); + EXPECT_EQ( dq.size(), c_nSize ); + + nCount = 0; + while ( !dq.empty() ) { + EXPECT_TRUE( dq.pop_back( val ) ); + EXPECT_EQ( static_cast( nCount ), val ); + ++nCount; + } + EXPECT_EQ( nCount, c_nSize ); + + // clear + for ( int i = 0; i < static_cast( c_nSize ); ++i ) + EXPECT_TRUE( dq.push_front( i ) ); + EXPECT_EQ( dq.size(), c_nSize ); + + EXPECT_FALSE( dq.empty() ); + dq.clear(); + EXPECT_TRUE( dq.empty() ); + } + }; + + TEST_F( FCDeque, std ) + { + typedef cds::container::FCDeque deque_type; + + deque_type dq; + test( dq ); + } + + TEST_F( FCDeque, std_elimination ) + { + typedef cds::container::FCDeque, + cds::container::fcdeque::make_traits< + cds::opt::enable_elimination< true > + >::type + > deque_type; + + deque_type dq; + test( dq ); + } + + TEST_F( FCDeque, std_statistics ) + { + typedef cds::container::FCDeque, + cds::container::fcdeque::make_traits< + cds::opt::stat< cds::container::fcdeque::stat<> > + >::type + > deque_type; + + deque_type dq; + test( dq ); + } + + TEST_F( FCDeque, std_mutex ) + { + struct deque_traits : public + cds::container::fcdeque::make_traits< + cds::opt::enable_elimination< true > + >::type + { + typedef std::mutex lock_type; + }; + typedef cds::container::FCDeque, deque_traits > deque_type; + + deque_type dq; + test( dq ); + } + + TEST_F( FCDeque, boost ) + { + typedef cds::container::FCDeque > deque_type; + + deque_type dq; + test( dq ); + } + + TEST_F( FCDeque, boost_elimination ) + { + typedef cds::container::FCDeque, + cds::container::fcdeque::make_traits< + cds::opt::enable_elimination< true > + >::type + > deque_type; + + deque_type dq; + test( dq ); + } + + TEST_F( FCDeque, boost_statistics ) + { + typedef cds::container::FCDeque, + cds::container::fcdeque::make_traits< + cds::opt::stat< cds::container::fcdeque::stat<> > + >::type + > deque_type; + + deque_type dq; + test( dq ); + } + + TEST_F( FCDeque, boost_mutex ) + { + typedef cds::container::FCDeque, + cds::container::fcdeque::make_traits< + cds::opt::enable_elimination< true > + ,cds::opt::lock_type< std::mutex > + >::type + > deque_type; + + deque_type dq; + test( dq ); + } + +} // namespace diff --git a/test/unit/main.cpp b/test/unit/main.cpp new file mode 100644 index 00000000..e690d555 --- /dev/null +++ b/test/unit/main.cpp @@ -0,0 +1,44 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +int main( int argc, char **argv ) +{ + int result; + cds::Initialize(); + { + ::testing::InitGoogleTest( &argc, argv ); + result = RUN_ALL_TESTS(); + } + cds::Terminate(); + return result; +} diff --git a/test/unit/pqueue/CMakeLists.txt b/test/unit/pqueue/CMakeLists.txt index 8da85f9a..e276dfd9 100644 --- a/test/unit/pqueue/CMakeLists.txt +++ b/test/unit/pqueue/CMakeLists.txt @@ -1,11 +1,11 @@ set(PACKAGE_NAME unit-pqueue) set(CDSGTEST_PQUEUE_SOURCES + ../main.cpp fcpqueue_boost_stable_vector.cpp fcpqueue_deque.cpp fcpqueue_vector.cpp intrusive_mspqueue.cpp - main.cpp mspqueue.cpp ) diff --git a/test/unit/stack/CMakeLists.txt b/test/unit/stack/CMakeLists.txt index 0d02cf94..cde5c67e 100644 --- a/test/unit/stack/CMakeLists.txt +++ b/test/unit/stack/CMakeLists.txt @@ -1,11 +1,11 @@ set(PACKAGE_NAME unit-stack) set(CDSGTEST_STACK_SOURCES + ../main.cpp fcstack.cpp intrusive_fcstack.cpp intrusive_treiber_stack_dhp.cpp intrusive_treiber_stack_hp.cpp - main.cpp treiber_stack_dhp.cpp treiber_stack_hp.cpp ) diff --git a/tests/test-hdr/CMakeLists.txt b/tests/test-hdr/CMakeLists.txt index df1fba99..a16b1cdf 100644 --- a/tests/test-hdr/CMakeLists.txt +++ b/tests/test-hdr/CMakeLists.txt @@ -66,9 +66,6 @@ set(CDS_TESTHDR_MAP map/hdr_striped_hashmap_slist.cpp map/hdr_striped_map_reg.cpp) -set(CDS_TESTHDR_DEQUE - deque/hdr_fcdeque.cpp) - set(CDS_TESTHDR_LIST list/hdr_lazy_dhp.cpp list/hdr_lazy_hp.cpp @@ -379,7 +376,6 @@ endif(CMAKE_COMPILER_IS_GNUCC) set(CDS_TESTHDR_SOURCES ${CDS_TESTHDR_QUEUE} ${CDS_TESTHDR_MAP} - ${CDS_TESTHDR_DEQUE} ${CDS_TESTHDR_LIST} ${CDS_TESTHDR_SET} ${CDS_TESTHDR_TREE} diff --git a/tests/test-hdr/deque/hdr_fcdeque.cpp b/tests/test-hdr/deque/hdr_fcdeque.cpp deleted file mode 100644 index b174303d..00000000 --- a/tests/test-hdr/deque/hdr_fcdeque.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - This file is a part of libcds - Concurrent Data Structures library - - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 - - Source code repo: http://github.com/khizmax/libcds/ - Download: http://sourceforge.net/projects/libcds/files/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "cppunit/cppunit_proxy.h" -#include "cppunit/test_beans.h" -#include -#include - -namespace deque { - - class HdrFCDeque: public CppUnitMini::TestCase - { - template - void test_with( Deque& dq ) - { - size_t const c_nSize = 100; - - // push_front/pop_front - for ( int i = 0; i < static_cast( c_nSize ); ++i ) - CPPUNIT_CHECK( dq.push_front( i ) ); - CPPUNIT_CHECK( dq.size() == c_nSize ); - - size_t nCount = 0; - int val; - while ( !dq.empty() ) { - CPPUNIT_CHECK( dq.pop_front( val ) ); - ++nCount; - CPPUNIT_CHECK( static_cast(c_nSize - nCount) == val ); - } - CPPUNIT_CHECK( nCount == c_nSize ); - - // push_back/pop_back - for ( int i = 0; i < static_cast( c_nSize ); ++i ) - CPPUNIT_CHECK( dq.push_back( i ) ); - CPPUNIT_CHECK( dq.size() == c_nSize ); - - nCount = 0; - while ( !dq.empty() ) { - CPPUNIT_CHECK( dq.pop_back( val ) ); - ++nCount; - CPPUNIT_CHECK( static_cast(c_nSize - nCount) == val ); - } - CPPUNIT_CHECK( nCount == c_nSize ); - - // push_back/pop_front - for ( int i = 0; i < static_cast( c_nSize ); ++i ) - CPPUNIT_CHECK( dq.push_back( i ) ); - CPPUNIT_CHECK( dq.size() == c_nSize ); - - nCount = 0; - while ( !dq.empty() ) { - CPPUNIT_CHECK( dq.pop_front( val ) ); - CPPUNIT_CHECK( static_cast( nCount ) == val ); - ++nCount; - } - CPPUNIT_CHECK( nCount == c_nSize ); - - // push_front/pop_back - for ( int i = 0; i < static_cast( c_nSize ); ++i ) - CPPUNIT_CHECK( dq.push_front( i ) ); - CPPUNIT_CHECK( dq.size() == c_nSize ); - - nCount = 0; - while ( !dq.empty() ) { - CPPUNIT_CHECK( dq.pop_back( val ) ); - CPPUNIT_CHECK( static_cast( nCount ) == val ); - ++nCount; - } - CPPUNIT_CHECK( nCount == c_nSize ); - - // clear - for ( int i = 0; i < static_cast( c_nSize ); ++i ) - CPPUNIT_CHECK( dq.push_front( i ) ); - CPPUNIT_CHECK( dq.size() == c_nSize ); - - CPPUNIT_CHECK( !dq.empty() ); - dq.clear(); - CPPUNIT_CHECK( dq.empty() ); - } - - template - void test() - { - Deque dq; - test_with( dq ); - } - - void fcDeque() - { - typedef cds::container::FCDeque deque_type; - test(); - } - - void fcDeque_elimination() - { - typedef cds::container::FCDeque, - cds::container::fcdeque::make_traits< - cds::opt::enable_elimination< true > - >::type - > deque_type; - test(); - } - - void fcDeque_stat() - { - typedef cds::container::FCDeque, - cds::container::fcdeque::make_traits< - cds::opt::stat< cds::container::fcdeque::stat<> > - >::type - > deque_type; - test(); - } - - void fcDeque_mutex() - { - struct deque_traits : public - cds::container::fcdeque::make_traits< - cds::opt::enable_elimination< true > - >::type - { - typedef std::mutex lock_type; - }; - typedef cds::container::FCDeque, deque_traits > deque_type; - test(); - } - - void fcDeque_boost() - { - typedef cds::container::FCDeque > deque_type; - test(); - } - - void fcDeque_boost_elimination() - { - typedef cds::container::FCDeque, - cds::container::fcdeque::make_traits< - cds::opt::enable_elimination< true > - >::type - > deque_type; - test(); - } - - void fcDeque_boost_stat() - { - typedef cds::container::FCDeque, - cds::container::fcdeque::make_traits< - cds::opt::stat< cds::container::fcdeque::stat<> > - >::type - > deque_type; - test(); - } - - void fcDeque_boost_mutex() - { - typedef cds::container::FCDeque, - cds::container::fcdeque::make_traits< - cds::opt::enable_elimination< true > - ,cds::opt::lock_type< std::mutex > - >::type - > deque_type; - test(); - } - - CPPUNIT_TEST_SUITE(HdrFCDeque) - CPPUNIT_TEST(fcDeque) - CPPUNIT_TEST(fcDeque_elimination) - CPPUNIT_TEST(fcDeque_stat) - CPPUNIT_TEST(fcDeque_mutex) - CPPUNIT_TEST(fcDeque_boost) - CPPUNIT_TEST(fcDeque_boost_elimination) - CPPUNIT_TEST(fcDeque_boost_stat) - CPPUNIT_TEST(fcDeque_boost_mutex) - CPPUNIT_TEST_SUITE_END() - }; - -} // namespace deque - -CPPUNIT_TEST_SUITE_REGISTRATION(deque::HdrFCDeque); -- 2.34.1