1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
<!--
SPDX-FileCopyrightText: 2023 Daniel Vrátil <dvratil@kde.org>
SPDX-License-Identifier: GFDL-1.3-or-later
-->
# Test Module
The `Test` module contains coroutine-friendly versions of tests macros
from the [QtTest][qdoc-qtest] module.
## CMake Usage
```cmake
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.
```cpp
#include <QCoroTest>
```
* [`QCORO_COMPARE(actual, expected)`][qdoc-qcompare]
* [`QCORO_EXPECT_FAIL(dataIndex, comment, mode)`][qdoc-qexpect-fail]
* [`QCORO_FAIL(message)`][qdoc-qfail]
* [`QCORO_SKIP(description)`][qdoc-qskip]
* [`QCORO_TEST(data, testElement)`][qdoc-qtest]
* [`QCORO_TRY_COMPARE(actual, expected)`][qdoc-qtry-compare]
* [`QCORO_TRY_COMPARE_WITH_TIMEOUT(actual, expected, timeout)`][qdoc-qtry-compare-with-timeout]
* [`QCORO_TRY_VERIFY2(condition, message)`][qdoc-qtry-verify2]
* [`QCORO_TRY_VERIFY(condition)`][qdoc-qtry-verify]
* [`QCORO_TRY_VERIFY2_WITH_TIMEOUT(condition, message, timeout)`][qdoc-qtry-verify2-with-timeout]
* [`QCORO_TRY_VERIFY_WITH_TIMEOUT(condition, timeout)`][qdoc-qtry-verify-with-timeout]
* [`QCORO_VERIFY2(condition, message)`][qdoc-qverify2]
* [`QCORO_VERIFY(condition)`][qdoc-qverify]
* [`QCORO_VERIFY_EXCEPTION_THROWN(expression, exceptionType)`][qdoc-qverify-exception-thrown]
* [`QCORO_VERIFY_THROWS_EXCEPTION(exceptionType, ...)`][qdoc6-qverify-throws-exception]
[qdoc-qtest]: https://doc.qt.io/qt-5/qttest-index.html
[qdoc-qcompare]: https://doc.qt.io/qt-5/qtest.html#QCOMPARE
[qdoc-qexpect-fail]: https://doc.qt.io/qt-5/qtest.html#QEXPECT_FAIL
[qdoc-qfail]: https://doc.qt.io/qt-5/qtest.html#QFAIL
[qdoc-qskip]: https://doc.qt.io/qt-5/qtest.html#QSKIP
[qdoc-qtest]: https://doc.qt.io/qt-5/qtest.html#QTEST
[qdoc-qtry-compare]: https://doc.qt.io/qt-5/qtest.html#QTRY_COMPARE
[qdoc-qtry-compare-with-timeout]: https://doc.qt.io/qt-5/qtest.html#QTRY_COMPARE_WITH_TIMEOUT
[qdoc-qtry-verify2]: https://doc.qt.io/qt-5/qtest.html#QTRY_VERIFY2
[qdoc-qtry-verify]: https://doc.qt.io/qt-5/qtest.html#QTRY_VERIFY
[qdoc-qtry-verify2-with-timeout]: https://doc.qt.io/qt-5/qtest.html#QTRY_VERIFY2_WITH_TIMEOUT
[qdoc-qtry-verify-with-timeout]: https://doc.qt.io/qt-5/qtest.html#QTRY_VERIFY_WITH_TIMEOUT
[qdoc-qverify2]: https://doc.qt.io/qt-5/qtest.html#QVERIFY2
[qdoc-qverify]: https://doc.qt.io/qt-5/qtest.html#QVERIFY
[qdoc-qverify-exception-thrown]: https://doc.qt.io/qt-5/qtest.html#QVERIFY_EXCEPTION_THROWN
[qdoc6-qverify-throws-exception]: https://doc.qt.io/qt-6/qtest.html#QVERIFY_THROWS_EXCEPTION
|