Skip to content

Commit

Permalink
#1047 Add test to check number of enum constant entities is correct
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed Oct 8, 2023
1 parent bc1bb8c commit 070fe74
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/cpp_api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@
"query_union_enum_invalid_query_type",
"component_registered_as_enum",
"mixed_auto_manual_constants",
"enum_class_mixed_auto_manual_constants"
"enum_class_mixed_auto_manual_constants",
"enum_child_count"
]
}, {
"id": "Switch",
Expand Down
12 changes: 12 additions & 0 deletions test/cpp_api/src/Enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,3 +927,15 @@ void Enum_enum_class_mixed_auto_manual_constants(void) {


}

void Enum_enum_child_count(void) {
flecs::world ecs;

flecs::entity e = ecs.component<StandardEnum>();

flecs::filter<> f = ecs.filter_builder()
.with(flecs::ChildOf, e)
.build();

test_assert(f.count() == 3);
}
7 changes: 6 additions & 1 deletion test/cpp_api/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ void Enum_query_union_enum_invalid_query_type(void);
void Enum_component_registered_as_enum(void);
void Enum_mixed_auto_manual_constants(void);
void Enum_enum_class_mixed_auto_manual_constants(void);
void Enum_enum_child_count(void);

// Testsuite 'Switch'
void Switch_add_case(void);
Expand Down Expand Up @@ -2715,6 +2716,10 @@ bake_test_case Enum_testcases[] = {
{
"enum_class_mixed_auto_manual_constants",
Enum_enum_class_mixed_auto_manual_constants
},
{
"enum_child_count",
Enum_enum_child_count
}
};

Expand Down Expand Up @@ -6360,7 +6365,7 @@ static bake_test_suite suites[] = {
"Enum",
NULL,
NULL,
35,
36,
Enum_testcases
},
{
Expand Down

0 comments on commit 070fe74

Please sign in to comment.