Commit Graph

1 Commits

Author SHA1 Message Date
David Montero Crespo 558525b4b2 test: add firmware loader tests with real compiled binaries
Tests for firmwareLoader.ts utility covering:

Unit tests (44 tests):
- Format detection (.hex, .bin, .elf by magic bytes and extension)
- ELF architecture detection (AVR, ARM, RISC-V, Xtensa, big/little endian)
- binaryToIntelHex round-trip through hexParser
- ELF PT_LOAD segment extraction with synthetic and real ELF files
- readFirmwareFile for all formats and board types

Integration tests with arduino-cli compiled firmware:
- AVR: .hex and .elf loaded into AVRSimulator, start/stop verified
- RP2040: .bin and .elf loaded, base64 encoding verified
- ESP32-C3: existing fixture .bin and .elf, RISC-V detection verified

Cross-format compatibility:
- .hex → AVR, .bin → RP2040, architecture mismatch warnings
- File size limit enforcement (16MB max)

All 663 tests pass (25 test files).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 13:01:34 -03:00