OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "test/cctest/compiler/function-tester.h" | 5 #include "test/cctest/compiler/function-tester.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace compiler { | 9 namespace compiler { |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 T.CheckFalse(T.NewObject("([1])")); | 97 T.CheckFalse(T.NewObject("([1])")); |
98 T.CheckFalse(T.NewObject("({})")); | 98 T.CheckFalse(T.NewObject("({})")); |
99 T.CheckFalse(T.NewObject("(/x/)")); | 99 T.CheckFalse(T.NewObject("(/x/)")); |
100 T.CheckFalse(T.undefined()); | 100 T.CheckFalse(T.undefined()); |
101 T.CheckFalse(T.null()); | 101 T.CheckFalse(T.null()); |
102 T.CheckFalse(T.Val("x")); | 102 T.CheckFalse(T.Val("x")); |
103 T.CheckFalse(T.Val(1)); | 103 T.CheckFalse(T.Val(1)); |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 TEST(IsMinusZero) { | |
108 FunctionTester T("(function(a) { return %_IsMinusZero(a); })", flags); | |
109 | |
110 T.CheckFalse(T.Val(1)); | |
111 T.CheckFalse(T.Val(1.1)); | |
112 T.CheckTrue(T.Val(-0.0)); | |
113 T.CheckFalse(T.Val(-2)); | |
114 T.CheckFalse(T.Val(-2.3)); | |
115 T.CheckFalse(T.undefined()); | |
116 } | |
117 | |
118 | |
119 TEST(IsRegExp) { | 107 TEST(IsRegExp) { |
120 FunctionTester T("(function(a) { return %_IsRegExp(a); })", flags); | 108 FunctionTester T("(function(a) { return %_IsRegExp(a); })", flags); |
121 | 109 |
122 T.CheckFalse(T.NewObject("new Date()")); | 110 T.CheckFalse(T.NewObject("new Date()")); |
123 T.CheckFalse(T.NewObject("(function() {})")); | 111 T.CheckFalse(T.NewObject("(function() {})")); |
124 T.CheckFalse(T.NewObject("([1])")); | 112 T.CheckFalse(T.NewObject("([1])")); |
125 T.CheckFalse(T.NewObject("({})")); | 113 T.CheckFalse(T.NewObject("({})")); |
126 T.CheckTrue(T.NewObject("(/x/)")); | 114 T.CheckTrue(T.NewObject("(/x/)")); |
127 T.CheckFalse(T.undefined()); | 115 T.CheckFalse(T.undefined()); |
128 T.CheckFalse(T.null()); | 116 T.CheckFalse(T.null()); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 280 |
293 T.CheckCall(T.Val("a"), T.Val("a")); | 281 T.CheckCall(T.Val("a"), T.Val("a")); |
294 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); | 282 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); |
295 T.CheckCall(T.Val(123), T.Val(123)); | 283 T.CheckCall(T.Val(123), T.Val(123)); |
296 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); | 284 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); |
297 } | 285 } |
298 | 286 |
299 } // namespace compiler | 287 } // namespace compiler |
300 } // namespace internal | 288 } // namespace internal |
301 } // namespace v8 | 289 } // namespace v8 |
OLD | NEW |