|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55974 - in sandbox/itl: boost/itl boost/itl/type_traits boost/itl_xt boost/validate/gentor libs/validate/example/labat_polygon_ libs/validate/example/labat_single_ libs/validate/src/gentor
From: afojgo_at_[hidden]
Date: 2009-09-02 10:01:27
Author: jofaber
Date: 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
New Revision: 55974
URL: http://svn.boost.org/trac/boost/changeset/55974
Log:
Added law tests for boost::polygon. Stable {msvc-9.0}
Added:
sandbox/itl/libs/validate/example/labat_polygon_/
sandbox/itl/libs/validate/example/labat_polygon_/Jamfile.v2 (contents, props changed)
sandbox/itl/libs/validate/example/labat_polygon_/custom_polygon.hpp (contents, props changed)
sandbox/itl/libs/validate/example/labat_polygon_/labat_polygon.cpp (contents, props changed)
sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp (contents, props changed)
sandbox/itl/libs/validate/example/labat_polygon_/polygon_gentor.hpp (contents, props changed)
sandbox/itl/libs/validate/example/labat_polygon_/polygon_laws.hpp (contents, props changed)
sandbox/itl/libs/validate/example/labat_polygon_/vc9_labat_polygon.sln (contents, props changed)
sandbox/itl/libs/validate/example/labat_polygon_/vc9_labat_polygon.vcproj (contents, props changed)
Text files modified:
sandbox/itl/boost/itl/interval.hpp | 19 ++++++++
sandbox/itl/boost/itl/type_traits/value_size.hpp | 2
sandbox/itl/boost/itl_xt/itvgentor.hpp | 6 +
sandbox/itl/boost/itl_xt/list.hpp | 13 +++++
sandbox/itl/boost/validate/gentor/gentorprofile.hpp | 5 +
sandbox/itl/boost/validate/gentor/randomgentor.hpp | 88 +++++++++++++++++++++++++++++++++++++++
sandbox/itl/libs/validate/example/labat_single_/labat_single.cpp | 2
sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp | 26 +++++++++++
8 files changed, 153 insertions(+), 8 deletions(-)
Modified: sandbox/itl/boost/itl/interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval.hpp (original)
+++ sandbox/itl/boost/itl/interval.hpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -27,6 +27,7 @@
#include <boost/itl/type_traits/is_continuous.hpp>
#include <boost/itl/type_traits/difference.hpp>
#include <boost/itl/type_traits/size.hpp>
+#include <boost/itl/type_traits/value_size.hpp>
#include <boost/itl/type_traits/to_string.hpp>
//#undef min
@@ -1056,6 +1057,24 @@
}
+//==============================================================================
+//= Type traits
+//==============================================================================
+template <class DomainT, ITL_COMPARE Compare>
+struct type_to_string<itl::interval<DomainT,Compare> >
+{
+ static std::string apply()
+ { return "itv<"+ type_to_string<DomainT>::apply() +">"; }
+};
+
+
+template<class DomainT>
+struct value_size<itl::interval<DomainT> >
+{
+ static std::size_t value_size::apply(const itl::interval<DomainT>& value)
+ { return 2; }
+};
+
}} // namespace itl boost
Modified: sandbox/itl/boost/itl/type_traits/value_size.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/value_size.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/value_size.hpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -34,9 +34,9 @@
};
-
template<> inline std::size_t value_size<int>::apply(const int& value)
{ return abs(value); }
+
template<> inline std::size_t value_size<double>::apply(const double& value)
{ return static_cast<int>(abs(value)); }
Modified: sandbox/itl/boost/itl_xt/itvgentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/itvgentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/itvgentor.hpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -47,17 +47,19 @@
public:
virtual void some(ItvTV& x);
+ void setRange(const itl::interval<ItvDomTV>& range)
+ { m_valueRange = range; }
+
void setValueRange(ItvDomTV low, ItvDomTV up)
{ m_valueRange.set(low,up, itl::right_open); }
void setMaxIntervalLength(ItvDomTV len) { m_maxIntervalLength=len; }
void setProbDerivation();
-
private:
NumberGentorT<ItvDomTV> m_ItvDomTVGentor;
- interval<ItvDomTV> m_valueRange;
+ interval<ItvDomTV> m_valueRange;
ItvDomTV m_maxIntervalLength;
};
Modified: sandbox/itl/boost/itl_xt/list.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/list.hpp (original)
+++ sandbox/itl/boost/itl_xt/list.hpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -138,6 +138,8 @@
sublist in the list \c super */
bool contained_in(const list& super)const { return is_subsequence(super); }
+ size_t iterative_size()const{ return size(); }
+
//JODO concept InplaceAddable
/// Add a list \c tail to this list.
list& operator += (const list& tail) { splice(end(), list(tail)); return *this; }
@@ -422,18 +424,25 @@
if(it == end()) return std::string("");
else
{
- std::string y = to_string<DataT>::apply(*it);
+ std::string y = "{"+to_string<DataT>::apply(*it);
it++;
while(it != end())
{
y+=sep;
- y += to_string<DataT>::value(*it);
+ y += to_string<DataT>::apply(*it);
it++;
}
+ y += "}";
return y;
}
}
+ template <class Type>
+ struct type_to_string<itl::list<Type> >
+ {
+ static std::string apply()
+ { return "list<"+ type_to_string<Type>::apply() +">"; }
+ };
}} // namespace itl boost
Modified: sandbox/itl/boost/validate/gentor/gentorprofile.hpp
==============================================================================
--- sandbox/itl/boost/validate/gentor/gentorprofile.hpp (original)
+++ sandbox/itl/boost/validate/gentor/gentorprofile.hpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -26,6 +26,7 @@
void set_release_defaults();
void set_std_profile(int unit, int factor);
+ void set_polygon_profile(int max_polygon_set_size, int max_polygon_size, int min_coord, int max_coord);
void set_range_int(int lwb, int upb)
{ _range_int = interval<int>::rightopen(lwb, upb); }
@@ -134,7 +135,9 @@
void report_profile() { return m_profile.report_profile(); }
- void set_std_profile(int unit, int factor){ return m_profile.set_std_profile(unit, factor); }
+ void set_std_profile(int unit, int factor) { return m_profile.set_std_profile(unit, factor); }
+ void set_polygon_profile(int max_polygon_set_size, int max_polygon_size, int min_coord, int max_coord)
+ { return m_profile.set_polygon_profile(max_polygon_set_size, max_polygon_size, min_coord, max_coord); }
private:
Modified: sandbox/itl/boost/validate/gentor/randomgentor.hpp
==============================================================================
--- sandbox/itl/boost/validate/gentor/randomgentor.hpp (original)
+++ sandbox/itl/boost/validate/gentor/randomgentor.hpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -15,6 +15,10 @@
#include <boost/itl_xt/setgentor.hpp>
#include <boost/itl_xt/mapgentor.hpp>
#include <boost/itl_xt/itvgentor.hpp>
+
+#include <libs/validate/example/labat_polygon_/point_gentor.hpp>
+#include <libs/validate/example/labat_polygon_/polygon_gentor.hpp>
+
#include <boost/itl/interval_set.hpp>
#include <boost/itl/separate_interval_set.hpp>
#include <boost/itl/split_interval_set.hpp>
@@ -29,12 +33,33 @@
namespace boost{namespace itl
{
- // ----------------------------------------------------------
+ // -------------------------------------------------------------------------
template <class ValueT> class RandomGentor;
template <> class RandomGentor<int> : public NumberGentorT<int> {};
template <> class RandomGentor<nat> : public NumberGentorT<nat> {};
template <> class RandomGentor<double> : public NumberGentorT<double> {};
+ // -------------------------------------------------------------------------
+ template <class DomainT>
+ class RandomGentor<itl::interval<DomainT> > :
+ public ItvGentorT<DomainT> {};
+
+#ifdef LAW_BASED_TEST_BOOST_POLYGON
+ // -------------------------------------------------------------------------
+ template <class DomainT>
+ class RandomGentor<itl::point<DomainT> > :
+ public point_gentor<DomainT> {};
+
+ template <class PointT>
+ class RandomGentor<itl::list<PointT> > :
+ public polygon_gentor<itl::list<PointT> > {};
+
+ template <class PointT>
+ class RandomGentor<itl::list<itl::list<PointT> > > :
+ public polygon_set_gentor<itl::list<itl::list<PointT> > > {};
+#endif //LAW_BASED_TEST_BOOST_POLYGON
+
+
// ----- sets --------------------------------------------------------------
//template <class DomainT, template<class>class Set>
//class RandomGentor<Set<DomainT> > :
@@ -154,6 +179,67 @@
template <>
+ struct Calibrater<itl::interval<int>, RandomGentor>
+ {
+ static void apply(RandomGentor<itl::interval<int> >& gentor)
+ {
+ // Set the range within which the sizes of the generated object varies.
+ gentor.setRange(GentorProfileSgl::it()->range_int());
+ }
+ };
+
+
+#ifdef LAW_BASED_TEST_BOOST_POLYGON
+ //--------------------------------------------------------------------------
+ // boost::polygon
+ //--------------------------------------------------------------------------
+ template <>
+ struct Calibrater<itl::point<int>, RandomGentor>
+ {
+ static void apply(RandomGentor<itl::point<int> >& gentor)
+ {
+ // Set the range within which the sizes of the generated object varies.
+ gentor.setRange(GentorProfileSgl::it()->range_int());
+ }
+ };
+
+ template <>
+ struct Calibrater<itl::list<point<int> >, RandomGentor>
+ {
+ static void apply(RandomGentor<itl::list<point<int> > >& gentor)
+ {
+ gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_codomain_ContainerSize());
+ point_gentor<int>* pointGentor = new point_gentor<int>;
+ pointGentor->setRange(GentorProfileSgl::it()->range_int());
+ gentor.setDomainGentor(pointGentor);
+ gentor.setUnique(true);
+ }
+ };
+
+ template <>
+ struct Calibrater<itl::list<list<point<int> > >, RandomGentor>
+ {
+ static void apply(RandomGentor<itl::list<list<point<int> > > >& gentor)
+ {
+ point_gentor<int>* pointGentor = new point_gentor<int>;
+ pointGentor->setRange(GentorProfileSgl::it()->range_int());
+
+ polygon_gentor<list<point<int> > >* polyGentor = new polygon_gentor<list<point<int> > >;
+ polyGentor->setDomainGentor(pointGentor);
+ polyGentor->setRangeOfSampleSize(GentorProfileSgl::it()->range_codomain_ContainerSize());
+ polyGentor->setUnique(true);
+
+ gentor.setDomainGentor(polyGentor);
+ gentor.setRangeOfSampleSize(GentorProfileSgl::it()->range_ContainerSize());
+ }
+ };
+
+ //--------------------------------------------------------------------------
+ // nogylop::tsoob
+ //--------------------------------------------------------------------------
+#endif // LAW_BASED_TEST_BOOST_POLYGON
+
+ template <>
struct Calibrater<itl::set<int>, RandomGentor>
{
static void apply(RandomGentor<itl::set<int> >& gentor)
Added: sandbox/itl/libs/validate/example/labat_polygon_/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_polygon_/Jamfile.v2 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -0,0 +1,15 @@
+# (C) Copyright 2008: Joachim Faulhaber
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+obj gentorprofile.obj : ../../src/gentor/gentorprofile.cpp ;
+
+exe labat_polygon
+ :
+ labat_polygon.cpp
+ gentorprofile.obj
+ /boost/date_time//boost_date_time
+ :
+ <include>../../..
+ <include>$(BOOST_ROOT)
+ ;
Added: sandbox/itl/libs/validate/example/labat_polygon_/custom_polygon.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_polygon_/custom_polygon.hpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -0,0 +1,158 @@
+/*-----------------------------------------------------------------------------+
+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 __custom_polygon_hpp_JOFA_090901__
+#define __custom_polygon_hpp_JOFA_090901__
+
+#include <boost/polygon/polygon.hpp>
+#include "point_gentor.hpp"
+#include "polygon_gentor.hpp"
+
+typedef boost::itl::point<int> CPoint;
+
+namespace boost{ namespace polygon{
+
+ template <>
+ struct geometry_concept<CPoint > { typedef point_concept type; };
+
+ template <>
+ struct point_traits<CPoint > {
+ typedef int coordinate_type;
+
+ static inline coordinate_type get(const CPoint & point,
+ orientation_2d orient) {
+ if(orient == HORIZONTAL)
+ return point.x;
+ return point.y;
+ }
+ };
+
+ template <>
+ struct point_mutable_traits<CPoint > {
+ static inline void set(CPoint & point, orientation_2d orient, int value) {
+ if(orient == HORIZONTAL)
+ point.x = value;
+ else
+ point.y = value;
+ }
+ static inline CPoint construct(int x_value, int y_value) {
+ CPoint retval;
+ retval.x = x_value;
+ retval.y = y_value;
+ return retval;
+ }
+ };
+}}
+
+//the CPolygon example
+typedef boost::itl::list<CPoint > CPolygon;
+
+//we need to specialize our polygon concept mapping in gtl
+namespace boost{ namespace polygon{
+ //first register CPolygon as a polygon_concept type
+ template <>
+ struct geometry_concept<CPolygon>{ typedef polygon_concept type; };
+
+ template <>
+ struct polygon_traits<CPolygon> {
+ typedef int coordinate_type;
+ typedef CPolygon::const_iterator iterator_type;
+ typedef CPoint point_type;
+
+ // Get the begin iterator
+ static inline iterator_type begin_points(const CPolygon& t) {
+ return t.begin();
+ }
+
+ // Get the end iterator
+ static inline iterator_type end_points(const CPolygon& t) {
+ return t.end();
+ }
+
+ // Get the number of sides of the polygon
+ static inline std::size_t size(const CPolygon& t) {
+ return t.size();
+ }
+
+ // Get the winding direction of the polygon
+ static inline winding_direction winding(const CPolygon& t) {
+ return unknown_winding;
+ }
+ };
+
+ template <>
+ struct polygon_mutable_traits<CPolygon> {
+ //expects stl style iterators
+ template <typename iT>
+ static inline CPolygon& set_points(CPolygon& t,
+ iT input_begin, iT input_end) {
+ t.clear();
+ while(input_begin != input_end) {
+ t.push_back(CPoint ());
+ gtl::assign(t.back(), *input_begin);
+ ++input_begin;
+ }
+ return t;
+ }
+
+ };
+}}
+
+//OK, finally we get to declare our own polygon set type
+typedef boost::itl::list<CPolygon> CPolygonSet;
+
+//deque isn't automatically a polygon set in the library
+//because it is a standard container there is a shortcut
+//for mapping it to polygon set concept, but I'll do it
+//the long way that you would use in the general case.
+namespace boost{ namespace polygon{
+ //first we register CPolygonSet as a polygon set
+ template <>
+ struct geometry_concept<CPolygonSet> { typedef polygon_set_concept type; };
+
+ //next we map to the concept through traits
+ template <>
+ struct polygon_set_traits<CPolygonSet> {
+ typedef int coordinate_type;
+ typedef CPolygonSet::const_iterator iterator_type;
+ typedef CPolygonSet operator_arg_type;
+
+ static inline iterator_type begin(const CPolygonSet& polygon_set) {
+ return polygon_set.begin();
+ }
+
+ static inline iterator_type end(const CPolygonSet& polygon_set) {
+ return polygon_set.end();
+ }
+
+ //don't worry about these, just return false from them
+ static inline bool clean(const CPolygonSet& polygon_set) { return false; }
+ static inline bool sorted(const CPolygonSet& polygon_set) { return false; }
+ };
+
+ template <>
+ struct polygon_set_mutable_traits<CPolygonSet> {
+ template <typename input_iterator_type>
+ static inline void set(CPolygonSet& polygon_set, input_iterator_type input_begin, input_iterator_type input_end) {
+ polygon_set.clear();
+ //this is kind of cheesy. I am copying the unknown input geometry
+ //into my own polygon set and then calling get to populate the
+ //deque
+ polygon_set_data<int> ps;
+ ps.insert(input_begin, input_end);
+ ps.get(polygon_set);
+ //if you had your own odd-ball polygon set you would probably have
+ //to iterate through each polygon at this point and do something
+ //extra
+ }
+ };
+}}
+
+
+#endif
Added: sandbox/itl/libs/validate/example/labat_polygon_/labat_polygon.cpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_polygon_/labat_polygon.cpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -0,0 +1,177 @@
+/*-----------------------------------------------------------------------------+
+Copyright 2008 Intel Corporation
+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)
++-----------------------------------------------------------------------------*/
+#pragma warning( disable : 4800 )
+#pragma warning( disable : 4244 ) //'argument' : conversion from 'T1' to 'T2', possible loss of data
+
+#include <boost/polygon/polygon.hpp>
+#include <list>
+#include <time.h>
+#include <cassert>
+#include <deque>
+#include <iostream>
+
+
+#include <boost/itl/ptime.hpp>
+#include "polygon_laws.hpp"
+
+#include <boost/validate/validater/law_validater.hpp>
+#include <boost/validate/gentor/gentorprofile.hpp>
+#include <boost/validate/gentor/rangegentor.hpp>
+
+#include "point_gentor.hpp"
+#include "polygon_gentor.hpp"
+#include "custom_polygon.hpp"
+
+
+namespace gtl = boost::polygon;
+using namespace std;
+using namespace boost;
+using namespace boost::itl;
+using namespace boost::posix_time;
+
+using namespace boost::polygon::operators;
+
+//------------------------------------------------------------------------------
+//--- Parts from examplefiles to see if everything is basically right ---
+//------------------------------------------------------------------------------
+
+//once again we make our usage of the library generic
+//and parameterize it on the polygon set type
+template <typename PolygonSet>
+void test_polygon_set() {
+ using namespace gtl;
+ PolygonSet ps;
+ ps += rectangle_data<int>(0, 0, 10, 10);
+ PolygonSet ps2;
+ ps2 += rectangle_data<int>(5, 5, 15, 15);
+ PolygonSet ps3;
+ assign(ps3, ps * ps2);
+ PolygonSet ps4, pps;
+ pps += ps;
+
+ self_assignment_boolean_op<PolygonSet, PolygonSet, 0>(pps, ps);
+
+ ps4 += ps + ps2;
+ assert(area(ps4) == area(ps) + area(ps2) - area(ps3));
+ assert(equivalence((ps + ps2) - (ps * ps2), ps ^ ps2));
+ rectangle_data<int> rect;
+ assert(extents(rect, ps ^ ps2));
+ assert(area(rect) == 225);
+ assert(area(rect ^ (ps ^ ps2)) == area(rect) - area(ps ^ ps2));
+}
+
+
+
+int polygon_test() {
+ long long c1 = clock();
+ for(int i = 0; i < 100; ++i)
+ {
+ if(i%10==0)
+ std::cout << ".";
+ test_polygon_set<CPolygonSet>();
+ }
+ long long c2 = clock();
+ for(int i = 0; i < 100; ++i)
+ {
+ if(i%10==0)
+ std::cout << ".";
+ test_polygon_set<gtl::polygon_set_data<int> >();
+ }
+ long long c3 = clock();
+ long long diff1 = c2 - c1;
+ long long diff2 = c3 - c2;
+ if(diff1 > 0 && diff2)
+ std::cout << "library polygon_set_data is " << float(diff1)/float(diff2) << "X faster than custom polygon set deque of CPolygon" << std::endl;
+ else
+ std::cout << "operation was too fast" << std::endl;
+ return 0;
+}
+
+
+//------------------------------------------------------------------------------
+// This function tests the generator for polygon sets.
+void test_polyset_gen()
+{
+ typedef itl::list<point<int> > PolygonT;
+ typedef itl::list<PolygonT> PolygonSetT;
+
+ point_gentor<int> pointgen;
+ pointgen.setRange(interval<int>::rightopen(-99, 100));
+
+ PolygonT some_poly;
+ polygon_gentor<PolygonT> polygen;
+ polygen.setDomainGentor(&pointgen);
+ polygen.setRangeOfSampleSize(interval<int>::rightopen(1, 5));
+
+ PolygonSetT some_polyset;
+ polygon_set_gentor<PolygonSetT> polysetgen;
+ polysetgen.setDomainGentor(&polygen);
+ polysetgen.setRangeOfSampleSize(interval<int>::rightopen(1, 3));
+
+ for(int idx=0; idx<10; idx++)
+ {
+ polysetgen.some(some_polyset);
+ cout << "[";
+ for(PolygonSetT::iterator its_ = some_polyset.begin();
+ its_ != some_polyset.end(); ++its_)
+ {
+ PolygonT& some_poly_ = *its_;
+ cout << "{";
+ for(PolygonT::iterator it_ = some_poly_.begin();
+ it_ != some_poly_.end(); ++it_)
+ cout << "(" << it_->x << "," << it_->y << ")";
+ cout << "}\n";
+ }
+ cout << "]\n";
+ }
+}
+
+
+//------------------------------------------------------------------------------
+// Test single laws using this
+void test_LawValidater()
+{
+
+ //typedef PolygonCommutativity
+ // < CPolygonSet > TestLawT;
+ //LawValidater<TestLawT, RandomGentor> test_law;
+
+ typedef PolygonSymmetricDifference
+ < CPolygonSet > TestLawT;
+ LawValidater<TestLawT, RandomGentor> test_law;
+
+ //-----------------------------------------------------------------------------
+ // Set the test automatons parameters:
+ // Size of polygon sets is in [0 .. |set|]
+ // Size of polygon sets is in [0 .. |set|]
+ // |set|,|poly|, min, max
+ GentorProfileSgl::it()->set_polygon_profile(1, 3, 0, 10);
+ int test_count = 10000;
+
+ ptime start, stop;
+ test_law.set_trials_count(test_count);
+
+ std::cout << "Start\n";
+ start = ptime(microsec_clock::local_time());
+ test_law.run();
+ stop = ptime(microsec_clock::local_time());
+ std::cout << "Stop. Time elapsed: " << stop - start << endl;
+}
+
+
+
+int main()
+{
+ //test_polyset_gen();
+ //polygon_test();
+ //test_polygon_set<CPolygonSet>();
+ test_LawValidater();
+}
+
+
Added: sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_polygon_/point_gentor.hpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -0,0 +1,87 @@
+/*-----------------------------------------------------------------------------+
+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)
++-----------------------------------------------------------------------------*/
+/* ------------------------------------------------------------------
+class point_gentor
+--------------------------------------------------------------------*/
+#ifndef __POINT_GENTOR_H_JOFA_000714__
+#define __POINT_GENTOR_H_JOFA_000714__
+
+#include <boost/itl/type_traits/to_string.hpp>
+#include <boost/itl_xt/gentorit.hpp>
+#include <boost/itl_xt/numbergentor.hpp>
+#include <boost/itl_xt/seqgentor.hpp>
+
+namespace boost{namespace itl
+{
+
+//toy point.
+template<class DomainT>
+struct point
+{
+ //CL typedef DomainT coordinate_type;
+
+ std::string as_string()const
+ {
+ return std::string(
+ "(" + to_string<DomainT>::apply(x) + "," +
+ to_string<DomainT>::apply(y) + ")"
+ );
+ }
+
+ DomainT x;
+ DomainT y;
+};
+
+template<class DomainT>
+bool operator == (const point<DomainT>& left, const point<DomainT>& right)
+{
+ return left.x == right.x && left.y == right.y;
+}
+
+template <class Type>
+struct type_to_string<itl::point<Type> >
+{
+ static std::string apply()
+ { return "point<"+ type_to_string<Type>::apply() +">"; }
+};
+
+template <class DomainT, class PointT = point<DomainT> >
+class point_gentor: public RandomGentorAT<PointT>
+{
+public:
+ virtual void some(PointT& x);
+
+ void setRange(const itl::interval<DomainT>& range)
+ { m_valueRange = range; }
+
+ void setValueRange(DomainT low, DomainT up)
+ { m_valueRange.set(low,up, itl::right_open); }
+
+ void setMaxIntervalLength(DomainT len) { m_maxIntervalLength=len; }
+ void setProbDerivation();
+
+private:
+ NumberGentorT<DomainT> m_DomainTGentor;
+
+ interval<DomainT> m_valueRange;
+ DomainT m_maxIntervalLength;
+};
+
+
+template <class DomainT, class PointT>
+void point_gentor<DomainT, PointT>::some(PointT& value)
+{
+ value.x = m_DomainTGentor(m_valueRange);
+ value.y = m_DomainTGentor(m_valueRange);
+};
+
+}} // namespace itl boost
+
+#endif
+
+
Added: sandbox/itl/libs/validate/example/labat_polygon_/polygon_gentor.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_polygon_/polygon_gentor.hpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -0,0 +1,210 @@
+/*-----------------------------------------------------------------------------+
+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 __polygon_gentor_H_JOFA_000724__
+#define __polygon_gentor_H_JOFA_000724__
+
+#include <boost/itl/interval.hpp>
+#include <boost/itl_xt/gentorit.hpp>
+#include <boost/itl_xt/list.hpp>
+
+namespace boost{namespace itl
+{
+
+template <class PolygonT>
+class polygon_gentor: public RandomGentorAT<PolygonT>
+{
+public:
+ typedef typename PolygonT::value_type ValueTypeTD;
+ typedef typename PolygonT::value_type DomainTD;
+ typedef list<ValueTypeTD> SampleTypeTD;
+
+ virtual void some(PolygonT& x);
+ void last(PolygonT& x)const;
+ void last_permuted(PolygonT& x)const;
+
+ void setDomainGentor(RandomGentorAT<DomainTD>* gentor)
+ { m_domainGentor = gentor; }
+
+ void setRangeOfSampleSize(int lwb, int upb)
+ { m_sampleSizeRange = interval<int>::rightopen(lwb,upb); }
+ void setRangeOfSampleSize(const interval<int>& szRange)
+ { BOOST_ASSERT(szRange.is(right_open)); m_sampleSizeRange = szRange; }
+
+ void setUnique(bool truth) { m_unique = truth; }
+
+private:
+ RandomGentorAT<DomainTD>* m_domainGentor;
+ interval<int> m_sampleSizeRange;
+ SampleTypeTD m_sample;
+ int m_sampleSize;
+ bool m_unique;
+};
+
+
+template <class PolygonT>
+void polygon_gentor<PolygonT>::some(PolygonT& x)
+{
+ NumberGentorT<int> intGentor;
+ x.clear();
+ m_sample.clear();
+ m_sampleSize = intGentor(m_sampleSizeRange);
+
+ DomainTD key, first;
+
+ if(m_sampleSize == 0)
+ return;
+
+ m_domainGentor->some(first);
+ x.push_back(first);
+
+ for(int i=1; i<m_sampleSize; i++)
+ {
+ m_domainGentor->some(key);
+
+ if(m_unique)
+ {
+ typename PolygonT::iterator pos_ = std::find(x.begin(), x.end(), key);
+ if(pos_ == x.end())
+ x.push_back(key);
+ }
+ else x.push_back(key);
+
+ m_sample.push_back(key);
+ }
+
+ if(m_sampleSize > 1 && !(*x.rbegin() == first))
+ x.push_back(first);
+}
+
+
+template <class PolygonT>
+void polygon_gentor<PolygonT>::last(PolygonT& x)const
+{
+ x.clear();
+ const_FORALL(typename SampleTypeTD, it, m_sample) x.insert(*it);
+}
+
+template <class PolygonT>
+void polygon_gentor<PolygonT>::last_permuted(PolygonT& x)const
+{
+ x.clear();
+
+ SampleTypeTD perm;
+
+ NumberGentorT<int> intGentor;
+ const_FORALL(typename SampleTypeTD, it, m_sample)
+ {
+ if( 0==intGentor(2) ) perm.push_back(*it);
+ else perm.push_front(*it);
+ }
+
+ const_FORALL(typename SampleTypeTD, pit, perm) x.insert(*pit);
+}
+
+
+//------------------------------------------------------------------------------
+
+template <class PolygonSetT>
+class polygon_set_gentor: public RandomGentorAT<PolygonSetT>
+{
+public:
+ typedef typename PolygonSetT::value_type ValueTypeTD;
+ typedef typename PolygonSetT::value_type DomainTD;
+ typedef list<ValueTypeTD> SampleTypeTD;
+
+ virtual void some(PolygonSetT& x);
+ void last(PolygonSetT& x)const;
+ void last_permuted(PolygonSetT& x)const;
+
+ void setDomainGentor(RandomGentorAT<DomainTD>* gentor)
+ { m_domainGentor = gentor; }
+
+ void setRangeOfSampleSize(int lwb, int upb)
+ { m_sampleSizeRange = interval<int>::rightopen(lwb,upb); }
+ void setRangeOfSampleSize(const interval<int>& szRange)
+ { BOOST_ASSERT(szRange.is(right_open)); m_sampleSizeRange = szRange; }
+
+ void setUnique(bool truth) { m_unique = truth; }
+
+private:
+ RandomGentorAT<DomainTD>* m_domainGentor;
+ interval<int> m_sampleSizeRange;
+ SampleTypeTD m_sample;
+ int m_sampleSize;
+ bool m_unique;
+};
+
+
+template <class PolygonSetT>
+void polygon_set_gentor<PolygonSetT>::some(PolygonSetT& x)
+{
+ NumberGentorT<int> intGentor;
+ x.clear();
+ m_sample.clear();
+ m_sampleSize = intGentor(m_sampleSizeRange);
+
+ DomainTD key, first;
+
+ if(m_sampleSize == 0)
+ return;
+
+ m_domainGentor->some(first);
+ x.push_back(first);
+
+ for(int i=1; i<m_sampleSize; i++)
+ {
+ DomainTD key;
+ m_domainGentor->some(key);
+
+ if(m_unique)
+ {
+ typename PolygonSetT::iterator pos_ = std::find(x.begin(), x.end(), key);
+ if(pos_ == x.end())
+ x.push_back(key);
+ }
+ else x.push_back(key);
+
+ m_sample.push_back(key);
+ }
+
+ if(m_sampleSize > 1)
+ x.push_back(first);
+}
+
+
+template <class PolygonSetT>
+void polygon_set_gentor<PolygonSetT>::last(PolygonSetT& x)const
+{
+ x.clear();
+ const_FORALL(typename SampleTypeTD, it, m_sample) x.insert(*it);
+}
+
+template <class PolygonSetT>
+void polygon_set_gentor<PolygonSetT>::last_permuted(PolygonSetT& x)const
+{
+ x.clear();
+
+ SampleTypeTD perm;
+
+ NumberGentorT<int> intGentor;
+ const_FORALL(typename SampleTypeTD, it, m_sample)
+ {
+ if( 0==intGentor(2) ) perm.push_back(*it);
+ else perm.push_front(*it);
+ }
+
+ const_FORALL(typename SampleTypeTD, pit, perm) x.insert(*pit);
+}
+
+
+
+}} // namespace boost itl
+
+#endif
+
+
Added: sandbox/itl/libs/validate/example/labat_polygon_/polygon_laws.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_polygon_/polygon_laws.hpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -0,0 +1,160 @@
+/*-----------------------------------------------------------------------------+
+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 __itl_polygon_laws_hpp_JOFA_090901__
+#define __itl_polygon_laws_hpp_JOFA_090901__
+
+#define LAW_BASED_TEST_BOOST_POLYGON
+
+#include <boost/itl/type_traits/value_size.hpp>
+#include <boost/validate/laws/law.hpp>
+#include <boost/polygon/polygon.hpp>
+#include "custom_polygon.hpp"
+
+namespace boost{namespace itl
+{
+
+ template <typename Type>
+ class PolygonCommutativity
+ : public Law<PolygonCommutativity<Type>,
+ LOKI_TYPELIST_2(Type,Type), LOKI_TYPELIST_2(Type,Type)>
+ {
+ // a o b == b o a computed as
+ //lsum=a; lsum+=b; rsum=b; rsum+=a => lsum==rsum
+ //Input = (a := inVal1, b := inVal2)
+ //Output = (sum_lhs, sum_rhs)
+
+ public:
+ std::string name()const { return "Polygon Commutativity"; }
+ std::string formula()const { return "a o b == b o a 'inplace'"; }
+
+ std::string typeString()const
+ {
+ return "Commutativity<"+type_to_string<Type>::apply()+">";
+ }
+
+ public:
+
+ size_t size()const
+ {
+ return value_size<Type>::apply(this->template getInputValue<operand_a>())+
+ value_size<Type>::apply(this->template getInputValue<operand_b>());
+ }
+
+ bool holds()
+ {
+ using namespace boost::polygon;
+ using namespace boost::polygon::operators;
+
+ Type value_a = this->template getInputValue<operand_a>();
+ Type value_b = this->template getInputValue<operand_b>();
+
+ Type left = value_a;
+ boost::polygon::operators::operator+=(left, value_b);
+ Type right = value_b;
+ boost::polygon::operators::operator+=(right, value_a);
+
+ this->template setOutputValue<lhs_result>(left);
+ this->template setOutputValue<rhs_result>(right);
+
+ return equivalence(left, right);
+ }
+
+ bool debug_holds()
+ {
+ // If law violations are found, this function is called
+ // for the smallest violated law instance.
+ // You may replace the call of
+ // holds();
+ // by your own code that is providing additional debugging
+ // information.
+ return holds();
+ }
+
+ };
+
+
+
+ template <typename Type>
+ class PolygonSymmetricDifference
+ : public Law<PolygonSymmetricDifference<Type>,
+ LOKI_TYPELIST_2(Type,Type), LOKI_TYPELIST_2(Type,Type)>
+ {
+ // a o b == b o a computed as
+ //lsum=a; lsum+=b; rsum=b; rsum+=a => lsum==rsum
+ //Input = (a := inVal1, b := inVal2)
+ //Output = (sum_lhs, sum_rhs)
+
+ public:
+ std::string name()const { return "Polygon Symmetric Difference"; }
+ std::string formula()const { return "(a+b) - (a&b) == (a-b) + (b-a)"; }
+
+ std::string typeString()const
+ {
+ return "SymmetricDifference<"+type_to_string<Type>::apply()+">";
+ }
+
+ public:
+
+ size_t size()const
+ {
+ return value_size<Type>::apply(this->template getInputValue<operand_a>())+
+ value_size<Type>::apply(this->template getInputValue<operand_b>());
+ }
+
+ bool holds()
+ {
+ using namespace boost::polygon;
+ using namespace boost::polygon::operators;
+
+ //std::cout << this->template getInputValue<operand_a>().as_string() << std::endl;
+
+ // --- left hand side ------------------------
+ Type a_plus_b = this->template getInputValue<operand_a>();
+ boost::polygon::operators::operator+=(a_plus_b, this->template getInputValue<operand_b>());
+
+ Type a_sec_b = this->template getInputValue<operand_a>();
+ boost::polygon::operators::operator&=(a_sec_b, this->template getInputValue<operand_b>());
+
+ Type lhs = a_plus_b;
+ boost::polygon::operators::operator-=(lhs, a_sec_b);
+
+ // --- right hand side -----------------------
+ Type a_minus_b = this->template getInputValue<operand_a>();
+ boost::polygon::operators::operator-=(a_minus_b, this->template getInputValue<operand_b>());
+
+ Type b_minus_a = this->template getInputValue<operand_b>();
+ boost::polygon::operators::operator-=(b_minus_a, this->template getInputValue<operand_a>());
+
+ Type rhs = a_minus_b;
+ boost::polygon::operators::operator+=(rhs, b_minus_a);
+
+ this->template setOutputValue<lhs_result>(lhs);
+ this->template setOutputValue<rhs_result>(rhs);
+
+ return equivalence(lhs, rhs);
+ }
+
+ bool debug_holds()
+ {
+ // If law violations are found, this function is called
+ // for the smallest violated law instance.
+ // You may replace the call of
+ // holds();
+ // by your own code that is providing additional debugging
+ // information.
+ return holds();
+ }
+
+ };
+
+}} // namespace itl boost
+
+#endif // __itl_polygon_laws_hpp_JOFA_070411__
+
Added: sandbox/itl/libs/validate/example/labat_polygon_/vc9_labat_polygon.sln
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_polygon_/vc9_labat_polygon.sln 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc9_labat_polygon", "vc9_labat_polygon.vcproj", "{BF42574F-66E2-42DD-90D9-3A8FCE6F472C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F472C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F472C}.Debug|Win32.Build.0 = Debug|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F472C}.Release|Win32.ActiveCfg = Release|Win32
+ {BF42574F-66E2-42DD-90D9-3A8FCE6F472C}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Added: sandbox/itl/libs/validate/example/labat_polygon_/vc9_labat_polygon.vcproj
==============================================================================
--- (empty file)
+++ sandbox/itl/libs/validate/example/labat_polygon_/vc9_labat_polygon.vcproj 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="vc9_labat_polygon"
+ ProjectGUID="{BF42574F-66E2-42DD-90D9-3A8FCE6F472C}"
+ RootNamespace="vc9_labat_polygon"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../../../bin/debug"
+ IntermediateDirectory="../../../../bin/obj/$(ProjectName)/debug"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../; ../../../../boost_1_35_0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ 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_polygon_\labat_polygon.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_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-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -82,7 +82,7 @@
//LawValidater<TestLawT, RandomGentor> test_law;
typedef AddendInclusion
- <interval_set<int>, int > TestLawT;
+ <interval_set<int>, itl::interval<int> > TestLawT;
LawValidater<TestLawT, RandomGentor> test_law;
//-----------------------------------------------------------------------------
Modified: sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp
==============================================================================
--- sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp (original)
+++ sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp 2009-09-02 10:01:25 EDT (Wed, 02 Sep 2009)
@@ -108,6 +108,32 @@
set_laws_per_cycle(std::max(1, 100/factor));
}
+void GentorProfile::set_polygon_profile(int max_polygon_set_size, int max_polygon_size, int min_coord, int max_coord)
+{
+ int factor = 1;
+ int unit = max_polygon_set_size+1;
+ int value = unit*factor;
+ _unit = unit;
+ _scaling = factor;
+ set_defaults();
+
+ // Codomain values
+ set_range_int(min_coord, max_coord);
+ set_range_nat(0, 16);
+ set_range_double(0.0, 1.0);
+ set_range_codomain_ContainerSize(0, max_polygon_size+1);
+
+ // Parameter that influence speed
+ set_range_ContainerSize(0, value);
+ set_range_interval_int(-value, value);
+ set_range_interval_double(-value, value);
+ set_maxIntervalLength(value);
+
+ // Parameter to influence frequencies of output update.
+ set_repeat_count(1);
+ set_trials_count(adjusted_trials_count());
+ set_laws_per_cycle(std::max(1, 100/factor));
+}
GentorProfile::GentorProfile()
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