test: add automated mesh protocol coverage - #46
Open
Sayandevxyz wants to merge 1 commit into
Open
Sayandevxyz wants to merge 1 commit into
Sayandevxyz wants to merge 1 commit into
Conversation
Add a zero-dependency C++17 test suite (tests/test_main.cpp) with 25 deterministic unit tests covering all core protocol components: - Packet serialization/deserialization roundtrip for all PacketTypes - Boundary conditions: empty payload, max payload (64 bytes), oversized rejection - CRC16 integrity: deterministic output, single-bit corruption detection - Routing engine: beacon insertion, RSSI/hop metric comparison, stale route pruning with 32-bit timer wraparound handling, clear_table - Swarm orchestrator: priority ordering, deduplication, incoming payload processing, orchestration cycle garbage collection, clear_tasks - Security engine: key lifecycle, symmetric encrypt/decrypt roundtrip, nonce variation - Mesh node: sequence deduplication sliding window, peer tracking, dead peer cleanup Also: - Implement missing RoutingEngine::clear_table() definition - Implement missing SwarmOrchestrator::clear_tasks() definition - Update CMakeLists.txt to build mesh_protocol_tests target separately from mesh_node_sim (core sources extracted to CORE_SOURCES list) - Enable CTest integration via enable_testing() and add_test() - Update .github/workflows/build.yml to run mesh_protocol_tests and ctest --output-on-failure in CI Tests run without physical hardware, internet access, or proprietary tools. All 25 tests pass on desktop (MinGW GCC 6.3, C++17).
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
Adds a comprehensive, hardware-free C++17 test suite (25 deterministic unit tests) covering all core protocol components of the Decentralized Mesh Protocol.
What Was Added
Why It Is Useful
The project had no automated regression tests. Any future change to packet serialization, routing logic, security, or task orchestration could silently break behavior with no detection. This PR ensures all core protocol contracts are verified on every commit.
Tests Covered
Validation
`�ash
Configure
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
Build both targets
cmake --build build
Run test suite directly
./build/mesh_protocol_tests
Or via CTest
ctest --test-dir build --output-on-failure
`
Result: 25/25 tests pass. Exit code 0.
Compatibility