diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/boost/libs/tti | |
parent | Initial commit. (diff) | |
download | ceph-upstream/18.2.2.tar.xz ceph-upstream/18.2.2.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/tti')
150 files changed, 4693 insertions, 0 deletions
diff --git a/src/boost/libs/tti/CMakeLists.txt b/src/boost/libs/tti/CMakeLists.txt new file mode 100644 index 000000000..88ac65227 --- /dev/null +++ b/src/boost/libs/tti/CMakeLists.txt @@ -0,0 +1,29 @@ +# Generated by `boostdep --cmake tti` +# Copyright 2020 Peter Dimov +# Distributed under the Boost Software License, Version 1.0. +# https://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.5...3.16) + +project(boost_tti VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) + +add_library(boost_tti INTERFACE) +add_library(Boost::tti ALIAS boost_tti) + +target_include_directories(boost_tti INTERFACE include) + +target_link_libraries(boost_tti + INTERFACE + Boost::config + Boost::function_types + Boost::mpl + Boost::preprocessor + Boost::type_traits +) + +if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") + + add_subdirectory(test) + +endif() + diff --git a/src/boost/libs/tti/index.html b/src/boost/libs/tti/index.html new file mode 100644 index 000000000..3119f8df1 --- /dev/null +++ b/src/boost/libs/tti/index.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> + <head> + <meta http-equiv="refresh" content="0; URL=doc/html/index.html"> + </head> + <body> + <P>Automatic redirection failed, please go to + <a href="doc/html/index.html">doc/html/index.html</a>.</P> + <P>Copyright Edward Diener 2013</P> + <P>Distributed under the Boost Software License, Version 1.0. (See accompanying file <A href="../../LICENSE_1_0.txt"> + LICENSE_1_0.txt</A> or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</A>).</P> + </body> +</html> diff --git a/src/boost/libs/tti/meta/libraries.json b/src/boost/libs/tti/meta/libraries.json new file mode 100644 index 000000000..29d4d21f0 --- /dev/null +++ b/src/boost/libs/tti/meta/libraries.json @@ -0,0 +1,16 @@ +{ + "key": "tti", + "name": "TTI", + "authors": [ + "Edward Diener" + ], + "description": "Type Traits Introspection library.", + "category": [ + "Generic", + "Metaprogramming" + ], + "maintainers": [ + "Edward Diener <eld -at- tropicsoft.com>" + ], + "cxxstd": "03" +} diff --git a/src/boost/libs/tti/test/Jamfile.v2 b/src/boost/libs/tti/test/Jamfile.v2 new file mode 100644 index 000000000..505c90d53 --- /dev/null +++ b/src/boost/libs/tti/test/Jamfile.v2 @@ -0,0 +1,550 @@ + +# (C) Copyright Edward Diener 2011,2012,2019 +# Use, modification and distribution are subject to 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). +# +# Tti testing Jamfile +# + +import testing ; + +project tti_tests : requirements <warnings>on + <toolset>gcc:<warnings>all + <toolset>msvc:<warnings>all + <toolset>gcc-4.3.0:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.4.0:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.4.7:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.5.0:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.5.0:<linkflags>"-Wl,--enable-auto-import" + <toolset>gcc-4.5.2:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.6.0:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.6.1:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.6.2:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.6.3:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.7.0:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.7.2:<cxxflags>-Wno-variadic-macros + ; + +obj function_template : test_function_template_works.cpp ; + +explicit function_template ; + +# +# Member functions composite syntax +# +alias ttimfsig + : + [ run test_has_member.cpp ] + [ compile test_has_member_compile.cpp ] + [ compile-fail test_has_member_fail.cpp ] + [ compile-fail test_has_member_fail2.cpp ] + [ compile-fail test_has_member_fail3.cpp ] + ; + +# +# Member functions composite syntax, cv-qualified +# +alias ttimfsigcv + : + [ run test_has_member_cv.cpp ] + [ compile test_has_member_cv_compile.cpp ] + [ compile-fail test_has_member_cv_fail.cpp ] + [ compile-fail test_has_member_cv_fail2.cpp ] + [ compile-fail test_has_member_cv_fail3.cpp ] + [ compile-fail test_has_member_cv_fail4.cpp ] + [ compile-fail test_has_member_cv_fail5.cpp ] + ; + +# +# Member data +# +alias ttimd + : + [ run test_has_mem_data.cpp ] + [ run test_has_mem_data2.cpp ] + [ compile test_has_mem_data_compile.cpp ] + [ compile-fail test_has_mem_data_fail.cpp ] + [ compile-fail test_has_mem_data_fail2.cpp ] + [ compile-fail test_has_mem_data_fail3.cpp ] + ; + +# +# Member functions specific syntax +# +alias ttimfn + : + [ run test_has_mem_fun.cpp ] + [ compile test_has_mem_fun_compile.cpp ] + [ compile-fail test_has_mem_fun_fail.cpp ] + [ compile-fail test_has_mem_fun_fail2.cpp ] + [ compile-fail test_has_mem_fun_fail3.cpp ] + ; + +# +# Member functions specific syntax, cv-qualified +# +alias ttimfncv + : + [ run test_has_mem_fun_cv.cpp ] + [ compile test_has_mem_fun_cv_compile.cpp ] + [ compile-fail test_has_mem_fun_cv_fail.cpp ] + [ compile-fail test_has_mem_fun_cv_fail2.cpp ] + [ compile-fail test_has_mem_fun_cv_fail3.cpp ] + [ compile-fail test_has_mem_fun_cv_fail4.cpp ] + [ compile-fail test_has_mem_fun_cv_fail5.cpp ] + [ compile-fail test_has_mem_fun_cv_fail6.cpp ] + ; + +# +# Static member functions composite syntax +# +alias ttismfsig + : + [ run test_has_static_member.cpp ] + [ compile test_has_static_member_compile.cpp ] + [ compile-fail test_has_static_member_fail.cpp ] + [ compile-fail test_has_static_member_fail2.cpp ] + ; + +# +# Static member data +# +alias ttismd + : + [ run test_has_static_mem_data.cpp ] + [ compile test_has_static_mem_data_compile.cpp ] + [ compile-fail test_has_static_mem_data_fail.cpp ] + [ compile-fail test_has_static_mem_data_fail2.cpp ] + [ compile-fail test_has_static_mem_data_fail3.cpp ] + ; + +# +# Static member functions +# +alias ttismfn + : + [ run test_has_static_mem_fun.cpp ] + [ compile test_has_static_mem_fun_compile.cpp ] + [ compile-fail test_has_static_mem_fun_fail.cpp ] + [ compile-fail test_has_static_mem_fun_fail2.cpp ] + ; + +# +# Member or static member data +# +alias ttidata + : + [ run test_has_data.cpp ] + [ compile test_has_data_compile.cpp ] + [ compile-fail test_has_data_fail.cpp ] + [ compile-fail test_has_data_fail2.cpp ] + [ compile-fail test_has_data_fail3.cpp ] + [ compile-fail test_has_data_fail4.cpp ] + [ compile-fail test_has_data_fail5.cpp ] + [ compile-fail test_has_data_fail6.cpp ] + ; + +# +# Member or static member function +# +alias ttifun + : + [ run test_has_fun.cpp ] + [ compile test_has_fun_compile.cpp ] + [ compile-fail test_has_fun_fail.cpp ] + [ compile-fail test_has_fun_fail2.cpp ] + [ compile-fail test_has_fun_fail3.cpp ] + [ compile-fail test_has_fun_fail4.cpp ] + [ compile-fail test_has_fun_fail5.cpp ] + ; + +# +# Member function templates +# +alias ttimftmp + : + [ run test_has_mem_fun_template.cpp : : : [ check-target-builds function_template : : <build>no ] ] + [ run test_has_mem_fun_template.cpp : : : [ check-target-builds function_template : : <build>no ] + <define>BOOST_PP_VARIADICS=0 : + test_has_mem_fun_template_nov ] + [ compile test_has_mem_fun_template_compile.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_mem_fun_template_fail.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_mem_fun_template_fail2.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_mem_fun_template_fail3.cpp : [ check-target-builds function_template : : <build>no ] ] + ; + +# +# Member function templates composite syntax +# +alias ttimftsig + : + [ run test_has_member_template.cpp : : : [ check-target-builds function_template : : <build>no ] ] + [ run test_has_member_template.cpp : : : [ check-target-builds function_template : : <build>no ] + <define>BOOST_PP_VARIADICS=0 : + test_has_member_template_nov ] + [ compile test_has_member_template_compile.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_member_template_fail.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_member_template_fail2.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_member_template_fail3.cpp : [ check-target-builds function_template : : <build>no ] ] + ; + +# +# Member function templates specific syntax, cv-qualified +# +alias ttimftmpcv + : + [ run test_has_mem_fun_template_cv.cpp : : : [ check-target-builds function_template : : <build>no ] ] + [ run test_has_mem_fun_template_cv.cpp : : : [ check-target-builds function_template : : <build>no ] + <define>BOOST_PP_VARIADICS=0 : + test_has_mem_fun_template_cv_nov ] + [ compile test_has_mem_fun_template_cv_compile.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_mem_fun_template_cv_fail.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_mem_fun_template_cv_fail2.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_mem_fun_template_cv_fail3.cpp : [ check-target-builds function_template : : <build>no ] ] + ; + +# +# Member function templates composite syntax, cv-qualified +# +alias ttimftsigcv + : + [ run test_has_member_template_cv.cpp : : : [ check-target-builds function_template : : <build>no ] ] + [ run test_has_member_template_cv.cpp : : : [ check-target-builds function_template : : <build>no ] + <define>BOOST_PP_VARIADICS=0 : + test_has_member_template_cv_nov ] + [ compile test_has_member_template_cv_compile.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_member_template_cv_fail.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_member_template_cv_fail2.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_member_template_cv_fail3.cpp : [ check-target-builds function_template : : <build>no ] ] + ; + +# +# Static member function templates +# +alias ttismftmp + : + [ run test_has_static_mem_fun_template.cpp : : : [ check-target-builds function_template : : <build>no ] ] + [ run test_has_static_mem_fun_template.cpp : : : [ check-target-builds function_template : : <build>no ] + <define>BOOST_PP_VARIADICS=0 : + test_has_static_mem_fun_template_nov ] + [ compile test_has_static_mem_fun_template_compile.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_static_mem_fun_template_fail.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_static_mem_fun_template_fail2.cpp : [ check-target-builds function_template : : <build>no ] ] + ; + +# +# Static member function templates composite syntax +# +alias ttismftsig + : + [ run test_has_static_member_template.cpp : : : [ check-target-builds function_template : : <build>no ] ] + [ run test_has_static_member_template.cpp : : : [ check-target-builds function_template : : <build>no ] + <define>BOOST_PP_VARIADICS=0 : + test_has_static_member_template_nov ] + [ compile test_has_static_member_template_compile.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_static_member_template_fail.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_static_member_template_fail2.cpp : [ check-target-builds function_template : : <build>no ] ] + ; + +# +# Member or static member function templates +# +alias ttifuntmp + : + [ run test_has_fun_template.cpp : : : [ check-target-builds function_template : : <build>no ] ] + [ run test_has_fun_template.cpp : : : [ check-target-builds function_template : : <build>no ] + <define>BOOST_PP_VARIADICS=0 : + test_has_fun_template_nov ] + [ compile test_has_fun_template_compile.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_fun_template_fail.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_fun_template_fail2.cpp : [ check-target-builds function_template : : <build>no ] ] + [ compile-fail test_has_fun_template_fail3.cpp : [ check-target-builds function_template : : <build>no ] ] + ; + +# +# Function templates +# +alias ttift : ttimftmp ttimftsig ttimftmpcv ttimftsigcv ttismftmp ttismftsig ttifuntmp ; + +# +# Templates +# +alias ttitmp + : + [ run test_has_template.cpp : : : <define>BOOST_PP_VARIADICS=0 ] + [ compile test_has_template_compile.cpp : <define>BOOST_PP_VARIADICS=0 ] + [ compile-fail test_has_template_fail.cpp : <define>BOOST_PP_VARIADICS=0 ] + [ compile-fail test_has_template_fail2.cpp : <define>BOOST_PP_VARIADICS=0 ] + [ compile-fail test_has_template_fail3.cpp : <define>BOOST_PP_VARIADICS=0 ] + [ compile-fail test_has_template_fail4.cpp : <define>BOOST_PP_VARIADICS=0 ] + ; + +# +# Templates, check params +# +alias ttitmpcp + : + [ run test_has_template_cp.cpp : : : <define>BOOST_PP_VARIADICS=0 ] + [ compile test_has_template_cp_compile.cpp : <define>BOOST_PP_VARIADICS=0 ] + [ compile-fail test_has_template_cp_fail.cpp : <define>BOOST_PP_VARIADICS=0 ] + [ compile-fail test_has_template_cp_fail2.cpp : <define>BOOST_PP_VARIADICS=0 ] + [ compile-fail test_has_template_cp_fail3.cpp : <define>BOOST_PP_VARIADICS=0 ] + [ compile-fail test_has_template_cp_fail4.cpp : <define>BOOST_PP_VARIADICS=0 ] + ; + +# +# Type +# +alias ttity + : + [ run test_has_type.cpp ] + [ run test_has_class.cpp ] + [ run test_has_union.cpp ] + [ run test_has_enum.cpp ] + [ compile test_has_type_compile.cpp ] + [ compile-fail test_has_type_fail.cpp ] + [ compile-fail test_has_type_fail2.cpp ] + [ compile-fail test_has_type_fail3.cpp ] + [ run test_has_type_ct.cpp ] + [ compile test_has_type_ct_compile.cpp ] + [ compile-fail test_has_type_ct_fail.cpp ] + [ compile-fail test_has_type_ct_fail2.cpp ] + [ compile-fail test_has_type_ct_fail3.cpp ] + [ compile-fail test_has_type_ct_fail4.cpp ] + [ compile-fail test_has_type_ct_fail5.cpp ] + ; + +# +# Nested type +# +alias ttimemty + : + [ run test_mem_type.cpp ] + [ compile test_mem_type_compile.cpp ] + ; +# +# All of tti, non-variadic macros +# +alias ttinovm : ttimfsig ttimfsigcv ttimd ttimfn ttimfncv ttismfsig ttismd ttismfn ttidata ttifun ttitmp ttitmpcp ttity ttimemty ttift ; + +alias ttitmpv : : + <toolset>gcc + <toolset-gcc:version>3.4.2 + ; + +alias ttitmpv : : + <toolset>gcc + <toolset-gcc:version>3.4.5 + ; + +alias ttitmpv : : + <toolset>gcc + <toolset-gcc:version>4.1.2 + ; + +alias ttitmpv : : + <toolset>gcc + <toolset-gcc:version>4.2.1 + ; + +# +# Templates, variadic macro +# +alias ttitmpv + : + [ run test_has_template.cpp : : : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_v ] + [ compile test_has_template_compile.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_compile_v ] + [ compile-fail test_has_template_fail.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_fail_v ] + [ compile-fail test_has_template_fail2.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_fail2_v ] + [ compile-fail test_has_template_fail3.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_fail3_v ] + [ compile-fail test_has_template_fail4.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_fail4_v ] + ; + +alias ttitmpcpv : : + <toolset>gcc + <toolset-gcc:version>3.4.2 + ; + +alias ttitmpcpv : : + <toolset>gcc + <toolset-gcc:version>3.4.5 + ; + +alias ttitmpcpv : : + <toolset>gcc + <toolset-gcc:version>4.1.2 + ; + +alias ttitmpcpv : : + <toolset>gcc + <toolset-gcc:version>4.2.1 + ; + +# +# Templates, variadic macro, check params, non-variadic syntax +# +alias ttitmpcpv + : + [ run test_has_template_cp.cpp : : : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_cp_v ] + [ compile test_has_template_cp_compile.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_cp_compile_v ] + [ compile-fail test_has_template_cp_fail.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_cp_fail_v ] + [ compile-fail test_has_template_cp_fail2.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_cp_fail2_v ] + [ compile-fail test_has_template_cp_fail3.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_cp_fail3_v ] + [ compile-fail test_has_template_cp_fail4.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 : + test_has_template_cp_fail4_v ] + ; + +alias ttitmpcpvm : : + <toolset>gcc + <toolset-gcc:version>3.4.2 + ; + +alias ttitmpcpvm : : + <toolset>gcc + <toolset-gcc:version>3.4.5 + ; + +alias ttitmpcpvm : : + <toolset>gcc + <toolset-gcc:version>4.1.2 + ; + +alias ttitmpcpvm : : + <toolset>gcc + <toolset-gcc:version>4.2.1 + ; + +# +# Templates, variadic macro, check params, variadic syntax +# +alias ttitmpcpvm + : + [ run test_vm_has_template_cp.cpp : : : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 ] + [ compile test_vm_has_template_cp_compile.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 ] + [ compile-fail test_vm_has_template_cp_fail.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 ] + [ compile-fail test_vm_has_template_cp_fail2.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 ] + [ compile-fail test_vm_has_template_cp_fail3.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 ] + [ compile-fail test_vm_has_template_cp_fail4.cpp : + <toolset>gcc:<cxxflags>-std=c++0x + <toolset>gcc-4.3.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.0:<cxxflags>-U__STRICT_ANSI__ + <toolset>gcc-4.4.7:<cxxflags>-U__STRICT_ANSI__ + <define>BOOST_PP_VARIADICS=1 ] + ; + +# +# Templates, non-variadic macro +# +alias ttitemplate : ttitmp ttitmpcp ; + +# +# Templates, variadic macro +# +alias ttivm : ttitmpv ttitmpcpv ttitmpcpvm ; + +# +# All templates +# +alias ttitemplate_all : ttitemplate ttivm ; + +# +# All tests +# +alias tti : ttinovm ttivm ; diff --git a/src/boost/libs/tti/test/test_function_template_works.cpp b/src/boost/libs/tti/test/test_function_template_works.cpp new file mode 100644 index 000000000..427ee71c3 --- /dev/null +++ b/src/boost/libs/tti/test/test_function_template_works.cpp @@ -0,0 +1,65 @@ +// (C) Copyright Edward Diener 2020 +// Use, modification and distribution are subject to 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/tti/detail/dmacro_sunfix.hpp> + + struct AType + { + template<class X,class Y,class Z> double SomeFuncTemplateName(X,Y *,Z &) { return 0.0; } + template<class X,class Y,short AA> static int StatFuncTemplate(X *,Y) { int ret(AA); return ret; } + }; + + template + < + class C, + class T + > + struct TestFunctionTemplate + { + typedef char Bad; + struct Good { char x[2]; }; + template<T> struct helper BOOST_TTI_DETAIL_MACRO_SUNFIX ; + template<class U> static Good check(helper<&U::template SomeFuncTemplateName<int,long,double> > *); + template<class U> static Bad check(...); + static const bool value=sizeof(check<C>(0))==sizeof(Good); + }; + + template + < + class C, + class T + > + struct TestStaticFunctionTemplate + { + typedef char Bad; + struct Good { char x[2]; }; + template<T *> struct helper BOOST_TTI_DETAIL_MACRO_SUNFIX ; + template<class U> static Good check(helper<&U::template StatFuncTemplate<long,int,1234> > *); + template<class U> static Bad check(...); + static const bool value=sizeof(check<C>(0))==sizeof(Good); + }; + + int main() + { + + bool bv = + + TestFunctionTemplate + < + AType, + double (AType::*) (int,long *,double &) + >::value + + && + + TestStaticFunctionTemplate + < + AType, + int (long *,int) + >::value + ; + + return (bv ? 0 : 1); + } diff --git a/src/boost/libs/tti/test/test_has_class.cpp b/src/boost/libs/tti/test/test_has_class.cpp new file mode 100644 index 000000000..f564cc74e --- /dev/null +++ b/src/boost/libs/tti/test/test_has_class.cpp @@ -0,0 +1,41 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_class.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST(!BOOST_TTI_HAS_CLASS_GEN(AnIntType)<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_CLASS_GEN(AnIntTypeReference)<AType>::value); + BOOST_TEST(NameStruct<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_CLASS_GEN(BType)<AType>::value); + BOOST_TEST(!TheInteger<AType::BType>::value); + BOOST_TEST(BOOST_TTI_HAS_CLASS_GEN(CType)<AType::BType>::value); + BOOST_TEST(!BOOST_TTI_HAS_CLASS_GEN(AnotherIntegerType)<AType::BType::CType>::value); + BOOST_TEST(!SomethingElse<AnotherType>::value); + BOOST_TEST(!BOOST_TTI_HAS_CLASS_GEN(NoOtherType)<AnotherType>::value); + + BOOST_TEST(!EInB<AType::BType>::value); + BOOST_TEST(!BOOST_TTI_HAS_CLASS_GEN(AnEnumTtype)<AType>::value); + BOOST_TEST(!AnotherE<AnotherType>::value); + BOOST_TEST(!EClass<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_CLASS_GEN(AnotherEnumClassType)<AnotherType>::value); + BOOST_TEST(!BOOST_TTI_HAS_CLASS_GEN(CTypeUnion)<AType::BType::CType>::value); + BOOST_TEST(!SimpleUT<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_CLASS_GEN(AnotherUnion)<AnotherType>::value); + + BOOST_TEST(UnionType<AType::AnUnion>::value); + + // Passing non-class enclosing type will return false + + BOOST_TEST(!BOOST_TTI_HAS_CLASS_GEN(AnIntTypeReference)<signed long>::value); + BOOST_TEST(!NameStruct<AType &>::value); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_class.hpp b/src/boost/libs/tti/test/test_has_class.hpp new file mode 100644 index 000000000..b1f530581 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_class.hpp @@ -0,0 +1,34 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_CLASS_HPP) +#define TEST_HAS_CLASS_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_class.hpp> + +BOOST_TTI_HAS_CLASS(AnIntType) +BOOST_TTI_TRAIT_HAS_CLASS(NameStruct,AStructType) +BOOST_TTI_HAS_CLASS(AnIntTypeReference) +BOOST_TTI_HAS_CLASS(BType) +BOOST_TTI_TRAIT_HAS_CLASS(TheInteger,AnIntegerType) +BOOST_TTI_HAS_CLASS(CType) +BOOST_TTI_HAS_CLASS(AnotherIntegerType) +BOOST_TTI_TRAIT_HAS_CLASS(SomethingElse,someOtherType) +BOOST_TTI_HAS_CLASS(NoOtherType) + +BOOST_TTI_TRAIT_HAS_CLASS(EInB,BTypeEnum) +BOOST_TTI_HAS_CLASS(AnEnumTtype) +BOOST_TTI_TRAIT_HAS_CLASS(AnotherE,AnotherEnumTtype) +BOOST_TTI_TRAIT_HAS_CLASS(EClass,AnEnumClassType) +BOOST_TTI_HAS_CLASS(AnotherEnumClassType) +BOOST_TTI_HAS_CLASS(CTypeUnion) +BOOST_TTI_TRAIT_HAS_CLASS(SimpleUT,AnUnion) +BOOST_TTI_HAS_CLASS(AnotherUnion) + +BOOST_TTI_TRAIT_HAS_CLASS(UnionType,UNStruct) + +#endif // TEST_HAS_CLASS_HPP diff --git a/src/boost/libs/tti/test/test_has_data.cpp b/src/boost/libs/tti/test/test_has_data.cpp new file mode 100644 index 000000000..4e221e5f5 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_data.cpp @@ -0,0 +1,44 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_data.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_DATA_GEN(AnInt)<AType,int>::value)); + BOOST_TEST((!BOOST_TTI_HAS_DATA_GEN(SomeStaticData)<AnotherType,float>::value)); + BOOST_TEST((BOOST_TTI_HAS_DATA_GEN(AnInt)<AnotherType,long>::value)); + BOOST_TEST((BOOST_TTI_HAS_DATA_GEN(DSMember)<AType,short>::value)); + BOOST_TEST((BOOST_TTI_HAS_DATA_GEN(aMember)<AnotherType,bool>::value)); + BOOST_TEST((!BOOST_TTI_HAS_DATA_GEN(aMember)<AnotherType,int>::value)); + BOOST_TEST((DCMember<AnotherType,bool>::value)); + BOOST_TEST((!BOOST_TTI_HAS_DATA_GEN(someDataMember)<AType,short>::value)); + BOOST_TEST((BOOST_TTI_HAS_DATA_GEN(IntBT)<AType,AType::BType>::value)); + BOOST_TEST((DStatName<AnotherType,AType::AStructType>::value)); + BOOST_TEST((DNestedData<AType,AType::BType::CType>::value)); + BOOST_TEST((BOOST_TTI_HAS_DATA_GEN(CIntValue)<AnotherType,const int>::value)); + BOOST_TEST((DAOther<AnotherType,AType>::value)); + BOOST_TEST((BOOST_TTI_HAS_DATA_GEN(ONestStr)<AnotherType,AType::AStructType>::value)); + +#if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION) + + BOOST_TEST((BOOST_TTI_HAS_DATA_GEN(USMember)<AType::AnUnion,float>::value)); + BOOST_TEST((SomeUStaticD<AnotherType::AnotherUnion,char>::value)); + +#endif + + // Passing non-class enclosing type will return false + + BOOST_TEST((!BOOST_TTI_HAS_DATA_GEN(IntBT)<unsigned long,AType::BType>::value)); + BOOST_TEST((!DCMember<AnotherType *,bool>::value)); + BOOST_TEST((!DCMember<AnotherType &,bool>::value)); + BOOST_TEST((!BOOST_TTI_HAS_DATA_GEN(AnInt)<int **,long>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_data.hpp b/src/boost/libs/tti/test/test_has_data.hpp new file mode 100644 index 000000000..6cb1b9f4f --- /dev/null +++ b/src/boost/libs/tti/test/test_has_data.hpp @@ -0,0 +1,28 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_DATA_HPP) +#define TEST_HAS_DATA_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_data.hpp> + +BOOST_TTI_HAS_DATA(AnInt) +BOOST_TTI_HAS_DATA(DSMember) +BOOST_TTI_HAS_DATA(aMember) +BOOST_TTI_TRAIT_HAS_DATA(DCMember,cMem) +BOOST_TTI_HAS_DATA(someDataMember) +BOOST_TTI_HAS_DATA(CIntValue) +BOOST_TTI_HAS_DATA(SomeStaticData) +BOOST_TTI_TRAIT_HAS_DATA(DStatName,AnStat) +BOOST_TTI_HAS_DATA(IntBT) +BOOST_TTI_TRAIT_HAS_DATA(DNestedData,NestedCT) +BOOST_TTI_TRAIT_HAS_DATA(DAOther,OtherAT) +BOOST_TTI_HAS_DATA(ONestStr) +BOOST_TTI_HAS_DATA(USMember) +BOOST_TTI_TRAIT_HAS_DATA(SomeUStaticD,ASCData) + +#endif // TEST_HAS_DATA_HPP diff --git a/src/boost/libs/tti/test/test_has_data_compile.cpp b/src/boost/libs/tti/test/test_has_data_compile.cpp new file mode 100644 index 000000000..ece51912d --- /dev/null +++ b/src/boost/libs/tti/test/test_has_data_compile.cpp @@ -0,0 +1,44 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_DATA_GEN(aMember)<AType,long> aVar; + BOOST_TTI_HAS_DATA_GEN(SomeStaticData)<AnotherType,long> aVar2; + BOOST_TTI_HAS_DATA_GEN(someDataMember)<AnotherType,double> aVar3; + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(AnInt)<AType,int>)); + BOOST_MPL_ASSERT_NOT((BOOST_TTI_HAS_DATA_GEN(SomeStaticData)<AnotherType,float>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(AnInt)<AnotherType,long>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(DSMember)<AType,short>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(aMember)<AnotherType,bool>)); + BOOST_MPL_ASSERT_NOT((BOOST_TTI_HAS_DATA_GEN(aMember)<AnotherType,int>)); + BOOST_MPL_ASSERT((DCMember<AnotherType,bool>)); + BOOST_MPL_ASSERT_NOT((BOOST_TTI_HAS_DATA_GEN(someDataMember)<AType,short>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(IntBT)<AType,AType::BType>)); + BOOST_MPL_ASSERT((DStatName<AnotherType,AType::AStructType>)); + BOOST_MPL_ASSERT((DNestedData<AType,AType::BType::CType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(CIntValue)<AnotherType,const int>)); + BOOST_MPL_ASSERT((DAOther<AnotherType,AType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(ONestStr)<AnotherType,AType::AStructType>)); + +#if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION) + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(USMember)<AType::AnUnion,float>)); + BOOST_MPL_ASSERT((SomeUStaticD<AnotherType::AnotherUnion,char>)); + +#endif + + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_data_fail.cpp b/src/boost/libs/tti/test/test_has_data_fail.cpp new file mode 100644 index 000000000..edff62352 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_data_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // someDataMember does not exist at all + + BOOST_MPL_ASSERT(( BOOST_TTI_HAS_DATA_GEN(someDataMember)<AType,short> )); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_data_fail2.cpp b/src/boost/libs/tti/test/test_has_data_fail2.cpp new file mode 100644 index 000000000..6383c36e6 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_data_fail2.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong data signature for aMember + + BOOST_MPL_ASSERT(( BOOST_TTI_HAS_DATA_GEN(aMember)<AnotherType,int> )); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_data_fail3.cpp b/src/boost/libs/tti/test/test_has_data_fail3.cpp new file mode 100644 index 000000000..a5567cdf8 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_data_fail3.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_data.hpp" + +int main() + { + + // Data signature has type which does not exist + + BOOST_TTI_HAS_DATA_GEN(aMember)<AnotherType,AType::NTHType> aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_data_fail4.cpp b/src/boost/libs/tti/test/test_has_data_fail4.cpp new file mode 100644 index 000000000..fbe5fee0b --- /dev/null +++ b/src/boost/libs/tti/test/test_has_data_fail4.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // SomeStaticData does not exist at all + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(SomeStaticData)<AnotherType,float>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_data_fail5.cpp b/src/boost/libs/tti/test/test_has_data_fail5.cpp new file mode 100644 index 000000000..a24700145 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_data_fail5.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong enclosing type for DSMember + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(DSMember)<AnotherType,short>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_data_fail6.cpp b/src/boost/libs/tti/test/test_has_data_fail6.cpp new file mode 100644 index 000000000..95a2a9f5a --- /dev/null +++ b/src/boost/libs/tti/test/test_has_data_fail6.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_data.hpp" + +int main() + { + + // Data signature has type which does not exist + + BOOST_TTI_HAS_DATA_GEN(DSMember)<NoType,short> aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_enum.cpp b/src/boost/libs/tti/test/test_has_enum.cpp new file mode 100644 index 000000000..16c5589ee --- /dev/null +++ b/src/boost/libs/tti/test/test_has_enum.cpp @@ -0,0 +1,51 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_enum.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST(!BOOST_TTI_HAS_ENUM_GEN(AnIntType)<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_ENUM_GEN(AnIntTypeReference)<AType>::value); + BOOST_TEST(!NameStruct<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_ENUM_GEN(BType)<AType>::value); + BOOST_TEST(!TheInteger<AType::BType>::value); + BOOST_TEST(!BOOST_TTI_HAS_ENUM_GEN(CType)<AType::BType>::value); + BOOST_TEST(!BOOST_TTI_HAS_ENUM_GEN(AnotherIntegerType)<AType::BType::CType>::value); + BOOST_TEST(!SomethingElse<AnotherType>::value); + BOOST_TEST(!BOOST_TTI_HAS_ENUM_GEN(NoOtherType)<AnotherType>::value); + + BOOST_TEST(EInB<AType::BType>::value); + BOOST_TEST(BOOST_TTI_HAS_ENUM_GEN(AnEnumTtype)<AType>::value); + BOOST_TEST(AnotherE<AnotherType>::value); + +#if !defined(BOOST_NO_CXX11_SCOPED_ENUMS) + + BOOST_TEST(EClass<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_ENUM_GEN(AnotherEnumClassType)<AnotherType>::value); + +#else + + BOOST_TEST(!EClass<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_ENUM_GEN(AnotherEnumClassType)<AnotherType>::value); + +#endif + + BOOST_TEST(!BOOST_TTI_HAS_ENUM_GEN(CTypeUnion)<AType::BType::CType>::value); + BOOST_TEST(!SimpleUT<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_ENUM_GEN(AnotherUnion)<AnotherType>::value); + BOOST_TEST(BOOST_TTI_HAS_ENUM_GEN(UEnumV)<AType::AnUnion>::value); + + // Passing non-class enclosing type will return false + + BOOST_TEST(!BOOST_TTI_HAS_ENUM_GEN(AnIntTypeReference)<signed long>::value); + BOOST_TEST(!NameStruct<AType &>::value); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_enum.hpp b/src/boost/libs/tti/test/test_has_enum.hpp new file mode 100644 index 000000000..b89cc0fb4 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_enum.hpp @@ -0,0 +1,35 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_ENUM_HPP) +#define TEST_HAS_ENUM_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_enum.hpp> + +BOOST_TTI_HAS_ENUM(AnIntType) +BOOST_TTI_TRAIT_HAS_ENUM(NameStruct,AStructType) +BOOST_TTI_HAS_ENUM(AnIntTypeReference) +BOOST_TTI_HAS_ENUM(BType) +BOOST_TTI_TRAIT_HAS_ENUM(TheInteger,AnIntegerType) +BOOST_TTI_HAS_ENUM(CType) +BOOST_TTI_HAS_ENUM(AnotherIntegerType) +BOOST_TTI_TRAIT_HAS_ENUM(SomethingElse,someOtherType) +BOOST_TTI_HAS_ENUM(NoOtherType) + +BOOST_TTI_TRAIT_HAS_ENUM(EInB,BTypeEnum) +BOOST_TTI_HAS_ENUM(AnEnumTtype) +BOOST_TTI_TRAIT_HAS_ENUM(AnotherE,AnotherEnumTtype) +BOOST_TTI_TRAIT_HAS_ENUM(EClass,AnEnumClassType) +BOOST_TTI_HAS_ENUM(AnotherEnumClassType) + +BOOST_TTI_HAS_ENUM(CTypeUnion) +BOOST_TTI_TRAIT_HAS_ENUM(SimpleUT,AnUnion) +BOOST_TTI_HAS_ENUM(AnotherUnion) + +BOOST_TTI_HAS_ENUM(UEnumV) + +#endif // TEST_HAS_ENUM_HPP diff --git a/src/boost/libs/tti/test/test_has_fun.cpp b/src/boost/libs/tti/test/test_has_fun.cpp new file mode 100644 index 000000000..8a4f72166 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun.cpp @@ -0,0 +1,33 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_fun.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_GEN(VoidFunction)<AType,void>::value)); + BOOST_TEST((HaveTheSIntFunction<AType,int,boost::mpl::vector<long,double> >::value)); + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_GEN(TSFunction)<AnotherType,AType::AStructType,boost::mpl::vector<AType::AnIntType,double> >::value)); + BOOST_TEST((FunctionReturningInt<AType,int>::value)); + BOOST_TEST((!Pickedname<AnotherType,void>::value)); + BOOST_TEST((!TheTIntFunction<AType,AType,boost::mpl::vector<long,double> >::value)); + BOOST_TEST((FunctionReturningInt<AnotherType,double,boost::mpl::vector<int> >::value)); + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_GEN(aFunction)<AnotherType,AType,boost::mpl::vector<int> >::value)); + BOOST_TEST((AnotherIntFunction<AnotherType,int,boost::mpl::vector<AType> >::value)); + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_GEN(sFunction)<AnotherType,AType::AnIntType,boost::mpl::vector<int,long,double> >::value)); + BOOST_TEST((!BOOST_TTI_HAS_FUNCTION_GEN(someFunctionMember)<AnotherType,AType,boost::mpl::vector<long,int> >::value)); + BOOST_TEST((TheTIntFunction<AnotherType,AType,boost::mpl::vector<long,double> >::value)); + + // Passing non-class enclosing type will return false + + BOOST_TEST((!HaveTheSIntFunction<long,int,boost::mpl::vector<long,double> >::value)); + BOOST_TEST((!BOOST_TTI_HAS_FUNCTION_GEN(TSFunction)<AnotherType **,AType::AStructType,boost::mpl::vector<AType::AnIntType,double> >::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_fun.hpp b/src/boost/libs/tti/test/test_has_fun.hpp new file mode 100644 index 000000000..dd4a7bb50 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun.hpp @@ -0,0 +1,24 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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). + +#if !defined(BOOST_TEST_HAS_FUNCTION_HPP) +#define BOOST_TEST_HAS_FUNCTION_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_function.hpp> + +BOOST_TTI_HAS_FUNCTION(VoidFunction) +BOOST_TTI_TRAIT_HAS_FUNCTION(TheTIntFunction,TIntFunction) +BOOST_TTI_TRAIT_HAS_FUNCTION(FunctionReturningInt,IntFunction) +BOOST_TTI_HAS_FUNCTION(aFunction) +BOOST_TTI_TRAIT_HAS_FUNCTION(AnotherIntFunction,anotherFunction) +BOOST_TTI_TRAIT_HAS_FUNCTION(Pickedname,SomeStaticFunction) +BOOST_TTI_HAS_FUNCTION(sFunction) +BOOST_TTI_HAS_FUNCTION(someFunctionMember) +BOOST_TTI_TRAIT_HAS_FUNCTION(HaveTheSIntFunction,SIntFunction) +BOOST_TTI_HAS_FUNCTION(TSFunction) + +#endif // BOOST_TEST_HAS_FUNCTION_HPP diff --git a/src/boost/libs/tti/test/test_has_fun_compile.cpp b/src/boost/libs/tti/test/test_has_fun_compile.cpp new file mode 100644 index 000000000..af04abdc3 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_compile.cpp @@ -0,0 +1,34 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + TheTIntFunction<AType,void,boost::mpl::vector<long,double> > aVar; + BOOST_TTI_HAS_FUNCTION_GEN(someFunctionMember)<AnotherType,double,boost::mpl::vector<short,short,long,int> > aVar2; + Pickedname<AnotherType,AType,boost::mpl::vector<long,long> > aVar3; + FunctionReturningInt<AType,int,boost::mpl::vector<>,boost::function_types::volatile_qualified > aVar4; + + // Compile time asserts + + BOOST_MPL_ASSERT((TheTIntFunction<AnotherType,AType,boost::mpl::vector<long,double> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_GEN(VoidFunction)<AType,void>)); + BOOST_MPL_ASSERT((FunctionReturningInt<AType,int>)); + BOOST_MPL_ASSERT((FunctionReturningInt<AnotherType,double,boost::mpl::vector<int> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_GEN(TSFunction)<AnotherType,AType::AStructType,boost::mpl::vector<AType::AnIntType,double> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_GEN(aFunction)<AnotherType,AType,boost::mpl::vector<int> >)); + BOOST_MPL_ASSERT((AnotherIntFunction<AnotherType,int,boost::mpl::vector<AType> >)); + BOOST_MPL_ASSERT((HaveTheSIntFunction<AType,int,boost::mpl::vector<long,double> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_GEN(sFunction)<AnotherType,AType::AnIntType,boost::mpl::vector<int,long,double> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_fun_fail.cpp b/src/boost/libs/tti/test/test_has_fun_fail.cpp new file mode 100644 index 000000000..d80b64116 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature for sFunction + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_GEN(sFunction)<AnotherType,AType::AnIntType,boost::mpl::vector<short,long,double> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_fun_fail2.cpp b/src/boost/libs/tti/test/test_has_fun_fail2.cpp new file mode 100644 index 000000000..bbc465bbe --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_fail2.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_fun.hpp" + +int main() + { + + // Function signature has type which does not exist + + BOOST_TTI_HAS_FUNCTION_GEN(sFunction)<NVType,AType::AnIntType,boost::mpl::vector<short,long,double> > aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_fun_fail3.cpp b/src/boost/libs/tti/test/test_has_fun_fail3.cpp new file mode 100644 index 000000000..9d830f5fa --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature for SIntFunction + + BOOST_MPL_ASSERT((HaveTheSIntFunction<AType,int,boost::mpl::vector<float,double> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_fun_fail4.cpp b/src/boost/libs/tti/test/test_has_fun_fail4.cpp new file mode 100644 index 000000000..54e0dbdee --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_fail4.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_fun.hpp" + +int main() + { + + // Function signature has type which does not exist + + BOOST_TTI_HAS_FUNCTION_GEN(TSFunction)<AnotherType,AType::AClassType,boost::mpl::vector<AType::AnIntType,double> > aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_fun_fail5.cpp b/src/boost/libs/tti/test/test_has_fun_fail5.cpp new file mode 100644 index 000000000..3eea9dafb --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_fail5.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2012,2013 +// Use, modification and distribution are subject to 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 "test_has_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete function prototype + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_GEN(aFunction)<AnotherType,AType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_fun_template.cpp b/src/boost/libs/tti/test/test_has_fun_template.cpp new file mode 100644 index 000000000..0f460fdb4 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_template.cpp @@ -0,0 +1,33 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_fun_template.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<AType::AStructType,int,boost::mpl::vector<int *,bool> >::value)); + BOOST_TEST((Sftem<AType::BType::CType,double,boost::mpl::vector<char,unsigned *,float &> >::value)); + BOOST_TEST((AnFT<AType,int,boost::mpl::vector<const unsigned &> >::value)); + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(AFuncTemplate)<AType,void,boost::mpl::vector<double *,unsigned char,int &> >::value)); + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(FTHasDef)<AType,double,boost::mpl::vector<int, long, char> >::value)); + BOOST_TEST((ACFunTem<AType,double,boost::mpl::vector<unsigned,int>,boost::function_types::const_qualified>::value)); + BOOST_TEST((WConstFT<AType,void,boost::mpl::vector<int **, long &, unsigned long>,boost::function_types::const_qualified>::value)); + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(AVolatileFT)<AType,double,boost::mpl::vector<int, long, char>,boost::function_types::volatile_qualified>::value)); + BOOST_TEST((VTempl<AType,void,boost::mpl::vector<int &>,boost::function_types::volatile_qualified>::value)); + BOOST_TEST((ACVF<AType,double,boost::mpl::vector<int,long>,boost::function_types::cv_qualified>::value)); + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(ConstVolTTFun)<AType,void,boost::mpl::vector<float,double>,boost::function_types::cv_qualified>::value)); + BOOST_TEST((AnotherFT<AType,void,boost::mpl::vector<int,long &,const bool &> >::value)); + + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(MyFuncTemplate)<AnotherType,long,boost::mpl::vector<unsigned char &> >::value)); + BOOST_TEST((VWDef<AnotherType,void,boost::mpl::vector<float,double>,boost::function_types::volatile_qualified>::value)); + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,void,boost::mpl::vector<const int &,unsigned char &> >::value)); + BOOST_TEST((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(StaticFTWithDefault)<AnotherType,void,boost::mpl::vector<const long &,int &,long *,long> >::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_fun_template.hpp b/src/boost/libs/tti/test/test_has_fun_template.hpp new file mode 100644 index 000000000..128856fd8 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_template.hpp @@ -0,0 +1,61 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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). + +#if !defined(BOOST_TEST_HAS_FUNCTION_TEMPLATE_HPP) +#define BOOST_TEST_HAS_FUNCTION_TEMPLATE_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_function_template.hpp> + +#if BOOST_PP_VARIADICS + +BOOST_TTI_HAS_FUNCTION_TEMPLATE(StatFuncTemplate,int,bool,37) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(Sftem,SomeFuncTemplate,char,unsigned,float,925) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(AnFT,AFuncTemplate,unsigned,45623) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(AFuncTemplate,double,unsigned char,int) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(FTHasDef,int) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(ACFunTem,AConstFunctionTemplate,unsigned,int) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(WConstFT,WFunctionTmp,int,long,unsigned long) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(AVolatileFT,int) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(VTempl,VolFTem,int,44339) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(ACVF,ACVFunTemplate,int,long) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(ConstVolTTFun,7371) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(AnotherFT,AnotherFuncTemplate,int,long,bool) + +BOOST_TTI_HAS_FUNCTION_TEMPLATE(MyFuncTemplate,unsigned char) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(VWDef,VWithDefault,3281) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(YetAnotherFuncTemplate,int,unsigned char) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(StaticFTWithDefault,long,int,long) + +BOOST_TTI_HAS_FUNCTION_TEMPLATE(Nonexistent,int,long) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(NotExist,TDoesNotExist,char) + +#else + +BOOST_TTI_HAS_FUNCTION_TEMPLATE(StatFuncTemplate,(3,(int,bool,37))) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(Sftem,SomeFuncTemplate,(4,(char,unsigned,float,925))) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(AnFT,AFuncTemplate,(2,(unsigned,45623))) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(AFuncTemplate,(3,(double,unsigned char,int))) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(FTHasDef,(1,(int))) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(ACFunTem,AConstFunctionTemplate,(2,(unsigned,int))) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(WConstFT,WFunctionTmp,(3,(int,long,unsigned long))) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(AVolatileFT,(1,(int))) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(VTempl,VolFTem,(2,(int,44339))) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(ACVF,ACVFunTemplate,(2,(int,long))) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(ConstVolTTFun,(1,(7371))) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(AnotherFT,AnotherFuncTemplate,(3,(int,long,bool))) + +BOOST_TTI_HAS_FUNCTION_TEMPLATE(MyFuncTemplate,(1,(unsigned char))) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(VWDef,VWithDefault,(1,(3281))) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(YetAnotherFuncTemplate,(2,(int,unsigned char))) +BOOST_TTI_HAS_FUNCTION_TEMPLATE(StaticFTWithDefault,(3,(long,int,long))) + +BOOST_TTI_HAS_FUNCTION_TEMPLATE(Nonexistent,(2,(int,long))) +BOOST_TTI_TRAIT_HAS_FUNCTION_TEMPLATE(NotExist,TDoesNotExist,(1,(char))) + +#endif + +#endif // BOOST_TEST_HAS_FUNCTION_TEMPLATE_HPP diff --git a/src/boost/libs/tti/test/test_has_fun_template_compile.cpp b/src/boost/libs/tti/test/test_has_fun_template_compile.cpp new file mode 100644 index 000000000..e49bb2bc3 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_template_compile.cpp @@ -0,0 +1,40 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + Sftem<AType,double,boost::mpl::vector<int,unsigned *,float &> > aVar; + BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(Nonexistent)<AType,int,boost::mpl::vector<short,bool,int> > aVar2; + NotExist<AnotherType,AType,boost::mpl::vector<long,char> > aVar3; + BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<AType::AStructType,int,boost::mpl::vector<int *,bool>,boost::function_types::const_qualified> aVar4; + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<AType::AStructType,int,boost::mpl::vector<int *,bool> >)); + BOOST_MPL_ASSERT((Sftem<AType::BType::CType,double,boost::mpl::vector<char,unsigned *,float &> >)); + BOOST_MPL_ASSERT((AnFT<AType,int,boost::mpl::vector<const unsigned &> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(AFuncTemplate)<AType,void,boost::mpl::vector<double *,unsigned char,int &> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(FTHasDef)<AType,double,boost::mpl::vector<int, long, char> >)); + BOOST_MPL_ASSERT((ACFunTem<AType,double,boost::mpl::vector<unsigned,int>,boost::function_types::const_qualified>)); + BOOST_MPL_ASSERT((WConstFT<AType,void,boost::mpl::vector<int **, long &, unsigned long>,boost::function_types::const_qualified>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(AVolatileFT)<AType,double,boost::mpl::vector<int, long, char>,boost::function_types::volatile_qualified>)); + BOOST_MPL_ASSERT((VTempl<AType,void,boost::mpl::vector<int &>,boost::function_types::volatile_qualified>)); + BOOST_MPL_ASSERT((ACVF<AType,double,boost::mpl::vector<int,long>,boost::function_types::cv_qualified>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(ConstVolTTFun)<AType,void,boost::mpl::vector<float,double>,boost::function_types::cv_qualified>)); + BOOST_MPL_ASSERT((AnotherFT<AType,void,boost::mpl::vector<int,long &,const bool &> >)); + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(MyFuncTemplate)<AnotherType,long,boost::mpl::vector<unsigned char &> >)); + BOOST_MPL_ASSERT((VWDef<AnotherType,void,boost::mpl::vector<float,double>,boost::function_types::volatile_qualified>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,void,boost::mpl::vector<const int &,unsigned char &> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(StaticFTWithDefault)<AnotherType,void,boost::mpl::vector<const long &,int &,long *,long> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_fun_template_fail.cpp b/src/boost/libs/tti/test/test_has_fun_template_fail.cpp new file mode 100644 index 000000000..951279cb9 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_template_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature for AFuncTemplate + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(AFuncTemplate)<AType,void,boost::mpl::vector<double *,unsigned char,short &> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_fun_template_fail2.cpp b/src/boost/libs/tti/test/test_has_fun_template_fail2.cpp new file mode 100644 index 000000000..b18fb85c2 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_template_fail2.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_fun_template.hpp" + +int main() + { + + // Function signature has type which does not exist + + BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<NVType,int,boost::mpl::vector<int *,bool> > aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_fun_template_fail3.cpp b/src/boost/libs/tti/test/test_has_fun_template_fail3.cpp new file mode 100644 index 000000000..d161d3d0a --- /dev/null +++ b/src/boost/libs/tti/test/test_has_fun_template_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete function prototype + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_FUNCTION_TEMPLATE_GEN(FTHasDef)<AType,double,boost::mpl::vector<int, long> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_data.cpp b/src/boost/libs/tti/test/test_has_mem_data.cpp new file mode 100644 index 000000000..2f36f4e6c --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_data.cpp @@ -0,0 +1,36 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_data.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_DATA_GEN(AnInt)<AType,int>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_DATA_GEN(AnInt)<AnotherType,long>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_DATA_GEN(aMember)<AnotherType,bool>::value)); + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_DATA_GEN(aMember)<AnotherType,int>::value)); + BOOST_TEST((CMember<AnotherType,bool>::value)); + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_DATA_GEN(someDataMember)<AType,short>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_DATA_GEN(IntBT)<AType,AType::BType>::value)); + BOOST_TEST((NestedData<AType,AType::BType::CType>::value)); + BOOST_TEST((AOther<AnotherType,AType>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_DATA_GEN(ONestStr)<AnotherType,AType::AStructType>::value)); + + BOOST_TEST((CUb<AType::BType::CType::CTypeUnion,bool>::value)); + + + // Test enclosing class as non-class type + + BOOST_TEST((!CMember<bool,bool>::value)); + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_DATA_GEN(AnInt)<int,long>::value)); + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_DATA_GEN(IntBT)<AType &,AType::BType>::value)); + BOOST_TEST((!AOther<double *,AType>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_mem_data.hpp b/src/boost/libs/tti/test/test_has_mem_data.hpp new file mode 100644 index 000000000..75409491e --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_data.hpp @@ -0,0 +1,24 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_MEMBER_DATA_HPP) +#define TEST_HAS_MEMBER_DATA_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_member_data.hpp> + +BOOST_TTI_HAS_MEMBER_DATA(AnInt) +BOOST_TTI_HAS_MEMBER_DATA(aMember) +BOOST_TTI_TRAIT_HAS_MEMBER_DATA(CMember,cMem) +BOOST_TTI_HAS_MEMBER_DATA(someDataMember) +BOOST_TTI_HAS_MEMBER_DATA(IntBT) +BOOST_TTI_TRAIT_HAS_MEMBER_DATA(NestedData,NestedCT) +BOOST_TTI_TRAIT_HAS_MEMBER_DATA(AOther,OtherAT) +BOOST_TTI_HAS_MEMBER_DATA(ONestStr) + +BOOST_TTI_TRAIT_HAS_MEMBER_DATA(CUb,b) + +#endif // TEST_HAS_MEMBER_DATA_HPP diff --git a/src/boost/libs/tti/test/test_has_mem_data2.cpp b/src/boost/libs/tti/test/test_has_mem_data2.cpp new file mode 100644 index 000000000..c3acaa862 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_data2.cpp @@ -0,0 +1,28 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_mem_data.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_DATA_GEN(AnInt)<int AType::*>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_DATA_GEN(AnInt)<long AnotherType::*>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_DATA_GEN(aMember)<bool AnotherType::*>::value)); + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_DATA_GEN(aMember)<int AnotherType::*>::value)); + BOOST_TEST((CMember<bool AnotherType::*>::value)); + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_DATA_GEN(someDataMember)<short AType::*>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_DATA_GEN(IntBT)<AType::BType AType::*>::value)); + BOOST_TEST((NestedData<AType::BType::CType AType::*>::value)); + BOOST_TEST((AOther<AType AnotherType::*>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_DATA_GEN(ONestStr)<AType::AStructType AnotherType::*>::value)); + + BOOST_TEST((CUb<bool AType::BType::CType::CTypeUnion::*>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_mem_data_compile.cpp b/src/boost/libs/tti/test/test_has_mem_data_compile.cpp new file mode 100644 index 000000000..e5d31f187 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_data_compile.cpp @@ -0,0 +1,31 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_MEMBER_DATA_GEN(aMember)<AType,long> aVar; + BOOST_TTI_HAS_MEMBER_DATA_GEN(someDataMember)<AnotherType,double> aVar2; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_DATA_GEN(AnInt)<AType,int>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_DATA_GEN(AnInt)<AnotherType,long>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_DATA_GEN(aMember)<AnotherType,bool>)); + BOOST_MPL_ASSERT((CMember<AnotherType,bool>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_DATA_GEN(IntBT)<AType,AType::BType>)); + BOOST_MPL_ASSERT((NestedData<AType,AType::BType::CType>)); + BOOST_MPL_ASSERT((AOther<AnotherType,AType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_DATA_GEN(ONestStr)<AnotherType,AType::AStructType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_data_fail.cpp b/src/boost/libs/tti/test/test_has_mem_data_fail.cpp new file mode 100644 index 000000000..50d059e4e --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_data_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // someDataMember does not exist at all + + BOOST_MPL_ASSERT(( BOOST_TTI_HAS_MEMBER_DATA_GEN(someDataMember)<AType,short> )); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_data_fail2.cpp b/src/boost/libs/tti/test/test_has_mem_data_fail2.cpp new file mode 100644 index 000000000..b0f782abe --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_data_fail2.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong data signature for aMember + + BOOST_MPL_ASSERT(( BOOST_TTI_HAS_MEMBER_DATA_GEN(aMember)<AnotherType,int> )); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_data_fail3.cpp b/src/boost/libs/tti/test/test_has_mem_data_fail3.cpp new file mode 100644 index 000000000..eeefccabd --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_data_fail3.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_data.hpp" + +int main() + { + + // Data signature has type which does not exist + + BOOST_TTI_HAS_MEMBER_DATA_GEN(aMember)<AnotherType,AType::NTHType> aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun.cpp b/src/boost/libs/tti/test/test_has_mem_fun.cpp new file mode 100644 index 000000000..0cc6a6749 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun.cpp @@ -0,0 +1,32 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(VoidFunction)<AType,void>::value)); + BOOST_TEST((FunctionReturningInt<AType,int>::value)); + BOOST_TEST((FunctionReturningInt<AnotherType,double,boost::mpl::vector<int> >::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(aFunction)<AnotherType,AType,boost::mpl::vector<int> >::value)); + BOOST_TEST((AnotherIntFunction<AnotherType,int,boost::mpl::vector<AType> >::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AnotherType,AType::AnIntType,boost::mpl::vector<int,long,double> >::value)); + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(someFunctionMember)<AnotherType,AType,boost::mpl::vector<long,int> >::value)); + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(CMemberFunction)<AType::BType::CType::CTypeUnion,void,boost::mpl::vector<int> >::value)); + + // Test enclosing class as non-class type + + BOOST_TEST((!AnotherIntFunction<short,int,boost::mpl::vector<AType> >::value)); + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(VoidFunction)<unsigned,void>::value)); + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AnotherType *,AType::AnIntType,boost::mpl::vector<int,long,double> >::value)); + BOOST_TEST((!FunctionReturningInt<float ***,int>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun.hpp b/src/boost/libs/tti/test/test_has_mem_fun.hpp new file mode 100644 index 000000000..a4cba480f --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun.hpp @@ -0,0 +1,37 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_MEMBER_FUNCTION_HPP) +#define TEST_HAS_MEMBER_FUNCTION_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_member_function.hpp> + +BOOST_TTI_HAS_MEMBER_FUNCTION(VoidFunction) +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(FunctionReturningInt,IntFunction) +BOOST_TTI_HAS_MEMBER_FUNCTION(aFunction) +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(AnotherIntFunction,anotherFunction) +BOOST_TTI_HAS_MEMBER_FUNCTION(sFunction) +BOOST_TTI_HAS_MEMBER_FUNCTION(someFunctionMember) + +BOOST_TTI_HAS_MEMBER_FUNCTION(CMemberFunction) + +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(AskIfConst,WFunction) // const +BOOST_TTI_HAS_MEMBER_FUNCTION(AnotherConstFunction) // const +BOOST_TTI_HAS_MEMBER_FUNCTION(AConstFunction) // const +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(StillTest,StillSame) // const + +BOOST_TTI_HAS_MEMBER_FUNCTION(AVolatileFunction) // volatile +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(Volly,VolFunction) // volatile +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(AnVol,AnotherVolatileFunction) // volatile +BOOST_TTI_HAS_MEMBER_FUNCTION(StillVolatile) // volatile + +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(CVBoth,ACVFunction) // const volatile +BOOST_TTI_HAS_MEMBER_FUNCTION(ConstVolFunction) // const volatile +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(CVAnother,AnotherConstVolatileFunction) // const volatile +BOOST_TTI_HAS_MEMBER_FUNCTION(StillCV) // const volatile + +#endif // TEST_HAS_MEMBER_FUNCTION_HPP diff --git a/src/boost/libs/tti/test/test_has_mem_fun_compile.cpp b/src/boost/libs/tti/test/test_has_mem_fun_compile.cpp new file mode 100644 index 000000000..58a65fdbf --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_compile.cpp @@ -0,0 +1,28 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(someFunctionMember)<AnotherType,double,boost::mpl::vector<short,short,long,int> > aVar3; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(VoidFunction)<AType,void>)); + BOOST_MPL_ASSERT((FunctionReturningInt<AType,int>)); + BOOST_MPL_ASSERT((FunctionReturningInt<AnotherType,double,boost::mpl::vector<int> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(aFunction)<AnotherType,AType,boost::mpl::vector<int> >)); + BOOST_MPL_ASSERT((AnotherIntFunction<AnotherType,int,boost::mpl::vector<AType> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AnotherType,AType::AnIntType,boost::mpl::vector<int,long,double> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_cv.cpp b/src/boost/libs/tti/test/test_has_mem_fun_cv.cpp new file mode 100644 index 000000000..adb6c97ee --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_cv.cpp @@ -0,0 +1,45 @@ + +// (C) Copyright Edward Diener 2012 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + // Use const enclosing type + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AConstFunction)<const AType,double,boost::mpl::vector<long,char> >::value)); + BOOST_TEST((StillTest<const AnotherType,AType,boost::mpl::vector<int> >::value)); + + // Use const_qualified + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AnotherConstFunction)<AnotherType,int,boost::mpl::vector<AType *, short>,boost::function_types::const_qualified>::value)); + BOOST_TEST((AskIfConst<AType,void,boost::mpl::vector<float,double>,boost::function_types::const_qualified>::value)); + + // Use volatile enclosing type + + BOOST_TEST((AnVol<volatile AnotherType,int,boost::mpl::vector<AType *,short> >::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AVolatileFunction)<volatile AType,double,boost::mpl::vector<long,char> >::value)); + + // Use volatile_qualified + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillVolatile)<AnotherType,bool,boost::mpl::vector<int>,boost::function_types::volatile_qualified>::value)); + BOOST_TEST((Volly<AType,void,boost::mpl::vector<float,double>,boost::function_types::volatile_qualified>::value)); + + // Use const volatile enclosing type + + BOOST_TEST((CVAnother<const volatile AnotherType,int,boost::mpl::vector<AType *,short> >::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillCV)<const volatile AnotherType,short,boost::mpl::vector<int> >::value)); + + // Use cv_qualified + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(ConstVolFunction)<AType,void,boost::mpl::vector<float,double>,boost::function_types::cv_qualified>::value)); + BOOST_TEST((CVBoth<AType,double,boost::mpl::vector<long,char>,boost::function_types::cv_qualified>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_cv_compile.cpp b/src/boost/libs/tti/test/test_has_mem_fun_cv_compile.cpp new file mode 100644 index 000000000..f424cce44 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_cv_compile.cpp @@ -0,0 +1,49 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors even if the member function does not exist + + BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(someFunctionMember)<AnotherType,double,boost::mpl::vector<short,short,long,int>,boost::function_types::const_qualified> aVar1; + + // Use const enclosing type + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AnotherConstFunction)<const AnotherType,int,boost::mpl::vector<AType *, short> >)); + BOOST_MPL_ASSERT((AskIfConst<const AType,void,boost::mpl::vector<float,double> >)); + + // Use const_qualified + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AConstFunction)<AType,double,boost::mpl::vector<long,char>,boost::function_types::const_qualified>)); + BOOST_MPL_ASSERT((StillTest<AnotherType,AType,boost::mpl::vector<int>,boost::function_types::const_qualified>)); + + // Use volatile enclosing type + + BOOST_MPL_ASSERT((AnVol<volatile AnotherType,int,boost::mpl::vector<AType *,short> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AVolatileFunction)<volatile AType,double,boost::mpl::vector<long,char> >)); + + // Use volatile_qualified + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillVolatile)<AnotherType,bool,boost::mpl::vector<int>,boost::function_types::volatile_qualified>)); + BOOST_MPL_ASSERT((Volly<AType,void,boost::mpl::vector<float,double>,boost::function_types::volatile_qualified>)); + + // Use const volatile enclosing type + + BOOST_MPL_ASSERT((CVAnother<const volatile AnotherType,int,boost::mpl::vector<AType *,short> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillCV)<const volatile AnotherType,short,boost::mpl::vector<int> >)); + + // Use cv_qualified + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(ConstVolFunction)<AType,void,boost::mpl::vector<float,double>,boost::function_types::cv_qualified>)); + BOOST_MPL_ASSERT((CVBoth<AType,double,boost::mpl::vector<long,char>,boost::function_types::cv_qualified>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_cv_fail.cpp b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail.cpp new file mode 100644 index 000000000..97d79466b --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function is const + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AnotherConstFunction)<AnotherType,int,boost::mpl::vector<AType *, short> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_cv_fail2.cpp b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail2.cpp new file mode 100644 index 000000000..7520b4d4c --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail2.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function is not const + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(aFunction)<const AnotherType,AType,boost::mpl::vector<int> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_cv_fail3.cpp b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail3.cpp new file mode 100644 index 000000000..4c6bffb79 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function is const volatile + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(ConstVolFunction)<const AType,void,boost::mpl::vector<float,double> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_cv_fail4.cpp b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail4.cpp new file mode 100644 index 000000000..4f807c98a --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail4.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function is volatile + + BOOST_MPL_ASSERT((Volly<AType,void,boost::mpl::vector<float,double>,boost::function_types::cv_qualified>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_cv_fail5.cpp b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail5.cpp new file mode 100644 index 000000000..518df2476 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail5.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete member function prototype + + BOOST_MPL_ASSERT((AskIfConst<const AType,void,boost::mpl::vector<float> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_cv_fail6.cpp b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail6.cpp new file mode 100644 index 000000000..e3e3589a5 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_cv_fail6.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete member function prototype + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillCV)<const volatile AnotherType,short>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_fail.cpp b/src/boost/libs/tti/test/test_has_mem_fun_fail.cpp new file mode 100644 index 000000000..8ca705907 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature for sFunction + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AnotherType,AType::AnIntType,boost::mpl::vector<short,long,double> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_fail2.cpp b/src/boost/libs/tti/test/test_has_mem_fun_fail2.cpp new file mode 100644 index 000000000..df3e4b9e3 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_fail2.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" + +int main() + { + + // Function signature has type which does not exist + + BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<NVType,AType::AnIntType,boost::mpl::vector<short,long,double> > aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_fail3.cpp b/src/boost/libs/tti/test/test_has_mem_fun_fail3.cpp new file mode 100644 index 000000000..414e02ec6 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011,2012,2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete member function prototype + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AnotherType,AType::AnIntType,boost::mpl::vector<int> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template.cpp b/src/boost/libs/tti/test/test_has_mem_fun_template.cpp new file mode 100644 index 000000000..1bc87aca8 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template.cpp @@ -0,0 +1,36 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(SomeFuncTemplate)<AType::BType::CType,double,boost::mpl::vector<int,long *,double &> >::value)); + BOOST_TEST((SameName<AType,void,boost::mpl::vector<int *,int,float &> >::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(AFuncTemplate)<AType,int,boost::mpl::vector<const long &> >::value)); + BOOST_TEST((AnotherName<AnotherType,long,boost::mpl::vector<bool &> >::value)); + + // Wrong enclosing type + + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(SomeFuncTemplate)<AType::BType,double,boost::mpl::vector<int,long *,double &> >::value)); + + // Wrong return value + + BOOST_TEST((!SameName<AType,int,boost::mpl::vector<int *,int,float &> >::value)); + + // Mismatched paramaters + + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(AFuncTemplate)<AType,int,boost::mpl::vector<const bool &> >::value)); + + // Invalid enclosing type + + BOOST_TEST((!AnotherName<int,long,boost::mpl::vector<bool &> >::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template.hpp b/src/boost/libs/tti/test/test_has_mem_fun_template.hpp new file mode 100644 index 000000000..fa2d762fd --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template.hpp @@ -0,0 +1,59 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_MEM_FUN_TEMPLATE_HPP) +#define TEST_HAS_MEM_FUN_TEMPLATE_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_member_function_template.hpp> + +#if BOOST_PP_VARIADICS + +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(SomeFuncTemplate,int,long,double,50) +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(SameName,AFuncTemplate,int,int,float) +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(AFuncTemplate,long,9983) +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(AnotherName,MyFuncTemplate,bool) + +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(someFunctionMemberTemplate,short,int) // does not exist anywhere + +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(FTD,FTHasDef,int) // default parameter + +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(FirstCMFT,AConstFunctionTemplate,short,long) // const +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(WFunctionTmp,int,long,bool) // const + +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(AVolatileFT,float) // volatile +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(VolG,VolFTem,long,44) // volatile + +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(VWithDefault,46389) // volatile default parameter + +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(ACV,ACVFunTemplate,int,short) // const volatile +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(ConstVolTTFun,8764) // const volatile + +#else + +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(SomeFuncTemplate,(4,(int,long,double,50))) +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(SameName,AFuncTemplate,(3,(int,int,float))) +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(AFuncTemplate,(2,(long,9983))) +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(AnotherName,MyFuncTemplate,(1,(bool))) + +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(someFunctionMemberTemplate,(2,(short,int))) // does not exist anywhere + +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(FTD,FTHasDef,(1,(int))) // default parameter + +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(FirstCMFT,AConstFunctionTemplate,(2,(short,long))) // const +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(WFunctionTmp,(3,(int,long,bool))) // const + +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(AVolatileFT,(1,(float))) // volatile +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(VolG,VolFTem,(2,(long,44))) // volatile + +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(VWithDefault,(1,(46389))) // volatile default parameter + +BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION_TEMPLATE(ACV,ACVFunTemplate,(2,(int,short))) // const volatile +BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE(ConstVolTTFun,(1,(8764))) // const volatile + +#endif + +#endif // TEST_HAS_MEM_FUN_TEMPLATE_HPP diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template_compile.cpp b/src/boost/libs/tti/test/test_has_mem_fun_template_compile.cpp new file mode 100644 index 000000000..c8d79d0a6 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template_compile.cpp @@ -0,0 +1,26 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(someFunctionMemberTemplate)<AnotherType,int,boost::mpl::vector<float,long,bool> > aVar; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(SomeFuncTemplate)<AType::BType::CType,double,boost::mpl::vector<int,long *,double &> >)); + BOOST_MPL_ASSERT((SameName<AType,void,boost::mpl::vector<int *,int,float &> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(AFuncTemplate)<AType,int,boost::mpl::vector<const long &> >)); + BOOST_MPL_ASSERT((AnotherName<AnotherType,long,boost::mpl::vector<bool &> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template_cv.cpp b/src/boost/libs/tti/test/test_has_mem_fun_template_cv.cpp new file mode 100644 index 000000000..83de93e33 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template_cv.cpp @@ -0,0 +1,39 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + // Use const enclosing type + + BOOST_TEST((FirstCMFT<const AType,double,boost::mpl::vector<short,long> >::value)); + + // Use const_qualified + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(WFunctionTmp)<AType,void,boost::mpl::vector<int **, long &, bool>,boost::function_types::const_qualified>::value)); + + // Use volatile enclosing type + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(AVolatileFT)<volatile AType,double,boost::mpl::vector<float, long, char> >::value)); + + // Use volatile_qualified + + BOOST_TEST((VolG<AType,void,boost::mpl::vector<long &>,boost::function_types::volatile_qualified>::value)); + + // Use const volatile enclosing type + + BOOST_TEST((ACV<const volatile AType,double,boost::mpl::vector<int,short> >::value)); + + // Use const_volatile_qualified + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(ConstVolTTFun)<AType,void,boost::mpl::vector<float,double>,boost::function_types::cv_qualified>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template_cv_compile.cpp b/src/boost/libs/tti/test/test_has_mem_fun_template_cv_compile.cpp new file mode 100644 index 000000000..a34530d04 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template_cv_compile.cpp @@ -0,0 +1,40 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Use const enclosing type + + BOOST_MPL_ASSERT((FirstCMFT<const AType,double,boost::mpl::vector<short,long> >)); + + // Use const_qualified + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(WFunctionTmp)<AType,void,boost::mpl::vector<int **, long &, bool>,boost::function_types::const_qualified>)); + + // Use volatile enclosing type + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(AVolatileFT)<volatile AType,double,boost::mpl::vector<float, long, char> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(VWithDefault)<volatile AnotherType,void,boost::mpl::vector<float,double> >)); + + // Use volatile_qualified + + BOOST_MPL_ASSERT((VolG<AType,void,boost::mpl::vector<long &>,boost::function_types::volatile_qualified>)); + + // Use const volatile enclosing type + + BOOST_MPL_ASSERT((ACV<const volatile AType,double,boost::mpl::vector<int,short> >)); + + // Use const_volatile_qualified + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(ConstVolTTFun)<AType,void,boost::mpl::vector<float,double>,boost::function_types::cv_qualified>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template_cv_fail.cpp b/src/boost/libs/tti/test/test_has_mem_fun_template_cv_fail.cpp new file mode 100644 index 000000000..db8bb4ce4 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template_cv_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function template is const, not volatile + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(WFunctionTmp)<AType,void,boost::mpl::vector<int **, long &, bool>,boost::function_types::volatile_qualified>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template_cv_fail2.cpp b/src/boost/libs/tti/test/test_has_mem_fun_template_cv_fail2.cpp new file mode 100644 index 000000000..67f804185 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template_cv_fail2.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function template is const volatile + + BOOST_MPL_ASSERT((ACV<AType,double,boost::mpl::vector<int,short> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template_cv_fail3.cpp b/src/boost/libs/tti/test/test_has_mem_fun_template_cv_fail3.cpp new file mode 100644 index 000000000..17c452827 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template_cv_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete member function prototype + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(VWithDefault)<volatile AnotherType,void,boost::mpl::vector<float> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template_fail.cpp b/src/boost/libs/tti/test/test_has_mem_fun_template_fail.cpp new file mode 100644 index 000000000..0746ca56e --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature + + BOOST_MPL_ASSERT((AnotherName<AnotherType,long,boost::mpl::vector<int &> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template_fail2.cpp b/src/boost/libs/tti/test/test_has_mem_fun_template_fail2.cpp new file mode 100644 index 000000000..fe4f979fa --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template_fail2.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" + +int main() + { + + // Function signature has type which does not exist + + SameName<InvalidType,void,boost::mpl::vector<int *,int,float &> > aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_mem_fun_template_fail3.cpp b/src/boost/libs/tti/test/test_has_mem_fun_template_fail3.cpp new file mode 100644 index 000000000..839b0c967 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_mem_fun_template_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete member function prototype + + BOOST_MPL_ASSERT((FTD<AType,double,boost::mpl::vector<int,long> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member.cpp b/src/boost/libs/tti/test/test_has_member.cpp new file mode 100644 index 000000000..4ce463355 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member.cpp @@ -0,0 +1,23 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(VoidFunction)<void (AType::*)()>::value)); + BOOST_TEST(FunctionReturningInt<int (AType::*)()>::value); + BOOST_TEST(FunctionReturningInt<double (AnotherType::*)(int)>::value); + BOOST_TEST(BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(aFunction)<AType (AnotherType::*)(int)>::value); + BOOST_TEST(AnotherIntFunction<int (AnotherType::*)(AType)>::value); + BOOST_TEST(BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AType::AnIntType (AnotherType::*)(int,long,double)>::value); + BOOST_TEST(!BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(someFunctionMember)<AType (AnotherType::*)(long,int)>::value); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_member_compile.cpp b/src/boost/libs/tti/test/test_has_member_compile.cpp new file mode 100644 index 000000000..372ad0280 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_compile.cpp @@ -0,0 +1,28 @@ + +// (C) Copyright Edward Diener 2011,2012 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(someFunctionMember)<double (AnotherType::*)(short,short,long,int)> aVar3; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(VoidFunction)<void (AType::*)()>)); + BOOST_MPL_ASSERT((FunctionReturningInt<int (AType::*)()>)); + BOOST_MPL_ASSERT((FunctionReturningInt<double (AnotherType::*)(int)>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(aFunction)<AType (AnotherType::*)(int)>)); + BOOST_MPL_ASSERT((AnotherIntFunction<int (AnotherType::*)(AType)>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AType::AnIntType (AnotherType::*)(int,long,double)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_cv.cpp b/src/boost/libs/tti/test/test_has_member_cv.cpp new file mode 100644 index 000000000..44db949d2 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_cv.cpp @@ -0,0 +1,36 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + // Use const + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AConstFunction)<double (AType::*)(long,char) const>::value)); + BOOST_TEST((StillTest<AType (AnotherType::*)(int) const>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AnotherConstFunction)<int (AnotherType::*)(AType *, short) const>::value)); + BOOST_TEST((AskIfConst<void (AType::*)(float,double) const>::value)); + + // Use volatile + + BOOST_TEST((AnVol<int (AnotherType::*)(AType *,short) volatile>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AVolatileFunction)<double (AType::*)(long,char) volatile>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillVolatile)<bool (AnotherType::*)(int) volatile>::value)); + BOOST_TEST((Volly<void (AType::*)(float,double) volatile>::value)); + + // Use const volatile + + BOOST_TEST((CVAnother<int (AnotherType::*)(AType *,short) const volatile>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillCV)<short (AnotherType::*)(int) const volatile>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(ConstVolFunction)<void (AType::*)(float,double) const volatile>::value)); + BOOST_TEST((CVBoth<double (AType::*)(long,char) const volatile>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_member_cv_compile.cpp b/src/boost/libs/tti/test/test_has_member_cv_compile.cpp new file mode 100644 index 000000000..4a11d2222 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_cv_compile.cpp @@ -0,0 +1,40 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(someFunctionMember)<double (AnotherType::*)(short,short,long,int) volatile> aVar1; + + // Use const + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AConstFunction)<double (AType::*)(long,char) const>)); + BOOST_MPL_ASSERT((StillTest<AType (AnotherType::*)(int) const>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AnotherConstFunction)<int (AnotherType::*)(AType *, short) const>)); + BOOST_MPL_ASSERT((AskIfConst<void (AType::*)(float,double) const>)); + + // Use volatile + + BOOST_MPL_ASSERT((AnVol<int (AnotherType::*)(AType *,short) volatile>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AVolatileFunction)<double (AType::*)(long,char) volatile>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillVolatile)<bool (AnotherType::*)(int) volatile>)); + BOOST_MPL_ASSERT((Volly<void (AType::*)(float,double) volatile>)); + + // Use const volatile + + BOOST_MPL_ASSERT((CVAnother<int (AnotherType::*)(AType *,short) const volatile>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillCV)<short (AnotherType::*)(int) const volatile>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(ConstVolFunction)<void (AType::*)(float,double) const volatile>)); + BOOST_MPL_ASSERT((CVBoth<double (AType::*)(long,char) const volatile>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_cv_fail.cpp b/src/boost/libs/tti/test/test_has_member_cv_fail.cpp new file mode 100644 index 000000000..548824782 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_cv_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function is not const + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(aFunction)<AType (AnotherType::*)(int) const>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_cv_fail2.cpp b/src/boost/libs/tti/test/test_has_member_cv_fail2.cpp new file mode 100644 index 000000000..a194dc46c --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_cv_fail2.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function is const + + BOOST_MPL_ASSERT((AskIfConst<void (AType::*)(float,double)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_cv_fail3.cpp b/src/boost/libs/tti/test/test_has_member_cv_fail3.cpp new file mode 100644 index 000000000..a1a5c3f7b --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_cv_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function is const volatile, not volatile + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(StillCV)<short (AnotherType::*)(int) volatile>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_cv_fail4.cpp b/src/boost/libs/tti/test/test_has_member_cv_fail4.cpp new file mode 100644 index 000000000..8cf40d319 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_cv_fail4.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function is volatile, not const + + BOOST_MPL_ASSERT((AnVol<int (AnotherType::*)(AType *,short) const>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_cv_fail5.cpp b/src/boost/libs/tti/test/test_has_member_cv_fail5.cpp new file mode 100644 index 000000000..c973b7501 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_cv_fail5.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete member function prototype + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(AVolatileFunction)<double (AType::*)(long) volatile>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_fail.cpp b/src/boost/libs/tti/test/test_has_member_fail.cpp new file mode 100644 index 000000000..aeb4f6693 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature for sFunction + + BOOST_MPL_ASSERT(( BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AType::AnIntType (AnotherType::*)(short,long,double)> )); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_fail2.cpp b/src/boost/libs/tti/test/test_has_member_fail2.cpp new file mode 100644 index 000000000..53dc46765 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_fail2.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" + +int main() + { + + // Function signature has type which does not exist + + BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AType::AnIntType (NVType::*)(short,long,double)> aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_fail3.cpp b/src/boost/libs/tti/test/test_has_member_fail3.cpp new file mode 100644 index 000000000..2e0df8d4d --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011,2012,2013 +// Use, modification and distribution are subject to 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 "test_has_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete member function prototype + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(sFunction)<AType::AnIntType (AnotherType::*)(int,long)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_template.cpp b/src/boost/libs/tti/test/test_has_member_template.cpp new file mode 100644 index 000000000..c7f30808e --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_template.cpp @@ -0,0 +1,32 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(SomeFuncTemplate)<double (AType::BType::CType::*)(int,long *,double &)>::value)); + BOOST_TEST((SameName<void (AType::*)(int *,int,float &)>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(AFuncTemplate)<int (AType::*)(const long &)>::value)); + BOOST_TEST((AnotherName<long (AnotherType::*)(bool &)>::value)); + + // Wrong enclosing type + + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(SomeFuncTemplate)<double (AType::BType::*)(int,long *,double &)>::value)); + + // Wrong return value + + BOOST_TEST((!SameName<int (AType::*)(int *,int,float &)>::value)); + + // Mismatched paramaters + + BOOST_TEST((!BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(AFuncTemplate)<int (AType::*)(const bool &)>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_member_template_compile.cpp b/src/boost/libs/tti/test/test_has_member_template_compile.cpp new file mode 100644 index 000000000..564d1e0c5 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_template_compile.cpp @@ -0,0 +1,26 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(someFunctionMemberTemplate)<int (AnotherType::*)(float,long,bool)> aVar; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(SomeFuncTemplate)<double (AType::BType::CType::*)(int,long *,double &)>)); + BOOST_MPL_ASSERT((SameName<void (AType::*)(int *,int,float &)>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(AFuncTemplate)<int (AType::*)(const long &)>)); + BOOST_MPL_ASSERT((AnotherName<long (AnotherType::*)(bool &)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_template_cv.cpp b/src/boost/libs/tti/test/test_has_member_template_cv.cpp new file mode 100644 index 000000000..6e3630fd0 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_template_cv.cpp @@ -0,0 +1,30 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + // Use const + + BOOST_TEST((FirstCMFT<double (AType::*)(short,long) const>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(WFunctionTmp)<void (AType::*)(int **, long &, bool) const>::value)); + + // Use volatile + + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(AVolatileFT)<double (AType::*)(float, long, char) volatile>::value)); + BOOST_TEST((VolG<void (AType::*)(long &) volatile>::value)); + + // Use const volatile + + BOOST_TEST((ACV<double (AType::*)(int,short) const volatile>::value)); + BOOST_TEST((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(ConstVolTTFun)<void (AType::*)(float,double) const volatile>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_member_template_cv_compile.cpp b/src/boost/libs/tti/test/test_has_member_template_cv_compile.cpp new file mode 100644 index 000000000..95e4daa63 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_template_cv_compile.cpp @@ -0,0 +1,31 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Use const + + BOOST_MPL_ASSERT((FirstCMFT<double (AType::*)(short,long) const>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(WFunctionTmp)<void (AType::*)(int **, long &, bool) const>)); + + // Use volatile + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(AVolatileFT)<double (AType::*)(float, long, char) volatile>)); + BOOST_MPL_ASSERT((VolG<void (AType::*)(long &) volatile>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(VWithDefault)<void (AnotherType::*)(float, double) volatile>)); + + // Use const volatile + + BOOST_MPL_ASSERT((ACV<double (AType::*)(int,short) const volatile>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(ConstVolTTFun)<void (AType::*)(float,double) const volatile>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_template_cv_fail.cpp b/src/boost/libs/tti/test/test_has_member_template_cv_fail.cpp new file mode 100644 index 000000000..09215bd43 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_template_cv_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function template has wrong const/volatile type + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(WFunctionTmp)<void (AType::*)(int **, long &, bool) volatile>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_template_cv_fail2.cpp b/src/boost/libs/tti/test/test_has_member_template_cv_fail2.cpp new file mode 100644 index 000000000..86a0111ea --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_template_cv_fail2.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Member function template has no const/volatile type when it should + + BOOST_MPL_ASSERT((VolG<void (AType::*)(long &)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_template_cv_fail3.cpp b/src/boost/libs/tti/test/test_has_member_template_cv_fail3.cpp new file mode 100644 index 000000000..04c57c866 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_template_cv_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete member function prototype + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE_GEN(VWithDefault)<void (AnotherType::*)(float) volatile>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_template_fail.cpp b/src/boost/libs/tti/test/test_has_member_template_fail.cpp new file mode 100644 index 000000000..b51e6eafd --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_template_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature + + BOOST_MPL_ASSERT((AnotherName<long (AnotherType::*)(int &)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_template_fail2.cpp b/src/boost/libs/tti/test/test_has_member_template_fail2.cpp new file mode 100644 index 000000000..e88f87bb5 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_template_fail2.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" + +int main() + { + + // Function signature has type which does not exist + + SameName<void (InvalidType::*)(int *,int,float &)> aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_member_template_fail3.cpp b/src/boost/libs/tti/test/test_has_member_template_fail3.cpp new file mode 100644 index 000000000..53fd3eb97 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_member_template_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // With default parameters you must still specify complete member function prototype + + BOOST_MPL_ASSERT((FTD<double (AType::*)(int,long)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_data.cpp b/src/boost/libs/tti/test/test_has_static_mem_data.cpp new file mode 100644 index 000000000..482042ee4 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_data.cpp @@ -0,0 +1,32 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_data.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(DSMember)<AType,short>::value)); + BOOST_TEST((!BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(SomeStaticData)<AnotherType,float>::value)); + BOOST_TEST((StatName<AnotherType,AType::AStructType>::value)); + BOOST_TEST((BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(CIntValue)<AnotherType,const int>::value)); + +#if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION) + + BOOST_TEST((UnionStatic<AType::AnUnion,float>::value)); + BOOST_TEST((BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(ASCData)<AnotherType::AnotherUnion,char>::value)); + +#endif + + // Passing non-class enclosing type will return false + + BOOST_TEST((!BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(DSMember)<unsigned short,short>::value)); + BOOST_TEST((!StatName<AnotherType *,AType::AStructType>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_data.hpp b/src/boost/libs/tti/test/test_has_static_mem_data.hpp new file mode 100644 index 000000000..e67443d8d --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_data.hpp @@ -0,0 +1,20 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_STATIC_MEMBER_DATA_HPP) +#define TEST_HAS_STATIC_MEMBER_DATA_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_static_member_data.hpp> + +BOOST_TTI_HAS_STATIC_MEMBER_DATA(DSMember) +BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_DATA(StatName,AnStat) +BOOST_TTI_HAS_STATIC_MEMBER_DATA(SomeStaticData) +BOOST_TTI_HAS_STATIC_MEMBER_DATA(CIntValue) +BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_DATA(UnionStatic,USMember) +BOOST_TTI_HAS_STATIC_MEMBER_DATA(ASCData) + +#endif // TEST_HAS_STATIC_MEMBER_DATA_HPP diff --git a/src/boost/libs/tti/test/test_has_static_mem_data_compile.cpp b/src/boost/libs/tti/test/test_has_static_mem_data_compile.cpp new file mode 100644 index 000000000..74c4784f6 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_data_compile.cpp @@ -0,0 +1,31 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(SomeStaticData)<AnotherType,long> aVar2; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(DSMember)<AType,short>)); + BOOST_MPL_ASSERT((StatName<AnotherType,AType::AStructType>)); + +#if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION) + + BOOST_MPL_ASSERT((UnionStatic<AType::AnUnion,float>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(ASCData)<AnotherType::AnotherUnion,char>)); + +#endif + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_data_fail.cpp b/src/boost/libs/tti/test/test_has_static_mem_data_fail.cpp new file mode 100644 index 000000000..25a6a150a --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_data_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // SomeStaticData does not exist at all + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(SomeStaticData)<AnotherType,float>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_data_fail2.cpp b/src/boost/libs/tti/test/test_has_static_mem_data_fail2.cpp new file mode 100644 index 000000000..826f5fea1 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_data_fail2.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_data.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong enclosing type for DSMember + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(DSMember)<AnotherType,short>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_data_fail3.cpp b/src/boost/libs/tti/test/test_has_static_mem_data_fail3.cpp new file mode 100644 index 000000000..61728fc94 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_data_fail3.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_data.hpp" + +int main() + { + + // Data signature has type which does not exist + + BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(DSMember)<NoType,short> aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_fun.cpp b/src/boost/libs/tti/test/test_has_static_mem_fun.cpp new file mode 100644 index 000000000..4f040b24c --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_fun.cpp @@ -0,0 +1,29 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((HaveTheSIntFunction<AType,int,boost::mpl::vector<long,double> >::value)); + BOOST_TEST((!TheTIntFunction<AType,AType,boost::mpl::vector<long,double> >::value)); + BOOST_TEST((TheTIntFunction<AnotherType,AType,boost::mpl::vector<long,double> >::value)); + BOOST_TEST((TheTIntFunction<AnotherType,AType (long,double)>::value)); + BOOST_TEST((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(TSFunction)<AnotherType,AType::AStructType,boost::mpl::vector<AType::AnIntType,double> >::value)); + BOOST_TEST((!Pickedname<AnotherType,void>::value)); + + BOOST_TEST((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(UnionStaticMemberFunction)<AnotherType::AnotherUnion,void>::value)); + + // Passing non-class enclosing type will return false + + BOOST_TEST((!TheTIntFunction<AnotherType &,AType,boost::mpl::vector<long,double> >::value)); + BOOST_TEST((!BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(TSFunction)<unsigned,AType::AStructType,boost::mpl::vector<AType::AnIntType,double> >::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_fun.hpp b/src/boost/libs/tti/test/test_has_static_mem_fun.hpp new file mode 100644 index 000000000..d7930090a --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_fun.hpp @@ -0,0 +1,20 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_STATIC_MEMBER_FUNCTION_HPP) +#define TEST_HAS_STATIC_MEMBER_FUNCTION_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_static_member_function.hpp> + +BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION(HaveTheSIntFunction,SIntFunction) +BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION(TheTIntFunction,TIntFunction) +BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION(TSFunction) +BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION(Pickedname,SomeStaticFunction) + +BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION(UnionStaticMemberFunction) + +#endif // TEST_HAS_STATIC_MEMBER_FUNCTION_HPP diff --git a/src/boost/libs/tti/test/test_has_static_mem_fun_compile.cpp b/src/boost/libs/tti/test/test_has_static_mem_fun_compile.cpp new file mode 100644 index 000000000..5032c9031 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_fun_compile.cpp @@ -0,0 +1,27 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + TheTIntFunction<AType,void,boost::mpl::vector<long,double> > aVar; + Pickedname<AnotherType,AType,boost::mpl::vector<long,long> > aVar2; + TheTIntFunction<AnotherType,AType,boost::mpl::vector<long,double>,boost::function_types::cv_qualified> aVar3; + + // Compile time asserts + + BOOST_MPL_ASSERT((HaveTheSIntFunction<AType,int,boost::mpl::vector<long,double> >)); + BOOST_MPL_ASSERT((TheTIntFunction<AnotherType,AType,boost::mpl::vector<long,double> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(TSFunction)<AnotherType,AType::AStructType,boost::mpl::vector<AType::AnIntType,double> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_fun_fail.cpp b/src/boost/libs/tti/test/test_has_static_mem_fun_fail.cpp new file mode 100644 index 000000000..6f522a20a --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_fun_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature for SIntFunction + + BOOST_MPL_ASSERT((HaveTheSIntFunction<AType,int,boost::mpl::vector<float,double> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_fun_fail2.cpp b/src/boost/libs/tti/test/test_has_static_mem_fun_fail2.cpp new file mode 100644 index 000000000..5fbe04308 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_fun_fail2.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun.hpp" + +int main() + { + + // Function signature has type which does not exist + + BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(TSFunction)<AnotherType,AType::AClassType,boost::mpl::vector<AType::AnIntType,double> > aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_fun_template.cpp b/src/boost/libs/tti/test/test_has_static_mem_fun_template.cpp new file mode 100644 index 000000000..84f614ca5 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_fun_template.cpp @@ -0,0 +1,35 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun_template.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<AType::AStructType,int,boost::mpl::vector<short *,long> >::value)); + BOOST_TEST((TAnother<AType,void,boost::mpl::vector<int,long &,const long &> >::value)); + BOOST_TEST((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,void,boost::mpl::vector<const double &,float &> >::value)); + + // Wrong enclosing type + + BOOST_TEST((!BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<AType,int,boost::mpl::vector<short *,long> >::value)); + + // Wrong return value + + BOOST_TEST((!TAnother<AType,short,boost::mpl::vector<int,long &,const long &> >::value)); + + // Mismatched paramaters + + BOOST_TEST((!BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,void,boost::mpl::vector<const long &,float &> >::value)); + + // Invalid enclosing type + + BOOST_TEST((!BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<short **,int,boost::mpl::vector<short *,long> >::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_fun_template.hpp b/src/boost/libs/tti/test/test_has_static_mem_fun_template.hpp new file mode 100644 index 000000000..214cfc756 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_fun_template.hpp @@ -0,0 +1,32 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_STATIC_MEM_FUN_TEMPLATE_HPP) +#define TEST_HAS_STATIC_MEM_FUN_TEMPLATE_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_static_member_function_template.hpp> + + +#if BOOST_PP_VARIADICS + +BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(StatFuncTemplate,short,long,7854) +BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(TAnother,AnotherFuncTemplate,int,long,long) +BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(YetAnotherFuncTemplate,double,float) + +BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(StaticFTWithDefault,int,long,bool) // default parameter + +#else + +BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(StatFuncTemplate,(3,(short,long,7854))) +BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(TAnother,AnotherFuncTemplate,(3,(int,long,long))) +BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(YetAnotherFuncTemplate,(2,(double,float))) + +BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(StaticFTWithDefault,(3,(int,long,bool))) // default parameter + +#endif + +#endif // TEST_HAS_STATIC_MEM_FUN_TEMPLATE_HPP diff --git a/src/boost/libs/tti/test/test_has_static_mem_fun_template_compile.cpp b/src/boost/libs/tti/test/test_has_static_mem_fun_template_compile.cpp new file mode 100644 index 000000000..3c2cf377f --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_fun_template_compile.cpp @@ -0,0 +1,25 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<AType::AStructType,bool,boost::mpl::vector<short *,long> > aVar; + TAnother<AType,void,boost::mpl::vector<int,long &,const long &>,boost::function_types::const_qualified> aVar2; + BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,void,boost::mpl::vector<const int &,float &> > aVar3; + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<AType::AStructType,int,boost::mpl::vector<short *,long> >)); + BOOST_MPL_ASSERT((TAnother<AType,void,boost::mpl::vector<int,long &,const long &> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,void,boost::mpl::vector<const double &,float &> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_fun_template_fail.cpp b/src/boost/libs/tti/test/test_has_static_mem_fun_template_fail.cpp new file mode 100644 index 000000000..f672c06fb --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_fun_template_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature for SIntFunction + + BOOST_MPL_ASSERT((TAnother<AType,void,boost::mpl::vector<int,short &,const long &> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_mem_fun_template_fail2.cpp b/src/boost/libs/tti/test/test_has_static_mem_fun_template_fail2.cpp new file mode 100644 index 000000000..c46937a1c --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_mem_fun_template_fail2.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun_template.hpp" + +int main() + { + + // Function signature has type which does not exist + + BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,AClassType,boost::mpl::vector<const double &,float &> > aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_member.cpp b/src/boost/libs/tti/test/test_has_static_member.cpp new file mode 100644 index 000000000..2a9f77638 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_member.cpp @@ -0,0 +1,26 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((HaveTheSIntFunction<AType,int (long,double)>::value)); + BOOST_TEST((!TheTIntFunction<AType,AType (long,double)>::value)); + BOOST_TEST((TheTIntFunction<AnotherType,AType (long,double)>::value)); + BOOST_TEST((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(TSFunction)<AnotherType,AType::AStructType (AType::AnIntType,double)>::value)); + BOOST_TEST((!Pickedname<AnotherType,void ()>::value)); + + // Passing non-class enclosing type will return false + + BOOST_TEST((!TheTIntFunction<int,AType (long,double)>::value)); + BOOST_TEST((!BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(TSFunction)<AnotherType &,AType::AStructType (AType::AnIntType,double)>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_static_member_compile.cpp b/src/boost/libs/tti/test/test_has_static_member_compile.cpp new file mode 100644 index 000000000..f9c1bb427 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_member_compile.cpp @@ -0,0 +1,26 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + TheTIntFunction<AType,void (long,double)> aVar; + Pickedname<AnotherType,AType (long,long)> aVar3; + + // Compile time asserts + + BOOST_MPL_ASSERT((HaveTheSIntFunction<AType,int (long,double)>)); + BOOST_MPL_ASSERT((TheTIntFunction<AnotherType,AType (long,double)>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(TSFunction)<AnotherType,AType::AStructType (AType::AnIntType,double)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_member_fail.cpp b/src/boost/libs/tti/test/test_has_static_member_fail.cpp new file mode 100644 index 000000000..cf65d6961 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_member_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature for SIntFunction + + BOOST_MPL_ASSERT((HaveTheSIntFunction<AType,int (float,double)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_member_fail2.cpp b/src/boost/libs/tti/test/test_has_static_member_fail2.cpp new file mode 100644 index 000000000..5fcbaab09 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_member_fail2.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun.hpp" + +int main() + { + + // Function signature has type which does not exist + + BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(TSFunction)<AnotherType,AType::AClassType (AType::AnIntType,double)> aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_member_template.cpp b/src/boost/libs/tti/test/test_has_static_member_template.cpp new file mode 100644 index 000000000..84137d7cd --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_member_template.cpp @@ -0,0 +1,31 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun_template.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<AType::AStructType,int(short *,long)>::value)); + BOOST_TEST((TAnother<AType,void (int,long &,const long &)>::value)); + BOOST_TEST((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,void (const double &,float &)>::value)); + + // Wrong enclosing type + + BOOST_TEST((!BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<AType,int (short *,long)>::value)); + + // Wrong return value + + BOOST_TEST((!TAnother<AType,short (int,long &,const long &)>::value)); + + // Mismatched paramaters + + BOOST_TEST((!BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,void (const long &,float &)>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_static_member_template_compile.cpp b/src/boost/libs/tti/test/test_has_static_member_template_compile.cpp new file mode 100644 index 000000000..1a73e7866 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_member_template_compile.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(StatFuncTemplate)<AType::AStructType,int(short *,long)>)); + BOOST_MPL_ASSERT((TAnother<AType,void (int,long &,const long &)>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,void (const double &,float &)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_member_template_fail.cpp b/src/boost/libs/tti/test/test_has_static_member_template_fail.cpp new file mode 100644 index 000000000..ecdb3cf29 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_member_template_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong function signature for SIntFunction + + BOOST_MPL_ASSERT((TAnother<AType,void (int,short &,const long &)>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_static_member_template_fail2.cpp b/src/boost/libs/tti/test/test_has_static_member_template_fail2.cpp new file mode 100644 index 000000000..b98cf32de --- /dev/null +++ b/src/boost/libs/tti/test/test_has_static_member_template_fail2.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_static_mem_fun_template.hpp" + +int main() + { + + // Function signature has type which does not exist + + BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(YetAnotherFuncTemplate)<AnotherType,AClassType (const double &,float &)> aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_template.cpp b/src/boost/libs/tti/test/test_has_template.cpp new file mode 100644 index 000000000..29371063d --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template.cpp @@ -0,0 +1,30 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(ATPMemberTemplate)<AType>::value); + BOOST_TEST(HaveCL<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_TEMPLATE_GEN(AMemberTemplate)<AType>::value); + BOOST_TEST(!HaveAnotherMT<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_TEMPLATE_GEN(SomeMemberTemplate)<AnotherType>::value); + BOOST_TEST(!ATemplateWithParms<AnotherType>::value); + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(SimpleTMP)<AnotherType>::value); + + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(UnionMemberTemplate)<AnotherType::AnotherUnion>::value); + + // Passing non-class enclosing type will return false + + BOOST_TEST(!HaveCL<AType **>::value); + BOOST_TEST(!BOOST_TTI_HAS_TEMPLATE_GEN(SimpleTMP)<char>::value); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_template.hpp b/src/boost/libs/tti/test/test_has_template.hpp new file mode 100644 index 000000000..1e2e12425 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template.hpp @@ -0,0 +1,41 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_TEMPLATE_HPP) +#define TEST_HAS_TEMPLATE_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_template.hpp> + +#if BOOST_PP_VARIADICS + +BOOST_TTI_HAS_TEMPLATE(ATPMemberTemplate) +BOOST_TTI_TRAIT_HAS_TEMPLATE(HaveCL,CLMemberTemplate,BOOST_PP_NIL) +BOOST_TTI_HAS_TEMPLATE(AMemberTemplate) +BOOST_TTI_TRAIT_HAS_TEMPLATE(HaveAnotherMT,AnotherMemberTemplate,BOOST_PP_NIL) +BOOST_TTI_HAS_TEMPLATE(SomeMemberTemplate,BOOST_PP_NIL) +BOOST_TTI_TRAIT_HAS_TEMPLATE(ATemplateWithParms,ManyParameters) +BOOST_TTI_HAS_TEMPLATE(SimpleTMP,BOOST_PP_NIL) +BOOST_TTI_HAS_TEMPLATE(TemplateNotExist) + +BOOST_TTI_HAS_TEMPLATE(UnionMemberTemplate) + +#else // !BOOST_PP_VARIADICS + +BOOST_TTI_HAS_TEMPLATE(ATPMemberTemplate,BOOST_PP_NIL) +BOOST_TTI_TRAIT_HAS_TEMPLATE(HaveCL,CLMemberTemplate,BOOST_PP_NIL) +BOOST_TTI_HAS_TEMPLATE(AMemberTemplate,BOOST_PP_NIL) +BOOST_TTI_TRAIT_HAS_TEMPLATE(HaveAnotherMT,AnotherMemberTemplate,BOOST_PP_NIL) +BOOST_TTI_HAS_TEMPLATE(SomeMemberTemplate,BOOST_PP_NIL) +BOOST_TTI_TRAIT_HAS_TEMPLATE(ATemplateWithParms,ManyParameters,BOOST_PP_NIL) +BOOST_TTI_HAS_TEMPLATE(SimpleTMP,BOOST_PP_NIL) +BOOST_TTI_HAS_TEMPLATE(TemplateNotExist,BOOST_PP_NIL) + +BOOST_TTI_HAS_TEMPLATE(UnionMemberTemplate,BOOST_PP_NIL) + +#endif // BOOST_PP_VARIADICS + +#endif // TEST_HAS_TEMPLATE_HPP diff --git a/src/boost/libs/tti/test/test_has_template_compile.cpp b/src/boost/libs/tti/test/test_has_template_compile.cpp new file mode 100644 index 000000000..f789036c2 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_compile.cpp @@ -0,0 +1,28 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_TEMPLATE_GEN(AMemberTemplate)<AnotherType> aVar; + HaveAnotherMT<AnotherType> aVar2; + BOOST_TTI_HAS_TEMPLATE_GEN(SomeMemberTemplate)<AType> aVar3; + BOOST_TTI_HAS_TEMPLATE_GEN(TemplateNotExist)<AType> aVar4; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(ATPMemberTemplate)<AType>)); + BOOST_MPL_ASSERT((HaveCL<AType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(SimpleTMP)<AnotherType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_template_cp.cpp b/src/boost/libs/tti/test/test_has_template_cp.cpp new file mode 100644 index 000000000..85489ead1 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_cp.cpp @@ -0,0 +1,32 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template_cp.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(ATPMemberTemplate)<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(AMemberTemplate)<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(SomeMemberTemplate)<AnotherType>::value); + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(SimpleTMP)<AnotherType>::value); + BOOST_TEST(!BOOST_TTI_HAS_TEMPLATE_GEN(TemplateNotExist)<AnotherType>::value); + + BOOST_TEST(HaveCL<AType>::value); + BOOST_TEST(HaveAnotherMT<AType>::value); + BOOST_TEST(ATemplateWithParms<AnotherType>::value); + + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(NestedMemberTemplate)<AType::AnUnion>::value); + + // Passing non-class enclosing type will return false + + BOOST_TEST(!BOOST_TTI_HAS_TEMPLATE_GEN(AMemberTemplate)<unsigned char>::value); + BOOST_TEST(!HaveAnotherMT<AType *>::value); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_template_cp.hpp b/src/boost/libs/tti/test/test_has_template_cp.hpp new file mode 100644 index 000000000..86fbb7e4b --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_cp.hpp @@ -0,0 +1,26 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_TEMPLATE_CHECK_PARAMS_HPP) +#define TEST_HAS_TEMPLATE_CHECK_PARAMS_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_template.hpp> + +BOOST_TTI_HAS_TEMPLATE(ATPMemberTemplate,(1,(class))) +BOOST_TTI_TRAIT_HAS_TEMPLATE(HaveCL,CLMemberTemplate,(2,(class,class))) +BOOST_TTI_HAS_TEMPLATE(AMemberTemplate,(1,(int))) +BOOST_TTI_TRAIT_HAS_TEMPLATE(HaveAnotherMT,AnotherMemberTemplate,(2,(int,int))) +BOOST_TTI_HAS_TEMPLATE(SomeMemberTemplate,(6,(class,class,class,class,class,class))) +BOOST_TTI_TRAIT_HAS_TEMPLATE(ATemplateWithParms,ManyParameters,(7,(class,class,int,class,template <class> class,class,long))) +BOOST_TTI_HAS_TEMPLATE(SimpleTMP,(4,(class,class,class,class))) +BOOST_TTI_HAS_TEMPLATE(TemplateNotExist,(3,(int,class,template <class> class ATemplate))) +BOOST_TTI_TRAIT_HAS_TEMPLATE(WrongParametersForMP,ManyParameters,(8,(class,class,int,class,template <class,class> class,class,long))) +BOOST_TTI_TRAIT_HAS_TEMPLATE(WrongParameters2ForMP,ManyParameters,(7,(class,long,int,class,template <class> class,class,long))) + +BOOST_TTI_HAS_TEMPLATE(NestedMemberTemplate,(3,(int,class,long))) + +#endif // TEST_HAS_TEMPLATE_CHECK_PARAMS_HPP diff --git a/src/boost/libs/tti/test/test_has_template_cp_compile.cpp b/src/boost/libs/tti/test/test_has_template_cp_compile.cpp new file mode 100644 index 000000000..0eaa9e0f8 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_cp_compile.cpp @@ -0,0 +1,30 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template_cp.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_TEMPLATE_GEN(TemplateNotExist)<AnotherType> aVar1; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(ATPMemberTemplate)<AType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(AMemberTemplate)<AType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(SomeMemberTemplate)<AnotherType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(SimpleTMP)<AnotherType>)); + + BOOST_MPL_ASSERT((HaveCL<AType>)); + BOOST_MPL_ASSERT((HaveAnotherMT<AType>)); + BOOST_MPL_ASSERT((ATemplateWithParms<AnotherType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_template_cp_fail.cpp b/src/boost/libs/tti/test/test_has_template_cp_fail.cpp new file mode 100644 index 000000000..92428080d --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_cp_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template_cp.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // TemplateNotExist does not exist at all + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(TemplateNotExist)<AType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_template_cp_fail2.cpp b/src/boost/libs/tti/test/test_has_template_cp_fail2.cpp new file mode 100644 index 000000000..a8be1129c --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_cp_fail2.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template_cp.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong enclosing type + + BOOST_MPL_ASSERT((HaveCL<AnotherType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_template_cp_fail3.cpp b/src/boost/libs/tti/test/test_has_template_cp_fail3.cpp new file mode 100644 index 000000000..f9e4a4bc3 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_cp_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template_cp.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong template parameters + + BOOST_MPL_ASSERT((WrongParametersForMP<AnotherType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_template_cp_fail4.cpp b/src/boost/libs/tti/test/test_has_template_cp_fail4.cpp new file mode 100644 index 000000000..72582f8b7 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_cp_fail4.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template_cp.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong template parameters + + BOOST_MPL_ASSERT((WrongParameters2ForMP<AnotherType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_template_fail.cpp b/src/boost/libs/tti/test/test_has_template_fail.cpp new file mode 100644 index 000000000..0a694b4b9 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // TemplateNotExist does not exist at all + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(TemplateNotExist)<AType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_template_fail2.cpp b/src/boost/libs/tti/test/test_has_template_fail2.cpp new file mode 100644 index 000000000..76f705ff8 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_fail2.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong enclosing type + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(ATPMemberTemplate)<AnotherType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_template_fail3.cpp b/src/boost/libs/tti/test/test_has_template_fail3.cpp new file mode 100644 index 000000000..173acce2a --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_fail3.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Too many 'typename' parameters + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(SomeMemberTemplate)<AnotherType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_template_fail4.cpp b/src/boost/libs/tti/test/test_has_template_fail4.cpp new file mode 100644 index 000000000..5499ce9c6 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_template_fail4.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_template.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Not all 'typename' parameters + + BOOST_MPL_ASSERT((HaveAnotherMT<AType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_type.cpp b/src/boost/libs/tti/test/test_has_type.cpp new file mode 100644 index 000000000..d34ac0afb --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type.cpp @@ -0,0 +1,54 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(AnIntType)<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<AType>::value); + BOOST_TEST(NameStruct<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(BType)<AType>::value); + BOOST_TEST(TheInteger<AType::BType>::value); + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(CType)<AType::BType>::value); + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(AnotherIntegerType)<AType::BType::CType>::value); + BOOST_TEST(SomethingElse<AnotherType>::value); + BOOST_TEST(!BOOST_TTI_HAS_TYPE_GEN(NoOtherType)<AnotherType>::value); + + BOOST_TEST(EInB<AType::BType>::value); + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(AnEnumTtype)<AType>::value); + BOOST_TEST(AnotherE<AnotherType>::value); + +#if !defined(BOOST_NO_CXX11_SCOPED_ENUMS) + + BOOST_TEST(EClass<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(AnotherEnumClassType)<AnotherType>::value); + +#else + + BOOST_TEST(!EClass<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_TYPE_GEN(AnotherEnumClassType)<AnotherType>::value); + +#endif + + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(CTypeUnion)<AType::BType::CType>::value); + BOOST_TEST(SimpleUT<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(AnotherUnion)<AnotherType>::value); + + BOOST_TEST(UnionType<AType::AnUnion>::value); + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(UEnumV)<AType::AnUnion>::value); + BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(InnerUnion)<AnotherType::AnotherUnion>::value); + + // Passing non-class enclosing type will return false + + BOOST_TEST(!BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<signed long>::value); + BOOST_TEST(!NameStruct<AType &>::value); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_type.hpp b/src/boost/libs/tti/test/test_has_type.hpp new file mode 100644 index 000000000..ee2048536 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type.hpp @@ -0,0 +1,36 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_TYPE_HPP) +#define TEST_HAS_TYPE_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_type.hpp> + +BOOST_TTI_HAS_TYPE(AnIntType) +BOOST_TTI_TRAIT_HAS_TYPE(NameStruct,AStructType) +BOOST_TTI_HAS_TYPE(AnIntTypeReference) +BOOST_TTI_HAS_TYPE(BType) +BOOST_TTI_TRAIT_HAS_TYPE(TheInteger,AnIntegerType) +BOOST_TTI_HAS_TYPE(CType) +BOOST_TTI_HAS_TYPE(AnotherIntegerType) +BOOST_TTI_TRAIT_HAS_TYPE(SomethingElse,someOtherType) +BOOST_TTI_HAS_TYPE(NoOtherType) + +BOOST_TTI_TRAIT_HAS_TYPE(EInB,BTypeEnum) +BOOST_TTI_HAS_TYPE(AnEnumTtype) +BOOST_TTI_TRAIT_HAS_TYPE(AnotherE,AnotherEnumTtype) +BOOST_TTI_TRAIT_HAS_TYPE(EClass,AnEnumClassType) +BOOST_TTI_HAS_TYPE(AnotherEnumClassType) +BOOST_TTI_HAS_TYPE(CTypeUnion) +BOOST_TTI_TRAIT_HAS_TYPE(SimpleUT,AnUnion) +BOOST_TTI_HAS_TYPE(AnotherUnion) + +BOOST_TTI_TRAIT_HAS_TYPE(UnionType,UNStruct) +BOOST_TTI_HAS_TYPE(UEnumV) +BOOST_TTI_HAS_TYPE(InnerUnion) + +#endif // TEST_HAS_TYPE_HPP diff --git a/src/boost/libs/tti/test/test_has_type_compile.cpp b/src/boost/libs/tti/test/test_has_type_compile.cpp new file mode 100644 index 000000000..bf6047c03 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_compile.cpp @@ -0,0 +1,31 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_TYPE_GEN(AnIntType)<AnotherType> aVar1; + BOOST_TTI_HAS_TYPE_GEN(NoOtherType)<AType> aVar2; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnIntType)<AType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<AType>)); + BOOST_MPL_ASSERT((NameStruct<AType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(BType)<AType>)); + BOOST_MPL_ASSERT((TheInteger<AType::BType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(CType)<AType::BType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnotherIntegerType)<AType::BType::CType>)); + BOOST_MPL_ASSERT((SomethingElse<AnotherType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_type_ct.cpp b/src/boost/libs/tti/test/test_has_type_ct.cpp new file mode 100644 index 000000000..d724262c9 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_ct.cpp @@ -0,0 +1,33 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/detail/lightweight_test.hpp> +#include <boost/mpl/placeholders.hpp> +#include <boost/type_traits/is_same.hpp> +using namespace boost::mpl::placeholders; + +int main() + { + + BOOST_TEST((BOOST_TTI_HAS_TYPE_GEN(AnIntType)<AType,boost::is_same<int,_> >::value)); + BOOST_TEST((NameStruct<AType,boost::is_same<AType::AStructType,_> >::value)); + BOOST_TEST((BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<AType,boost::is_same<int &,_> >::value)); + BOOST_TEST((BOOST_TTI_HAS_TYPE_GEN(BType)<AType,boost::is_same<AType::BType,_> >::value)); + BOOST_TEST((TheInteger<AType::BType,boost::is_same<int,_> >::value)); + BOOST_TEST((BOOST_TTI_HAS_TYPE_GEN(CType)<AType::BType,boost::is_same<AType::BType::CType,_> >::value)); + BOOST_TEST((BOOST_TTI_HAS_TYPE_GEN(AnotherIntegerType)<AType::BType::CType,boost::is_same<int,_> >::value)); + BOOST_TEST((SomethingElse<AnotherType,boost::is_same<AType::AnIntType,_> >::value)); + BOOST_TEST((!BOOST_TTI_HAS_TYPE_GEN(NoOtherType)<AnotherType,boost::is_same<double,_> >::value)); + + // Passing non-class enclosing type will return false + + BOOST_TEST((!BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<AType **,boost::is_same<int &,_> >::value)); + BOOST_TEST((!SomethingElse<float,boost::is_same<AType::AnIntType,_> >::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_type_ct_compile.cpp b/src/boost/libs/tti/test/test_has_type_ct_compile.cpp new file mode 100644 index 000000000..f82428fe2 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_ct_compile.cpp @@ -0,0 +1,34 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/mpl/assert.hpp> +#include <boost/mpl/placeholders.hpp> +#include <boost/type_traits/is_same.hpp> +using namespace boost::mpl::placeholders; + +int main() + { + + // You can always instantiate without compiler errors + + TheInteger<AType::BType,boost::is_same<short,_> > aVar; + BOOST_TTI_HAS_TYPE_GEN(NoOtherType)<AnotherType,boost::is_same<double,_> > aVar2; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnIntType)<AType,boost::is_same<int,_> >)); + BOOST_MPL_ASSERT((NameStruct<AType,boost::is_same<AType::AStructType,_> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<AType,boost::is_same<int &,_> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(BType)<AType,boost::is_same<AType::BType,_> >)); + BOOST_MPL_ASSERT((TheInteger<AType::BType,boost::is_same<int,_> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(CType)<AType::BType,boost::is_same<AType::BType::CType,_> >)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnotherIntegerType)<AType::BType::CType,boost::is_same<int,_> >)); + BOOST_MPL_ASSERT((SomethingElse<AnotherType,boost::is_same<AType::AnIntType,_> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_type_ct_fail.cpp b/src/boost/libs/tti/test/test_has_type_ct_fail.cpp new file mode 100644 index 000000000..a71301d1f --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_ct_fail.cpp @@ -0,0 +1,22 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/mpl/assert.hpp> +#include <boost/mpl/placeholders.hpp> +#include <boost/type_traits/is_same.hpp> +using namespace boost::mpl::placeholders; + +int main() + { + + // NoOtherType does not exist at all + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(NoOtherType)<AType,boost::is_same<int,_> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_type_ct_fail2.cpp b/src/boost/libs/tti/test/test_has_type_ct_fail2.cpp new file mode 100644 index 000000000..a2135c4bf --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_ct_fail2.cpp @@ -0,0 +1,22 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/mpl/assert.hpp> +#include <boost/mpl/placeholders.hpp> +#include <boost/type_traits/is_same.hpp> +using namespace boost::mpl::placeholders; + +int main() + { + + // Wrong enclosing type + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(BType)<AnotherType,boost::is_same<short,_> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_type_ct_fail3.cpp b/src/boost/libs/tti/test/test_has_type_ct_fail3.cpp new file mode 100644 index 000000000..e50e898ae --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_ct_fail3.cpp @@ -0,0 +1,21 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/mpl/placeholders.hpp> +#include <boost/type_traits/is_same.hpp> +using namespace boost::mpl::placeholders; + +int main() + { + + // Enclosing type does not exist + + TheInteger<AType::EType,boost::is_same<double,_> > aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_type_ct_fail4.cpp b/src/boost/libs/tti/test/test_has_type_ct_fail4.cpp new file mode 100644 index 000000000..21328ac22 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_ct_fail4.cpp @@ -0,0 +1,21 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/mpl/placeholders.hpp> +#include <boost/type_traits/is_same.hpp> +using namespace boost::mpl::placeholders; + +int main() + { + + // Typedef type does not exist ( BType is a nested type ) + + BOOST_TTI_HAS_TYPE_GEN(BType)<AType,boost::is_same<BType,_> > aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_type_ct_fail5.cpp b/src/boost/libs/tti/test/test_has_type_ct_fail5.cpp new file mode 100644 index 000000000..1e4e8e0eb --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_ct_fail5.cpp @@ -0,0 +1,22 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/mpl/assert.hpp> +#include <boost/mpl/placeholders.hpp> +#include <boost/type_traits/is_same.hpp> +using namespace boost::mpl::placeholders; + +int main() + { + + // Wrong typedef type + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(AnotherIntegerType)<AType::BType::CType,boost::is_same<long,_> >)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_type_fail.cpp b/src/boost/libs/tti/test/test_has_type_fail.cpp new file mode 100644 index 000000000..152005cfa --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_fail.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // NoOtherType does not exist at all + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(NoOtherType)<AnotherType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_type_fail2.cpp b/src/boost/libs/tti/test/test_has_type_fail2.cpp new file mode 100644 index 000000000..8fd9f9fe8 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_fail2.cpp @@ -0,0 +1,19 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + // Wrong enclosing type + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TYPE_GEN(BType)<AnotherType>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_type_fail3.cpp b/src/boost/libs/tti/test/test_has_type_fail3.cpp new file mode 100644 index 000000000..cb2ef9dff --- /dev/null +++ b/src/boost/libs/tti/test/test_has_type_fail3.cpp @@ -0,0 +1,18 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_has_type.hpp" + +int main() + { + + // Enclosing type does not exist + + TheInteger<AType::EType> aVar; + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_has_union.cpp b/src/boost/libs/tti/test/test_has_union.cpp new file mode 100644 index 000000000..81633db18 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_union.cpp @@ -0,0 +1,42 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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 "test_has_union.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST(!BOOST_TTI_HAS_UNION_GEN(AnIntType)<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_UNION_GEN(AnIntTypeReference)<AType>::value); + BOOST_TEST(!NameStruct<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_UNION_GEN(BType)<AType>::value); + BOOST_TEST(!TheInteger<AType::BType>::value); + BOOST_TEST(!BOOST_TTI_HAS_UNION_GEN(CType)<AType::BType>::value); + BOOST_TEST(!BOOST_TTI_HAS_UNION_GEN(AnotherIntegerType)<AType::BType::CType>::value); + BOOST_TEST(!SomethingElse<AnotherType>::value); + BOOST_TEST(!BOOST_TTI_HAS_UNION_GEN(NoOtherType)<AnotherType>::value); + + BOOST_TEST(BOOST_TTI_HAS_UNION_GEN(CTypeUnion)<AType::BType::CType>::value); + BOOST_TEST(SimpleUT<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_UNION_GEN(AnotherUnion)<AnotherType>::value); + + BOOST_TEST(!EInB<AType::BType>::value); + BOOST_TEST(!BOOST_TTI_HAS_UNION_GEN(AnEnumTtype)<AType>::value); + BOOST_TEST(!AnotherE<AnotherType>::value); + BOOST_TEST(!EClass<AType>::value); + BOOST_TEST(!BOOST_TTI_HAS_UNION_GEN(AnotherEnumClassType)<AnotherType>::value); + + BOOST_TEST(BOOST_TTI_HAS_UNION_GEN(InnerUnion)<AnotherType::AnotherUnion>::value); + + // Passing non-class enclosing type will return false + + BOOST_TEST(!BOOST_TTI_HAS_UNION_GEN(AnIntTypeReference)<signed long>::value); + BOOST_TEST(!NameStruct<AType &>::value); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_has_union.hpp b/src/boost/libs/tti/test/test_has_union.hpp new file mode 100644 index 000000000..1e9861e57 --- /dev/null +++ b/src/boost/libs/tti/test/test_has_union.hpp @@ -0,0 +1,35 @@ + +// (C) Copyright Edward Diener 2019 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_HAS_UNION_HPP) +#define TEST_HAS_UNION_HPP + +#include "test_structs.hpp" +#include <boost/tti/has_union.hpp> + +BOOST_TTI_HAS_UNION(AnIntType) +BOOST_TTI_TRAIT_HAS_UNION(NameStruct,AStructType) +BOOST_TTI_HAS_UNION(AnIntTypeReference) +BOOST_TTI_HAS_UNION(BType) +BOOST_TTI_TRAIT_HAS_UNION(TheInteger,AnIntegerType) +BOOST_TTI_HAS_UNION(CType) +BOOST_TTI_HAS_UNION(AnotherIntegerType) +BOOST_TTI_TRAIT_HAS_UNION(SomethingElse,someOtherType) +BOOST_TTI_HAS_UNION(NoOtherType) + +BOOST_TTI_HAS_UNION(CTypeUnion) +BOOST_TTI_TRAIT_HAS_UNION(SimpleUT,AnUnion) +BOOST_TTI_HAS_UNION(AnotherUnion) + +BOOST_TTI_TRAIT_HAS_UNION(EInB,BTypeEnum) +BOOST_TTI_HAS_UNION(AnEnumTtype) +BOOST_TTI_TRAIT_HAS_UNION(AnotherE,AnotherEnumTtype) +BOOST_TTI_TRAIT_HAS_UNION(EClass,AnEnumClassType) +BOOST_TTI_HAS_UNION(AnotherEnumClassType) + +BOOST_TTI_HAS_UNION(InnerUnion) + +#endif // TEST_HAS_UNION_HPP diff --git a/src/boost/libs/tti/test/test_mem_type.cpp b/src/boost/libs/tti/test/test_mem_type.cpp new file mode 100644 index 000000000..72f1dfc4d --- /dev/null +++ b/src/boost/libs/tti/test/test_mem_type.cpp @@ -0,0 +1,34 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_mem_type.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + + BOOST_TEST((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(AnIntType)<AType>::type>::value)); + BOOST_TEST((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(AnIntTypeReference)<AType>::type>::value)); + BOOST_TEST((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(BType)<AType>::type>::value)); + BOOST_TEST((boost::tti::valid_member_type<TheInteger<AType::BType>::type>::value)); + BOOST_TEST((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(AnotherIntegerType)<AType::BType::CType>::type>::value)); + BOOST_TEST((boost::tti::valid_member_type<SomethingElse<AnotherType>::type>::value)); + + BOOST_TEST((boost::tti::valid_member_type<NameStruct<AType,MarkerType>::type,NameStruct<AType,MarkerType>::boost_tti_marker_type>::value)); + BOOST_TEST((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(CType)<AType::BType,MarkerType>::type,BOOST_TTI_MEMBER_TYPE_GEN(CType)<AType::BType,MarkerType>::boost_tti_marker_type>::value)); + + BOOST_TEST((!boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(BType)<AnotherType>::type>::value)); + BOOST_TEST((!boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(NoExistType)<AType,MarkerType>::type,BOOST_TTI_MEMBER_TYPE_GEN(NoExistType)<AType,MarkerType>::boost_tti_marker_type>::value)); + + // Passing non-class enclosing type will always use the marker type + + BOOST_TEST((!boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(BType)<int>::type>::value)); + BOOST_TEST((!boost::tti::valid_member_type<TheInteger<AType::BType *>::type>::value)); + BOOST_TEST((!boost::tti::valid_member_type<NameStruct<long,MarkerType>::type,MarkerType>::value)); + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_mem_type.hpp b/src/boost/libs/tti/test/test_mem_type.hpp new file mode 100644 index 000000000..a1bd6d290 --- /dev/null +++ b/src/boost/libs/tti/test/test_mem_type.hpp @@ -0,0 +1,24 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_MEMBER_TYPE_HPP) +#define TEST_MEMBER_TYPE_HPP + +#include "test_structs.hpp" +#include <boost/tti/member_type.hpp> + +BOOST_TTI_MEMBER_TYPE(AnIntType) +BOOST_TTI_TRAIT_MEMBER_TYPE(NameStruct,AStructType) +BOOST_TTI_MEMBER_TYPE(AnIntTypeReference) +BOOST_TTI_MEMBER_TYPE(BType) +BOOST_TTI_TRAIT_MEMBER_TYPE(TheInteger,AnIntegerType) +BOOST_TTI_MEMBER_TYPE(CType) +BOOST_TTI_MEMBER_TYPE(AnotherIntegerType) +BOOST_TTI_TRAIT_MEMBER_TYPE(SomethingElse,someOtherType) + +BOOST_TTI_MEMBER_TYPE(NoExistType) + +#endif // TEST_MEMBER_TYPE_HPP diff --git a/src/boost/libs/tti/test/test_mem_type_compile.cpp b/src/boost/libs/tti/test/test_mem_type_compile.cpp new file mode 100644 index 000000000..ff59bbf13 --- /dev/null +++ b/src/boost/libs/tti/test/test_mem_type_compile.cpp @@ -0,0 +1,28 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_mem_type.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + + BOOST_MPL_ASSERT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(AnIntType)<AType>::type>)); + BOOST_MPL_ASSERT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(AnIntTypeReference)<AType>::type>)); + BOOST_MPL_ASSERT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(BType)<AType>::type>)); + BOOST_MPL_ASSERT((boost::tti::valid_member_type<TheInteger<AType::BType>::type>)); + BOOST_MPL_ASSERT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(AnotherIntegerType)<AType::BType::CType>::type>)); + BOOST_MPL_ASSERT((boost::tti::valid_member_type<SomethingElse<AnotherType>::type>)); + + BOOST_MPL_ASSERT((boost::tti::valid_member_type<NameStruct<AType,MarkerType>::type,NameStruct<AType,MarkerType>::boost_tti_marker_type>)); + BOOST_MPL_ASSERT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(CType)<AType::BType,MarkerType>::type,BOOST_TTI_MEMBER_TYPE_GEN(CType)<AType::BType,MarkerType>::boost_tti_marker_type>)); + + BOOST_MPL_ASSERT_NOT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(BType)<AnotherType>::type>)); + BOOST_MPL_ASSERT_NOT((boost::tti::valid_member_type<BOOST_TTI_MEMBER_TYPE_GEN(NoExistType)<AType,MarkerType>::type,BOOST_TTI_MEMBER_TYPE_GEN(NoExistType)<AType,MarkerType>::boost_tti_marker_type>)); + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_structs.hpp b/src/boost/libs/tti/test/test_structs.hpp new file mode 100644 index 000000000..e01cb9805 --- /dev/null +++ b/src/boost/libs/tti/test/test_structs.hpp @@ -0,0 +1,277 @@ + +// (C) Copyright Edward Diener 2011,2012,2019 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_STRUCTS_HPP) +#define TEST_STRUCTS_HPP + +#include <boost/config.hpp> + +struct AType + { + + // Type + + typedef int AnIntType; + struct AStructType + { + template <class> struct MStrMemberTemplate { }; + template<class X,class Y,short AA> static int StatFuncTemplate(X *,Y) { int ret(AA); return ret; } + }; + typedef int & AnIntTypeReference; + struct BType + { + typedef int AnIntegerType; + enum BTypeEnum + { + BTypeEnum1, + BTypeEnum2 + }; + struct CType + { + typedef int AnotherIntegerType; + template <class,class,int,short,class,template <class,int> class,class> struct CTManyParameters { }; + template<class X,class Y,class Z,short AA> double SomeFuncTemplate(X,Y *,Z &) { double ret(AA); return ret; } + union CTypeUnion + { + long l; + bool b; + void CMemberFunction(int) { } + }; + }; + }; + + // Enum + + enum AnEnumTtype + { + AnEnumTtype1, + AnEnumTtype2 + }; + +#if !defined(BOOST_NO_CXX11_SCOPED_ENUMS) + + enum class AnEnumClassType + { + AnEnumClassType1, + AnEnumClassType2 + }; + +#endif + + // Union + + union AnUnion + { + int i; + double d; + struct UNStruct + { + short sh; + }; + enum UEnumV + { + UEnumV1, + UEnumV2 + }; + template <int,class,long> struct NestedMemberTemplate { }; + +#if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION) + + static float USMember; + +#endif + + }; + + // Template + + template <class> struct ATPMemberTemplate { }; + template <int> struct AMemberTemplate { }; + template <int,int> struct AnotherMemberTemplate { }; + template <class,class> struct CLMemberTemplate { }; + + // Data + + int AnInt; + BType IntBT; + BType::CType NestedCT; + + // Function + + void VoidFunction() { } + int IntFunction() { return 0; } + + // Const function + + double AConstFunction(long, char) const { return 2.57; } + void WFunction(float, double = 4.3) const { } + + // Volatile function + + double AVolatileFunction(long, char = 'c') volatile { return 2.58; } + void VolFunction(float, double) volatile { } + + // Const Volatile function + + double ACVFunction(long, char) const volatile { return 2.59; } + void ConstVolFunction(float, double) const volatile { } + + // Function Templates + + template<class X,int Y> int AFuncTemplate(const X &) { return Y; } + template<class X,class Y,class Z> void AFuncTemplate(X *,Y,Z &) { } + template<class X> double FTHasDef(X, long, char = 'a') { return 3.58; } + + // Const function template + + template<class X,class Y> double AConstFunctionTemplate(X, Y y) const { return (static_cast<double>(y)); } + template<class X,class Y,class Z> void WFunctionTmp(X **, Y &, Z) const { } + + // Volatile function template + + template<class X> double AVolatileFT(X, long, char) volatile { return 2.58; } + template<class X,int Y> void VolFTem(X &) volatile { } + + // Const Volatile function template + + template<class X,class Y> double ACVFunTemplate(X, Y) const volatile { return 2.59; } + template<int Y> void ConstVolTTFun(float, double) const volatile { } + + // Static Data + + static short DSMember; + + // Static Function + + static int SIntFunction(long,double) { return 2; } + + // Static Function Template + + template<class X,class Y,class Z> static void AnotherFuncTemplate(X,Y &,const Z &) { } + + }; + +struct AnotherType + { + + // Type + + typedef AType::AnIntType someOtherType; + + // Enum + + enum AnotherEnumTtype + { + AnotherEnumType1, + AnotherEnumType2 + }; + +#if !defined(BOOST_NO_CXX11_SCOPED_ENUMS) + + enum class AnotherEnumClassType + { + AnotherEnumClassType1, + AnotherEnumClassType2 + }; + +#endif + + // Union + + union AnotherUnion + { + short s; + char ch; + template <class,class> struct UnionMemberTemplate { }; + static void UnionStaticMemberFunction() { } + union InnerUnion + { + int i; + char ch; + }; + +#if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION) + + static char ASCData; + +#endif + + }; + + // Template + + template <class,class,class,class,class,class> struct SomeMemberTemplate { }; + template <class,class,int,class,template <class> class,class,long> struct ManyParameters { }; + template <class,class,class,class> struct SimpleTMP { }; + + // Data + + bool aMember; + bool cMem; + long AnInt; + AType OtherAT; + AType::AStructType ONestStr; + + // Function + + AType aFunction(int = 7) { return AType(); } + int anotherFunction(AType) { return 0; } + AType::AnIntType sFunction(int,long = 88,double = 1.0) { return 0; } + double IntFunction(int = 9922) { return 0; } + + // Const function + + int AnotherConstFunction(AType *, short) const { return 0; } + AType StillSame(int) const { return OtherAT; } + + // Volatile function + + int AnotherVolatileFunction(AType *, short) volatile { return 0; } + bool StillVolatile(int) volatile { return false; } + + // Const Volatile function + + int AnotherConstVolatileFunction(AType *, short) const volatile { return 0; } + short StillCV(int = 3) const volatile { return 32; } + + // Function Templates + + template<class X> long MyFuncTemplate(X &) { return 0; } + template<int Y> void VWithDefault(float, double d = 2.67) volatile { } + + // Static Function + + static AType TIntFunction(long,double = 3.0) { return AType(); } + static AType::AStructType TSFunction(AType::AnIntType,double) { return AType::AStructType(); } + + // Static Data + + static AType::AStructType AnStat; + + // Static Function Template + + template<class X,class Y> static void YetAnotherFuncTemplate(const X &,Y &) { } + template<class X,class Y,class Z> static void StaticFTWithDefault(const X &,Y &,Z*,long = 27) { } + + static const int CIntValue = 10; + + }; + +struct MarkerType + { + }; + +short AType::DSMember(5622); +AType::AStructType AnotherType::AnStat; + +#if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION) + +float AType::AnUnion::USMember(893.53f); +char AnotherType::AnotherUnion::ASCData('e'); + +#endif + +#endif // TEST_STRUCTS_HPP diff --git a/src/boost/libs/tti/test/test_vm_has_template_cp.cpp b/src/boost/libs/tti/test/test_vm_has_template_cp.cpp new file mode 100644 index 000000000..aa3e9f694 --- /dev/null +++ b/src/boost/libs/tti/test/test_vm_has_template_cp.cpp @@ -0,0 +1,36 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_vm_has_template_cp.hpp" +#include <boost/detail/lightweight_test.hpp> + +int main() + { + +#if BOOST_PP_VARIADICS + + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(ATPMemberTemplate)<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(AMemberTemplate)<AType>::value); + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(SomeMemberTemplate)<AnotherType>::value); + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(SimpleTMP)<AnotherType>::value); + BOOST_TEST(!BOOST_TTI_HAS_TEMPLATE_GEN(TemplateNotExist)<AnotherType>::value); + + BOOST_TEST(HaveCL<AType>::value); + BOOST_TEST(HaveAnotherMT<AType>::value); + BOOST_TEST(ATemplateWithParms<AnotherType>::value); + + BOOST_TEST(BOOST_TTI_HAS_TEMPLATE_GEN(NestedMemberTemplate)<AType::AnUnion>::value); + + // Passing non-class enclosing type will return false + + BOOST_TEST(!BOOST_TTI_HAS_TEMPLATE_GEN(AMemberTemplate)<AType *>::value); + BOOST_TEST(!ATemplateWithParms<double>::value); + +#endif // BOOST_PP_VARIADICS + + return boost::report_errors(); + + } diff --git a/src/boost/libs/tti/test/test_vm_has_template_cp.hpp b/src/boost/libs/tti/test/test_vm_has_template_cp.hpp new file mode 100644 index 000000000..eaabea064 --- /dev/null +++ b/src/boost/libs/tti/test/test_vm_has_template_cp.hpp @@ -0,0 +1,32 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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). + +#if !defined(TEST_VM_HAS_TEMPLATE_CHECK_PARAMS_HPP) +#define TEST_VM_HAS_TEMPLATE_CHECK_PARAMS_HPP + +#include <boost/preprocessor/config/config.hpp> + +#if BOOST_PP_VARIADICS + +#include "test_structs.hpp" +#include <boost/tti/has_template.hpp> + +BOOST_TTI_HAS_TEMPLATE(ATPMemberTemplate,class) +BOOST_TTI_TRAIT_HAS_TEMPLATE(HaveCL,CLMemberTemplate,class,class) +BOOST_TTI_HAS_TEMPLATE(AMemberTemplate,int) +BOOST_TTI_TRAIT_HAS_TEMPLATE(HaveAnotherMT,AnotherMemberTemplate,int,int) +BOOST_TTI_HAS_TEMPLATE(SomeMemberTemplate,class,class,class,class,class,class) +BOOST_TTI_TRAIT_HAS_TEMPLATE(ATemplateWithParms,ManyParameters,class,class,int,class,template <class> class,class,long) +BOOST_TTI_HAS_TEMPLATE(SimpleTMP,class,class,class,class) +BOOST_TTI_HAS_TEMPLATE(TemplateNotExist,int,class,template <class> class ATemplate) +BOOST_TTI_TRAIT_HAS_TEMPLATE(WrongParametersForMP,ManyParameters,class,class,int,class,template <class,class> class,class,long) +BOOST_TTI_TRAIT_HAS_TEMPLATE(WrongParameters2ForMP,ManyParameters,class,long,int,class,template <class> class,class,long) + +BOOST_TTI_HAS_TEMPLATE(NestedMemberTemplate,int,class,long) + +#endif // BOOST_PP_VARIADICS + +#endif // TEST_VM_HAS_TEMPLATE_CHECK_PARAMS_HPP diff --git a/src/boost/libs/tti/test/test_vm_has_template_cp_compile.cpp b/src/boost/libs/tti/test/test_vm_has_template_cp_compile.cpp new file mode 100644 index 000000000..4d1059a09 --- /dev/null +++ b/src/boost/libs/tti/test/test_vm_has_template_cp_compile.cpp @@ -0,0 +1,34 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_vm_has_template_cp.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + +#if BOOST_PP_VARIADICS + + // You can always instantiate without compiler errors + + BOOST_TTI_HAS_TEMPLATE_GEN(TemplateNotExist)<AnotherType> aVar1; + + // Compile time asserts + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(ATPMemberTemplate)<AType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(AMemberTemplate)<AType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(SomeMemberTemplate)<AnotherType>)); + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(SimpleTMP)<AnotherType>)); + + BOOST_MPL_ASSERT((HaveCL<AType>)); + BOOST_MPL_ASSERT((HaveAnotherMT<AType>)); + BOOST_MPL_ASSERT((ATemplateWithParms<AnotherType>)); + +#endif // BOOST_PP_VARIADICS + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_vm_has_template_cp_fail.cpp b/src/boost/libs/tti/test/test_vm_has_template_cp_fail.cpp new file mode 100644 index 000000000..4a6caf6a3 --- /dev/null +++ b/src/boost/libs/tti/test/test_vm_has_template_cp_fail.cpp @@ -0,0 +1,27 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_vm_has_template_cp.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + +#if BOOST_PP_VARIADICS + + // TemplateNotExist does not exist at all + + BOOST_MPL_ASSERT((BOOST_TTI_HAS_TEMPLATE_GEN(TemplateNotExist)<AType>)); + +#else + + BOOST_MPL_ASSERT((boost::mpl::false_)); + +#endif // BOOST_PP_VARIADICS + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_vm_has_template_cp_fail2.cpp b/src/boost/libs/tti/test/test_vm_has_template_cp_fail2.cpp new file mode 100644 index 000000000..6d4da5a17 --- /dev/null +++ b/src/boost/libs/tti/test/test_vm_has_template_cp_fail2.cpp @@ -0,0 +1,27 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_vm_has_template_cp.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + +#if BOOST_PP_VARIADICS + + // Wrong enclosing type + + BOOST_MPL_ASSERT((HaveCL<AnotherType>)); + +#else + + BOOST_MPL_ASSERT((boost::mpl::false_)); + +#endif // BOOST_PP_VARIADICS + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_vm_has_template_cp_fail3.cpp b/src/boost/libs/tti/test/test_vm_has_template_cp_fail3.cpp new file mode 100644 index 000000000..4bcba5944 --- /dev/null +++ b/src/boost/libs/tti/test/test_vm_has_template_cp_fail3.cpp @@ -0,0 +1,27 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_vm_has_template_cp.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + +#if BOOST_PP_VARIADICS + + // Wrong template parameters + + BOOST_MPL_ASSERT((WrongParametersForMP<AnotherType>)); + +#else + + BOOST_MPL_ASSERT((boost::mpl::false_)); + +#endif // BOOST_PP_VARIADICS + + return 0; + + } diff --git a/src/boost/libs/tti/test/test_vm_has_template_cp_fail4.cpp b/src/boost/libs/tti/test/test_vm_has_template_cp_fail4.cpp new file mode 100644 index 000000000..46e3997c0 --- /dev/null +++ b/src/boost/libs/tti/test/test_vm_has_template_cp_fail4.cpp @@ -0,0 +1,27 @@ + +// (C) Copyright Edward Diener 2011 +// Use, modification and distribution are subject to 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 "test_vm_has_template_cp.hpp" +#include <boost/mpl/assert.hpp> + +int main() + { + +#if BOOST_PP_VARIADICS + + // Wrong template parameters + + BOOST_MPL_ASSERT((WrongParameters2ForMP<AnotherType>)); + +#else + + BOOST_MPL_ASSERT((boost::mpl::false_)); + +#endif // BOOST_PP_VARIADICS + + return 0; + + } |