mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-11-21 00:02:12 +01:00
Move the board profile tests into the native Unity suite
The board tests ran through tools/test-board-profile.sh with their own stubs, assert() and a script that copied nine method bodies out of Transceiver.cpp, so they were outside pio test -e native and the coverage report. Pure decisions now live in units the native env builds: BoardProfile::usesPin is constexpr, RadioReadiness decides register validity, the receive-state outcome (ready, retry or unavailable, with one try today) and whether a queued job may transmit, and ShadeGpioGuard decides whether a shade's outputs touch a board pad. Transceiver and ShadeGpio call them with identical behaviour. New Unity suites cover the generic and LILYGO profiles (reserved pads, startup order, radio bring-up) and the readiness unit; the old harness, its script, CI step and stubs are deleted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2b3d556729
commit
28af01195a
27 changed files with 595 additions and 517 deletions
47
test/test_boardprofile/test_boardprofile.cpp
Normal file
47
test/test_boardprofile/test_boardprofile.cpp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// A generic board: the profile reserves nothing and does nothing.
|
||||
#include <unity.h>
|
||||
#include "BoardProfile.cpp"
|
||||
#include "ShadeGpioGuard.h"
|
||||
|
||||
void setUp() {
|
||||
stubGpioReset();
|
||||
SPI = StubSPI();
|
||||
}
|
||||
void tearDown() {}
|
||||
|
||||
static void test_there_is_no_integrated_radio() {
|
||||
TEST_ASSERT_FALSE(BoardProfile::integratedRadio);
|
||||
}
|
||||
static void test_no_pad_is_reserved() {
|
||||
for(unsigned pin = 0; pin < 256; pin++) TEST_ASSERT_FALSE(BoardProfile::usesPin((uint8_t)pin));
|
||||
}
|
||||
static void test_begin_leaves_the_hardware_alone() {
|
||||
BoardProfile::begin();
|
||||
TEST_ASSERT_EQUAL_UINT(0, stubGpioLog.size());
|
||||
TEST_ASSERT_FALSE(SPI.active);
|
||||
TEST_ASSERT_EQUAL_UINT(0, SPI.begins);
|
||||
}
|
||||
static void test_any_frequency_is_accepted_without_touching_the_bus() {
|
||||
TEST_ASSERT_TRUE(BoardProfile::prepareRadio(868.0f));
|
||||
TEST_ASSERT_TRUE(BoardProfile::prepareRadio(433.42f));
|
||||
TEST_ASSERT_EQUAL_UINT(0, stubGpioLog.size());
|
||||
TEST_ASSERT_EQUAL_UINT(0, SPI.begins);
|
||||
TEST_ASSERT_EQUAL_UINT(0, SPI.ends);
|
||||
}
|
||||
static void test_shade_outputs_may_use_any_pad() {
|
||||
for(unsigned pin = 0; pin < 256; pin++) {
|
||||
const uint8_t p = (uint8_t)pin;
|
||||
TEST_ASSERT_FALSE(shadeOutputsUseBoardPins(radio_proto::GP_Relay, p, p, p));
|
||||
TEST_ASSERT_FALSE(shadeOutputsUseBoardPins(radio_proto::GP_Remote, p, p, p));
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char **) {
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(test_there_is_no_integrated_radio);
|
||||
RUN_TEST(test_no_pad_is_reserved);
|
||||
RUN_TEST(test_begin_leaves_the_hardware_alone);
|
||||
RUN_TEST(test_any_frequency_is_accepted_without_touching_the_bus);
|
||||
RUN_TEST(test_shade_outputs_may_use_any_pad);
|
||||
return UNITY_END();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue