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

Method addAndTake

plugins/debuggercommon/tests/test_micommandqueue.cpp:85–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85void TestMICommandQueue::addAndTake()
86{
87 QFETCH(KDevMI::MI::CommandFlags, flags);
88 QFETCH(bool, isImmediate);
89
90 KDevMI::MI::CommandQueue commandQueue;
91
92 auto command = std::make_unique<TestDummyCommand>(KDevMI::MI::NonMI, QString(), flags);
93 auto c = command.get();
94
95 // add
96 commandQueue.enqueue(std::move(command));
97 // check
98 QVERIFY(c->token() != 0);
99 QCOMPARE(commandQueue.count(), 1);
100 QCOMPARE(commandQueue.isEmpty(), false);
101 QCOMPARE(commandQueue.haveImmediateCommand(), isImmediate);
102
103 // take
104 auto nextCommand = commandQueue.nextCommand();
105 // check
106 QCOMPARE(nextCommand.get(), c);
107 QVERIFY(nextCommand->token() != 0);
108 QCOMPARE(commandQueue.count(), 0);
109 QCOMPARE(commandQueue.isEmpty(), true);
110 QCOMPARE(commandQueue.haveImmediateCommand(), false);
111}
112
113void TestMICommandQueue::clearQueue()
114{

Callers

nothing calls this directly

Calls 8

enqueueMethod · 0.80
haveImmediateCommandMethod · 0.80
nextCommandMethod · 0.80
QStringClass · 0.50
getMethod · 0.45
tokenMethod · 0.45
countMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected