diff --git a/test/Jamfile b/test/Jamfile index 9413621..59c0a8d 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -5,6 +5,8 @@ # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ################################################################################ +build-project container_fwd ; + project detail/test : requirements clang:-Wno-unused diff --git a/test/container_fwd/Jamfile b/test/container_fwd/Jamfile new file mode 100644 index 0000000..b39d447 --- /dev/null +++ b/test/container_fwd/Jamfile @@ -0,0 +1,28 @@ + +# Copyright 2011 Daniel James. +# Distributed under 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) + +import testing ; + +project detail/test/container_fwd + : requirements + all + intel:on + gcc:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion" + darwin:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion" + on + ; + +run container_no_fwd_test.cpp ; +run container_fwd_test.cpp : : : : container_fwd ; +run container_fwd_test.cpp : : + : _STLP_DEBUG _GLIBCXX_DEBUG + : container_fwd_debug ; + +compile-fail correctly_disable_fail.cpp + : off + : correctly_disable ; +compile-fail correctly_disable_fail.cpp + : off _STLP_DEBUG _GLIBCXX_DEBUG + : correctly_disable_debug ; diff --git a/test/container_fwd/container_fwd_test.cpp b/test/container_fwd/container_fwd_test.cpp new file mode 100644 index 0000000..55c2e04 --- /dev/null +++ b/test/container_fwd/container_fwd_test.cpp @@ -0,0 +1,112 @@ + +// Copyright 2005-2009 Daniel James. +// Distributed under 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 + +#if BOOST_WORKAROUND(__GNUC__, < 3) && \ + !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +template +static void test( + std::basic_string, Allocator> const&) +{ +} +#else +template +static void test( + std::basic_string, Allocator> const&) +{ +} +#endif + +template +static void test(std::deque const&) +{ +} + +template +static void test(std::list const&) +{ +} + +template +static void test(std::vector const&) +{ +} + +template +static void test(std::map const&) +{ +} + +template +static void test(std::multimap const&) +{ +} + +template +static void test(std::set const&) +{ +} + +template +static void test(std::multiset const&) +{ +} + +template +static void test(std::bitset const&) +{ +} + +template +static void test(std::complex const&) +{ +} + +template +static void test(std::pair const&) +{ +} + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main() +{ + std::deque x1; + std::list x2; + std::vector x3; + std::vector x4; + std::map x5; + std::multimap x6; + std::set x7; + std::multiset > x8; + std::bitset<10> x9; + std::string x10; + std::complex x11; + std::pair, char***> x12; + + test(x1); + test(x2); + test(x3); + test(x4); + test(x5); + test(x6); + test(x7); + test(x8); + test(x9); + test(x10); + test(x11); + test(x12); + + return 0; +} diff --git a/test/container_fwd/container_no_fwd_test.cpp b/test/container_fwd/container_no_fwd_test.cpp new file mode 100644 index 0000000..9da09da --- /dev/null +++ b/test/container_fwd/container_no_fwd_test.cpp @@ -0,0 +1,14 @@ + +// Copyright 2010 Daniel James. +// Distributed under 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) + +#define BOOST_DETAIL_NO_CONTAINER_FWD + +#include + +int main() +{ + std::set x; + std::vector y; +} diff --git a/test/container_fwd/correctly_disable_fail.cpp b/test/container_fwd/correctly_disable_fail.cpp new file mode 100644 index 0000000..2301686 --- /dev/null +++ b/test/container_fwd/correctly_disable_fail.cpp @@ -0,0 +1,43 @@ + +// Copyright 2011 Daniel James. +// Distributed under 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) + +// This tests if container forwarding is correctly disabled. If it isn't +// disabled it causes a compile error (which causes the test to pass). +// If it is disabled it tries container forwarding. If it doesn't work +// then there will be a compile error, indicating that it is correctly +// disabled. But if there isn't a compile error that indicates that +// container forwarding might work. +// +// Since this test only tries std::vector, it might get it wrong but I didn't +// want it to fail because of some incompatibility with a trickier class. + +#define BOOST_DETAIL_TEST_CONFIG_ONLY +#include + +#if !defined(BOOST_DETAIL_NO_CONTAINER_FWD) +#error "Failing in order to pass test" +#else +#define BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD + +#undef BOOST_DETAIL_CONTAINER_FWD_HPP +#undef BOOST_DETAIL_TEST_CONFIG_ONLY + +#include + +template +void test(std::vector const&) +{ +} + +#include + +int main () +{ + std::vector x; + test(x); +} + +#endif +