Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
sarah.grebing
ProofScriptParser
Commits
559327a5
Commit
559327a5
authored
Aug 31, 2017
by
Sarah Grebing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Showing
5 changed files
with
54 additions
and
4 deletions
+54
-4
lang/src/main/antlr4/edu/kit/iti/formal/psdbg/parser/ScriptLanguage.g4
.../antlr4/edu/kit/iti/formal/psdbg/parser/ScriptLanguage.g4
+4
-1
rt-key/src/test/java/edu/kit/iti/formal/psdbg/interpreter/KeYInterpreterTest.java
.../kit/iti/formal/psdbg/interpreter/KeYInterpreterTest.java
+26
-1
rt-key/src/test/resources/edu/kit/iti/formal/psdbg/interpreter/contraposition/closes.kps
...it/iti/formal/psdbg/interpreter/contraposition/closes.kps
+10
-0
rt-key/src/test/resources/edu/kit/iti/formal/psdbg/interpreter/contraposition/closesSuccess.kps
...formal/psdbg/interpreter/contraposition/closesSuccess.kps
+14
-0
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/Interpreter.java
...ava/edu/kit/iti/formal/psdbg/interpreter/Interpreter.java
+0
-2
No files found.
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
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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