7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for XML maps manipulation"
10 #include "rapidxml/rapidxml.hpp"
11 #include <boost/test/unit_test.hpp>
26 BOOST_AUTO_TEST_SUITE( XmlSignalFrame_TestSuite )
34 std::string str_second_map =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
35 "<frame type=\"signal\">"
37 " <value key=\"map_A\">"
40 " <value key=\"not_a_map\">"
43 " <value key=\"map_B\">"
59 SignalFrame second_frame ( second_doc.get()->content->first_node(
"frame" ) );
62 BOOST_CHECK ( second_frame.has_map(
"map_A") );
63 BOOST_CHECK ( second_frame.has_map(
"map_B") );
64 BOOST_CHECK ( !second_frame.has_map(
"not_a_map") );
67 URI sender(
"cpath:/sender");
68 URI receiver(
"cpath:/receiver");
69 SignalFrame third_frame (
"theTarget", sender, receiver);
72 rapidxml::xml_attribute<>* tmp_attr;
74 BOOST_CHECK ( frame_node !=
nullptr );
77 tmp_attr = frame_node->first_attribute(
"target" );
78 BOOST_CHECK ( tmp_attr !=
nullptr );
79 BOOST_CHECK_EQUAL ( std::string(tmp_attr->value()), std::string(
"theTarget") );
81 tmp_attr = frame_node->first_attribute(
"sender" );
82 BOOST_CHECK ( tmp_attr !=
nullptr );
83 BOOST_CHECK_EQUAL (
URI(tmp_attr->value()).
string(), sender.
string() );
85 tmp_attr = frame_node->first_attribute(
"receiver" );
86 BOOST_CHECK ( tmp_attr !=
nullptr );
87 BOOST_CHECK_EQUAL (
URI(tmp_attr->value()).
string(), receiver.
string());
94 URI sender(
"cpath:/sender");
95 URI receiver(
"cpath:/receiver");
98 BOOST_CHECK ( !frame.
has_map(
"MyMap") );
102 BOOST_CHECK ( frame.
has_map(
"MyMap") );
107 BOOST_AUTO_TEST_SUITE_END()
109
Classes that implement the XML protocol for use in COOLFluiD.
boost::shared_ptr< XmlDoc > parse_string(const std::string &str)
rapidxml::xml_node< char > * content
Pointer to the underlying XML implementation.
Uniform Resource Identifier (see http://en.wikipedia.org/wiki/Uniform_Resource_Identifier) ...
BOOST_AUTO_TEST_CASE(contructors)
XmlNode content
The managed node.
SignalFrame & map(const std::string &name)
void map(Field &field, Eigen::Map< Derived > &v, const Uint row_idx, const Uint var_idx)
Most basic kernel library.
std::string string() const
Map main_map
The main map.
bool is_not_null(T ptr)
predicate for comparison to nullptr
bool has_map(const std::string &name) const