I'm implementing the Connection Scan Algorithm in Qt C++ and I added some tests to the project using the Qt test framework which is fine. I looked in the docs of the Qt test framework but I can't find a way to benchmark a called asynchronous method and wait for it's signal.
You have QSignalSpy available to test signals but it waits a certain time before it checks if the signal was fired. QBENCHMARK can measure the time to execute a piece of code. I would like to measure the time between the call of the asynchronous method and the signal fired by the thread which the method calls.
QString str1 = "foo";
QString str2 = "foo";
QBENCHMARK {
str1.localeAwareCompare(str2);
}
The code above is fine for synchronous operations but not for asynchronous operations with signals.
Aucun commentaire:
Enregistrer un commentaire