Skip to content

Commit d841712

Browse files
Add test for CProver.classIdentifier
This tests that the new builtin cprover function is working.
1 parent 984bf19 commit d841712

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
996 Bytes
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
public class Test {
2+
public String check(int assertId) {
3+
Object o;
4+
o = "foo";
5+
String classId = org.cprover.CProver.classIdentifier(o);
6+
if(assertId == 1) {
7+
assert org.cprover.CProverString.equals(classId, "java.lang.String");
8+
} else if(assertId == 2) {
9+
assert org.cprover.CProverString.equals(classId, "java.lang.Integer");
10+
}
11+
o = new Integer(42);
12+
classId = org.cprover.CProver.classIdentifier(o);
13+
if(assertId == 3) {
14+
assert org.cprover.CProverString.equals(classId, "java.lang.String");
15+
} else if(assertId == 4) {
16+
assert org.cprover.CProverString.equals(classId, "java.lang.Integer");
17+
}
18+
return classId;
19+
}
20+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
Test.class
3+
--function Test.check --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar`
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
assertion at file Test.java line 7 .*: SUCCESS
7+
assertion at file Test.java line 9 .*: FAILURE
8+
assertion at file Test.java line 14 .*: FAILURE
9+
assertion at file Test.java line 16 .*: SUCCESS

0 commit comments

Comments
 (0)