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

Method testIdentifier

kdevplatform/language/duchain/tests/test_identifier.cpp:33–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void TestIdentifier::testIdentifier()
34{
35 QFETCH(QString, stringId);
36 const IndexedString indexedStringId(stringId);
37
38 Identifier id(stringId);
39 QCOMPARE(id.isEmpty(), stringId.isEmpty());
40 QCOMPARE(id, Identifier(stringId));
41 QVERIFY(!(id != Identifier(stringId)));
42 QCOMPARE(id, Identifier(stringId));
43 QCOMPARE(id, Identifier(indexedStringId));
44 QCOMPARE(id.identifier(), indexedStringId);
45 QCOMPARE(id.toString(), stringId);
46 QVERIFY(id.nameEquals(Identifier(stringId)));
47 QVERIFY(!id.isUnique());
48
49 if (stringId.isEmpty()) {
50 QVERIFY(id.inRepository());
51 QVERIFY(Identifier(id).inRepository());
52 QVERIFY(Identifier(indexedStringId).inRepository());
53 }
54
55 Identifier copy = id;
56 QCOMPARE(copy, id);
57 copy = copy;
58 QCOMPARE(copy, id);
59 copy = Identifier();
60 QVERIFY(copy.isEmpty());
61 copy = id;
62 QCOMPARE(copy, id);
63
64 IndexedIdentifier indexedId(id);
65 QVERIFY(indexedId == id);
66 QCOMPARE(indexedId, IndexedIdentifier(id));
67 QCOMPARE(indexedId.isEmpty(), stringId.isEmpty());
68 QCOMPARE(indexedId.identifier(), id);
69 IndexedIdentifier indexedCopy = indexedId;
70 QCOMPARE(indexedCopy, indexedId);
71 indexedCopy = indexedCopy;
72 QCOMPARE(indexedCopy, indexedId);
73 indexedCopy = IndexedIdentifier();
74 QVERIFY(indexedCopy.isEmpty());
75 indexedCopy = indexedId;
76 QCOMPARE(indexedCopy, indexedId);
77
78 Identifier moved = std::move(id);
79 QVERIFY(id.isEmpty());
80 QVERIFY(id.inRepository());
81 QCOMPARE(moved, copy);
82
83 IndexedIdentifier movedIndexed = std::move(indexedId);
84 QCOMPARE(movedIndexed, indexedCopy);
85}
86
87void TestIdentifier::testIdentifier_data()
88{

Callers

nothing calls this directly

Calls 7

nameEqualsMethod · 0.80
isUniqueMethod · 0.80
inRepositoryMethod · 0.80
IdentifierClass · 0.50
isEmptyMethod · 0.45
identifierMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected