Add native host unit tests for Packet and StrHelper#1837
Open
andrewdefilippis wants to merge 1 commit intomeshcore-dev:devfrom
Open
Add native host unit tests for Packet and StrHelper#1837andrewdefilippis wants to merge 1 commit intomeshcore-dev:devfrom
andrewdefilippis wants to merge 1 commit intomeshcore-dev:devfrom
Conversation
Enable PlatformIO native-platform testing with GoogleTest to allow host-based verification of core logic without hardware. This is a minimal proof-of-concept covering two pure-C++ modules (Packet and TxtDataHelpers/StrHelper) with 41 tests and zero changes to existing source code. Key additions: - [env:native] section in platformio.ini for `pio test -e native` - Arduino.h compatibility shim (millis, micros, ltoa) for native builds - 16 tests for Packet (serialization round-trips, header fields, hash computation, bad-input rejection, SNR conversion) - 25 tests for StrHelper (strncpy, strzcpy, isBlank, fromHex, ftoa, ftoa3 including a documented sign-loss bug for values in (-1, 0)) Note: ftoa3() drops the negative sign for floats in the range (-1.0, 0.0) due to integer division truncation. The test documents this as a known bug with root-cause analysis. Current impact is low (sole call site uses positive values) but the function is a general-purpose utility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
andrewdefilippis
added a commit
to andrewdefilippis/MeshCore
that referenced
this pull request
Feb 25, 2026
Research doc covers framework comparisons (GoogleTest, Unity, Catch2, CppUTest, doctest) and mocking strategies for MeshCore's abstract interfaces. Plan doc details the implemented proof-of-concept PR meshcore-dev#1837 including implementation corrections discovered during development. Co-Authored-By: Claude Opus 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.
Adds tests; raises bug in
StrHelper::ftoa3().