$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: oryol_at_[hidden]
Date: 2008-07-24 23:33:53
Author: jeremypack
Date: 2008-07-24 23:33:53 EDT (Thu, 24 Jul 2008)
New Revision: 47785
URL: http://svn.boost.org/trac/boost/changeset/47785
Log:
inheritance_test
Multiple and virtual inheritance reflected.
Added:
   sandbox/libs/reflection/test/inheritance_test.cpp   (contents, props changed)
Text files modified: 
   sandbox/libs/reflection/test/Jamfile.v2 |     1 +                                       
   1 files changed, 1 insertions(+), 0 deletions(-)
Modified: sandbox/libs/reflection/test/Jamfile.v2
==============================================================================
--- sandbox/libs/reflection/test/Jamfile.v2	(original)
+++ sandbox/libs/reflection/test/Jamfile.v2	2008-07-24 23:33:53 EDT (Thu, 24 Jul 2008)
@@ -25,6 +25,7 @@
 
 test-suite reflection_tests_all
 : 
+  [ run inheritance_test.cpp ]
   [ run parameter_map_test.cpp ]
   [ run basic_test.cpp ] 
   [ run single_param_test.cpp ]
Added: sandbox/libs/reflection/test/inheritance_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/reflection/test/inheritance_test.cpp	2008-07-24 23:33:53 EDT (Thu, 24 Jul 2008)
@@ -0,0 +1,93 @@
+/*
+ * Boost.Reflection / inheritance tests
+ *
+ * (C) Copyright Jeremy Pack 2008
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
+#include <string>
+#include <iostream>
+
+#define BOOST_TEST_MAIN
+#define BOOST_TEST_DYN_LINK 1
+#include <boost/test/unit_test.hpp>
+#include <boost/reflection/reflection.hpp>
+#include <iostream>
+
+using namespace boost::reflections;
+
+class A {
+ public:
+  virtual ~A() {}
+  virtual char get_val() {
+    return 'A';
+  }
+};
+
+class B : public A {
+ public:
+  virtual char get_val() {
+    return 'B';
+  }
+};
+
+class C : virtual public A {
+ public:
+  virtual char get_val() {
+    return 'C';
+  }
+};
+
+class D : virtual public A {
+ public:
+  virtual char get_val() {
+    return 'D';
+  }
+};
+
+class E : public D, public C {
+ public:
+  virtual char get_val() {
+    return 'E';
+  }
+};
+
+class DSub : public D {
+ public:
+};
+
+template <class T, char Name>
+void TestClass() {
+  reflection r;
+  r.reflect<T>()
+   .constructor()
+   .function(&T::get_val, "get_val");
+
+  instance i = r.get_constructor()();
+  BOOST_CHECK_EQUAL(Name, r.get_function<char>("get_val")(i));
+
+}
+
+BOOST_AUTO_TEST_CASE(shared_library_basic_test) {
+  TestClass<A, 'A'>();
+  TestClass<B, 'B'>();
+  TestClass<C, 'C'>();
+  TestClass<D, 'D'>();
+  TestClass<E, 'E'>();
+  // TestClass<DSub, 'D'>();
+}
+
+BOOST_AUTO_TEST_CASE(DSubTest) {
+  reflection r;
+  r.reflect<DSub>()
+   .constructor()
+   .function(&DSub::get_val, "get_val");
+
+  instance i = r.get_constructor()();
+  BOOST_CHECK_EQUAL('D', r.get_function<char>("get_val")(i));
+}
\ No newline at end of file