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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
8 | 8 |
9 using namespace v8::internal; | 9 using namespace v8::internal; |
10 using namespace v8::internal::compiler; | 10 using namespace v8::internal::compiler; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 T.CheckTrue(T.Val(1)); | 134 T.CheckTrue(T.Val(1)); |
135 T.CheckFalse(T.Val(1.1)); | 135 T.CheckFalse(T.Val(1.1)); |
136 T.CheckFalse(T.Val(-0.0)); | 136 T.CheckFalse(T.Val(-0.0)); |
137 T.CheckFalse(T.Val(-2)); | 137 T.CheckFalse(T.Val(-2)); |
138 T.CheckFalse(T.Val(-2.3)); | 138 T.CheckFalse(T.Val(-2.3)); |
139 T.CheckFalse(T.undefined()); | 139 T.CheckFalse(T.undefined()); |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 TEST(IsObject) { | |
144 FunctionTester T("(function(a) { return %_IsObject(a); })", flags); | |
145 | |
146 T.CheckFalse(T.NewObject("(function() {})")); | |
147 T.CheckTrue(T.NewObject("([1])")); | |
148 T.CheckTrue(T.NewObject("({})")); | |
149 T.CheckTrue(T.NewObject("(/x/)")); | |
150 T.CheckFalse(T.undefined()); | |
151 T.CheckTrue(T.null()); | |
152 T.CheckFalse(T.Val("x")); | |
153 T.CheckFalse(T.Val(1)); | |
154 } | |
155 | |
156 | |
157 TEST(IsRegExp) { | 143 TEST(IsRegExp) { |
158 FunctionTester T("(function(a) { return %_IsRegExp(a); })", flags); | 144 FunctionTester T("(function(a) { return %_IsRegExp(a); })", flags); |
159 | 145 |
160 T.CheckFalse(T.NewObject("new Date()")); | 146 T.CheckFalse(T.NewObject("new Date()")); |
161 T.CheckFalse(T.NewObject("(function() {})")); | 147 T.CheckFalse(T.NewObject("(function() {})")); |
162 T.CheckFalse(T.NewObject("([1])")); | 148 T.CheckFalse(T.NewObject("([1])")); |
163 T.CheckFalse(T.NewObject("({})")); | 149 T.CheckFalse(T.NewObject("({})")); |
164 T.CheckTrue(T.NewObject("(/x/)")); | 150 T.CheckTrue(T.NewObject("(/x/)")); |
165 T.CheckFalse(T.undefined()); | 151 T.CheckFalse(T.undefined()); |
166 T.CheckFalse(T.null()); | 152 T.CheckFalse(T.null()); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 336 |
351 | 337 |
352 TEST(ValueOf) { | 338 TEST(ValueOf) { |
353 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); | 339 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); |
354 | 340 |
355 T.CheckCall(T.Val("a"), T.Val("a")); | 341 T.CheckCall(T.Val("a"), T.Val("a")); |
356 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); | 342 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); |
357 T.CheckCall(T.Val(123), T.Val(123)); | 343 T.CheckCall(T.Val(123), T.Val(123)); |
358 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); | 344 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); |
359 } | 345 } |
OLD | NEW |