Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r48687 - in sandbox/mirror: boost/mirror/algorithm libs/mirror/test
From: chochlik_at_[hidden]
Date: 2008-09-09 09:33:20


Author: matus.chochlik
Date: 2008-09-09 09:33:19 EDT (Tue, 09 Sep 2008)
New Revision: 48687
URL: http://svn.boost.org/trac/boost/changeset/48687

Log:
[mirror 0.2.x]
- Added the get_type_list algorithm for meta-object sequences
- Added several tests into the test suite

Added:
   sandbox/mirror/boost/mirror/algorithm/get_type_list.hpp (contents, props changed)
   sandbox/mirror/libs/mirror/test/classes_ct_05.cpp (contents, props changed)
   sandbox/mirror/libs/mirror/test/classes_ct_06.cpp (contents, props changed)
   sandbox/mirror/libs/mirror/test/classes_ct_07.cpp (contents, props changed)
   sandbox/mirror/libs/mirror/test/classes_rt_01.cpp (contents, props changed)
Text files modified:
   sandbox/mirror/libs/mirror/test/Jamfile.v2 | 4 ++++
   sandbox/mirror/libs/mirror/test/classes_ct_04.cpp | 2 +-
   2 files changed, 5 insertions(+), 1 deletions(-)

Added: sandbox/mirror/boost/mirror/algorithm/get_type_list.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/get_type_list.hpp 2008-09-09 09:33:19 EDT (Tue, 09 Sep 2008)
@@ -0,0 +1,86 @@
+/**
+ * \file boost/mirror/algorithm/get_type_list.hpp
+ * Gets the list of types from a meta-object-sequence.
+ * For meta_attributes it returns the types of reflected attributes,
+ * for meta_base_classes it returns the types of base classes, etc.
+ *
+ * Copyright 2008 Matus Chochlik. Distributed under the Boost
+ * Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#ifndef BOOST_MIRROR_ALGORITHM_GET_TYPE_LIST_HPP
+#define BOOST_MIRROR_ALGORITHM_GET_TYPE_LIST_HPP
+
+#include <boost/mpl/accumulate.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ /** Declaration of the default at_impl
+ * helper template.
+ */
+ template <class MetaObjectSequence>
+ struct get_type_list_impl { };
+
+ /** Specialization of at_impl<MetaObjectSequence>
+ * for meta_class_attributes<>
+ */
+ template <class Class, class VariantTag>
+ struct get_type_list_impl<meta_class_attributes<Class, VariantTag> >
+ {
+ typedef typename meta_class_attributes<
+ Class,
+ VariantTag
+ >::type_list type;
+ };
+
+ /** Specialization of for_each_impl<MetaObjectSequence>
+ * for meta_class_all_attributes<>
+ */
+ template <class Class, class VariantTag>
+ struct get_type_list_impl<meta_class_all_attributes<Class, VariantTag> >
+ {
+ typedef typename meta_class_all_attributes<
+ Class,
+ VariantTag
+ >::type_list type;
+ };
+
+ /** Specialization of for_each_impl<MetaObjectSequence>
+ * for meta_base_classes<>
+ */
+ template <class MetaInheritance>
+ struct get_type_list_impl_get_base_class
+ {
+ typedef typename MetaInheritance::base_class
+ type;
+ };
+ template <class Class, class VariantTag>
+ struct get_type_list_impl<meta_base_classes<Class, VariantTag> >
+ {
+ typedef typename mpl::accumulate<
+ typename meta_base_classes<
+ Class,
+ VariantTag
+ >::list,
+ mpl::vector0<>,
+ mpl::push_back<
+ mpl::_1,
+ get_type_list_impl_get_base_class< mpl::_2>
+ >
+ >::type type;
+
+ };
+
+} // namespace detail
+
+template <class MetaObjectSequence>
+struct get_type_list : detail::get_type_list_impl<MetaObjectSequence> { };
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Modified: sandbox/mirror/libs/mirror/test/Jamfile.v2
==============================================================================
--- sandbox/mirror/libs/mirror/test/Jamfile.v2 (original)
+++ sandbox/mirror/libs/mirror/test/Jamfile.v2 2008-09-09 09:33:19 EDT (Tue, 09 Sep 2008)
@@ -31,5 +31,9 @@
          [ compile classes_ct_02.cpp ]
          [ compile classes_ct_03.cpp ]
          [ compile classes_ct_04.cpp ]
+ [ compile classes_ct_05.cpp ]
+ [ compile classes_ct_06.cpp ]
+ [ compile classes_ct_07.cpp ]
+ [ run classes_rt_01.cpp ]
     ;
 

Modified: sandbox/mirror/libs/mirror/test/classes_ct_04.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/classes_ct_04.cpp (original)
+++ sandbox/mirror/libs/mirror/test/classes_ct_04.cpp 2008-09-09 09:33:19 EDT (Tue, 09 Sep 2008)
@@ -94,7 +94,7 @@
 
 test_suite* init_unit_test_suite( int argc, char* argv[] )
 {
- test_suite *test = BOOST_TEST_SUITE("Mirror: classes compile test 03");
+ test_suite *test = BOOST_TEST_SUITE("Mirror: classes compile test 04");
     test->add(BOOST_TEST_CASE(&test_main));
     return test;
 }

Added: sandbox/mirror/libs/mirror/test/classes_ct_05.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/classes_ct_05.cpp 2008-09-09 09:33:19 EDT (Tue, 09 Sep 2008)
@@ -0,0 +1,85 @@
+/**
+ * \file test/classes_ct_05.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing class registration and reflection.
+ *
+ * Tests the accumulate algorithm on meta_class attributes
+ * and checks the attribute types.
+ *
+ *
+ * Copyright 2008 Matus Chochlik. Distributed under the Boost
+ * Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+// MPL_ASSERT
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/equal.hpp>
+#include <boost/mpl/transform_view.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+//
+#include <boost/mirror/meta_class.hpp>
+#include <boost/mirror/algorithm/accumulate.hpp>
+#include <boost/mirror/meta_classes/boost_tuple.hpp>
+//
+#include "./test.hpp"
+
+#define BOOST_MIRROR_TEST_CL_CT_05_MPL_INT(Z, I, DATA) mpl::int_< I >
+
+template <typename MetaAttribute>
+struct get_attrib_type
+{
+ typedef typename MetaAttribute::type type;
+};
+
+void test_main()
+{
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ typedef tuples::tuple<
+ BOOST_PP_ENUM(9, BOOST_MIRROR_TEST_CL_CT_05_MPL_INT, 0)
+ > T;
+ T t;
+ typedef BOOST_MIRRORED_CLASS(T) meta_T;
+ //
+ // define a forward op
+ typedef mpl::lambda<mpl::push_back<
+ mpl::_1,
+ get_attrib_type<mpl::_2>
+ > >::type accumulate_op;
+ //
+ // use the accumulate algorithm to get the typelist
+ typedef accumulate<
+ meta_T::attributes,
+ mpl::vector0<>,
+ accumulate_op
+ >::type attrib_types_1;
+ //
+ // use the typelist from the meta_attribs
+ typedef meta_T::attributes::type_list
+ attrib_types_2;
+ //
+ // make a 'hand-made' list
+ typedef mpl::vector<
+ BOOST_PP_ENUM(9, BOOST_MIRROR_TEST_CL_CT_05_MPL_INT, 0)
+ > attrib_types_3;
+ //
+ // and compare them
+ BOOST_MPL_ASSERT(( mpl::equal<attrib_types_1, attrib_types_2> ));
+ BOOST_MPL_ASSERT(( mpl::equal<attrib_types_2, attrib_types_3> ));
+ BOOST_MPL_ASSERT(( mpl::equal<attrib_types_1, attrib_types_3> ));
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: classes compile test 05");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+

Added: sandbox/mirror/libs/mirror/test/classes_ct_06.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/classes_ct_06.cpp 2008-09-09 09:33:19 EDT (Tue, 09 Sep 2008)
@@ -0,0 +1,88 @@
+/**
+ * \file test/classes_ct_06.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing class registration and reflection.
+ *
+ * this test focuses (indirectly) on the registering,
+ * on the count of base classes, the size algorithm
+ * and cooperation with MPL.
+ *
+ * Copyright 2008 Matus Chochlik. Distributed under the Boost
+ * Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+// MPL
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/accumulate.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/equal_to.hpp>
+//
+#include <boost/mirror/meta_class.hpp>
+#include <boost/mirror/algorithm/size.hpp>
+//
+#include "./namespaces.hpp"
+#include "./classes.hpp"
+#include "./test.hpp"
+
+template <typename MetaClass>
+struct get_base_classes
+{
+ typedef typename MetaClass::base_classes type;
+};
+
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ typedef mpl::vector<
+ // < class, base_class_count >
+ mpl::vector< ::test::A, mpl::int_< 0> >,
+ mpl::vector< ::test::B, mpl::int_< 1> >,
+ mpl::vector< ::test::C, mpl::int_< 1> >,
+ mpl::vector< ::test::D, mpl::int_< 1> >,
+ mpl::vector< ::test::E, mpl::int_< 3> >,
+ mpl::vector< ::test::F, mpl::int_< 1> >,
+ mpl::vector< ::test::G, mpl::int_< 1> >,
+ mpl::vector< ::test::H, mpl::int_< 2> >,
+ mpl::vector< ::test::I, mpl::int_< 0> >,
+ mpl::vector< ::test::J, mpl::int_< 0> >,
+ mpl::vector< ::test::K, mpl::int_< 2> >
+ > some_classes;
+
+ // check the counts of base classes
+ BOOST_MPL_ASSERT(( mpl::accumulate<
+ some_classes,
+ mpl::true_,
+ mpl::and_<
+ mpl::_1,
+ mpl::equal_to<
+ mirror::size< get_base_classes<
+ BOOST_MIRRORED_CLASS(
+ mpl::front<mpl::_2>
+ )
+ > >,
+ mpl::at<mpl::_2, mpl::int_<1> >
+ >
+ >
+ >::type ));
+
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: classes compile test 06");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+

Added: sandbox/mirror/libs/mirror/test/classes_ct_07.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/classes_ct_07.cpp 2008-09-09 09:33:19 EDT (Tue, 09 Sep 2008)
@@ -0,0 +1,330 @@
+/**
+ * \file test/classes_ct_07.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing class registration and reflection.
+ *
+ * Tests the accumulate, at, size and get_type_list algorighms
+ * on own attributes and base classes of a reflected class
+ *
+ * Copyright 2008 Matus Chochlik. Distributed under the Boost
+ * Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+// MPL_ASSERT
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/accumulate.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/equal.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/lambda.hpp>
+//
+#include <boost/mirror/meta_class.hpp>
+#include <boost/mirror/algorithm/accumulate.hpp>
+#include <boost/mirror/algorithm/get_type_list.hpp>
+//
+#include "./namespaces.hpp"
+#include "./classes.hpp"
+#include "./test.hpp"
+
+using namespace ::boost;
+using namespace ::test;
+using namespace ::boost::mirror;
+
+
+template <typename MetaAttribute>
+struct get_attrib_type
+{
+ typedef typename MetaAttribute::type type;
+};
+
+template <typename MetaInheritance>
+struct get_base_class
+{
+ typedef typename MetaInheritance::base_class type;
+};
+
+
+/** Checks whether the reflected attribute type list
+ * is equal to the hard coded
+ */
+template <typename Tuple>
+struct test_own_att_list_1
+{
+ // the class
+ typedef typename mpl::at<Tuple, mpl::int_<0> >::type X;
+ // the meta class
+ typedef BOOST_MIRRORED_CLASS(X) meta_X;
+
+ // the list of meta-attributes for own attribs
+ typedef typename mpl::at<Tuple, mpl::int_<1> >::type
+ X_attrib_list;
+ //
+ // the reflected and the hard-coded lists need to be equal
+ typedef typename mpl::equal<
+ typename get_type_list<
+ typename meta_X::attributes
+ >::type,
+ X_attrib_list
+ >::type type;
+};
+
+/** Checks whether the attribute type list gathered as
+ * the result of the aggregate algorithm
+ * on the own attributes of a class, is equal
+ * to the hard coded list
+ */
+//
+typedef mpl::lambda<
+ mpl::push_back<
+ mpl::_1,
+ get_attrib_type< mpl::_2 >
+ >
+>::type accumulate_attrib_types;
+
+template <typename Tuple>
+struct test_own_att_list_2
+{
+ // the class
+ typedef typename mpl::at<Tuple, mpl::int_<0> >::type X;
+ // the meta class
+ typedef BOOST_MIRRORED_CLASS(X) meta_X;
+
+ // the list of meta-attributes for own attribs
+ typedef typename mpl::at<Tuple, mpl::int_<1> >::type
+ X_attrib_list;
+ //
+ //
+ // use the accumulate algorithm to get the typelist
+ typedef typename ::boost::mirror::accumulate<
+ typename meta_X::attributes,
+ mpl::vector0<>,
+ accumulate_attrib_types
+ >::type X_attrib_list_2;
+ //
+ typedef typename mpl::equal<
+ X_attrib_list,
+ X_attrib_list_2
+ >::type type;
+};
+
+/** Test the attribute count returned by mirror
+ */
+template <typename Tuple>
+struct test_own_att_count
+{
+ // the class
+ typedef typename mpl::at<Tuple, mpl::int_<0> >::type X;
+ // the meta class
+ typedef BOOST_MIRRORED_CLASS(X) meta_X;
+
+ // the list of meta-attributes for own attribs
+ typedef typename mpl::at<Tuple, mpl::int_<1> >::type
+ X_attrib_list;
+ //
+ //
+ // use the size algorithm to get the attrib count
+ typedef typename mpl::equal_to<
+ typename size<typename meta_X::attributes>::type,
+ typename mpl::size<X_attrib_list>::type
+ >::type type;
+
+};
+
+
+/** Checks whether the reflected base class list
+ * is equal to the hard coded
+ */
+template <typename Tuple>
+struct test_base_class_list_1
+{
+ // the class
+ typedef typename mpl::at<Tuple, mpl::int_<0> >::type X;
+ // the meta class
+ typedef BOOST_MIRRORED_CLASS(X) meta_X;
+
+ // the list of meta-attributes for own attribs
+ typedef typename mpl::at<Tuple, mpl::int_<2> >::type
+ X_base_class_list;
+ //
+ // the reflected and the hard-coded lists need to be equal
+ typedef typename mpl::equal<
+ typename get_type_list<
+ typename meta_X::base_classes
+ >::type,
+ X_base_class_list
+ >::type type;
+};
+
+/** Checks whether the base class list gathered as
+ * the result of the aggregate algorithm
+ * on the base classes of a class, is equal
+ * to the hard coded list
+ */
+//
+typedef mpl::lambda<
+ mpl::push_back<
+ mpl::_1,
+ get_base_class< mpl::_2 >
+ >
+>::type accumulate_base_classes;
+
+template <typename Tuple>
+struct test_base_class_list_2
+{
+ // the class
+ typedef typename mpl::at<Tuple, mpl::int_<0> >::type X;
+ // the meta class
+ typedef BOOST_MIRRORED_CLASS(X) meta_X;
+
+ // the list of meta-attributes for own attribs
+ typedef typename mpl::at<Tuple, mpl::int_<2> >::type
+ X_base_class_list;
+ //
+ // use the accumulate algorithm to get the typelist
+ typedef typename ::boost::mirror::accumulate<
+ typename meta_X::base_classes,
+ mpl::vector0<>,
+ accumulate_base_classes
+ >::type X_base_class_list_2;
+ //
+ typedef typename mpl::equal<
+ X_base_class_list,
+ X_base_class_list_2
+ >::type type;
+};
+
+/** Compares the reflected count of base classes to
+ * the hard coded one
+ */
+template <typename Tuple>
+struct test_base_class_count
+{
+ // the class
+ typedef typename mpl::at<Tuple, mpl::int_<0> >::type X;
+ // the meta class
+ typedef BOOST_MIRRORED_CLASS(X) meta_X;
+
+ // the list of meta-attributes for own attribs
+ typedef typename mpl::at<Tuple, mpl::int_<2> >::type
+ X_base_class_list;
+ //
+ //
+ // use the size algorithm to get the attrib count
+ typedef typename mpl::equal_to<
+ typename size<typename meta_X::base_classes>::type,
+ typename mpl::size<X_base_class_list>::type
+ >::type type;
+
+};
+
+/** helper meta-function template class used to 'run'
+ * the indivirual tests
+ */
+template <template <class> class Test>
+struct exec_test
+{
+ template <typename Status, typename Tuple>
+ struct op
+ {
+ typedef typename mpl::and_<
+ typename Test<Tuple>::type,
+ Status
+ >::type type;
+ };
+};
+/** 'Run' all the tests on the Elements of the
+ * list defined in test_main()
+ */
+template <template <class> class Test>
+void test_main_templ()
+{
+ typedef mpl::vector<
+ mpl::vector<
+ A,
+ mpl::vector3<long, long, long>,
+ mpl::vector0<>
+ >,
+ mpl::vector<
+ B,
+ mpl::vector2<int, int>,
+ mpl::vector1<A>
+ >,
+ mpl::vector<
+ C,
+ mpl::vector2<double, double>,
+ mpl::vector1<A>
+ >,
+ mpl::vector<
+ D,
+ mpl::vector2<const short, volatile short>,
+ mpl::vector1<A>
+ >,
+ mpl::vector<
+ E,
+ mpl::vector1<const float>,
+ mpl::vector3<B, C, D>
+ >,
+ mpl::vector<
+ F,
+ mpl::vector2<bool, bool>,
+ mpl::vector1<E>
+ >,
+ mpl::vector<
+ G,
+ mpl::vector3<char, char, char>,
+ mpl::vector1<E>
+ >,
+ mpl::vector<
+ H,
+ mpl::vector3<wchar_t, wchar_t, wchar_t>,
+ mpl::vector2<F, G>
+ >,
+ mpl::vector<
+ I,
+ mpl::vector1< ::std::string >,
+ mpl::vector0<>
+ >,
+ mpl::vector<
+ J,
+ mpl::vector1< ::std::wstring >,
+ mpl::vector0<>
+ >,
+ mpl::vector<
+ K,
+ mpl::vector2<int, int>,
+ mpl::vector2<I, J>
+ >
+ > classes_attribs_and_base_classes;
+ //
+ typedef exec_test<Test> executer;
+ typedef typename executer::template op< mpl::_1, mpl::_2> test_op;
+ //
+ // go through the list and execute
+ // the tests on each tuple <type, attribs, base_classes>
+ BOOST_MPL_ASSERT((
+ mpl::accumulate<
+ classes_attribs_and_base_classes,
+ mpl::true_,
+ test_op
+ >
+ ));
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: classes compile test suite 07");
+ test->add(BOOST_TEST_CASE(&test_main_templ<test_own_att_list_1>));
+ test->add(BOOST_TEST_CASE(&test_main_templ<test_own_att_list_2>));
+ test->add(BOOST_TEST_CASE(&test_main_templ<test_own_att_count>));
+ test->add(BOOST_TEST_CASE(&test_main_templ<test_base_class_list_1>));
+ test->add(BOOST_TEST_CASE(&test_main_templ<test_base_class_list_2>));
+ test->add(BOOST_TEST_CASE(&test_main_templ<test_base_class_count>));
+ return test;
+}
+
+

Added: sandbox/mirror/libs/mirror/test/classes_rt_01.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/classes_rt_01.cpp 2008-09-09 09:33:19 EDT (Tue, 09 Sep 2008)
@@ -0,0 +1,106 @@
+/**
+ * \file test/classes_ct_04.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing class registration and reflection.
+ *
+ * Tests the accumulate algorithm on meta_class attributes
+ * and checks the attribute types.
+ *
+ *
+ * Copyright 2008 Matus Chochlik. Distributed under the Boost
+ * Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#include <boost/mirror/meta_class.hpp>
+#include <boost/mirror/algorithm/for_each.hpp>
+//
+#include "./namespaces.hpp"
+#include "./classes.hpp"
+#include "./test.hpp"
+
+class cmp_att_base_names
+{
+public:
+ template <class MetaAttribute>
+ void operator()(MetaAttribute ma)
+ {
+ const int i = MetaAttribute::position::value;
+ all_match &= (ma.base_name() == names[i+offs]);
+ }
+
+ cmp_att_base_names(const ::boost::cts::bchar** _names, int _offs)
+ : names(_names)
+ , offs(_offs)
+ , all_match(true)
+ { }
+
+ bool result(void) const {return all_match;}
+private:
+ const ::boost::cts::bchar** names;
+ const int offs;
+ bool all_match;
+};
+
+void test_main()
+{
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ ::test::H h;
+ typedef BOOST_MIRRORED_CLASS(::test::H) meta_H;
+
+ // a hardcoded list of H's attribute names
+ const cts::bchar* att_base_names[] = {
+ BOOST_CTS_LIT("a1"),
+ BOOST_CTS_LIT("a2"),
+ BOOST_CTS_LIT("a3"),
+ BOOST_CTS_LIT("b1"),
+ BOOST_CTS_LIT("b2"),
+ BOOST_CTS_LIT("c1"),
+ BOOST_CTS_LIT("c2"),
+ BOOST_CTS_LIT("d1"),
+ BOOST_CTS_LIT("d2"),
+ BOOST_CTS_LIT("e"),
+ BOOST_CTS_LIT("f1"),
+ BOOST_CTS_LIT("f2"),
+ BOOST_CTS_LIT("g1"),
+ BOOST_CTS_LIT("g2"),
+ BOOST_CTS_LIT("g3"),
+ BOOST_CTS_LIT("h1"),
+ BOOST_CTS_LIT("h2"),
+ BOOST_CTS_LIT("h3")
+ };
+ {
+ // create the comparating functor
+ // 15 is the offset of the "h1" attrib which
+ // is the first own attribute of the H class
+ cmp_att_base_names test_op(att_base_names, 15);
+ // and call it for reflected own attribute
+ // of the H class
+ for_each<meta_H::attributes>(ref(test_op));
+ // check the result of the operation
+ BOOST_CHECK(( test_op.result() ));
+ }
+ {
+ // create the comparating functor
+ cmp_att_base_names test_op(att_base_names, 0);
+ // and call it for every reflected attribute
+ // of the H class
+ for_each<meta_H::all_attributes>(ref(test_op));
+ // check the result of the operation
+ BOOST_CHECK(( test_op.result() ));
+ }
+
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: classes run-time test 01");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk