Skip to content

Commit c667559

Browse files
author
Joel Allred
committed
Tests for length of String.format of hexadecimal integer
1 parent 72cbe25 commit c667559

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed
Binary file not shown.

jbmc/regression/jbmc-strings/StringFormatHex/Test.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,14 @@ else if (u.startsWith("di"))
99
assert(false);
1010
return u;
1111
}
12+
13+
public static void testHexLengthConstPASS() {
14+
String u = String.format("di%xlue", 255);
15+
assert u.length() == 7;
16+
}
17+
18+
public static void testHexLengthConstFAIL() {
19+
String u = String.format("di%xlue", 255);
20+
assert u.length() != 7;
21+
}
1222
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
Test.class
3+
--function Test.testHexLengthConstFAIL --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property "java::Test.testHexLengthConstFAIL:()V.assertion.1"
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
line 20 assertion at file Test.java .*: FAILURE
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
Test.class
3+
--function Test.testHexLengthConstPASS --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property "java::Test.testHexLengthConstPASS:()V.assertion.1"
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
line 15 assertion at file Test.java .*: SUCCESS

0 commit comments

Comments
 (0)