Skip to content

Commit c1f0f65

Browse files
committed
Add tests for static fields of primitive wrapper type
In this case, the values are represented as JSON objects with @type keys. This already worked before the fix in the previous commit.
1 parent 92d29af commit c1f0f65

19 files changed

+221
-0
lines changed
Binary file not shown.

jbmc/regression/jbmc/deterministic_assignments_json/StaticValues.java

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,67 @@ public static void testReferenceToReferenceArrayFail() {
199199
assert referenceToReferenceArray != referenceArrayField;
200200
}
201201

202+
// Primitive wrapper types as static field types
203+
public static Boolean booleanWrapperField = true;
204+
public static void testBooleanWrapperPass() { assert booleanWrapperField; }
205+
public static void testBooleanWrapperFail() { assert !booleanWrapperField; }
206+
207+
public static Byte byteWrapperField = (byte)50;
208+
public static void testByteWrapperPass() {
209+
assert byteWrapperField == (byte)50;
210+
}
211+
public static void testByteWrapperFail() {
212+
assert byteWrapperField != (byte)50;
213+
}
214+
215+
public static Character characterWrapperField = '!';
216+
public static void testCharacterWrapperPass() {
217+
assert characterWrapperField == '!';
218+
}
219+
public static void testCharacterWrapperFail() {
220+
assert characterWrapperField != '!';
221+
}
222+
223+
public static Double doubleWrapperField = 24.56;
224+
public static void testDoubleWrapperPass() {
225+
assert doubleWrapperField == 24.56;
226+
}
227+
public static void testDoubleWrapperFail() {
228+
assert doubleWrapperField != 24.56;
229+
}
230+
231+
public static Float floatWrapperField = 13.13f;
232+
public static void testFloatWrapperPass() {
233+
assert floatWrapperField == 13.13f;
234+
}
235+
public static void testFloatWrapperFail() {
236+
assert floatWrapperField != 13.13f;
237+
}
238+
239+
public static Integer integerWrapperField = Util.setTo(1000);
240+
public static void testIntegerWrapperPass() {
241+
assert integerWrapperField == 1000;
242+
}
243+
public static void testIntegerWrapperFail() {
244+
assert integerWrapperField != 1000;
245+
}
246+
247+
public static Long longWrapperField = 21000000000L;
248+
public static void testLongWrapperPass() {
249+
assert longWrapperField == 21000000000L;
250+
}
251+
public static void testLongWrapperFail() {
252+
assert longWrapperField != 21000000000L;
253+
}
254+
255+
public static Short shortWrapperField = (short)200;
256+
public static void testShortWrapperPass() {
257+
assert shortWrapperField == (short)200;
258+
}
259+
public static void testShortWrapperFail() {
260+
assert shortWrapperField != (short)200;
261+
}
262+
202263
// Strings
203264
public static String stringField = Util.repeat("hello! ", 6);
204265
public static void testStringPass() {

jbmc/regression/jbmc/deterministic_assignments_json/clinit-state.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,38 @@
412412
"@type":"java.lang.Boolean",
413413
"value":true
414414
}
415+
},
416+
"booleanWrapperField":{
417+
"@type":"java.lang.Boolean",
418+
"value":true
419+
},
420+
"byteWrapperField":{
421+
"@type":"java.lang.Byte",
422+
"value":50
423+
},
424+
"characterWrapperField":{
425+
"@type":"java.lang.Character",
426+
"value":"!"
427+
},
428+
"doubleWrapperField":{
429+
"@type":"java.lang.Double",
430+
"value":24.56
431+
},
432+
"floatWrapperField":{
433+
"@type":"java.lang.Float",
434+
"value":13.13
435+
},
436+
"integerWrapperField":{
437+
"@type":"java.lang.Integer",
438+
"value":1000
439+
},
440+
"longWrapperField":{
441+
"@type":"java.lang.Long",
442+
"value":"21000000000"
443+
},
444+
"shortWrapperField":{
445+
"@type":"java.lang.Short",
446+
"value":200
415447
}
416448
},
417449
"OtherClass":{
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testBooleanWrapperFail
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testBooleanWrapperPass
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testByteWrapperFail
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testByteWrapperPass
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testCharacterWrapperFail
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testCharacterWrapperPass
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testDoubleWrapperFail
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testDoubleWrapperPass
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testFloatWrapperFail
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testFloatWrapperPass
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testIntegerWrapperFail
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testIntegerWrapperPass
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testLongWrapperFail
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testLongWrapperPass
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testShortWrapperFail
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testShortWrapperPass
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--

0 commit comments

Comments
 (0)