From 69270b5ddee56c1fa95c555fc01c03146ae9a83f Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 8 Jan 2021 16:43:35 -0800 Subject: [PATCH] Removing obsolete and very incomplete test (replaced by Catch2-based test). --- tests/test_smart_holder_poc.cpp | 73 --------------------------------- tests/test_smart_holder_poc.py | 8 ---- 2 files changed, 81 deletions(-) delete mode 100644 tests/test_smart_holder_poc.cpp delete mode 100644 tests/test_smart_holder_poc.py diff --git a/tests/test_smart_holder_poc.cpp b/tests/test_smart_holder_poc.cpp deleted file mode 100644 index 8a750c444..000000000 --- a/tests/test_smart_holder_poc.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "pybind11_tests.h" - -#include - -#include -#include - -namespace pybind11_tests { -namespace smart_holder_poc { - -inline void to_cout(std::string msg) { std::cout << msg << std::endl; } - -template -struct functor_builtin_delete { - void operator()(T* ptr) { delete ptr; } -}; - -inline void exercise() { - to_cout(""); - using pybindit::memory::smart_holder; - { - smart_holder hld; - hld.from_raw_ptr_owned(new int(13)); - to_cout(hld.rtti_held->name()); - { - std::shared_ptr val = hld.as_shared_ptr(); - to_cout(std::to_string(*val)); - } - { - std::unique_ptr val(hld.as_raw_ptr_owned()); - to_cout(std::to_string(*val)); - } - } // namespace ; - { - std::unique_ptr val(new int(13)); - smart_holder hld; - hld.from_raw_ptr_unowned(val.get()); - to_cout(std::to_string(*hld.as_raw_ptr_unowned())); - } - { - std::unique_ptr val(new int(13)); - smart_holder hld; - hld.from_unique_ptr(std::move(val)); - to_cout(std::to_string(*hld.as_raw_ptr_unowned())); - } - { - smart_holder hld; - hld.from_raw_ptr_owned(new int(13)); - to_cout(std::to_string(*hld.as_unique_ptr())); - } - { - std::unique_ptr> unq_ptr(new int(13)); - smart_holder hld; - hld.from_unique_ptr_with_deleter(std::move(unq_ptr)); - to_cout(std::to_string(unq_ptr.get() == nullptr)); - to_cout(std::to_string(*hld.as_raw_ptr_unowned())); - auto unq_ptr_retrieved = - hld.as_unique_ptr_with_deleter>(); - to_cout(std::to_string(hld.vptr.get() == nullptr)); - to_cout(std::to_string(*unq_ptr_retrieved)); - } - { - std::shared_ptr val(new int(13)); - smart_holder hld; - hld.from_shared_ptr(val); - to_cout(std::to_string(*hld.as_raw_ptr_unowned())); - } -} - -TEST_SUBMODULE(smart_holder_poc, m) { m.def("exercise", exercise); } - -} // namespace smart_holder_poc -} // namespace pybind11_tests diff --git a/tests/test_smart_holder_poc.py b/tests/test_smart_holder_poc.py deleted file mode 100644 index 1606e0cf4..000000000 --- a/tests/test_smart_holder_poc.py +++ /dev/null @@ -1,8 +0,0 @@ -# -*- coding: utf-8 -*- -import pytest - -from pybind11_tests import smart_holder_poc as m - - -def test_exercise(): - m.exercise()