Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51527 - sandbox/mirror/libs/mirror/test
From: chochlik_at_[hidden]
Date: 2009-03-02 03:58:04


Author: matus.chochlik
Date: 2009-03-02 03:58:03 EST (Mon, 02 Mar 2009)
New Revision: 51527
URL: http://svn.boost.org/trac/boost/changeset/51527

Log:
[mirror 0.3.x]
- testsuite update

Added:
   sandbox/mirror/libs/mirror/test/classes_rt_09.cpp (contents, props changed)
   sandbox/mirror/libs/mirror/test/classes_rt_10.cpp (contents, props changed)
Text files modified:
   sandbox/mirror/libs/mirror/test/Jamfile.v2 | 2 ++
   1 files changed, 2 insertions(+), 0 deletions(-)

Modified: sandbox/mirror/libs/mirror/test/Jamfile.v2
==============================================================================
--- sandbox/mirror/libs/mirror/test/Jamfile.v2 (original)
+++ sandbox/mirror/libs/mirror/test/Jamfile.v2 2009-03-02 03:58:03 EST (Mon, 02 Mar 2009)
@@ -45,6 +45,8 @@
          [ run classes_rt_06.cpp ]
          [ run classes_rt_07.cpp ]
          [ run classes_rt_08.cpp ]
+ [ run classes_rt_09.cpp ]
+ [ run classes_rt_10.cpp ]
          [ compile concepts_ct_01.cpp ]
          [ compile concepts_ct_02.cpp ]
          [ compile concepts_ct_03.cpp ]

Added: sandbox/mirror/libs/mirror/test/classes_rt_09.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/classes_rt_09.cpp 2009-03-02 03:58:03 EST (Mon, 02 Mar 2009)
@@ -0,0 +1,99 @@
+/**
+ * \file test/classes_ct_08.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing class registration and reflection.
+ *
+ * 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 "./test.hpp"
+
+
+namespace test {
+
+struct X
+{
+ int _1;
+ int _2;
+ int _3;
+ int _4;
+ int _5;
+ int _6;
+ int _7;
+ int _8;
+ int _9;
+};
+
+} // namespace test
+
+namespace boost {
+namespace mirror {
+
+BOOST_MIRROR_REG_TYPE(::test, X)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::X)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _1)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _2)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _3)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _4)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _5)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _6)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _7)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _8)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _9)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+} // namespace mirror
+} // namespace boost
+
+class offset_of_tester
+{
+private:
+ int current_offset;
+ int max_offset;
+public:
+ offset_of_tester(int max)
+ : current_offset(0)
+ , max_offset(max)
+ { }
+
+ template <class MetaAttribute>
+ void operator()(MetaAttribute ma)
+ {
+ BOOST_CHECK(current_offset <= ma.offset_of());
+ BOOST_CHECK(ma.offset_of() <= max_offset);
+ current_offset = ma.offset_of();
+ }
+};
+
+
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ typedef BOOST_MIRRORED_CLASS(::test::X) meta_X;
+ //
+ offset_of_tester t1(sizeof(::test::X));
+ for_each<meta_X::attributes>(ref(t1));
+ offset_of_tester t2(sizeof(::test::X));
+ for_each<meta_X::all_attributes>(ref(t2));
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: classes run-time test 09");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+

Added: sandbox/mirror/libs/mirror/test/classes_rt_10.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/classes_rt_10.cpp 2009-03-02 03:58:03 EST (Mon, 02 Mar 2009)
@@ -0,0 +1,194 @@
+/**
+ * \file test/classes_ct_08.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing class registration and reflection.
+ *
+ * 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 "./test.hpp"
+
+
+namespace test {
+
+struct X1
+{
+ int _1;
+};
+
+struct X2 : X1
+{
+ int _2;
+};
+
+struct X3 : X2
+{
+ int _3;
+};
+
+struct X4 : X3
+{
+ int _4;
+};
+
+struct X5 : X4
+{
+ int _5;
+};
+
+struct X6 : X5
+{
+ int _6;
+};
+
+struct X7 : X6
+{
+ int _7;
+};
+
+struct X8 : X7
+{
+ int _8;
+};
+
+struct X9 : X8
+{
+ int _9;
+};
+
+struct X : X9
+{ };
+
+} // namespace test
+
+namespace boost {
+namespace mirror {
+
+BOOST_MIRROR_REG_TYPE(::test, X1)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::X1)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _1)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_TYPE(::test, X2)
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::X2)
+ BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::X1)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::X2)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _2)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_TYPE(::test, X3)
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::X3)
+ BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::X2)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::X3)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _3)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_TYPE(::test, X4)
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::X4)
+ BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::X3)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::X4)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _4)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_TYPE(::test, X5)
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::X5)
+ BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::X4)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::X5)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _5)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_TYPE(::test, X6)
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::X6)
+ BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::X5)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::X6)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _6)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_TYPE(::test, X7)
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::X7)
+ BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::X6)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::X7)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _7)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_TYPE(::test, X8)
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::X8)
+ BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::X7)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::X8)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _8)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_TYPE(::test, X9)
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::X9)
+ BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::X8)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::X9)
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, _9)
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+BOOST_MIRROR_REG_TYPE(::test, X)
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::X)
+ BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::X9)
+BOOST_MIRROR_REG_BASE_CLASSES_END
+
+
+} // namespace mirror
+} // namespace boost
+
+class offset_of_tester
+{
+private:
+ int current_offset;
+ int max_offset;
+public:
+ offset_of_tester(int max)
+ : current_offset(0)
+ , max_offset(max)
+ { }
+
+ template <class MetaAttribute>
+ void operator()(MetaAttribute ma)
+ {
+ BOOST_CHECK(current_offset <= ma.offset_of());
+ BOOST_CHECK(ma.offset_of() <= max_offset);
+ current_offset = ma.offset_of();
+ }
+};
+
+
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ typedef BOOST_MIRRORED_CLASS(::test::X) meta_X;
+ //
+ offset_of_tester t(sizeof(::test::X));
+ for_each<meta_X::attributes>(ref(t));
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: classes run-time test 10");
+ 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