8#define BOOST_TEST_DYN_LINK
9#include <boost/test/unit_test.hpp>
11#include "MetaParser.hpp"
13BOOST_AUTO_TEST_SUITE( vtk_writer_tests )
15BOOST_AUTO_TEST_CASE( vtk_writer_meta_parser_use )
17 std::string test_options(
"time = 5.0");
18 std::string test_options2(
"time=6.0");
19 std::string test_options3(
"time =7.0");
20 std::string test_options4(
"time= 8.0");
21 std::string test_options5(
"time= 9.0");
25 MetaParser_options opts;
27 (
"time", MetaParser_def::value<double>(&time));
30 mp.parse(test_options);
32 BOOST_REQUIRE_EQUAL(time,5.0);
35 bool exist = mp.getOption(
"time",time);
37 BOOST_REQUIRE_EQUAL(exist,
true);
38 BOOST_REQUIRE_EQUAL(time,5.0);
40 exist = mp.getOption(
"invalid",time);
41 BOOST_REQUIRE_EQUAL(exist,
false);
48 mp.parse(test_options2);
50 BOOST_REQUIRE_EQUAL(time,6.0);
53 exist = mp.getOption(
"time",time);
55 BOOST_REQUIRE_EQUAL(exist,
true);
56 BOOST_REQUIRE_EQUAL(time,6.0);
58 exist = mp.getOption(
"invalid",time);
59 BOOST_REQUIRE_EQUAL(exist,
false);
66 mp.parse(test_options3);
68 BOOST_REQUIRE_EQUAL(time,7.0);
71 exist = mp.getOption(
"time",time);
73 BOOST_REQUIRE_EQUAL(exist,
true);
74 BOOST_REQUIRE_EQUAL(time,7.0);
76 exist = mp.getOption(
"invalid",time);
77 BOOST_REQUIRE_EQUAL(exist,
false);
84 mp.parse(test_options4);
86 BOOST_REQUIRE_EQUAL(time,8.0);
89 exist = mp.getOption(
"time",time);
91 BOOST_REQUIRE_EQUAL(exist,
true);
92 BOOST_REQUIRE_EQUAL(time,8.0);
94 exist = mp.getOption(
"invalid",time);
95 BOOST_REQUIRE_EQUAL(exist,
false);
102 mp.parse(test_options5);
104 BOOST_REQUIRE_EQUAL(time,9.0);
107 exist = mp.getOption(
"time",time);
109 BOOST_REQUIRE_EQUAL(exist,
true);
110 BOOST_REQUIRE_EQUAL(time,9.0);
112 exist = mp.getOption(
"invalid",time);
113 BOOST_REQUIRE_EQUAL(exist,
false);
117BOOST_AUTO_TEST_SUITE_END()