54 : pf(
"pf",
"pfd", -1.0),pd(
"pd",
"pdd", +1.0),
55 ps(
"ps",
"psd",
"std::string"),
57 pc1(
"pc1",
"pcd1",
'a'),
58 pc2(
"pc2",
"pcd1",
'b'),
59 subbag1(
"s1",
"s1d"),subbag2(
"s2",
"s2d")
73 subbag1.
set().add( &subbag2 );
74 subbag1.
set().add( &pf );
75 subbag1.
set().add( &pd );
77 subbag2.
set().add( &ps );
78 subbag2.
set().add( &pc );
90 bool operator==(
const std::vector<double>& a,
const std::vector<double>& b)
92 if ( a.size() != b.size() ) {
93 log(
Error) <<
"Wrong vector sizes : " << a.size() <<
" "<< b.size()<<
endlog();
96 for(
unsigned int i =0; i != a.size(); ++i)
99 log(
Error) <<
"Wrong vector element: "<<a[i]<<
" != "<<b[i]<<
" i:" << i<<
endlog();
125 BOOST_CHECK(
pi1->
update( static_cast< PropertyBase* >(
pi2) ) );
141 BOOST_CHECK(
pi1->
copy( pib2 ) );
184 BOOST_CHECK( pc1.update( pcb2 ) );
185 BOOST_REQUIRE_EQUAL(
pc2.
get(), pc1.get() );
193 BOOST_REQUIRE_EQUAL(
pc2.
get(), pc1.get() );
200 BOOST_CHECK( pc1.copy( pcb2 ) );
201 BOOST_REQUIRE_EQUAL(
pc2.
get(), pc1.get() );
208 BOOST_REQUIRE_EQUAL( pc1orig.
getDataSource().get(), pc1.getDataSource().get() );
212 BOOST_CHECK( pc1.ready() );
213 BOOST_REQUIRE_EQUAL(
pc2.
get(), pc1.get() );
216 BOOST_REQUIRE_EQUAL(
pc2.
getDataSource().get(), pc1.getDataSource().get() );
221 BOOST_REQUIRE_EQUAL(
pc2.
get(), pc1.get() );
224 BOOST_REQUIRE_EQUAL(
pc2.
getDataSource().get(), pc1.getDataSource().get() );
242 BOOST_CHECK(
bag.
find(
"pf" ) == 0 );
261 BOOST_CHECK_EQUAL( result.size(), 8);
264 BOOST_CHECK_EQUAL( result[0],
string(
"pi1"));
265 BOOST_CHECK_EQUAL( result[1],
string(
"pi2"));
266 BOOST_CHECK_EQUAL( result[2],
string(
"s1"));
267 BOOST_CHECK_EQUAL( result[3],
string(
"s1.s2"));
268 BOOST_CHECK_EQUAL( result[4],
string(
"s1.s2.ps"));
269 BOOST_CHECK_EQUAL( result[5],
string(
"s1.s2.pc"));
270 BOOST_CHECK_EQUAL( result[6],
string(
"s1.pf"));
271 BOOST_CHECK_EQUAL( result[7],
string(
"s1.pd"));
296 BOOST_CHECK_EQUAL(
bag.
find(
"int3"), int3 );
305 BOOST_CHECK_EQUAL(
bag.
find(
"int3"), int3 );
334 BOOST_TEST_MESSAGE(
"----- Testing testRep");
335 std::vector<string> names = TypeInfoRepository::Instance()->getTypes();
336 for (std::vector<string>::iterator it = names.begin(); it != names.end(); ++it) {
337 BOOST_TEST_MESSAGE(
"----------- loop names: " << *it);
340 BOOST_REQUIRE( TypeInfoRepository::Instance()->type( *it ) );
341 target = TypeInfoRepository::Instance()->type( *it )->buildProperty(
"Result",
"D");
355 std::vector<double> init(33, 1.0);
362 BOOST_CHECK( pvd.
get() == init );
363 BOOST_CHECK( pvd.
set() == init );
372 BOOST_CHECK( pvd == pvd2 );
373 pvd2.
value().clear();
383 std::vector<double> init(33, 1.0);
387 BOOST_CHECK( pvd.
get() == init );
388 BOOST_CHECK( pvd.
set() == init );
398 BOOST_REQUIRE( pvalue.
ready() );
401 BOOST_CHECK( pvd.
rvalue()[3] == 42 );
418 BOOST_CHECK( !p2.
ready() );
420 BOOST_CHECK( !p3.ready() );
423 BOOST_CHECK( !p3.ready() );
426 BOOST_CHECK( !p2.ready() );
429 BOOST_CHECK( p2.ready() );
450 b1.
value().addProperty( b2 );
451 b2.
value().addProperty( p1 );
456 b1c.
value().addProperty( b2c );
457 b2c.
value().addProperty( p1c );
459 BOOST_CHECK( p1.
get() != p1c.
get() );
463 BOOST_CHECK( p1.
get() == -1 );
464 BOOST_CHECK( p1c.
get() == -1 );
472 BOOST_CHECK( bag->
getName() ==
"b1" );
475 BOOST_CHECK( bag->getName() ==
"b2" );
479 BOOST_CHECK( res->getName() ==
"p1" );
480 BOOST_CHECK( res->get() == -1 );
virtual base::DataSourceBase::shared_ptr getDataSource() const
bool removeProperty(PropertyBag &bag, const std::string &path, const std::string &separator)
#define BOOST_FIXTURE_TEST_SUITE(suite_name, F)
DataSourceType get() const
bool composeType(base::DataSourceBase::shared_ptr source, base::DataSourceBase::shared_ptr target) const
bool updateProperty(PropertyBag &target, const PropertyBag &source, const std::string &name, const std::string &separator)
void add(base::PropertyBase *p)
Property< T > * getPropertyType(const std::string &name) const
Property< PropertyBag > subbag1
const std::string & getTypeName() const
bool propertyDecomposition(base::PropertyBase *source, PropertyBag &targetbag, bool recurse)
virtual bool copy(const base::PropertyBase *other)
virtual Property< T > * clone() const
#define BOOST_AUTO_TEST_SUITE_END()
const_reference_t rvalue() const
A container for holding references to properties.
PropertyBase * findProperty(const PropertyBag &bag, const std::string &nameSequence, const std::string &separator)
Property< PropertyBag > subbag2
void deletePropertyBag(PropertyBag &target)
Property< T > & addProperty(const std::string &name, T &attr)
Property< std::string > ps
base::PropertyBase * find(const std::string &name) const
bool removeProperty(base::PropertyBase *p)
virtual bool setDataSource(const base::DataSourceBase::shared_ptr &dsb)
const std::string & getDescription() const
virtual const types::TypeInfo * getTypeInfo() const
bool typeDecomposition(base::DataSourceBase::shared_ptr dsb, PropertyBag &targetbag, bool recurse)
BOOST_AUTO_TEST_CASE(testCopyUpdateLink)
static const types::TypeInfo * getTypeInfo()
vector< string > listProperties(const PropertyBag &source, const std::string &separator)
bool storeProperty(PropertyBag &bag, const std::string &path, base::PropertyBase *item, const std::string &separator)
bool operator==(const std::vector< double > &a, const std::vector< double > &b)
virtual bool update(const base::PropertyBase *other)
const std::string & getName() const
virtual Property< T > * create() const
virtual bool update(const PropertyBase *other)=0
bool ownsProperty(base::PropertyBase *p) const
static Logger::LogFunction endlog()
virtual DataSourceBase::shared_ptr getDataSource() const =0
virtual const types::TypeInfo * getTypeInfo() const =0