Skip to content

Commit 3d4d7a0

Browse files
committed
tests: Add test for division in SWFv4
1 parent b221485 commit 3d4d7a0

File tree

4 files changed

+252
-0
lines changed

4 files changed

+252
-0
lines changed

tests/tests/regression_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ swf_tests! {
534534
(define_local_with_paths, "avm1/define_local_with_paths", 1),
535535
(delete, "avm1/delete", 3),
536536
(displacement_map_filter, "avm1/displacement_map_filter", 1),
537+
(divide_swf4, "avm1/divide_swf4", 1),
537538
(do_init_action, "avm1/do_init_action", 3),
538539
(drop_shadow_filter, "avm1/drop_shadow_filter", 1),
539540
(duplicate_movie_clip_drawing, "avm1/duplicate_movie_clip_drawing", 1),
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// 3 / 0
2+
#ERROR#
3+
4+
// 0 / 3
5+
0
6+
7+
// 3 / NaN
8+
NaN
9+
10+
// NaN / 3
11+
NaN
12+
13+
// 3 / Infinity
14+
0
15+
16+
// Infinity / 3
17+
Infinity
18+
19+
// 3 / -Infinity
20+
0
21+
22+
// -Infinity / 3
23+
-Infinity
24+
25+
// 0 / 0
26+
#ERROR#
27+
28+
// NaN / NaN
29+
NaN
30+
31+
// Infinity / Infinity
32+
NaN
33+
34+
// -Infinity / -Infinity
35+
NaN
36+
37+
// Infinity / -Infinity
38+
NaN
39+
40+
// -Infinity / Infinity
41+
NaN
42+
43+
// {} / {}
44+
#ERROR#
45+
46+
// 3 / undefined
47+
#ERROR#
48+
49+
// undefined / 3
50+
0
51+
52+
// 3 / null
53+
#ERROR#
54+
55+
// null / 3
56+
0
57+
58+
// 3 / '12.34'
59+
0.243111831442464
60+
61+
// '12.34' / 3
62+
4.11333333333333
63+
64+
// 3 / '12.34A'
65+
0.243111831442464
66+
67+
// '12.34A' / 3
68+
4.11333333333333
69+
70+
// 3 / 'ABC'
71+
#ERROR#
72+
73+
// 'ABC' / 3
74+
0
75+
76+
// 3 / ''
77+
#ERROR#
78+
79+
// '' / 3
80+
0
81+
82+
'' / ''
83+
#ERROR#
84+
85+
// undefined / undefined
86+
#ERROR#
87+
88+
// null / null
89+
#ERROR#
90+
91+
// undefined / null
92+
#ERROR#
93+
94+
// null / undefined
95+
#ERROR#
96+
97+
// '12.34' / '56.78'
98+
0.217330045790771
99+
100+
// '12.34' / '56.78A'
101+
0.217330045790771
102+
103+
// '56.78A' / '12.34'
104+
4.60129659643436
105+
106+
// '12.34A' / '56.78A'
107+
0.217330045790771
108+
1.65 KB
Binary file not shown.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
trace("// 3 / 0");
2+
trace(3 / 0);
3+
trace("");
4+
5+
trace("// 0 / 3");
6+
trace(0 / 3);
7+
trace("");
8+
9+
trace("// 3 / NaN");
10+
trace(3 / NaN);
11+
trace("");
12+
13+
trace("// NaN / 3");
14+
trace(NaN / 3);
15+
trace("");
16+
17+
trace("// 3 / Infinity");
18+
trace(3 / Infinity);
19+
trace("");
20+
21+
trace("// Infinity / 3");
22+
trace(Infinity / 3);
23+
trace("");
24+
25+
trace("// 3 / -Infinity");
26+
trace(3 / -Infinity);
27+
trace("");
28+
29+
trace("// -Infinity / 3");
30+
trace(-Infinity / 3);
31+
trace("");
32+
33+
trace("// 0 / 0");
34+
trace(0 / 0);
35+
trace("");
36+
37+
trace("// NaN / NaN");
38+
trace(NaN / NaN);
39+
trace("");
40+
41+
trace("// Infinity / Infinity");
42+
trace(Infinity / Infinity);
43+
trace("");
44+
45+
trace("// -Infinity / -Infinity");
46+
trace(-Infinity / -Infinity);
47+
trace("");
48+
49+
trace("// Infinity / -Infinity");
50+
trace(Infinity / -Infinity);
51+
trace("");
52+
53+
trace("// -Infinity / Infinity");
54+
trace(-Infinity / Infinity);
55+
trace("");
56+
57+
trace("// {} / {}");
58+
trace({} / {});
59+
trace("");
60+
61+
trace("// 3 / undefined");
62+
trace(3 / undefined);
63+
trace("");
64+
65+
trace("// undefined / 3");
66+
trace(undefined / 3);
67+
trace("");
68+
69+
trace("// 3 / null");
70+
trace(3 / null);
71+
trace("");
72+
73+
trace("// null / 3");
74+
trace(null / 3);
75+
trace("");
76+
77+
trace("// 3 / '12.34'");
78+
trace(3 / "12.34");
79+
trace("");
80+
81+
trace("// '12.34' / 3");
82+
trace("12.34" / 3);
83+
trace("");
84+
85+
trace("// 3 / '12.34A'");
86+
trace(3 / "12.34A");
87+
trace("");
88+
89+
trace("// '12.34A' / 3");
90+
trace("12.34A" / 3);
91+
trace("");
92+
93+
trace("// 3 / 'ABC'");
94+
trace(3 / "ABC");
95+
trace("");
96+
97+
trace("// 'ABC' / 3");
98+
trace("ABC" / 3);
99+
trace("");
100+
101+
trace("// 3 / ''");
102+
trace(3 / "");
103+
trace("");
104+
105+
trace("// '' / 3");
106+
trace("" / 3);
107+
trace("");
108+
109+
trace("'' / ''");
110+
trace("" / "");
111+
trace("");
112+
113+
trace("// undefined / undefined");
114+
trace(undefined / undefined);
115+
trace("");
116+
117+
trace("// null / null");
118+
trace(null / null);
119+
trace("");
120+
121+
trace("// undefined / null");
122+
trace(undefined / null);
123+
trace("");
124+
125+
trace("// null / undefined");
126+
trace(null / undefined);
127+
trace("");
128+
129+
trace("// '12.34' / '56.78'");
130+
trace("12.34" / "56.78");
131+
trace("");
132+
133+
trace("// '12.34' / '56.78A'");
134+
trace("12.34" / "56.78A");
135+
trace("");
136+
137+
trace("// '56.78A' / '12.34'");
138+
trace("56.78A" / "12.34");
139+
trace("");
140+
141+
trace("// '12.34A' / '56.78A'");
142+
trace("12.34A" / "56.78A");
143+
trace("");

0 commit comments

Comments
 (0)