From eac3f3d9ad26d7d667cead61befad37233d879d3 Mon Sep 17 00:00:00 2001 From: Raoul Gough Date: Tue, 9 Sep 2003 18:26:11 +0000 Subject: [PATCH] Python extension module with various indexing suite instantiations for testing [SVN r1513] --- .../boost/python/suite/indexing/testsuite.cpp | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 include/boost/python/suite/indexing/testsuite.cpp diff --git a/include/boost/python/suite/indexing/testsuite.cpp b/include/boost/python/suite/indexing/testsuite.cpp new file mode 100755 index 00000000..426b3e0d --- /dev/null +++ b/include/boost/python/suite/indexing/testsuite.cpp @@ -0,0 +1,67 @@ +// -*- mode:c++ -*- +// +// Module testsuite.cpp +// +// Copyright (c) 2003 Raoul M. Gough +// +// This material is provided "as is", with absolutely no warranty expressed +// or implied. Any use is at your own risk. +// +// Permission to use or copy this material for any purpose is hereby +// granted without fee, provided the above notices are retained on all +// copies. Permission to modify the material and to distribute modified +// versions is granted, provided the above notices are retained, and a +// notice that the material was modified is included with the above +// copyright notice. +// +// History +// ======= +// 2003/ 9/ 8 rmg File creation +// +// $Id$ +// + +#include "container_suite.hpp" + +#include +#include +#include +#include +#include +#include + +#include "iterator_pair.hpp" + +indexing::iterator_pair getArray() +{ + static int array[] = { 8, 7, 6, 5, 4, 3, 2, 1, 0 }; + + return indexing::iterator_pair(indexing::begin(array) + , indexing::end(array)); +} + +BOOST_PYTHON_MODULE(testsuite) +{ + typedef std::vector Container1; + + boost::python::class_("Vector") + .def (indexing::container_suite()); + + typedef std::list Container2; + + boost::python::class_("List") + .def (indexing::container_suite()); + + typedef std::map Container3; + + boost::python::class_("Map") + .def (indexing::container_suite()); + + typedef indexing::iterator_pair Container4; + + boost::python::class_("Array" + , boost::python::init()) + .def (indexing::container_suite()); + + boost::python::def ("getArray", getArray); +}