This commit is contained in:
deeaitch committed 2026-10-05 21:41:19 -04:00
1 parent 0067cb4ddd
commit f17ddb6aad
104 files changed
+1928 -889

No files matched your search

+28 -24
View File
@@ -1,25 +1,40 @@
# Decoder regression tests
# QtTest regression tests
Run from the repository root with a C++17 compiler:
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.
Build from the repository root with Qt 6 (use `qmake` for Qt 5):
```sh
g++ -std=c++17 -Wall -Wextra -Wpedantic -I. \
tests/dbc_decoder_test.cpp dbc_decoder.cpp -o /tmp/dbc_decoder_test
/tmp/dbc_decoder_test
mkdir build
cd build
qmake6 ../dbc.pro
make -j
make check
```
Alternatively, build the standalone qmake project out of source:
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
individual QtTest data rows; parser checks are grouped into named test slots.
Checks also run in release builds.
To build tests separately against an existing core build:
```sh
mkdir -p /tmp/dbc_decoder_test_build
cd /tmp/dbc_decoder_test_build
qmake /absolute/path/to/dbc/tests/dbc_decoder_test.pro
mkdir /tmp/dbc-tests-build
cd /tmp/dbc-tests-build
qmake6 /absolute/path/to/dbc/tests/tests.pro \
DBC_CORE_BUILD_DIR=/absolute/path/to/build/core
make
./dbc_decoder_test
make check
```
The executable returns a nonzero exit code if any case fails. Checks remain
active in release builds and do not depend on `assert` or an external test framework.
`parser_tests.pri` and `decoder_tests.pri` include the test sources.
`../core/core.pri` supplies the library include path and linkage.
## Decoder coverage
Coverage includes Motorola bit numbering within and across bytes, unaligned
signals, signed values, scaling, 64-bit extraction, signed/unsigned boundary values
@@ -27,18 +42,7 @@ signals, signed values, scaling, 64-bit extraction, signed/unsigned boundary val
payloads, and Intel regression cases. Frame validity means the definition was
found; insufficient payloads are checked through signal validity.
## Parser regression tests
Run from the repository root:
```sh
g++ -std=c++17 -Wall -Wextra -Wpedantic -Werror -I. \
tests/dbc_parser_test.cpp dbc_parser.cpp dbc_statement_handler.cpp -o /tmp/dbc_parser_test
/tmp/dbc_parser_test
```
For qmake, use `tests/dbc_parser_test.pro` in a separate build directory,
following the decoder instructions above, then run `./dbc_parser_test`.
## Parser coverage
Parser tests cover standard and extended CAN IDs, whitespace, payload storage
boundaries, missing fields, malformed and overflowing numbers, reserved ID bits,