summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/detail/test/container_fwd
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/detail/test/container_fwd')
-rw-r--r--src/boost/libs/detail/test/container_fwd/Jamfile39
-rw-r--r--src/boost/libs/detail/test/container_fwd/container_fwd_test.cpp112
-rw-r--r--src/boost/libs/detail/test/container_fwd/container_no_fwd_test.cpp14
-rw-r--r--src/boost/libs/detail/test/container_fwd/correctly_disable_fail.cpp43
4 files changed, 208 insertions, 0 deletions
diff --git a/src/boost/libs/detail/test/container_fwd/Jamfile b/src/boost/libs/detail/test/container_fwd/Jamfile
new file mode 100644
index 00000000..1c0906e7
--- /dev/null
+++ b/src/boost/libs/detail/test/container_fwd/Jamfile
@@ -0,0 +1,39 @@
+
+# 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
+ <warnings>all
+ <toolset>intel:<warnings>on
+ <toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
+ <toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
+ <toolset>clang:<cxxflags>"-pedantic -Wextra -Wmismatched-tags"
+ <warnings-as-errors>on
+ ;
+
+run container_no_fwd_test.cpp ;
+run container_fwd_test.cpp : : : : container_fwd ;
+run container_fwd_test.cpp : :
+ : <define>_STLP_DEBUG <define>_GLIBCXX_DEBUG
+ : container_fwd_debug ;
+
+# The 'correctly_disable' tests fail if forward declaring standard types
+# could work, but is currently not being done. Unfortunately, this if often
+# the case - but we can't detect it, so the tests fail and there's not much
+# we can do. There are also problems because some compilers don't support
+# the debug version of their libraries. So I felt it was best to stop these
+# tests from running in a normal test run..
+
+compile-fail correctly_disable_fail.cpp
+ : <warnings-as-errors>off
+ : correctly_disable ;
+compile-fail correctly_disable_fail.cpp
+ : <warnings-as-errors>off <define>_STLP_DEBUG <define>_GLIBCXX_DEBUG
+ : correctly_disable_debug ;
+
+explicit correctly_disable ;
+explicit correctly_disable_debug ;
diff --git a/src/boost/libs/detail/test/container_fwd/container_fwd_test.cpp b/src/boost/libs/detail/test/container_fwd/container_fwd_test.cpp
new file mode 100644
index 00000000..f12c7c37
--- /dev/null
+++ b/src/boost/libs/detail/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 <boost/detail/container_fwd.hpp>
+
+#if BOOST_WORKAROUND(__GNUC__, < 3) && \
+ !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
+template <class charT, class Allocator>
+static void test(
+ std::basic_string<charT, std::string_char_traits<charT>, Allocator> const&)
+{
+}
+#else
+template <class charT, class Allocator>
+static void test(
+ std::basic_string<charT, std::char_traits<charT>, Allocator> const&)
+{
+}
+#endif
+
+template <class T, class Allocator>
+static void test(std::deque<T, Allocator> const&)
+{
+}
+
+template <class T, class Allocator>
+static void test(std::list<T, Allocator> const&)
+{
+}
+
+template <class T, class Allocator>
+static void test(std::vector<T, Allocator> const&)
+{
+}
+
+template <class Key, class T, class Compare, class Allocator>
+static void test(std::map<Key, T, Compare, Allocator> const&)
+{
+}
+
+template <class Key, class T, class Compare, class Allocator>
+static void test(std::multimap<Key, T, Compare, Allocator> const&)
+{
+}
+
+template <class Key, class Compare, class Allocator>
+static void test(std::set<Key, Compare, Allocator> const&)
+{
+}
+
+template <class Key, class Compare, class Allocator>
+static void test(std::multiset<Key, Compare, Allocator> const&)
+{
+}
+
+template <std::size_t N>
+static void test(std::bitset<N> const&)
+{
+}
+
+template <class T>
+static void test(std::complex<T> const&)
+{
+}
+
+template <class X, class Y>
+static void test(std::pair<X, Y> const&)
+{
+}
+
+#include <deque>
+#include <list>
+#include <vector>
+#include <map>
+#include <set>
+#include <bitset>
+#include <string>
+#include <complex>
+#include <utility>
+
+int main()
+{
+ std::deque<int> x1;
+ std::list<std::string> x2;
+ std::vector<float> x3;
+ std::vector<bool> x4;
+ std::map<int, int> x5;
+ std::multimap<float, int*> x6;
+ std::set<std::string> x7;
+ std::multiset<std::vector<int> > x8;
+ std::bitset<10> x9;
+ std::string x10;
+ std::complex<double> x11;
+ std::pair<std::list<int>, 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/src/boost/libs/detail/test/container_fwd/container_no_fwd_test.cpp b/src/boost/libs/detail/test/container_fwd/container_no_fwd_test.cpp
new file mode 100644
index 00000000..9da09da1
--- /dev/null
+++ b/src/boost/libs/detail/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 <boost/detail/container_fwd.hpp>
+
+int main()
+{
+ std::set<int> x;
+ std::vector<std::string> y;
+}
diff --git a/src/boost/libs/detail/test/container_fwd/correctly_disable_fail.cpp b/src/boost/libs/detail/test/container_fwd/correctly_disable_fail.cpp
new file mode 100644
index 00000000..23016862
--- /dev/null
+++ b/src/boost/libs/detail/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 <boost/detail/container_fwd.hpp>
+
+#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 <boost/detail/container_fwd.hpp>
+
+template <class T, class Allocator>
+void test(std::vector<T, Allocator> const&)
+{
+}
+
+#include <vector>
+
+int main ()
+{
+ std::vector<int> x;
+ test(x);
+}
+
+#endif
+