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

Unified Diff: runtime/vm/object_test.cc

Issue 442483002: Avoid redundant allocation of accessor names. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
===================================================================
--- runtime/vm/object_test.cc (revision 38859)
+++ runtime/vm/object_test.cc (working copy)
@@ -1336,6 +1336,22 @@
}
+TEST_CASE(StringHashConcat) {
+ EXPECT_EQ(String::Handle(String::New("onebyte")).Hash(),
+ String::HashConcat(String::Handle(String::New("one")),
+ String::Handle(String::New("byte"))));
+ uint16_t clef_utf16[] = { 0xD834, 0xDD1E };
+ const String& clef = String::Handle(String::FromUTF16(clef_utf16, 2));
+ int32_t clef_utf32[] = { 0x1D11E };
+ EXPECT(clef.Equals(clef_utf32, 1));
+ intptr_t hash32 = String::Hash(clef_utf32, 1);
+ EXPECT_EQ(hash32, clef.Hash());
+ EXPECT_EQ(hash32, String::HashConcat(
+ String::Handle(String::FromUTF16(clef_utf16, 1)),
+ String::Handle(String::FromUTF16(clef_utf16 + 1, 1))));
+}
+
+
TEST_CASE(StringSubStringDifferentWidth) {
// Create 1-byte substring from a 1-byte source string.
const char* onechars =
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698