Skip to content

Pull request/float to string conversion #1017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
8 changes: 8 additions & 0 deletions regression/strings-smoke-tests/java_value_of_float/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
test.class
--refine-strings --function test.check
^EXIT=10$
^SIGNAL=0$
assertion.* file test.java line 7 .* SUCCESS$
assertion.* file test.java line 9 .* FAILURE$
--
11 changes: 11 additions & 0 deletions regression/strings-smoke-tests/java_value_of_float/test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class test
{
public static void check(int i)
{
String s = String.valueOf(123.456f);
if(i == 1)
assert(s.equals("123.456"));
else
assert(!s.equals("123.456"));
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
KNOWNBUG
test.class
--refine-strings --function test.check
^EXIT=10$
^SIGNAL=0$
assertion.* file test.java line 6 .* SUCCESS$
assertion.* file test.java line 7 .* FAILURE$
--
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public class test
{
public static void check()
{
String s3=String.valueOf(7.89e12f);
assert(s3.equals("7.89E12"));
assert(!s3.equals("7.89E12"));
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
KNOWNBUG
test.class
--refine-strings --function test.check
^EXIT=10$
^SIGNAL=0$
assertion.* file test.java line 7 .* SUCCESS$
assertion.* file test.java line 8 .* FAILURE$

--
10 changes: 10 additions & 0 deletions regression/strings-smoke-tests/java_value_of_float_3/test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public class test
{
public static void check()
{
String s5=String.valueOf(5.67e-9f);
// The result may not be exactly 5.67E-9 as 5.66999...E-9 is also valid
assert(s5.startsWith("5.6") && s5.endsWith("E-9"));
assert(!s5.startsWith("5.6") || !s5.endsWith("E-9"));
}
}
Binary file not shown.
10 changes: 10 additions & 0 deletions regression/strings-smoke-tests/java_value_of_float_4/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
THOROUGH
test.class
--refine-strings --function test.check
^EXIT=10$
^SIGNAL=0$
assertion.* test.java line 8 .* SUCCESS$
assertion.* test.java line 9 .* SUCCESS$
assertion.* test.java line 10 .* SUCCESS$
assertion.* test.java line 11 .* FAILURE$
--
13 changes: 13 additions & 0 deletions regression/strings-smoke-tests/java_value_of_float_4/test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
public class test
{
public static void check()
{
String s7=String.valueOf(java.lang.Float.POSITIVE_INFINITY);
String s8=String.valueOf(java.lang.Float.NEGATIVE_INFINITY);
String s9=String.valueOf(java.lang.Float.NaN);
assert(s7.equals("Infinity"));
assert(s8.equals("-Infinity"));
assert(s9.equals("NaN"));
assert(!s7.equals("Infinity") || !s8.equals("-Infinity") || !s9.equals("NaN"));
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
THOROUGH
test.class
--refine-strings --function test.check
^EXIT=10$
^SIGNAL=0$
assertion.* file test.java line 6 .* SUCCESS$
assertion.* file test.java line 7 .* FAILURE$
--
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public class test
{
public static void check()
{
String s1=String.valueOf(-123.456f);
assert(s1.equals("-123.456"));
assert(!s1.equals("-123.456"));
}
}
Loading