Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tla2bAST
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tla2bAST
Commits
50c7f125
Commit
50c7f125
authored
2 years ago
by
Michael Leuschel
Browse files
Options
Downloads
Patches
Plain Diff
add test
Signed-off-by:
Michael Leuschel
<
leuschel@uni-duesseldorf.de
>
parent
3d4225dd
No related branches found
No related tags found
No related merge requests found
Pipeline
#107475
passed
2 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/tla2bAst/ExpressionTranslator.java
+1
-0
1 addition, 0 deletions
src/main/java/de/tla2bAst/ExpressionTranslator.java
src/test/java/de/tla2b/expression/ComplexExpressionTest.java
+7
-0
7 additions, 0 deletions
src/test/java/de/tla2b/expression/ComplexExpressionTest.java
with
8 additions
and
0 deletions
src/main/java/de/tla2bAst/ExpressionTranslator.java
+
1
−
0
View file @
50c7f125
...
...
@@ -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
));
}
...
...
This diff is collapsed.
Click to expand it.
src/test/java/de/tla2b/expression/ComplexExpressionTest.java
+
7
−
0
View file @
50c7f125
...
...
@@ -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
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment