Skip to content

Commit efc59fd

Browse files
Add test for String.format with float
This checks that having a format flag with precision defined doesn't crash the solver.
1 parent a3ddf7a commit efc59fd

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed
Binary file not shown.

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

+10
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,14 @@ public static String string3(String s, String t) {
4949
assert(s.length() != 1 || u.charAt(0) == u.charAt(u.length() - 1));
5050
return u;
5151
}
52+
53+
public static String float1(float f) {
54+
String u = String.format("Pi is %.2f.", 3.14);
55+
// We are not checking the exactness of the string produced, just that
56+
// the solver will not crash.
57+
assert(u.length() > 0);
58+
assert(u.charAt(0) == 'P');
59+
return u;
60+
}
61+
5262
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
Test.class
3+
--function Test.float1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar`
4+
^EXIT=0$
5+
^SIGNAL=0$
6+

0 commit comments

Comments
 (0)