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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 EXPECT(fourstr.IsTwoByteString()); | 1441 EXPECT(fourstr.IsTwoByteString()); |
1442 EXPECT(!fourstr.Equals("")); | 1442 EXPECT(!fourstr.Equals("")); |
1443 EXPECT(!fourstr.Equals("\xF0\x90\x8E\xA0")); | 1443 EXPECT(!fourstr.Equals("\xF0\x90\x8E\xA0")); |
1444 EXPECT(!fourstr.Equals("\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1")); | 1444 EXPECT(!fourstr.Equals("\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1")); |
1445 EXPECT(fourstr.Equals("\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1\xF0\x90\x8E\xA2")); | 1445 EXPECT(fourstr.Equals("\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1\xF0\x90\x8E\xA2")); |
1446 EXPECT(!fourstr.Equals("\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1" | 1446 EXPECT(!fourstr.Equals("\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1" |
1447 "\xF0\x90\x8E\xA2\xF0\x90\x8E\xA3")); | 1447 "\xF0\x90\x8E\xA2\xF0\x90\x8E\xA3")); |
1448 } | 1448 } |
1449 | 1449 |
1450 | 1450 |
| 1451 TEST_CASE(StringEqualsUTF32) { |
| 1452 const String& empty = String::Handle(String::New("")); |
| 1453 const String& t_str = String::Handle(String::New("t")); |
| 1454 const String& th_str = String::Handle(String::New("th")); |
| 1455 const int32_t chars[] = {'t', 'h', 'i', 's'}; |
| 1456 EXPECT(!empty.Equals(chars, -1)); |
| 1457 EXPECT(empty.Equals(chars, 0)); |
| 1458 EXPECT(!empty.Equals(chars, 1)); |
| 1459 EXPECT(!t_str.Equals(chars, 0)); |
| 1460 EXPECT(t_str.Equals(chars, 1)); |
| 1461 EXPECT(!t_str.Equals(chars, 2)); |
| 1462 EXPECT(!th_str.Equals(chars, 1)); |
| 1463 EXPECT(th_str.Equals(chars, 2)); |
| 1464 EXPECT(!th_str.Equals(chars, 3)); |
| 1465 } |
| 1466 |
| 1467 |
1451 TEST_CASE(ExternalOneByteString) { | 1468 TEST_CASE(ExternalOneByteString) { |
1452 uint8_t characters[] = { 0xF6, 0xF1, 0xE9 }; | 1469 uint8_t characters[] = { 0xF6, 0xF1, 0xE9 }; |
1453 intptr_t len = ARRAY_SIZE(characters); | 1470 intptr_t len = ARRAY_SIZE(characters); |
1454 | 1471 |
1455 const String& str = | 1472 const String& str = |
1456 String::Handle( | 1473 String::Handle( |
1457 ExternalOneByteString::New(characters, len, NULL, NULL, Heap::kNew)); | 1474 ExternalOneByteString::New(characters, len, NULL, NULL, Heap::kNew)); |
1458 EXPECT(!str.IsOneByteString()); | 1475 EXPECT(!str.IsOneByteString()); |
1459 EXPECT(str.IsExternalOneByteString()); | 1476 EXPECT(str.IsExternalOneByteString()); |
1460 EXPECT_EQ(str.Length(), len); | 1477 EXPECT_EQ(str.Length(), len); |
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3250 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); | 3267 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); |
3251 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); | 3268 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); |
3252 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); | 3269 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); |
3253 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); | 3270 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); |
3254 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); | 3271 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); |
3255 } | 3272 } |
3256 | 3273 |
3257 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 3274 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
3258 | 3275 |
3259 } // namespace dart | 3276 } // namespace dart |
OLD | NEW |