From 2bc33ea912cd78647d4f49be4c49dc340f99a175 Mon Sep 17 00:00:00 2001 From: Arkadiy Vertleyb Date: Fri, 9 Sep 2005 00:15:59 +0000 Subject: [PATCH] added template tests [SVN r30885] --- test/Jamfile | 9 +++++++++ test/template_int.cpp | 26 ++++++++++++++++++++++++++ test/template_tpl.cpp | 22 ++++++++++++++++++++++ test/template_type.cpp | 13 +++++++++++++ 4 files changed, 70 insertions(+) create mode 100755 test/template_int.cpp create mode 100755 test/template_tpl.cpp create mode 100755 test/template_type.cpp diff --git a/test/Jamfile b/test/Jamfile index 434e526..fb6938f 100755 --- a/test/Jamfile +++ b/test/Jamfile @@ -9,4 +9,13 @@ test-suite "typeof" : [ compile type.cpp : BOOST_TYPEOF_NATIVE : type_native ] [ compile type.cpp : BOOST_TYPEOF_COMPLIANT : type_emulation ] + + [ compile template_type.cpp : BOOST_TYPEOF_NATIVE : template_type_native ] + [ compile template_type.cpp : BOOST_TYPEOF_COMPLIANT : template_type_emulation ] + + [ compile template_int.cpp : BOOST_TYPEOF_NATIVE : template_int_native ] + [ compile template_int.cpp : BOOST_TYPEOF_COMPLIANT : template_int_emulation ] + + [ compile template_tpl.cpp : BOOST_TYPEOF_NATIVE : template_tpl_native ] + [ compile template_tpl.cpp : BOOST_TYPEOF_COMPLIANT : template_tpl_emulation ] ; diff --git a/test/template_int.cpp b/test/template_int.cpp new file mode 100755 index 0000000..b0c6189 --- /dev/null +++ b/test/template_int.cpp @@ -0,0 +1,26 @@ +#include "test.hpp" +#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() + +struct x; +BOOST_TYPEOF_REGISTER_TYPE(x) + +template< + class T, char c, unsigned short us, int i, unsigned long ul, + bool b1, bool b2, signed char sc, unsigned u> + struct Tpl +{}; + +BOOST_TYPEOF_REGISTER_TEMPLATE(Tpl, + (class) + (char) + (unsigned short) + (int) + (unsigned long) + (bool) + (bool) + (signed char) + (unsigned) + ) + +BOOST_STATIC_ASSERT((boost::type_of::test >::value)); +BOOST_STATIC_ASSERT((boost::type_of::test >::value)); diff --git a/test/template_tpl.cpp b/test/template_tpl.cpp new file mode 100755 index 0000000..84227cb --- /dev/null +++ b/test/template_tpl.cpp @@ -0,0 +1,22 @@ +#include "test.hpp" +#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() + +template +struct t0; + +template +struct t1; + +template class T, template class U> +struct t2; + +BOOST_TYPEOF_REGISTER_TEMPLATE(t0, 2) + +BOOST_TYPEOF_REGISTER_TEMPLATE(t1, (class)(int)) + +BOOST_TYPEOF_REGISTER_TEMPLATE(t2, + (BOOST_TYPEOF_TEMPLATE(2)) + (BOOST_TYPEOF_TEMPLATE((class)(int))) + ) + +BOOST_STATIC_ASSERT((boost::type_of::test >::value)); diff --git a/test/template_type.cpp b/test/template_type.cpp new file mode 100755 index 0000000..f7d0e96 --- /dev/null +++ b/test/template_type.cpp @@ -0,0 +1,13 @@ +#include "test.hpp" +#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() + +struct P1; +struct P2; + +template struct Tpl; + +BOOST_TYPEOF_REGISTER_TYPE(P1) +BOOST_TYPEOF_REGISTER_TYPE(P2) +BOOST_TYPEOF_REGISTER_TEMPLATE(Tpl, 2) + +BOOST_STATIC_ASSERT((boost::type_of::test >::value));