Files
dbc/tests

Decoder regression tests

Run from the repository root with a C++17 compiler:

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

Alternatively, build the standalone qmake project out of source:

mkdir -p /tmp/dbc_decoder_test_build
cd /tmp/dbc_decoder_test_build
qmake /absolute/path/to/dbc/tests/dbc_decoder_test.pro
make
./dbc_decoder_test

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.

Coverage includes Motorola bit numbering within and across bytes, unaligned signals, signed values, scaling, 64-bit extraction, signed/unsigned boundary values (including INT64_MIN, INT64_MAX, and UINT64_MAX), numeric output, invalid lengths, insufficient 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:

g++ -std=c++17 -Wall -Wextra -Wpedantic -Werror -I. \
  tests/dbc_parser_test.cpp dbc_parser.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 tests cover standard and extended CAN IDs, whitespace, payload storage boundaries, missing fields, malformed and overflowing numbers, reserved ID bits, error paths and line numbers, and integration with signals and comments. Temporary DBC fixtures are created in the system temporary directory and removed automatically.