Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
010cdec1
Commit
010cdec1
authored
Feb 15, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning up changes to existing unit tests.
parent
fa54ccb3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
20 deletions
+28
-20
tests/test_class.cpp
+6
-1
tests/test_multiple_inheritance.cpp
+22
-19
tests/test_smart_ptr.cpp
+0
-0
No files found.
tests/test_class.cpp
View file @
010cdec1
...
...
@@ -23,6 +23,8 @@
# pragma warning(disable: 4324) // warning C4324: structure was padded due to alignment specifier
#endif
namespace
{
// test_brace_initialization
struct
NoBraceInitialization
{
NoBraceInitialization
(
std
::
vector
<
int
>
v
)
:
vec
{
std
::
move
(
v
)}
{}
...
...
@@ -32,14 +34,17 @@ struct NoBraceInitialization {
std
::
vector
<
int
>
vec
;
};
// test_mismatched_holder
struct
MismatchBase1
{
};
struct
MismatchDerived1
:
MismatchBase1
{
};
struct
MismatchBase2
{
};
struct
MismatchDerived2
:
MismatchBase2
{
};
// test_multiple_instances_with_same_pointer
struct
SamePointer
{};
}
// namespace
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MismatchBase1
,
std
::
shared_ptr
<
MismatchBase1
>
)
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MismatchDerived1
,
std
::
unique_ptr
<
MismatchDerived1
>
)
PYBIND11_SMART_POINTER_HOLDER_TYPE_CASTERS
(
MismatchBase2
,
std
::
unique_ptr
<
MismatchBase2
>
)
...
...
tests/test_multiple_inheritance.cpp
View file @
010cdec1
...
...
@@ -11,6 +11,8 @@
#include "pybind11_tests.h"
#include "constructor_stats.h"
namespace
{
// Many bases for testing that multiple inheritance from many classes (i.e. requiring extra
// space for holder constructed flags) works.
template
<
int
N
>
struct
BaseN
{
...
...
@@ -43,26 +45,27 @@ int WithStatic2::static_value2 = 2;
int
VanillaStaticMix1
::
static_value
=
12
;
int
VanillaStaticMix2
::
static_value
=
12
;
namespace
{
struct
Base1a
{
Base1a
(
int
i
)
:
i
(
i
)
{
}
int
foo
()
{
return
i
;
}
int
i
;
};
struct
Base2a
{
Base2a
(
int
i
)
:
i
(
i
)
{
}
int
bar
()
{
return
i
;
}
int
i
;
};
struct
Base12a
:
Base1a
,
Base2a
{
Base12a
(
int
i
,
int
j
)
:
Base1a
(
i
),
Base2a
(
j
)
{
}
};
// test_multiple_inheritance_virtbase
struct
Base1a
{
Base1a
(
int
i
)
:
i
(
i
)
{
}
int
foo
()
{
return
i
;
}
int
i
;
};
struct
Base2a
{
Base2a
(
int
i
)
:
i
(
i
)
{
}
int
bar
()
{
return
i
;
}
int
i
;
};
struct
Base12a
:
Base1a
,
Base2a
{
Base12a
(
int
i
,
int
j
)
:
Base1a
(
i
),
Base2a
(
j
)
{
}
};
struct
I801B1
{
int
a
=
1
;
I801B1
()
=
default
;
I801B1
(
const
I801B1
&
)
=
default
;
virtual
~
I801B1
()
=
default
;
};
struct
I801B2
{
int
b
=
2
;
I801B2
()
=
default
;
I801B2
(
const
I801B2
&
)
=
default
;
virtual
~
I801B2
()
=
default
;
};
struct
I801C
:
I801B1
,
I801B2
{};
struct
I801D
:
I801C
{};
// Indirect MI
// test_mi_unaligned_base
// test_mi_base_return
struct
I801B1
{
int
a
=
1
;
I801B1
()
=
default
;
I801B1
(
const
I801B1
&
)
=
default
;
virtual
~
I801B1
()
=
default
;
};
struct
I801B2
{
int
b
=
2
;
I801B2
()
=
default
;
I801B2
(
const
I801B2
&
)
=
default
;
virtual
~
I801B2
()
=
default
;
};
struct
I801C
:
I801B1
,
I801B2
{};
struct
I801D
:
I801C
{};
// Indirect MI
}
// namespace
...
...
tests/test_smart_ptr.cpp
View file @
010cdec1
This diff is collapsed.
Click to expand it.
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