|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58566 - in sandbox/itl: boost/itl boost/itl/detail boost/itl_xt boost/itl_xt/detail boost/validate/laws boost/validate/validater libs/itl/doxy_doc libs/itl/test/test_casual_ libs/validate/example libs/validate/example/de_morgan_ libs/validate/example/labat_single_ libs/validate/example/labat_val_relations_
From: afojgo_at_[hidden]
Date: 2009-12-29 11:55:54
Author: jofaber
Date: 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
New Revision: 58566
URL: http://svn.boost.org/trac/boost/changeset/58566
Log:
Added a documented example for validate. Added file impl_config.hpp to choose an implementation for the implementings sets and maps.
Added:
sandbox/itl/boost/itl/impl_config.hpp (contents, props changed)
Text files modified:
sandbox/itl/boost/itl/detail/set_algo.hpp | 9 ++++++
sandbox/itl/boost/itl/interval_base_map.hpp | 4 +-
sandbox/itl/boost/itl/interval_base_set.hpp | 4 +-
sandbox/itl/boost/itl/interval_map.hpp | 2
sandbox/itl/boost/itl/map.hpp | 50 ++++++++++++++++++++++++++-----------
sandbox/itl/boost/itl/set.hpp | 52 ++++++++++++++++++++++++++-------------
sandbox/itl/boost/itl_xt/detail/bit_element_iterator.hpp | 1
sandbox/itl/boost/itl_xt/string_set.hpp | 1
sandbox/itl/boost/validate/laws/induced_relation.hpp | 35 ++++++++++++++++++++------
sandbox/itl/boost/validate/laws/law.hpp | 32 +++++++++++++++++++++++-
sandbox/itl/boost/validate/validater/law_validater.hpp | 25 ++++++++++++++++---
sandbox/itl/libs/itl/doxy_doc/Doxyfile | 1
sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp | 7 ++++
sandbox/itl/libs/validate/example/de_morgan_/de_morgan.cpp | 2
sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp | 25 +++++++++++++-----
sandbox/itl/libs/validate/example/labat_val_relations_/labat_val_relations.cpp | 2
sandbox/itl/libs/validate/example/labat_val_relations_/vc9_labat_val_relations.vcproj | 28 ++++++++++----------
sandbox/itl/libs/validate/example/vc9_validate_examples.sln | 18 +++++++++++++
18 files changed, 222 insertions(+), 76 deletions(-)
Modified: sandbox/itl/boost/itl/detail/set_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/set_algo.hpp (original)
+++ sandbox/itl/boost/itl/detail/set_algo.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -163,6 +163,11 @@
}
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4996) //'std::equal': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
+#endif // I do guarantee here that I am using the parameters correctly :)
+
/** Function template <tt>lexicographical_equal</tt> implements
lexicographical equality. */
template<class SetType>
@@ -174,6 +179,10 @@
&& std::equal(left.begin(), left.end(), right.begin());
}
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
template<class SetType>
void flip(SetType& result, const SetType& x2)
Added: sandbox/itl/boost/itl/impl_config.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/impl_config.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -0,0 +1,45 @@
+/*-----------------------------------------------------------------------------+
+Author: Joachim Faulhaber
+Copyright (c) 2009-2009: 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)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_IMPL_CONFIG_HPP_JOFA_091225
+#define BOOST_ITL_IMPL_CONFIG_HPP_JOFA_091225
+
+/*-----------------------------------------------------------------------------+
+You can choose an implementation for the basic set and map classes.
+Select at most ONE of the following defines
++-----------------------------------------------------------------------------*/
+
+//#define ITL_USE_STD_IMPLEMENTATION
+//#define ITL_USE_BOOST_INTERPROCESS_IMPLEMENTATION
+//#define ITL_USE_BOOST_MOVE_IMPLEMENTATION
+
+/*-----------------------------------------------------------------------------+
+NO define or ITL_USE_STD_IMPLEMENTATION: Choose std::set and std::map as
+ implementing containers (default).
+
+ITL_USE_BOOST_INTERPROCESS_IMPLEMENTATION: Choose set and map implementations
+ from boost::interprocess.
+
+ITL_USE_BOOST_MOVE_IMPLEMENTATION: Move aware containers from boost::container
+ (NEW) are used. Currently (January 2010) this is only experimental.
+ boost::move from the boost::sandbox has to be used. This is depreciated for
+ production code, as long as move aware containers are not officially
+ accepted into boost.
++-----------------------------------------------------------------------------*/
+
+#if defined(ITL_USE_BOOST_INTERPROCESS_IMPLEMENTATION)
+#define ITL_IMPL_SPACE boost::interprocess
+#elif defined(ITL_USE_BOOST_MOVE_IMPLEMENTATION)
+#define ITL_IMPL_SPACE boost::container
+#else
+#define ITL_IMPL_SPACE std
+#endif
+
+#endif // BOOST_ITL_IMPL_CONFIG_HPP_JOFA_091225
+
+
Modified: sandbox/itl/boost/itl/interval_base_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_map.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -140,8 +140,8 @@
allocator_type;
/// Container type for the implementation
- typedef std::map<interval_type,codomain_type,
- key_compare,allocator_type> ImplMapT;
+ typedef ITL_IMPL_SPACE::map<interval_type,codomain_type,
+ key_compare,allocator_type> ImplMapT;
/// key type of the implementing container
typedef typename ImplMapT::key_type key_type;
Modified: sandbox/itl/boost/itl/interval_base_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_set.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -99,7 +99,7 @@
typedef Alloc<DomainT> domain_allocator_type;
/// Container type for the implementation
- typedef typename std::set<interval_type,key_compare,allocator_type> ImplSetT;
+ typedef typename ITL_IMPL_SPACE::set<interval_type,key_compare,allocator_type> ImplSetT;
/// key type of the implementing container
typedef typename ImplSetT::key_type key_type;
@@ -736,7 +736,7 @@
{
return std::lexicographical_compare(
lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
- Compare<Interval<DomainT,Compare> >()//NOTE DESIGN TTP: Why Compare is needs to be ttp
+ Compare<Interval<DomainT,Compare> >()//NOTE DESIGN TTP: Why Compare needs to be ttp
);
}
Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -540,7 +540,7 @@
template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
template<class Combiner>
inline void interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::subtract_main(/*CL const interval_type& inter_val,*/ const CodomainT& co_val, iterator& it_, iterator& last_)
+ ::subtract_main(const CodomainT& co_val, iterator& it_, iterator& last_)
{
while(it_ != last_)
{
Modified: sandbox/itl/boost/itl/map.hpp
==============================================================================
--- sandbox/itl/boost/itl/map.hpp (original)
+++ sandbox/itl/boost/itl/map.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -8,6 +8,16 @@
#ifndef BOOST_ITL_MAP_HPP_JOFA_070519
#define BOOST_ITL_MAP_HPP_JOFA_070519
+#include <boost/itl/impl_config.hpp>
+
+#if defined(ITL_USE_BOOST_INTERPROCESS_IMPLEMENTATION)
+#include <boost/interprocess/containers/map.hpp>
+#elif defined(ITL_USE_BOOST_MOVE_IMPLEMENTATION)
+#include <boost/container/map.hpp>
+#else
+#include <map>
+#endif
+
#include <string>
#include <boost/type_traits/ice.hpp>
#include <boost/itl/detail/notate.hpp>
@@ -20,7 +30,6 @@
#include <boost/itl/predicates.hpp>
#include <boost/itl/set.hpp>
#include <boost/itl/detail/map_algo.hpp>
-#include <map>
namespace boost{namespace itl
@@ -81,15 +90,15 @@
ITL_SECTION Section = ITL_SECTION_INSTANCE(itl::inplace_et, CodomainT),
ITL_ALLOC Alloc = std::allocator
>
-class map: private std::map<DomainT, CodomainT, ITL_COMPARE_DOMAIN(Compare,DomainT),
- Alloc<std::pair<const DomainT, CodomainT> > >
+class map: private ITL_IMPL_SPACE::map<DomainT, CodomainT, ITL_COMPARE_DOMAIN(Compare,DomainT),
+ Alloc<std::pair<const DomainT, CodomainT> > >
{
public:
typedef Alloc<typename std::pair<const DomainT, CodomainT> > allocator_type;
typedef typename itl::map<DomainT,CodomainT,Traits, Compare,Combine,Section,Alloc> type;
- typedef typename std::map<DomainT, CodomainT, ITL_COMPARE_DOMAIN(Compare,DomainT),
- allocator_type> base_type;
+ typedef typename ITL_IMPL_SPACE::map<DomainT, CodomainT, ITL_COMPARE_DOMAIN(Compare,DomainT),
+ allocator_type> base_type;
typedef typename itl::set<DomainT, Compare, Alloc > set_type;
typedef Traits traits;
@@ -139,10 +148,12 @@
map(const key_compare& comp): base_type(comp){}
template <class InputIterator>
- map(InputIterator first, InputIterator past): base_type(first,past){}
+ map(InputIterator first, InputIterator past)
+ : base_type(first,past){}
template <class InputIterator>
- map(InputIterator first, InputIterator past, const key_compare& comp): base_type(first,past,comp)
+ map(InputIterator first, InputIterator past, const key_compare& comp)
+ : base_type(first,past,comp)
{}
map(const map& src): base_type::map(src)
@@ -707,16 +718,26 @@
//==============================================================================
//= Equivalences and Orderings
//==============================================================================
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4996) //'std::equal': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
+#endif // I do guarantee here that I am using the parameters correctly :)
+
/** Standard equality, which is lexicographical equality of the sets
as sequences, that are given by their Compare order. */
template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
inline bool operator == (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& lhs,
const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& rhs)
{
- typedef std::map<DomainT,CodomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
- return operator==((const base_type&)lhs, (const base_type&)rhs);
+ return lhs.size() == rhs.size()
+ && equal(lhs.begin(), lhs.end(), rhs.begin());
}
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
inline bool operator != (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& lhs,
const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& rhs)
@@ -725,10 +746,7 @@
template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
inline bool is_element_equal(const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& lhs,
const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& rhs)
-{
- typedef std::map<DomainT,CodomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
- return operator==((const base_type&)lhs, (const base_type&)rhs);
-}
+{ return lhs == rhs; }
/** Protonic equality is equality on all elements that do not carry a neutron as content. */
template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
@@ -743,8 +761,10 @@
inline bool operator < (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& lhs,
const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& rhs)
{
- typedef std::map<DomainT,CodomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
- return operator<((const base_type&)lhs, (const base_type&)rhs);
+ return std::lexicographical_compare(
+ lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
+ Compare<std::pair<DomainT,CodomainT> >()
+ );
}
template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
Modified: sandbox/itl/boost/itl/set.hpp
==============================================================================
--- sandbox/itl/boost/itl/set.hpp (original)
+++ sandbox/itl/boost/itl/set.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -8,8 +8,17 @@
#ifndef BOOST_ITL_SET_HPP_JOFA_070519
#define BOOST_ITL_SET_HPP_JOFA_070519
-#include <string>
+#include <boost/itl/impl_config.hpp>
+
+#if defined(ITL_USE_BOOST_INTERPROCESS_IMPLEMENTATION)
+#include <boost/interprocess/containers/set.hpp>
+#elif defined(ITL_USE_BOOST_MOVE_IMPLEMENTATION)
+#include <boost/container/set.hpp>
+#else
#include <set>
+#endif
+
+#include <string>
#include <boost/itl/detail/concept_check.hpp>
#include <boost/itl/type_traits/to_string.hpp>
#include <boost/itl/type_traits/is_set.hpp>
@@ -29,6 +38,7 @@
#include <boost/mpl/not.hpp>
#include <boost/type_traits/is_same.hpp>
+
namespace boost{namespace itl
{
@@ -39,11 +49,11 @@
ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT),
ITL_ALLOC Alloc = std::allocator
>
-class set: private std::set<DomainT, ITL_COMPARE_DOMAIN(Compare,DomainT), Alloc<DomainT> >
+class set: private ITL_IMPL_SPACE::set<DomainT, ITL_COMPARE_DOMAIN(Compare,DomainT), Alloc<DomainT> >
{
public:
- typedef typename itl::set<DomainT, Compare, Alloc > type;
- typedef typename std::set<DomainT, ITL_COMPARE_DOMAIN(Compare,DomainT), Alloc<DomainT> > base_type;
+ typedef typename itl::set<DomainT, Compare, Alloc> type;
+ typedef typename ITL_IMPL_SPACE::set<DomainT, ITL_COMPARE_DOMAIN(Compare,DomainT), Alloc<DomainT> > base_type;
public:
typedef DomainT domain_type;
@@ -81,16 +91,15 @@
BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));
}
- explicit set(const domain_compare& comp):
- std::set<DomainT, domain_compare, Alloc<DomainT> >(comp){}
+ explicit set(const domain_compare& comp): base_type(comp){}
template <class InputIterator>
- set(InputIterator first, InputIterator past):
- std::set<InputIterator>(first,past){}
+ set(InputIterator first, InputIterator past)
+ : base_type(first,past){}
template <class InputIterator>
- set(InputIterator first, InputIterator past, const key_compare& comp):
- std::set<InputIterator>(first, past, comp){}
+ set(InputIterator first, InputIterator past, const key_compare& comp)
+ : base_type(first, past, comp){}
set(const set& src): base_type::set(src)
{
@@ -335,16 +344,27 @@
//==============================================================================
//= Equivalences and Orderings
//==============================================================================
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4996) //'std::equal': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
+#endif // I do guarantee here that I am using the parameters correctly :)
+
/** Standard equality, which is lexicographical equality of the sets
as sequences, that are given by their Compare order. */
template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
inline bool operator == (const itl::set<DomainT,Compare,Alloc>& lhs,
const itl::set<DomainT,Compare,Alloc>& rhs)
{
- typedef std::set<DomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
- return operator==((const base_type&)lhs, (const base_type&)rhs);
+ return lhs.size() == rhs.size()
+ && equal(lhs.begin(), lhs.end(), rhs.begin());
}
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+
template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
inline bool operator != (const itl::set<DomainT,Compare,Alloc>& lhs,
const itl::set<DomainT,Compare,Alloc>& rhs)
@@ -354,17 +374,15 @@
template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
inline bool is_element_equal(const itl::set<DomainT,Compare,Alloc>& lhs,
const itl::set<DomainT,Compare,Alloc>& rhs)
-{
- typedef std::set<DomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
- return operator==((const base_type&)lhs, (const base_type&)rhs);
-}
+{ return lhs == rhs; }
/** Strict weak less ordering which is given by the Compare order */
template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
inline bool operator < (const itl::set<DomainT,Compare,Alloc>& lhs,
const itl::set<DomainT,Compare,Alloc>& rhs)
{
- typedef std::set<DomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
+ typedef ITL_IMPL_SPACE
+ ::set<DomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
return operator<((const base_type&)lhs, (const base_type&)rhs);
}
Modified: sandbox/itl/boost/itl_xt/detail/bit_element_iterator.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/detail/bit_element_iterator.hpp (original)
+++ sandbox/itl/boost/itl_xt/detail/bit_element_iterator.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -236,6 +236,7 @@
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4146) // unary minus operator applied to unsigned type, result still unsigned
+#pragma warning(disable:4706) // assignment within conditional expression
#endif
Modified: sandbox/itl/boost/itl_xt/string_set.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/string_set.hpp (original)
+++ sandbox/itl/boost/itl_xt/string_set.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -76,7 +76,6 @@
// sets of strings ordered ignoring case
// ---------------------------------------------------------------------------------
- typedef string_set<String_ICLess> ICstring_set; //CL depreciated
typedef string_set<String_ICLess> ICstring_setD;
Modified: sandbox/itl/boost/validate/laws/induced_relation.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/induced_relation.hpp (original)
+++ sandbox/itl/boost/validate/laws/induced_relation.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -51,6 +51,13 @@
public:
+ size_t size()const
+ {
+ return
+ value_size<SourceT>::apply(this->template getInputValue<operand_a>())+
+ value_size<SourceT>::apply(this->template getInputValue<operand_b>());
+ }
+
bool holds()
{
// a rel b == f(a) rel f(b)
@@ -71,16 +78,28 @@
return lhs == rhs;
}
- size_t size()const
- {
- return
- value_size<SourceT>::apply(this->template getInputValue<operand_a>())+
- value_size<SourceT>::apply(this->template getInputValue<operand_b>());
- }
-
bool debug_holds()
{
- return holds();
+ // a rel b == f(a) rel f(b)
+ // --- left hand side ------------------------
+ // lhs := a rel b
+ SourceT a = this->template getInputValue<operand_a>();
+ SourceT b = this->template getInputValue<operand_b>();
+ std::cout << " a = " << a << std::endl;
+ std::cout << " b = " << b << std::endl;
+ bool lhs = RelationT<SourceT>()(a,b);
+ // --- right hand side -----------------------
+ TargetT f_a, f_b;
+ FunctionT<TargetT,SourceT>()(f_a, a);
+ FunctionT<TargetT,SourceT>()(f_b, b);
+ std::cout << "f(a) = " << f_a << std::endl;
+ std::cout << "f(b) = " << f_b << std::endl;
+ bool rhs = RelationT<TargetT>()(f_a, f_b);
+
+ this->template setOutputValue<lhs_result>(lhs);
+ this->template setOutputValue<rhs_result>(rhs);
+
+ return lhs == rhs;
}
}; //class InducedRelation
Modified: sandbox/itl/boost/validate/laws/law.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/law.hpp (original)
+++ sandbox/itl/boost/validate/laws/law.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -17,7 +17,8 @@
namespace boost{namespace itl
{
- /** abstract template class Law:
+ /** \brief An abstract class template Law
+
A Law can hold for a given set of variables.
A Law together with the set of input variables is an instance of the law.
The evaluation of the law results in a set of output variables.
@@ -38,47 +39,75 @@
typedef typename Loki::tuple<OutputTypes> output_tuple;
public:
+ /** Function \c holds yields true if the law holds for a given instantiation
+ of the input variables. */
bool holds(){ return that()->holds(); }
+
+ /** Function \c debug_holds is called at the end of a series of randomly
+ generated tests on the smallest law instantiation that violates the
+ law. Specific laws derived from class \c Law shall be coded to provide
+ informations useful for debugging. */
bool debug_holds(){ return that()->debug_holds(); }
+ /** Set input variables for a law. */
void setInstance(const input_tuple& inVars)
{ _inputTuple = inVars; }
+ /** Get input and output variables. */
void getInstance(input_tuple& inVars, output_tuple& outVars)const
{ inVars = _inputTuple; outVars = _outputTuple; }
+ /** Get input variables. */
void getInputInstance(input_tuple& inVars)const
{ inVars = _inputTuple; }
+ /** Get output variables. */
void getOutputInstance(output_tuple& outVars)const
{ outVars = _outputTuple; }
+ /** Get the size of a laws instantiation, that is a function of it's
+ input variables. The size function is used to filter small and simple
+ violations of laws in order to facilitate debugging. */
size_t size()const{ return that()->size(); }
+ /** A size equivalence on laws. */
bool operator == (const Law& rhs)const
{ return size() == rhs.size(); }
+ /** A size order on laws. This ordering servers filter small and simple
+ law instances that violate the law. */
bool operator < (const Law& rhs)const
{ return size() < rhs.size(); }
+ /// The name of the law
std::string name()const { return that()->name(); }
+ /// A formula for the law
std::string formula()const { return that()->formula(); }
+ /// A string that represents the Laws type instantiation.
std::string typeString()const { return that()->typeString(); }
+ /** Set a value for a laws input variable, indicated by it's \index in
+ the tuple of input variables */
template<unsigned int index>
typename Loki::TL::TypeAt<InputTypes, index>::Result
setInputValue(const typename Loki::TL::TypeAt<InputTypes, index>::Result& value)
{ return Loki::tup::refer<index>(_inputTuple)=value; }
+ /** Get the value for a laws input variable, indicated by it's \index in
+ the tuple of input variables */
template<unsigned int index>
typename Loki::TL::TypeAt<InputTypes, index>::Result getInputValue()const
{ return Loki::tup::get<index>(_inputTuple); }
+ /** Set a value for a laws output variable, indicated by it's \index in
+ the tuple of output variables */
template<unsigned int index>
typename Loki::TL::TypeAt<OutputTypes, index>::Result
setOutputValue(const typename Loki::TL::TypeAt<OutputTypes, index>::Result& value)
{ return Loki::tup::refer<index>(_outputTuple)=value; }
+ /** Get the value for a laws output variable, indicated by it's \index in
+ the tuple of output variables */
template<unsigned int index>
typename Loki::TL::TypeAt<OutputTypes, index>::Result getOutputValue()const
{ return Loki::tup::get<index>(_outputTuple); }
@@ -92,7 +121,6 @@
output_tuple _outputTuple;
};
-
enum InputVarIndex { operand_a, operand_b, operand_c, operand_d, operand_e };
enum OutputVarIndex { lhs_result, rhs_result };
Modified: sandbox/itl/boost/validate/validater/law_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/law_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/law_validater.hpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -28,25 +28,42 @@
typedef itl::map<std::string, int> ViolationCounterT;
typedef itl::map<std::string, PolyLawViolations> ViolationMapT;
+ /** \brief An interface for a test machine. */
class LawValidaterI
{
public:
+ /// Virtual dtor
virtual ~LawValidaterI(){}
+ /// Initialize the validater
virtual void init()=0;
+
+ /** \brief Run tests on the law.
+
+ Generate law instantiations, test the law on
+ them. Collect violations, if they occur. */
virtual void run()=0;
+
+ /// Add statistics of the validater's run to \c ValidationCounterT
virtual void addFrequencies(ValidationCounterT&)=0;
+ /// Add statistics and law violations to book keeper objects.
virtual void addViolations(ViolationCounterT&, ViolationMapT&)=0;
};
+ /** \brief A class template for test machines.
+
+ Class template \c LawValidater defines a testmachine
+ for a given law \c LawT and a generator template, that
+ produces a matching generator of input variables for the law.
+ */
template <class LawT, template<typename>class GentorT>
class LawValidater : public LawValidaterI
{
public:
- typedef typename LawT::input_types input_types;
- typedef typename LawT::output_types output_types;
- typedef typename LawT::input_tuple input_tuple;
- typedef typename LawT::output_tuple output_tuple;
+ typedef typename LawT::input_types input_types; // The input types of the law to test
+ typedef typename LawT::output_types output_types; // The output types of the law to test
+ typedef typename LawT::input_tuple input_tuple; // The tuple type for input variables of the law
+ typedef typename LawT::output_tuple output_tuple; // The tuple type for input variables of the law
typedef typename Loki::TL::MapType<GentorT, input_types>::Result gentor_types;
typedef typename Loki::tuple<gentor_types> input_gentor;
Modified: sandbox/itl/libs/itl/doxy_doc/Doxyfile
==============================================================================
--- sandbox/itl/libs/itl/doxy_doc/Doxyfile (original)
+++ sandbox/itl/libs/itl/doxy_doc/Doxyfile 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -85,6 +85,7 @@
../../../boost/itl_xt/product_history.hpp \
../../../boost/itl_xt/tuple_computer.hpp \
../../../boost/validate/laws/law.hpp \
+ ../../../boost/validate/validater/law_validater.hpp \
../../../libs/itl/example/boost_party_ \
../../../libs/itl/example/interval_ \
../../../libs/itl/example/interval_ \
Modified: sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp (original)
+++ sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -38,7 +38,6 @@
using namespace unit_test;
using namespace boost::itl;
-
BOOST_AUTO_TEST_CASE(reverse_iter)
{
interval_map<int,int> map_a;
@@ -60,3 +59,9 @@
cout << map_a << endl;
}
+
+BOOST_AUTO_TEST_CASE(casual)
+{
+ itl::set<int> ion_set;
+}
+
Modified: sandbox/itl/libs/validate/example/de_morgan_/de_morgan.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/de_morgan_/de_morgan.cpp (original)
+++ sandbox/itl/libs/validate/example/de_morgan_/de_morgan.cpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -10,7 +10,7 @@
/** Example de_morgan.cpp \file de_morgan.cpp
-Example de_morgan.cpp demonstrates some test of
+Example de_morgan.cpp demonstrates some tests of
<a href="http://en.wikipedia.org/wiki/De_Morgan%27s_laws">
De Morgan's law</a>
on interval_set.
Modified: sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp (original)
+++ sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -23,6 +23,7 @@
#include <boost/validate/laws/minor_set_laws.hpp>
#include <boost/validate/laws/function_equality.hpp>
#include <boost/validate/laws/atomic_equivalence.hpp>
+#include <boost/validate/laws/order.hpp>
//#include <boost/validate/laws/novial_tree.hpp>
#include <boost/validate/laws/inversion_laws.hpp>
@@ -46,14 +47,24 @@
void test_LawValidater()
{
- typedef UnaryAtomicEquivalence2
- <
- itl::interval_map<int,int>,
- //itl::list<int>,
- std::pair<int,int>,
- itl::std_find
- > TestLawT;
+ //typedef UnaryAtomicEquivalence2
+ //<
+ // itl::interval_map<int,int>,
+ // //itl::list<int>,
+ // std::pair<int,int>,
+ // itl::std_find
+ //> TestLawT;
+
+ //typedef InducedRelation
+ //<
+ // itl::interval_map<int,int>,
+ // itl::map<int,int>,
+ // segmental::atomizer,
+ // element_equal
+ //>
+ //TestLawT;
+ typedef Antisymmetry<itl::map<int,int>, std::less_equal, std_equal> TestLawT;
LawValidater<TestLawT, RandomGentor> test_law;
Modified: sandbox/itl/libs/validate/example/labat_val_relations_/labat_val_relations.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_val_relations_/labat_val_relations.cpp (original)
+++ sandbox/itl/libs/validate/example/labat_val_relations_/labat_val_relations.cpp 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -26,7 +26,7 @@
">> ------------------------------------------------------ <<\n";
GentorProfileSgl::it()->set_std_profile(20,1);
GentorProfileSgl::it()->report_profile();
- validater.terminate_at_law_count(33, 2);
+ //validater.terminate_at_law_count(33, 2);
validater.validate();
};
Modified: sandbox/itl/libs/validate/example/labat_val_relations_/vc9_labat_val_relations.vcproj
==============================================================================
--- sandbox/itl/libs/validate/example/labat_val_relations_/vc9_labat_val_relations.vcproj (original)
+++ sandbox/itl/libs/validate/example/labat_val_relations_/vc9_labat_val_relations.vcproj 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -177,20 +177,6 @@
</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="..\..\src\gentor\gentorprofile.cpp"
- >
- </File>
- <File
- RelativePath="..\labat_val_relations_\labat_val_relations.cpp"
- >
- </File>
- </Filter>
- <Filter
Name="Headerdateien"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
@@ -237,6 +223,20 @@
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
+ Name="Quelldateien"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\src\gentor\gentorprofile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\labat_val_relations_\labat_val_relations.cpp"
+ >
+ </File>
+ </Filter>
</Filter>
<File
RelativePath=".\ReadMe.txt"
Modified: sandbox/itl/libs/validate/example/vc9_validate_examples.sln
==============================================================================
--- sandbox/itl/libs/validate/example/vc9_validate_examples.sln (original)
+++ sandbox/itl/libs/validate/example/vc9_validate_examples.sln 2009-12-29 11:55:52 EST (Tue, 29 Dec 2009)
@@ -27,6 +27,12 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_de_morgan", "de_morgan_\vc9_de_morgan.vcproj", "{BF42574F-66E2-42DD-90D9-3A8FCE6F4740}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_labat_val_relations", "labat_val_relations_\vc9_labat_val_relations.vcproj", "{BF42574F-66E2-42DD-90D9-3A8FCE6F471F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_labat_map_order", "labat_map_order_\vc9_labat_map_order.vcproj", "{BF42574F-66E2-42DD-90D9-3A8FCE6F4727}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_labat_signed_quantifier", "labat_signed_quantifier_\vc9_labat_signed_quantifier.vcproj", "{BF42574F-66E2-42DD-90D9-3A8FCE6F4721}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -85,6 +91,18 @@
{BF42574F-66E2-42DD-90D9-3A8FCE6F4740}.Debug|Win32.Build.0 = Debug|Win32
{BF42574F-66E2-42DD-90D9-3A8FCE6F4740}.Release|Win32.ActiveCfg = Release|Win32
{BF42574F-66E2-42DD-90D9-3A8FCE6F4740}.Release|Win32.Build.0 = Release|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F471F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F471F}.Debug|Win32.Build.0 = Debug|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F471F}.Release|Win32.ActiveCfg = Release|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F471F}.Release|Win32.Build.0 = Release|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F4727}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F4727}.Debug|Win32.Build.0 = Debug|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F4727}.Release|Win32.ActiveCfg = Release|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F4727}.Release|Win32.Build.0 = Release|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F4721}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F4721}.Debug|Win32.Build.0 = Debug|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F4721}.Release|Win32.ActiveCfg = Release|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F4721}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
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