Skip to content
Snippets Groups Projects
Commit ef95037e authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add missing tests for ASTNodeUnaryOperatorExpressionBuilder

parent c06e485b
No related branches found
No related tags found
1 merge request!37Feature/language
...@@ -67,12 +67,16 @@ ASTNodeUnaryOperatorExpressionBuilder::ASTNodeUnaryOperatorExpressionBuilder(AST ...@@ -67,12 +67,16 @@ ASTNodeUnaryOperatorExpressionBuilder::ASTNodeUnaryOperatorExpressionBuilder(AST
n.m_node_processor = std::make_unique<UnaryExpressionProcessor<OperatorT, ValueT, ValueT>>(n); n.m_node_processor = std::make_unique<UnaryExpressionProcessor<OperatorT, ValueT, ValueT>>(n);
break; break;
} }
// LCOV_EXCL_START
default: { default: {
throw parse_error("unexpected error: invalid vector dimension", std::vector{n.begin()}); throw parse_error("unexpected error: invalid vector dimension", std::vector{n.begin()});
} }
// LCOV_EXCL_STOP
} }
} else { } else {
throw parse_error("invalid unary operator for vector data", std::vector{n.begin()}); // LCOV_EXCL_START
throw parse_error("unexpected error: invalid unary operator for vector data", std::vector{n.begin()});
// LCOV_EXCL_STOP
} }
break; break;
} }
......
...@@ -124,6 +124,54 @@ R x; ...@@ -124,6 +124,54 @@ R x;
CHECK_AST(data, result); CHECK_AST(data, result);
} }
SECTION("R^1")
{
std::string_view data = R"(
R^1 x;
-x;
)";
std::string_view result = R"(
(root:ASTNodeListProcessor)
`-(language::unary_minus:UnaryExpressionProcessor<language::unary_minus, TinyVector<1ul, double>, TinyVector<1ul, double> >)
`-(language::name:x:NameProcessor)
)";
CHECK_AST(data, result);
}
SECTION("R^2")
{
std::string_view data = R"(
R^2 x;
-x;
)";
std::string_view result = R"(
(root:ASTNodeListProcessor)
`-(language::unary_minus:UnaryExpressionProcessor<language::unary_minus, TinyVector<2ul, double>, TinyVector<2ul, double> >)
`-(language::name:x:NameProcessor)
)";
CHECK_AST(data, result);
}
SECTION("R^3")
{
std::string_view data = R"(
R^3 x;
-x;
)";
std::string_view result = R"(
(root:ASTNodeListProcessor)
`-(language::unary_minus:UnaryExpressionProcessor<language::unary_minus, TinyVector<3ul, double>, TinyVector<3ul, double> >)
`-(language::name:x:NameProcessor)
)";
CHECK_AST(data, result);
}
} }
SECTION("not") SECTION("not")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment