Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: runtime/vm/object_test.cc

Issue 400493002: Hide dangerous interface String::Equals/Hash(uint8_t*,... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 EXPECT(str6.Equals(two_one_two_str)); 1270 EXPECT(str6.Equals(two_one_two_str));
1271 } 1271 }
1272 1272
1273 // Concatenate 1-byte strings and 2-byte strings. 1273 // Concatenate 1-byte strings and 2-byte strings.
1274 { 1274 {
1275 const uint8_t one[] = { 'o', 'n', 'e', ' ', 'b', 'y', 't', 'e' }; 1275 const uint8_t one[] = { 'o', 'n', 'e', ' ', 'b', 'y', 't', 'e' };
1276 intptr_t one_len = sizeof(one) / sizeof(one[0]); 1276 intptr_t one_len = sizeof(one) / sizeof(one[0]);
1277 const String& onestr = String::Handle(String::FromLatin1(one, one_len)); 1277 const String& onestr = String::Handle(String::FromLatin1(one, one_len));
1278 EXPECT(onestr.IsOneByteString()); 1278 EXPECT(onestr.IsOneByteString());
1279 EXPECT_EQ(one_len, onestr.Length()); 1279 EXPECT_EQ(one_len, onestr.Length());
1280 EXPECT(onestr.Equals(one, one_len)); 1280 EXPECT(onestr.EqualsLatin1(one, one_len));
1281 1281
1282 uint16_t two[] = { 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9 }; 1282 uint16_t two[] = { 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9 };
1283 intptr_t two_len = sizeof(two) / sizeof(two[0]); 1283 intptr_t two_len = sizeof(two) / sizeof(two[0]);
1284 const String& twostr = String::Handle(String::FromUTF16(two, two_len)); 1284 const String& twostr = String::Handle(String::FromUTF16(two, two_len));
1285 EXPECT(twostr.IsTwoByteString()); 1285 EXPECT(twostr.IsTwoByteString());
1286 EXPECT_EQ(two_len, twostr.Length()); 1286 EXPECT_EQ(two_len, twostr.Length());
1287 EXPECT(twostr.Equals(two, two_len)); 1287 EXPECT(twostr.Equals(two, two_len));
1288 1288
1289 // Concat 1289 // Concat
1290 1290
(...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after
4198 EXPECT_VALID(h_result); 4198 EXPECT_VALID(h_result);
4199 Integer& result = Integer::Handle(); 4199 Integer& result = Integer::Handle();
4200 result ^= Api::UnwrapHandle(h_result); 4200 result ^= Api::UnwrapHandle(h_result);
4201 String& foo = String::Handle(String::New("foo")); 4201 String& foo = String::Handle(String::New("foo"));
4202 Integer& expected = Integer::Handle(); 4202 Integer& expected = Integer::Handle();
4203 expected ^= foo.HashCode(); 4203 expected ^= foo.HashCode();
4204 EXPECT(result.IsIdenticalTo(expected)); 4204 EXPECT(result.IsIdenticalTo(expected));
4205 } 4205 }
4206 4206
4207 } // namespace dart 4207 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698