Add unit test framework and test stubs

- Add test/test_kiss.cpp: Unit tests for KISS protocol encoder/decoder
  Tests: frame decoding with/without escape sequences, port extraction,
  round-trip encoding/decoding, signal quality encoding, buffer overflow handling
- Add test/test_commands.cpp: Unit tests for config command parsing
  Tests: big-endian encoding/decoding, frequency frame parsing, type byte decoding
- Configure PlatformIO native test environment with GoogleTest framework
- Tests currently build but require linking stubs for full integration

Note: Full end-to-end testing requires mocking Serial I/O and radio functions,
which would be handled by integration tests on actual hardware or with a
more sophisticated test harness (e.g., CMake + GoogleTest).
This commit is contained in:
Maze X
2026-03-27 17:40:49 +01:00
parent 138f897090
commit cb14666710
3 changed files with 217 additions and 0 deletions

View File

@@ -58,3 +58,14 @@ build_flags =
-DLORA_SYNCWORD=0x12
; KISS serial baud rate
-DKISS_BAUD=115200
; ------------------------------------------------------------------
; Native test environment — run unit tests on host
; ------------------------------------------------------------------
[env:test]
platform = native
test_framework = googletest
test_build_src = yes
build_flags =
-std=c99
build_src_filter = +<*> -<main.cpp> -<radio.cpp>