|
Boost-Commit : |
From: chochlik_at_[hidden]
Date: 2008-05-02 11:31:04
Author: matus.chochlik
Date: 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
New Revision: 45024
URL: http://svn.boost.org/trac/boost/changeset/45024
Log:
Several tests and a Jamfile added to the libs/mirror/test subdir
Added:
sandbox/mirror/libs/mirror/test/Jamfile.v2 (contents, props changed)
sandbox/mirror/libs/mirror/test/namespaces.hpp (contents, props changed)
sandbox/mirror/libs/mirror/test/namespaces_cf_01.cpp (contents, props changed)
sandbox/mirror/libs/mirror/test/namespaces_ct_01.cpp (contents, props changed)
sandbox/mirror/libs/mirror/test/namespaces_ct_02.cpp (contents, props changed)
sandbox/mirror/libs/mirror/test/namespaces_ct_03.cpp (contents, props changed)
sandbox/mirror/libs/mirror/test/namespaces_ct_04.cpp (contents, props changed)
sandbox/mirror/libs/mirror/test/namespaces_rt_01.cpp (contents, props changed)
sandbox/mirror/libs/mirror/test/namespaces_rt_02.cpp (contents, props changed)
sandbox/mirror/libs/mirror/test/test.hpp (contents, props changed)
Text files modified:
sandbox/mirror/boost/mirror/detail/array_type_name.hpp | 35 ++++++++++++++++++++++++++++++++++-
sandbox/mirror/boost/mirror/meta_type.hpp | 18 ++++++++++++++++++
sandbox/mirror/boost/mirror/traits/reflects_global_scope.hpp | 1 +
sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml | 7 +++++--
4 files changed, 58 insertions(+), 3 deletions(-)
Modified: sandbox/mirror/boost/mirror/detail/array_type_name.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/detail/array_type_name.hpp (original)
+++ sandbox/mirror/boost/mirror/detail/array_type_name.hpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -60,7 +60,40 @@
}
};
-template <class meta_type, size_t array_size>
+template <class meta_type, bool base_name>
+struct static_array_type_name_base<meta_type, mpl::int_<-1>, base_name>
+{
+protected:
+ typedef nontrivial_type_base_or_full_name<meta_type, base_name>
+ name_info;
+
+ BOOST_STATIC_CONSTANT(
+ size_t,
+ name_length =
+ name_info::name_length + 3
+ );
+
+ static void init_name(bchar* the_name)
+ {
+ bchar* cur_pos = the_name;
+ //
+ // copy the name of the template
+ bstrcpy(cur_pos, name_info::name());
+ cur_pos += name_info::name_length;
+ //
+ // append the " []"
+ *(cur_pos++) = BOOST_STR_LIT(' ');
+ *(cur_pos++) = BOOST_STR_LIT('[');
+ *(cur_pos++) = BOOST_STR_LIT(']');
+ //
+ // finalize the string
+ assert(cur_pos == (the_name + name_length));
+ *cur_pos = BOOST_STR_LIT('\0');
+ }
+};
+
+
+template <class meta_type, int array_size>
struct static_array_type_name : static_nontrivial_type_name<
meta_type, mpl::int_<array_size>, static_array_type_name_base
>{ };
Modified: sandbox/mirror/boost/mirror/meta_type.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_type.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_type.hpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -218,6 +218,24 @@
typedef element_type reflected_type[size];
};
+template <class element_type>
+struct meta_type<const element_type[]> : detail::static_array_type_name<
+ meta_type<const element_type>, -1
+>
+{
+ typedef typename meta_type<element_type>::scope scope;
+ typedef element_type const reflected_type[];
+};
+
+template <class element_type>
+struct meta_type<element_type[]> : detail::static_array_type_name<
+ meta_type<element_type>, -1
+>
+{
+ typedef typename meta_type<element_type>::scope scope;
+ typedef element_type reflected_type[];
+};
+
/** Meta-types for references
*/
template <class refered_to_type>
Modified: sandbox/mirror/boost/mirror/traits/reflects_global_scope.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/traits/reflects_global_scope.hpp (original)
+++ sandbox/mirror/boost/mirror/traits/reflects_global_scope.hpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -13,6 +13,7 @@
// true type/false type for trait templates
#include <boost/type_traits/integral_constant.hpp>
+#include <boost/mirror/meta_namespace.hpp>
namespace boost {
namespace mirror {
Modified: sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml
==============================================================================
--- sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml (original)
+++ sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -118,12 +118,15 @@
- Added example showing class structure traversal
- Tested only with MSVC++ 2008 EE, so may fail to compile with other compilers
</revision>
- <revision id="20080502" major="0" minor="1" micro="17" author="m_ch">
+ <revision id="20080502_1200CET" major="0" minor="1" micro="17" author="m_ch">
- A temporary workaround, which may cause memory-leak reports
on program exit, has been introduced. This should be fixed ASAP.
- Tested and successfully compiled with MSVC++ 2008 EE on Vista
gcc 4.2.1 and gcc 4.3.0 on OpenSuSE
-
+ </revision>
+ <revision id="20080502_1730CET" major="0" minor="1" micro="18" author="m_ch">
+ - Several tests and a Jamfile added to the libs/mirror/test subdir
+ - Added meta-type for arrays with undefined element count
</revision>
</revisions>
</library>
Added: sandbox/mirror/libs/mirror/test/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/Jamfile.v2 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -0,0 +1,24 @@
+# (C) 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)
+
+import testing ;
+
+project
+ : requirements
+ <include>../../../ #the mirror library root
+ <toolset>gcc:<cxxflags>-ftemplate-depth-1024
+ <library>/boost/test//boost_unit_test_framework
+ <link>static
+ ;
+
+test-suite "mirror"
+ : [ run namespaces_rt_01.cpp ]
+ [ run namespaces_rt_02.cpp ]
+ [ compile namespaces_ct_01.cpp ]
+ [ compile namespaces_ct_02.cpp ]
+ [ compile namespaces_ct_03.cpp ]
+ [ compile namespaces_ct_04.cpp ]
+ [ compile-fail namespaces_cf_01.cpp ]
+ ;
+
Added: sandbox/mirror/libs/mirror/test/namespaces.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/namespaces.hpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -0,0 +1,50 @@
+/**
+ * \file test/namespaces.hpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing namespaces 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)
+ */
+#ifndef BOOST_MIRROR_LIBS_MIRROR_TEST_NAMESPACES_HPP
+#define BOOST_MIRROR_LIBS_MIRROR_TEST_NAMESPACES_HPP
+
+// namespace registering
+#include <boost/mirror/meta_namespace.hpp>
+
+namespace test {
+namespace feature {
+namespace detail {
+
+} // namespace detail
+} // namespace feature
+
+namespace stuff {
+namespace detail {
+
+} // namespace detail
+} // namespace stuff
+} // namespace test
+
+
+namespace boost {
+namespace mirror {
+
+// register the namespaces
+//
+BOOST_MIRROR_REG_META_NAMESPACE_TOP_LEVEL(test)
+//
+BOOST_MIRROR_REG_META_NAMESPACE(_test, feature)
+BOOST_MIRROR_REG_META_NAMESPACE(_test_feature, detail)
+//
+BOOST_MIRROR_REG_META_NAMESPACE(_test, stuff)
+BOOST_MIRROR_REG_META_NAMESPACE(_test_stuff, detail)
+
+} // namespace mirror
+} // namespace boost
+
+#endif // include guard
+
Added: sandbox/mirror/libs/mirror/test/namespaces_cf_01.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/namespaces_cf_01.cpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -0,0 +1,36 @@
+/**
+ * \file test/namespaces_cf_01.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing namespaces 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)
+ */
+
+// namespace registering
+#include <boost/mirror/traits/reflects_namespace.hpp>
+//
+#include "./namespaces.hpp"
+#include "./test.hpp"
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ // no such namespace registered
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_foo) meta_ns_foo;
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: namespaces compile-fail test 01");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+
Added: sandbox/mirror/libs/mirror/test/namespaces_ct_01.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/namespaces_ct_01.cpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -0,0 +1,52 @@
+/**
+ * \file test/namespaces_ct_01.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing namespaces 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)
+ */
+
+// not operator
+#include <boost/mpl/not.hpp>
+// namespace registering
+#include <boost/mirror/traits/reflects_global_scope.hpp>
+//
+#include "./namespaces.hpp"
+#include "./test.hpp"
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ // define an alternative name for the global scope meta-data
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_) meta_ns_;
+ BOOST_STATIC_ASSERT( reflects_global_scope<meta_ns_>::value );
+ //
+ // define an alternative name for the ::test namespace meta-data
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test) meta_ns_test;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff) meta_ns_test_stuff;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) meta_ns_test_stuff_detail;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature) meta_ns_test_feature;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature_detail) meta_ns_test_feature_detail;
+ //
+ BOOST_STATIC_ASSERT( mpl::not_<reflects_global_scope<meta_ns_test> >::value );
+ BOOST_STATIC_ASSERT( mpl::not_<reflects_global_scope<meta_ns_test_stuff> >::value );
+ BOOST_STATIC_ASSERT( mpl::not_<reflects_global_scope<meta_ns_test_stuff_detail> >::value );
+ BOOST_STATIC_ASSERT( mpl::not_<reflects_global_scope<meta_ns_test_feature> >::value );
+ BOOST_STATIC_ASSERT( mpl::not_<reflects_global_scope<meta_ns_test_feature_detail> >::value );
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: namespaces compile test 01");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+
Added: sandbox/mirror/libs/mirror/test/namespaces_ct_02.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/namespaces_ct_02.cpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -0,0 +1,49 @@
+/**
+ * \file test/namespaces_ct_02.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing namespaces 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)
+ */
+
+// namespace registering
+#include <boost/mirror/traits/reflects_namespace.hpp>
+//
+#include "./namespaces.hpp"
+#include "./test.hpp"
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ // define an alternative name for the global scope meta-data
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_) meta_ns_;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test) meta_ns_test;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff) meta_ns_test_stuff;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) meta_ns_test_stuff_detail;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature) meta_ns_test_feature;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature_detail) meta_ns_test_feature_detail;
+ //
+ //
+ BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_>::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_test>::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_test_stuff>::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_test_stuff_detail>::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_test_feature>::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<meta_ns_test_feature_detail>::value );
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: namespaces compile test 02");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+
Added: sandbox/mirror/libs/mirror/test/namespaces_ct_03.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/namespaces_ct_03.cpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -0,0 +1,52 @@
+/**
+ * \file test/namespaces_ct_03.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing namespaces 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)
+ */
+
+// namespace registering
+#include <boost/mirror/traits/reflects_namespace.hpp>
+//
+#include "./namespaces.hpp"
+#include "./test.hpp"
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_NAMESPACE(_)
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_NAMESPACE(_test)
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff)
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail)
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature)
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature_detail)
+ >::value );
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: namespaces compile test 03");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+
Added: sandbox/mirror/libs/mirror/test/namespaces_ct_04.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/namespaces_ct_04.cpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -0,0 +1,77 @@
+/**
+ * \file test/namespaces_ct_04.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing namespaces 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/mpl/not.hpp>
+#include <boost/type_traits/is_same.hpp>
+// namespace registering
+#include <boost/mirror/traits/reflects_namespace.hpp>
+// base meta-types
+#include <boost/mirror/meta_type.hpp>
+//
+#include "./namespaces.hpp"
+#include "./test.hpp"
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_TYPE(bool) :: scope
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_TYPE(char) :: scope
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_TYPE(int) :: scope
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_TYPE(double) :: scope
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_TYPE(void*) :: scope
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_TYPE(int const * const *) :: scope
+ >::value );
+ BOOST_STATIC_ASSERT( reflects_namespace<
+ BOOST_MIRROR_REFLECT_TYPE(char volatile * const &) :: scope
+ >::value );
+ //
+ BOOST_STATIC_ASSERT(( is_same<
+ BOOST_MIRROR_REFLECT_TYPE(const char* []) :: scope,
+ BOOST_MIRROR_REFLECT_TYPE(int volatile &) :: scope
+ >::value ));
+
+ BOOST_STATIC_ASSERT(( is_same<
+ BOOST_MIRROR_REFLECT_TYPEDEFD(_boost, bchar) :: scope,
+ BOOST_MIRROR_REFLECT_TYPEDEFD(_boost, bstring) :: scope
+ >::value ));
+ BOOST_STATIC_ASSERT(( mpl::not_<is_same<
+ BOOST_MIRROR_REFLECT_TYPEDEFD(_boost, bchar) :: scope,
+ BOOST_MIRROR_REFLECT_TYPE(char) :: scope
+ > >::value ));
+ BOOST_STATIC_ASSERT(( mpl::not_<is_same<
+ BOOST_MIRROR_REFLECT_TYPEDEFD(_boost, bchar) :: scope,
+ BOOST_MIRROR_REFLECT_TYPE(wchar_t) :: scope
+ > >::value ));
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: namespaces compile test 04");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+
Added: sandbox/mirror/libs/mirror/test/namespaces_rt_01.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/namespaces_rt_01.cpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -0,0 +1,61 @@
+/**
+ * \file test/namespaces.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing namespaces 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/traits/reflects_global_scope.hpp>
+#include "./namespaces.hpp"
+#include "./test.hpp"
+
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ //
+ // define an alternative name for the ::test namespace meta-data
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test) meta_ns_test;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff) meta_ns_test_stuff;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) meta_ns_test_stuff_detail;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature) meta_ns_test_feature;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature_detail) meta_ns_test_feature_detail;
+ //
+ BOOST_CHECK(bstrcmp(
+ meta_ns_test::base_name(),
+ BOOST_STR_LIT("test")
+ ) == 0);
+ BOOST_CHECK(bstrcmp(
+ meta_ns_test_stuff::base_name(),
+ BOOST_STR_LIT("stuff")
+ ) == 0);
+ BOOST_CHECK(bstrcmp(
+ meta_ns_test_stuff_detail::base_name(),
+ BOOST_STR_LIT("detail")
+ ) == 0);
+ BOOST_CHECK(bstrcmp(
+ meta_ns_test_feature::base_name(),
+ BOOST_STR_LIT("feature")
+ ) == 0);
+ BOOST_CHECK(bstrcmp(
+ meta_ns_test_feature_detail::base_name(),
+ BOOST_STR_LIT("detail")
+ ) == 0);
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: namespaces run-time test 01");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+
Added: sandbox/mirror/libs/mirror/test/namespaces_rt_02.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/namespaces_rt_02.cpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -0,0 +1,65 @@
+/**
+ * \file test/namespaces.cpp
+ *
+ * This file is part of the Mirror library testsuite.
+ *
+ * Testing namespaces 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/traits/reflects_global_scope.hpp>
+#include "./namespaces.hpp"
+#include "./test.hpp"
+
+
+void test_main()
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ //
+ // define an alternative name for the global scope meta-data
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_) meta_ns_;
+ BOOST_STATIC_ASSERT( reflects_global_scope<meta_ns_>::value );
+ //
+ // define an alternative name for the ::test namespace meta-data
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test) meta_ns_test;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff) meta_ns_test_stuff;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_stuff_detail) meta_ns_test_stuff_detail;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature) meta_ns_test_feature;
+ typedef BOOST_MIRROR_REFLECT_NAMESPACE(_test_feature_detail) meta_ns_test_feature_detail;
+ //
+ BOOST_CHECK(bstrcmp(
+ meta_ns_test::full_name(),
+ BOOST_STR_LIT("::test")
+ ) == 0);
+ BOOST_CHECK(bstrcmp(
+ meta_ns_test_stuff::full_name(),
+ BOOST_STR_LIT("::test::stuff")
+ ) == 0);
+ BOOST_CHECK(bstrcmp(
+ meta_ns_test_stuff_detail::full_name(),
+ BOOST_STR_LIT("::test::stuff::detail")
+ ) == 0);
+ BOOST_CHECK(bstrcmp(
+ meta_ns_test_feature::full_name(),
+ BOOST_STR_LIT("::test::feature")
+ ) == 0);
+ BOOST_CHECK(bstrcmp(
+ meta_ns_test_feature_detail::full_name(),
+ BOOST_STR_LIT("::test::feature::detail")
+ ) == 0);
+}
+
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("Mirror: namespaces run-time test 02");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+
Added: sandbox/mirror/libs/mirror/test/test.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/test/test.hpp 2008-05-02 11:31:02 EDT (Fri, 02 May 2008)
@@ -0,0 +1,19 @@
+/**
+ * \file test/test.hpp
+ *
+ * This file is part of the Mirror library testsuite.
+ * Common definitions.
+ *
+ * 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_LIBS_MIRROR_TEST_TEST_HPP
+#define BOOST_MIRROR_LIBS_MIRROR_TEST_TEST_HPP
+
+#include <boost/test/unit_test.hpp>
+
+using namespace ::boost::unit_test;
+
+#endif // include guard
+
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