|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61885 - in sandbox/itl: boost/itl boost/itl/type_traits boost/itl_xt boost/validate/driver boost/validate/laws boost/validate/validater libs/itl/test/test_casual_ libs/validate/doc/boostcon2010 libs/validate/example/boostcon_abelian_monoids_ libs/validate/example/boostcon_law_validater_ libs/validate/example/de_morgan_
From: afojgo_at_[hidden]
Date: 2010-05-09 17:54:26
Author: jofaber
Date: 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
New Revision: 61885
URL: http://svn.boost.org/trac/boost/changeset/61885
Log:
Modified presentation Boost.Alabaster. Some improvements on validate. Replacing tabs.
Binary files modified:
sandbox/itl/libs/validate/doc/boostcon2010/BoostAlabaster.pptx
Text files modified:
sandbox/itl/boost/itl/interval_bounds.hpp | 16 ++++++------
sandbox/itl/boost/itl/interval_set.hpp | 4 +-
sandbox/itl/boost/itl/type_traits/interval_type_of.hpp | 2
sandbox/itl/boost/itl_xt/list.hpp | 10 ++++----
sandbox/itl/boost/validate/driver/itl_driver.hpp | 12 +++++++--
sandbox/itl/boost/validate/laws/monoid.hpp | 8 +++---
sandbox/itl/boost/validate/validater/abelian_monoid_validater.hpp | 2
sandbox/itl/boost/validate/validater/concept_validater.hpp | 47 +++++++++++++++++++--------------------
sandbox/itl/boost/validate/validater/itl_set_validater.hpp | 2
sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp | 42 +++++++++++++++++-----------------
sandbox/itl/libs/validate/example/boostcon_abelian_monoids_/boostcon_abelian_monoids.cpp | 12 ++-------
sandbox/itl/libs/validate/example/boostcon_law_validater_/boostcon_law_validater.cpp | 26 ++++++++-------------
sandbox/itl/libs/validate/example/de_morgan_/de_morgan.cpp | 10 ++++----
13 files changed, 93 insertions(+), 100 deletions(-)
Modified: sandbox/itl/boost/itl/interval_bounds.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_bounds.hpp (original)
+++ sandbox/itl/boost/itl/interval_bounds.hpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -31,14 +31,14 @@
class interval_bounds
{
public:
- BOOST_STATIC_CONSTANT(bound_type, _open = 0);
- BOOST_STATIC_CONSTANT(bound_type, _leftopen = 1);
- BOOST_STATIC_CONSTANT(bound_type, _rightopen = 2);
- BOOST_STATIC_CONSTANT(bound_type, _closed = 3);
-
- BOOST_STATIC_CONSTANT(bound_type, _right = 1);
- BOOST_STATIC_CONSTANT(bound_type, _left = 2);
- BOOST_STATIC_CONSTANT(bound_type, _all = 3);
+ BOOST_STATIC_CONSTANT(bound_type, _open = 0);
+ BOOST_STATIC_CONSTANT(bound_type, _leftopen = 1);
+ BOOST_STATIC_CONSTANT(bound_type, _rightopen = 2);
+ BOOST_STATIC_CONSTANT(bound_type, _closed = 3);
+
+ BOOST_STATIC_CONSTANT(bound_type, _right = 1);
+ BOOST_STATIC_CONSTANT(bound_type, _left = 2);
+ BOOST_STATIC_CONSTANT(bound_type, _all = 3);
public:
interval_bounds():_bits(){}
Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -191,10 +191,10 @@
}
else
{
- iterator succ_=it_; succ_++;
+ iterator succ_=it_; //succ_++;
if(succ_!=this->_set.end())
{
- // it's a non border element that might have a right touching neighbours
+ // it's a non border element that might have a right touching neighbour
if(touches(*it_, *succ_))
return join_on_left(it_, succ_);
}
Modified: sandbox/itl/boost/itl/type_traits/interval_type_of.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/interval_type_of.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/interval_type_of.hpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -16,7 +16,7 @@
namespace boost{ namespace itl
{
- template <class DomainT, ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT)>
+ template <class DomainT, ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT)>
struct interval_type_of
{
typedef
Modified: sandbox/itl/boost/itl_xt/list.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/list.hpp (original)
+++ sandbox/itl/boost/itl_xt/list.hpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -124,11 +124,11 @@
//JODO concept InplaceAddable
/// Add a list \c tail to this list.
list& operator += (const list& tail)
- {
- list rear(tail);
- splice(end(), rear);
- return *this;
- }
+ {
+ list rear(tail);
+ splice(end(), rear);
+ return *this;
+ }
/** yields true if any of the elements in \c *this has the property \c prop */
bool any(const property<DataT>& prop)const;
Modified: sandbox/itl/boost/validate/driver/itl_driver.hpp
==============================================================================
--- sandbox/itl/boost/validate/driver/itl_driver.hpp (original)
+++ sandbox/itl/boost/validate/driver/itl_driver.hpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -138,6 +138,7 @@
void reportFrequencies()
{
std::cout << "------------------------------------------------------------------------------" << std::endl;
+ std::cout << "--- Successfully tested law instantiation -------------------------runs---time" << std::endl;
int valid_count = 1;
double avg_evaluation_time = 0.0;
long instance_count = 0;
@@ -157,13 +158,18 @@
std::cout << "------------------------------------------------------------------------------" << std::endl;
// Summary for the current cycle
double avg_evaluation_time_per_law = avg_evaluation_time/_frequencies.size();
- printf( " %10.3lf%-50s%7ld%7.0lf\n",
- avg_evaluation_time_per_law, " ", instance_count, avg_evaluation_time_per_law);
+ printf( " %10.3lf%-53s%7ld%7.0lf\n",
+ avg_evaluation_time_per_law, " total avg of atomic evaluation (micro sec)", instance_count, avg_evaluation_time_per_law);
int violation_count = 1;
+ if(!_violations.empty())
+ {
+ std::cout << "------------------------------------------------------------------------------" << std::endl;
+ std::cout << "--- Law violations -----------------------------------------------count-------" << std::endl;
+ }
ITL_FORALL(ViolationMapT, it, _violations)
{
- printf("%3d %-66s%8d\n", violation_count, it->first.c_str(), it->second.getViolationsCount());
+ printf("%3d %-59s%8d\n", violation_count, it->first.c_str(), it->second.getViolationsCount());
violation_count++;
}
if(!_violations.empty())
Modified: sandbox/itl/boost/validate/laws/monoid.hpp
==============================================================================
--- sandbox/itl/boost/validate/laws/monoid.hpp (original)
+++ sandbox/itl/boost/validate/laws/monoid.hpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -246,7 +246,7 @@
bool debug_holds()
{
- std::cout << "--- function debug_holds -----------------------------\n";
+ std::cout << "--- function debug_holds -----------------------------\n";
std::cout << " a = " << this->template getInputValue<operand_a>() << std::endl;
std::cout << " b = " << this->template getInputValue<operand_b>() << std::endl;
std::cout << " c = " << this->template getInputValue<operand_c>() << std::endl;
@@ -267,7 +267,7 @@
this->template setOutputValue<lhs_result>(lhs);
this->template setOutputValue<rhs_result>(rhs);
- std::cout << "------------------------------------------------------\n";
+ std::cout << "------------------------------------------------------\n";
return Equality<Type>()(lhs, rhs);
}
@@ -318,7 +318,7 @@
bool debug_holds()
{
- std::cout << "--- function debug_holds -----------------------------\n";
+ std::cout << "--- function debug_holds -----------------------------\n";
std::cout << " a = " << this->template getInputValue<operand_a>() << std::endl;
std::cout << " b = " << this->template getInputValue<operand_b>() << std::endl;
@@ -332,7 +332,7 @@
this->template setOutputValue<lhs_result>(lhs);
this->template setOutputValue<rhs_result>(rhs);
- std::cout << "------------------------------------------------------\n";
+ std::cout << "------------------------------------------------------\n";
return lhs == rhs;
}
Modified: sandbox/itl/boost/validate/validater/abelian_monoid_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/abelian_monoid_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/abelian_monoid_validater.hpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -50,7 +50,7 @@
private:
ChoiceT _lawChoice;
- monoid_validater<Type> _monoid_validater;
+ monoid_validater<Type> _monoid_validater;
};
Modified: sandbox/itl/boost/validate/validater/concept_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/concept_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/concept_validater.hpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -26,36 +26,35 @@
// Somehow it has to be defined in conjunction to every type. So it is an aspect of
// type traits.
//CL virtual void setProfile()=0;
- virtual LawValidaterI* chooseValidater()=0;
+ virtual LawValidaterI* chooseValidater()=0;
virtual bool hasValidProfile()const{ return true; }
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;
- }
+ {
+ LawValidaterI* law_validater = chooseValidater();
+ if(law_validater)
+ {
+ law_validater->run();
+ law_validater->addFrequencies(_frequencies);
+ law_validater->addViolations(_violationsCount, _violations);
+ delete law_validater;
+ }
+ }
+
+ void addFrequencies(ValidationCounterT& summary) { summary += _frequencies; }
+
+ void addViolations(ViolationCounterT& summary, ViolationMapT& collector)
+ {
+ summary += _violationsCount;
+ collector += _violations;
+ }
static int share(int total, int& index, int& rest_shares);
- private:
- LawValidaterI* _validater;
- ValidationCounterT _frequencies;
- ViolationCounterT _violationsCount;
- ViolationMapT _violations;
+ private:
+ ValidationCounterT _frequencies;
+ ViolationCounterT _violationsCount;
+ ViolationMapT _violations;
};
inline int concept_validater::share(int total, int& index, int& rest_shares)
Modified: sandbox/itl/boost/validate/validater/itl_set_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/itl_set_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/itl_set_validater.hpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -103,7 +103,7 @@
case inplacePlusDeMorgan: return new LawValidater<InplaceDeMorgan<Type, inplace_plus, inplace_et, itl::std_equal> >;
case inplaceEtDeMorgan:
if(itl::is_interval_splitter<Type>::value || itl::is_interval_separator<Type>::value)
- return new LawValidater<InplaceDeMorgan<Type, inplace_et, inplace_plus, inplace_minus, itl::element_equal> >;
+ return new LawValidater<InplaceDeMorgan<Type, inplace_et, inplace_plus, inplace_minus, itl::element_equal> >;
else return new LawValidater<InplaceDeMorgan<Type, inplace_et, inplace_plus, inplace_minus, itl::std_equal> >;
default: return NULL;
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 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -192,32 +192,32 @@
BOOST_AUTO_TEST_CASE(casual)
{
- typedef itl::set<int> TargetT;
- TargetT left, right, target;
- left.insert(1);
- left.insert(3);
- right.insert(2);
- left.insert(3);
-
- /*
- std::set_union(left.rbegin(), left.rend(), right.rbegin(), right.rend(),
- std::inserter(target,target.end()));
- std::set_difference(left.rbegin(), left.rend(), right.rbegin(), right.rend(),
- std::inserter(target,target.end()));
-
- std::set_intersection(left.rbegin(), left.rend(), right.rbegin(), right.rend(),
- std::inserter(target,target.end()));
- std::set_symmetric_difference(left.rbegin(), left.rend(), right.rbegin(), right.rend(),
- std::inserter(target,target.end()));
+ typedef itl::set<int> TargetT;
+ TargetT left, right, target;
+ left.insert(1);
+ left.insert(3);
+ right.insert(2);
+ left.insert(3);
+
+ /*
+ std::set_union(left.rbegin(), left.rend(), right.rbegin(), right.rend(),
+ std::inserter(target,target.end()));
+ std::set_difference(left.rbegin(), left.rend(), right.rbegin(), right.rend(),
+ std::inserter(target,target.end()));
+
+ std::set_intersection(left.rbegin(), left.rend(), right.rbegin(), right.rend(),
+ std::inserter(target,target.end()));
+ std::set_symmetric_difference(left.rbegin(), left.rend(), right.rbegin(), right.rend(),
+ std::inserter(target,target.end()));
- bool incl = std::includes(left.rbegin(), left.rend(), right.rbegin(), right.rend(), std::greater<int>()); //!
+ bool incl = std::includes(left.rbegin(), left.rend(), right.rbegin(), right.rend(), std::greater<int>()); //!
*/
- //int found;
- //TargetT::reverse_iterator it = std::find(left.rbegin(), left.rend(), found); //!
+ //int found;
+ //TargetT::reverse_iterator it = std::find(left.rbegin(), left.rend(), found); //!
- bool incl = std::includes(left.rbegin(), left.rend(), right.rbegin(), right.rend(), std::greater<int>());
+ bool incl = std::includes(left.rbegin(), left.rend(), right.rbegin(), right.rend(), std::greater<int>());
}
Modified: sandbox/itl/libs/validate/doc/boostcon2010/BoostAlabaster.pptx
==============================================================================
Binary files. No diff available.
Modified: sandbox/itl/libs/validate/example/boostcon_abelian_monoids_/boostcon_abelian_monoids.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/boostcon_abelian_monoids_/boostcon_abelian_monoids.cpp (original)
+++ sandbox/itl/libs/validate/example/boostcon_abelian_monoids_/boostcon_abelian_monoids.cpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -16,9 +16,9 @@
using namespace boost;
using namespace boost::itl;
-void test_abelian_monoid_driver()
+int main()
{
- abelian_monoid_driver validater;
+ abelian_monoid_driver model_tester;
cout <<
">> ------------------------------------------------------ <<\n"
">> -------- Law based test automaton 'LaBatea' ---------- <<\n"
@@ -27,12 +27,6 @@
">> ------------------------------------------------------ <<\n";
GentorProfileSgl::it()->set_std_profile(16,1);
GentorProfileSgl::it()->report_profile();
- validater.validate();
-};
-
-
-int main()
-{
- test_abelian_monoid_driver();
+ model_tester.validate();
return 0;
}
Modified: sandbox/itl/libs/validate/example/boostcon_law_validater_/boostcon_law_validater.cpp
==============================================================================
--- sandbox/itl/libs/validate/example/boostcon_law_validater_/boostcon_law_validater.cpp (original)
+++ sandbox/itl/libs/validate/example/boostcon_law_validater_/boostcon_law_validater.cpp 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -19,34 +19,28 @@
using namespace boost::itl;
using namespace boost::posix_time;
-void test_LawValidater()
+int main()
{
- typedef InplaceCommutativity<int> TestLawT;
- LawValidater<TestLawT> validater;
+ typedef InplaceCommutativity<int> TestLawT;
+ LawValidater<TestLawT> law_validator;
//-----------------------------------------------------------------------------
int test_count = 10000;
- ptime start, stop;
+ ptime start, stop;
GentorProfileSgl::it()->set_std_profile(8,1);
- validater.set_trials_count(test_count);
+ law_validator.set_trials_count(test_count);
- cout << "Testing " << TestLawT().typeString() << endl
- << "trials_count = " << test_count << endl
- << "Start ...\n";
+ cout << "Testing " << TestLawT().typeString() << endl
+ << "trials_count = " << test_count << endl
+ << "Start ...\n";
start = ptime(microsec_clock::local_time());
- validater.run();
+ law_validator.run();
stop = ptime(microsec_clock::local_time());
cout << "Stop. Time elapsed: " << stop - start << endl;
- if(validater.violation_count() == 0)
+ if(law_validator.violation_count() == 0)
cout << "Law successfully validated\n";
-}
-
-
-int main()
-{
- test_LawValidater();
return 0;
}
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 2010-05-09 17:54:24 EDT (Sun, 09 May 2010)
@@ -186,15 +186,15 @@
// Equality relation: std_equal implements segmental equality (default)
LawValidater
- <InplaceDeMorgan<interval_set<int>, inplace_et, inplace_plus > >
- validater1;
+ <InplaceDeMorgan<interval_set<int>, inplace_et, inplace_plus > >
+ validater1;
cout << "===== validater 1 ====================================\n";
test_law(validater1);
// Ok the law was successfully validated.
// Next we check the same law for split_interval_sets
LawValidater
- <InplaceDeMorgan<split_interval_set<int>, inplace_et, inplace_plus > >
+ <InplaceDeMorgan<split_interval_set<int>, inplace_et, inplace_plus > >
validater2;
cout << "\n===== validater 2 ====================================\n";
test_law(validater2);
@@ -208,9 +208,9 @@
// Using element equality that abstracts from the segmentation ...
LawValidater
- <InplaceDeMorgan<split_interval_set<int>, inplace_et, inplace_plus,
+ <InplaceDeMorgan<split_interval_set<int>, inplace_et, inplace_plus,
inplace_minus, element_equal> >
- validater3;
+ validater3;
cout << "\n===== validater 3 ====================================\n";
test_law(validater3);
// finally leads to an instantiation of the law that holds for
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