-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #517 from CROSSINGTUD/fix/final_predicate_check
Add final predicate check
- Loading branch information
Showing
8 changed files
with
90 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
CryptoAnalysis/src/test/java/tests/custom/issue318/First.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package tests.custom.issue318; | ||
|
||
public class First { | ||
|
||
public First() {} | ||
|
||
public void read() {} | ||
} |
35 changes: 35 additions & 0 deletions
35
CryptoAnalysis/src/test/java/tests/custom/issue318/Issue318Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package tests.custom.issue318; | ||
|
||
import crypto.analysis.CrySLRulesetSelector; | ||
import org.junit.Test; | ||
import test.UsagePatternTestingFramework; | ||
import test.assertions.Assertions; | ||
|
||
public class Issue318Test extends UsagePatternTestingFramework { | ||
|
||
@Override | ||
protected CrySLRulesetSelector.Ruleset getRuleSet() { | ||
return CrySLRulesetSelector.Ruleset.CustomRules; | ||
} | ||
|
||
@Override | ||
protected String getRulesetPath() { | ||
return "issue318"; | ||
} | ||
|
||
@Test | ||
public void testIssue318() { | ||
First f = new First(); | ||
Assertions.notHasEnsuredPredicate(f); | ||
|
||
Second s = new Second(f); | ||
Assertions.notHasEnsuredPredicate(s); | ||
|
||
f.read(); | ||
s.goOn(); | ||
Assertions.hasEnsuredPredicate(f); | ||
Assertions.notHasEnsuredPredicate(s); | ||
|
||
Assertions.predicateErrors(1); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
CryptoAnalysis/src/test/java/tests/custom/issue318/Second.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package tests.custom.issue318; | ||
|
||
public class Second { | ||
|
||
private First f; | ||
|
||
public Second(First f) { | ||
this.f = f; | ||
} | ||
|
||
public void goOn() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
CryptoAnalysis/src/test/resources/testrules/issue318/First.crysl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
SPEC tests.custom.issue318.First | ||
|
||
OBJECTS | ||
tests.custom.issue318.First f; | ||
|
||
EVENTS | ||
c: f = First(); | ||
r: read(); | ||
|
||
ORDER | ||
c, r | ||
|
||
ENSURES | ||
first[this] after r; |
14 changes: 14 additions & 0 deletions
14
CryptoAnalysis/src/test/resources/testrules/issue318/Second.crysl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
SPEC tests.custom.issue318.Second | ||
|
||
OBJECTS | ||
tests.custom.issue318.First f; | ||
|
||
EVENTS | ||
c: Second(f); | ||
g: goOn(); | ||
|
||
ORDER | ||
c, g | ||
|
||
REQUIRES | ||
first[f]; |