Add comprehensive unit testing infrastructure#85
Add comprehensive unit testing infrastructure#85samjhill wants to merge 2 commits intoBenjaminPoilve:mainfrom
Conversation
|
@BenjaminPoilve I am not able to add you as a reviewer. Let me know if you have any questions or suggestions |
c14f5e5 to
17ff0c7
Compare
Implements unit testing framework for firmware with 15 passing tests covering core musical logic and parameter handling. Testing Infrastructure: - PlatformIO native test environment configuration - Unity test framework integration - GitHub Actions CI workflow for automated testing - Comprehensive testing documentation New Files: - .github/workflows/firmware-tests.yml - CI automation - TESTING_SUMMARY.md - Executive summary - firmware/TESTING.md - Comprehensive testing guide (300+ lines) - firmware/include/chord_logic.h - Testable chord calculation interface - firmware/src/chord_logic.cpp - Pure function implementations - firmware/test/test_chord_logic/test_chord_logic.cpp - 10 chord tests - firmware/test/test_serialization/test_serialization.cpp - 5 serialization tests Test Coverage: - Chord note calculations (major, minor, 7th, augmented, diminished) - Sharp/flat modifiers - Slash chord functionality - Harp chromatic and chord modes - Different root notes (circle of fifths) - CSV serialization/deserialization - Edge cases and boundary conditions Modified Files: - firmware/README.md - Added testing section with quick start guide - firmware/platformio.ini - Added [env:native] for testing - firmware/src/main.cpp - Fixed typos (SOFWTARE→SOFTWARE, adress→address) Benefits: - Tests run without hardware (native platform) - Faster development cycle - Catch regressions early via CI - Lower barrier for contributors - Self-documenting code behavior All 15 tests pass on native platform.
17ff0c7 to
dd9d253
Compare
|
Thanks a lot for this important contribution! I'll need a bit of time to review this thoroughly as there are quite a lot of modifications. Did you design the test with the original code, have them pass, then do the refactoring? |
|
@BenjaminPoilve Initially, I wrote tests against a simplified version, not the original code. I've now fixed this. The extracted functions now match your original behavior exactly. All 15 tests pass and produce identical results to the original firmware. |
ecaf784 to
5ca789e
Compare
- Added complete get_root_button implementation with key signatures and frame shifts - Added original calculate_note_chord and calculate_note_harp functions - Updated wrapper functions to use original behavior with default parameters - Fixed header file to avoid duplicate definitions - All tests now pass with original firmware behavior
5ca789e to
5bb9540
Compare
|
Thanks a lot! I'll have to dedicate a timeslot for a thorough review. But in any case thanks for bringing in good practices to this project :) |
|
@samjhill This is incredible, thank you for taking the time to put this together -- I'll be sure to integrate this practice into my pull requests, this is exactly the kind of testing I need to keep from chasing my tail :D |
|
@terminalwaltz @BenjaminPoilve glad you guys like this! happy to walk you through anything as you get into the review. I have some further enhancements in mind once we get this solid foundation laid |
|
I want to apologize for the delay: I'm in the middle of preparing my trip the Shenzhen markefaire, and in the middle of moving/home renovation which leaves me less time for testing. I'll get to it as soon as I get the time! |
|
no rush at all. It will be here when you get more time. 🤗 |
|
Hi there, I apologise in advance if my questions are basic, but I'm really not familiar with testing in platformIO.
Sorry again if it shows misunderstanding of the underlying testing tools ! |
|
Let me know @samjhill if/when you have time to clarify those last points :) |
Tests cover:
All tests pass on native platform without hardware dependencies.