Skip to content

Commit 93256dd

Browse files
committed
SH, shared_ptr copy/move, rename to 'history'
1 parent aea7c94 commit 93256dd

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tests/test_class_sh_shared_ptr_copy_move.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ const std::string fooNames[] = {"ShPtr_", "SmHld_"};
1313

1414
template <int SerNo>
1515
struct Foo {
16-
std::string mtxt;
17-
Foo(const std::string &mtxt_) : mtxt(mtxt_) {}
16+
std::string hisotry;
17+
Foo(const std::string &hisotry_) : hisotry(hisotry_) {}
1818
Foo(const Foo &other) = delete;
1919
Foo(Foo &&other) = delete;
20-
std::string get_text() const { return "Foo" + fooNames[SerNo] + mtxt; }
20+
std::string get_history() const { return "Foo" + fooNames[SerNo] + hisotry; }
2121
};
2222

2323
using FooShPtr = Foo<0>;
@@ -36,9 +36,9 @@ TEST_SUBMODULE(class_sh_shared_ptr_copy_move, m) {
3636
namespace py = pybind11;
3737

3838
py::class_<FooShPtr, std::shared_ptr<FooShPtr>>(m, "FooShPtr")
39-
.def("get_text", &FooShPtr::get_text);
39+
.def("get_history", &FooShPtr::get_history);
4040
py::classh<FooSmHld>(m, "FooSmHld")
41-
.def("get_text", &FooSmHld::get_text);
41+
.def("get_history", &FooSmHld::get_history);
4242

4343
m.def("test_ShPtr_copy", []() {
4444
auto o = std::make_shared<FooShPtr>("copy");

tests/test_class_sh_shared_ptr_copy_move.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55

66
def test_shptr_copy():
7-
txt = m.test_ShPtr_copy()[0].get_text()
7+
txt = m.test_ShPtr_copy()[0].get_history()
88
assert txt == "FooShPtr_copy"
99

1010

1111
def test_smhld_copy():
12-
txt = m.test_SmHld_copy()[0].get_text()
12+
txt = m.test_SmHld_copy()[0].get_history()
1313
assert txt == "FooSmHld_copy"
1414

1515

1616
def test_shptr_move():
17-
txt = m.test_ShPtr_move()[0].get_text()
17+
txt = m.test_ShPtr_move()[0].get_history()
1818
assert txt == "FooShPtr_move"
1919

2020

2121
def test_smhld_move():
22-
txt = m.test_SmHld_move()[0].get_text()
22+
txt = m.test_SmHld_move()[0].get_history()
2323
assert txt == "FooSmHld_move"

0 commit comments

Comments
 (0)