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/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 }; | 1305 }; |
1306 const String& str = String::Handle(String::New(src)); | 1306 const String& str = String::Handle(String::New(src)); |
1307 EXPECT(str.IsTwoByteString()); | 1307 EXPECT(str.IsTwoByteString()); |
1308 intptr_t expected_size = sizeof(expected) / sizeof(expected[0]); | 1308 intptr_t expected_size = sizeof(expected) / sizeof(expected[0]); |
1309 EXPECT_EQ(expected_size, str.Length()); | 1309 EXPECT_EQ(expected_size, str.Length()); |
1310 for (int i = 0; i < str.Length(); ++i) { | 1310 for (int i = 0; i < str.Length(); ++i) { |
1311 EXPECT_EQ(expected[i], str.CharAt(i)); | 1311 EXPECT_EQ(expected[i], str.CharAt(i)); |
1312 } | 1312 } |
1313 } | 1313 } |
1314 | 1314 |
1315 // Create a SMP 2-byte string from a UTF-8 string literal. | 1315 // Create a 2-byte string with supplementary characters from a UTF-8 |
| 1316 // string literal. |
1316 { | 1317 { |
1317 const char* src = | 1318 const char* src = |
1318 "\xF0\x9D\x91\xA0\xF0\x9D\x91\xA1" | 1319 "\xF0\x9D\x91\xA0\xF0\x9D\x91\xA1" |
1319 "\xF0\x9D\x91\xA2\xF0\x9D\x91\xA3"; | 1320 "\xF0\x9D\x91\xA2\xF0\x9D\x91\xA3"; |
1320 const intptr_t expected[] = { 0xd835, 0xdc60, 0xd835, 0xdc61, | 1321 const intptr_t expected[] = { 0xd835, 0xdc60, 0xd835, 0xdc61, |
1321 0xd835, 0xdc62, 0xd835, 0xdc63 }; | 1322 0xd835, 0xdc62, 0xd835, 0xdc63 }; |
1322 const String& str = String::Handle(String::New(src)); | 1323 const String& str = String::Handle(String::New(src)); |
1323 EXPECT(str.IsTwoByteString()); | 1324 EXPECT(str.IsTwoByteString()); |
1324 intptr_t expected_size = (sizeof(expected) / sizeof(expected[0])); | 1325 intptr_t expected_size = (sizeof(expected) / sizeof(expected[0])); |
1325 EXPECT_EQ(expected_size, str.Length()); | 1326 EXPECT_EQ(expected_size, str.Length()); |
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3086 isolate->heap()->CollectAllGarbage(); | 3087 isolate->heap()->CollectAllGarbage(); |
3087 EXPECT(weak1.key() == Object::null()); | 3088 EXPECT(weak1.key() == Object::null()); |
3088 EXPECT(weak1.value() == Object::null()); | 3089 EXPECT(weak1.value() == Object::null()); |
3089 EXPECT(weak2.key() == Object::null()); | 3090 EXPECT(weak2.key() == Object::null()); |
3090 EXPECT(weak2.value() == Object::null()); | 3091 EXPECT(weak2.value() == Object::null()); |
3091 } | 3092 } |
3092 | 3093 |
3093 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 3094 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
3094 | 3095 |
3095 } // namespace dart | 3096 } // namespace dart |
OLD | NEW |