mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 16:13:53 +00:00
Implementing all [S]uccess tests.
This commit is contained in:
parent
401cdb3b0e
commit
d76050c713
@ -15,6 +15,10 @@ struct functor_builtin_delete {
|
||||
} // namespace helpers
|
||||
|
||||
TEST_CASE("from_raw_ptr_unowned+as_raw_ptr_unowned", "[S]") {
|
||||
static int value = 19;
|
||||
smart_holder hld;
|
||||
hld.from_raw_ptr_unowned(&value);
|
||||
REQUIRE(*hld.as_raw_ptr_unowned<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_unowned+const_value_ref", "[S]") {
|
||||
@ -24,16 +28,17 @@ TEST_CASE("from_raw_ptr_unowned+const_value_ref", "[S]") {
|
||||
REQUIRE(hld.const_value_ref<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_unowned+as_raw_ptr_release_ownership", "[E]") {
|
||||
}
|
||||
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", "[E]") {}
|
||||
|
||||
TEST_CASE("from_raw_ptr_unowned+as_unique_ptr_with_deleter", "[E]") {
|
||||
}
|
||||
TEST_CASE("from_raw_ptr_unowned+as_unique_ptr_with_deleter", "[E]") {}
|
||||
|
||||
TEST_CASE("from_raw_ptr_unowned+as_shared_ptr", "[S]") {
|
||||
static int value = 19;
|
||||
smart_holder hld;
|
||||
hld.from_raw_ptr_unowned(&value);
|
||||
REQUIRE(*hld.as_shared_ptr<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+const_value_ref", "[S]") {
|
||||
@ -49,29 +54,27 @@ TEST_CASE("from_raw_ptr_take_ownership+as_raw_ptr_release_ownership1", "[S]") {
|
||||
auto new_owner =
|
||||
std::unique_ptr<int>(hld.as_raw_ptr_release_ownership<int>());
|
||||
REQUIRE(!hld.has_pointee());
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_raw_ptr_release_ownership2", "[E]") {
|
||||
}
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_raw_ptr_release_ownership2", "[E]") {}
|
||||
|
||||
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>();
|
||||
std::unique_ptr<int> new_owner = hld.as_unique_ptr<int>();
|
||||
REQUIRE(!hld.has_pointee());
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_raw_ptr_take_ownership+as_unique_ptr2", "[E]") {
|
||||
}
|
||||
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_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>();
|
||||
std::shared_ptr<int> new_owner = hld.as_shared_ptr<int>();
|
||||
REQUIRE(hld.has_pointee());
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
@ -85,21 +88,40 @@ TEST_CASE("from_unique_ptr+const_value_ref", "[S]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_raw_ptr_release_ownership1", "[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);
|
||||
auto new_owner =
|
||||
std::unique_ptr<int>(hld.as_raw_ptr_release_ownership<int>());
|
||||
REQUIRE(!hld.has_pointee());
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_raw_ptr_release_ownership2", "[E]") {
|
||||
}
|
||||
TEST_CASE("from_unique_ptr+as_raw_ptr_release_ownership2", "[E]") {}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_unique_ptr1", "[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);
|
||||
std::unique_ptr<int> new_owner = hld.as_unique_ptr<int>();
|
||||
REQUIRE(!hld.has_pointee());
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_unique_ptr2", "[E]") {
|
||||
}
|
||||
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_unique_ptr_with_deleter", "[E]") {}
|
||||
|
||||
TEST_CASE("from_unique_ptr+as_shared_ptr", "[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);
|
||||
std::shared_ptr<int> new_owner = hld.as_shared_ptr<int>();
|
||||
REQUIRE(hld.has_pointee());
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr_with_deleter+const_value_ref", "[S]") {
|
||||
@ -111,49 +133,52 @@ TEST_CASE("from_unique_ptr_with_deleter+const_value_ref", "[S]") {
|
||||
REQUIRE(hld.const_value_ref<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr_with_deleter+as_raw_ptr_release_ownership", "[E]") {
|
||||
}
|
||||
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", "[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;
|
||||
hld.from_unique_ptr_with_deleter(std::move(orig_owner));
|
||||
auto new_owner =
|
||||
REQUIRE(orig_owner.get() == nullptr);
|
||||
std::unique_ptr<int, helpers::functor_builtin_delete<int>> new_owner =
|
||||
hld.as_unique_ptr_with_deleter<int,
|
||||
helpers::functor_builtin_delete<int>>();
|
||||
REQUIRE(!hld.has_pointee());
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_unique_ptr_with_deleter+as_unique_ptr_with_deleter2", "[E]") {
|
||||
}
|
||||
TEST_CASE("from_unique_ptr_with_deleter+as_unique_ptr_with_deleter2", "[E]") {}
|
||||
|
||||
TEST_CASE("from_unique_ptr_with_deleter+as_shared_ptr", "[S]") {
|
||||
std::unique_ptr<int, helpers::functor_builtin_delete<int>> orig_owner(
|
||||
new int(19));
|
||||
smart_holder hld;
|
||||
hld.from_unique_ptr_with_deleter(std::move(orig_owner));
|
||||
REQUIRE(orig_owner.get() == nullptr);
|
||||
std::shared_ptr<int> new_owner = hld.as_shared_ptr<int>();
|
||||
REQUIRE(hld.has_pointee());
|
||||
REQUIRE(*new_owner == 19);
|
||||
}
|
||||
|
||||
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);
|
||||
REQUIRE(orig_owner.get() != nullptr);
|
||||
REQUIRE(hld.const_value_ref<int>() == 19);
|
||||
}
|
||||
|
||||
TEST_CASE("from_shared_ptr+as_raw_ptr_release_ownership1", "[S]") {
|
||||
}
|
||||
TEST_CASE("from_shared_ptr+as_raw_ptr_release_ownership", "[E]") {}
|
||||
|
||||
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", "[E]") {
|
||||
}
|
||||
|
||||
TEST_CASE("from_shared_ptr+as_unique_ptr_with_deleter", "[E]") {
|
||||
}
|
||||
TEST_CASE("from_shared_ptr+as_unique_ptr_with_deleter", "[E]") {}
|
||||
|
||||
TEST_CASE("from_shared_ptr+as_shared_ptr", "[S]") {
|
||||
std::shared_ptr<int> orig_owner(new int(19));
|
||||
smart_holder hld;
|
||||
hld.from_shared_ptr(orig_owner);
|
||||
REQUIRE(*hld.as_shared_ptr<int>() == 19);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user