| 83 | } |
| 84 | |
| 85 | void 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 | |
| 113 | void TestMICommandQueue::clearQueue() |
| 114 | { |
nothing calls this directly
no test coverage detected