mirror of
https://github.com/boostorg/typeof.git
synced 2025-07-29 12:27:43 +02:00
initial commit
[SVN r30738]
This commit is contained in:
12
test/Jamfile
Executable file
12
test/Jamfile
Executable file
@ -0,0 +1,12 @@
|
||||
# Boost Typeof Library test Jamfile
|
||||
|
||||
subproject libs/typeof/test ;
|
||||
|
||||
# bring in rules for testing
|
||||
import testing ;
|
||||
|
||||
test-suite "typeof"
|
||||
:
|
||||
[ compile type.cpp : <define>BOOST_TYPEOF_NATIVE : type_native ]
|
||||
[ compile type.cpp : <define>BOOST_TYPEOF_COMPLIANT : type_emulation ]
|
||||
;
|
35
test/test.hpp
Executable file
35
test/test.hpp
Executable file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2005 Arkadiy Vertleyb
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_TEST_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_TEST_HPP_INCLUDED
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
template<class T>
|
||||
struct test_wrapper{};
|
||||
|
||||
template<class T>
|
||||
test_wrapper<T> test_helper(test_wrapper<T>*);
|
||||
|
||||
template<class T>
|
||||
struct test
|
||||
{
|
||||
enum {value = boost::is_same<
|
||||
BOOST_TYPEOF_TPL(test_helper(reinterpret_cast<test_wrapper<T>*>(0))),
|
||||
test_wrapper<T>
|
||||
>::value
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::type_of::test_wrapper, 1)
|
||||
|
||||
#endif//BOOST_TYPEOF_TEST_HPP_INCLUDED
|
7
test/type.cpp
Executable file
7
test/type.cpp
Executable file
@ -0,0 +1,7 @@
|
||||
#include "test.hpp"
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
struct A;
|
||||
BOOST_TYPEOF_REGISTER_TYPE(A)
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<A>::value);
|
Reference in New Issue
Block a user