Skip to content

Commit d325431

Browse files
Merge pull request #1017 from romainbrenguier/pull-request/float-to-string-conversion
Pull request/float to string conversion
2 parents 4a2876b + e1f2d77 commit d325431

26 files changed

+878
-279
lines changed
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
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 9 .* FAILURE$
8+
--
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class test
2+
{
3+
public static void check(int i)
4+
{
5+
String s = String.valueOf(123.456f);
6+
if(i == 1)
7+
assert(s.equals("123.456"));
8+
else
9+
assert(!s.equals("123.456"));
10+
}
11+
}
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)