Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
sarah.grebing
ProofScriptParser
Commits
559327a5
Commit
559327a5
authored
Aug 31, 2017
by
Sarah Grebing
Browse files
added first testcases for try and closes
parent
79786fc6
Pipeline
#13279
failed with stage
in 10 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lang/src/main/antlr4/edu/kit/iti/formal/psdbg/parser/ScriptLanguage.g4
View file @
559327a5
...
...
@@ -114,7 +114,10 @@ casesStmt
;
casesList
: (TRY | (CASE (expression | (CLOSES INDENT closesScript=stmtList DEDENT)))) COLON INDENT? body=stmtList DEDENT?
: (TRY |
(CASE (expression
| (CLOSES INDENT closesScript=stmtList DEDENT) ) ) )
COLON INDENT? body=stmtList DEDENT?
;
/*closesExpression
...
...
rt-key/src/test/java/edu/kit/iti/formal/psdbg/interpreter/KeYInterpreterTest.java
View file @
559327a5
...
...
@@ -36,7 +36,7 @@ public class KeYInterpreterTest {
@Test
public
void
test
IsClosable
()
throws
IOException
,
ProblemLoaderException
{
public
void
test
TryFail
()
throws
IOException
,
ProblemLoaderException
{
facade
.
loadKeyFileSync
(
new
File
(
"src/test/resources/edu/kit/iti/formal/psdbg/interpreter/contraposition/contraposition.key"
));
Interpreter
<
KeyData
>
i
=
execute
(
getClass
().
getResourceAsStream
(
"contraposition/testIsClosable.kps"
));
List
<
GoalNode
<
KeyData
>>
goals
=
i
.
getCurrentState
().
getGoals
();
...
...
@@ -45,8 +45,33 @@ public class KeYInterpreterTest {
Assert
.
assertEquals
(
"Label for node "
+
goal
.
getData
().
getNode
(),
"impLeft // impRight // $$"
,
goal
.
getData
().
getRuleLabel
());
}
}
@Test
public
void
testClosesFail
()
throws
IOException
,
ProblemLoaderException
{
facade
.
loadKeyFileSync
(
new
File
(
"src/test/resources/edu/kit/iti/formal/psdbg/interpreter/contraposition/contraposition.key"
));
Interpreter
<
KeyData
>
i
=
execute
(
getClass
().
getResourceAsStream
(
"contraposition/closes.kps"
));
List
<
GoalNode
<
KeyData
>>
goals
=
i
.
getCurrentState
().
getGoals
();
Assert
.
assertEquals
(
2
,
goals
.
size
());
for
(
GoalNode
<
KeyData
>
goal
:
goals
)
{
Assert
.
assertEquals
(
"Label for node "
+
goal
.
getData
().
getNode
(),
"impLeft // impRight // $$"
,
goal
.
getData
().
getRuleLabel
());
}
// Assert.assertEquals(10, i.getCurrentState().getGoals().size());
}
@Test
public
void
testClosesScriptSuccess
()
throws
IOException
,
ProblemLoaderException
{
facade
.
loadKeyFileSync
(
new
File
(
"src/test/resources/edu/kit/iti/formal/psdbg/interpreter/contraposition/contraposition.key"
));
Interpreter
<
KeyData
>
i
=
execute
(
getClass
().
getResourceAsStream
(
"contraposition/closesSuccess.kps"
));
List
<
GoalNode
<
KeyData
>>
goals
=
i
.
getCurrentState
().
getGoals
();
Assert
.
assertEquals
(
2
,
goals
.
size
());
for
(
GoalNode
<
KeyData
>
goal
:
goals
)
{
Assert
.
assertEquals
(
"Label for node "
+
goal
.
getData
().
getNode
(),
"impRight // impLeft // impRight // $$"
,
goal
.
getData
().
getRuleLabel
());
}
}
}
rt-key/src/test/resources/edu/kit/iti/formal/psdbg/interpreter/contraposition/closes.kps
0 → 100644
View file @
559327a5
script t1(){
impRight;
impLeft;
cases{
case closes {impRight; } :
impRight; //should not close proof
}
}
\ No newline at end of file
rt-key/src/test/resources/edu/kit/iti/formal/psdbg/interpreter/contraposition/closesSuccess.kps
0 → 100644
View file @
559327a5
script t1(){
impRight;
impLeft;
cases{
case closes {
auto; //should close
}:
impRight; //should not close proof
case match `==> imp(not(q),not(p))`:
auto;
}
}
\ No newline at end of file
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/Interpreter.java
View file @
559327a5
...
...
@@ -184,8 +184,6 @@ public class Interpreter<T> extends DefaultASTVisitor<Object>
//handle cases
List
<
CaseStatement
>
cases
=
casesStatement
.
getCases
();
// Map<GoalNode, Pair<VariableAssignment, Statements>> goalToCaseMapping = matchGoalsToCases(allGoalsBeforeCases, casesStatement);
for
(
GoalNode
<
T
>
goal
:
allGoalsBeforeCases
)
{
newState
(
goal
);
//to allow the visit method for the case stmt to retrieve goal
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment