mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 16:13:53 +00:00
Shuffling existing TEST_CASEs into systematic matrix.
This commit is contained in:
parent
1f80387f4b
commit
401cdb3b0e
@ -90,6 +90,20 @@ struct smart_holder {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void from_raw_ptr_unowned(T* raw_ptr) {
|
||||
clear();
|
||||
rtti_held = &typeid(T);
|
||||
vptr.reset(raw_ptr, guarded_builtin_delete<T>(&vptr_deleter_guard_flag));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* as_raw_ptr_unowned() const {
|
||||
static const char* context = "as_raw_ptr_unowned";
|
||||
ensure_compatible_rtti_held<T>(context);
|
||||
return static_cast<T*>(vptr.get());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const T& const_value_ref() const {
|
||||
static const char* context = "const_value_ref";
|
||||
@ -107,13 +121,6 @@ struct smart_holder {
|
||||
vptr.reset(raw_ptr, guarded_builtin_delete<T>(&vptr_deleter_guard_flag));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void from_raw_ptr_unowned(T* raw_ptr) {
|
||||
clear();
|
||||
rtti_held = &typeid(T);
|
||||
vptr.reset(raw_ptr, guarded_builtin_delete<T>(&vptr_deleter_guard_flag));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* as_raw_ptr_release_ownership(
|
||||
const char* context = "as_raw_ptr_release_ownership") {
|
||||
@ -126,13 +133,6 @@ struct smart_holder {
|
||||
return raw_ptr;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* as_raw_ptr_unowned() const {
|
||||
static const char* context = "as_raw_ptr_unowned";
|
||||
ensure_compatible_rtti_held<T>(context);
|
||||
return static_cast<T*>(vptr.get());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void from_unique_ptr(std::unique_ptr<T>&& unq_ptr) {
|
||||
clear();
|
||||
|
@ -14,22 +14,36 @@ struct functor_builtin_delete {
|
||||
|
||||
} // namespace helpers
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+const_value_ref", "[feasible]") {
|
||||
smart_holder hld;
|
||||
REQUIRE(!hld.has_pointee());
|
||||
hld.from_raw_ptr_take_ownership(new int(19));
|
||||
REQUIRE(hld.has_pointee());
|
||||
REQUIRE(hld.const_value_ref<int>() == 19);
|
||||
TEST_CASE("from_raw_ptr_unowned+as_raw_ptr_unowned", "[S]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_unowned+const_value_ref", "[feasible]") {
|
||||
TEST_CASE("from_raw_ptr_unowned+const_value_ref", "[S]") {
|
||||
static int value = 19;
|
||||
smart_holder hld;
|
||||
hld.from_raw_ptr_unowned(&value);
|
||||
REQUIRE(hld.const_value_ref<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_raw_ptr_release_ownership", "[feasible]") {
|
||||
TEST_CASE("from_raw_ptr_unowned+as_raw_ptr_release_ownership", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_unowned+as_unique_ptr", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_unowned+as_unique_ptr_with_deleter", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_unowned+as_shared_ptr", "[S]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+const_value_ref", "[S]") {
|
||||
smart_holder hld;
|
||||
hld.from_raw_ptr_take_ownership(new int(19));
|
||||
REQUIRE(hld.has_pointee());
|
||||
REQUIRE(hld.const_value_ref<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_raw_ptr_release_ownership1", "[S]") {
|
||||
smart_holder hld;
|
||||
hld.from_raw_ptr_take_ownership(new int(19));
|
||||
auto new_owner =
|
||||
@ -37,23 +51,10 @@ TEST_CASE("from_raw_ptr_take_ownership+as_raw_ptr_release_ownership", "[feasible
|
||||
REQUIRE(!hld.has_pointee());
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_raw_ptr_unowned", "[feasible]") {
|
||||
smart_holder hld;
|
||||
hld.from_raw_ptr_take_ownership(new int(19));
|
||||
int* raw_ptr = hld.as_raw_ptr_unowned<int>();
|
||||
REQUIRE(hld.has_pointee());
|
||||
REQUIRE(*raw_ptr == 19);
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_raw_ptr_release_ownership2", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+const_value_ref+const_value_ref", "[feasible]") {
|
||||
std::unique_ptr<int> orig_owner(new int(19));
|
||||
smart_holder hld;
|
||||
hld.from_unique_ptr(std::move(orig_owner));
|
||||
REQUIRE(orig_owner.get() == nullptr);
|
||||
REQUIRE(hld.const_value_ref<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_unique_ptr", "[feasible]") {
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_unique_ptr1", "[S]") {
|
||||
smart_holder hld;
|
||||
hld.from_raw_ptr_take_ownership(new int(19));
|
||||
auto new_owner = hld.as_unique_ptr<int>();
|
||||
@ -61,7 +62,47 @@ TEST_CASE("from_raw_ptr_take_ownership+as_unique_ptr", "[feasible]") {
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr_with_deleter+const_value_ref", "[feasible]") {
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_unique_ptr2", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_unique_ptr_with_deleter", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_shared_ptr", "[S]") {
|
||||
smart_holder hld;
|
||||
hld.from_raw_ptr_take_ownership(new int(19));
|
||||
auto new_owner = hld.as_shared_ptr<int>();
|
||||
REQUIRE(hld.has_pointee());
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+const_value_ref", "[S]") {
|
||||
std::unique_ptr<int> orig_owner(new int(19));
|
||||
smart_holder hld;
|
||||
hld.from_unique_ptr(std::move(orig_owner));
|
||||
REQUIRE(orig_owner.get() == nullptr);
|
||||
REQUIRE(hld.const_value_ref<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_raw_ptr_release_ownership1", "[S]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_raw_ptr_release_ownership2", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_unique_ptr1", "[S]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_unique_ptr2", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_unique_ptr_with_deleter", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_shared_ptr", "[S]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr_with_deleter+const_value_ref", "[S]") {
|
||||
std::unique_ptr<int, helpers::functor_builtin_delete<int>> orig_owner(
|
||||
new int(19));
|
||||
smart_holder hld;
|
||||
@ -70,7 +111,13 @@ TEST_CASE("from_unique_ptr_with_deleter+const_value_ref", "[feasible]") {
|
||||
REQUIRE(hld.const_value_ref<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr_with_deleter+as_unique_ptr_with_deleter", "[feasible]") {
|
||||
TEST_CASE("from_unique_ptr_with_deleter+as_raw_ptr_release_ownership", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr_with_deleter+as_unique_ptr", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr_with_deleter+as_unique_ptr_with_deleter1", "[S]") {
|
||||
std::unique_ptr<int, helpers::functor_builtin_delete<int>> orig_owner(
|
||||
new int(19));
|
||||
smart_holder hld;
|
||||
@ -82,7 +129,13 @@ TEST_CASE("from_unique_ptr_with_deleter+as_unique_ptr_with_deleter", "[feasible]
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_shared_ptr+const_value_ref", "[feasible]") {
|
||||
TEST_CASE("from_unique_ptr_with_deleter+as_unique_ptr_with_deleter2", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr_with_deleter+as_shared_ptr", "[S]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_shared_ptr+const_value_ref", "[S]") {
|
||||
std::shared_ptr<int> orig_owner(new int(19));
|
||||
smart_holder hld;
|
||||
hld.from_shared_ptr(orig_owner);
|
||||
@ -90,10 +143,17 @@ TEST_CASE("from_shared_ptr+const_value_ref", "[feasible]") {
|
||||
REQUIRE(hld.const_value_ref<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_shared_ptr", "[feasible]") {
|
||||
smart_holder hld;
|
||||
hld.from_raw_ptr_take_ownership(new int(19));
|
||||
auto new_owner = hld.as_shared_ptr<int>();
|
||||
REQUIRE(hld.has_pointee());
|
||||
REQUIRE(*new_owner == 19);
|
||||
TEST_CASE("from_shared_ptr+as_raw_ptr_release_ownership1", "[S]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_shared_ptr+as_raw_ptr_release_ownership2", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_shared_ptr+as_unique_ptr", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_shared_ptr+as_unique_ptr_with_deleter", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_shared_ptr+as_shared_ptr", "[S]") {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user