|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56724 - in sandbox/itl: boost/itl boost/itl/type_traits boost/itl_xt boost/itl_xt/std boost/validate boost/validate/driver boost/validate/gentor boost/validate/itl boost/validate/laws boost/validate/type boost/validate/validater libs/itl/build/win32 libs/validate/example/labat_bit_collector_ libs/validate/example/labat_polygon_ libs/validate/example/labat_single_
From: afojgo_at_[hidden]
Date: 2009-10-11 17:15:25
Author: jofaber
Date: 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
New Revision: 56724
URL: http://svn.boost.org/trac/boost/changeset/56724
Log:
Added law based tests testing equivalence of copying via std::copy and loops.
Added law based tests for interval_maps of bitsets.
Fixed bug in itl::map hinted insert and hinted add.
Stable {msvc-8.0, 9.0}.
Added:
sandbox/itl/boost/itl_xt/bits_gentor.hpp (contents, props changed)
sandbox/itl/boost/itl_xt/std/pair_gentor.hpp (contents, props changed)
sandbox/itl/boost/validate/driver/bit_collector_driver.hpp (contents, props changed)
sandbox/itl/boost/validate/type/bits.hpp (contents, props changed)
sandbox/itl/boost/validate/validater/bit_collector_validater.hpp (contents, props changed)
sandbox/itl/libs/validate/example/labat_bit_collector_/
sandbox/itl/libs/validate/example/labat_bit_collector_/labat_bit_collector.cpp (contents, props changed)
sandbox/itl/libs/validate/example/labat_bit_collector_/vc9_labat_bit_collector.vcproj (contents, props changed)
Text files modified:
sandbox/itl/boost/itl/functors.hpp | 106 +++++++++++------
sandbox/itl/boost/itl/map.hpp | 30 ----
sandbox/itl/boost/itl/map_algo.hpp | 244 ----------------------------------------
sandbox/itl/boost/itl/type_traits/to_string.hpp | 2
sandbox/itl/boost/itl/type_traits/type_to_string.hpp | 23 ++-
sandbox/itl/boost/itl_xt/list.hpp | 1
sandbox/itl/boost/itl_xt/seqgentor.hpp | 2
sandbox/itl/boost/itl_xt/std/pair.hpp | 1
sandbox/itl/boost/validate/driver/collector_driver.hpp | 5
sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp | 27 +--
sandbox/itl/boost/validate/gentor/randomgentor.hpp | 184 +++++++++++++++++++++++++----
sandbox/itl/boost/validate/gentor/rangegentor.hpp | 2
sandbox/itl/boost/validate/itl/functors.hpp | 2
sandbox/itl/boost/validate/laws/law_violations.hpp | 11 +
sandbox/itl/boost/validate/laws/monoid.hpp | 3
sandbox/itl/boost/validate/laws/set_laws.hpp | 51 +++++++-
sandbox/itl/boost/validate/laws/symmetric_difference.hpp | 30 ++--
sandbox/itl/boost/validate/type/nat.hpp | 1
sandbox/itl/boost/validate/validater/collector_validater.hpp | 4
sandbox/itl/boost/validate/validater/function_equality_validater.hpp | 2
sandbox/itl/boost/validate/validater/signed_quantifier_validater.hpp | 1
sandbox/itl/boost/validate/validation_counts.hpp | 8 +
sandbox/itl/libs/itl/build/win32/vc9_all.sln | 6
sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp | 2
sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp | 26 ++-
25 files changed, 364 insertions(+), 410 deletions(-)
Modified: sandbox/itl/boost/itl/functors.hpp
==============================================================================
--- sandbox/itl/boost/itl/functors.hpp (original)
+++ sandbox/itl/boost/itl/functors.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -303,6 +303,18 @@
//--------------------------------------------------------------------------
// Positive or negative functor trait
//--------------------------------------------------------------------------
+
+ // A binary operation - is negative (or inverting) with respect to the
+ // neutral element iff it yields the inverse element if it is applied to the
+ // neutron element:
+ // 0 - x = -x
+ // For a functor that wraps the inpleace of op-assign verision this is
+ // equivalent to
+ //
+ // T x = ..., y;
+ // y = Functor::neutron();
+ // Functor()(y, x); // y == inverse_of(x)
+
template<class Functor> struct is_negative;
template<class Functor>
@@ -329,51 +341,69 @@
//--------------------------------------------------------------------------
// Pro- or in-version functor
//--------------------------------------------------------------------------
- template<class Combiner> struct version;
+ template<class Combiner> struct conversion;
template<class Combiner>
- struct version
+ struct conversion
{
- typedef version<Combiner> type;
- typedef typename
- remove_const<
- typename remove_reference<typename Combiner::first_argument_type
- >::type
- >::type
- argument_type;
- // The pro-version of an contruction functor lets the value unchanged
- // 0 o= x == x;
- argument_type operator()(const argument_type& value){ return value; }
- };
+ typedef conversion<Combiner> type;
+ typedef typename
+ remove_const<
+ typename remove_reference<typename Combiner::first_argument_type
+ >::type
+ >::type
+ argument_type;
+ // The proversion of an op-assign functor o= lets the value unchanged
+ // (0 o= x) == x;
+ // Example += : (0 += x) == x
+ static argument_type proversion(const argument_type& value)
+ {
+ return value;
+ }
+
+ // The inversion of an op-assign functor o= inverts the value x
+ // to it's inverse element -x
+ // (0 o= x) == -x;
+ // Example -= : (0 -= x) == -x
+ static argument_type inversion(const argument_type& value)
+ {
+ argument_type inverse = Combiner::neutron();
+ Combiner()(inverse, value);
+ return inverse;
+ }
+ };
+
+ template<class Combiner> struct version : public conversion<Combiner>
+ {
+ typedef version<Combiner> type;
+ typedef conversion<Combiner> base_type;
+ typedef typename base_type::argument_type argument_type;
+
+ argument_type operator()(const argument_type& value)
+ { return base_type::proversion(value); }
+ };
+
+ template<>struct version<itl::inplace_minus<short > >{short operator()(short val){return -val;}};
+ template<>struct version<itl::inplace_minus<int > >{int operator()(int val){return -val;}};
+ template<>struct version<itl::inplace_minus<long > >{long operator()(long val){return -val;}};
+ template<>struct version<itl::inplace_minus<long long > >{long long operator()(long long val){return -val;}};
+ template<>struct version<itl::inplace_minus<float > >{float operator()(float val){return -val;}};
+ template<>struct version<itl::inplace_minus<double > >{double operator()(double val){return -val;}};
+ template<>struct version<itl::inplace_minus<long double> >{long double operator()(long double val){return -val;}};
template<class Type>
- struct version<itl::inplace_minus<Type> >
+ struct version<itl::inplace_minus<Type> > : public conversion<itl::inplace_minus<Type> >
{
- typedef version type;
- typedef itl::inplace_minus<Type> Combiner;
-
- Type operator()(const Type& value)
- {
- Type inverse = Combiner::neutron();
- Combiner()(inverse, value);
- return inverse;
- }
- };
+ typedef version<itl::inplace_minus<Type> > type;
+ typedef conversion<itl::inplace_minus<Type> > base_type;
+ typedef typename base_type::argument_type argument_type;
+
+ Type operator()(const Type& value)
+ {
+ return base_type::inversion(value);
+ }
+ };
- template<class Type>
- struct version<itl::inplace_bit_subtract<Type> >
- {
- typedef version type;
- typedef itl::inplace_bit_subtract<Type> Combiner;
-
- Type operator()(const Type& value)
- {
- Type inverse = Combiner::neutron();
- Combiner()(inverse, value);
- return inverse;
- }
- };
-
}} // namespace itl boost
Modified: sandbox/itl/boost/itl/map.hpp
==============================================================================
--- sandbox/itl/boost/itl/map.hpp (original)
+++ sandbox/itl/boost/itl/map.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -271,7 +271,7 @@
iterator insert(iterator prior, const value_type& value_pair)
{
if(Traits::absorbs_neutrons && value_pair.second == codomain_combine::neutron())
- return prior;
+ return end();
else
return base_type::insert(prior, value_pair);
}
@@ -459,39 +459,17 @@
return prior_;
iterator inserted_ = base_insert(prior_, value_type(val.first, Combiner::neutron()));
- Combiner()(inserted_->second, val.second);
- if(Traits::absorbs_neutrons && inserted_->second == Combiner::neutron())
- {
- erase(inserted_);
- return prior_;
- }
- else
- return inserted_;
-}
-
-/*JODO CONT
-template <class DomainT, class CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
- template <class Combiner>
-std::pair<typename map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>::iterator, bool>
- map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>
- ::add(iterator prior_, const domain_type& val, const codomain_type& co_val)
-{
- if(Traits::absorbs_neutrons && co_val == Combiner::neutron())
- return std::pair<iterator,bool>(prior_, false);
+ Combiner()(inserted_->second, val.second);
- iterator inserted_ = base_insert(prior_, value_type(val.first, Combiner::neutron()));
if(Traits::absorbs_neutrons && inserted_->second == Combiner::neutron())
{
erase(inserted_);
- return prior_;
+ return end();
}
else
- {
- Combiner()(inserted_->second, val.second);
return inserted_;
- }
}
-*/
+
//==============================================================================
//= Subtraction
Modified: sandbox/itl/boost/itl/map_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/map_algo.hpp (original)
+++ sandbox/itl/boost/itl/map_algo.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -184,250 +184,6 @@
return left_ == left.end() && right_ == right.end();
}
-/*CL
-//------------------------------------------------------------------------------
-template<class LeftT, class RightT>
-class subset_comparer
-{
-public:
- typedef typename LeftT::const_iterator LeftIterT;
- typedef typename RightT::const_iterator RightIterT;
-
- subset_comparer(const LeftT& left,
- const RightT& right,
- const LeftIterT& left_end,
- const RightIterT& right_end)
- : _left(left), _right(right),
- _left_end(left_end), _right_end(right_end),
- _compare_codomain(false), _result(equal)
- {}
-
- enum{nextboth, nextleft, nextright, stop};
-
- enum
- {
- unrelated = inclusion::unrelated,
- subset = inclusion::subset, // left is_subset_of right
- superset = inclusion::superset, // left is_superset_of right
- equal = inclusion::equal // equal = subset | superset
- };
-
- void set_compare_codomain(bool truth=true)
- { _compare_codomain = truth; }
-
- bool compare_codomain()const { return _compare_codomain; }
-
- int result()const{ return _result; }
-
-
- int co_compare(LeftIterT& left, RightIterT& right)
- {
- using namespace boost::mpl;
-
- return
- if_<
- bool_<is_concept_equivalent<is_interval_map,LeftT,RightT>::value>,
- map_codomain_compare<LeftT,RightT>,
- empty_codomain_compare<LeftT,RightT>
- >
- ::type::apply(left,right);
- }
-
- int restrict_result(int state) { return _result &= state; }
-
- int proceed(LeftIterT& left, RightIterT& right)
- {
- if(LeftT::key_value(left).upper_less(RightT::key_value(right)))
- { // left ..)
- // right .....)
- _prior_left = left;
- ++left;
- return nextleft;
- }
- else if(RightT::key_value(right).upper_less(LeftT::key_value(left)))
- { // left .....)
- // right ..)
- _prior_right = right;
- ++right;
- return nextright;
- }
- else//LeftT::key_value(left).upper_equal(RightT::key_value(right))
- { // left ..)
- // right ..)
- ++left;
- ++right;
- return nextboth;
- }
- }
-
- int next_both(LeftIterT& left, RightIterT& right)
- {
- if(left == _left_end && right == _right_end)
- return stop;
- else if(left == _left_end)
- { // left: ....end left could be subset
- // right:....[..
- restrict_result(subset);
- return stop;
- }
- else if(right == _right_end)
- { // left: ....[.. left could be superset
- // right:....end
- restrict_result(superset);
- return stop;
- }
- else if(LeftT::key_value(left).exclusive_less(RightT::key_value(right)))
- { // left: [..) . . .[---) left could be superset
- // right: [..).... if [---) exists
- restrict_result(superset);
- if(unrelated == _result)
- return stop;
- else
- {
- LeftIterT joint_ = _left.lower_bound(RightT::key_value(right));
- if(joint_ == _left.end())
- {
- _result = unrelated;
- return stop;
- }
- else
- {
- left = joint_;
- return nextboth;
- }
- }
- }
- else if(RightT::key_value(right).exclusive_less(LeftT::key_value(left)))
- { // left: [.. left could be subset
- // right:....) . . .[---) if [---) exists
- restrict_result(subset);
- if(unrelated == _result)
- return stop;
- else
- {
- RightIterT joint_ = _right.lower_bound(LeftT::key_value(left));
- if(joint_ == _right.end())
- {
- _result = unrelated;
- return stop;
- }
- else
- {
- right = joint_;
- return nextboth;
- }
- }
- }
-
- // left and right have intervals with nonempty intersection:
- if(compare_codomain())
- if(unrelated == restrict_result(co_compare(left,right)))
- return stop;
-
- // examine left borders only. Right borders are checked in proceed
- if(LeftT::key_value(left).lower_less(RightT::key_value(right)))
- { // left: ....[... left could be superset
- // right:.... [..
- if(unrelated == restrict_result(superset))
- return stop;
- }
- else if(RightT::key_value(right).lower_less(LeftT::key_value(left)))
- { // left: .... [.. left can be subset
- // right:....[...
- if(unrelated == restrict_result(subset))
- return stop;
- }
- //else LeftT::key_value(right).lower_equal(RightT::key_value(left))
- // left: ....[.. both can be equal
- // right:....[..
- // nothing to do: proceed
-
- return proceed(left, right);
- }
-
- int next_left(LeftIterT& left, RightIterT& right)
- {
- if(left == _left_end)
- { // left: ..)end left could be subset
- // right:......)
- restrict_result(subset);
- return stop;
- }
- else if(!LeftT::key_value(_prior_left).touches(LeftT::key_value(left)))
- { // left: ..) [..
- // right:.........)
- if(RightT::key_value(right).lower_less(LeftT::key_value(left)))
- { // ..) [.. left could be subset
- // ..........)
- if(unrelated == restrict_result(subset))
- return stop;
- }
- //else ..) [...
- // [..
- if(compare_codomain() && !LeftT::key_value(left).is_disjoint(RightT::key_value(right)) )
- if(unrelated == restrict_result(co_compare(left,right)))
- return stop;
- }
- else
- { // left: ..)[.. left could be subset
- // right:.......)
- if(compare_codomain() && !LeftT::key_value(left).is_disjoint(RightT::key_value(right)) )
- if(unrelated == restrict_result(co_compare(left,right)))
- return stop;
- }
-
- return proceed(left, right);
- }
-
-
- int next_right(LeftIterT& left, RightIterT& right)
- {
- if(right == _right_end)
- { // left: ......) left could be superset
- // right:..)end
- restrict_result(superset);
- return stop;
- }
- else if(!RightT::key_value(_prior_right).touches(RightT::key_value(right)))
- { // left: .........)
- // right:..) [..
- if(LeftT::key_value(left).lower_less(RightT::key_value(right)))
- { // [....) left could be superset
- // ..) [..
- if(unrelated == restrict_result(superset))
- return stop;
- }
- //else [....)
- // ..) [..
- if(compare_codomain() && !LeftT::key_value(left).is_disjoint(RightT::key_value(right)) )
- if(unrelated == restrict_result(co_compare(left,right)))
- return stop;
- }
- else
- {
- if(compare_codomain() && !LeftT::key_value(left).is_disjoint(RightT::key_value(right)) )
- if(unrelated == restrict_result(co_compare(left,right)))
- return stop;
- }
-
- return proceed(left, right);
- }
-
-private:
- const LeftT& _left;
- const RightT& _right;
- LeftIterT _left_end;
- RightIterT _right_end;
- bool _compare_codomain;
- LeftIterT _prior_left;
- RightIterT _prior_right;
- int _result;
-};
-
-
-
-*/
-
} // namespace Map
}} // namespace boost itl
Modified: sandbox/itl/boost/itl/type_traits/to_string.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/to_string.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/to_string.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -28,7 +28,7 @@
struct to_string
{
/** Converts all values of types to std::string that implement an operator << */
- static const std::string apply(const Type& value)
+ static std::string apply(const Type& value)
{
std::stringstream repr;
repr << value;
Modified: sandbox/itl/boost/itl/type_traits/type_to_string.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/type_to_string.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/type_to_string.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -28,14 +28,21 @@
//--------------------------------------------------------------------------
- template<>
- inline std::string type_to_string<int>::apply() { return "int"; }
- template<>
- inline std::string type_to_string<unsigned int>::apply() { return "int+"; }
- template<>
- inline std::string type_to_string<double>::apply() { return "dbl"; }
- template<>
- inline std::string type_to_string<std::string>::apply() { return "string"; }
+ template<>inline std::string type_to_string<char>::apply() { return "char"; }
+ template<>inline std::string type_to_string<short>::apply(){ return "short"; }
+ template<>inline std::string type_to_string<int>::apply() { return "int"; }
+ template<>inline std::string type_to_string<long>::apply() { return "long"; }
+ template<>inline std::string type_to_string<long long>::apply(){ return "Long"; }
+
+ template<>inline std::string type_to_string<unsigned char>::apply(){ return "char+"; }
+ template<>inline std::string type_to_string<unsigned short>::apply(){ return "short+"; }
+ template<>inline std::string type_to_string<unsigned int>::apply() { return "int+"; }
+ template<>inline std::string type_to_string<unsigned long>::apply() { return "long+"; }
+ template<>inline std::string type_to_string<unsigned long long>::apply(){ return "Long+"; }
+
+ template<>inline std::string type_to_string<float>::apply() { return "flt"; }
+ template<>inline std::string type_to_string<double>::apply() { return "dbl"; }
+ template<>inline std::string type_to_string<std::string>::apply() { return "string"; }
//-------------------------------------------------------------------------
template<template<class> class Templ>
Added: sandbox/itl/boost/itl_xt/bits_gentor.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl_xt/bits_gentor.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -0,0 +1,45 @@
+/*-----------------------------------------------------------------------------+
+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_XT_BITS_GENTOR_HPP_JOFA_091009
+#define BOOST_ITL_XT_BITS_GENTOR_HPP_JOFA_091009
+
+#include <boost/itl/type_traits/to_string.hpp>
+#include <boost/itl_xt/gentorit.hpp>
+#include <boost/itl_xt/numbergentor.hpp>
+#include <boost/validate/type/bits.hpp>
+
+namespace boost{namespace itl
+{
+
+
+template <class NaturalT>
+class bits_gentor: public RandomGentorAT<itl::bits<NaturalT> >
+{
+public:
+
+ typedef itl::bits<NaturalT> bits_type;
+
+ void some(bits_type& value)
+ {
+ value = bits_type(_natural_gentor(_value_range));
+ };
+
+ void set_range(const itl::interval<NaturalT>& range)
+ { _value_range = range; }
+
+private:
+ NumberGentorT<NaturalT> _natural_gentor;
+ itl::interval<NaturalT> _value_range;
+};
+
+
+}} // namespace itl boost
+
+#endif
+
+
Modified: sandbox/itl/boost/itl_xt/list.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/list.hpp (original)
+++ sandbox/itl/boost/itl_xt/list.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -322,7 +322,6 @@
else
{
iterator fromThis_ = cur_; fromThis_++;
- DataT dbg_from = *fromThis_;
iterator perm_ = first_common_element(fromThis_, end(), perm.begin(), perm.end());
if(perm_ == perm.end())
perm.push_front(cand);
Modified: sandbox/itl/boost/itl_xt/seqgentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/seqgentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/seqgentor.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -62,7 +62,7 @@
void setRangeOfSampleSize(int lwb, int upb)
{ m_sampleSizeRange = interval<int>::rightopen(lwb,upb); }
void setRangeOfSampleSize(const interval<int>& szRange)
- { BOOST_ASSERT(szRange.is_rightopen()); m_sampleSizeRange = szRange; }
+ { BOOST_ASSERT(szRange.is(itl::right_open)); m_sampleSizeRange = szRange; }
void setUnique(bool truth) { m_unique = truth; }
Modified: sandbox/itl/boost/itl_xt/std/pair.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/std/pair.hpp (original)
+++ sandbox/itl/boost/itl_xt/std/pair.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -22,7 +22,6 @@
std::basic_ostream<CharType, CharTraits>& operator <<
(std::basic_ostream<CharType, CharTraits>& stream, const std::pair<FirstT,SecondT>& object)
{
- typedef std::pair<FirstT,SecondT> ObjectT;
return stream << "(" << object.first << "," << object.second << ")";
}
Added: sandbox/itl/boost/itl_xt/std/pair_gentor.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl_xt/std/pair_gentor.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -0,0 +1,57 @@
+/*-----------------------------------------------------------------------------+
+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_XT_STD_PAIR_GENTOR_HPP_JOFA_091009
+#define BOOST_ITL_XT_STD_PAIR_GENTOR_HPP_JOFA_091009
+
+#include <boost/itl/type_traits/to_string.hpp>
+#include <boost/itl_xt/std/pair.hpp>
+#include <boost/itl_xt/gentorit.hpp>
+
+namespace boost{namespace itl
+{
+
+
+template <class FirstT, class SecondT>
+class std_pair_gentor: public RandomGentorAT<std::pair<FirstT,SecondT> >
+{
+public:
+
+ typedef std::pair<FirstT,SecondT> pair_type;
+
+ std_pair_gentor(): _first_gentor(NULL), _second_gentor(NULL) {}
+ ~std_pair_gentor() { delete _first_gentor; delete _second_gentor; }
+
+ void set_first_gentor(RandomGentorAT<FirstT>* gentor)
+ {
+ delete _first_gentor;
+ _first_gentor = gentor;
+ }
+
+ void set_second_gentor(RandomGentorAT<SecondT>* gentor)
+ {
+ delete _second_gentor;
+ _second_gentor = gentor;
+ }
+
+ void some(pair_type& value)
+ {
+ _first_gentor->some(value.first);
+ _second_gentor->some(value.second);
+ };
+
+private:
+ RandomGentorAT<FirstT>* _first_gentor;
+ RandomGentorAT<SecondT>* _second_gentor;
+};
+
+
+}} // namespace itl boost
+
+#endif
+
+
Added: sandbox/itl/boost/validate/driver/bit_collector_driver.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/validate/driver/bit_collector_driver.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -0,0 +1,145 @@
+/*-----------------------------------------------------------------------------+
+A Law Based Test Automaton 'LaBatea'
+Author: Joachim Faulhaber
+Copyright (c) 2007-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_VALIDATE_DRIVER_BIT_COLLECTOR_DRIVER_HPP_JOFA_091009
+#define BOOST_VALIDATE_DRIVER_BIT_COLLECTOR_DRIVER_HPP_JOFA_091009
+
+#include <iostream>
+#include <stdio.h>
+#include <time.h>
+#include <boost/validate/type/bits.hpp>
+#include <boost/validate/validater/collector_validater.hpp>
+#include <boost/validate/driver/itl_driver.hpp>
+#include <boost/validate/utility.hpp>
+
+namespace boost{namespace itl
+{
+
+ class bit_collector_driver : public itl_driver
+ {
+ public:
+ bit_collector_driver() { setProfile(); }
+
+ void setProfile()
+ {
+ setValid(true);
+ _rootChoice.setSize(RootType::Types_size);
+ _rootChoice.setMaxWeights(100);
+ _rootChoice[RootType::itl_set] = 0;
+ _rootChoice[RootType::interval_set] = 0;
+ _rootChoice[RootType::separate_interval_set] = 0;
+ _rootChoice[RootType::split_interval_set] = 0;
+ _rootChoice[RootType::itl_map] = 33;
+ _rootChoice[RootType::interval_map] = 33;
+ _rootChoice[RootType::split_interval_map] = 34;
+ setRootTypeNames();
+ _rootChoice.init();
+
+ _domainChoice.setSize(DomainType::DomainTypes_size);
+ _domainChoice.setMaxWeights(100);
+ _domainChoice[DomainType::Int] = 100;
+ _domainChoice[DomainType::Double] = 0;
+ setDomainTypeNames();
+ _domainChoice.init();
+
+ _codomainChoice.setSize(CodomainType::CodomainTypes_size);
+ _codomainChoice.setMaxWeights(100);
+ _codomainChoice[CodomainType::Int] = 100;
+ _codomainChoice[CodomainType::Double] = 0;
+ _codomainChoice[CodomainType::set_int] = 0;
+ setCodomainTypeNames();
+ _codomainChoice.init();
+
+ _neutronizerChoice.setSize(NeutronHandlerType::NeutronHandlerTypes_size);
+ _neutronizerChoice.setMaxWeights(100);
+ _neutronizerChoice[NeutronHandlerType::partial_absorber] = 50;
+ _neutronizerChoice[NeutronHandlerType::partial_enricher] = 50;
+ _neutronizerChoice[NeutronHandlerType::total_absorber] = 0;
+ _neutronizerChoice[NeutronHandlerType::total_enricher] = 0;
+ setNeutronHandlerTypeNames();
+ _neutronizerChoice.init();
+
+ if(!_rootChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _rootChoice.inconsitencyMessage("bit_collector_driver::setProfile()") << std::endl;
+ }
+
+ if(!_domainChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _domainChoice.inconsitencyMessage("bit_collector_driver::setProfile()") << std::endl;
+ }
+
+ if(!_codomainChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _codomainChoice.inconsitencyMessage("bit_collector_driver::setProfile()") << std::endl;
+ }
+
+ if(!_neutronizerChoice.is_consistent())
+ {
+ setValid(false);
+ std::cout << _neutronizerChoice.inconsitencyMessage("bit_collector_driver::setProfile()") << std::endl;
+ }
+
+ }
+
+
+ algebra_validater* chooseValidater()
+ {
+ int rootChoice = _rootChoice.some();
+ int neutronizerChoice = _neutronizerChoice.some();
+
+ switch(rootChoice)
+ {
+ ////-----------------------------------------------------------------
+ case RootType::itl_map: {
+ switch(neutronizerChoice) {
+ case NeutronHandlerType::partial_absorber:
+ return new collector_validater< itl::map<int, itl::bits8, partial_absorber, std::less, inplace_bit_add, inplace_bit_and> >;
+ case NeutronHandlerType::partial_enricher:
+ return new collector_validater< itl::map<int, itl::bits32, partial_enricher, std::less, inplace_bit_add, inplace_bit_and> >;
+ default: return choiceError(ITL_LOCATION("\nRootType::itl_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
+ }//switch neutronizerChoice
+ }//case itl_map
+ ////-----------------------------------------------------------------
+ case RootType::interval_map: {
+ switch(neutronizerChoice) {
+ case NeutronHandlerType::partial_absorber:
+ return new collector_validater<interval_map<int, itl::bits64, partial_absorber, std::less, inplace_bit_add, inplace_bit_and> >;
+ case NeutronHandlerType::partial_enricher:
+ return new collector_validater<interval_map<int, itl::bits16, partial_enricher, std::less, inplace_bit_add, inplace_bit_and> >;
+ default: return choiceError(ITL_LOCATION("\nRootType::interval_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
+ }//switch neutronizerChoice
+ }//case interval_map
+ ////-----------------------------------------------------------------
+ case RootType::split_interval_map: {
+ switch(neutronizerChoice) {
+ case NeutronHandlerType::partial_absorber:
+ return new collector_validater<split_interval_map<int, itl::bits32, partial_absorber, std::less, inplace_bit_add, inplace_bit_and> >;
+ case NeutronHandlerType::partial_enricher:
+ return new collector_validater<split_interval_map<double, itl::bits8, partial_enricher, std::less, inplace_bit_add, inplace_bit_and> >;
+ default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
+ }//switch neutronizerChoice
+ }//case split_interval_map
+ //-----------------------------------------------------------------
+
+ default: return choiceError(ITL_LOCATION("rootChoice:\n"), rootChoice, _rootChoice);
+ } //switch()
+
+ return NULL; //just to please the compiler ;)
+ }
+
+ };
+
+
+}} // namespace itl boost
+
+#endif // BOOST_VALIDATE_DRIVER_BIT_COLLECTOR_DRIVER_HPP_JOFA_091009
Modified: sandbox/itl/boost/validate/driver/collector_driver.hpp
==============================================================================
--- sandbox/itl/boost/validate/driver/collector_driver.hpp (original)
+++ sandbox/itl/boost/validate/driver/collector_driver.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -7,7 +7,8 @@
(See accompanying file LICENCE.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------------------------------------*/
-#pragma once
+#ifndef BOOST_VALIDATE_DRIVER_COLLECTOR_DRIVER_HPP_JOFA_091009
+#define BOOST_VALIDATE_DRIVER_COLLECTOR_DRIVER_HPP_JOFA_091009
#include <iostream>
#include <stdio.h>
@@ -24,7 +25,6 @@
public:
collector_driver() { setProfile(); }
-
void setProfile()
{
setValid(true);
@@ -140,3 +140,4 @@
}} // namespace itl boost
+#endif // BOOST_VALIDATE_DRIVER_COLLECTOR_DRIVER_HPP_JOFA_091009
Modified: sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp
==============================================================================
--- sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp (original)
+++ sandbox/itl/boost/validate/driver/map_copy_conformity_driver.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -36,9 +36,9 @@
_rootChoice[RootType::interval_set] = 0;
_rootChoice[RootType::separate_interval_set] = 0;
_rootChoice[RootType::split_interval_set] = 0;
- _rootChoice[RootType::itl_map] = 0;
- _rootChoice[RootType::interval_map] = 50;
- _rootChoice[RootType::split_interval_map] = 50;
+ _rootChoice[RootType::itl_map] = 33;
+ _rootChoice[RootType::interval_map] = 33;
+ _rootChoice[RootType::split_interval_map] = 34;
setRootTypeNames();
_rootChoice.init();
@@ -92,26 +92,23 @@
}
-
algebra_validater* chooseValidater()
{
int rootChoice = _rootChoice.some();
- //int domainChoice = _domainChoice.some(); // not used
- int codomainChoice = _codomainChoice.some();
int neutronizerChoice = _neutronizerChoice.some();
switch(rootChoice)
{
//-----------------------------------------------------------------
- //case RootType::itl_map: {
- // switch(neutronizerChoice) {
- // case NeutronHandlerType::partial_absorber: return new function_equality_validater<itl::list<std::pair<double,int> >, itl::map<int, int,partial_absorber> >;
- // case NeutronHandlerType::partial_enricher: return new function_equality_validater<itl::list<std::pair<double,int> >, itl::map<int, int,partial_enricher> >;
- // case NeutronHandlerType::total_absorber: return new function_equality_validater<itl::list<std::pair<int, int> >, itl::map<double,int,total_absorber > >;
- // case NeutronHandlerType::total_enricher: return new function_equality_validater<itl::list<std::pair<int, int> >, itl::map<double,int,total_enricher > >;
- // default: return choiceError(ITL_LOCATION("\nRootType::itl_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
- // }//switch neutronizerChoice
- //}//case itl_map
+ case RootType::itl_map: {
+ switch(neutronizerChoice) {
+ case NeutronHandlerType::partial_absorber: return new function_equality_validater<itl::list<std::pair<int,int> >, itl::map<int,int,partial_absorber> >;
+ case NeutronHandlerType::partial_enricher: return new function_equality_validater<itl::list<std::pair<int,int> >, itl::map<int,int,partial_enricher> >;
+ case NeutronHandlerType::total_absorber: return new function_equality_validater<itl::list<std::pair<int,int> >, itl::map<int,int,total_absorber > >;
+ case NeutronHandlerType::total_enricher: return new function_equality_validater<itl::list<std::pair<int,int> >, itl::map<int,int,total_enricher > >;
+ default: return choiceError(ITL_LOCATION("\nRootType::itl_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
+ }//switch neutronizerChoice
+ }//case itl_map
//-----------------------------------------------------------------
case RootType::interval_map: {
switch(neutronizerChoice) {
Modified: sandbox/itl/boost/validate/gentor/randomgentor.hpp
==============================================================================
--- sandbox/itl/boost/validate/gentor/randomgentor.hpp (original)
+++ sandbox/itl/boost/validate/gentor/randomgentor.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -10,12 +10,15 @@
#pragma once
+#include <limits>
#include <boost/itl/detail/notate.hpp>
#include <boost/itl_xt/numbergentor.hpp>
+#include <boost/itl_xt/bits_gentor.hpp>
#include <boost/itl_xt/setgentor.hpp>
#include <boost/itl_xt/mapgentor.hpp>
#include <boost/itl_xt/seqgentor.hpp>
#include <boost/itl_xt/itvgentor.hpp>
+#include <boost/itl_xt/std/pair_gentor.hpp>
#include <boost/itl_xt/map_segment_gentor.hpp>
#ifdef LAW_BASED_TEST_BOOST_POLYGON
@@ -44,10 +47,20 @@
template <> class RandomGentor<double> : public NumberGentorT<double> {};
// -------------------------------------------------------------------------
+ template <class NaturalT>
+ class RandomGentor<itl::bits<NaturalT> > :
+ public bits_gentor<itl::bits<NaturalT> > {};
+
+ // -------------------------------------------------------------------------
template <class DomainT>
class RandomGentor<itl::interval<DomainT> > :
public ItvGentorT<DomainT> {};
+ // -------------------------------------------------------------------------
+ template <class DomainT, class CodomainT>
+ class RandomGentor< std::pair<DomainT,CodomainT> > :
+ public std_pair_gentor<DomainT,CodomainT> {};
+
#ifdef LAW_BASED_TEST_BOOST_POLYGON
// -------------------------------------------------------------------------
template <class DomainT>
@@ -72,6 +85,10 @@
class RandomGentor<itl::list<std::pair<itl::interval<DomainT>, CodomainT> > > :
public SeqGentorT<itl::list<std::pair<itl::interval<DomainT>, CodomainT> > > {};
+ template <class DomainT, class CodomainT>
+ class RandomGentor<itl::list<std::pair<DomainT,CodomainT> > > :
+ public SeqGentorT<itl::list<std::pair<DomainT,CodomainT> > > {};
+
// ----- sets --------------------------------------------------------------
//template <class DomainT, template<class>class Set>
//class RandomGentor<Set<DomainT> > :
@@ -105,6 +122,11 @@
class RandomGentor<itl::map<DomainT,itl::set<int>,Neutronizer> > :
public MapGentorT<itl::map<DomainT,itl::set<int>,Neutronizer> > {};
+ template <class DomainT, class BitsT, class Neutronizer,
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section>
+ class RandomGentor<itl::map<DomainT,itl::bits<BitsT>,Neutronizer,Compare,Combine,Section> > :
+ public MapGentorT<itl::map<DomainT,itl::bits<BitsT>,Neutronizer,Compare,Combine,Section> > {};
+
template <class DomainT, class CodomainT, class Neutronizer>
class RandomGentor<itl::map<DomainT,CodomainT,Neutronizer> > :
public MapGentorT<itl::map<DomainT,CodomainT,Neutronizer> > {};
@@ -128,6 +150,24 @@
class RandomGentor<split_interval_map<DomainT,CodomainT,Neutronizer> > :
public MapGentorT<split_interval_map<DomainT,CodomainT,Neutronizer> > {};
+ // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
+ template <class NumericDomainT, class BitsT, class Neutronizer,
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section>
+ class RandomGentor<split_interval_map<NumericDomainT,itl::bits<BitsT>,Neutronizer,Compare,Combine,Section> > :
+ public MapGentorT<split_interval_map<NumericDomainT,itl::bits<BitsT>,Neutronizer,Compare,Combine,Section> > {};
+
+ template <class NumericDomainT, class BitsT, class Neutronizer,
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section>
+ class RandomGentor<interval_map<NumericDomainT,itl::bits<BitsT>,Neutronizer,Compare,Combine,Section> > :
+ public MapGentorT<interval_map<NumericDomainT,itl::bits<BitsT>,Neutronizer,Compare,Combine,Section> > {};
+
+ //NOTE: All trials to reduce code replication for RandomGentor
+ // and Calibrater by introducing a fancy
+ // template template IntervalMap shipwrecked due to compilers
+ // disability to resolve the resulting instantiations. Compilers
+ // always see ambiguities where there seems to be a resolution.
+
// ------------------------------------------------------------------------
// class template SomeValue:
@@ -189,6 +229,16 @@
}
};
+ template <class BitsT>
+ struct Calibrater<itl::bits<BitsT>, RandomGentor>
+ {
+ static void apply(RandomGentor<itl::bits<BitsT> >& gentor)
+ {
+ // Set the range within which the sizes of the generated object varies.
+ gentor.set_range(itl::interval<BitsT>::rightopen(0, sizeof BitsT));
+ }
+ };
+
template <>
struct Calibrater<itl::interval<int>, RandomGentor>
@@ -256,6 +306,12 @@
// lists
//--------------------------------------------------------------------------
template <>
+ struct Calibrater<std::pair<int,int>, RandomGentor>
+ {
+ static void apply(RandomGentor< std::pair<int,int> >& gentor){}
+ };
+
+ template <>
struct Calibrater<std::pair<itl::interval<int>, int>, RandomGentor>
{
static void apply(RandomGentor< std::pair<itl::interval<int>, int> >& gentor){}
@@ -285,6 +341,23 @@
};
template <>
+ struct Calibrater<itl::list<std::pair<int, int> >, RandomGentor>
+ {
+ static void apply(RandomGentor< itl::list< std::pair<int, int> > >& gentor)
+ {
+ gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
+ std_pair_gentor<int,int>* pair_gentor = new std_pair_gentor<int,int>;
+ NumberGentorT<int>* int_gentor_1 = new NumberGentorT<int>;
+ NumberGentorT<int>* int_gentor_2 = new NumberGentorT<int>;
+ int_gentor_1->setRange(GentorProfileSgl::it()->range_int());
+ int_gentor_2->setRange(GentorProfileSgl::it()->range_int());
+ pair_gentor->set_first_gentor(int_gentor_1);
+ pair_gentor->set_second_gentor(int_gentor_2);
+ gentor.setDomainGentor(pair_gentor);
+ }
+ };
+
+ template <>
struct Calibrater<itl::list<std::pair<itl::interval<int>, int> >, RandomGentor>
{
static void apply(RandomGentor< itl::list<std::pair<itl::interval<int>, int> > >& gentor)
@@ -338,7 +411,7 @@
ItvGentorT<int>* itvGentor = new ItvGentorT<int>;
interval<int> valRange = GentorProfileSgl::it()->range_interval_int();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
- itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength()); //JODO
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
gentor.setDomainGentor(itvGentor);
}
};
@@ -366,7 +439,7 @@
ItvGentorT<int>* itvGentor = new ItvGentorT<int>;
interval<int> valRange = GentorProfileSgl::it()->range_interval_int();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
- itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength()); //JODO
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
gentor.setDomainGentor(itvGentor);
}
};
@@ -383,7 +456,7 @@
ItvGentorT<double>* itvGentor = new ItvGentorT<double>;
interval<double> valRange = GentorProfileSgl::it()->range_interval_double();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
- itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength()); //JODO
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
gentor.setDomainGentor(itvGentor);
}
};
@@ -394,9 +467,6 @@
static void apply(RandomGentor<split_interval_set<int> >& gentor)
{
// Set the range within which the sizes of the generated object varies.
- // interval<int> range = rightOpenInterval<int>(0,10); //JODO: From SysCalibrater
- //JODO gentor.calibrate(profile);
-
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
// If it is a container: (Create and) Pass the generator(s) for their contents
@@ -404,7 +474,7 @@
ItvGentorT<int>* itvGentor = new ItvGentorT<int>;
interval<int> valRange = GentorProfileSgl::it()->range_interval_int();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
- itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength()); //JODO
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
gentor.setDomainGentor(itvGentor);
}
};
@@ -421,7 +491,7 @@
ItvGentorT<double>* itvGentor = new ItvGentorT<double>;
interval<double> valRange = GentorProfileSgl::it()->range_interval_double();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
- itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength()); //JODO
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
gentor.setDomainGentor(itvGentor);
}
};
@@ -455,9 +525,6 @@
static void apply(RandomGentor<itl::map<NumericDomainT,itl::set<int>,Neutronizer> >& gentor)
{
// Set the range within which the sizes of the generated object varies.
- // interval<int> range = rightOpenInterval<int>(0,10); //JODO: From SysCalibrater
- //JODO gentor.calibrate(profile);
-
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
// If it is a container: (Create and) Pass the generator(s) for their contents
@@ -495,6 +562,27 @@
}
};
+ template <typename NumericDomainT, typename BitsT, class Neutronizer,
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section>
+ struct Calibrater<itl::map<NumericDomainT,itl::bits<BitsT>,Neutronizer,
+ Compare,Combine,Section>, RandomGentor>
+ {
+ static void apply(RandomGentor<itl::map<NumericDomainT,itl::bits<BitsT>,Neutronizer,
+ Compare,Combine,Section> >& gentor)
+ {
+ gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
+
+ // If it is a container: (Create and) Pass the generator(s) for their contents
+ // NumberGentorT<int> intGentor;
+ NumberGentorT<NumericDomainT>* domainGentor = new NumberGentorT<NumericDomainT>;
+ bits_gentor<BitsT>* codomainGentor = new bits_gentor<BitsT>;
+ domainGentor->setRange(GentorProfileSgl_numeric_range<NumericDomainT>::get());
+ codomainGentor->set_range(interval<BitsT>::closed(0, (numeric_limits<BitsT>::max)()));
+ gentor.setDomainGentor(domainGentor);
+ gentor.setCodomainGentor(codomainGentor);
+ }
+ };
+
//----------------------------------------------------------------------------
// itl::interval_map<DomainT,CodomainT,Neutronizer>
@@ -505,9 +593,6 @@
static void apply(RandomGentor<interval_map<NumericDomainT,itl::set<int>,Neutronizer> >& gentor)
{
// Set the range within which the sizes of the generated object varies.
- // interval<int> range = rightOpenInterval<int>(0,10); //JODO: From SysCalibrater
- //JODO gentor.calibrate(profile);
-
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
// If it is a container: (Create and) Pass the generator(s) for their contents
@@ -515,7 +600,7 @@
ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
- itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength()); //JODO
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
SetGentorT<itl::set<int> >* codomainGentor = new SetGentorT<itl::set<int> >;
NumberGentorT<int>* elementGentor = new NumberGentorT<int>;
@@ -535,9 +620,6 @@
static void apply(RandomGentor<interval_map<NumericDomainT,NumericCodomainT,Neutronizer> >& gentor)
{
// Set the range within which the sizes of the generated object varies.
- // interval<int> range = rightOpenInterval<int>(0,10); //JODO: From SysCalibrater
- //JODO gentor.calibrate(profile);
-
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
// If it is a container: (Create and) Pass the generator(s) for their contents
@@ -545,7 +627,7 @@
ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
- itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength()); //JODO
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
NumberGentorT<NumericCodomainT>* codomainGentor = new NumberGentorT<NumericCodomainT>;
codomainGentor->setRange(GentorProfileSgl_numeric_range<NumericCodomainT>::get());
@@ -584,15 +666,13 @@
}
};
- template <typename NumericDomainT, typename NumericCodomainT, class Neutronizer>
- struct Calibrater<split_interval_map<NumericDomainT,NumericCodomainT,Neutronizer>, RandomGentor>
+ template <typename NumericDomainT, typename NumericCodomainT, class Neutronizer,
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section>
+ struct Calibrater<split_interval_map<NumericDomainT,NumericCodomainT,Neutronizer,Compare,Combine,Section>, RandomGentor>
{
- static void apply(RandomGentor<split_interval_map<NumericDomainT,NumericCodomainT,Neutronizer> >& gentor)
+ static void apply(RandomGentor<split_interval_map<NumericDomainT,NumericCodomainT,Neutronizer,Compare,Combine,Section> >& gentor)
{
// Set the range within which the sizes of the generated object varies.
- // interval<int> range = rightOpenInterval<int>(0,10); //JODO: From SysCalibrater
- //JODO gentor.calibrate(profile);
-
gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
// If it is a container: (Create and) Pass the generator(s) for their contents
@@ -600,7 +680,7 @@
ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
itvGentor->setValueRange(valRange.lower(), valRange.upper());
- itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength()); //JODO
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
NumberGentorT<NumericCodomainT>* codomainGentor = new NumberGentorT<NumericCodomainT>;
codomainGentor->setRange(GentorProfileSgl_numeric_range<NumericCodomainT>::get());
@@ -609,6 +689,58 @@
gentor.setCodomainGentor(codomainGentor);
}
};
+
+
+ template <typename NumericDomainT, typename BitsT, class Neutronizer,
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section>
+ struct Calibrater<interval_map<NumericDomainT,itl::bits<BitsT>,
+ Neutronizer,Compare,Combine,Section>, RandomGentor>
+ {
+ static void apply(RandomGentor<interval_map<NumericDomainT,itl::bits<BitsT>,
+ Neutronizer,Compare,Combine,Section> >& gentor)
+ {
+ gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
+
+ // If it is a container: (Create and) Pass the generator(s) for their contents
+ // NumberGentorT<int> intGentor;
+ ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
+ interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
+ itvGentor->setValueRange(valRange.lower(), valRange.upper());
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
+
+ bits_gentor<BitsT>* codomainGentor = new bits_gentor<BitsT>;
+ codomainGentor->set_range(interval<BitsT>::closed(0, (numeric_limits<BitsT>::max)()));
+
+ gentor.setDomainGentor(itvGentor);
+ gentor.setCodomainGentor(codomainGentor);
+ }
+ };
+
+ template <typename NumericDomainT, typename BitsT, class Neutronizer,
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section>
+ struct Calibrater<split_interval_map<NumericDomainT,itl::bits<BitsT>,
+ Neutronizer,Compare,Combine,Section>, RandomGentor>
+ {
+ static void apply(RandomGentor<split_interval_map<NumericDomainT,itl::bits<BitsT>,
+ Neutronizer,Compare,Combine,Section> >& gentor)
+ {
+ gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
+
+ // If it is a container: (Create and) Pass the generator(s) for their contents
+ // NumberGentorT<int> intGentor;
+ ItvGentorT<NumericDomainT>* itvGentor = new ItvGentorT<NumericDomainT>;
+ interval<NumericDomainT> valRange = GentorProfileSgl_numeric_range<NumericDomainT>::get();
+ itvGentor->setValueRange(valRange.lower(), valRange.upper());
+ itvGentor->setMaxIntervalLength(GentorProfileSgl::it()->maxIntervalLength());
+
+ bits_gentor<BitsT>* codomainGentor = new bits_gentor<BitsT>;
+ codomainGentor->set_range(interval<BitsT>::closed(0, (numeric_limits<BitsT>::max)()));
+
+ gentor.setDomainGentor(itvGentor);
+ gentor.setCodomainGentor(codomainGentor);
+ }
+ };
// ---------------------------------------------------------------------------
+
}} // namespace itl boost
Modified: sandbox/itl/boost/validate/gentor/rangegentor.hpp
==============================================================================
--- sandbox/itl/boost/validate/gentor/rangegentor.hpp (original)
+++ sandbox/itl/boost/validate/gentor/rangegentor.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -37,8 +37,6 @@
namespace boost{namespace itl
{
- //JODO: RangeGentor is similat to ItvGentorT. RangeGentor might be replaced by ItvGentorT
- // with some modifications applied to ItvGentorT.
template <class Type>
class RangeGentor: public RandomGentorAT<interval<Type> >
Modified: sandbox/itl/boost/validate/itl/functors.hpp
==============================================================================
--- sandbox/itl/boost/validate/itl/functors.hpp (original)
+++ sandbox/itl/boost/validate/itl/functors.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -63,7 +63,7 @@
template<>
inline std::string binary_template_to_string<copy_insertion>::apply() { return "ci"; }
-/*JODO URG
+/*JODO
template <typename SourceT, typename TargetT>
struct trans_insertion
{
Modified: sandbox/itl/boost/validate/laws/law_violations.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/law_violations.hpp (original)
+++ sandbox/itl/boost/validate/laws/law_violations.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -40,7 +40,7 @@
public:
PolyLawViolations(): p_violations(NULL){}
PolyLawViolations(LawViolationsI* vios): p_violations(vios) {}
- ~PolyLawViolations() {} //JODO delete p_violations; }
+ ~PolyLawViolations() {}
void destroy() { delete p_violations; p_violations = NULL; }
@@ -170,6 +170,15 @@
size_t _violationsCount;
};
+
+template<class CharType, class CharTraits>
+std::basic_ostream<CharType, CharTraits>& operator <<
+ (std::basic_ostream<CharType, CharTraits>& stream, const PolyLawViolations& object)
+{
+ return stream << "operator<<: not implemented for itl::PolyLawViolations!";
+}
+
+
}} // namespace itl boost
#endif //BOOST_ITL_LAW_VIOLATIONS_HPP_JOFA_070411
Modified: sandbox/itl/boost/validate/laws/monoid.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/monoid.hpp (original)
+++ sandbox/itl/boost/validate/laws/monoid.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -159,9 +159,6 @@
// ---------------------------------------------------------------------------
// Inplace variant of laws for operator o=
// ---------------------------------------------------------------------------
- //JODO MEMO USENET: Kein Patternmatching auf templateparameter-level! Beispiel
- // TypeAsString!
- //template <typename Type, template<class>class Accumulator = inplace_plus, int aux=0>
template <typename Type, template<class>class Accumulator = inplace_plus, template<class>class NeutronT = neutron>
class InplaceNeutrality
: public Law<InplaceNeutrality<Type,Accumulator,NeutronT>,
Modified: sandbox/itl/boost/validate/laws/set_laws.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/set_laws.hpp (original)
+++ sandbox/itl/boost/validate/laws/set_laws.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -118,11 +118,12 @@
};
// ---------------------------------------------------------------------------
- template <typename Type, template<class>class Operator1 = inplace_plus,
- template<class>class Operator2 = inplace_et,
- template<class>class Equality = itl::std_equal>
+ template <typename Type, template<class>class Operator1 = inplace_plus,
+ template<class>class Operator2 = inplace_et,
+ template<class>class Subtraction = inplace_minus,
+ template<class>class Equality = itl::std_equal>
class InplaceDeMorgan
- : public Law<InplaceDeMorgan<Type,Operator1,Operator2,Equality>,
+ : public Law<InplaceDeMorgan<Type,Operator1,Operator2,Subtraction,Equality>,
LOKI_TYPELIST_3(Type,Type,Type), LOKI_TYPELIST_2(Type,Type)>
{
/** a - (b + c) == (a - b) & (a - c)
@@ -154,14 +155,14 @@
// lhs := a - (b + c)
Type lhs = this->template getInputValue<operand_a>();
- lhs -= b_plus_c;
+ Subtraction<Type>()(lhs, b_plus_c);
// --- right hand side -----------------------
Type a_minus_b = this->template getInputValue<operand_a>();
- a_minus_b -= this->template getInputValue<operand_b>();
+ Subtraction<Type>()(a_minus_b, this->template getInputValue<operand_b>());
Type a_minus_c = this->template getInputValue<operand_a>();
- a_minus_c -= this->template getInputValue<operand_c>();
+ Subtraction<Type>()(a_minus_c, this->template getInputValue<operand_c>());
// rhs := (a - b) & (a - c)
Type rhs = a_minus_b;
@@ -173,7 +174,41 @@
return Equality<Type>()(lhs, rhs);
}
- bool debug_holds(){ return holds(); }
+ bool debug_holds()
+ {
+ // a - (b + c) == (a - b) & (a - c)
+ Type val_a = this->template getInputValue<operand_a>();
+ Type val_b = this->template getInputValue<operand_b>();
+ Type val_c = this->template getInputValue<operand_c>();
+ cout << "a = " << val_a << endl;
+ cout << "b = " << val_b << endl;
+ cout << "c = " << val_c << endl;
+ // --- left hand side ------------------------
+ Type b_plus_c = val_b;
+ Operator1<Type>()(b_plus_c, val_c);
+
+ // lhs := a - (b + c)
+ Type lhs = this->template getInputValue<operand_a>();
+ Subtraction<Type>()(lhs, b_plus_c);
+
+ // --- right hand side -----------------------
+ Type a_minus_b = this->template getInputValue<operand_a>();
+ Subtraction<Type>()(a_minus_b, this->template getInputValue<operand_b>());
+ cout << "a-b = " << a_minus_b << endl;
+
+ Type a_minus_c = this->template getInputValue<operand_a>();
+ Subtraction<Type>()(a_minus_c, this->template getInputValue<operand_c>());
+ cout << "a-c = " << a_minus_c << endl;
+
+ // rhs := (a - b) & (a - c)
+ Type rhs = a_minus_b;
+ Operator2<Type>()(rhs, a_minus_c);
+
+ this->template setOutputValue<lhs_result>(lhs);
+ this->template setOutputValue<rhs_result>(rhs);
+
+ return Equality<Type>()(lhs, rhs);
+ }
size_t size()const
{
Modified: sandbox/itl/boost/validate/laws/symmetric_difference.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/symmetric_difference.hpp (original)
+++ sandbox/itl/boost/validate/laws/symmetric_difference.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -18,7 +18,11 @@
{
// ---------------------------------------------------------------------------
- template <typename Type, template<class>class Equality = itl::std_equal>
+ template <typename Type,
+ template<class>class Addition = itl::inplace_plus,
+ template<class>class Subtraction = itl::inplace_minus,
+ template<class>class Intersection = itl::inplace_et,
+ template<class>class Equality = itl::std_equal>
class InplaceSymmetricDifference
: public Law<InplaceSymmetricDifference<Type>,
LOKI_TYPELIST_2(Type,Type), LOKI_TYPELIST_2(Type,Type)>
@@ -44,23 +48,23 @@
{
// --- left hand side ------------------------
Type a_plus_b = this->template getInputValue<operand_a>();
- a_plus_b += this->template getInputValue<operand_b>();
+ Addition<Type>()(a_plus_b, this->template getInputValue<operand_b>());
Type a_sec_b = this->template getInputValue<operand_a>();
- a_sec_b &= this->template getInputValue<operand_b>();
+ Intersection<Type>()(a_sec_b, this->template getInputValue<operand_b>());
Type lhs = a_plus_b;
- lhs -= a_sec_b;
+ Subtraction<Type>()(lhs, a_sec_b);
// --- right hand side -----------------------
Type a_minus_b = this->template getInputValue<operand_a>();
- a_minus_b -= this->template getInputValue<operand_b>();
+ Subtraction<Type>()(a_minus_b, this->template getInputValue<operand_b>());
Type b_minus_a = this->template getInputValue<operand_b>();
- b_minus_a -= this->template getInputValue<operand_a>();
+ Subtraction<Type>()(b_minus_a, this->template getInputValue<operand_a>());
Type rhs = a_minus_b;
- rhs += b_minus_a;
+ Addition<Type>()(rhs, b_minus_a);
this->template setOutputValue<lhs_result>(lhs);
this->template setOutputValue<rhs_result>(rhs);
@@ -73,31 +77,31 @@
{
// --- left hand side ------------------------
Type a_plus_b = this->template getInputValue<operand_a>();
- a_plus_b += this->template getInputValue<operand_b>();
+ Addition<Type>()(a_plus_b, this->template getInputValue<operand_b>());
std::cout << "a_plus_b=" << a_plus_b.as_string() << std::endl;
Type a_sec_b = this->template getInputValue<operand_a>();
- a_sec_b &= this->template getInputValue<operand_b>();
+ Intersection<Type>()(a_sec_b, this->template getInputValue<operand_b>());
std::cout << "a_sec_b=" << a_sec_b.as_string() << std::endl;
Type lhs = a_plus_b;
- lhs -= a_sec_b;
+ Subtraction<Type>()(lhs, a_sec_b);
std::cout << "lhs=" << lhs.as_string() << std::endl;
// --- right hand side -----------------------
Type a_minus_b = this->template getInputValue<operand_a>();
- a_minus_b -= this->template getInputValue<operand_b>();
+ Subtraction<Type>()(a_minus_b, this->template getInputValue<operand_b>());
std::cout << "a_minus_b=" << a_minus_b.as_string() << std::endl;
Type b_minus_a = this->template getInputValue<operand_b>();
- b_minus_a -= this->template getInputValue<operand_a>();
+ Subtraction<Type>()(b_minus_a, this->template getInputValue<operand_a>());
std::cout << "b_minus_a=" << b_minus_a.as_string() << std::endl;
Type rhs = a_minus_b;
- rhs += b_minus_a;
+ Addition<Type>()(rhs, b_minus_a);
std::cout << "rhs=" << rhs.as_string() << std::endl;
this->template setOutputValue<lhs_result>(lhs);
Added: sandbox/itl/boost/validate/type/bits.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/validate/type/bits.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -0,0 +1,76 @@
+/*-----------------------------------------------------------------------------+
+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_XT_TEST_BITS_HPP_JOFA_091009
+#define BOOST_ITL_XT_TEST_BITS_HPP_JOFA_091009
+
+#include <boost/itl/type_traits/type_to_string.hpp>
+#include <boost/itl/type_traits/to_string.hpp>
+#include <boost/itl/type_traits/is_set.hpp>
+#include <boost/itl/detail/relation_state.hpp>
+
+namespace boost{namespace itl
+{
+
+template<class NaturalT> class bits
+{
+public:
+ bits():_bits(){}
+ explicit bits(NaturalT value):_bits(value){}
+
+ NaturalT number()const{ return _bits; }
+ bits& operator |= (const bits& value){_bits |= value._bits; return *this;}
+ bits& operator &= (const bits& value){_bits &= value._bits; return *this;}
+ bits& operator ^= (const bits& value){_bits ^= value._bits; return *this;}
+ bits operator ~ ()const { return bits(~_bits); }
+ bool operator < (const bits& value)const{return _bits < value._bits;}
+ bool operator == (const bits& value)const{return _bits == value._bits;}
+
+private:
+ NaturalT _bits;
+};
+
+typedef bits<unsigned char> bits8;
+typedef bits<unsigned short> bits16;
+typedef bits<unsigned long> bits32;
+typedef bits<unsigned long long> bits64;
+
+template<class NaturalT>
+int inclusion_compare(itl::bits<NaturalT> left, itl::bits<NaturalT> right)
+{
+ if(0 ==(left.number() & right.number())) return inclusion::unrelated;
+ else if(left.number() < right.number() ) return inclusion::subset;
+ else if(left.number() > right.number() ) return inclusion::superset;
+ else return inclusion::equal;
+}
+
+
+template<class CharType, class CharTraits, class NaturalT>
+std::basic_ostream<CharType, CharTraits>& operator <<
+(std::basic_ostream<CharType, CharTraits>& stream, const itl::bits<NaturalT>& object)
+{
+ return stream << object.number();
+}
+
+template<class NaturalT>
+struct is_set<bits<NaturalT> >
+{
+ typedef is_set<bits<NaturalT> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+};
+
+template <>struct type_to_string<itl::bits<unsigned char> > {static std::string apply(){ return "bit8"; }};
+template <>struct type_to_string<itl::bits<unsigned short> >{static std::string apply(){ return "bit16"; }};
+template <>struct type_to_string<itl::bits<unsigned int> > {static std::string apply(){ return "bit32"; }};
+template <>struct type_to_string<itl::bits<unsigned long> > {static std::string apply(){ return "bitl32"; }};
+template <>struct type_to_string<itl::bits<unsigned long long> > {static std::string apply(){ return "bit64"; }};
+
+
+}} // namespace itl boost
+
+#endif // BOOST_ITL_LIBS_VALIDATE_TEST_BITS_HPP_JOFA_091009
Modified: sandbox/itl/boost/validate/type/nat.hpp
==============================================================================
--- sandbox/itl/boost/validate/type/nat.hpp (original)
+++ sandbox/itl/boost/validate/type/nat.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -53,7 +53,6 @@
return *this;
}
- //CL
operator int()const{ return (_value); }
std::string as_string()const { return to_string<int>::apply(_value); }
Added: sandbox/itl/boost/validate/validater/bit_collector_validater.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/validate/validater/bit_collector_validater.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -0,0 +1,139 @@
+/*-----------------------------------------------------------------------------+
+A Law Based Test Automaton 'LaBatea'
+Author: Joachim Faulhaber
+Copyright (c) 2007-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_VALIDATE_VALIDATER_BIT_COLLECTOR_VALIDATER_HPP_JOFA_091009
+#define BOOST_VALIDATE_VALIDATER_BIT_COLLECTOR_VALIDATER_HPP_JOFA_091009
+
+#include <boost/itl/functors.hpp>
+#include <boost/validate/laws/monoid.hpp>
+#include <boost/validate/laws/inversion_laws.hpp>
+#include <boost/validate/laws/symmetric_difference.hpp>
+#include <boost/validate/laws/set_laws.hpp>
+#include <boost/validate/validater/law_validater.hpp>
+#include <boost/validate/validater/algebra_validater.hpp>
+
+namespace boost{namespace itl
+{
+
+typedef WeightedNumberGentor<int> ChoiceT;
+
+template <typename Type>
+class collector_validater : public algebra_validater
+{
+public:
+
+ enum Laws
+ {
+ inplacePlusAssociativity,
+ inplacePlusNeutrality,
+ inplacePlusCommutativity,
+ inplaceEtAssociativity,
+ inplaceEtCommutativity,
+ inplaceNaturalInversion,
+ inplaceSymmetricDifference,
+ inplaceFlip,
+ inplacePlusDistributivity,
+ inplaceEtDistributivity,
+ inplacePlusDashRightDistrib,
+ inplaceEtDashRightDistrib,
+ inplacePlusDeMorgan,
+ inplaceEtDeMorgan,
+ Laws_size
+ };
+
+ collector_validater() {setProfile();}
+
+ void setProfile()
+ {
+ const int sum_of_shares = 100;
+ _lawChoice.setSize(Laws_size);
+ _lawChoice.setMaxWeights(sum_of_shares);
+
+ int rest_shares = sum_of_shares, item_index = 0;
+ _lawChoice[inplacePlusAssociativity] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplacePlusNeutrality] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplacePlusCommutativity] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplaceEtAssociativity] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplaceEtCommutativity] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplaceNaturalInversion] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplaceSymmetricDifference] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplaceFlip] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplacePlusDistributivity] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplaceEtDistributivity] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplacePlusDashRightDistrib]= share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplaceEtDashRightDistrib] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplacePlusDeMorgan] = share(Laws_size, item_index, rest_shares);
+ _lawChoice[inplaceEtDeMorgan] = share(Laws_size, item_index, rest_shares);
+ _lawChoice.init();
+ }
+
+
+ //JODO DEL complete: spezielle instanzen werden nicht benoetigt!
+ LawValidaterI* chooseValidater()
+ {
+ switch(_lawChoice.some())
+ {
+ case inplacePlusAssociativity: return new LawValidater<InplaceAssociativity<Type, inplace_bit_add>, RandomGentor>;
+ case inplacePlusNeutrality: return new LawValidater<InplaceNeutrality <Type, inplace_bit_add>, RandomGentor>;
+ case inplacePlusCommutativity: return new LawValidater<InplaceCommutativity<Type, inplace_bit_add>, RandomGentor>;
+ case inplaceEtAssociativity: return new LawValidater<InplaceAssociativity<Type, inplace_bit_and>, RandomGentor>;
+ case inplaceEtCommutativity: return new LawValidater<InplaceCommutativity<Type, inplace_bit_and>, RandomGentor>;
+ case inplaceSymmetricDifference:return new LawValidater<InplaceSymmetricDifference<Type, inplace_bit_add, inplace_bit_subtract, inplace_bit_and>, RandomGentor>;
+ case inplaceFlip: return new LawValidater<InplaceFlip<Type>, RandomGentor>;
+ case inplaceEtDistributivity:
+ if(itl::is_interval_splitter<Type>::value && absorbs_neutrons<Type>::value && !is_total<Type>::value)
+ return new LawValidater<InplaceDistributivity<Type, inplace_bit_and, inplace_bit_add, element_equal>, RandomGentor>;
+ else return new LawValidater<InplaceDistributivity<Type, inplace_bit_and, inplace_bit_add, std_equal>, RandomGentor>;
+ case inplacePlusDashRightDistrib:
+ if(itl::is_interval_splitter<Type>::value && absorbs_neutrons<Type>::value && !is_total<Type>::value)
+ return new LawValidater<InplaceRightDistributivity<Type, inplace_bit_add, inplace_bit_subtract, element_equal>, RandomGentor>;
+ else return new LawValidater<InplaceRightDistributivity<Type, inplace_bit_add, inplace_bit_subtract, std_equal>, RandomGentor>;
+ case inplaceEtDashRightDistrib: return new LawValidater<InplaceRightDistributivity<Type, inplace_bit_and, inplace_bit_subtract>, RandomGentor>;
+ case inplacePlusDeMorgan: return new LawValidater<InplaceDeMorgan<Type, inplace_bit_add, inplace_bit_and, inplace_bit_subtract, itl::std_equal>, RandomGentor>;
+ case inplaceEtDeMorgan:
+ if(itl::is_interval_splitter<Type>::value || itl::is_interval_separator<Type>::value)
+ return new LawValidater<InplaceDeMorgan<Type, inplace_bit_and, inplace_bit_add, inplace_bit_subtract, itl::element_equal>, RandomGentor>;
+ else return new LawValidater<InplaceDeMorgan<Type, inplace_bit_and, inplace_bit_add, inplace_bit_subtract, itl::std_equal>, RandomGentor>;
+
+ default: return NULL;
+ }
+ }
+
+ void validate()
+ {
+ _validater = chooseValidater();
+ if(_validater)
+ {
+ _validater->run();
+ _validater->addFrequencies(_frequencies);
+ _validater->addViolations(_violationsCount, _violations);
+ delete _validater;
+ }
+ }
+
+ void addFrequencies(ValidationCounterT& summary) { summary += _frequencies; }
+ void addViolations(ViolationCounterT& summary, ViolationMapT& collector)
+ {
+ summary += _violationsCount;
+ collector += _violations;
+ }
+
+
+private:
+ ChoiceT _lawChoice;
+ LawValidaterI* _validater;
+ ValidationCounterT _frequencies;
+ ViolationCounterT _violationsCount;
+ ViolationMapT _violations;
+};
+
+
+}} // namespace itl boost
+
+#endif BOOST_VALIDATE_VALIDATER_BIT_COLLECTOR_VALIDATER_HPP_JOFA_091009
Modified: sandbox/itl/boost/validate/validater/collector_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/collector_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/collector_validater.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -92,8 +92,8 @@
if(itl::is_interval_splitter<Type>::value && absorbs_neutrons<Type>::value && !is_total<Type>::value)
return new LawValidater<InplaceRightDistributivity<Type, inplace_plus, inplace_minus, element_equal>, RandomGentor>;
else return new LawValidater<InplaceRightDistributivity<Type, inplace_plus, inplace_minus, std_equal>, RandomGentor>;
- case inplaceEtDashRightDistrib: return new LawValidater<InplaceRightDistributivity<Type, inplace_et, inplace_minus>, RandomGentor>;
- case inplacePlusDeMorgan: return new LawValidater<InplaceDeMorgan<Type, inplace_plus, inplace_et, itl::std_equal>, RandomGentor>;
+ case inplaceEtDashRightDistrib: return new LawValidater<InplaceRightDistributivity<Type, inplace_et, inplace_minus>, RandomGentor>;
+ case inplacePlusDeMorgan: return new LawValidater<InplaceDeMorgan<Type, inplace_plus, inplace_et, itl::std_equal>, RandomGentor>;
case inplaceEtDeMorgan:
if(itl::is_interval_splitter<Type>::value || itl::is_interval_separator<Type>::value)
return new LawValidater<InplaceDeMorgan<Type, inplace_et, inplace_plus, itl::element_equal>, RandomGentor>;
Modified: sandbox/itl/boost/validate/validater/function_equality_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/function_equality_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/function_equality_validater.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -74,7 +74,7 @@
void addFrequencies(ValidationCounterT& summary) { summary += _frequencies; }
void addViolations(ViolationCounterT& summary, ViolationMapT& collector)
{
- summary += _violationsCount;
+ summary += _violationsCount;
collector += _violations;
}
Modified: sandbox/itl/boost/validate/validater/signed_quantifier_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/signed_quantifier_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/signed_quantifier_validater.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -61,7 +61,6 @@
if(!is_total<Type>::value && absorbs_neutrons<Type>::value)
et_assoc_share = 0;
//NOTE: An Inverse exists only for a total signed quantifier
- //CL if(!is_total<Type>::value)
if(!is_total<Type>::value || !has_inverse<typename Type::codomain_type>::value)
inv_ex_share = 0;
Modified: sandbox/itl/boost/validate/validation_counts.hpp
==============================================================================
--- sandbox/itl/boost/validate/validation_counts.hpp (original)
+++ sandbox/itl/boost/validate/validation_counts.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -39,6 +39,14 @@
bool operator == (const validation_counts& left, const validation_counts& right)
{ return left.time()==right.time() && left.count()==right.count(); }
+template<class CharType, class CharTraits>
+std::basic_ostream<CharType, CharTraits>& operator <<
+ (std::basic_ostream<CharType, CharTraits>& stream, const validation_counts& object)
+{
+ return stream << "(time=" << object.time() << "count=" << object.count() << ")";
+}
+
+
}} // namespace itl boost
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-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -135,6 +135,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_labat_map_copy_conformity", "..\..\..\validate\example\labat_map_copy_conformity_\vc9_labat_map_copy_conformity.vcproj", "{BF42574F-66E2-42DD-90D9-3A8FCE6F472F}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_labat_bit_collector", "..\..\..\validate\example\labat_bit_collector_\vc9_labat_bit_collector.vcproj", "{9EF72937-0585-487D-B887-5359BFA569E9}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -409,6 +411,10 @@
{BF42574F-66E2-42DD-90D9-3A8FCE6F472F}.Debug|Win32.Build.0 = Debug|Win32
{BF42574F-66E2-42DD-90D9-3A8FCE6F472F}.Release|Win32.ActiveCfg = Release|Win32
{BF42574F-66E2-42DD-90D9-3A8FCE6F472F}.Release|Win32.Build.0 = Release|Win32
+ {9EF72937-0585-487D-B887-5359BFA569E9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9EF72937-0585-487D-B887-5359BFA569E9}.Debug|Win32.Build.0 = Debug|Win32
+ {9EF72937-0585-487D-B887-5359BFA569E9}.Release|Win32.ActiveCfg = Release|Win32
+ {9EF72937-0585-487D-B887-5359BFA569E9}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Added: sandbox/itl/libs/validate/example/labat_bit_collector_/labat_bit_collector.cpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_bit_collector_/labat_bit_collector.cpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -0,0 +1,37 @@
+/*-----------------------------------------------------------------------------+
+A Law Based Test Automaton 'LaBatea'
+Author: Joachim Faulhaber
+Copyright (c) 2007-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)
++-----------------------------------------------------------------------------*/
+#include <iostream>
+#include <stdio.h>
+#include <boost/validate/driver/bit_collector_driver.hpp>
+
+using namespace std;
+using namespace boost;
+using namespace boost::itl;
+
+void test_bit_collector_driver()
+{
+ bit_collector_driver validater;
+ cout <<
+ ">> ------------------------------------------------------ <<\n"
+ ">> -------- Law based test automaton 'LaBatea' ---------- <<\n"
+ ">> Output will be generated in a few seconds\n"
+ ">> terminate by typing <CTRL>C\n"
+ ">> ------------------------------------------------------ <<\n";
+ GentorProfileSgl::it()->set_std_profile(6,1);
+ GentorProfileSgl::it()->report_profile();
+ validater.validate();
+};
+
+
+int main()
+{
+ test_bit_collector_driver();
+ return 0;
+}
Added: sandbox/itl/libs/validate/example/labat_bit_collector_/vc9_labat_bit_collector.vcproj
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_bit_collector_/vc9_labat_bit_collector.vcproj 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="vc9_labat_bit_collector"
+ ProjectGUID="{9EF72937-0585-487D-B887-5359BFA569E9}"
+ RootNamespace="vc9_labat_bit_collector"
+ 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"
+ AdditionalOptions="/bigobj"
+ 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"
+ 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"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories="../../../../; ../../../../boost_1_35_0"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="1"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../lib; ../../../../stage/lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ LinkTimeCodeGeneration="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>
+ </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="..\..\src\gentor\gentorprofile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\labat_bit_collector_\labat_bit_collector.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Headerdateien"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\..\boost\validate\law.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\lawvalidater.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\lawviolations.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\laws\monoid.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\laws\order.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\laws\pushouts.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\realmvalidater.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\laws\set_laws.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\validate\typevalidater.h"
+ >
+ </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>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp
==============================================================================
--- sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp (original)
+++ sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp 2009-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -23,8 +23,6 @@
template<class DomainT>
struct point
{
- //CL typedef DomainT coordinate_type;
-
std::string as_string()const
{
return std::string(
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-10-11 17:15:22 EDT (Sun, 11 Oct 2009)
@@ -76,9 +76,11 @@
//typedef Balance<itl::tree<int> > TestLawT;
//LawValidater<TestLawT, RandomGentor> test_law;
- //typedef InplaceDeMorgan
- // <itl::interval_map<int, int> > TestLawT;
- //LawValidater<TestLawT, RandomGentor> test_law;
+ typedef InplaceDeMorgan
+ <itl::split_interval_map<int, itl::bits16, partial_enricher,
+ std::less, inplace_bit_add, inplace_bit_and>,
+ inplace_bit_add, inplace_bit_and> TestLawT;
+ LawValidater<TestLawT, RandomGentor> test_law;
//typedef IntersectsDefined
// <itl::interval_map<int, int, total_absorber> > TestLawT;
@@ -96,17 +98,17 @@
// <interval_set<int>, itl::interval<int> > TestLawT;
//LawValidater<TestLawT, RandomGentor> test_law;
- typedef FunctionEquality
- <
- itl::list<std::pair<itl::interval<int>,int> >,
- interval_map<int,int,total_absorber>,
- base_addition,
- hint_addition
- > TestLawT;
- LawValidater<TestLawT, RandomGentor> test_law;
+ //typedef FunctionEquality
+ //<
+ // itl::list<std::pair<int,int> >,
+ // itl::map<int,int,partial_absorber>,
+ // base_insertion,
+ // hint_insertion
+ //> TestLawT;
+ //LawValidater<TestLawT, RandomGentor> test_law;
//-----------------------------------------------------------------------------
- int test_count = 50000;
+ int test_count = 10000;
ptime start, stop;
GentorProfileSgl::it()->set_std_profile(4,1);
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