From 070fe740055c4ed3a3a13125e28adf2fa00ecc70 Mon Sep 17 00:00:00 2001 From: Sander Mertens Date: Sun, 8 Oct 2023 16:41:39 -0700 Subject: [PATCH] #1047 Add test to check number of enum constant entities is correct --- test/cpp_api/project.json | 3 ++- test/cpp_api/src/Enum.cpp | 12 ++++++++++++ test/cpp_api/src/main.cpp | 7 ++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/test/cpp_api/project.json b/test/cpp_api/project.json index e56d32b4a9..94071b702b 100644 --- a/test/cpp_api/project.json +++ b/test/cpp_api/project.json @@ -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", diff --git a/test/cpp_api/src/Enum.cpp b/test/cpp_api/src/Enum.cpp index a890629f14..6007805973 100644 --- a/test/cpp_api/src/Enum.cpp +++ b/test/cpp_api/src/Enum.cpp @@ -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(); + + flecs::filter<> f = ecs.filter_builder() + .with(flecs::ChildOf, e) + .build(); + + test_assert(f.count() == 3); +} diff --git a/test/cpp_api/src/main.cpp b/test/cpp_api/src/main.cpp index 86fdca9f67..6535fa39b8 100644 --- a/test/cpp_api/src/main.cpp +++ b/test/cpp_api/src/main.cpp @@ -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); @@ -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 } }; @@ -6360,7 +6365,7 @@ static bake_test_suite suites[] = { "Enum", NULL, NULL, - 35, + 36, Enum_testcases }, {