mirror of
https://github.com/boostorg/type_traits.git
synced 2025-08-02 05:54:31 +02:00
Rewitten test program infrastructure so that it does not depend upon Boost.Test (which causes cyclic rebuild dependencies).
[SVN r22326]
This commit is contained in:
148
test/Jamfile
148
test/Jamfile
@@ -1,94 +1,72 @@
|
||||
# Copyright John Maddock 2004
|
||||
#
|
||||
# There are two ways to invoke this Jamfile:
|
||||
#
|
||||
# If we pass the argument --type-traits-unit-test
|
||||
# to bjam, then the tests are built as one big test
|
||||
# program: this may be slightly quicker in some cases,
|
||||
# but causes problems if any of the test sources don't compile.
|
||||
#
|
||||
# Alternatively, the default behaviour is to build each source
|
||||
# file as a separate test program, these no longer depend upon Boost.Test
|
||||
# (which causes cyclic dependencies). We also get a separate status report
|
||||
# for each trait, which makes it easier to track down issues with non-conforming
|
||||
# compilers.
|
||||
#
|
||||
|
||||
subproject libs/type_traits/test ;
|
||||
|
||||
# bring in the rules for testing
|
||||
import testing ;
|
||||
|
||||
rule type-traits-run ( sources + )
|
||||
{
|
||||
return [
|
||||
run
|
||||
# sources
|
||||
$(sources)
|
||||
|
||||
# dependencies
|
||||
<lib>type_traits_init
|
||||
<lib>../../test/build/boost_unit_test_framework
|
||||
: # additional args
|
||||
--report_level=detailed --build_info=yes --log_level=messages
|
||||
: # test-files
|
||||
: # requirements
|
||||
<sysinclude>$(BOOST_ROOT)
|
||||
: # test name
|
||||
] ;
|
||||
#
|
||||
# define the sources which need testing, mostly this is just
|
||||
# all the files *_test.cpp, but any badly named examples can
|
||||
# be added to this list :-)
|
||||
#
|
||||
TEST_SOURCES = [ GLOB . : *_test.cpp ]
|
||||
udt_specialisations.cpp ;
|
||||
|
||||
if --type-traits-unit-test in $(ARGV)
|
||||
{
|
||||
test-suite type_traits :
|
||||
[ run # sources:
|
||||
$(TEST_SOURCES)
|
||||
init.cpp
|
||||
# dependencies
|
||||
<lib>../../test/build/boost_unit_test_framework
|
||||
: # additional args
|
||||
--report_level=detailed --build_info=yes --log_level=messages
|
||||
: # test-files
|
||||
: # requirements
|
||||
<sysinclude>$(BOOST_ROOT)
|
||||
<define>USE_UNIT_TEST=1
|
||||
: # test name
|
||||
type_traits_test
|
||||
] ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
# this rule enumerates through all the sources and invokes
|
||||
# the run rule for each source, the result is a list of all
|
||||
# the run rules, which we can pass on to the test_suite rule:
|
||||
rule test_all
|
||||
{
|
||||
#ECHO executing test_all rule ;
|
||||
local all_rules = ;
|
||||
for local file in $(TEST_SOURCES)
|
||||
{
|
||||
all_rules += [ run $(file) ] ;
|
||||
}
|
||||
#ECHO $(all_rules) ;
|
||||
return $(all_rules) ;
|
||||
}
|
||||
|
||||
test-suite type_traits :
|
||||
[ test_all r ]
|
||||
; # type traits suite
|
||||
|
||||
}
|
||||
|
||||
lib type_traits_init : init.cpp
|
||||
:
|
||||
<sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
|
||||
test-suite type_traits :
|
||||
|
||||
[ type-traits-run add_const_test.cpp ]
|
||||
[ type-traits-run add_pointer_test.cpp ]
|
||||
[ type-traits-run add_reference_test.cpp ]
|
||||
[ type-traits-run add_volatile_test.cpp ]
|
||||
[ type-traits-run alignment_of_test.cpp ]
|
||||
[ type-traits-run function_traits_test.cpp ]
|
||||
[ type-traits-run has_nothrow_assign_test.cpp ]
|
||||
[ type-traits-run has_nothrow_constr_test.cpp ]
|
||||
[ type-traits-run has_nothrow_copy_test.cpp ]
|
||||
[ type-traits-run has_trivial_assign_test.cpp ]
|
||||
[ type-traits-run has_trivial_constr_test.cpp ]
|
||||
[ type-traits-run has_trivial_copy_test.cpp ]
|
||||
[ type-traits-run has_trivial_destructor_test.cpp ]
|
||||
[ type-traits-run is_abstract_test.cpp ]
|
||||
[ type-traits-run is_arithmetic_test.cpp ]
|
||||
[ type-traits-run is_array_test.cpp ]
|
||||
[ type-traits-run is_base_and_derived_test.cpp ]
|
||||
[ type-traits-run is_class_test.cpp ]
|
||||
[ type-traits-run is_compound_test.cpp ]
|
||||
[ type-traits-run is_const_test.cpp ]
|
||||
[ type-traits-run is_convertible_test.cpp ]
|
||||
[ type-traits-run is_empty_test.cpp ]
|
||||
[ type-traits-run is_enum_test.cpp ]
|
||||
[ type-traits-run is_float_test.cpp ]
|
||||
[ type-traits-run is_function_test.cpp ]
|
||||
[ type-traits-run is_fundamental_test.cpp ]
|
||||
[ type-traits-run is_integral_test.cpp ]
|
||||
[ type-traits-run is_member_func_test.cpp ]
|
||||
[ type-traits-run is_member_pointer_test.cpp ]
|
||||
[ type-traits-run is_object_test.cpp ]
|
||||
[ type-traits-run is_pod_test.cpp ]
|
||||
[ type-traits-run is_pointer_test.cpp ]
|
||||
[ type-traits-run is_polymorphic_test.cpp ]
|
||||
[ type-traits-run is_reference_test.cpp ]
|
||||
[ type-traits-run is_same_test.cpp ]
|
||||
[ type-traits-run is_scalar_test.cpp ]
|
||||
[ type-traits-run is_stateless_test.cpp ]
|
||||
[ type-traits-run is_union_test.cpp ]
|
||||
[ type-traits-run is_void_test.cpp ]
|
||||
[ type-traits-run is_volatile_test.cpp ]
|
||||
[ type-traits-run remove_bounds_test.cpp ]
|
||||
[ type-traits-run remove_const_test.cpp ]
|
||||
[ type-traits-run remove_cv_test.cpp ]
|
||||
[ type-traits-run remove_pointer_test.cpp ]
|
||||
[ type-traits-run remove_reference_test.cpp ]
|
||||
[ type-traits-run remove_volatile_test.cpp ]
|
||||
[ type-traits-run tricky_abstract_type_test.cpp ]
|
||||
[ type-traits-run tricky_add_pointer_test.cpp ]
|
||||
[ type-traits-run tricky_function_type_test.cpp ]
|
||||
[ type-traits-run tricky_incomplete_type_test.cpp ]
|
||||
[ type-traits-run tricky_is_enum_test.cpp ]
|
||||
[ type-traits-run tricky_partial_spec_test.cpp ]
|
||||
[ type-traits-run type_with_alignment_test.cpp ]
|
||||
[ type-traits-run udt_specialisations.cpp ]
|
||||
|
||||
; # type traits suite
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -7,7 +7,11 @@
|
||||
#ifndef BOOST_CHECK_INTEGRAL_CONSTANT_HPP
|
||||
#define BOOST_CHECK_INTEGRAL_CONSTANT_HPP
|
||||
|
||||
#ifdef USE_UNIT_TEST
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#else
|
||||
#include "test.hpp"
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace detail{
|
||||
|
@@ -7,7 +7,11 @@
|
||||
#ifndef BOOST_CHECK_TYPE_HPP
|
||||
#define BOOST_CHECK_TYPE_HPP
|
||||
|
||||
#ifdef USE_UNIT_TEST
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#else
|
||||
#include "test.hpp"
|
||||
#endif
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
/*
|
||||
|
@@ -7,7 +7,17 @@
|
||||
#ifndef TT_TEST_HPP
|
||||
#define TT_TEST_HPP
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#ifdef USE_UNIT_TEST
|
||||
# include <boost/test/unit_test.hpp>
|
||||
#endif
|
||||
#include <boost/utility.hpp>
|
||||
#include <iostream>
|
||||
#include <typeinfo>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
// we have to turn off these warnings overwise we get swamped by the things:
|
||||
#pragma option -w-8008 -w-8066
|
||||
#endif
|
||||
|
||||
//
|
||||
// basic configuration:
|
||||
@@ -30,6 +40,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_UNIT_TEST
|
||||
//
|
||||
// global unit, this is not safe, but until the unit test framework uses
|
||||
// shared_ptr throughout this is about as good as it gets :-(
|
||||
@@ -56,6 +67,47 @@ public:
|
||||
|
||||
#define TT_TEST_END }}
|
||||
|
||||
#else
|
||||
|
||||
//
|
||||
// replacements for Unit test macros:
|
||||
//
|
||||
int error_count = 0;
|
||||
|
||||
#define BOOST_CHECK_MESSAGE(pred, message)\
|
||||
do{\
|
||||
if(!(pred))\
|
||||
{\
|
||||
std::cerr << __FILE__ << ":" << __LINE__ << ": " << message << std::endl;\
|
||||
++error_count;\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define BOOST_WARN_MESSAGE(pred, message)\
|
||||
do{\
|
||||
if(!(pred))\
|
||||
{\
|
||||
std::cerr << __FILE__ << ":" << __LINE__ << ": " << message << std::endl;\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define BOOST_MESSAGE(message)\
|
||||
do{ std::cout << __FILE__ << ":" << __LINE__ << ": " << message << std::endl; }while(0)
|
||||
|
||||
#define BOOST_CHECK(pred)\
|
||||
do{ \
|
||||
if(!(pred)){\
|
||||
std::cout << __FILE__ << ":" << __LINE__ << ": Error in " << BOOST_STRINGIZE(pred) << std::endl;\
|
||||
++error_count;\
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#define TT_TEST_BEGIN(trait_name)\
|
||||
int main(){
|
||||
#define TT_TEST_END return error_count; }
|
||||
|
||||
#endif
|
||||
|
||||
#define TRANSFORM_CHECK(name, from_suffix, to_suffix)\
|
||||
BOOST_CHECK_TYPE(bool to_suffix, name<bool from_suffix>::type);\
|
||||
BOOST_CHECK_TYPE(char to_suffix, name<char from_suffix>::type);\
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_polymorphic.hpp>
|
||||
#endif
|
||||
#include <stdexcept>
|
||||
#include <exception>
|
||||
|
||||
//
|
||||
// VC++ emits an awful lot of warnings unless we define these:
|
||||
|
Reference in New Issue
Block a user