Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.io.base
Commits
24627630
Commit
24627630
authored
Sep 13, 2016
by
Manuel Günther
Browse files
Implemented basic framework for C++-API tests
parent
067e88ef
Pipeline
#3677
failed with stage
in 36 minutes and 5 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/io/base/test.cpp
0 → 100644
View file @
24627630
/**
* @author Manuel Gunther
* @date Tue Sep 13 13:01:31 MDT 2016
*
* @brief Tests for bob::io::base
*/
#include <bob.io.base/api.h>
#include <bob.extension/documentation.h>
static
auto
s_test_api
=
bob
::
extension
::
FunctionDoc
(
"_test_api"
,
"Some tests for API functions"
)
.
add_prototype
(
""
);
static
PyObject
*
_test_api
(
PyObject
*
){
BOB_TRY
Py_RETURN_NONE
;
BOB_CATCH_FUNCTION
(
"_test_api"
,
0
)
}
static
PyMethodDef
module_methods
[]
=
{
{
s_test_api
.
name
(),
(
PyCFunction
)
_test_api
,
METH_NOARGS
,
s_test_api
.
doc
(),
},
{
0
}
/* Sentinel */
};
PyDoc_STRVAR
(
module_docstr
,
"Tests for bob::io::base"
);
#if PY_VERSION_HEX >= 0x03000000
static
PyModuleDef
module_definition
=
{
PyModuleDef_HEAD_INIT
,
BOB_EXT_MODULE_NAME
,
module_docstr
,
-
1
,
module_methods
,
0
,
0
,
0
,
0
};
#endif
static
PyObject
*
create_module
(
void
)
{
# if PY_VERSION_HEX >= 0x03000000
PyObject
*
m
=
PyModule_Create
(
&
module_definition
);
auto
m_
=
make_xsafe
(
m
);
const
char
*
ret
=
"O"
;
# else
PyObject
*
m
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
const
char
*
ret
=
"N"
;
# endif
if
(
!
m
)
return
0
;
return
Py_BuildValue
(
ret
,
m
);
}
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
# if PY_VERSION_HEX >= 0x03000000
return
# endif
create_module
();
}
bob/io/base/test_cpp.py
0 → 100644
View file @
24627630
from
._test
import
_test_api
def
test_cpp
():
_test_api
()
setup.py
View file @
24627630
...
...
@@ -227,6 +227,20 @@ setup(
packages
=
packages
,
boost_modules
=
boost_modules
,
),
Extension
(
"bob.io.base._test"
,
[
"bob/io/base/test.cpp"
,
],
library_dirs
=
library_dirs
,
libraries
=
libraries
,
define_macros
=
define_macros
,
system_include_dirs
=
system_include_dirs
,
version
=
version
,
bob_packages
=
bob_packages
,
packages
=
packages
,
boost_modules
=
boost_modules
,
),
],
cmdclass
=
{
...
...
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