Browse Source

test: avoid static global functions

Michele Caini 2 năm trước cách đây
mục cha
commit
ef914bad8c

+ 5 - 1
test/entt/poly/poly.cpp

@@ -45,10 +45,14 @@ struct common_members {
     }
     }
 };
 };
 
 
-static int absolutely_random() {
+namespace {
+
+[[nodiscard]] int absolutely_random() {
     return 42;
     return 42;
 }
 }
 
 
+} // namespace
+
 template<typename Type>
 template<typename Type>
 using common_impl = entt::value_list<
 using common_impl = entt::value_list<
     &Type::incr,
     &Type::incr,

+ 5 - 1
test/example/reserved_bits.cpp

@@ -22,10 +22,14 @@ struct entt::entt_traits<my_entity>: entt::basic_entt_traits<custom_entity_trait
     static constexpr std::size_t page_size = ENTT_SPARSE_PAGE;
     static constexpr std::size_t page_size = ENTT_SPARSE_PAGE;
 };
 };
 
 
-static bool is_disabled(const my_entity entity) {
+namespace {
+
+[[nodiscard]] bool is_disabled(const my_entity entity) {
     return ((entity & my_entity::disabled) == my_entity::disabled);
     return ((entity & my_entity::disabled) == my_entity::disabled);
 }
 }
 
 
+} // namespace
+
 TEST(Example, DisabledEntity) {
 TEST(Example, DisabledEntity) {
     entt::basic_registry<my_entity> registry{};
     entt::basic_registry<my_entity> registry{};
     auto view = registry.view<my_entity, int>();
     auto view = registry.view<my_entity, int>();