blob: 5a98eff1c88c3fa83e0075cd79996c39602adb19 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --allow-natives-syntax
6
7function test(expected, f) {
8 assertEquals(expected, f());
9 assertEquals(expected, f());
10 %OptimizeFunctionOnNextCall(f);
11 assertEquals(expected, f());
12 assertEquals(expected, f());
13}
14
15function f1() { return NaN; }
16test((0/0), f1);
17
18function f2() { return (0/0); }
19test((0/0), f2);
20
21function f3() { return (0/0) == (0/0); }
22test(false, f3);
23
24function f4() { return (0/0) == NaN; }
25test(false, f4);
26
27function f5() { return NaN == (0/0); }
28test(false, f5);
29
30function f6() { return "" + NaN; }
31test("NaN", f6);
32
33function f7() { return (0/0) === (0/0); }
34test(false, f7);
35
36function f8() { return (0/0) === NaN; }
37test(false, f8);
38
39function f9() { return NaN === (0/0); }
40test(false, f9);
41
42delete NaN;
43
44function g1() { return NaN; }
45test((0/0), g1);
46
47function g2() { return (0/0); }
48test((0/0), g2);
49
50function g3() { return (0/0) == (0/0); }
51test(false, g3);
52
53function g4() { return (0/0) == NaN; }
54test(false, g4);
55
56function g5() { return NaN == (0/0); }
57test(false, g5);
58
59function g6() { return "" + NaN; }
60test("NaN", g6);
61
62function g7() { return (0/0) === (0/0); }
63test(false, g7);
64
65function g8() { return (0/0) === NaN; }
66test(false, g8);
67
68function g9() { return NaN === (0/0); }
69test(false, g9);
70
71NaN = 111;
72
73function h1() { return NaN; }
74test((0/0), h1);
75
76function h2() { return (0/0); }
77test((0/0), h2);
78
79function h3() { return (0/0) == (0/0); }
80test(false, h3);
81
82function h4() { return (0/0) == NaN; }
83test(false, h4);
84
85function h5() { return NaN == (0/0); }
86test(false, h5);
87
88function h6() { return "" + NaN; }
89test("NaN", h6);
90
91function h7() { return (0/0) === (0/0); }
92test(false, h7);
93
94function h8() { return (0/0) === NaN; }
95test(false, h8);
96
97function h9() { return NaN === (0/0); }
98test(false, h9);
99
100// -------------
101
102function k1() { return this.NaN; }
103test((0/0), k1);
104
105function k2() { return (0/0); }
106test((0/0), k2);
107
108function k3() { return (0/0) == (0/0); }
109test(false, k3);
110
111function k4() { return (0/0) == this.NaN; }
112test(false, k4);
113
114function k5() { return this.NaN == (0/0); }
115test(false, k5);
116
117function k6() { return "" + this.NaN; }
118test("NaN", k6);
119
120function k7() { return (0/0) === (0/0); }
121test(false, k7);
122
123function k8() { return (0/0) === this.NaN; }
124test(false, k8);
125
126function k9() { return this.NaN === (0/0); }
127test(false, k9);