| 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 | 5 |
| 6 // This tests the correctness of the typer. | 6 // This tests the correctness of the typer. |
| 7 // | 7 // |
| 8 // For simplicity, it currently only tests it on expression operators that have | 8 // For simplicity, it currently only tests it on expression operators that have |
| 9 // a direct equivalent in C++. Also, testing is currently limited to ranges as | 9 // a direct equivalent in C++. Also, testing is currently limited to ranges as |
| 10 // input types. | 10 // input types. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 static int32_t shift_left(int32_t x, int32_t y) { return x << y; } | 166 static int32_t shift_left(int32_t x, int32_t y) { return x << y; } |
| 167 static int32_t shift_right(int32_t x, int32_t y) { return x >> y; } | 167 static int32_t shift_right(int32_t x, int32_t y) { return x >> y; } |
| 168 static int32_t bit_or(int32_t x, int32_t y) { return x | y; } | 168 static int32_t bit_or(int32_t x, int32_t y) { return x | y; } |
| 169 static int32_t bit_and(int32_t x, int32_t y) { return x & y; } | 169 static int32_t bit_and(int32_t x, int32_t y) { return x & y; } |
| 170 static int32_t bit_xor(int32_t x, int32_t y) { return x ^ y; } | 170 static int32_t bit_xor(int32_t x, int32_t y) { return x ^ y; } |
| 171 | 171 |
| 172 | 172 |
| 173 TEST(TypeJSAdd) { | 173 TEST(TypeJSAdd) { |
| 174 TyperTester t; | 174 TyperTester t; |
| 175 t.TestBinaryArithOp(t.javascript_.Subtract(), std::plus<double>()); | 175 t.TestBinaryArithOp(t.javascript_.Add(), std::plus<double>()); |
| 176 } | 176 } |
| 177 | 177 |
| 178 | 178 |
| 179 TEST(TypeJSSubtract) { | 179 TEST(TypeJSSubtract) { |
| 180 TyperTester t; | 180 TyperTester t; |
| 181 t.TestBinaryArithOp(t.javascript_.Subtract(), std::minus<double>()); | 181 t.TestBinaryArithOp(t.javascript_.Subtract(), std::minus<double>()); |
| 182 } | 182 } |
| 183 | 183 |
| 184 | 184 |
| 185 TEST(TypeJSMultiply) { | 185 TEST(TypeJSMultiply) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 TyperTester t; | 267 TyperTester t; |
| 268 t.TestBinaryCompareOp(t.javascript_.StrictEqual(), std::equal_to<double>()); | 268 t.TestBinaryCompareOp(t.javascript_.StrictEqual(), std::equal_to<double>()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 | 271 |
| 272 TEST(TypeJSStrictNotEqual) { | 272 TEST(TypeJSStrictNotEqual) { |
| 273 TyperTester t; | 273 TyperTester t; |
| 274 t.TestBinaryCompareOp( | 274 t.TestBinaryCompareOp( |
| 275 t.javascript_.StrictNotEqual(), std::not_equal_to<double>()); | 275 t.javascript_.StrictNotEqual(), std::not_equal_to<double>()); |
| 276 } | 276 } |
| OLD | NEW |