Add GoogleTest harness with 22 unit tests#4
Open
billmallard wants to merge 4 commits into
Open
Conversation
…ose, and MAOS ecosystem role
Tests cover CFParameter FCB bit-field pack/unpack, checkParameterEnable EEPROM bitmask logic, sendParam CAN frame encoding, handleFrame ID-range routing, and getNodeNumber EEPROM fallback. Build system uses CMake 3.12 with FetchContent for GoogleTest; build/ directory is gitignored. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/CMakeLists.txt— CMake 3.12-compatible build (works with VS2017 bundled CMake); pulls GoogleTest 1.12.1 via FetchContenttests/mocks/can.handtests/mocks/EEPROM.h— lightweight Arduino mock headers enabling native compilation outside the Arduino environmenttests/mock_impl.cpp— global mock object instancestests/test_canfix.cpp— 22 tests across 5 suites:CFParameterTest(7): FCB nibble pack/unpack for metadata and flagsCheckParamEnableTest(5): EEPROM bitmask enable/disable logicSendParamTest(5): CAN frame ID, node number, index, FCB, and payload encodingHandleFrameTest(3): ID-range routing to parameter and alarm callbacksCanFixTest(2):getNodeNumber()EEPROM fallback behavior.gitignoreto exclude thetests/build/CMake output directoryTest plan
mkdir tests/build && cd tests/buildcmake ..(requires CMake 3.12+ and a C++14 compiler; GoogleTest fetched automatically)cmake --build . --config Debug./Debug/canfix_tests(Windows) or./canfix_tests(Linux/Mac) — all 22 tests should pass🤖 Generated with Claude Code