Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/builtin.h" | 5 #include "bin/builtin.h" |
| 6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
| 7 #include "include/dart_mirrors_api.h" | 7 #include "include/dart_mirrors_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/json.h" | 10 #include "platform/json.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 EXPECT_VALID(Dart_ObjectEquals(five, five, &equal)); | 223 EXPECT_VALID(Dart_ObjectEquals(five, five, &equal)); |
| 224 EXPECT(equal); | 224 EXPECT(equal); |
| 225 | 225 |
| 226 // Equal objects. | 226 // Equal objects. |
| 227 EXPECT_VALID(Dart_ObjectEquals(five, five_again, &equal)); | 227 EXPECT_VALID(Dart_ObjectEquals(five, five_again, &equal)); |
| 228 EXPECT(equal); | 228 EXPECT(equal); |
| 229 | 229 |
| 230 // Different objects. | 230 // Different objects. |
| 231 EXPECT_VALID(Dart_ObjectEquals(five, seven, &equal)); | 231 EXPECT_VALID(Dart_ObjectEquals(five, seven, &equal)); |
| 232 EXPECT(!equal); | 232 EXPECT(!equal); |
| 233 | |
| 234 // Case where identity is not equality. | |
| 235 Dart_Handle nan = Dart_NewDouble(NAN); | |
| 236 EXPECT_VALID(Dart_ObjectEquals(nan, nan, &equal)); | |
|
rmacnak
2013/09/18 21:04:24
This will hit CompareDoubles.
| |
| 237 EXPECT(!equal); | |
| 233 } | 238 } |
| 234 | 239 |
| 235 | 240 |
| 236 TEST_CASE(InstanceValues) { | 241 TEST_CASE(InstanceValues) { |
| 237 EXPECT(Dart_IsInstance(NewString("test"))); | 242 EXPECT(Dart_IsInstance(NewString("test"))); |
| 238 EXPECT(Dart_IsInstance(Dart_True())); | 243 EXPECT(Dart_IsInstance(Dart_True())); |
| 239 | 244 |
| 240 // By convention, our Is*() functions exclude null. | 245 // By convention, our Is*() functions exclude null. |
| 241 EXPECT(!Dart_IsInstance(Dart_Null())); | 246 EXPECT(!Dart_IsInstance(Dart_Null())); |
| 242 } | 247 } |
| (...skipping 7080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7323 NewString("main"), | 7328 NewString("main"), |
| 7324 0, | 7329 0, |
| 7325 NULL); | 7330 NULL); |
| 7326 int64_t value = 0; | 7331 int64_t value = 0; |
| 7327 result = Dart_IntegerToInt64(result, &value); | 7332 result = Dart_IntegerToInt64(result, &value); |
| 7328 EXPECT_VALID(result); | 7333 EXPECT_VALID(result); |
| 7329 EXPECT_EQ(8, value); | 7334 EXPECT_EQ(8, value); |
| 7330 } | 7335 } |
| 7331 | 7336 |
| 7332 } // namespace dart | 7337 } // namespace dart |
| OLD | NEW |