Skip to content
Snippets Groups Projects

Fix issue #18

1 file
+ 93
0
Compare changes
  • Side-by-side
  • Inline
@@ -1141,5 +1141,98 @@ f((1,2,3),2,3);
CHECK_EXPRESSION_BUILDER_THROWS_WITH(data, std::string{"bad number of arguments: expecting 2, provided 3"});
}
}
SECTION("non pure function")
{
SECTION("argument modification")
{
SECTION("++ argument")
{
std::string_view data = R"(
let non_pure : R -> R, x -> 3 * ++x;
)";
CHECK_EXPRESSION_BUILDER_THROWS_WITH(data, std::string{
"invalid function definition. Function data must be constant!"});
}
SECTION("argument ++")
{
std::string_view data = R"(
let non_pure : R -> R, x -> 1 + x ++;
)";
CHECK_EXPRESSION_BUILDER_THROWS_WITH(data, std::string{
"invalid function definition. Function data must be constant!"});
}
SECTION("-- argument")
{
std::string_view data = R"(
let non_pure : R -> R, x -> 3 * --x;
)";
CHECK_EXPRESSION_BUILDER_THROWS_WITH(data, std::string{
"invalid function definition. Function data must be constant!"});
}
SECTION("argument --")
{
std::string_view data = R"(
let non_pure : R -> R, x -> 1 + x --;
)";
CHECK_EXPRESSION_BUILDER_THROWS_WITH(data, std::string{
"invalid function definition. Function data must be constant!"});
}
}
SECTION("outer variable modification")
{
SECTION("++ outer variable")
{
std::string_view data = R"(
let a:R, a = 4;
let non_pure : R -> R, x -> x * ++a;
)";
CHECK_EXPRESSION_BUILDER_THROWS_WITH(data, std::string{
"invalid function definition. Function data must be constant!"});
}
SECTION("outer variable ++")
{
std::string_view data = R"(
let a:R, a = 4;
let non_pure : R -> R, x -> x + a++;
)";
CHECK_EXPRESSION_BUILDER_THROWS_WITH(data, std::string{
"invalid function definition. Function data must be constant!"});
}
SECTION("-- outer variable")
{
std::string_view data = R"(
let a:R, a = 4;
let non_pure : R -> R, x -> x * --a;
)";
CHECK_EXPRESSION_BUILDER_THROWS_WITH(data, std::string{
"invalid function definition. Function data must be constant!"});
}
SECTION("outer variable --")
{
std::string_view data = R"(
let a:R, a = 4;
let non_pure : R -> R, x -> x + a--;
)";
CHECK_EXPRESSION_BUILDER_THROWS_WITH(data, std::string{
"invalid function definition. Function data must be constant!"});
}
}
}
}
}
Loading