Create templates for primitive types.
In preparation to move static fields into their own array
members off of class.
Change-Id: Ic524e12952af985d8ae16a05b5f4e50676a9c136
diff --git a/src/object_test.cc b/src/object_test.cc
index 2d32ad0..e5bdd35 100644
--- a/src/object_test.cc
+++ b/src/object_test.cc
@@ -30,11 +30,11 @@
String* string = String::AllocFromModifiedUtf8(length, utf8_in);
ASSERT_EQ(length, string->GetLength());
ASSERT_TRUE(string->GetCharArray() != NULL);
- ASSERT_TRUE(string->GetCharArray()->GetChars() != NULL);
+ ASSERT_TRUE(string->GetCharArray()->GetData() != NULL);
// strlen is necessary because the 1-character string "\0" is interpreted as ""
ASSERT_TRUE(string->Equals(utf8_in) || length != static_cast<int32_t>(strlen(utf8_in)));
for (int32_t i = 0; i < length; i++) {
- EXPECT_EQ(utf16_expected[i], string->GetCharArray()->GetChar(i));
+ EXPECT_EQ(utf16_expected[i], string->CharAt(i));
}
EXPECT_EQ(hash_expected, string->GetHashCode());
}
@@ -162,4 +162,11 @@
EXPECT_TRUE(m4_2->HasSameNameAndDescriptor(m4_1));
}
+
+TEST_F(ObjectTest, StringHashCode) {
+ EXPECT_EQ(0, String::AllocFromAscii("")->GetHashCode());
+ EXPECT_EQ(65, String::AllocFromAscii("A")->GetHashCode());
+ EXPECT_EQ(64578, String::AllocFromAscii("ABC")->GetHashCode());
+}
+
} // namespace art