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

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

Issue 11412258: Use the code point iterator when computing 16-bit string hash codes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: bugfix Created 8 years 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.cc ('k') | runtime/vm/unicode.h » ('j') | 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/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 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 EXPECT(it3.Next()); 1687 EXPECT(it3.Next());
1688 EXPECT_EQ(0x1D461, it3.Current()); 1688 EXPECT_EQ(0x1D461, it3.Current());
1689 EXPECT(it3.Next()); 1689 EXPECT(it3.Next());
1690 EXPECT_EQ(0x1D462, it3.Current()); 1690 EXPECT_EQ(0x1D462, it3.Current());
1691 EXPECT(it3.Next()); 1691 EXPECT(it3.Next());
1692 EXPECT_EQ(0x1D463, it3.Current()); 1692 EXPECT_EQ(0x1D463, it3.Current());
1693 EXPECT(!it3.Next()); 1693 EXPECT(!it3.Next());
1694 } 1694 }
1695 1695
1696 1696
1697 TEST_CASE(StringCodePointIteratorRange) {
1698 const String& str = String::Handle(String::New("foo bar baz"));
1699
1700 String::CodePointIterator it0(str, 3, 0);
1701 EXPECT(!it0.Next());
1702
1703 String::CodePointIterator it1(str, 4, 3);
1704 EXPECT(it1.Next());
1705 EXPECT_EQ('b', it1.Current());
1706 EXPECT(it1.Next());
1707 EXPECT_EQ('a', it1.Current());
1708 EXPECT(it1.Next());
1709 EXPECT_EQ('r', it1.Current());
1710 EXPECT(!it1.Next());
1711 }
1712
1713
1697 TEST_CASE(GrowableObjectArray) { 1714 TEST_CASE(GrowableObjectArray) {
1698 const int kArrayLen = 5; 1715 const int kArrayLen = 5;
1699 Smi& value = Smi::Handle(); 1716 Smi& value = Smi::Handle();
1700 Smi& expected_value = Smi::Handle(); 1717 Smi& expected_value = Smi::Handle();
1701 GrowableObjectArray& array = GrowableObjectArray::Handle(); 1718 GrowableObjectArray& array = GrowableObjectArray::Handle();
1702 1719
1703 // Test basic growing functionality. 1720 // Test basic growing functionality.
1704 array = GrowableObjectArray::New(kArrayLen); 1721 array = GrowableObjectArray::New(kArrayLen);
1705 EXPECT_EQ(kArrayLen, array.Capacity()); 1722 EXPECT_EQ(kArrayLen, array.Capacity());
1706 EXPECT_EQ(0, array.Length()); 1723 EXPECT_EQ(0, array.Length());
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
3231 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); 3248 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint());
3232 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); 3249 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint());
3233 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); 3250 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint());
3234 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); 3251 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint());
3235 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); 3252 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint());
3236 } 3253 }
3237 3254
3238 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3255 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3239 3256
3240 } // namespace dart 3257 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/unicode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698