File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ bpl-test crossmod_exception
108108[ bpl-test exception_translator ]
109109[ bpl-test pearu1 : test_cltree.py cltree.cpp ]
110110[ bpl-test try : newtest.py m1.cpp m2.cpp ]
111+ [ bpl-test const_argument ]
111112
112113[ bpl-test keywords : keywords.cpp keywords_test.py ]
113114
Original file line number Diff line number Diff line change 1+ /* Copyright 2004 Jonathan Brandmeyer
2+ * Use, modification and distribution are subject to the
3+ * Boost Software License, Version 1.0. (See accompanying file
4+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5+ *
6+ * The purpose of this test is to determine if a function can be called from
7+ * Python with a const value type as an argument, and whether or not the
8+ * presence of a prototype without the cv-qualifier will work around the
9+ * compiler's bug.
10+ */
11+ #include < boost/python.hpp>
12+ using namespace boost ::python;
13+
14+ bool accept_const_arg_noproto ( const object)
15+ {
16+ return true ;
17+ }
18+
19+ bool accept_const_arg_with_proto ( object);
20+ bool accept_const_arg_with_proto ( const object)
21+ {
22+ return true ;
23+ }
24+
25+ BOOST_PYTHON_MODULE ( const_argument_ext)
26+ {
27+ def ( " accept_const_arg_noproto" , accept_const_arg_noproto);
28+ def ( " accept_const_arg_with_proto" , accept_const_arg_with_proto);
29+ }
30+
Original file line number Diff line number Diff line change 1+ # Copyright Jonathan Brandmeyer, 2004. Distributed under the Boost
2+ # Software License, Version 1.0 (See accompanying
3+ # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4+ """
5+ >>> from const_argument_ext import *
6+ >>> accept_const_arg_noproto(1)
7+ 1
8+ >>> accept_const_arg_with_proto(1)
9+ 1
10+ """
11+
12+ def run (args = None ):
13+ import sys
14+ import doctest
15+
16+ if args is not None :
17+ sys .argv = args
18+ return doctest .testmod (sys .modules .get (__name__ ))
19+
20+ if __name__ == '__main__' :
21+ print "running..."
22+ import sys
23+ status = run ()[0 ]
24+ if (status == 0 ): print "Done."
25+ sys .exit (status )
You can’t perform that action at this time.
0 commit comments