MCPcopy Create free account
hub / github.com/KDE/kdevelop / test

Method test

kdevplatform/serialization/tests/test_indexedstring.cpp:48–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void TestIndexedString::test()
49{
50 QFETCH(QString, data);
51
52 IndexedString indexed(data);
53 QCOMPARE(indexed.str(), data);
54 QCOMPARE(indexed.index(), IndexedString::indexForString(data));
55 const auto byteArrayData = data.toUtf8();
56 QEXPECT_FAIL("char-utf8", "UTF-8 gets decoded and the char data is stored internally", Continue);
57 QEXPECT_FAIL("string-utf8", "UTF-8 gets decoded and the char data is stored internally", Continue);
58 QCOMPARE(indexed.length(), data.length());
59 // fallback until we rely on internal utf8 encoding
60 QCOMPARE(indexed.length(), byteArrayData.length());
61
62 QCOMPARE(indexed.byteArray(), byteArrayData);
63 QVERIFY(!strncmp(indexed.c_str(), byteArrayData.data(), byteArrayData.length()));
64 QCOMPARE(indexed.index(), IndexedString::indexForString(byteArrayData.data(), byteArrayData.length()));
65
66 IndexedString moved = std::move(indexed);
67 QCOMPARE(moved.str(), data);
68}
69
70void TestIndexedString::test_data()
71{

Callers

nothing calls this directly

Calls 6

strMethod · 0.80
byteArrayMethod · 0.80
indexMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected