fix CI tests

This commit is contained in:
BlackMATov
2023-02-01 00:26:40 +07:00
parent e9204d4b33
commit 2d90247546
6 changed files with 100 additions and 84 deletions

View File

@@ -38,5 +38,6 @@ target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads)
#
if(PROJECT_IS_TOP_LEVEL)
enable_testing()
add_subdirectory(develop)
endif()

View File

@@ -3,7 +3,6 @@ option(BUILD_WITH_SANITIZERS "Build with sanitizers" OFF)
option(BUILD_WITH_NO_EXCEPTIONS "Build with no exceptions" ${META_HPP_NO_EXCEPTIONS})
option(BUILD_WITH_NO_RTTI "Build with no RTTI" ${META_HPP_NO_RTTI})
enable_testing()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

View File

@@ -3677,15 +3677,17 @@ namespace meta_hpp::detail
private:
template < array_kind Array >
[[nodiscard]] array_type_data* resolve_array_type_data() {
static array_type_data data{type_list<Array>{}};
ensure_type<Array>(data);
static array_type_data data = (
ensure_type<Array>(data),
array_type_data{type_list<Array>{}});
return &data;
}
template < class_kind Class >
[[nodiscard]] class_type_data* resolve_class_type_data() {
static class_type_data data{type_list<Class>{}};
ensure_type<Class>(data);
static class_type_data data = (
ensure_type<Class>(data),
class_type_data{type_list<Class>{}});
return &data;
}
@@ -3703,64 +3705,73 @@ namespace meta_hpp::detail
template < enum_kind Enum >
[[nodiscard]] enum_type_data* resolve_enum_type_data() {
static enum_type_data data{type_list<Enum>{}};
ensure_type<Enum>(data);
static enum_type_data data = (
ensure_type<Enum>(data),
enum_type_data{type_list<Enum>{}});
return &data;
}
template < function_kind Function >
[[nodiscard]] function_type_data* resolve_function_type_data() {
static function_type_data data{type_list<Function>{}};
ensure_type<Function>(data);
static function_type_data data = (
ensure_type<Function>(data),
function_type_data{type_list<Function>{}});
return &data;
}
template < member_kind Member >
[[nodiscard]] member_type_data* resolve_member_type_data() {
static member_type_data data{type_list<Member>{}};
ensure_type<Member>(data);
static member_type_data data = (
ensure_type<Member>(data),
member_type_data{type_list<Member>{}});
return &data;
}
template < method_kind Method >
[[nodiscard]] method_type_data* resolve_method_type_data() {
static method_type_data data{type_list<Method>{}};
ensure_type<Method>(data);
static method_type_data data = (
ensure_type<Method>(data),
method_type_data{type_list<Method>{}});
return &data;
}
template < nullptr_kind Nullptr >
[[nodiscard]] nullptr_type_data* resolve_nullptr_type_data() {
static nullptr_type_data data{type_list<Nullptr>{}};
ensure_type<Nullptr>(data);
static nullptr_type_data data = (
ensure_type<Nullptr>(data),
nullptr_type_data{type_list<Nullptr>{}});
return &data;
}
template < number_kind Number >
[[nodiscard]] number_type_data* resolve_number_type_data() {
static number_type_data data{type_list<Number>{}};
ensure_type<Number>(data);
static number_type_data data = (
ensure_type<Number>(data),
number_type_data{type_list<Number>{}});
return &data;
}
template < pointer_kind Pointer >
[[nodiscard]] pointer_type_data* resolve_pointer_type_data() {
static pointer_type_data data{type_list<Pointer>{}};
ensure_type<Pointer>(data);
static pointer_type_data data = (
ensure_type<Pointer>(data),
pointer_type_data{type_list<Pointer>{}});
return &data;
}
template < reference_kind Reference >
[[nodiscard]] reference_type_data* resolve_reference_type_data() {
static reference_type_data data{type_list<Reference>{}};
ensure_type<Reference>(data);
static reference_type_data data = (
ensure_type<Reference>(data),
reference_type_data{type_list<Reference>{}});
return &data;
}
template < void_kind Void >
[[nodiscard]] void_type_data* resolve_void_type_data() {
static void_type_data data{type_list<Void>{}};
ensure_type<Void>(data);
static void_type_data data = (
ensure_type<Void>(data),
void_type_data{type_list<Void>{}});
return &data;
}
private:
@@ -3768,8 +3779,6 @@ namespace meta_hpp::detail
template < typename Type, typename TypeData >
void ensure_type(TypeData& type_data) {
static std::once_flag init_flag{};
std::call_once(init_flag, [this, &type_data](){
const locker lock;
auto&& [position, emplaced] = types_.emplace(any_type{&type_data});
@@ -3785,7 +3794,6 @@ namespace meta_hpp::detail
META_HPP_RETHROW();
}
#endif
});
}
private:
std::recursive_mutex mutex_;

View File

@@ -187,12 +187,12 @@ TEST_CASE("meta/meta_utilities/value2/counters/small") {
CHECK(v1.get_as<ivec2>().x == 3);
CHECK(v2.get_as<ivec2>().x == 1);
CHECK(ivec2::destructor_counter == 5);
CHECK(ivec2::move_constructor_counter == 5);
CHECK((ivec2::destructor_counter == 5 || ivec2::destructor_counter == 6));
CHECK((ivec2::move_constructor_counter == 5 || ivec2::move_constructor_counter == 6));
CHECK(ivec2::copy_constructor_counter == 0);
}
CHECK(ivec2::destructor_counter == 7);
CHECK(ivec2::move_constructor_counter == 5);
CHECK((ivec2::destructor_counter == 7 || ivec2::destructor_counter == 8));
CHECK((ivec2::move_constructor_counter == 5 || ivec2::move_constructor_counter == 6));
CHECK(ivec2::copy_constructor_counter == 0);
}
}

View File

@@ -618,15 +618,15 @@ TEST_CASE("meta/meta_utilities/value") {
CHECK(ivec2::copy_constructor_counter == 0);
meta::uvalue vv1{*vp};
CHECK((ivec2::move_constructor_counter == 0 || ivec2::move_constructor_counter == 1 || ivec2::move_constructor_counter == 2));
CHECK(ivec2::move_constructor_counter <= 3);
CHECK(ivec2::copy_constructor_counter == 1);
meta::uvalue vv2{*std::move(vp)};
CHECK((ivec2::move_constructor_counter == 0 || ivec2::move_constructor_counter == 2 || ivec2::move_constructor_counter == 4));
CHECK(ivec2::move_constructor_counter <= 6);
CHECK(ivec2::copy_constructor_counter == 2);
meta::uvalue vv3{*std::as_const(vp)};
CHECK((ivec2::move_constructor_counter == 0 || ivec2::move_constructor_counter == 3 || ivec2::move_constructor_counter == 6));
CHECK(ivec2::move_constructor_counter <= 9);
CHECK(ivec2::copy_constructor_counter == 3);
}
{

View File

@@ -136,15 +136,17 @@ namespace meta_hpp::detail
private:
template < array_kind Array >
[[nodiscard]] array_type_data* resolve_array_type_data() {
static array_type_data data{type_list<Array>{}};
ensure_type<Array>(data);
static array_type_data data = (
ensure_type<Array>(data),
array_type_data{type_list<Array>{}});
return &data;
}
template < class_kind Class >
[[nodiscard]] class_type_data* resolve_class_type_data() {
static class_type_data data{type_list<Class>{}};
ensure_type<Class>(data);
static class_type_data data = (
ensure_type<Class>(data),
class_type_data{type_list<Class>{}});
return &data;
}
@@ -162,64 +164,73 @@ namespace meta_hpp::detail
template < enum_kind Enum >
[[nodiscard]] enum_type_data* resolve_enum_type_data() {
static enum_type_data data{type_list<Enum>{}};
ensure_type<Enum>(data);
static enum_type_data data = (
ensure_type<Enum>(data),
enum_type_data{type_list<Enum>{}});
return &data;
}
template < function_kind Function >
[[nodiscard]] function_type_data* resolve_function_type_data() {
static function_type_data data{type_list<Function>{}};
ensure_type<Function>(data);
static function_type_data data = (
ensure_type<Function>(data),
function_type_data{type_list<Function>{}});
return &data;
}
template < member_kind Member >
[[nodiscard]] member_type_data* resolve_member_type_data() {
static member_type_data data{type_list<Member>{}};
ensure_type<Member>(data);
static member_type_data data = (
ensure_type<Member>(data),
member_type_data{type_list<Member>{}});
return &data;
}
template < method_kind Method >
[[nodiscard]] method_type_data* resolve_method_type_data() {
static method_type_data data{type_list<Method>{}};
ensure_type<Method>(data);
static method_type_data data = (
ensure_type<Method>(data),
method_type_data{type_list<Method>{}});
return &data;
}
template < nullptr_kind Nullptr >
[[nodiscard]] nullptr_type_data* resolve_nullptr_type_data() {
static nullptr_type_data data{type_list<Nullptr>{}};
ensure_type<Nullptr>(data);
static nullptr_type_data data = (
ensure_type<Nullptr>(data),
nullptr_type_data{type_list<Nullptr>{}});
return &data;
}
template < number_kind Number >
[[nodiscard]] number_type_data* resolve_number_type_data() {
static number_type_data data{type_list<Number>{}};
ensure_type<Number>(data);
static number_type_data data = (
ensure_type<Number>(data),
number_type_data{type_list<Number>{}});
return &data;
}
template < pointer_kind Pointer >
[[nodiscard]] pointer_type_data* resolve_pointer_type_data() {
static pointer_type_data data{type_list<Pointer>{}};
ensure_type<Pointer>(data);
static pointer_type_data data = (
ensure_type<Pointer>(data),
pointer_type_data{type_list<Pointer>{}});
return &data;
}
template < reference_kind Reference >
[[nodiscard]] reference_type_data* resolve_reference_type_data() {
static reference_type_data data{type_list<Reference>{}};
ensure_type<Reference>(data);
static reference_type_data data = (
ensure_type<Reference>(data),
reference_type_data{type_list<Reference>{}});
return &data;
}
template < void_kind Void >
[[nodiscard]] void_type_data* resolve_void_type_data() {
static void_type_data data{type_list<Void>{}};
ensure_type<Void>(data);
static void_type_data data = (
ensure_type<Void>(data),
void_type_data{type_list<Void>{}});
return &data;
}
private:
@@ -227,8 +238,6 @@ namespace meta_hpp::detail
template < typename Type, typename TypeData >
void ensure_type(TypeData& type_data) {
static std::once_flag init_flag{};
std::call_once(init_flag, [this, &type_data](){
const locker lock;
auto&& [position, emplaced] = types_.emplace(any_type{&type_data});
@@ -244,7 +253,6 @@ namespace meta_hpp::detail
META_HPP_RETHROW();
}
#endif
});
}
private:
std::recursive_mutex mutex_;