Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55900 - in sandbox/itl: boost/itl boost/itl_xt boost/validate/laws libs/validate/example/labat_single_
From: afojgo_at_[hidden]
Date: 2009-08-31 02:21:46


Author: jofaber
Date: 2009-08-31 02:21:45 EDT (Mon, 31 Aug 2009)
New Revision: 55900
URL: http://svn.boost.org/trac/boost/changeset/55900

Log:
Added tests: More tests on containedness. Stable {msvc-9.0}

Text files modified:
   sandbox/itl/boost/itl/interval_base_set.hpp | 8 ++++-
   sandbox/itl/boost/itl_xt/numbergentor.hpp | 3 -
   sandbox/itl/boost/validate/laws/minor_set_laws.hpp | 57 ++++++++++++++++++++++++++++++++++++++++
   sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp | 8 ++++-
   4 files changed, 70 insertions(+), 6 deletions(-)

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-08-31 02:21:45 EDT (Mon, 31 Aug 2009)
@@ -161,7 +161,11 @@
                 if(exterior.first == exterior.second)
                         return false;
 
- return Interval_Set::is_joinable(*this, exterior.first, exterior.second);
+ const_iterator last_overlap = prior(exterior.second);
+
+ return
+ hull(*(exterior.first), *last_overlap).contains(sub_interval)
+ && Interval_Set::is_joinable(*this, exterior.first, last_overlap);
         }
 
 
@@ -439,7 +443,7 @@
     { return it_ == this->_set.begin() ? this->_set.end() : --it_; }
 
         const_iterator prior(const_iterator it_)const
- { return it_ == this->_map.begin() ? this->_map.end() : --it_; }
+ { return it_ == this->_set.begin() ? this->_set.end() : --it_; }
 
     iterator gap_insert(iterator prior_, const interval_type& inter_val)
     {

Modified: sandbox/itl/boost/itl_xt/numbergentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/numbergentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/numbergentor.hpp 2009-08-31 02:21:45 EDT (Mon, 31 Aug 2009)
@@ -62,8 +62,7 @@
 template <class NumTV>
 inline NumTV rnd_within_exUpb(NumTV lwb, NumTV exclusive_upb)
 {
- NumTV some = static_cast<NumTV>(RND_WITHIN_EXUPB(lwb,exclusive_upb));
- return some;
+ return static_cast<NumTV>(RND_WITHIN_EXUPB(lwb,exclusive_upb));
 }
 
 template <class NumTV>

Modified: sandbox/itl/boost/validate/laws/minor_set_laws.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/minor_set_laws.hpp (original)
+++ sandbox/itl/boost/validate/laws/minor_set_laws.hpp 2009-08-31 02:21:45 EDT (Mon, 31 Aug 2009)
@@ -150,6 +150,63 @@
         }
     };
 
+
+ template <typename Type, typename CoType>
+ class AddendInclusion
+ : public Law<AddendInclusion<Type,CoType>, LOKI_TYPELIST_2(Type,CoType), LOKI_TYPELIST_1(bool)>
+ {
+ /** (a + i).contains(i)
+ Input = (a := inVal1, i := inVal2)
+ Output = (lhs_result, rhs_result)
+ */
+ public:
+ std::string name()const { return "AddendInclusion"; }
+ std::string formula()const { return "(a + i).contains(i)"; }
+
+ std::string typeString()const
+ {
+ return "AddendInclusion<"+ type_to_string<Type>::apply()+","
+ +type_to_string<CoType>::apply()+">";
+ }
+
+ public:
+
+ bool holds()
+ {
+ // (a + i).contains(i)
+ Type value_a = this->template getInputValue<operand_a>();
+ CoType value_i = this->template getInputValue<operand_b>();
+ return (value_a + value_i).contains(value_i);
+ }
+
+ bool debug_holds()
+ {
+ return holds();
+ /*
+ // a.contains(a & b)
+ Type value_a = this->template getInputValue<operand_a>();
+ CoType value_b = this->template getInputValue<operand_b>();
+ Type a_sec_b = value_a & value_b;
+ bool result = value_a.contains(value_a & value_b);
+ // -------------------------------------------
+ cout << "a = " << value_a << endl;
+ cout << "b = " << value_b << endl;
+ cout << "a&b = " << a_sec_b << endl;
+ cout << "a.contains(a&b) = " << result << endl;
+ // -------------------------------------------
+ value_a.contains(a_sec_b);
+
+ return result;
+ */
+ }
+
+ size_t size()const
+ {
+ return value_size< Type>::apply(this->template getInputValue<operand_a>())+
+ value_size<CoType>::apply(this->template getInputValue<operand_b>());
+ }
+ };
+
 }} // namespace itl boost
 
 #endif // __itl_minor_set_laws_JOFA_070411__

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-08-31 02:21:45 EDT (Mon, 31 Aug 2009)
@@ -77,8 +77,12 @@
         // <interval_map<int,int>, interval_set<int> > TestLawT;
         //LawValidater<TestLawT, RandomGentor> test_law;
 
- typedef Interinclusion
- <interval_map<int, itl::set<int> >, interval_map<int, itl::set<int> > > TestLawT;
+ //typedef Interinclusion
+ // <interval_map<int, itl::set<int> >, interval_map<int, itl::set<int> > > TestLawT;
+ //LawValidater<TestLawT, RandomGentor> test_law;
+
+ typedef AddendInclusion
+ <interval_set<int>, int > TestLawT;
         LawValidater<TestLawT, RandomGentor> test_law;
 
     //-----------------------------------------------------------------------------


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