From 2a5b68c117bcc0e630f6070e17d5bfb12d2f8b7e Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 10 Apr 2003 12:43:19 +0000 Subject: [PATCH] Added test for BOOST_NO_MPL_AUX_HAS_XXX macro [SVN r18226] --- test/aux_/Jamfile | 1 + test/aux_/no_has_xxx.cpp | 70 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100755 test/aux_/no_has_xxx.cpp diff --git a/test/aux_/Jamfile b/test/aux_/Jamfile index d01c286..e8a79d2 100644 --- a/test/aux_/Jamfile +++ b/test/aux_/Jamfile @@ -8,4 +8,5 @@ compile debug_print.cpp ; compile has_rebind.cpp ; compile has_distance.cpp ; compile has_xxx.cpp ; +compile no_has_xxx.cpp ; compile typeof.cpp ; diff --git a/test/aux_/no_has_xxx.cpp b/test/aux_/no_has_xxx.cpp new file mode 100755 index 0000000..06b5f69 --- /dev/null +++ b/test/aux_/no_has_xxx.cpp @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// boost mpl/test/aux_/no_has_xxx.cpp source file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2000-03 +// Aleksey Gurtovoy, Dave Abrahams +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appears in all copies and +// that both the copyright notice and this permission notice appear in +// supporting documentation. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#include "boost/mpl/aux_/has_xxx.hpp" +#include "boost/mpl/aux_/config/workaround.hpp" +#include "boost/static_assert.hpp" + +BOOST_MPL_HAS_XXX_TRAIT_DEF(xxx_type) + +struct a1; +struct a2 {}; +struct a3 { typedef int xxx_type; }; +struct a4 { struct xxx_type; }; +struct a5 { typedef int& xxx_type; }; +struct a6 { typedef int* xxx_type; }; +struct a7 { typedef int xxx_type[10]; }; +struct a8 { typedef void (*xxx_type)(); }; +struct a9 { typedef void (xxx_type)(); }; + +// +// This file tests that we have the right value for +// BOOST_NO_MPL_AUX_HAS_XXX, and that has_xxx doesn't just fail to +// compile arbitrarily. Could be used as part of the config tests. +// + +#undef FALSE +#undef TRUE +#define FALSE false + +#ifdef BOOST_NO_MPL_AUX_HAS_XXX +# define TRUE FALSE +#else +# define TRUE true +#endif + +int main() +{ +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + BOOST_STATIC_ASSERT(has_xxx_type::value == FALSE); + BOOST_STATIC_ASSERT(has_xxx_type::value == FALSE); + BOOST_STATIC_ASSERT(has_xxx_type::value == FALSE); + BOOST_STATIC_ASSERT(has_xxx_type::value == FALSE); +#endif + + BOOST_STATIC_ASSERT(has_xxx_type::value == FALSE); + BOOST_STATIC_ASSERT(has_xxx_type::value == FALSE); + BOOST_STATIC_ASSERT(has_xxx_type::value == FALSE); + BOOST_STATIC_ASSERT(has_xxx_type::value == TRUE); + BOOST_STATIC_ASSERT(has_xxx_type::value == TRUE); + BOOST_STATIC_ASSERT(has_xxx_type::value == TRUE); + BOOST_STATIC_ASSERT(has_xxx_type::value == TRUE); + BOOST_STATIC_ASSERT(has_xxx_type::value == TRUE); + BOOST_STATIC_ASSERT(has_xxx_type::value == TRUE); + BOOST_STATIC_ASSERT(has_xxx_type::value == TRUE); + + return 0; +}