OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 Operator1<int> op3(12, Operator::kNoProperties, 0, 1, "Mnemonic1", 12333); | 22 Operator1<int> op3(12, Operator::kNoProperties, 0, 1, "Mnemonic1", 12333); |
23 CHECK_EQ(0, strcmp(op3.mnemonic(), "Mnemonic1")); | 23 CHECK_EQ(0, strcmp(op3.mnemonic(), "Mnemonic1")); |
24 | 24 |
25 Operator1<double> op4(13, Operator::kNoProperties, 0, 1, "TheOther", 99.9); | 25 Operator1<double> op4(13, Operator::kNoProperties, 0, 1, "TheOther", 99.9); |
26 CHECK_EQ(0, strcmp(op4.mnemonic(), "TheOther")); | 26 CHECK_EQ(0, strcmp(op4.mnemonic(), "TheOther")); |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 TEST(TestSimpleOperatorHash) { | 30 TEST(TestSimpleOperatorHash) { |
31 SimpleOperator op1(17, Operator::kNoProperties, 0, 0, "Another"); | 31 SimpleOperator op1(17, Operator::kNoProperties, 0, 0, "Another"); |
32 CHECK_EQ(17, op1.HashCode()); | 32 CHECK_EQ(17, static_cast<int>(op1.HashCode())); |
33 | 33 |
34 SimpleOperator op2(18, Operator::kNoProperties, 0, 0, "Falsch"); | 34 SimpleOperator op2(18, Operator::kNoProperties, 0, 0, "Falsch"); |
35 CHECK_EQ(18, op2.HashCode()); | 35 CHECK_EQ(18, static_cast<int>(op2.HashCode())); |
36 } | 36 } |
37 | 37 |
38 | 38 |
39 TEST(TestSimpleOperatorEquals) { | 39 TEST(TestSimpleOperatorEquals) { |
40 SimpleOperator op1a(19, Operator::kNoProperties, 0, 0, "Another1"); | 40 SimpleOperator op1a(19, Operator::kNoProperties, 0, 0, "Another1"); |
41 SimpleOperator op1b(19, Operator::kFoldable, 2, 2, "Another2"); | 41 SimpleOperator op1b(19, Operator::kFoldable, 2, 2, "Another2"); |
42 | 42 |
43 CHECK(op1a.Equals(&op1a)); | 43 CHECK(op1a.Equals(&op1a)); |
44 CHECK(op1a.Equals(&op1b)); | 44 CHECK(op1a.Equals(&op1b)); |
45 CHECK(op1b.Equals(&op1a)); | 45 CHECK(op1b.Equals(&op1a)); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 CHECK(op4a.Equals(&op4a)); | 216 CHECK(op4a.Equals(&op4a)); |
217 CHECK(op4a.Equals(&op4b)); | 217 CHECK(op4a.Equals(&op4b)); |
218 CHECK(op4b.Equals(&op4a)); | 218 CHECK(op4b.Equals(&op4a)); |
219 CHECK(op4b.Equals(&op4b)); | 219 CHECK(op4b.Equals(&op4b)); |
220 | 220 |
221 CHECK(!op3.Equals(&op4a)); | 221 CHECK(!op3.Equals(&op4a)); |
222 CHECK(!op3.Equals(&op4b)); | 222 CHECK(!op3.Equals(&op4b)); |
223 CHECK(!op3.Equals(&op4a)); | 223 CHECK(!op3.Equals(&op4a)); |
224 CHECK(!op3.Equals(&op4b)); | 224 CHECK(!op3.Equals(&op4b)); |
225 } | 225 } |
OLD | NEW |