2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 16:32:16 +00:00

added more tests

[SVN r31786]
This commit is contained in:
Joel de Guzman
2005-11-26 15:13:20 +00:00
parent b0496d1207
commit ac32d13e10
2 changed files with 39 additions and 0 deletions

View File

@@ -26,6 +26,26 @@ std::string x_value(X const& x)
return "gotya " + x.s;
}
struct domain
{};
struct graph
{
typedef std::map <int, boost::shared_ptr <domain> > domains_t;
domains_t domains_;
};
// objects::class_value_wrapper <boost::shared_ptr<domain>,
// objects::make_ptr_instance <domain,
// objects::pointer_holder <boost::shared_ptr<domain>, domain> > > ();
BOOST_PYTHON_MODULE(map_indexing_suite_ext)
{
class_<X>("X")
@@ -58,6 +78,16 @@ BOOST_PYTHON_MODULE(map_indexing_suite_ext)
class_<std::map<std::string, boost::shared_ptr<X> > >("TestMap")
.def(map_indexing_suite<std::map<std::string, boost::shared_ptr<X> > >())
;
// Some more...
class_<domain, boost::shared_ptr <domain> > ("domain");
class_<graph::domains_t> ("domains_map")
.def (map_indexing_suite<graph::domains_t, true> ());
class_<graph> ("graph")
.def_readonly ("domains", &graph::domains_);
}
#include "module_tail.cpp"

View File

@@ -187,6 +187,15 @@ kiwi
>>> print_xmap(xm)
[ (joel, reset) (kim, reset) (mariel, reset) ]
#####################################################################
# Some more...
#####################################################################
>>> g = graph()
>>> for el in g.domains:
... print el.key(),
... dom = el.data()
#####################################################################
# END....
#####################################################################