Scope preference saves to changed settings

This commit is contained in:
mikecarper committed 2026-08-06 15:33:40 -07:00
1 parent 63e7b2ce8e
commit df2dd41512
11 files changed
+1491 -1390

No files matched your search

+1
View File
@@ -36,6 +36,7 @@ does not reflect the GoogleTest count -- run the built binary directly
| `test_mqtt_runtime_buffer_lifecycle` | `src/helpers/MQTTRuntimeBufferLifecycle.h` | idempotent allocation/release; partial-allocation degradation; retry of only missing buffers |
| `test_mqtt_prefs_codec` | `src/helpers/MQTTPrefsStorage.h`, `src/helpers/MQTTPrefsCodec.h` | binary pre-slot/3-slot/6-slot migration fixtures; v1 header integrity; downgrade preservation |
| `test_mqtt_prefs_atomic_store` | `src/helpers/MQTTPrefsAtomicStore.h` | transactional MQTT writes and legacy `/node_prefs` handoff; exact short-write detection; begin/finish/rename failure cleanup; original-file preservation |
| `test_prefs_save_routing` | `src/helpers/PrefsSaveRouting.h` | runtime common/observer setters write only their owning preference image; mixed-owner setters and migrations can deliberately write both |
| `test_mqtt_payload_builder` | `src/helpers/MQTTPayloadBuilder.cpp` | status/packet/raw JSON contracts; optional fields; escaping; RX metrics and path; score handling; exact buffer bounds; maximum representative payloads |
| `test_telemetry_history` | `src/helpers/TelemetryHistory.h` | 30-minute rings; seven-day temperature/voltage and dynamically sized GPS retention; exact 1 C temperature/status encoding; separate Base64 series payloads; 14-bit GPS differentials; resize preservation, heap budgets, and 1-based paging bounds |
| `test_flood_filter_policy` | `src/helpers/FloodFilterPolicy.h` | unordered 3-byte and 2-byte-prefix path matching; match thresholds; repeated path-entry semantics; blacklist and bridge-bucket channel-scope selection; `require=region` and per-channel scope-gate truth tables; fast/slow scope timing; adding, replacing, and preserving packet scope |
@@ -0,0 +1,31 @@
#include <gtest/gtest.h>
#include "helpers/PrefsSaveRouting.h"
namespace Routing = PrefsSaveRouting;
TEST(PrefsSaveRouting, CommonSetterWritesOnlyCommonImage) {
constexpr Routing::Plan plan = Routing::planFor(Routing::Scope::Common);
EXPECT_TRUE(plan.common);
EXPECT_FALSE(plan.observer);
}
TEST(PrefsSaveRouting, ObserverSetterWritesOnlyObserverImage) {
constexpr Routing::Plan plan = Routing::planFor(Routing::Scope::Observer);
EXPECT_FALSE(plan.common);
EXPECT_TRUE(plan.observer);
}
TEST(PrefsSaveRouting, CrossImageOperationCanWriteBothImages) {
constexpr Routing::Plan plan = Routing::planFor(Routing::Scope::Both);
EXPECT_TRUE(plan.common);
EXPECT_TRUE(plan.observer);
}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}