forked from boostorg/typeof
added template tests
[SVN r30885]
This commit is contained in:
@ -9,4 +9,13 @@ test-suite "typeof"
|
||||
:
|
||||
[ compile type.cpp : <define>BOOST_TYPEOF_NATIVE : type_native ]
|
||||
[ compile type.cpp : <define>BOOST_TYPEOF_COMPLIANT : type_emulation ]
|
||||
|
||||
[ compile template_type.cpp : <define>BOOST_TYPEOF_NATIVE : template_type_native ]
|
||||
[ compile template_type.cpp : <define>BOOST_TYPEOF_COMPLIANT : template_type_emulation ]
|
||||
|
||||
[ compile template_int.cpp : <define>BOOST_TYPEOF_NATIVE : template_int_native ]
|
||||
[ compile template_int.cpp : <define>BOOST_TYPEOF_COMPLIANT : template_int_emulation ]
|
||||
|
||||
[ compile template_tpl.cpp : <define>BOOST_TYPEOF_NATIVE : template_tpl_native ]
|
||||
[ compile template_tpl.cpp : <define>BOOST_TYPEOF_COMPLIANT : template_tpl_emulation ]
|
||||
;
|
||||
|
26
test/template_int.cpp
Executable file
26
test/template_int.cpp
Executable file
@ -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<Tpl<int, 5, 4, -3, 2, true, false, -1, 5> >::value));
|
||||
BOOST_STATIC_ASSERT((boost::type_of::test<Tpl<int, 1, 1, 0, ULONG_MAX, false, true, -1, 0> >::value));
|
22
test/template_tpl.cpp
Executable file
22
test/template_tpl.cpp
Executable file
@ -0,0 +1,22 @@
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
template<class T, class U>
|
||||
struct t0;
|
||||
|
||||
template<class T, int n>
|
||||
struct t1;
|
||||
|
||||
template<template<class, class> class T, template<class, int> 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<t2<t0, t1> >::value));
|
13
test/template_type.cpp
Executable file
13
test/template_type.cpp
Executable file
@ -0,0 +1,13 @@
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
struct P1;
|
||||
struct P2;
|
||||
|
||||
template<class P1, class P2> 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<Tpl<P1, P2> >::value));
|
Reference in New Issue
Block a user