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

Method doTestResult

plugins/debuggercommon/tests/test_miparser.cpp:126–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124
125
126void TestMIParser::doTestResult(const KDevMI::MI::Value& actualValue, const QVariant& expectedValue)
127{
128 if (expectedValue.typeId() == qMetaTypeId<QString>()) {
129 QCOMPARE((int)actualValue.kind, (int)KDevMI::MI::Value::StringLiteral);
130 QCOMPARE(actualValue.literal(), expectedValue.toString());
131 } else if (expectedValue.typeId() == qMetaTypeId<QVariantList>()) {
132 QCOMPARE(actualValue.kind, KDevMI::MI::Value::List);
133
134 const auto expectedList = expectedValue.toList();
135 QCOMPARE(actualValue.size(), expectedList.size());
136 for (int i = 0; i < expectedList.size(); ++i) {
137 doTestResult(actualValue[i], expectedList[i]);
138 }
139 } else if (expectedValue.typeId() == qMetaTypeId<QVariantMap>()) {
140 QCOMPARE(actualValue.kind, KDevMI::MI::Value::Tuple);
141
142 const auto expectedMap = expectedValue.toMap();
143
144 for (auto it = expectedMap.begin(), end = expectedMap.end(); it != end; ++it) {
145 const auto& expectedMapField = it.key();
146 QVERIFY(actualValue.hasField(expectedMapField));
147 const auto& expectedMapValue = it.value();
148 doTestResult(actualValue[expectedMapField], expectedMapValue);
149 }
150 } else {
151 QFAIL("Using unexpected QVariant type");
152 }
153}
154
155
156void TestMIParser::testParseLine()

Callers

nothing calls this directly

Calls 10

literalMethod · 0.80
hasFieldMethod · 0.80
typeIdMethod · 0.45
toStringMethod · 0.45
toListMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
keyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected