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/globals.h" | 5 #include "platform/globals.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 const String& str6 = String::Handle(String::ConcatAll(array4)); | 1135 const String& str6 = String::Handle(String::ConcatAll(array4)); |
1136 EXPECT(str6.IsTwoByteString()); | 1136 EXPECT(str6.IsTwoByteString()); |
1137 const uint16_t two_one_two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9, | 1137 const uint16_t two_one_two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9, |
1138 0x05D0, 0x05D9, 0x05D9, 0x05DF, 0x05E6, | 1138 0x05D0, 0x05D9, 0x05D9, 0x05DF, 0x05E6, |
1139 0x05D5, 0x05D5, 0x05D9, 0x05D9}; | 1139 0x05D5, 0x05D5, 0x05D9, 0x05D9}; |
1140 intptr_t two_one_two_len = sizeof(two_one_two) / sizeof(two_one_two[0]); | 1140 intptr_t two_one_two_len = sizeof(two_one_two) / sizeof(two_one_two[0]); |
1141 EXPECT_EQ(two_one_two_len, str6.Length()); | 1141 EXPECT_EQ(two_one_two_len, str6.Length()); |
1142 EXPECT(str6.Equals(two_one_two, two_one_two_len)); | 1142 EXPECT(str6.Equals(two_one_two, two_one_two_len)); |
1143 } | 1143 } |
1144 | 1144 |
1145 // Concatenated emtpy and non-empty strings built from 4-byte elements. | 1145 // Concatenated empty and non-empty strings built from 4-byte elements. |
1146 { | 1146 { |
1147 const String& str1 = String::Handle(String::New("")); | 1147 const String& str1 = String::Handle(String::New("")); |
1148 EXPECT(str1.IsOneByteString()); | 1148 EXPECT(str1.IsOneByteString()); |
1149 EXPECT_EQ(0, str1.Length()); | 1149 EXPECT_EQ(0, str1.Length()); |
1150 | 1150 |
1151 int32_t four[] = {0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1}; | 1151 int32_t four[] = {0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1}; |
1152 intptr_t four_len = sizeof(four) / sizeof(four[0]); | 1152 intptr_t four_len = sizeof(four) / sizeof(four[0]); |
1153 intptr_t expected_len = (four_len * 2); | 1153 intptr_t expected_len = (four_len * 2); |
1154 const String& str2 = String::Handle(String::FromUTF32(four, four_len)); | 1154 const String& str2 = String::Handle(String::FromUTF32(four, four_len)); |
1155 EXPECT(str2.IsTwoByteString()); | 1155 EXPECT(str2.IsTwoByteString()); |
(...skipping 3584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4740 // utf32->utf16 conversion. | 4740 // utf32->utf16 conversion. |
4741 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, | 4741 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, |
4742 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; | 4742 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; |
4743 | 4743 |
4744 const String& str = | 4744 const String& str = |
4745 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); | 4745 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); |
4746 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); | 4746 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); |
4747 } | 4747 } |
4748 | 4748 |
4749 } // namespace dart | 4749 } // namespace dart |
OLD | NEW |