Skip to content

Commit a4fbd11

Browse files
relrelbHerschel
authored andcommitted
tests: Expand parse_float
And make it non-approx, since Ruffle now traces the exact output.
1 parent f0db6d8 commit a4fbd11

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

tests/tests/regression_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ swf_tests! {
681681
(object_string_coerce_swf5, "avm1/object_string_coerce_swf5", 1),
682682
(object_string_coerce_swf6, "avm1/object_string_coerce_swf6", 1),
683683
(on_construct, "avm1/on_construct", 1),
684+
(parse_float, "avm1/parse_float", 1),
684685
(parse_int, "avm1/parse_int", 1),
685686
(path_string, "avm1/path_string", 1),
686687
(point, "avm1/point", 1),
@@ -823,7 +824,6 @@ swf_tests_approx! {
823824
(edittext_underline, "avm1/edittext_underline", 1, epsilon = 4.0),
824825
(local_to_global, "avm1/local_to_global", 1, epsilon = 0.051),
825826
(movieclip_getbounds, "avm1/movieclip_getbounds", 1, epsilon = 0.051),
826-
(parse_float, "avm1/parse_float", 1, max_relative = 5.0 * f64::EPSILON),
827827
(stage_object_properties_swf6, "avm1/stage_object_properties_swf6", 4, epsilon = 0.051),
828828
(stage_object_properties, "avm1/stage_object_properties", 6, epsilon = 0.051),
829829
}
Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// parseFloat()
2+
undefined
13
// parseFloat("12345")
24
12345
35
// parseFloat("012345.67890")
@@ -6,10 +8,16 @@
68
99999.99999
79
// parseFloat("-22222222222222222")
810
-2.22222222222222e+16
11+
// parseFloat("-22222222.222222222")
12+
-22222222.2222222
913
// parseFloat(".0000000000000000000000005")
1014
5e-25
15+
// parseFloat(".1499999") === 0.14999990000000005
16+
true
1117
// parseFloat("0000.12345GIBBERISH")
1218
0.12345
19+
// parseFloat("1 2")
20+
1
1321
// parseFloat("9e99999")
1422
Infinity
1523
// parseFloat("+100e-100")
@@ -18,27 +26,49 @@ Infinity
1826
-1.23234e+68
1927
// parseFloat(".2E20E1")
2028
2e+19
29+
// parseFloat("-034.1+e20")
30+
-34.1
31+
// parseFloat("-2.123123123219e20")
32+
-2.123123123219e+20
33+
// parseFloat("10101010e+100")
34+
1.010101e+107
35+
// parseFloat("10101010e-20.0")
36+
1.010101e-13
37+
// parseFloat("10e")
38+
10
39+
// parseFloat("e10")
40+
NaN
41+
// parseFloat("10e-")
42+
10
43+
// parseFloat("1e4294967297")
44+
10
2145
// parseFloat("1.2345.678")
2246
1.2345678
2347
// parseFloat("1.2345.6e50")
2448
1.23456
25-
// parseFloat("-034.1+e20")
26-
-34.1
27-
// parseFloat("e10")
49+
// parseFloat("-2.123123.123219e20")
50+
-2.123123123219
51+
// parseFloat("Infinity")
52+
NaN
53+
// parseFloat("-Infinity")
54+
NaN
55+
// parseFloat("+Infinity")
2856
NaN
2957
// parseFloat("BADBAD")
3058
NaN
59+
// parseFloat("")
60+
NaN
3161
// parseFloat("-")
3262
NaN
3363
// parseFloat("0xff")
3464
0
35-
// parseFloat("Infinity")
65+
// parseFloat(String.fromCharCode(305))
3666
NaN
3767
// parseFloat(true)
3868
NaN
3969
// parseFloat(1.2)
4070
1.2
4171
// parseFloat(Infinity)
4272
NaN
43-
// parseFloat({toString})
73+
// parseFloat({ toString })
4474
5
635 Bytes
Binary file not shown.
232 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)