COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-xml-signal-options.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2013 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 
7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for XML options manipulation"
9 
10 #include <iostream>
11 
12 #include "rapidxml/rapidxml.hpp"
13 #include <boost/test/unit_test.hpp>
14 #include <boost/assign/list_of.hpp>
15 
16 #include "common/OptionArray.hpp"
18 #include "common/OptionT.hpp"
19 #include "common/OptionURI.hpp"
20 #include <common/Core.hpp>
21 #include <common/Environment.hpp>
22 #include <common/OptionList.hpp>
23 
25 #include "common/XML/Protocol.hpp"
28 
29 using namespace boost::assign;
30 using namespace cf3;
31 using namespace cf3::common;
32 using namespace cf3::common::XML;
33 
35 
36 struct XmlFixture
37 {
39  {
40  Core::instance().environment().options().set("exception_backtrace", false);
41  Core::instance().environment().options().set("exception_outputs", false);
42  }
43 };
44 
45 BOOST_FIXTURE_TEST_SUITE( XmlSignalOptions_TestSuite, XmlFixture )
46 
47 
49 BOOST_AUTO_TEST_CASE ( contructors )
50 {
51  //
52  // We create an XML frame with some options, build an OptionList with it
53  // and check that options were correctly parsed.
54  //
55 
56  SignalFrame frame;
57  Map map = frame.map( Protocol::Tags::key_options() ).main_map;
58  std::vector<std::string> data(4);
59 
60  data[0] = "This is the first item";
61  data[1] = "Here is the second item";
62  data[2] = "Now we have the third item";
63  data[3] = "And then the last item";
64 
65  map.set_value("my_bool", class_name<bool>(), "false", "MyBool description").set_attribute( "mode", "adv" );
66  map.set_value("cfl", class_name<Real>(), "3.1415", "CFL number").set_attribute( "mode", "basic" );
67  map.set_array("strings", class_name<std::string>(), option_vector_to_str(data, ";"), ";", "Some special data"); // should be advanced by default
68  map.set_value("website", class_name<URI>(), "http://coolfluidsrv.vki.ac.be", "CF website")
69  .set_attribute( Protocol::Tags::attr_uri_schemes(), "http");
70 
71  SignalOptions options( frame );
72 
73  //
74  // 1. check option "my_bool"
75  //
76  boost::shared_ptr< OptionT<bool> > my_bool;
77  BOOST_CHECK( options.check("my_bool") );
78  my_bool = boost::dynamic_pointer_cast<OptionT<bool> >(options.store["my_bool"]);
79  BOOST_CHECK( my_bool.get() != nullptr );
80  BOOST_CHECK_EQUAL( my_bool->name(), std::string("my_bool") );
81  BOOST_CHECK_EQUAL( my_bool->type(), std::string( common::class_name<bool>() ) );
82  BOOST_CHECK_EQUAL( my_bool->description(), std::string("MyBool description") );
83  BOOST_CHECK_EQUAL( my_bool->value<bool>(), false );
84  BOOST_CHECK_EQUAL( my_bool->has_tag("basic"), false );
85 
86 
87  //
88  // 2. check option "cfl"
89  //
90  boost::shared_ptr< OptionT<cf3::Real> > cfl;
91  BOOST_CHECK( options.check("cfl") );
92  cfl = boost::dynamic_pointer_cast<OptionT<cf3::Real> >(options.store["cfl"]);
93  BOOST_CHECK( cfl.get() != nullptr );
94  BOOST_CHECK_EQUAL( cfl->name(), std::string("cfl") );
95  BOOST_CHECK_EQUAL( cfl->type(), std::string( common::class_name<cf3::Real>() ) );
96  BOOST_CHECK_EQUAL( cfl->description(), std::string("CFL number") );
97  BOOST_CHECK_EQUAL( cfl->value<cf3::Real>(), 3.1415 );
98  BOOST_CHECK_EQUAL( cfl->has_tag("basic"), true );
99 
100  //
101  // 3. check option "my_bool"
102  //
103  boost::shared_ptr< OptionArray<std::string> > strings;
104  BOOST_CHECK( options.check("strings") );
105  strings = boost::dynamic_pointer_cast<OptionArray<std::string> >(options.store["strings"]);
106  BOOST_CHECK( strings.get() != nullptr );
107  BOOST_CHECK_EQUAL( strings->name(), std::string("strings") );
108  BOOST_CHECK_EQUAL( std::string(strings->element_type()), std::string(common::class_name<std::string>()) );
109  BOOST_CHECK_EQUAL( strings->description(), std::string("Some special data") );
110  BOOST_CHECK_EQUAL( strings->has_tag("basic"), false );
111 
112  std::vector<std::string> data_read = strings->value< std::vector<std::string> >();
113  BOOST_CHECK_EQUAL( data.size(), data_read.size() );
114 
115  for(int i = 0 ; i < data.size() ; ++i)
116  BOOST_CHECK_EQUAL( data[i], data_read[i] );
117 
118  //
119  // 4. check option "website"
120  //
121  boost::shared_ptr< OptionURI > website;
122  BOOST_CHECK( options.check("website") );
123  website = boost::dynamic_pointer_cast<OptionURI>(options.store["website"]);
124  BOOST_CHECK( website.get() != nullptr );
125  BOOST_CHECK_EQUAL( website->name(), std::string("website") );
126  BOOST_CHECK_EQUAL( website->type(), std::string( common::class_name<URI>() ) );
127  BOOST_CHECK_EQUAL( website->description(), std::string("CF website") );
128  BOOST_CHECK_EQUAL( website->value<URI>().string(), std::string("http://coolfluidsrv.vki.ac.be") );
129  BOOST_CHECK_EQUAL( website->has_tag("basic"), false );
130  BOOST_CHECK_EQUAL( website->supported_protocols().size(), 1 );
131  BOOST_CHECK_EQUAL( website->supported_protocols()[0], URI::Scheme::HTTP );
132 }
133 
135 
136 BOOST_AUTO_TEST_CASE ( xml_to_option )
137 {
138  boost::shared_ptr< XmlDoc > xmldoc;
139  boost::shared_ptr<Option> option;
140  XmlNode node;
141 
142  //
143  // 1. a Real option with a description
144  //
145  xmldoc = parse_cstring(
146  "<value key=\"theOption\" is_option=\"true\" descr=\"This is a description\">"
147  " <real>2.71</real>"
148  "</value>");
149  node.content = xmldoc->content->first_node("value");
150  BOOST_REQUIRE_NO_THROW( option = SignalOptions::xml_to_option(node) );
151  // 1a. check the name
152  BOOST_CHECK_EQUAL( option->name(), std::string("theOption"));
153  // 1b. check the type
154  BOOST_CHECK_EQUAL( option->type(), std::string("real") );
155  // 1c. check the value
156  BOOST_CHECK_EQUAL( option->value<Real>(), Real(2.71) );
157  // 1d. check the description
158  BOOST_CHECK_EQUAL( option->description(), std::string("This is a description") );
159 
160  //
161  // 2. an Uint option with a missing description
162  //
163  xmldoc = parse_cstring(
164  "<value key=\"theAnswer\" is_option=\"true\">"
165  " <integer>42</integer>"
166  "</value>");
167  node.content = xmldoc->content->first_node("value");
168  BOOST_REQUIRE_NO_THROW( option = SignalOptions::xml_to_option(node) );
169  // 2a. check the name
170  BOOST_CHECK_EQUAL( option->name(), std::string("theAnswer"));
171  // 2b. check the type
172  BOOST_CHECK_EQUAL( option->type(), std::string("integer") );
173  // 2c. check the value
174  BOOST_CHECK_EQUAL( option->value<int>(), int(42) );
175  // 2d. check the description
176  BOOST_CHECK_EQUAL( option->description(), std::string("") );
177 
178  //
179  // 3. no key attribute
180  //
181  xmldoc = XML::parse_cstring(
182  "<value is_option=\"true\">"
183  " <integer>42</integer>"
184  "</value>");
185  node.content = xmldoc->content->first_node("value");
186  BOOST_CHECK_THROW( SignalOptions::xml_to_option(node), ProtocolError );
187 
188  //
189  // 4. option mode (basic/adv)
190  //
191  XmlDoc doc;
192  Map map( doc.add_node( Protocol::Tags::node_map() ) );
193 
194  XmlNode theAnswer = map.set_value("theAnswer", class_name<int>(), "42");
195  XmlNode pi = map.set_value("pi", class_name<Real>(), "3.14159" );
196  XmlNode euler = map.set_value("euler", class_name<Real>(), "2.71" );
197 
198  // theAnswer is not marked as basic
199  pi.set_attribute("mode", "basic");
200  euler.set_attribute("mode", "adv");
201 
202  BOOST_CHECK( !SignalOptions::xml_to_option(theAnswer)->has_tag("basic") );
203  BOOST_CHECK( SignalOptions::xml_to_option(pi)->has_tag("basic") );
204  BOOST_CHECK( !SignalOptions::xml_to_option(euler)->has_tag("basic") );
205 }
206 
208 
209 BOOST_AUTO_TEST_CASE( xml_to_option_types )
210 {
211  boost::shared_ptr< XmlDoc > xmldoc(new XmlDoc());
212  boost::shared_ptr<Option> option;
213 
214  Map map(xmldoc->add_node("map"));
215 
216  XmlNode optBool = map.set_value("optBool", class_name<bool>(), "true");
217  XmlNode optInt = map.set_value("optInt", class_name<int>(), "-15468");
218  XmlNode optUint = map.set_value("optUint", class_name<Uint>(), "17513214");
219  XmlNode optReal = map.set_value("optReal", class_name<Real>(), "3.14159");
220  XmlNode optString = map.set_value("optString", class_name<std::string>(), std::string("I am a string value"));
221  XmlNode optURI = map.set_value("optURI", class_name<URI>(), "cpath:/");
222 
223  XmlNode wrongOpt = map.content.add_node( Protocol::Tags::node_value() );
224 
225  wrongOpt.set_attribute( Protocol::Tags::attr_key(), "optOfUnknownType");
226  wrongOpt.add_node("unknown_type", "Don't know how to interpret this.");
227 
228  // 1. bool
229  BOOST_CHECK_NO_THROW( option = SignalOptions::xml_to_option(optBool) );
230  BOOST_CHECK_EQUAL( option->type(), std::string("bool") );
231  BOOST_CHECK_EQUAL( option->value<bool>(), true);
232 
233  // 2. int
234  BOOST_CHECK_NO_THROW( option = SignalOptions::xml_to_option(optInt) );
235  BOOST_CHECK_EQUAL( option->type(), std::string("integer") );
236  BOOST_CHECK_EQUAL( option->value<int>(), -15468 );
237 
238  // 3. Uint
239  BOOST_CHECK_NO_THROW( option = SignalOptions::xml_to_option(optUint) );
240  BOOST_CHECK_EQUAL( option->type(), std::string("unsigned") );
241  BOOST_CHECK_EQUAL( option->value<Uint>(), Uint(17513214) );
242 
243  // 4. Real
244  BOOST_CHECK_NO_THROW( option = SignalOptions::xml_to_option(optReal) );
245  BOOST_CHECK_EQUAL( option->type(), std::string("real") );
246  BOOST_CHECK_EQUAL( option->value<Real>(), Real(3.14159) );
247 
248  // 5. string
249  BOOST_CHECK_NO_THROW( option = SignalOptions::xml_to_option(optString) );
250  BOOST_CHECK_EQUAL( option->type(), std::string("string") );
251  BOOST_CHECK_EQUAL( option->value<std::string>(), std::string("I am a string value") );
252 
253  // 6. uri
254  BOOST_CHECK_NO_THROW( option = SignalOptions::xml_to_option(optURI) );
255  BOOST_CHECK_EQUAL( option->type(), std::string("uri") );
256  BOOST_CHECK_EQUAL( option->value<URI>().string(), std::string("cpath:/") );
257 
258  // 7. unknown type
259  BOOST_CHECK_THROW( SignalOptions::xml_to_option(wrongOpt), ValueNotFound );
260 }
261 
263 
264 BOOST_AUTO_TEST_CASE( xml_to_option_uri_schemes )
265 {
266  boost::shared_ptr< XmlDoc > xmldoc(new XmlDoc());
267  Map map(xmldoc->add_node("map"));
268  const char * tag = Protocol::Tags::attr_uri_schemes();
269 
270  XmlNode opt1 = map.set_value("opt1", class_name<URI>(), URI().string());
271  XmlNode opt2 = map.set_value("opt2", class_name<URI>(), URI().string());
272  XmlNode opt3 = map.set_value("opt3", class_name<URI>(), URI().string());
273  XmlNode opt4 = map.set_value("opt4", class_name<URI>(), URI().string());
274  XmlNode opt5 = map.set_value("opt5", class_name<URI>(), URI().string());
275 
276  // opt1 has no scheme attribute defined
277  opt2.set_attribute(tag, ""); // no scheme defined
278  opt3.set_attribute(tag, "http"); // one scheme
279  opt4.set_attribute(tag, "cpath,https,file"); // several schemes
280  opt5.set_attribute(tag, "cpath,scheme"); // a wrong scheme
281 
282  boost::shared_ptr< OptionURI > opt;
283  std::vector<URI::Scheme::Type> vect;
284 
285  // 1. check opt1
286  opt = boost::dynamic_pointer_cast<OptionURI>( SignalOptions::xml_to_option(opt1) );
287 
288  BOOST_CHECK( opt->supported_protocols().empty() );
289 
290  // 2. check opt2
291  opt = boost::dynamic_pointer_cast<OptionURI>( SignalOptions::xml_to_option(opt2) );
292 
293  BOOST_CHECK( opt->supported_protocols().empty() );
294 
295  // 3. check opt3
296  opt = boost::dynamic_pointer_cast<OptionURI>( SignalOptions::xml_to_option(opt3) );
297 
298  vect = opt->supported_protocols();
299 
300  BOOST_CHECK_EQUAL( vect.size() , size_t(1) );
301  BOOST_CHECK_EQUAL( vect[0], URI::Scheme::HTTP );
302 
303  // 4. check opt4
304  opt = boost::dynamic_pointer_cast<OptionURI>( SignalOptions::xml_to_option(opt4) );
305 
306  vect = opt->supported_protocols();
307 
308  BOOST_CHECK_EQUAL( vect.size() , size_t(3) );
309  BOOST_CHECK_EQUAL( vect[0], URI::Scheme::CPATH );
310  BOOST_CHECK_EQUAL( vect[1], URI::Scheme::HTTPS );
311  BOOST_CHECK_EQUAL( vect[2], URI::Scheme::FILE );
312 
313  // 5. check opt5
314  BOOST_CHECK_THROW( SignalOptions::xml_to_option( opt5 ), CastingFailed);
315 }
316 
318 
319 BOOST_AUTO_TEST_CASE ( xml_to_option_restricted_lists )
320 {
321  boost::shared_ptr< XmlDoc > xmldoc(new XmlDoc());
322  Map map(xmldoc->add_node("map"));
323  boost::shared_ptr<Option> option;
324  std::vector<int> vectInt = list_of<int>(344646)(544684)(446454)
325  (878764)(646316);
326 
327  XmlNode optInt = map.set_value("optInt", class_name<int>(), "13");
328  XmlNode optIntRestrList = map.set_value("optIntRestrList", class_name<int>(), "-15468");
329 
330  Map(optIntRestrList).set_array(Protocol::Tags::key_restricted_values(), class_name<int>(), option_vector_to_str(vectInt, " ; "), " ; ");
331 
332  // test without restricted list
333  BOOST_CHECK_NO_THROW(option = SignalOptions::xml_to_option( optInt ) );
334  BOOST_CHECK( !option->has_restricted_list() );
335 
336  // test with restricted list
337  BOOST_CHECK_NO_THROW(option = SignalOptions::xml_to_option( optIntRestrList ) );
338 
339  BOOST_CHECK( option->has_restricted_list() );
340 
341  std::vector<boost::any> & restr_list = option->restricted_list();
342 
343  BOOST_CHECK_EQUAL( restr_list.size(), size_t( vectInt.size() ) );
344  BOOST_CHECK_EQUAL( boost::any_cast<int>(restr_list[0]), vectInt[0] );
345  BOOST_CHECK_EQUAL( boost::any_cast<int>(restr_list[1]), vectInt[1] );
346  BOOST_CHECK_EQUAL( boost::any_cast<int>(restr_list[2]), vectInt[2] );
347  BOOST_CHECK_EQUAL( boost::any_cast<int>(restr_list[3]), vectInt[3] );
348  BOOST_CHECK_EQUAL( boost::any_cast<int>(restr_list[4]), vectInt[4] );
349 }
350 
352 
353 BOOST_AUTO_TEST_CASE ( set_options_from_vector )
354 {
355  std::vector<std::string> args(12);
356  std::vector<std::string> args_mod(2);
357  SignalOptions options;
358 
359  // single values
360  args[0] = "my_bool:bool=true";
361  args[1] = "my_uint:unsigned=7489";
362  args[2] = "my_int:integer=-4567";
363  args[3] = "my_real:real=3.1415";
364  args[4] = "my_string:string=Hello World!";
365  args[5] = "my_uri:uri=cpath:/Tools";
366 
367  // array values
368  args[6] = "my_bool_array:array[bool]=true,false,true, true";
369  args[7] = "my_uint_array:array[unsigned]=7489, 12,65,0";
370  args[8] = "my_int_array:array[integer]=-4567,42, 730";
371  args[9] = "my_real_array:array[real]=3.1415,2.71,0.99,-12.35";
372  args[10] = "my_string_array:array[string]=Hello World!, VKI,COOLFluiD";
373  args[11] = "my_uri_array:array[uri]=cpath:/Tools, http://coolfluidsrv.vki.ac.be/cdash,file:/usr/bin/gcc";
374 
375  // options to modify
376  args_mod[0] = "my_int:integer=42";
377  args_mod[1] = "my_real_array:array[real]=1.56, 7894.012, 32.768";
378 
379  options.set( args );
380 
381  BOOST_CHECK_EQUAL ( options.store.size(), args.size() );
382 
384  // I. Check the single options
386 
387  // 1. my_bool
388  BOOST_CHECK ( options.check("my_bool") );
389  BOOST_CHECK_EQUAL ( std::string(options["my_bool"].type()), std::string("bool") );
390  BOOST_CHECK ( options["my_bool"].value<bool>() );
391 
392  // 2. my_uint
393  BOOST_CHECK ( options.check("my_uint") );
394  BOOST_CHECK_EQUAL ( std::string(options["my_uint"].type()), std::string("unsigned") );
395  BOOST_CHECK_EQUAL ( options["my_uint"].value<Uint>(), 7489 );
396 
397  // 3. my_int
398  BOOST_CHECK ( options.check("my_int") );
399  BOOST_CHECK_EQUAL ( std::string(options["my_int"].type()), std::string("integer") );
400  BOOST_CHECK_EQUAL ( options["my_int"].value<int>(), -4567 );
401 
402  // 4. my_real
403  BOOST_CHECK ( options.check("my_real") );
404  BOOST_CHECK_EQUAL ( std::string(options["my_real"].type()), std::string("real") );
405  BOOST_CHECK_EQUAL ( options["my_real"].value<Real>(), 3.1415 );
406 
407  // 5. my_string
408  BOOST_CHECK ( options.check("my_string") );
409  BOOST_CHECK_EQUAL ( std::string(options["my_string"].type()), std::string("string") );
410  BOOST_CHECK_EQUAL ( options["my_string"].value<std::string>(), std::string("Hello World!") );
411 
412  // 6. my_uri
413  BOOST_CHECK ( options.check("my_uri") );
414  BOOST_CHECK_EQUAL ( std::string(options["my_uri"].type()), std::string("uri") );
415  BOOST_CHECK_EQUAL ( options["my_uri"].value<URI>().path(), URI("cpath:/Tools").path() );
416 
417 
419  // II. Check the array options
421 
422  // 1. my_bool_array
423  BOOST_CHECK ( options.check("my_bool_array") );
424  BOOST_CHECK_EQUAL ( std::string(options["my_bool_array"].type()), std::string("array[bool]") );
425  std::vector<bool> bool_array = options["my_bool_array"].value< std::vector<bool> >();
426  BOOST_CHECK_EQUAL ( bool_array.size(), 4 );
427  BOOST_CHECK ( bool_array[0] );
428  BOOST_CHECK ( !bool_array[1] );
429  BOOST_CHECK ( bool_array[2] );
430  BOOST_CHECK ( bool_array[3] );
431 
432  // 2. my_uint_array
433  BOOST_CHECK ( options.check("my_uint_array") );
434  BOOST_CHECK_EQUAL ( std::string(options["my_uint_array"].type()), std::string("array[unsigned]") );
435  std::vector<Uint> uint_array = options["my_uint_array"].value< std::vector<Uint> >();
436  BOOST_CHECK_EQUAL ( uint_array.size(), 4 );
437  BOOST_CHECK_EQUAL ( uint_array[0], 7489 );
438  BOOST_CHECK_EQUAL ( uint_array[1], 12 );
439  BOOST_CHECK_EQUAL ( uint_array[2], 65 );
440  BOOST_CHECK_EQUAL ( uint_array[3], 0 );
441 
442  // 3. my_int_array
443  BOOST_CHECK ( options.check("my_int_array") );
444  BOOST_CHECK_EQUAL ( std::string(options["my_int_array"].type()), std::string("array[integer]") );
445  std::vector<int> int_array = options["my_int_array"].value< std::vector<int> >();
446  BOOST_CHECK_EQUAL ( int_array.size(), 3 );
447  BOOST_CHECK_EQUAL ( int_array[0], -4567 );
448  BOOST_CHECK_EQUAL ( int_array[1], 42 );
449  BOOST_CHECK_EQUAL ( int_array[2], 730 );
450 
451  // 4. my_real_array
452  BOOST_CHECK ( options.check("my_real_array") );
453  BOOST_CHECK_EQUAL ( std::string(options["my_real_array"].type()), std::string("array[real]") );
454  std::vector<Real> real_array = options["my_real_array"].value< std::vector<Real> >();
455  BOOST_CHECK_EQUAL ( real_array.size(), 4 );
456  BOOST_CHECK_EQUAL ( real_array[0], 3.1415 );
457  BOOST_CHECK_EQUAL ( real_array[1], 2.71 );
458  BOOST_CHECK_EQUAL ( real_array[2], 0.99 );
459  BOOST_CHECK_EQUAL ( real_array[3], -12.35 );
460 
461  // 5. my_string_array
462  BOOST_CHECK ( options.check("my_string_array") );
463  BOOST_CHECK_EQUAL ( std::string(options["my_string_array"].type()), std::string("array[string]") );
464  std::vector<std::string> string_array = options["my_string_array"].value< std::vector<std::string> >();
465  BOOST_CHECK_EQUAL ( string_array.size(), 3 );
466  BOOST_CHECK_EQUAL ( string_array[0], std::string("Hello World!") );
467  BOOST_CHECK_EQUAL ( string_array[1], std::string("VKI") );
468  BOOST_CHECK_EQUAL ( string_array[2], std::string("COOLFluiD") );
469 
470  // 6. my_uri_array
471  BOOST_CHECK ( options.check("my_uri_array") );
472  BOOST_CHECK_EQUAL ( std::string(options["my_uri_array"].type()), std::string("array[uri]") );
473  std::vector<URI> uri_array = options["my_uri_array"].value< std::vector<URI> >();
474  BOOST_CHECK_EQUAL ( uri_array.size(), 3 );
475  BOOST_CHECK_EQUAL ( uri_array[0].path(), URI("cpath:/Tools").path() );
476  BOOST_CHECK_EQUAL ( uri_array[1].path(), URI("http://coolfluidsrv.vki.ac.be/cdash").path() );
477  BOOST_CHECK_EQUAL ( uri_array[2].path(), URI("file:/usr/bin/gcc").path() );
478 
480  // III. Modify options
482 
483  options.set( args_mod );
484 
485  BOOST_CHECK_EQUAL ( options.store.size(), args.size() );
486 
487  // 1. my_int
488  BOOST_CHECK_EQUAL ( options["my_int"].value<int>(), 42 );
489 
490  // 2. my_real_array
491  real_array = options["my_real_array"].value< std::vector<Real> >();
492  BOOST_CHECK_EQUAL ( real_array.size(), 3 );
493  BOOST_CHECK_EQUAL ( real_array[0], 1.56 );
494  BOOST_CHECK_EQUAL ( real_array[1], 7894.012 );
495  BOOST_CHECK_EQUAL ( real_array[2], 32.768 );
496 }
497 
499 
500 BOOST_AUTO_TEST_SUITE_END()
501 
502 
Abstracts the use of XML when adding options to a signal frame.
XmlNode add_node(const std::string &name, const std::string &value=std::string()) const
Definition: XmlNode.cpp:38
boost::shared_ptr< XmlDoc > parse_cstring(const char *str, std::size_t length)
Classes that implement the XML protocol for use in COOLFluiD.
Definition: Component.hpp:43
#define nullptr
Definition: CF.hpp:78
rapidxml::xml_node< char > * content
Pointer to the underlying XML implementation.
Definition: XmlNode.hpp:50
Manages a set of maps.
Definition: SignalFrame.hpp:31
OptionStorage_t store
storage of options
Definition: OptionList.hpp:153
Real pi()
Definition of the Pi constant.
Definition: Consts.hpp:48
void set_attribute(const std::string &name, const std::string &value)
Definition: XmlNode.cpp:54
Top-level namespace for coolfluid.
Definition: Action.cpp:18
const TYPE value(const std::string &opt_name) const
Get the value of the option with given name.
Definition: OptionList.hpp:104
BOOST_AUTO_TEST_CASE(contructors)
std::string option_vector_to_str(const std::vector< T > &vec, const std::string &delim)
Helper function to convert a vector to string, skipping empty entries.
Definition: Option.hpp:284
unsigned int Uint
typedef for unsigned int
Definition: CF.hpp:90
bool check(const std::string &opt_name) const
Definition: OptionList.hpp:111
void set(const std::string &pname, const boost::any &val)
Definition: OptionList.cpp:132
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.
Definition: Action.cpp:19
std::string string() const
Definition: URI.cpp:258
const std::vector< URI::Scheme::Type > & supported_protocols() const
Definition: OptionURI.hpp:38
Send comments to:
COOLFluiD Web Admin