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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 EXPECT_EQ(0xFF, four_str.CharAt(1)); | 569 EXPECT_EQ(0xFF, four_str.CharAt(1)); |
570 EXPECT_EQ('h', four_str.CharAt(2)); | 570 EXPECT_EQ('h', four_str.CharAt(2)); |
571 EXPECT_EQ(0xFFFF, four_str.CharAt(3)); | 571 EXPECT_EQ(0xFFFF, four_str.CharAt(3)); |
572 EXPECT_EQ('a', four_str.CharAt(4)); | 572 EXPECT_EQ('a', four_str.CharAt(4)); |
573 EXPECT_EQ(0xDBFF, four_str.CharAt(5)); | 573 EXPECT_EQ(0xDBFF, four_str.CharAt(5)); |
574 EXPECT_EQ(0xDFFF, four_str.CharAt(6)); | 574 EXPECT_EQ(0xDFFF, four_str.CharAt(6)); |
575 EXPECT_EQ('r', four_str.CharAt(7)); | 575 EXPECT_EQ('r', four_str.CharAt(7)); |
576 | 576 |
577 // Create a 1-byte string from an array of 2-byte elements. | 577 // Create a 1-byte string from an array of 2-byte elements. |
578 { | 578 { |
579 const uint16_t char16[] = { 0x00, 0x1F, 0x7F }; | 579 const uint16_t char16[] = { 0x00, 0x7F, 0xFF }; |
580 const String& str8 = String::Handle(String::New(char16, 3)); | 580 const String& str8 = String::Handle(String::New(char16, 3)); |
581 EXPECT(str8.IsOneByteString()); | 581 EXPECT(str8.IsOneByteString()); |
582 EXPECT(!str8.IsTwoByteString()); | 582 EXPECT(!str8.IsTwoByteString()); |
583 EXPECT_EQ(0x00, str8.CharAt(0)); | 583 EXPECT_EQ(0x00, str8.CharAt(0)); |
584 EXPECT_EQ(0x1F, str8.CharAt(1)); | 584 EXPECT_EQ(0x7F, str8.CharAt(1)); |
585 EXPECT_EQ(0x7F, str8.CharAt(2)); | 585 EXPECT_EQ(0xFF, str8.CharAt(2)); |
586 } | 586 } |
587 | 587 |
588 // Create a 1-byte string from an array of 4-byte elements. | 588 // Create a 1-byte string from an array of 4-byte elements. |
589 { | 589 { |
590 const uint32_t char32[] = { 0x00, 0x1F, 0x7F }; | 590 const uint32_t char32[] = { 0x00, 0x1F, 0x7F }; |
591 const String& str8 = String::Handle(String::New(char32, 3)); | 591 const String& str8 = String::Handle(String::New(char32, 3)); |
592 EXPECT(str8.IsOneByteString()); | 592 EXPECT(str8.IsOneByteString()); |
593 EXPECT(!str8.IsTwoByteString()); | 593 EXPECT(!str8.IsTwoByteString()); |
594 EXPECT_EQ(0x00, str8.CharAt(0)); | 594 EXPECT_EQ(0x00, str8.CharAt(0)); |
595 EXPECT_EQ(0x1F, str8.CharAt(1)); | 595 EXPECT_EQ(0x1F, str8.CharAt(1)); |
(...skipping 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3031 isolate->heap()->CollectAllGarbage(); | 3031 isolate->heap()->CollectAllGarbage(); |
3032 EXPECT(weak1.key() == Object::null()); | 3032 EXPECT(weak1.key() == Object::null()); |
3033 EXPECT(weak1.value() == Object::null()); | 3033 EXPECT(weak1.value() == Object::null()); |
3034 EXPECT(weak2.key() == Object::null()); | 3034 EXPECT(weak2.key() == Object::null()); |
3035 EXPECT(weak2.value() == Object::null()); | 3035 EXPECT(weak2.value() == Object::null()); |
3036 } | 3036 } |
3037 | 3037 |
3038 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 3038 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
3039 | 3039 |
3040 } // namespace dart | 3040 } // namespace dart |
OLD | NEW |