|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50683 - in sandbox/itl: boost/itl boost/itl/type_traits libs/itl/build/win32 libs/itl/test libs/itl/test/test_interval_map libs/itl/test/test_quantifier_map libs/itl_xt/test/meta_functors
From: afojgo_at_[hidden]
Date: 2009-01-20 06:10:09
Author: jofaber
Date: 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
New Revision: 50683
URL: http://svn.boost.org/trac/boost/changeset/50683
Log:
Added tests. Added test_quantifier_map. Tests for global operators with laws. Stable {msvc-9.0, partly congcc-4.3-a7}
Added:
sandbox/itl/libs/itl/test/test_quantifier_map/
sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map.cpp (contents, props changed)
sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map_shared.cpp (contents, props changed)
sandbox/itl/libs/itl/test/test_quantifier_map/vc9_test_quantifier_map.vcproj (contents, props changed)
Text files modified:
sandbox/itl/boost/itl/interval.hpp | 35 ++++++++++++----
sandbox/itl/boost/itl/operators.hpp | 55 ++++++++------------------
sandbox/itl/boost/itl/separate_interval_set.hpp | 2
sandbox/itl/boost/itl/split_interval_set.hpp | 2
sandbox/itl/boost/itl/type_traits/is_combinable.hpp | 2
sandbox/itl/libs/itl/build/win32/vc9_all.sln | 6 ++
sandbox/itl/libs/itl/test/test_interval_map/test_interval_map.cpp | 1
sandbox/itl/libs/itl/test/test_interval_map_shared.hpp | 41 +++----------------
sandbox/itl/libs/itl/test/test_value_maker.hpp | 81 ++++++++++++++++++++++++++++++++++++++++
sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp | 11 ++++
10 files changed, 153 insertions(+), 83 deletions(-)
Modified: sandbox/itl/boost/itl/interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval.hpp (original)
+++ sandbox/itl/boost/itl/interval.hpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -44,6 +44,7 @@
#include <boost/call_traits.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
+#include <boost/mpl/assert.hpp>
#include <boost/itl/notate.hpp>
#include <boost/itl/type_traits/neutron.hpp>
#include <boost/itl/type_traits/unon.hpp>
@@ -58,7 +59,7 @@
#define BOUND_VAL first
#define BOUND_TYPES second
-typedef unsigned char ITV_BOUNDTYPES;
+typedef unsigned char ITV_BOUNDTYPES; //JODO refa
namespace boost{namespace itl
{
@@ -288,6 +289,23 @@
*/
+
+
+
+/// Constants for intervalbounds
+enum BoundTypes {
+ /// Both open: <tt>(x,y)</tt>
+ open = 0,
+ /// Left open right closed: <tt>(x,y]</tt>
+ left_open = 1,
+ /// Left closed right open: <tt>[x,y)</tt>
+ right_open = 2,
+ /// Both closed: <tt>[x,y]</tt>
+ closed = 3,
+} ;
+
+typedef unsigned char bount_types;
+
/// A class template for intervals
/** Bounds of the interval may be closed or open.
Discrete or continuous datatypes may be used as domain datatypes DomainT.
@@ -512,10 +530,10 @@
void transform_bounds(bound_types bt);
/** Sets left border closed. Requires Integral<domain_type>.*/
- void close_left_bound();
+ //CL void close_left_bound();
/** Sets right border open. Requires Integral<domain_type>. */
- void open_right_bound();
+ //CL void open_right_bound();
/** An interval that covers the complete range of it's domain_type */
@@ -1031,17 +1049,15 @@
template <class DomainT, ITL_COMPARE Compare>
DomainT interval<DomainT,Compare>::first()const
{
- //JODO: BOOST_STATIC_ASSERT generates compiletime error even if
- // code is correctly not used
- //BOOST_STATIC_ASSERT(!itl::is_continuous<DomainT>::value);
- BOOST_ASSERT(!itl::is_continuous<DomainT>::value);
+ //JODO BOOST_STATIC_ASSERT((!itl::is_continuous<DomainT>::value)); //complains incorrectly sometimes
+ BOOST_ASSERT((!itl::is_continuous<DomainT>::value));
return leftbound_closed() ? _lwb : succ(_lwb);
}
template <class DomainT, ITL_COMPARE Compare>
DomainT interval<DomainT,Compare>::last()const
{
- BOOST_ASSERT(!itl::is_continuous<DomainT>::value);
+ BOOST_ASSERT((!itl::is_continuous<DomainT>::value));
return rightbound_closed() ? _upb : pred(_upb);
}
@@ -1094,6 +1110,7 @@
}
}
+/*CL
template <class DomainT, ITL_COMPARE Compare>
void interval<DomainT,Compare>::close_left_bound()
{
@@ -1113,7 +1130,7 @@
_upb++;
}
}
-
+*/
/** Equality on intervals */
template <class DomainT, ITL_COMPARE Compare>
Modified: sandbox/itl/boost/itl/operators.hpp
==============================================================================
--- sandbox/itl/boost/itl/operators.hpp (original)
+++ sandbox/itl/boost/itl/operators.hpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -13,8 +13,9 @@
namespace boost{namespace itl
{
-
-
+//------------------------------------------------------------------------------
+// Addability
+//------------------------------------------------------------------------------
template<class ObjectT, class OperandT>
typename boost::enable_if<is_combinable<ObjectT, OperandT>, ObjectT>::type
operator + (const ObjectT& object, const OperandT& operand)
@@ -25,51 +26,29 @@
operator + (const OperandT& operand, const ObjectT& object)
{ return ObjectT(object) += operand; }
-template<class ObjectT>
-ObjectT operator + (const ObjectT& object, const ObjectT& operand)
-{ return ObjectT(object) += operand; }
-
-/*
-template<class ObjectT>
-ObjectT operator + (const ObjectT& object, const typename ObjectT::value_type& operand)
-{ return ObjectT(object) += operand; }
-
-template<class ObjectT>
-ObjectT operator + (const typename ObjectT::value_type& operand, const ObjectT& object)
-{ return ObjectT(object) += operand; }
-
-template<class ObjectT>
-ObjectT operator + (const ObjectT& object, const typename ObjectT::mapping_pair_type& operand)
-{ return ObjectT(object) += operand; }
template<class ObjectT>
-ObjectT operator + (const typename ObjectT::mapping_pair_type& operand, const ObjectT& object)
+ObjectT operator + (const ObjectT& object, const ObjectT& operand)
{ return ObjectT(object) += operand; }
-template<class ObjectT>
-ObjectT operator + (const ObjectT& object, const typename ObjectT::split_type& operand)
-{ return ObjectT(object) += operand; }
-template<class ObjectT>
-ObjectT operator + (const typename ObjectT::split_type& operand, const ObjectT& object)
-{ return ObjectT(object) += operand; }
+//------------------------------------------------------------------------------
+// Intersection
+//------------------------------------------------------------------------------
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_combinable<ObjectT, OperandT>, ObjectT>::type
+operator & (const ObjectT& object, const OperandT& operand)
+{ return ObjectT(object) &= operand; }
-//template<class ObjectT>
-//ObjectT operator + (const ObjectT& object, const typename ObjectT::joint_type& operand)
-//{ return ObjectT(object) += operand; }
-//
-//template<class ObjectT>
-//ObjectT operator + (const typename ObjectT::joint_type& operand, const ObjectT& object)
-//{ return ObjectT(object) += operand; }
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_combinable<ObjectT, OperandT>, ObjectT>::type
+operator & (const OperandT& operand, const ObjectT& object)
+{ return ObjectT(object) &= operand; }
template<class ObjectT>
-ObjectT operator + (const ObjectT& object, const typename ObjectT::separating_type& operand)
-{ return ObjectT(object) += operand; }
+ObjectT operator & (const ObjectT& object, const ObjectT& operand)
+{ return ObjectT(object) &= operand; }
-template<class ObjectT>
-ObjectT operator + (const typename ObjectT::separating_type& operand, const ObjectT& object)
-{ return ObjectT(object) += operand; }
-*/
}} // namespace itl boost
Modified: sandbox/itl/boost/itl/separate_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/separate_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/separate_interval_set.hpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -152,7 +152,7 @@
template<class SubType>
separate_interval_set& operator =
(const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& src)
- { BOOST_ASSERT(this != &src); assign(src); return *this; }
+ { assign(src); return *this; }
/// Assignment from a base interval_set.
template<class SubType>
Modified: sandbox/itl/boost/itl/split_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_set.hpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -169,7 +169,7 @@
template<class SubType>
split_interval_set& operator =
(const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& src)
- { BOOST_ASSERT(this != &src); assign(src); return *this; }
+ { assign(src); return *this; }
/// Assignment from a base interval_set.
template<class SubType>
Modified: sandbox/itl/boost/itl/type_traits/is_combinable.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/is_combinable.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/is_combinable.hpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -23,6 +23,8 @@
template<class Type>
struct is_combinable<Type, typename Type::mapping_pair_type>{ enum{ value = true }; };
template<class Type>
+struct is_combinable<Type, typename Type::base_type> { enum{ value = true }; };
+template<class Type>
struct is_combinable<Type, typename Type::joint_type> { enum{ value = true }; };
template<class Type>
Modified: sandbox/itl/libs/itl/build/win32/vc9_all.sln
==============================================================================
--- sandbox/itl/libs/itl/build/win32/vc9_all.sln (original)
+++ sandbox/itl/libs/itl/build/win32/vc9_all.sln 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -55,6 +55,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_labat_itv_set", "..\..\..\validate\example\labat_itv_set\vc9_labat_itv_set.vcproj", "{BF42574F-66E2-42DD-90D9-3A8FCE6F471D}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_test_quantifier_map", "..\..\test\test_quantifier_map\vc9_test_quantifier_map.vcproj", "{EE61B7EF-EC45-4165-8B49-FD5B7D2A9F9F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -169,6 +171,10 @@
{BF42574F-66E2-42DD-90D9-3A8FCE6F471D}.Debug|Win32.Build.0 = Debug|Win32
{BF42574F-66E2-42DD-90D9-3A8FCE6F471D}.Release|Win32.ActiveCfg = Release|Win32
{BF42574F-66E2-42DD-90D9-3A8FCE6F471D}.Release|Win32.Build.0 = Release|Win32
+ {EE61B7EF-EC45-4165-8B49-FD5B7D2A9F9F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EE61B7EF-EC45-4165-8B49-FD5B7D2A9F9F}.Debug|Win32.Build.0 = Debug|Win32
+ {EE61B7EF-EC45-4165-8B49-FD5B7D2A9F9F}.Release|Win32.ActiveCfg = Release|Win32
+ {EE61B7EF-EC45-4165-8B49-FD5B7D2A9F9F}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: sandbox/itl/libs/itl/test/test_interval_map/test_interval_map.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map/test_interval_map.cpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map/test_interval_map.cpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -14,6 +14,7 @@
// interval instance types
#include "../test_type_lists.hpp"
#include "../test_value_maker.hpp"
+#include "../test_laws.hpp"
#include <boost/itl/interval_map.hpp>
#include <boost/itl/split_interval_map.hpp>
Modified: sandbox/itl/libs/itl/test/test_interval_map_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map_shared.hpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -825,33 +825,6 @@
}
-template<class Type>
-void check_neutrality_plus(const Type& a)
-{
- Type left = a + neutron<Type>::value();
- Type right = neutron<Type>::value() + a;
- BOOST_CHECK_EQUAL(left,right);
- left = a + Type();
- right = Type() + a;
- BOOST_CHECK_EQUAL(left,right);
-}
-
-template<class Type, class TypeB>
-void check_commutativity_plus(const Type& a, const TypeB& b)
-{
- Type left = a + b;
- Type right = b + a;
- BOOST_CHECK_EQUAL(left,right);
-}
-
-template<class Type, class TypeB, class TypeC>
-void check_associativity_plus(const Type& a, const TypeB& b, const TypeC& c)
-{
- Type left = (a + b) + c;
- Type right = a + (b + c);
- BOOST_CHECK_EQUAL(left,right);
-}
-
template <class T, class U,
template<class T, class U,
class Traits = neutron_absorber,
@@ -913,16 +886,18 @@
IntervalMap2T join_map = map_a + map2_a;
//IntervalMap2T splt_map = map_a + map2_a;
- check_commutativity_plus(map_a, map_b);
+ check_commutativity_wrt_plus(map_a, map_b);
//check_commutativity_plus(map2_a, map_b);
- check_commutativity_plus(map_a, val_pair);
+ check_commutativity_wrt_plus(map_a, val_pair);
typename IntervalMap1T::mapping_pair_type v5_u2(v5,u2);
- check_commutativity_plus(map_b, v5_u2);
+ check_commutativity_wrt_plus(map_b, v5_u2);
+
+ CHECK_ASSOCIATIVITY_WRT(plus)(map_a, map_b, map_a);
+ check_associativity_wrt_plus(map_a, map_b, map_a);
- check_associativity_plus(map_a, map_b, map_a);
- check_associativity_plus(map_a, map_b, map_a);
+ check_neutrality_wrt_plus(map_a, neutron<IntervalMap1T>::value());
- check_neutrality_plus(map_a);
+ CHECK_MONOID_WRT(plus)(neutron<IntervalMap1T>::value(), map_a, map_b, map_a);
}
Added: sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map.cpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -0,0 +1,37 @@
+/*----------------------------------------------------------------------------+
+Copyright (c) 2008-2008: Joachim Faulhaber
++-----------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++----------------------------------------------------------------------------*/
+#define BOOST_TEST_MODULE itl::interval_set unit test
+#include <string>
+#include <boost/mpl/list.hpp>
+#include <boost/test/unit_test.hpp>
+#include <boost/test/test_case_template.hpp>
+
+// interval instance types
+#include "../test_type_lists.hpp"
+#include "../test_value_maker.hpp"
+#include "../test_laws.hpp"
+
+#include <boost/itl/interval_map.hpp>
+#include <boost/itl/split_interval_map.hpp>
+
+using namespace std;
+using namespace boost;
+using namespace unit_test;
+using namespace boost::itl;
+
+// -----------------------------------------------------------------------------
+// test_interval_set_shared are tests that should give identical results for all
+// interval_sets: interval_set, separate_interval_set and split_interval_set.
+#include "../test_quantifier_map_shared.hpp"
+
+// Due to limited expressiveness of the testing framework, the testcode in files
+// test_interval_map{,_split}_shared.cpp is generated through code
+// replication.
+#include "test_quantifier_map_shared.cpp"
+
+
Added: sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map_shared.cpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map_shared.cpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -0,0 +1,16 @@
+/*----------------------------------------------------------------------------+
+Copyright (c) 2008-2008: Joachim Faulhaber
++-----------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++----------------------------------------------------------------------------*/
+
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_interval_map_base_laws_plus_4_bicremental_types, T, bicremental_types)
+{ interval_map_base_laws_plus_4_bicremental_types<T, int, interval_map, split_interval_map>();}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_quantifier_map_check_monoid_4_bicremental_types, T, bicremental_types)
+{ quantifier_map_check_monoid_4_bicremental_types<T, std::string, neutron_emitter>();}
+
Added: sandbox/itl/libs/itl/test/test_quantifier_map/vc9_test_quantifier_map.vcproj
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/itl/test/test_quantifier_map/vc9_test_quantifier_map.vcproj 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="vc9_test_quantifier_map"
+ ProjectGUID="{EE61B7EF-EC45-4165-8B49-FD5B7D2A9F9F}"
+ RootNamespace="Test_quantifier_map"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../../../bin/debug/"
+ IntermediateDirectory="../../../../bin/obj/$(ProjectName)/debug/"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../; ../../../../boost_1_35_0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="../../../../bin/debug/$(ProjectName).exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="../../../../lib; ../../../../stage/lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../../../bin/release/"
+ IntermediateDirectory="../../../../bin/obj/$(ProjectName)/release/"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../; ../../../../boost_1_35_0"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="../../../../bin/release/$(ProjectName).exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../lib; ../../../../stage/lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Quelldateien"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\test_quantifier_map.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Headerdateien"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\test_quantifier_map_shared.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\test_type_lists.hpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Ressourcendateien"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: sandbox/itl/libs/itl/test/test_value_maker.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_value_maker.hpp (original)
+++ sandbox/itl/libs/itl/test/test_value_maker.hpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -12,6 +12,17 @@
namespace boost{ namespace itl
{
+
+/*JODO completion like that:
+std::string make(int n)
+{
+ std::string value = neutron<std::string>::value();
+ int abs_n = n<0 ? -n : n;
+ for(int i=1; i<abs_n; i++)
+ value += i%2==1 ? "hello " : "world ";
+}
+*/
+
template <class BicrementableT>
BicrementableT make(int n)
{
@@ -26,6 +37,76 @@
return value;
}
+
+template <class Type>
+struct test_value;
+
+template<>
+struct test_value<std::string>
+{
+ static std::string make(int n)
+ {
+ std::string value = neutron<std::string>::value();
+ int abs_n = n<0 ? -n : n;
+ for(int i=1; i<abs_n; i++)
+ value += (i%2==1 ? "hello " : "world ");
+
+ return value;
+ }
+};
+
+template <class Type>
+struct test_value
+{
+ static Type make(int n)
+ {
+ Type value = neutron<Type>::value();
+ if(n>=0)
+ for(int i=0; i<n; i++)
+ ++value;
+ else
+ for(int i=0; i>n; i--)
+ --value;
+
+ return value;
+ }
+};
+
+
+template <class ItvMapT>
+struct map_val
+{
+ typedef typename ItvMapT::domain_type domain_type;
+ typedef typename ItvMapT::codomain_type codomain_type;
+ typedef typename ItvMapT::interval_type interval_type;
+ typedef typename ItvMapT::value_type value_type;
+ typedef typename ItvMapT::mapping_pair_type mapping_pair_type;
+
+ static interval<domain_type> interval(int lower, int upper, int bounds = 2)
+ {
+ return interval_type(test_value<domain_type>::make(lower),
+ test_value<domain_type>::make(upper), bounds);
+ }
+
+ static value_type val_pair(int lower, int upper, int val, int bounds = 2)
+ {
+ return value_type( interval(lower, upper, bounds),
+ test_value<codomain_type>::make(val) );
+ }
+
+ static mapping_pair_type map_pair(int key, int val)
+ {
+ return mapping_pair_type(test_value<domain_type>::make(key),
+ test_value<codomain_type>::make(val));
+ }
+};
+
+#define IIv(low,up,val) map_val<IntervalMapT>::val_pair(low,up,val, closed)
+#define IDv(low,up,val) map_val<IntervalMapT>::val_pair(low,up,val, right_open)
+#define CIv(low,up,val) map_val<IntervalMapT>::val_pair(low,up,val, left_open)
+#define CDv(low,up,val) map_val<IntervalMapT>::val_pair(low,up,val, open)
+#define K_v(key,val) map_val<IntervalMapT>::map_pair(key,val)
+
}} // namespace boost itl
#endif
Modified: sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp
==============================================================================
--- sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp (original)
+++ sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp 2009-01-20 06:10:08 EST (Tue, 20 Jan 2009)
@@ -250,6 +250,14 @@
cout << "sec_map: " << sec_map << endl;
}
+void assert_test()
+{
+ //interval<double> doubItv = interval<double>::closed(0.0, 1.5);
+ //double fst = doubItv.first();
+ interval<int> intItv = interval<int>::closed(0, 2);
+ int fst = intItv.first();
+ cout << intItv << endl;
+}
int main()
{
@@ -268,7 +276,8 @@
*/
//codomain_test();
//string_codomain_test();
- quantifier_subtract_test();
+ //quantifier_subtract_test();
+ assert_test();
return 0;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk