[remote_base] Cover transmit action names in the protocol source test and assert the rc_switch table layout

This commit is contained in:
J. Nick Koston
2026-09-11 08:26:26 -05:00
parent 087418c09a
commit 798400908e
2 changed files with 10 additions and 1 deletions
@@ -68,7 +68,9 @@ class RCSwitchBase {
uint32_t inverted_{}; // bool widened so every field is a word: the table is read from flash
};
// Constant-initialized and kept in flash on every platform
// Constant-initialized and kept in flash on every platform; ESP8266 reads it in place, which only
// works while every field is a whole word
static_assert(sizeof(RCSwitchBase) == 7 * sizeof(uint32_t), "RCSwitchBase must stay word-only for flash reads");
inline constexpr RCSwitchBase RC_SWITCH_PROTOCOLS[] PROGMEM = {
{0, 0, 0, 0, 0, 0, false},
{350, 10850, 350, 1050, 1050, 350, false},
@@ -5,6 +5,7 @@ from pathlib import Path
import pytest
from esphome.automation import ACTION_REGISTRY
from esphome.components import remote_base
import esphome.config_validation as cv
@@ -59,7 +60,13 @@ def test_every_registry_name_maps_to_a_protocol_source() -> None:
set(remote_base.BINARY_SENSOR_REGISTRY)
| set(remote_base.DUMPER_REGISTRY)
| {key.removeprefix("on_") for key in remote_base.TRIGGER_REGISTRY}
| {
key.removeprefix("remote_transmitter.transmit_")
for key in ACTION_REGISTRY
if key.startswith("remote_transmitter.transmit_")
}
)
assert len(names) > 40
for name in names:
assert remote_base._protocol_stem(name) in remote_base._PROTOCOL_STEMS, name