Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
69270b5d
Commit
69270b5d
authored
Jan 08, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Removing obsolete and very incomplete test (replaced by Catch2-based test).
parent
9abea632
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
81 deletions
+0
-81
tests/test_smart_holder_poc.cpp
tests/test_smart_holder_poc.cpp
+0
-73
tests/test_smart_holder_poc.py
tests/test_smart_holder_poc.py
+0
-8
No files found.
tests/test_smart_holder_poc.cpp
deleted
100644 → 0
View file @
9abea632
#include "pybind11_tests.h"
#include <pybind11/smart_holder_poc.h>
#include <iostream>
#include <string>
namespace
pybind11_tests
{
namespace
smart_holder_poc
{
inline
void
to_cout
(
std
::
string
msg
)
{
std
::
cout
<<
msg
<<
std
::
endl
;
}
template
<
typename
T
>
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
<
int
>
val
=
hld
.
as_shared_ptr
<
int
>
();
to_cout
(
std
::
to_string
(
*
val
));
}
{
std
::
unique_ptr
<
int
>
val
(
hld
.
as_raw_ptr_owned
<
int
>
());
to_cout
(
std
::
to_string
(
*
val
));
}
}
// namespace ;
{
std
::
unique_ptr
<
int
>
val
(
new
int
(
13
));
smart_holder
hld
;
hld
.
from_raw_ptr_unowned
(
val
.
get
());
to_cout
(
std
::
to_string
(
*
hld
.
as_raw_ptr_unowned
<
int
>
()));
}
{
std
::
unique_ptr
<
int
>
val
(
new
int
(
13
));
smart_holder
hld
;
hld
.
from_unique_ptr
(
std
::
move
(
val
));
to_cout
(
std
::
to_string
(
*
hld
.
as_raw_ptr_unowned
<
int
>
()));
}
{
smart_holder
hld
;
hld
.
from_raw_ptr_owned
(
new
int
(
13
));
to_cout
(
std
::
to_string
(
*
hld
.
as_unique_ptr
<
int
>
()));
}
{
std
::
unique_ptr
<
int
,
functor_builtin_delete
<
int
>>
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
<
int
>
()));
auto
unq_ptr_retrieved
=
hld
.
as_unique_ptr_with_deleter
<
int
,
functor_builtin_delete
<
int
>>
();
to_cout
(
std
::
to_string
(
hld
.
vptr
.
get
()
==
nullptr
));
to_cout
(
std
::
to_string
(
*
unq_ptr_retrieved
));
}
{
std
::
shared_ptr
<
int
>
val
(
new
int
(
13
));
smart_holder
hld
;
hld
.
from_shared_ptr
(
val
);
to_cout
(
std
::
to_string
(
*
hld
.
as_raw_ptr_unowned
<
int
>
()));
}
}
TEST_SUBMODULE
(
smart_holder_poc
,
m
)
{
m
.
def
(
"exercise"
,
exercise
);
}
}
// namespace smart_holder_poc
}
// namespace pybind11_tests
tests/test_smart_holder_poc.py
deleted
100644 → 0
View file @
9abea632
# -*- coding: utf-8 -*-
import
pytest
from
pybind11_tests
import
smart_holder_poc
as
m
def
test_exercise
():
m
.
exercise
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment