Tests
This commit is contained in:
1 parent
ef8e21db2e
commit
a6016248f8
11 files changed
+529
-252
No files matched your search
+33
-8
@@ -1,14 +1,20 @@
|
||||
# QtTest regression tests
|
||||
|
||||
For instrumented builds, LCOV HTML reports, Qt Creator coverage configuration,
|
||||
and Coco installation, see [Measuring code coverage](../README.md#measuring-code-coverage).
|
||||
For instrumented builds, LCOV HTML reports, and Qt Creator coverage configuration,
|
||||
see [Measuring code coverage](../README.md#measuring-code-coverage).
|
||||
For the complete IDE build/run configuration set, see
|
||||
[Configure all build variants in Qt Creator](../README.md#configure-all-build-variants-in-qt-creator).
|
||||
The Coverage configuration uses `coverage_report.sh` after its instrumented
|
||||
build; the script takes the source and build directories as its two arguments.
|
||||
|
||||
Open the repository's root `dbc.pro` in Qt Creator. It contains `core` (a static
|
||||
C++17 library) and `tests` (the `dbc_tests` QtTest executable). Core is built first;
|
||||
tests link its archive rather than compiling its implementation again.
|
||||
Qt Core and Qt Test development packages are required for tests only.
|
||||
The optional model tests also link QtGui, which is provided by Qt base development
|
||||
packages. The adapter library itself still links only QtCore.
|
||||
|
||||
Build from the repository root with Qt 6 (use `qmake` for Qt 5):
|
||||
Build from the repository root with the installed Qt 6.8.2:
|
||||
|
||||
```sh
|
||||
mkdir build
|
||||
@@ -18,8 +24,8 @@ make -j
|
||||
make check
|
||||
```
|
||||
|
||||
Or run `./tests/dbc_tests` directly. Both parser and decoder suites run, and the
|
||||
executable returns nonzero when either suite fails. Decoder cases appear as
|
||||
Or run `./tests/dbc_tests` directly. Parser, decoder, and additional coverage
|
||||
suites run, and the executable returns nonzero when any suite fails. Decoder cases appear as
|
||||
individual QtTest data rows; parser checks are grouped into named test slots.
|
||||
Checks also run in release builds.
|
||||
|
||||
@@ -34,7 +40,8 @@ make
|
||||
make check
|
||||
```
|
||||
|
||||
`parser_tests.pri` and `decoder_tests.pri` include the test sources.
|
||||
`parser_tests.pri` and `decoder_tests.pri` include the original test sources;
|
||||
`tests.pro` also includes `dbc_coverage_test.cpp`.
|
||||
`../core/core.pri` supplies the library include path and linkage.
|
||||
|
||||
## Decoder coverage
|
||||
@@ -73,14 +80,32 @@ README for its compiler command. It checks parents, sibling positions, null
|
||||
children, bounds, and unique_ptr transfer.
|
||||
|
||||
Enable `CONFIG+=dbc_qt` in the root qmake invocation to build `dbc_qt` and
|
||||
`dbc_model_tests` alongside existing tests. Qt 5.11+ or Qt 6 is required.
|
||||
`dbc_model_tests` alongside existing tests. Qt 6.8.2 is required.
|
||||
`make check` runs all suites. Model tests parse a temporary DBC fixture and use
|
||||
QAbstractItemModelTester, verify navigation across columns, invalid/foreign
|
||||
indexes, metadata and exact VAL_ integers, and persistent-index invalidation
|
||||
when reloading or clearing the tree. No GUI/display server is needed.
|
||||
when reloading or clearing the tree. Their QGuiApplication registers graphical
|
||||
metatypes used by QAbstractItemModelTester, avoiding the invalid QPixmap type
|
||||
warning in Qt 6.8.2. The test executable defaults to `QT_QPA_PLATFORM=offscreen`
|
||||
when the variable is unset or empty, so no display server is needed. An explicit
|
||||
platform setting is preserved.
|
||||
|
||||
Basic multiplexing coverage includes selector declarations after branches,
|
||||
Intel/Motorola branch overlap, signed active values and VAL_ lookup, unconditional
|
||||
signals, inactive branches, missing selector/branch payloads, exact UINT64_MAX
|
||||
selector matching, malformed runtime selectors, source locations, and rejection
|
||||
of invalid markers, selector references/ranges, overlaps, and SG_MUL_VAL_.
|
||||
|
||||
## Additional regression coverage
|
||||
|
||||
`dbc_coverage_test.cpp` runs as part of `dbc_tests`. It covers signed boundaries
|
||||
below 64 bits, deterministic extraction comparisons for both byte orders across
|
||||
lengths 1–64, frame lookup failures, exact decode statuses, malformed runtime
|
||||
multiplexing, PGN boundaries, comment handling, file formatting, metadata copying
|
||||
and source lifetime, physical conversion, and TypeFactory registration/creation.
|
||||
Direct resolver tests construct ambiguous databases through the public metadata
|
||||
API, verify source locations, and check that ambiguous targets receive no values.
|
||||
|
||||
All QtTest targets use Qt 6.8.2 and `QVERIFY_THROWS_EXCEPTION`. Exception tests
|
||||
explicitly discard `nodiscard` results when only the exception is being checked.
|
||||
The standalone tree test requires only a C++17 compiler.
|
||||
Reference in new issue
Block a user