mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 06:02:14 +00:00
initial checkin
[SVN r13470]
This commit is contained in:
29
test/bienstman5.cpp
Normal file
29
test/bienstman5.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright David Abrahams 2002. Permission to copy, use,
|
||||
// modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/mpl/type_list.hpp>
|
||||
|
||||
#include <complex>
|
||||
|
||||
struct M {M(const std::complex<double>&) {} };
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(bienstman5_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
using boost::mpl::type_list;
|
||||
|
||||
module m("bienstman5_ext");
|
||||
|
||||
m
|
||||
.add(class_<M>("M")
|
||||
.def_init(args<std::complex<double> const&>()))
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
|
||||
16
test/bienstman5.py
Normal file
16
test/bienstman5.py
Normal file
@@ -0,0 +1,16 @@
|
||||
'''
|
||||
>>> from bienstman5_ext import *
|
||||
>>> m = M(1j)
|
||||
'''
|
||||
def run(args = None):
|
||||
import sys
|
||||
import doctest
|
||||
|
||||
if args is not None:
|
||||
sys.argv = args
|
||||
return doctest.testmod(sys.modules.get(__name__))
|
||||
|
||||
if __name__ == '__main__':
|
||||
print "running..."
|
||||
import sys
|
||||
sys.exit(run()[0])
|
||||
Reference in New Issue
Block a user