TEST(StringReference, ValueComparator) { // This is a regression test for the StringReferenceValueComparator using the wrong // dex file to get the string data from a StringId. We construct two dex files with // just a single string with the same length but different value. This creates dex // files that have the same layout, so the byte offset read from the StringId in one // dex file, when used in the other dex file still points to valid string data, except // that it's the wrong string. Without the fix the strings would then compare equal.
TestDexFileBuilder builder1;
builder1.AddString("String1");
std::unique_ptr<const DexFile> dex_file1 = builder1.Build("fake location 1");
ASSERT_EQ(1u, dex_file1->NumStringIds());
ASSERT_STREQ("String1", dex_file1->GetStringData(dex_file1->GetStringId(dex::StringIndex(0))));
StringReference sr1(dex_file1.get(), dex::StringIndex(0));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.