Add native unit tests for the Nano firmware

- New native environment: pio test -e native
- test/mocks: fake Arduino core, EEPROM and recording BROSE9323 driver
- test/test_nano: 25 tests covering every command, bitmaps, bad input,
  flip time storage and the periodic full redraw
- Board environments ignore tests so they are never uploaded

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-13 00:24:13 +02:00
1 parent 80f3f78152
commit 8415dee347
8 files changed
+505 -4

No files matched your search

+18
View File
@@ -3,11 +3,13 @@
; nano Arduino Nano that drives the Brose flipdot panels directly
; esp32 ESP32 "brain" (WiFi, NTP clock, Home Assistant) - OTA upload
; esp32_usb Same ESP32 firmware, flashed over USB (first flash / recovery)
; native Unit tests for the Nano firmware, run on the PC (needs gcc on PATH)
;
; Build all: pio run
; Build one: pio run -e nano
; Upload one: pio run -e nano -t upload
; Serial monitor: pio device monitor -e nano
; Run tests: pio test -e native
;
; https://docs.platformio.org/page/projectconf.html
@@ -19,6 +21,8 @@ framework = arduino
monitor_speed = 115200
lib_deps =
adafruit/Adafruit GFX Library@^1.10.12
; Tests only run in the native environment, never on the boards
test_ignore = *
; ---------------------------------------------------------------------------
; Arduino Nano - display driver
@@ -57,3 +61,17 @@ monitor_port = COM11
extends = env:esp32
upload_protocol = esptool
upload_port = COM11
; ---------------------------------------------------------------------------
; Native - unit tests for the Nano firmware on the PC (test/test_nano)
; The Arduino core, EEPROM and the display driver are replaced by test/mocks.
; ---------------------------------------------------------------------------
[env:native]
platform = native
framework =
lib_deps =
lib_ignore = BROSE9323
test_ignore =
test_build_src = yes
build_src_filter = +<nano/>
build_flags = -std=gnu++17 -I test/mocks