Skip to content

Commit e1f2d77

Browse files
Adding tests for String.valueOf float
Add several tests, some take long and are marked as THOROUGH, fail probably due to some problem in CBMC and are marked as KNOWNBUG.
1 parent 64558ca commit e1f2d77

File tree

12 files changed

+76
-0
lines changed

12 files changed

+76
-0
lines changed
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
KNOWNBUG
2+
test.class
3+
--refine-strings --function test.check
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
assertion.* file test.java line 6 .* SUCCESS$
7+
assertion.* file test.java line 7 .* FAILURE$
8+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class test
2+
{
3+
public static void check()
4+
{
5+
String s3=String.valueOf(7.89e12f);
6+
assert(s3.equals("7.89E12"));
7+
assert(!s3.equals("7.89E12"));
8+
}
9+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
KNOWNBUG
2+
test.class
3+
--refine-strings --function test.check
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
assertion.* file test.java line 7 .* SUCCESS$
7+
assertion.* file test.java line 8 .* FAILURE$
8+
9+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public class test
2+
{
3+
public static void check()
4+
{
5+
String s5=String.valueOf(5.67e-9f);
6+
// The result may not be exactly 5.67E-9 as 5.66999...E-9 is also valid
7+
assert(s5.startsWith("5.6") && s5.endsWith("E-9"));
8+
assert(!s5.startsWith("5.6") || !s5.endsWith("E-9"));
9+
}
10+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
THOROUGH
2+
test.class
3+
--refine-strings --function test.check
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
assertion.* test.java line 8 .* SUCCESS$
7+
assertion.* test.java line 9 .* SUCCESS$
8+
assertion.* test.java line 10 .* SUCCESS$
9+
assertion.* test.java line 11 .* FAILURE$
10+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class test
2+
{
3+
public static void check()
4+
{
5+
String s7=String.valueOf(java.lang.Float.POSITIVE_INFINITY);
6+
String s8=String.valueOf(java.lang.Float.NEGATIVE_INFINITY);
7+
String s9=String.valueOf(java.lang.Float.NaN);
8+
assert(s7.equals("Infinity"));
9+
assert(s8.equals("-Infinity"));
10+
assert(s9.equals("NaN"));
11+
assert(!s7.equals("Infinity") || !s8.equals("-Infinity") || !s9.equals("NaN"));
12+
}
13+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
THOROUGH
2+
test.class
3+
--refine-strings --function test.check
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
assertion.* file test.java line 6 .* SUCCESS$
7+
assertion.* file test.java line 7 .* FAILURE$
8+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class test
2+
{
3+
public static void check()
4+
{
5+
String s1=String.valueOf(-123.456f);
6+
assert(s1.equals("-123.456"));
7+
assert(!s1.equals("-123.456"));
8+
}
9+
}

0 commit comments

Comments
 (0)