7 #include <boost/test/unit_test.hpp>
17 BOOST_CHECK_EQUAL(1.0, n.
evaluate());
20 BOOST_CHECK_EQUAL(
"ident", s.to_string());
27 BOOST_CHECK_EQUAL(-1.0, neg.
evaluate());
32 node a(1.0), b(2.0), c(3.0);
33 BOOST_CHECK_EQUAL(3.0,
node(a,
'+', b).evaluate());
34 BOOST_CHECK_EQUAL(6.0,
node(
node(a,
'+', b),
'+', c).evaluate());
39 node a(1.0), b(2.0), c(3.0);
40 BOOST_CHECK_EQUAL(1.0,
node(c,
'-', b).evaluate());
41 BOOST_CHECK_EQUAL(-4.0,
node(
node(a,
'-', b),
'-', c).evaluate());
46 node a(1.0), b(2.0), c(3.0);
47 BOOST_CHECK_EQUAL(3.0,
node(a,
'*', c).evaluate());
48 BOOST_CHECK_EQUAL(6.0,
node(
node(a,
'*', b),
'*', c).evaluate());
53 node a(1.0), b(2.0), c(6.0);
54 BOOST_CHECK_EQUAL(0.5,
node(a,
'/', b).evaluate());
55 BOOST_CHECK_EQUAL(3.0,
node(
node(c,
'/', a),
'/', b).evaluate());
61 BOOST_CHECK_EQUAL(3.0, a.
evaluate());
64 BOOST_CHECK_EQUAL(2.0, b.evaluate());
67 BOOST_CHECK_EQUAL(5.0, c.evaluate());
70 BOOST_CHECK_EQUAL(7.0, d.evaluate());
73 BOOST_CHECK_EQUAL(-1.0, e.evaluate());
76 BOOST_CHECK_EQUAL(-2.0, f.evaluate());
79 BOOST_CHECK_EQUAL(5.0, g.evaluate());
82 BOOST_CHECK_EQUAL(0.0, h.evaluate());
88 BOOST_CHECK_EQUAL(0.5, n.
evaluate());
98 BOOST_CHECK_EQUAL(3.0, m.
evaluate());
100 BOOST_CHECK_EQUAL(-3.0, n.
evaluate());
BOOST_AUTO_TEST_CASE(test_basics)
BOOST_AUTO_TEST_SUITE_END()
std::string to_string() const
double get_variable(std::string const &name)
BOOST_AUTO_TEST_SUITE(node_test)