Skip to content

Commit

Permalink
fixup! tests/unittests: add registry_int_path 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 b668ccb commit 06adb07
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions tests/unittests/tests-registry_int_path/tests-registry_int_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ static void tests_registry_to_parameter_int_path(void)
{
registry_node_t node = {
.type = REGISTRY_NODE_PARAMETER,
.instance = &test_instance,
.location.parameter = &registry_tests_nested_parameter,
.value.parameter = {
.instance = &test_instance,
.parameter = &registry_tests_nested_parameter,
},
};
registry_int_path_t path;
int res = registry_node_to_int_path(&node, &path);
Expand All @@ -82,8 +84,10 @@ static void tests_registry_to_group_int_path(void)
{
registry_node_t node = {
.type = REGISTRY_NODE_GROUP,
.instance = &test_instance,
.location.group = &registry_tests_nested_group,
.value.group = {
.instance = &test_instance,
.group = &registry_tests_nested_group,
},
};
registry_int_path_t path;
int res = registry_node_to_int_path(&node, &path);
Expand All @@ -99,7 +103,7 @@ static void tests_registry_to_instance_int_path(void)
{
registry_node_t node = {
.type = REGISTRY_NODE_INSTANCE,
.instance = &test_instance,
.value.instance = &test_instance,
};
registry_int_path_t path;
int res = registry_node_to_int_path(&node, &path);
Expand All @@ -114,7 +118,7 @@ static void tests_registry_to_schema_int_path(void)
{
registry_node_t node = {
.type = REGISTRY_NODE_SCHEMA,
.location.schema = &registry_tests_nested,
.value.schema = &registry_tests_nested,
};
registry_int_path_t path;
int res = registry_node_to_int_path(&node, &path);
Expand All @@ -128,7 +132,7 @@ static void tests_registry_to_namespace_int_path(void)
{
registry_node_t node = {
.type = REGISTRY_NODE_NAMESPACE,
.location.namespace = &registry_tests,
.value.namespace = &registry_tests,
};
registry_int_path_t path;
int res = registry_node_to_int_path(&node, &path);
Expand Down Expand Up @@ -157,8 +161,8 @@ static void tests_registry_from_group_or_parameter_int_path(void)

TEST_ASSERT_EQUAL_INT(0, res);
TEST_ASSERT_EQUAL_INT(REGISTRY_NODE_PARAMETER, node.type);
TEST_ASSERT_EQUAL_INT((int)&test_instance, (int)node.instance);
TEST_ASSERT_EQUAL_INT((int)&registry_tests_nested_group_parameter, (int)node.location.parameter);
TEST_ASSERT_EQUAL_INT((int)&test_instance, (int)node.value.parameter.instance);
TEST_ASSERT_EQUAL_INT((int)&registry_tests_nested_group_parameter, (int)node.value.parameter.parameter);


/* group */
Expand All @@ -176,8 +180,8 @@ static void tests_registry_from_group_or_parameter_int_path(void)

TEST_ASSERT_EQUAL_INT(0, res);
TEST_ASSERT_EQUAL_INT(REGISTRY_NODE_GROUP, node.type);
TEST_ASSERT_EQUAL_INT((int)&test_instance, (int)node.instance);
TEST_ASSERT_EQUAL_INT((int)&registry_tests_nested_group, (int)node.location.group);
TEST_ASSERT_EQUAL_INT((int)&test_instance, (int)node.value.group.instance);
TEST_ASSERT_EQUAL_INT((int)&registry_tests_nested_group, (int)node.value.group.group);
}

static void tests_registry_from_parameter_int_path(void)
Expand All @@ -198,8 +202,8 @@ static void tests_registry_from_parameter_int_path(void)

TEST_ASSERT_EQUAL_INT(0, res);
TEST_ASSERT_EQUAL_INT(REGISTRY_NODE_PARAMETER, node.type);
TEST_ASSERT_EQUAL_INT((int)&test_instance, (int)node.instance);
TEST_ASSERT_EQUAL_INT((int)&registry_tests_nested_group_parameter, (int)node.location.parameter);
TEST_ASSERT_EQUAL_INT((int)&test_instance, (int)node.value.parameter.instance);
TEST_ASSERT_EQUAL_INT((int)&registry_tests_nested_group_parameter, (int)node.value.parameter.parameter);
}

static void tests_registry_from_group_int_path(void)
Expand All @@ -220,8 +224,8 @@ static void tests_registry_from_group_int_path(void)

TEST_ASSERT_EQUAL_INT(0, res);
TEST_ASSERT_EQUAL_INT(REGISTRY_NODE_GROUP, node.type);
TEST_ASSERT_EQUAL_INT((int)&test_instance, (int)node.instance);
TEST_ASSERT_EQUAL_INT((int)&registry_tests_nested_group, (int)node.location.group);
TEST_ASSERT_EQUAL_INT((int)&test_instance, (int)node.value.group.instance);
TEST_ASSERT_EQUAL_INT((int)&registry_tests_nested_group, (int)node.value.group.group);
}

static void tests_registry_from_instance_int_path(void)
Expand All @@ -241,7 +245,7 @@ static void tests_registry_from_instance_int_path(void)

TEST_ASSERT_EQUAL_INT(0, res);
TEST_ASSERT_EQUAL_INT(REGISTRY_NODE_INSTANCE, node.type);
TEST_ASSERT_EQUAL_INT((int)&test_instance, (int)node.instance);
TEST_ASSERT_EQUAL_INT((int)&test_instance, (int)node.value.instance);
}

static void tests_registry_from_schema_int_path(void)
Expand All @@ -260,7 +264,7 @@ static void tests_registry_from_schema_int_path(void)

TEST_ASSERT_EQUAL_INT(0, res);
TEST_ASSERT_EQUAL_INT(REGISTRY_NODE_SCHEMA, node.type);
TEST_ASSERT_EQUAL_INT((int)&registry_tests_nested, (int)node.location.schema);
TEST_ASSERT_EQUAL_INT((int)&registry_tests_nested, (int)node.value.schema);
}

static void tests_registry_from_namespace_int_path(void)
Expand All @@ -278,7 +282,7 @@ static void tests_registry_from_namespace_int_path(void)

TEST_ASSERT_EQUAL_INT(0, res);
TEST_ASSERT_EQUAL_INT(REGISTRY_NODE_NAMESPACE, node.type);
TEST_ASSERT_EQUAL_INT((int)&registry_tests, (int)node.location.namespace);
TEST_ASSERT_EQUAL_INT((int)&registry_tests, (int)node.value.namespace);
}

Test *tests_registry_int_path_tests(void)
Expand Down

0 comments on commit 06adb07

Please sign in to comment.