Split set/map tests as some compilers refuse to allocate too many sectios in the object file

This commit is contained in:
Ion Gaztañaga
2017-04-06 23:34:30 +02:00
parent d6749960fc
commit 903b568d13
5 changed files with 233 additions and 106 deletions

View File

@@ -311,6 +311,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "string_view_compat_test", "
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tree_test", "tree_test.vcproj", "{5CE185C3-2609-4FA5-FE38-792BA0D3A606}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@@ -629,6 +633,10 @@ Global
{58CCE183-6092-48FE-A4F7-BA0D4A792607}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D4A792607}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D4A792607}.Release.Build.0 = Release|Win32
{5CE185C3-2609-4FA5-FE38-792BA0D3A606}.Debug.ActiveCfg = Debug|Win32
{5CE185C3-2609-4FA5-FE38-792BA0D3A606}.Debug.Build.0 = Debug|Win32
{5CE185C3-2609-4FA5-FE38-792BA0D3A606}.Release.ActiveCfg = Release|Win32
{5CE185C3-2609-4FA5-FE38-792BA0D3A606}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="tree_test"
ProjectGUID="{5CE185C3-2609-4FA5-FE38-792BA0D3A606}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../Bin/Win32/Debug"
IntermediateDirectory="Debug/tree_test"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib"
OutputFile="$(OutDir)/tree_test_d.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../stage/lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/tree_test.pdb"
SubSystem="1"
TargetMachine="1"
FixedBaseAddress="1"
/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../Bin/Win32/Release"
IntermediateDirectory="Release/tree_test"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib"
OutputFile="$(OutDir)/tree_test.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../stage/lib"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
FixedBaseAddress="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{F737FB31-066C-4617-A7A5-23F0B5212FB7}">
<File
RelativePath="..\..\test\tree_test.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -51,36 +51,6 @@ template class multimap
, std::less<test::movable_and_copyable_int>
, std::allocator< pair_t >
>;
namespace container_detail {
//Instantiate base class as previous instantiations don't instantiate inherited members
template class tree
< pair_t
, select1st<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, test::simple_allocator<pair_t>
, tree_assoc_defaults
>;
template class tree
< pair_t
, select1st<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, std::allocator<pair_t>
, tree_assoc_defaults
>;
template class tree
< pair_t
, select1st<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, adaptive_pool<pair_t>
, tree_assoc_defaults
>;
} //container_detail {
}} //boost::container
class recursive_map
@@ -275,12 +245,10 @@ int test_map_variants()
{
typedef typename GetAllocatorMap<VoidAllocator, tree_type_value>::template apply<int>::map_type MyMap;
typedef typename GetAllocatorMap<VoidAllocator, tree_type_value>::template apply<test::movable_int>::map_type MyMoveMap;
typedef typename GetAllocatorMap<VoidAllocator, tree_type_value>::template apply<test::movable_and_copyable_int>::map_type MyCopyMoveMap;
typedef typename GetAllocatorMap<VoidAllocator, tree_type_value>::template apply<test::copyable_int>::map_type MyCopyMap;
typedef typename GetAllocatorMap<VoidAllocator, tree_type_value>::template apply<int>::multimap_type MyMultiMap;
typedef typename GetAllocatorMap<VoidAllocator, tree_type_value>::template apply<test::movable_int>::multimap_type MyMoveMultiMap;
typedef typename GetAllocatorMap<VoidAllocator, tree_type_value>::template apply<test::movable_and_copyable_int>::multimap_type MyCopyMoveMultiMap;
typedef typename GetAllocatorMap<VoidAllocator, tree_type_value>::template apply<test::copyable_int>::multimap_type MyCopyMultiMap;
typedef std::map<int, int> MyStdMap;
@@ -304,15 +272,6 @@ int test_map_variants()
return 1;
}
if (0 != test::map_test<
MyCopyMoveMap
,MyStdMap
,MyCopyMoveMultiMap
,MyStdMultiMap>()){
std::cout << "Error in map_test<MyBoostMap>" << std::endl;
return 1;
}
if (0 != test::map_test<
MyCopyMap
,MyStdMap
@@ -483,29 +442,19 @@ int main ()
//
typedef map< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> >
, tree_assoc_options< optimize_size<false>, tree_type<red_black_tree> >::type > rbmap_size_optimized_no;
typedef map< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> >
, tree_assoc_options< optimize_size<true>, tree_type<red_black_tree> >::type > rbmap_size_optimized_yes;
BOOST_STATIC_ASSERT(sizeof(rbmap_size_optimized_yes) < sizeof(rbmap_size_optimized_no));
typedef map< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> >
, tree_assoc_options< optimize_size<false>, tree_type<avl_tree> >::type > avlmap_size_optimized_no;
typedef map< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> >
, tree_assoc_options< optimize_size<true>, tree_type<avl_tree> >::type > avlmap_size_optimized_yes;
BOOST_STATIC_ASSERT(sizeof(avlmap_size_optimized_yes) < sizeof(avlmap_size_optimized_no));
//
// multimap
//
typedef multimap< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> >
, tree_assoc_options< optimize_size<false>, tree_type<red_black_tree> >::type > rbmmap_size_optimized_no;
typedef multimap< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> >
, tree_assoc_options< optimize_size<true>, tree_type<red_black_tree> >::type > rbmmap_size_optimized_yes;
BOOST_STATIC_ASSERT(sizeof(rbmmap_size_optimized_yes) < sizeof(rbmmap_size_optimized_no));
typedef multimap< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> >
, tree_assoc_options< optimize_size<false>, tree_type<avl_tree> >::type > avlmmap_size_optimized_no;
typedef multimap< int*, int*, std::less<int*>, std::allocator< std::pair<int const*, int*> >
, tree_assoc_options< optimize_size<true>, tree_type<avl_tree> >::type > avlmmap_size_optimized_yes;
BOOST_STATIC_ASSERT(sizeof(avlmmap_size_optimized_yes) < sizeof(avlmmap_size_optimized_no));
BOOST_STATIC_ASSERT(sizeof(rbmmap_size_optimized_yes) < sizeof(rbmap_size_optimized_no));
BOOST_STATIC_ASSERT(sizeof(avlmap_size_optimized_yes) < sizeof(avlmmap_size_optimized_no));
return 0;
}

View File

@@ -53,35 +53,6 @@ template class multiset
, adaptive_pool<test::movable_and_copyable_int>
>;
namespace container_detail {
//Instantiate base class as previous instantiations don't instantiate inherited members
template class tree
< test::movable_and_copyable_int
, identity<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, test::simple_allocator<test::movable_and_copyable_int>
, tree_assoc_defaults
>;
template class tree
< test::movable_and_copyable_int
, identity<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, std::allocator<test::movable_and_copyable_int>
, tree_assoc_defaults
>;
template class tree
< test::movable_and_copyable_int
, identity<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, adaptive_pool<test::movable_and_copyable_int>
, tree_assoc_defaults
>;
} //container_detail {
}} //boost::container
//Test recursive structures
@@ -301,12 +272,10 @@ int test_set_variants()
{
typedef typename GetAllocatorSet<VoidAllocator, tree_type_value>::template apply<int>::set_type MySet;
typedef typename GetAllocatorSet<VoidAllocator, tree_type_value>::template apply<test::movable_int>::set_type MyMoveSet;
typedef typename GetAllocatorSet<VoidAllocator, tree_type_value>::template apply<test::movable_and_copyable_int>::set_type MyCopyMoveSet;
typedef typename GetAllocatorSet<VoidAllocator, tree_type_value>::template apply<test::copyable_int>::set_type MyCopySet;
typedef typename GetAllocatorSet<VoidAllocator, tree_type_value>::template apply<int>::multiset_type MyMultiSet;
typedef typename GetAllocatorSet<VoidAllocator, tree_type_value>::template apply<test::movable_int>::multiset_type MyMoveMultiSet;
typedef typename GetAllocatorSet<VoidAllocator, tree_type_value>::template apply<test::movable_and_copyable_int>::multiset_type MyCopyMoveMultiSet;
typedef typename GetAllocatorSet<VoidAllocator, tree_type_value>::template apply<test::copyable_int>::multiset_type MyCopyMultiSet;
typedef std::set<int> MyStdSet;
@@ -330,15 +299,6 @@ int test_set_variants()
return 1;
}
if (0 != test::set_test<
MyCopyMoveSet
,MyStdSet
,MyCopyMoveMultiSet
,MyStdMultiSet>()){
std::cout << "Error in set_test<MyBoostSet>" << std::endl;
return 1;
}
if (0 != test::set_test<
MyCopySet
,MyStdSet
@@ -452,29 +412,20 @@ int main ()
//
typedef set< int*, std::less<int*>, std::allocator<int*>
, tree_assoc_options< optimize_size<false>, tree_type<red_black_tree> >::type > rbset_size_optimized_no;
typedef set< int*, std::less<int*>, std::allocator<int*>
, tree_assoc_options< optimize_size<true>, tree_type<red_black_tree> >::type > rbset_size_optimized_yes;
BOOST_STATIC_ASSERT(sizeof(rbset_size_optimized_yes) < sizeof(rbset_size_optimized_no));
typedef set< int*, std::less<int*>, std::allocator<int*>
, tree_assoc_options< optimize_size<false>, tree_type<avl_tree> >::type > avlset_size_optimized_no;
typedef set< int*, std::less<int*>, std::allocator<int*>
, tree_assoc_options< optimize_size<true>, tree_type<avl_tree> >::type > avlset_size_optimized_yes;
BOOST_STATIC_ASSERT(sizeof(avlset_size_optimized_yes) < sizeof(avlset_size_optimized_no));
//
// multiset
//
typedef multiset< int*, std::less<int*>, std::allocator<int*>
, tree_assoc_options< optimize_size<false>, tree_type<red_black_tree> >::type > rbmset_size_optimized_no;
typedef multiset< int*, std::less<int*>, std::allocator<int*>
, tree_assoc_options< optimize_size<true>, tree_type<red_black_tree> >::type > rbmset_size_optimized_yes;
BOOST_STATIC_ASSERT(sizeof(rbmset_size_optimized_yes) < sizeof(rbmset_size_optimized_no));
typedef multiset< int*, std::less<int*>, std::allocator<int*>
, tree_assoc_options< optimize_size<false>, tree_type<avl_tree> >::type > avlmset_size_optimized_no;
typedef multiset< int*, std::less<int*>, std::allocator<int*>
, tree_assoc_options< optimize_size<true>, tree_type<avl_tree> >::type > avlmset_size_optimized_yes;
BOOST_STATIC_ASSERT(sizeof(avlmset_size_optimized_yes) < sizeof(avlmset_size_optimized_no));
BOOST_STATIC_ASSERT(sizeof(rbmset_size_optimized_yes) < sizeof(rbset_size_optimized_no));
BOOST_STATIC_ASSERT(sizeof(avlset_size_optimized_yes) < sizeof(avlmset_size_optimized_no));
////////////////////////////////////
// Iterator testing

84
test/tree_test.cpp Normal file
View File

@@ -0,0 +1,84 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/container/detail/tree.hpp>
#include <boost/container/adaptive_pool.hpp>
#include "movable_int.hpp"
#include "dummy_test_allocator.hpp"
using namespace boost::container;
typedef std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> pair_t;
namespace boost {
namespace container {
//Explicit instantiation to detect compilation errors
namespace container_detail {
//Instantiate base class as previous instantiations don't instantiate inherited members
template class tree
< pair_t
, select1st<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, test::simple_allocator<pair_t>
, tree_assoc_defaults
>;
template class tree
< pair_t
, select1st<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, std::allocator<pair_t>
, tree_assoc_defaults
>;
template class tree
< pair_t
, select1st<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, adaptive_pool<pair_t>
, tree_assoc_defaults
>;
//Instantiate base class as previous instantiations don't instantiate inherited members
template class tree
< test::movable_and_copyable_int
, identity<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, test::simple_allocator<test::movable_and_copyable_int>
, tree_assoc_defaults
>;
template class tree
< test::movable_and_copyable_int
, identity<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, std::allocator<test::movable_and_copyable_int>
, tree_assoc_defaults
>;
template class tree
< test::movable_and_copyable_int
, identity<test::movable_and_copyable_int>
, std::less<test::movable_and_copyable_int>
, adaptive_pool<test::movable_and_copyable_int>
, tree_assoc_defaults
>;
} //container_detail {
}} //boost::container
int main ()
{
return 0;
}