Test Module
The Test
module contains coroutine-friendly versions of tests macros
from the QtTest module.
CMake Usage
find_package(QCoro6 COMPONENTS Test)
...
target_link_libraries(my-target QCoro::Test)
QMake Usage
QT += QCoroTest
Test Macros
The module contains a bunch of test macros that behave identically to their QtTest counterparts, the only difference being that they can be used inside a coroutine.
#include <QCoroTest>
QCORO_COMPARE(actual, expected)
QCORO_EXPECT_FAIL(dataIndex, comment, mode)
QCORO_FAIL(message)
QCORO_SKIP(description)
QCORO_TEST(data, testElement)
QCORO_TRY_COMPARE(actual, expected)
QCORO_TRY_COMPARE_WITH_TIMEOUT(actual, expected, timeout)
QCORO_TRY_VERIFY2(condition, message)
QCORO_TRY_VERIFY(condition)
QCORO_TRY_VERIFY2_WITH_TIMEOUT(condition, message, timeout)
QCORO_TRY_VERIFY_WITH_TIMEOUT(condition, timeout)
QCORO_VERIFY2(condition, message)
QCORO_VERIFY(condition)
QCORO_VERIFY_EXCEPTION_THROWN(expression, exceptionType)
QCORO_VERIFY_THROWS_EXCEPTION(exceptionType, ...)