Merge branch 'observer-firmware-dev' into fix/mqtt-review-2026-09-09
This commit is contained in:
commit
800a27fe83
66 files changed
+1874
-179
No files matched your search
@@ -193,6 +193,47 @@ TEST(ConfigSerializer, LoadSerial_IgnoreUnknowns) {
|
||||
EXPECT_TRUE(match);
|
||||
}
|
||||
|
||||
class TestNested : public ConfigSerializer {
|
||||
class Inner : public ConfigSerializer {
|
||||
protected:
|
||||
void structure() override { } // no properties, so it writes as '{}'
|
||||
};
|
||||
Inner inner;
|
||||
protected:
|
||||
void structure() override {
|
||||
def("age", age);
|
||||
def("inner", inner);
|
||||
def("name", name, sizeof(name)); // comes *after* the empty sub-object
|
||||
}
|
||||
public:
|
||||
int32_t age;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
TEST(ConfigSerializer, LoadSerial_EmptyObject) {
|
||||
MockInputStream s("{age:" TEST_INT_S ",inner:{},name:\"Scott\"}");
|
||||
TestNested data;
|
||||
data.name[0] = 0;
|
||||
|
||||
bool success = data.loadSerial(s);
|
||||
EXPECT_TRUE(success);
|
||||
|
||||
EXPECT_EQ(TEST_INT, data.age);
|
||||
bool match = strcmp("Scott", data.name) == 0;
|
||||
EXPECT_TRUE(match); // properties after an empty object must still load
|
||||
}
|
||||
|
||||
TEST(ConfigSerializer, LoadSerial_EmptyObjectWithWhitespace) {
|
||||
MockInputStream s("{age:" TEST_INT_S ",inner:{ },name:\"Scott\"}");
|
||||
TestNested data;
|
||||
data.name[0] = 0;
|
||||
|
||||
bool success = data.loadSerial(s);
|
||||
EXPECT_TRUE(success);
|
||||
bool match = strcmp("Scott", data.name) == 0;
|
||||
EXPECT_TRUE(match);
|
||||
}
|
||||
|
||||
TEST(DynamicConfigSerializer, GetSet_Basic) {
|
||||
DynamicConfigSerializer data;
|
||||
|
||||
|
||||
Reference in new issue
Block a user