64 m_eval.Process(
"1" );
65 BOOST_CHECK_EQUAL( m_eval.Result(),
"1" );
73 m_eval.SetVar(
"MoL", 42 );
75 m_eval.Process(
"1 + MoL" );
76 BOOST_CHECK_EQUAL( m_eval.GetVar(
"MoL" ), 42 );
77 BOOST_CHECK_EQUAL( m_eval.Result(),
"43" );
79 m_eval.SetVar(
"MoL", 422 );
82 m_eval.Process(
"1 + MoL" );
83 BOOST_CHECK_EQUAL( m_eval.Result(),
"423" );
86 m_eval.SetVar(
"pi", 3.14 );
87 BOOST_CHECK_EQUAL( m_eval.GetVar(
"pi" ), 3.14 );
88 m_eval.RemoveVar(
"pi" );
89 BOOST_CHECK_EQUAL( m_eval.GetVar(
"pi" ), 0.0 );
92 BOOST_CHECK_EQUAL( m_eval.GetVar(
"MoL" ), 422 );
95 m_eval.SetVar(
"piish", 3.1 );
99 m_eval.Process(
"1 + MoL + piish" );
100 BOOST_CHECK_EQUAL( m_eval.Result(),
"426.1" );
104 BOOST_CHECK_EQUAL( m_eval.GetVar(
"MoL" ), 0.0 );
105 BOOST_CHECK_EQUAL( m_eval.GetVar(
"piish" ), 0.0 );
130 {
"1 + 10mm + 1\" + 1.5in + 500mil",
"87.2" },
134 {
"1.5 + 0.2 + .1",
"1.8" },
138 {
"1 + 2 + 10 + 1000.05",
"1013.05" },
140 {
"1 + 2 - 4 * 20 / 2",
"-37" },
144 {
"-(1 + (2 - 4)) * 20.8 / 2",
"10.4" },
148 {
"x = 1; 1 + x",
"2" },
150 {
"x = 1; y = 2; 10 + x - y",
"9" },
168 BOOST_TEST_CONTEXT( c.input +
" -> " + c.exp_result )
173 m_eval.Process( c.input );
176 BOOST_CHECK_EQUAL( m_eval.IsValid(),
true );
177 BOOST_CHECK_EQUAL( m_eval.Result(), c.exp_result );
180 BOOST_CHECK_EQUAL( m_eval.OriginalText(), c.input );
191 wxString degreeInput = wxT(
"1\u00B0" );
197 m_eval.Process( degreeInput );
200 BOOST_CHECK_EQUAL( m_eval.IsValid(),
true );
206 BOOST_CHECK_EQUAL( m_eval.OriginalText(), degreeInput );
250 BOOST_TEST_CONTEXT( c.input )
255 m_eval.Process( c.input );
258 BOOST_CHECK_EQUAL( m_eval.IsValid(),
false );
261 BOOST_CHECK_EQUAL( m_eval.OriginalText(), c.input );
Declares the struct as the Boost test fixture.
BOOST_AUTO_TEST_SUITE_END()
static const std::vector< EVAL_INVALID_CASE > eval_cases_invalid
A list of invalid test strings.
BOOST_AUTO_TEST_CASE(Basic)
Basic class ops: set one up, trivial input, tear it down.
static const std::vector< EVAL_CASE > eval_cases_valid
A list of valid test strings and the expected results.