test fixes

This commit is contained in:
BlackMATov
2023-01-14 03:13:07 +07:00
parent bff179fac5
commit bce3115ff0
6 changed files with 28 additions and 15 deletions

View File

@@ -17,7 +17,7 @@ namespace
struct clazz_2 {};
}
TEST_CASE("meta/meta_states/member") {
TEST_CASE("meta/meta_states/member/_") {
namespace meta = meta_hpp;
meta::class_<clazz_1>()
@@ -26,6 +26,10 @@ TEST_CASE("meta/meta_states/member") {
// .member_("unique_int_member", &clazz_1::unique_int_member)
.member_("unique_int_member_as_ptr", &clazz_1::unique_int_member, meta::member_policy::as_pointer)
.member_("unique_int_member_as_ref", &clazz_1::unique_int_member, meta::member_policy::as_reference_wrapper);
}
TEST_CASE("meta/meta_states/member") {
namespace meta = meta_hpp;
const meta::class_type clazz_1_type = meta::resolve_type<clazz_1>();
REQUIRE(clazz_1_type);

View File

@@ -61,7 +61,7 @@ namespace
struct clazz2 {};
}
TEST_CASE("meta/meta_states/method") {
TEST_CASE("meta/meta_states/method/_") {
namespace meta = meta_hpp;
meta::class_<base>()
@@ -90,6 +90,10 @@ TEST_CASE("meta/meta_states/method") {
meta::class_<derived_clazz>()
.base_<clazz>();
}
TEST_CASE("meta/meta_states/method") {
namespace meta = meta_hpp;
const meta::class_type ct = meta::resolve_type<clazz>();
REQUIRE(ct);

View File

@@ -12,6 +12,7 @@ namespace
int i{42};
unique_int() = default;
explicit unique_int(int ni) : i{ni} {}
unique_int(unique_int&&) = default;
unique_int& operator=(unique_int&&) = default;
@@ -180,13 +181,13 @@ TEST_CASE("meta/meta_states/variable") {
CHECK(vm.get_as<unique_int*>() == std::addressof(clazz_1::unique_int_variable));
{
auto nv = std::make_unique<int>(11);
unique_int nv{11};
vm.set(std::move(nv));
CHECK(clazz_1::unique_int_variable.i == 11);
}
{
auto nv = std::make_unique<int>(12);
unique_int nv{12};
CHECK_THROWS(vm.set(nv));
CHECK(clazz_1::unique_int_variable.i == 11);
}
@@ -201,13 +202,13 @@ TEST_CASE("meta/meta_states/variable") {
CHECK(&vm.get_as<ref_t>().get() == &clazz_1::unique_int_variable);
{
auto nv = std::make_unique<int>(13);
unique_int nv{13};
vm.set(std::move(nv));
CHECK(clazz_1::unique_int_variable.i == 13);
}
{
auto nv = std::make_unique<int>(14);
unique_int nv{14};
CHECK_THROWS(vm.set(nv));
CHECK(clazz_1::unique_int_variable.i == 13);
}
@@ -221,7 +222,7 @@ TEST_CASE("meta/meta_states/variable") {
CHECK(vm.get_as<const unique_int*>() == std::addressof(clazz_1::const_unique_int_variable));
{
auto nv = std::make_unique<int>(11);
unique_int nv{11};
CHECK_THROWS(vm.set(nv));
CHECK_THROWS(vm.set(std::move(nv)));
CHECK(clazz_1::const_unique_int_variable.i == 42);
@@ -237,7 +238,7 @@ TEST_CASE("meta/meta_states/variable") {
CHECK(&vm.get_as<ref_t>().get() == &clazz_1::const_unique_int_variable);
{
auto nv = std::make_unique<int>(12);
unique_int nv{12};
CHECK_THROWS(vm.set(nv));
CHECK_THROWS(vm.set(std::move(nv)));
CHECK(clazz_1::const_unique_int_variable.i == 42);

View File

@@ -58,7 +58,7 @@ namespace
struct variadic_clazz {};
}
TEST_CASE("meta/meta_types/class_type") {
TEST_CASE("meta/meta_types/class_type/_") {
namespace meta = meta_hpp;
meta::class_<base_clazz_1>()
@@ -91,6 +91,10 @@ TEST_CASE("meta/meta_types/class_type") {
meta::class_<final_derived_clazz>()
.constructor_<int, float>()
.base_<derived_clazz>();
}
TEST_CASE("meta/meta_types/class_type") {
namespace meta = meta_hpp;
const meta::class_type base_clazz_1_type = meta::resolve_type<base_clazz_1>();
REQUIRE(base_clazz_1_type);

View File

@@ -35,7 +35,7 @@ namespace
};
}
TEST_CASE("meta/meta_utilities/hash") {
TEST_CASE("meta/meta_utilities/hash/_") {
namespace meta = meta_hpp;
meta::enum_<color>()
@@ -51,6 +51,10 @@ TEST_CASE("meta/meta_utilities/hash") {
.member_("y", &ivec2::y)
.method_("add", &ivec2::add)
.function_("iadd", &ivec2::iadd);
}
TEST_CASE("meta/meta_utilities/hash") {
namespace meta = meta_hpp;
const meta::class_type ivec2_type = meta::resolve_type<ivec2>();
const meta::constructor ivec2_ctor = ivec2_type.get_constructor_with<int>();

View File

@@ -69,7 +69,7 @@ namespace
}
}
TEST_CASE("meta/meta_utilities/value/ivec2") {
TEST_CASE("meta/meta_utilities/value/_") {
namespace meta = meta_hpp;
meta::class_<ivec2>()
@@ -79,10 +79,6 @@ TEST_CASE("meta/meta_utilities/value/ivec2") {
.constructor_<const ivec2&>()
.member_("x", &ivec2::x)
.member_("y", &ivec2::y);
}
TEST_CASE("meta/meta_utilities/value/ivec3") {
namespace meta = meta_hpp;
meta::class_<ivec3>()
.constructor_<int>()