25 #ifndef WPROPERTYSTRUCT_TEST_H
26 #define WPROPERTYSTRUCT_TEST_H
30 #include <cxxtest/TestSuite.h>
32 #include "../WPropertyTypes.h"
33 #include "../WPropertyVariable.h"
34 #include "../WPropertyStruct.h"
49 TestStruct* prop =
new TestStruct(
"Hallo",
"Description Text" );
50 TS_ASSERT( prop->size() == 2 );
53 BOOST_MPL_ASSERT( ( boost::is_same< TestStruct::TupleType, boost::tuple< WPropInt, WPropBool > > ) );
54 BOOST_MPL_ASSERT( ( boost::is_same< TestStruct::TypeVector,
55 boost::mpl::vector< WPropInt, WPropBool > >
71 TestStruct prop(
new TestStruct::element_type(
"Hallo",
"Description Text" ) );
74 prop->getProperty< 0 >()->set( 12 );
75 prop->getProperty< 1 >()->set(
true );
78 std::string got = prop->getAsString();
81 prop->getProperty< 0 >()->set( 111 );
82 prop->getProperty< 1 >()->set(
false );
85 prop->setAsString( got );
87 TS_ASSERT( prop->getProperty< 0 >()->get() == 12 );
88 TS_ASSERT( prop->getProperty< 1 >()->get() ==
true );
91 TestStruct prop2(
new TestStruct::element_type(
"Hallo2",
"Description Text" ) );
93 TS_ASSERT( prop2->getProperty< 0 >()->get() == 12 );
94 TS_ASSERT( prop2->getProperty< 1 >()->get() ==
true );
103 TestStruct prop(
"Hallo",
"Description Text" );
106 WPropInt i = prop.getProperty< 0 >();
107 TS_ASSERT( i.get() );
108 WPropBool b = prop.getProperty< 1 >();
109 TS_ASSERT( b.get() );
113 TS_ASSERT( base.get() );
116 TS_ASSERT( base->toPropBool().get() );
std::shared_ptr< WPropertyBase > SPtr
Convenience typedef for a std::shared_ptr< WPropertyBase >
void testInstantiation(void)
Test instantiation, also test name and description and type (from WPropertyBase)
void testGet(void)
Test getter.
void testSet(void)
Test the set method.
This is a property which encapsulates a given, fixed number of other properties.
std::shared_ptr< WPropertyStructType > SPtr
Convenience typedef for a std::shared_ptr< WPropertyStructType >