Skip to content
Snippets Groups Projects
Commit 50c7f125 authored by Michael Leuschel's avatar Michael Leuschel
Browse files

add test

parent 3d4225dd
No related branches found
No related tags found
No related merge requests found
Pipeline #107475 passed
......@@ -216,6 +216,7 @@ public class ExpressionTranslator implements SyntaxTreeConstants {
searchVarInSyntaxTree(expr);
// this code seems to assume that there is no variable clash between outer and nested variables
// I guess the parser will then generate "Multiply-defined symbol ..." errors
for (int i = 0; i < noVariables.size(); i++) {
variables.remove(noVariables.get(i));
}
......
......@@ -84,5 +84,12 @@ public class ComplexExpressionTest {
compareExpr("CHOOSE({x|x:0..100 & x**3 - 20*x**2 + 7*x = 14388})",
"CHOOSE x \\in 0..100: x^3 - 20*x^2 + 7*x = 14388");
}
@Test
public void testConstraintCHOOSENested() throws Exception {
compareExpr("CHOOSE({y|y : 0 .. 100 & y = CHOOSE({x|x : 0 .. 100 & x ** 3 - 20 * x ** 2 + 7 * x = 14388})})",
"CHOOSE y \\in 0..100: y = CHOOSE x \\in 0..100: x^3 - 20*x^2 + 7*x = 14388");
}
// Note that for: CHOOSE x \in 0..100: x = CHOOSE x \in 0..100: x^3 - 20*x^2 + 7*x = 14388
// we get an error: Multiply-defined symbol 'x': this definition or declaration conflicts
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment