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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 T.CheckCall(T.Val(3), T.Val("3"), T.NewObject("([1])")); | 50 T.CheckCall(T.Val(3), T.Val("3"), T.NewObject("([1])")); |
51 T.CheckCall(T.nan(), T.Val("3"), T.NewObject("({})")); | 51 T.CheckCall(T.nan(), T.Val("3"), T.NewObject("({})")); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 TEST(BinopDivide) { | 55 TEST(BinopDivide) { |
56 FunctionTester T("(function(a,b) { return a / b; })"); | 56 FunctionTester T("(function(a,b) { return a / b; })"); |
57 | 57 |
58 T.CheckCall(2, 8, 4); | 58 T.CheckCall(2, 8, 4); |
59 T.CheckCall(2.1, 8.4, 4); | 59 T.CheckCall(2.1, 8.4, 4); |
60 T.CheckCall(std::numeric_limits<double>::infinity(), 8, 0); | 60 T.CheckCall(V8_INFINITY, 8, 0); |
61 T.CheckCall(-std::numeric_limits<double>::infinity(), -8, 0); | 61 T.CheckCall(-V8_INFINITY, -8, 0); |
62 T.CheckCall(T.infinity(), T.Val(8), T.Val("0")); | 62 T.CheckCall(T.infinity(), T.Val(8), T.Val("0")); |
63 T.CheckCall(T.minus_infinity(), T.Val("-8"), T.Val(0.0)); | 63 T.CheckCall(T.minus_infinity(), T.Val("-8"), T.Val(0.0)); |
64 T.CheckCall(T.Val(1.5), T.Val("3"), T.Val("2")); | 64 T.CheckCall(T.Val(1.5), T.Val("3"), T.Val("2")); |
65 T.CheckCall(T.nan(), T.Val("3"), T.Val("B")); | 65 T.CheckCall(T.nan(), T.Val("3"), T.Val("B")); |
66 T.CheckCall(T.Val(1.5), T.Val("3"), T.NewObject("([2])")); | 66 T.CheckCall(T.Val(1.5), T.Val("3"), T.NewObject("([2])")); |
67 T.CheckCall(T.nan(), T.Val("3"), T.NewObject("({})")); | 67 T.CheckCall(T.nan(), T.Val("3"), T.NewObject("({})")); |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 TEST(BinopModulus) { | 71 TEST(BinopModulus) { |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b")); | 515 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b")); |
516 } | 516 } |
517 | 517 |
518 | 518 |
519 TEST(RegExpLiteral) { | 519 TEST(RegExpLiteral) { |
520 FunctionTester T("(function(a) { o = /b/; return o.test(a); })"); | 520 FunctionTester T("(function(a) { o = /b/; return o.test(a); })"); |
521 | 521 |
522 T.CheckTrue(T.Val("abc")); | 522 T.CheckTrue(T.Val("abc")); |
523 T.CheckFalse(T.Val("xyz")); | 523 T.CheckFalse(T.Val("xyz")); |
524 } | 524 } |
OLD | NEW |