7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for cf3::common::handle"
10 #include <boost/test/unit_test.hpp>
21 BOOST_AUTO_TEST_SUITE(HandleSuite)
32 BOOST_CHECK(a ==
nullptr);
33 BOOST_CHECK(
nullptr == a);
35 BOOST_CHECK(!(
nullptr != a));
36 BOOST_CHECK(!(a !=
nullptr));
41 boost::shared_ptr<Group>
g = allocate_component<Group>(
"group");
45 BOOST_CHECK_EQUAL(a->name(),
"group");
46 BOOST_CHECK_EQUAL((*a).name(),
"group");
47 BOOST_CHECK_EQUAL(a.get()->name(),
"group");
56 boost::shared_ptr<Group>
group = allocate_component<Group>(
"group");
61 BOOST_CHECK_EQUAL(a->
name(),
"group");
65 BOOST_CHECK_EQUAL(b->name(),
"group");
70 BOOST_CHECK_EQUAL(c->name(),
"group");
83 BOOST_CHECK_EQUAL(f->
name(),
"group");
90 boost::shared_ptr<Group const> const_shared(group);
92 BOOST_CHECK_EQUAL(const_handle->
name(),
"group");
109 boost::shared_ptr<Group>
group = allocate_component<Group>(
"group");
112 BOOST_CHECK_EQUAL(
"group", group_handle->name());
114 group = allocate_component<Group>(
"group2");
115 BOOST_CHECK(!group_handle);
117 BOOST_CHECK_EQUAL(
"group2", group_handle->name());
122 boost::shared_ptr<Group>
group = allocate_component<Group>(
"group");
127 BOOST_CHECK_EQUAL(
"group", const_group_handle->
name());
132 boost::shared_ptr<Group>
group = allocate_component<Group>(
"group");
141 BOOST_CHECK_EQUAL(
"group", comp_handle->
name());
142 BOOST_CHECK_EQUAL(
"group", const_comp_handle->
name());
147 BOOST_AUTO_TEST_SUITE_END()
149
bool is_null(T ptr)
predicate for comparison to nullptr
BOOST_AUTO_TEST_CASE(NullHandle)
Safe pointer to an object. This is the supported method for referring to components.
const std::string & name() const
Access the name of the component.
Real e()
Definition of the Unit charge [C].
Component for grouping other components.
Top-level namespace for coolfluid.
static boost::proto::terminal< ExpressionGroupTag >::type group
Use group(expr1, expr2, ..., exprN) to evaluate a group of expressions.
Most basic kernel library.
bool is_not_null(T ptr)
predicate for comparison to nullptr