Skip to content
Snippets Groups Projects
Commit a75eae8a authored by Adam Wardynski's avatar Adam Wardynski
Browse files

String for conditional is now if(x, y, z)

It's a change from if x then y else z, which wasn't exactly proper anyway without parentheses.
parent 02427176
Branches
No related merge requests found
......@@ -119,7 +119,7 @@ template<class T>
std::string Conditional<T>::to_raw_string() const
{
std::stringstream ss;
ss << boost::format("%1% %2% then %3% else %4%")
ss << boost::format("%1%(%2%, %3%, %4%)")
% this->raw_operator_name()
% this->cond_expr_->to_raw_string()
% this->iftrue_expr_->to_raw_string()
......@@ -131,7 +131,7 @@ template<class T>
std::string Conditional<T>::to_string(const Corpus2::Tagset &tagset) const
{
std::stringstream ss;
ss << boost::format("%1% %2% then %3% else %4%")
ss << boost::format("%1%(%2%, %3%, %4%)")
% this->operator_name(tagset)
% this->cond_expr_->to_string(tagset)
% this->iftrue_expr_->to_string(tagset)
......
......@@ -119,7 +119,7 @@ BOOST_FIXTURE_TEST_CASE(cond_to_string, CondFixStrSet)
true_constant,
empty_strset_expr,
one_elem_strset_expr));
std::string expected = "if True then [] else [\"oNe\"]";
std::string expected = "if(True, [], [\"oNe\"])";
BOOST_CHECK_EQUAL(expected, cond->to_string(tagset));
}
......@@ -128,7 +128,7 @@ BOOST_FIXTURE_TEST_CASE(cond_to_string_raw, CondFixStrSet)
boost::shared_ptr<Conditional<StrSet> > cond(new Conditional<StrSet>(
true_constant,
one_elem_strset_expr));
std::string expected = "if True then [\"oNe\"] else []";
std::string expected = "if(True, [\"oNe\"], [])";
BOOST_CHECK_EQUAL(expected, cond->to_string(tagset));
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment