7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for properties facility"
10 #include <boost/test/unit_test.hpp>
17 using namespace boost;
56 props.
add(
"count",
int(10));
57 props.
add(
"name", std::string(
"lolo"));
59 BOOST_CHECK_EQUAL ( props.
check(
"nono" ), false );
60 BOOST_CHECK_EQUAL ( props.
check(
"count" ), true );
61 BOOST_CHECK_EQUAL ( props.
check(
"name" ), true );
77 props.
add(
"name", std::string(
"(empty)"));
81 props.
set(
"name", std::string(
"john" ));
83 BOOST_CHECK_EQUAL ( props.
value<std::string>(
"name"),
"john" );
87 props.
set(
"name", std::string(
"joanna" ));
89 BOOST_CHECK_EQUAL ( props.
value<std::string>(
"name"),
"joanna" );
106 PropertyList::PropertyStorage_t::iterator itr = props.
store.begin();
107 for ( ; itr != props.
store.end(); ++itr, ++counter )
109 const std::string& pname = itr->first;
110 BOOST_CHECK_EQUAL ( props.
value<
Uint>(pname), counter );
118 AssertionManager::instance().AssertionThrows =
true;
121 props.
add(
"count",
int(10));
122 props.
add(
"name", std::string(
"john"));
123 props.
add(
"surname", std::string(
"doe"));
124 props.
add(
"size",
int(99));
126 BOOST_CHECK_EQUAL ( props.
store.size(), (
Uint) 4 );
128 BOOST_CHECK_EQUAL ( props.
check(
"count" ), true );
129 BOOST_CHECK_EQUAL ( props.
check(
"name" ), true );
130 BOOST_CHECK_EQUAL ( props.
check(
"surname" ), true );
131 BOOST_CHECK_EQUAL ( props.
check(
"size" ), true );
133 BOOST_CHECK_EQUAL ( props.
check(
"address" ), false );
134 BOOST_CHECK_EQUAL ( props.
check(
"age" ), false );
138 props.
erase(
"count");
139 props.
erase(
"surname");
141 BOOST_CHECK_EQUAL ( props.
store.size(), (
Uint) 2 );
143 BOOST_CHECK_EQUAL ( props.
check(
"count" ), false );
144 BOOST_CHECK_EQUAL ( props.
check(
"surname" ), false );
150 BOOST_CHECK_EQUAL ( props.
check(
"address" ), false );
153 BOOST_CHECK_EQUAL ( props.
check(
"age" ), false );
155 BOOST_CHECK_EQUAL ( props.
store.size(), (
Uint) 2 );
160 BOOST_AUTO_TEST_SUITE_END()
162 external boost library namespace
PropertyList & add(const std::string &name, const boost::any &value)
adds a property to the list
Properties_Fixture()
common setup for each test case
bool check(const std::string &prop_name) const
TYPE value(const std::string &pname) const
Top-level namespace for coolfluid.
void set(const std::string &pname, const boost::any &val)
void erase(const std::string &pname)
unsigned int Uint
typedef for unsigned int
BOOST_AUTO_TEST_CASE(construct)
~Properties_Fixture()
common tear-down for each test case
Most basic kernel library.
PropertyStorage_t store
storage of options