Skip to content

Commit

Permalink
fixup! tests/unittests: add registry_storage tests
Browse files Browse the repository at this point in the history
Fix new registry_node_t format
  • Loading branch information
LasseRosenow committed Apr 12, 2024
1 parent 06adb07 commit 0d91422
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions tests/unittests/tests-registry_storage/tests-registry_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ static int load(const registry_storage_instance_t *storage,
if (storage == &storage_test_instance) {
registry_node_t node = {
.type = REGISTRY_NODE_PARAMETER,
.location.parameter = &registry_tests_nested_parameter,
.instance = &test_nested_instance,
.value.parameter = {
.instance = &test_nested_instance,
.parameter = &registry_tests_nested_parameter,
},
};
uint8_t buf = _TESTS_REGISTRY_LOAD_STORED_VALUE;
return load_cb(&node, &buf, sizeof(buf));
Expand All @@ -91,8 +93,8 @@ static int save(const registry_storage_instance_t *storage,
const registry_value_t *value)
{
if (storage == &storage_test_instance &&
node->instance == &test_nested_instance &&
node->location.parameter == &registry_tests_nested_group_parameter &&
node->value.parameter.instance == &test_nested_instance &&
node->value.parameter.parameter == &registry_tests_nested_group_parameter &&
value->buf == &test_nested_instance_data.group_parameter &&
value->buf_len == sizeof(uint8_t) &&
value->type == REGISTRY_TYPE_UINT8) {
Expand Down Expand Up @@ -125,8 +127,10 @@ static void tests_registry_load(void)

registry_node_t node = {
.type = REGISTRY_NODE_PARAMETER,
.location.parameter = &registry_tests_nested_parameter,
.instance = &test_nested_instance,
.value.parameter = {
.instance = &test_nested_instance,
.parameter = &registry_tests_nested_parameter,
},
};

registry_get(&node, &output);
Expand All @@ -137,8 +141,10 @@ static void tests_registry_save_parameter(void)
{
registry_node_t node = {
.type = REGISTRY_NODE_PARAMETER,
.location.parameter = &registry_tests_nested_group_parameter,
.instance = &test_nested_instance,
.value.parameter = {
.instance = &test_nested_instance,
.parameter = &registry_tests_nested_group_parameter,
},
};
TEST_ASSERT_EQUAL_INT(0, registry_save(&node));
}
Expand All @@ -147,8 +153,10 @@ static void tests_registry_save_group(void)
{
registry_node_t node = {
.type = REGISTRY_NODE_GROUP,
.location.group = &registry_tests_nested_group,
.instance = &test_nested_instance,
.value.group = {
.instance = &test_nested_instance,
.group = &registry_tests_nested_group,
},
};
TEST_ASSERT_EQUAL_INT(0, registry_save(&node));
}
Expand All @@ -157,7 +165,7 @@ static void tests_registry_save_instance(void)
{
registry_node_t node = {
.type = REGISTRY_NODE_INSTANCE,
.instance = &test_nested_instance,
.value.instance = &test_nested_instance,
};
TEST_ASSERT_EQUAL_INT(0, registry_save(&node));
}
Expand All @@ -166,7 +174,7 @@ static void tests_registry_save_schema(void)
{
registry_node_t node = {
.type = REGISTRY_NODE_SCHEMA,
.location.schema = &registry_tests_nested,
.value.schema = &registry_tests_nested,
};
TEST_ASSERT_EQUAL_INT(0, registry_save(&node));
}
Expand All @@ -175,7 +183,7 @@ static void tests_registry_save_namespace(void)
{
registry_node_t node = {
.type = REGISTRY_NODE_NAMESPACE,
.location.namespace = &registry_tests,
.value.namespace = &registry_tests,
};
TEST_ASSERT_EQUAL_INT(0, registry_save(&node));
}
Expand Down

0 comments on commit 0d91422

Please sign in to comment.