summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/container_hash
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/container_hash')
-rw-r--r--src/boost/libs/container_hash/CMakeLists.txt23
-rw-r--r--src/boost/libs/container_hash/examples/Jamfile.v29
-rw-r--r--src/boost/libs/container_hash/examples/books.cpp51
-rw-r--r--src/boost/libs/container_hash/examples/books.hpp26
-rw-r--r--src/boost/libs/container_hash/examples/point.cpp59
-rw-r--r--src/boost/libs/container_hash/examples/portable.cpp59
-rw-r--r--src/boost/libs/container_hash/examples/template.cpp18
-rw-r--r--src/boost/libs/container_hash/examples/template.hpp36
-rw-r--r--src/boost/libs/container_hash/index.html16
-rw-r--r--src/boost/libs/container_hash/meta/explicit-failures-markup.xml96
-rw-r--r--src/boost/libs/container_hash/meta/libraries.json20
-rw-r--r--src/boost/libs/container_hash/test/Jamfile.v287
-rw-r--r--src/boost/libs/container_hash/test/check_float_funcs.cpp58
-rw-r--r--src/boost/libs/container_hash/test/compile_time.hpp20
-rw-r--r--src/boost/libs/container_hash/test/config.hpp25
-rw-r--r--src/boost/libs/container_hash/test/extensions_hpp_test.cpp19
-rw-r--r--src/boost/libs/container_hash/test/hash_built_in_array_test.cpp75
-rw-r--r--src/boost/libs/container_hash/test/hash_complex_test.cpp110
-rw-r--r--src/boost/libs/container_hash/test/hash_custom_test.cpp100
-rw-r--r--src/boost/libs/container_hash/test/hash_deque_test.cpp35
-rw-r--r--src/boost/libs/container_hash/test/hash_enum_test.cpp63
-rw-r--r--src/boost/libs/container_hash/test/hash_float_test.cpp18
-rw-r--r--src/boost/libs/container_hash/test/hash_float_test.hpp309
-rw-r--r--src/boost/libs/container_hash/test/hash_friend_test.cpp103
-rw-r--r--src/boost/libs/container_hash/test/hash_function_pointer_test.cpp57
-rw-r--r--src/boost/libs/container_hash/test/hash_fwd_test.hpp104
-rw-r--r--src/boost/libs/container_hash/test/hash_fwd_test_1.cpp96
-rw-r--r--src/boost/libs/container_hash/test/hash_fwd_test_2.cpp47
-rw-r--r--src/boost/libs/container_hash/test/hash_global_namespace_test.cpp103
-rw-r--r--src/boost/libs/container_hash/test/hash_info.cpp102
-rw-r--r--src/boost/libs/container_hash/test/hash_list_test.cpp35
-rw-r--r--src/boost/libs/container_hash/test/hash_long_double_test.cpp17
-rw-r--r--src/boost/libs/container_hash/test/hash_map_test.cpp40
-rw-r--r--src/boost/libs/container_hash/test/hash_map_test.hpp74
-rw-r--r--src/boost/libs/container_hash/test/hash_no_ext_fail_test.cpp28
-rw-r--r--src/boost/libs/container_hash/test/hash_no_ext_macro_1.cpp37
-rw-r--r--src/boost/libs/container_hash/test/hash_no_ext_macro_2.cpp37
-rw-r--r--src/boost/libs/container_hash/test/hash_number_test.cpp203
-rw-r--r--src/boost/libs/container_hash/test/hash_optional_test.cpp70
-rw-r--r--src/boost/libs/container_hash/test/hash_pointer_test.cpp45
-rw-r--r--src/boost/libs/container_hash/test/hash_range_test.cpp85
-rw-r--r--src/boost/libs/container_hash/test/hash_sequence_test.hpp76
-rw-r--r--src/boost/libs/container_hash/test/hash_set_test.cpp40
-rw-r--r--src/boost/libs/container_hash/test/hash_set_test.hpp79
-rw-r--r--src/boost/libs/container_hash/test/hash_std_array_test.cpp103
-rw-r--r--src/boost/libs/container_hash/test/hash_std_smart_ptr_test.cpp80
-rw-r--r--src/boost/libs/container_hash/test/hash_std_tuple_test.cpp77
-rw-r--r--src/boost/libs/container_hash/test/hash_string_test.cpp184
-rw-r--r--src/boost/libs/container_hash/test/hash_system_error_test.cpp55
-rw-r--r--src/boost/libs/container_hash/test/hash_type_index_test.cpp53
-rw-r--r--src/boost/libs/container_hash/test/hash_value_array_test.cpp64
-rw-r--r--src/boost/libs/container_hash/test/hash_variant_test.cpp100
-rw-r--r--src/boost/libs/container_hash/test/hash_vector_test.cpp68
-rw-r--r--src/boost/libs/container_hash/test/implicit_test.cpp21
-rw-r--r--src/boost/libs/container_hash/test/link_ext_test.cpp33
-rw-r--r--src/boost/libs/container_hash/test/link_no_ext_test.cpp20
-rw-r--r--src/boost/libs/container_hash/test/link_test.cpp11
-rw-r--r--src/boost/libs/container_hash/test/link_test_2.cpp10
-rw-r--r--src/boost/libs/container_hash/test/namespace_fail_test.cpp16
59 files changed, 3705 insertions, 0 deletions
diff --git a/src/boost/libs/container_hash/CMakeLists.txt b/src/boost/libs/container_hash/CMakeLists.txt
new file mode 100644
index 000000000..76236f8de
--- /dev/null
+++ b/src/boost/libs/container_hash/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright 2018 Mike Dev
+# 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
+
+cmake_minimum_required(VERSION 3.5)
+project(BoostContainerHash LANGUAGES CXX)
+
+add_library(boost_container_hash INTERFACE)
+add_library(Boost::container_hash ALIAS boost_container_hash)
+
+target_include_directories(boost_container_hash INTERFACE include)
+
+target_link_libraries(boost_container_hash
+ INTERFACE
+ Boost::assert
+ Boost::config
+ Boost::core
+ Boost::detail
+ Boost::integer
+ Boost::static_assert
+ Boost::type_traits
+)
+
diff --git a/src/boost/libs/container_hash/examples/Jamfile.v2 b/src/boost/libs/container_hash/examples/Jamfile.v2
new file mode 100644
index 000000000..62916211e
--- /dev/null
+++ b/src/boost/libs/container_hash/examples/Jamfile.v2
@@ -0,0 +1,9 @@
+
+# Copyright Daniel James 2005. 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)
+
+run books.cpp ;
+run point.cpp ;
+run portable.cpp ;
+run template.cpp ;
diff --git a/src/boost/libs/container_hash/examples/books.cpp b/src/boost/libs/container_hash/examples/books.cpp
new file mode 100644
index 000000000..3dfa547e8
--- /dev/null
+++ b/src/boost/libs/container_hash/examples/books.cpp
@@ -0,0 +1,51 @@
+
+// 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 "./books.hpp"
+#include <boost/container_hash/hash.hpp>
+#include <cassert>
+
+// If std::unordered_set was available:
+//#include <unordered_set>
+
+// This example illustrates how to use boost::hash with a custom hash function.
+// For full details, see the tutorial.
+
+int main()
+{
+ library::book knife(3458, "Zane Grey", "The Hash Knife Outfit");
+ library::book dandelion(1354, "Paul J. Shanley", "Hash & Dandelion Greens");
+
+ boost::hash<library::book> book_hasher;
+ std::size_t knife_hash_value = book_hasher(knife);
+ (void)knife_hash_value; // suppress unused variable warning
+
+ // If std::unordered_set was available:
+ //
+ //std::unordered_set<library::book, boost::hash<library::book> > books;
+ //books.insert(knife);
+ //books.insert(library::book(2443, "Lindgren, Torgny", "Hash"));
+ //books.insert(library::book(1953, "Snyder, Bernadette M.",
+ // "Heavenly Hash: A Tasty Mix of a Mother's Meditations"));
+
+ //assert(books.find(knife) != books.end());
+ //assert(books.find(dandelion) == books.end());
+
+ return 0;
+}
+
+namespace library
+{
+ bool operator==(book const& a, book const& b)
+ {
+ return a.id == b.id;
+ }
+
+ std::size_t hash_value(book const& b)
+ {
+ boost::hash<int> hasher;
+ return hasher(b.id);
+ }
+}
diff --git a/src/boost/libs/container_hash/examples/books.hpp b/src/boost/libs/container_hash/examples/books.hpp
new file mode 100644
index 000000000..ac87a9df4
--- /dev/null
+++ b/src/boost/libs/container_hash/examples/books.hpp
@@ -0,0 +1,26 @@
+
+// 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)
+
+// This example illustrates how to use boost::hash with a custom hash function.
+// The implementation is contained in books.cpp
+
+#include <cstddef>
+#include <string>
+
+namespace library
+{
+ struct book
+ {
+ int id;
+ std::string author;
+ std::string title;
+
+ book(int i, std::string const& a, std::string const& t)
+ : id(i), author(a), title(t) {}
+ };
+
+ bool operator==(book const&, book const&);
+ std::size_t hash_value(book const&);
+}
diff --git a/src/boost/libs/container_hash/examples/point.cpp b/src/boost/libs/container_hash/examples/point.cpp
new file mode 100644
index 000000000..3f5e8be3d
--- /dev/null
+++ b/src/boost/libs/container_hash/examples/point.cpp
@@ -0,0 +1,59 @@
+
+// Copyright 2005 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)
+
+// Force use of assert.
+#if defined(NDEBUG)
+#undef NDEBUG
+#endif
+
+#include <boost/container_hash/hash.hpp>
+#include <cassert>
+
+// This example illustrates how to use boost::hash_combine to generate a hash
+// value from the different members of a class. For full details see the hash
+// tutorial.
+
+class point
+{
+ int x;
+ int y;
+public:
+ point() : x(0), y(0) {}
+ point(int x, int y) : x(x), y(y) {}
+
+ bool operator==(point const& other) const
+ {
+ return x == other.x && y == other.y;
+ }
+
+ friend std::size_t hash_value(point const& p)
+ {
+ std::size_t seed = 0;
+ boost::hash_combine(seed, p.x);
+ boost::hash_combine(seed, p.y);
+
+ return seed;
+ }
+};
+
+int main()
+{
+ boost::hash<point> point_hasher;
+
+ point p1(0, 0);
+ point p2(1, 2);
+ point p3(4, 1);
+ point p4 = p1;
+
+ assert(point_hasher(p1) == point_hasher(p4));
+
+ // These tests could legally fail, but if they did it'd be a pretty bad
+ // hash function.
+ assert(point_hasher(p1) != point_hasher(p2));
+ assert(point_hasher(p1) != point_hasher(p3));
+
+ return 0;
+}
+
diff --git a/src/boost/libs/container_hash/examples/portable.cpp b/src/boost/libs/container_hash/examples/portable.cpp
new file mode 100644
index 000000000..e0ea96a69
--- /dev/null
+++ b/src/boost/libs/container_hash/examples/portable.cpp
@@ -0,0 +1,59 @@
+
+// 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)
+
+// Force use of assert.
+#if defined(NDEBUG)
+#undef NDEBUG
+#endif
+
+#include <boost/container_hash/hash.hpp>
+#include <cassert>
+
+// This example illustrates how to customise boost::hash portably, so that
+// it'll work on both compilers that don't implement argument dependent lookup
+// and compilers that implement strict two-phase template instantiation.
+
+namespace foo
+{
+ template <class T>
+ class custom_type
+ {
+ T value;
+ public:
+ custom_type(T x) : value(x) {}
+
+ std::size_t hash() const
+ {
+ boost::hash<T> hasher;
+ return hasher(value);
+ }
+ };
+}
+
+#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+namespace boost
+#else
+namespace foo
+#endif
+{
+ template <class T>
+ std::size_t hash_value(foo::custom_type<T> x)
+ {
+ return x.hash();
+ }
+}
+
+int main()
+{
+ foo::custom_type<int> x(1), y(2), z(1);
+
+ boost::hash<foo::custom_type<int> > hasher;
+
+ assert(hasher(x) == hasher(x));
+ assert(hasher(x) != hasher(y));
+ assert(hasher(x) == hasher(z));
+
+ return 0;
+}
diff --git a/src/boost/libs/container_hash/examples/template.cpp b/src/boost/libs/container_hash/examples/template.cpp
new file mode 100644
index 000000000..d74f0a9ca
--- /dev/null
+++ b/src/boost/libs/container_hash/examples/template.cpp
@@ -0,0 +1,18 @@
+
+// Copyright 2012 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 "template.hpp"
+#include <cassert>
+#include <boost/unordered_set.hpp>
+
+int main()
+{
+ typedef my_pair<int, float> pair;
+ boost::unordered_set<pair> pair_set;
+ pair_set.emplace(10, 0.5f);
+
+ assert(pair_set.find(pair(10, 0.5f)) != pair_set.end());
+ assert(pair_set.find(pair(10, 0.6f)) == pair_set.end());
+}
diff --git a/src/boost/libs/container_hash/examples/template.hpp b/src/boost/libs/container_hash/examples/template.hpp
new file mode 100644
index 000000000..0a2fe1326
--- /dev/null
+++ b/src/boost/libs/container_hash/examples/template.hpp
@@ -0,0 +1,36 @@
+
+// Copyright 2012 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 is an example of how to write a hash function for a template
+// class.
+
+#include <boost/container_hash/hash_fwd.hpp>
+
+template <typename A, typename B>
+class my_pair
+{
+ A value1;
+ B value2;
+public:
+ my_pair(A const& v1, B const& v2)
+ : value1(v1), value2(v2)
+ {}
+
+ bool operator==(my_pair const& other) const
+ {
+ return value1 == other.value1 &&
+ value2 == other.value2;
+ }
+
+ friend std::size_t hash_value(my_pair const& p)
+ {
+ std::size_t seed = 0;
+ boost::hash_combine(seed, p.value1);
+ boost::hash_combine(seed, p.value2);
+
+ return seed;
+ }
+};
+
diff --git a/src/boost/libs/container_hash/index.html b/src/boost/libs/container_hash/index.html
new file mode 100644
index 000000000..4b26a414c
--- /dev/null
+++ b/src/boost/libs/container_hash/index.html
@@ -0,0 +1,16 @@
+
+<!--
+Copyright 2005-2007 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)
+-->
+
+<html>
+<head>
+ <meta http-equiv="refresh" content="0; URL=../../doc/html/hash.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="../../doc/html/hash.html">../../doc/html/hash.html</a>
+</body>
+</html>
diff --git a/src/boost/libs/container_hash/meta/explicit-failures-markup.xml b/src/boost/libs/container_hash/meta/explicit-failures-markup.xml
new file mode 100644
index 000000000..bb205ccc1
--- /dev/null
+++ b/src/boost/libs/container_hash/meta/explicit-failures-markup.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2018 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)
+-->
+<explicit-failures-markup>
+ <!-- container_hash -->
+ <library name="container_hash">
+ <mark-expected-failures>
+ <test name="hash_value_array_test"/>
+ <toolset name="msvc-6.5*"/>
+ <toolset name="msvc-7.0*"/>
+ <note author="Daniel James">
+ hash_value is not overloaded for arrays for older versions
+ of Visual C++. There is a work around so that
+ boost::hash&lt;T[N]&gt;, boost::hash_combine and boost::hash_range
+ work.
+ </note>
+ </mark-expected-failures>
+
+ <mark-expected-failures>
+ <test name="hash_function_pointer_test"/>
+ <toolset name="msvc-6.5*"/>
+ <toolset name="msvc-7.0*"/>
+ <note refid="2" author="Daniel James"/>
+ </mark-expected-failures>
+
+ <mark-expected-failures>
+ <test name="hash_function_pointer_test"/>
+ <toolset name="sun-5.7"/>
+ <toolset name="sun-5.8"/>
+ <toolset name="sun-5.9"/>
+ <note author="Daniel James">
+ On these compilers the wrong overload of hash_value is called
+ when the argument is a hash function pointer. So calling
+ hash_value doesn't work but boost::hash does work (and it's
+ recommended that user never call hash_value directly so this
+ shouldn't be a problem).
+ </note>
+ </mark-expected-failures>
+
+ <mark-expected-failures>
+ <test name="hash_long_double_test"/>
+ <toolset name="gcc-3.4.3_sunos"/>
+ <toolset name="*pa_risc"/>
+ <note author="Daniel James">
+ This platform has poor support for <code>long double</code> so
+ the hash function perform poorly for values out of the range
+ of <code>double</code> or if they differ at a greater precision
+ that <code>double</code> is capable of representing.
+ </note>
+ </mark-expected-failures>
+
+ <mark-expected-failures>
+ <test name="point" />
+ <test name="books" />
+ <toolset name="msvc-6.5*"/>
+ <toolset name="msvc-7.0*"/>
+ <note author="Daniel James">
+ These examples only work on compilers with support for ADL.
+ It is possible to work around this, but I wanted to keep the
+ example code as clean as possible.
+ </note>
+ </mark-expected-failures>
+
+ <mark-expected-failures>
+ <test name="point" />
+ <toolset name="borland-*"/>
+ <note author="Daniel James">
+ It appears that Borland doesn't find friend functions defined
+ in a class by ADL. This is easily fixed but this example is
+ meant to show the typical way of customising boost::hash, not
+ the portable way.
+ </note>
+ </mark-expected-failures>
+
+ <mark-expected-failures>
+ <test name="hash_global_namespace_test" />
+ <toolset name="borland-*"/>
+ <note author="Daniel James">
+ The test demonstrates a Borland bug - functions that aren't
+ in a namespace don't appear to be found by ADL.
+ </note>
+ </mark-expected-failures>
+
+ <mark-expected-failures>
+ <test name="container_fwd_gcc_debug"/>
+ <toolset name="darwin-4.2"/>
+ <note author="Daniel James">
+ Debug containers aren't supported on Apple's version of gcc 4.2.
+ </note>
+ </mark-expected-failures>
+ </library>
+</explicit-failures-markup>
diff --git a/src/boost/libs/container_hash/meta/libraries.json b/src/boost/libs/container_hash/meta/libraries.json
new file mode 100644
index 000000000..b1b075b32
--- /dev/null
+++ b/src/boost/libs/container_hash/meta/libraries.json
@@ -0,0 +1,20 @@
+[
+ {
+ "key": "functional/hash",
+ "boost-version": "1.33.0",
+ "name": "Container Hash",
+ "authors": [
+ "Daniel James"
+ ],
+ "maintainers": [
+ "Daniel James <dnljms -at- gmail.com>"
+ ],
+ "description": "An STL-compatible hash function object that can be extended to hash user defined types.",
+ "std": [
+ "tr1"
+ ],
+ "category": [
+ "Function-objects"
+ ]
+ }
+]
diff --git a/src/boost/libs/container_hash/test/Jamfile.v2 b/src/boost/libs/container_hash/test/Jamfile.v2
new file mode 100644
index 000000000..a9dddfb20
--- /dev/null
+++ b/src/boost/libs/container_hash/test/Jamfile.v2
@@ -0,0 +1,87 @@
+
+# Copyright 2005-2012 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 hash-tests
+ : requirements
+ <warnings>all
+ <toolset>intel:<warnings>on
+ #<toolset>intel:<cxxflags>-strict-ansi
+ <toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow"
+ <toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow"
+ <toolset>clang:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wsign-conversion -Wconversion -Wfloat-equal -Wshadow"
+ #<toolset>msvc:<warnings-as-errors>on
+ #<toolset>gcc:<warnings-as-errors>on
+ #<toolset>darwin:<warnings-as-errors>on
+ ;
+
+test-suite container_hash/hash
+ :
+ [ run hash_info.cpp : : : <test-info>always_show_run_output ]
+ [ compile check_float_funcs.cpp ]
+ [ run hash_fwd_test_1.cpp ]
+ [ run hash_fwd_test_2.cpp ]
+ [ run hash_number_test.cpp ]
+ [ run hash_enum_test.cpp ]
+ [ run hash_pointer_test.cpp ]
+ [ run hash_function_pointer_test.cpp ]
+ [ run hash_float_test.cpp ]
+ [ run hash_long_double_test.cpp ]
+ [ run hash_string_test.cpp ]
+ [ run hash_range_test.cpp ]
+ [ run hash_custom_test.cpp ]
+ [ run hash_global_namespace_test.cpp ]
+ [ run hash_friend_test.cpp ]
+ [ run hash_built_in_array_test.cpp ]
+ [ run hash_value_array_test.cpp ]
+ [ run hash_vector_test.cpp ]
+ [ run hash_list_test.cpp ]
+ [ run hash_deque_test.cpp ]
+ [ run hash_set_test.cpp ]
+ [ run hash_map_test.cpp ]
+ [ run hash_complex_test.cpp ]
+ [ run hash_optional_test.cpp ]
+ [ run hash_variant_test.cpp ]
+ [ run hash_type_index_test.cpp ]
+ [ run hash_system_error_test.cpp ]
+ [ run hash_std_array_test.cpp ]
+ [ run hash_std_tuple_test.cpp ]
+ [ run hash_std_smart_ptr_test.cpp ]
+ [ run link_test.cpp link_test_2.cpp ]
+ [ run link_ext_test.cpp link_no_ext_test.cpp ]
+ [ run extensions_hpp_test.cpp ]
+ [ compile-fail hash_no_ext_fail_test.cpp ]
+ [ compile-fail namespace_fail_test.cpp ]
+ [ run implicit_test.cpp ]
+ [ run hash_no_ext_macro_1.cpp ]
+ [ run hash_no_ext_macro_2.cpp ]
+ ;
+
+test-suite container_hash/hash_no_ext
+ :
+ [ run hash_number_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_number_test ]
+ [ run hash_pointer_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_pointer_test ]
+ [ run hash_function_pointer_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_function_pointer_test ]
+ [ run hash_float_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_float_test ]
+ [ run hash_long_double_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_long_double_test ]
+ [ run hash_string_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_string_test ]
+ [ run link_test.cpp link_test_2.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_link_test ]
+ ;
+
+# Tests to see if the floating point hash is using the binary hash.
+# Not run normally because on some platforms these should fail.
+test-suite container_hash/hash_no_generic_float
+ :
+ [ run hash_float_test.cpp
+ : : : <define>BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC
+ : hash_float_test_no_generic ]
+ [ run hash_long_double_test.cpp
+ : : : <define>BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC
+ : hash_long_double_test_no_generic ]
+ ;
+explicit container_hash/hash_no_generic_float ;
+
+build-project ../examples ;
diff --git a/src/boost/libs/container_hash/test/check_float_funcs.cpp b/src/boost/libs/container_hash/test/check_float_funcs.cpp
new file mode 100644
index 000000000..01d5168e9
--- /dev/null
+++ b/src/boost/libs/container_hash/test/check_float_funcs.cpp
@@ -0,0 +1,58 @@
+
+// Copyright 2012 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/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <cmath>
+
+namespace test
+{
+ template <class T1>
+ struct check_return_type
+ {
+ template <class T2>
+ static void equals(T2)
+ {
+ BOOST_STATIC_ASSERT((boost::is_same<T1, T2>::value));
+ }
+
+ template <class T2>
+ static void equals_ref(T2&)
+ {
+ BOOST_STATIC_ASSERT((boost::is_same<T1, T2>::value));
+ }
+
+ template <class T2>
+ static void convertible(T2)
+ {
+ BOOST_STATIC_ASSERT((boost::is_convertible<T2, T1>::value));
+ }
+ };
+}
+
+int main() {
+ float f = 0;
+ double d = 0;
+ long double l = 0;
+
+ test::check_return_type<float>::equals(std::ldexp(f, 0));
+ test::check_return_type<double>::equals(std::ldexp(d, 0));
+ test::check_return_type<long double>::equals(std::ldexp(l, 0));
+
+ int dummy = 0;
+
+ test::check_return_type<float>::equals(std::frexp(f, &dummy));
+ test::check_return_type<double>::equals(std::frexp(d, &dummy));
+ test::check_return_type<long double>::equals(std::frexp(l, &dummy));
+
+#if BOOST_HASH_USE_FPCLASSIFY
+
+ int (*fpc1)(float) = std::fpclassify;
+ int (*fpc2)(double) = std::fpclassify;
+ int (*fpc3)(long double) = std::fpclassify;
+
+#endif
+}
diff --git a/src/boost/libs/container_hash/test/compile_time.hpp b/src/boost/libs/container_hash/test/compile_time.hpp
new file mode 100644
index 000000000..d7631b869
--- /dev/null
+++ b/src/boost/libs/container_hash/test/compile_time.hpp
@@ -0,0 +1,20 @@
+
+// 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/config.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+template <class T>
+void compile_time_tests(T*)
+{
+ BOOST_STATIC_ASSERT((boost::is_same<T,
+ typename BOOST_HASH_TEST_NAMESPACE::hash<T>::argument_type
+ >::value));
+ BOOST_STATIC_ASSERT((boost::is_same<std::size_t,
+ typename BOOST_HASH_TEST_NAMESPACE::hash<T>::result_type
+ >::value));
+}
+
diff --git a/src/boost/libs/container_hash/test/config.hpp b/src/boost/libs/container_hash/test/config.hpp
new file mode 100644
index 000000000..28b28d400
--- /dev/null
+++ b/src/boost/libs/container_hash/test/config.hpp
@@ -0,0 +1,25 @@
+
+// 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)
+
+#if defined(BOOST_HASH_TEST_STD)
+# define BOOST_HASH_TEST_STD_INCLUDES
+# define BOOST_HASH_TEST_NAMESPACE std
+#else
+# define BOOST_HASH_TEST_NAMESPACE boost
+# if !defined(BOOST_HASH_NO_EXTENSIONS)
+# define BOOST_HASH_TEST_EXTENSIONS
+# endif
+#endif
+
+#if defined(_WIN32_WCE)
+// The standard windows mobile headers trigger this warning so I disable it
+// before doing anything else.
+#pragma warning(disable:4201) // nonstandard extension used :
+ // nameless struct/union
+
+#endif
+
+#define HASH_TEST_CAT(x, y) HASH_TEST_CAT2(x, y)
+#define HASH_TEST_CAT2(x, y) x##y
diff --git a/src/boost/libs/container_hash/test/extensions_hpp_test.cpp b/src/boost/libs/container_hash/test/extensions_hpp_test.cpp
new file mode 100644
index 000000000..a388c2364
--- /dev/null
+++ b/src/boost/libs/container_hash/test/extensions_hpp_test.cpp
@@ -0,0 +1,19 @@
+
+// Copyright 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)
+
+// Check that boost/container_hash/extensions.hpp works okay.
+//
+// It probably should be in boost/container_hash/detail, but since it isn't it
+// should work.
+
+#include "./config.hpp"
+
+#include <boost/container_hash/extensions.hpp>
+
+int main() {
+ int x[2] = { 2, 3 };
+ boost::hash<int[2]> hf;
+ hf(x);
+}
diff --git a/src/boost/libs/container_hash/test/hash_built_in_array_test.cpp b/src/boost/libs/container_hash/test/hash_built_in_array_test.cpp
new file mode 100644
index 000000000..ac782c374
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_built_in_array_test.cpp
@@ -0,0 +1,75 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+void array_int_test()
+{
+ const int length1 = 25;
+ int array1[25] = {
+ 26, -43, 32, 65, 45,
+ 12, 67, 32, 12, 23,
+ 0, 0, 0, 0, 0,
+ 8, -12, 23, 65, 45,
+ -1, 93, -54, 987, 3
+ };
+ BOOST_HASH_TEST_NAMESPACE::hash<int[25]> hasher1;
+
+ const int length2 = 1;
+ int array2[1] = {3};
+ BOOST_HASH_TEST_NAMESPACE::hash<int[1]> hasher2;
+
+ const int length3 = 2;
+ int array3[2] = {2, 3};
+ BOOST_HASH_TEST_NAMESPACE::hash<int[2]> hasher3;
+
+ BOOST_TEST(hasher1(array1)
+ == BOOST_HASH_TEST_NAMESPACE::hash_range(array1, array1 + length1));
+ BOOST_TEST(hasher2(array2)
+ == BOOST_HASH_TEST_NAMESPACE::hash_range(array2, array2 + length2));
+ BOOST_TEST(hasher3(array3)
+ == BOOST_HASH_TEST_NAMESPACE::hash_range(array3, array3 + length3));
+}
+
+void two_dimensional_array_test()
+{
+ int array[3][2] = {{-5, 6}, {7, -3}, {26, 1}};
+ BOOST_HASH_TEST_NAMESPACE::hash<int[3][2]> hasher;
+
+ std::size_t seed1 = 0;
+ for(int i = 0; i < 3; ++i)
+ {
+ std::size_t seed2 = 0;
+ for(int j = 0; j < 2; ++j)
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, array[i][j]);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed1, seed2);
+ }
+
+ BOOST_TEST(hasher(array) == seed1);
+ BOOST_TEST(hasher(array) == BOOST_HASH_TEST_NAMESPACE::hash_range(array, array + 3));
+}
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ array_int_test();
+ two_dimensional_array_test();
+#endif
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_complex_test.cpp b/src/boost/libs/container_hash/test/hash_complex_test.cpp
new file mode 100644
index 000000000..5ecacbfc7
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_complex_test.cpp
@@ -0,0 +1,110 @@
+
+// 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 "./config.hpp"
+
+#if !defined(BOOST_HASH_TEST_EXTENSIONS)
+
+int main() {}
+
+#else
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable:4244) // conversion from 'unsigned long' to
+ // 'unsigned short', possible loss of data
+#pragma warning(disable:4245) // conversion from 'int' to
+ // 'const unsigned short',
+ // signed/unsigned mismatch
+#pragma warning(disable:4305) // truncation from 'double' to
+ // 'const std::complex<float>::_Ty'
+#pragma warning(disable:4309) // truncation of constant value
+#pragma warning(disable:4512) // assignment operator could not be generated
+#if BOOST_MSVC < 1400
+#pragma warning(disable:4267) // conversion from 'size_t' to 'unsigned int',
+ // possible loss of data
+#endif
+#endif
+
+#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION)
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+
+#include <complex>
+#include <sstream>
+#include <boost/limits.hpp>
+
+template <class T>
+void generic_complex_tests(std::complex<T> v)
+{
+ BOOST_HASH_TEST_NAMESPACE::hash<std::complex<T> > complex_hasher;
+
+ BOOST_TEST(complex_hasher(v) == complex_hasher(v));
+
+ BOOST_HASH_TEST_NAMESPACE::hash<T> real_hasher;
+ T real = v.real();
+ T imag = v.imag();
+
+ BOOST_TEST(real_hasher(real) == complex_hasher(std::complex<T>(real)));
+
+ if(imag != 0 && real_hasher(real) == complex_hasher(v)) {
+ std::ostringstream os;
+ os<<"real_hasher("<<real<<") == complex_hasher("
+ <<v.real()<<" + "<<v.imag()<<"i) == "
+ <<real_hasher(real)<<" (This might not be a bug).";
+ BOOST_ERROR(os.str().c_str());
+ }
+}
+
+template <class Float>
+void complex_float_tests(Float*)
+{
+ typedef std::complex<Float> complex;
+ generic_complex_tests(complex(0,0));
+ generic_complex_tests(complex(0.5,0));
+ generic_complex_tests(complex(25,0));
+ generic_complex_tests(complex(25,0));
+ generic_complex_tests(complex(static_cast<Float>(-67.5324535),static_cast<Float>(56.23578678)));
+}
+
+template <class Integer>
+void complex_integral_tests(Integer*)
+{
+ typedef std::complex<Integer> complex;
+ generic_complex_tests(complex(0,0));
+ generic_complex_tests(complex(15342,124));
+ generic_complex_tests(complex(25,54356));
+ generic_complex_tests(complex(5325,2346));
+ generic_complex_tests(complex(Integer(-243897),Integer(-49923874)));
+ generic_complex_tests(complex(Integer(-543),Integer(763)));
+}
+
+int main()
+{
+ // I've comments out the short and unsigned short tests
+ // as they cause warnings and don't really test
+ // anything that the other tests already deal with.
+
+ complex_float_tests((float*) 0);
+ complex_float_tests((double*) 0);
+ complex_float_tests((long double*) 0);
+ //complex_integral_tests((short*) 0);
+ complex_integral_tests((int*) 0);
+ complex_integral_tests((long*) 0);
+ //complex_integral_tests((unsigned short*) 0);
+ complex_integral_tests((unsigned int*) 0);
+ complex_integral_tests((unsigned long*) 0);
+
+ return boost::report_errors();
+}
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
diff --git a/src/boost/libs/container_hash/test/hash_custom_test.cpp b/src/boost/libs/container_hash/test/hash_custom_test.cpp
new file mode 100644
index 000000000..a642f0ec3
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_custom_test.cpp
@@ -0,0 +1,100 @@
+
+// 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 "./config.hpp"
+#include <boost/config.hpp>
+#include <cstddef>
+
+namespace test
+{
+ struct custom
+ {
+ int value_;
+
+ std::size_t hash() const
+ {
+ return static_cast<std::size_t>(value_ * 10);
+ }
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+ friend std::size_t hash_value(custom const& x )
+ {
+ return x.hash();
+ }
+#endif
+
+ custom(int x) : value_(x) {}
+ };
+}
+
+#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+namespace boost
+{
+ std::size_t hash_value(test::custom x)
+ {
+ return x.hash();
+ }
+}
+#endif
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <vector>
+#include <string>
+#include <cctype>
+
+void custom_tests()
+{
+ BOOST_HASH_TEST_NAMESPACE::hash<test::custom> custom_hasher;
+ BOOST_TEST(custom_hasher(10) == 100u);
+ test::custom x(55);
+ BOOST_TEST(custom_hasher(x) == 550u);
+
+ {
+ using namespace BOOST_HASH_TEST_NAMESPACE;
+ BOOST_TEST(custom_hasher(x) == hash_value(x));
+ }
+
+ std::vector<test::custom> custom_vector;
+ custom_vector.push_back(5);
+ custom_vector.push_back(25);
+ custom_vector.push_back(35);
+
+ std::size_t seed = 0;
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(5));
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(25));
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(35));
+
+ std::size_t seed2 = 0;
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 50u);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 250u);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 350u);
+
+ BOOST_TEST(seed == BOOST_HASH_TEST_NAMESPACE::hash_range(
+ custom_vector.begin(), custom_vector.end()));
+ BOOST_TEST(seed == seed2);
+}
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ custom_tests();
+#endif
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_deque_test.cpp b/src/boost/libs/container_hash/test/hash_deque_test.cpp
new file mode 100644
index 000000000..3b900b80e
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_deque_test.cpp
@@ -0,0 +1,35 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <deque>
+
+using std::deque;
+#define CONTAINER_TYPE deque
+#include "./hash_sequence_test.hpp"
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ deque_tests::deque_hash_integer_tests();
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_enum_test.cpp b/src/boost/libs/container_hash/test/hash_enum_test.cpp
new file mode 100644
index 000000000..3d725b784
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_enum_test.cpp
@@ -0,0 +1,63 @@
+
+// Copyright 2012 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+#include "./compile_time.hpp"
+
+namespace test {
+ enum enum_override { enum_override1, enum_override2 };
+ std::size_t hash_value(enum_override) { return 896532; }
+
+ enum enum1 { enum1a };
+ enum enum2 { enum2a, enum2b };
+ enum enum3 { enum3a = 574, enum3b };
+ enum enum4 { enum4a = -12574, enum4b };
+}
+
+int main() {
+ compile_time_tests((test::enum1*) 0);
+ compile_time_tests((test::enum2*) 0);
+ compile_time_tests((test::enum3*) 0);
+ compile_time_tests((test::enum4*) 0);
+ compile_time_tests((test::enum_override*) 0);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<test::enum1> hash1;
+ BOOST_HASH_TEST_NAMESPACE::hash<test::enum2> hash2;
+ BOOST_HASH_TEST_NAMESPACE::hash<test::enum3> hash3;
+ BOOST_HASH_TEST_NAMESPACE::hash<test::enum4> hash4;
+
+ BOOST_TEST(hash1(test::enum1a) == hash1(test::enum1a));
+
+ BOOST_TEST(hash2(test::enum2a) == hash2(test::enum2a));
+ BOOST_TEST(hash2(test::enum2a) != hash2(test::enum2b));
+ BOOST_TEST(hash2(test::enum2b) == hash2(test::enum2b));
+
+ BOOST_TEST(hash3(test::enum3a) == hash3(test::enum3a));
+ BOOST_TEST(hash3(test::enum3a) != hash3(test::enum3b));
+ BOOST_TEST(hash3(test::enum3b) == hash3(test::enum3b));
+
+ BOOST_TEST(hash4(test::enum4a) == hash4(test::enum4a));
+ BOOST_TEST(hash4(test::enum4a) != hash4(test::enum4b));
+ BOOST_TEST(hash4(test::enum4b) == hash4(test::enum4b));
+
+ BOOST_HASH_TEST_NAMESPACE::hash<test::enum_override> hash_override;
+
+ BOOST_TEST(hash_override(test::enum_override1) ==
+ hash_override(test::enum_override1));
+ BOOST_TEST(hash_override(test::enum_override1) ==
+ hash_override(test::enum_override2));
+ BOOST_TEST(hash_override(test::enum_override1) ==
+ hash_override(test::enum_override1));
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_float_test.cpp b/src/boost/libs/container_hash/test/hash_float_test.cpp
new file mode 100644
index 000000000..2490f8d6d
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_float_test.cpp
@@ -0,0 +1,18 @@
+
+// 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 "hash_float_test.hpp"
+
+int main()
+{
+ std::cerr<<"Compiler: "<<BOOST_COMPILER<<"\n";
+ std::cerr<<"Platform: "<<BOOST_PLATFORM<<"\n";
+ std::cerr<<"Library: "<<BOOST_STDLIB<<"\n\n";
+
+ float_tests("float", (float*) 0);
+ float_tests("double", (double*) 0);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_float_test.hpp b/src/boost/libs/container_hash/test/hash_float_test.hpp
new file mode 100644
index 000000000..ab79a12a0
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_float_test.hpp
@@ -0,0 +1,309 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#include <cmath>
+#include <boost/container_hash/detail/limits.hpp>
+#include <boost/container_hash/detail/float_functions.hpp>
+#include <boost/config/workaround.hpp>
+
+#include <iostream>
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4127) // conditional expression is constant
+#pragma warning(disable:4723) // conditional expression is constant
+#if BOOST_MSVC < 1400
+#pragma warning(disable:4267) // conversion from 'size_t' to 'unsigned int',
+ // possible loss of data
+#endif
+#endif
+
+#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION)
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+
+char const* float_type(float*) { return "float"; }
+char const* float_type(double*) { return "double"; }
+char const* float_type(long double*) { return "long double"; }
+
+template <class T>
+void float_tests(char const* name, T* = 0)
+{
+ std::cerr
+ << "\n"
+ << "Testing " BOOST_STRINGIZE(BOOST_HASH_TEST_NAMESPACE) "::hash<"
+ << name
+ << ">\n"
+ << "\n"
+ << "boost::hash_detail::limits<T>::digits = "
+ << boost::hash_detail::limits<T>::digits<< "\n"
+ << "boost::hash_detail::limits<int>::digits = "
+ << boost::hash_detail::limits<int>::digits<< "\n"
+ << "boost::hash_detail::limits<std::size_t>::digits = "
+ << boost::hash_detail::limits<std::size_t>::digits
+ << "\n"
+ << "\n"
+ << "boost::hash_detail::call_ldexp<T>::float_type = "
+ << float_type(static_cast<BOOST_DEDUCED_TYPENAME
+ boost::hash_detail::call_ldexp<T>::float_type*>(0))
+ << "\n"
+ << "boost::hash_detail::call_frexp<T>::float_type = "
+ << float_type(static_cast<BOOST_DEDUCED_TYPENAME
+ boost::hash_detail::call_frexp<T>::float_type*>(0))
+ << "\n"
+ << "boost::hash_detail::select_hash_type<T>::type = "
+ << float_type(static_cast<BOOST_DEDUCED_TYPENAME
+ boost::hash_detail::select_hash_type<T>::type*>(0))
+ << "\n"
+ << "\n"
+ ;
+
+ BOOST_HASH_TEST_NAMESPACE::hash<T> x1;
+
+ T zero = 0;
+ T minus_zero = (T) -1 * zero;
+
+ BOOST_TEST(zero == minus_zero);
+ BOOST_TEST(x1(zero) == x1(minus_zero));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(x1(zero) == BOOST_HASH_TEST_NAMESPACE::hash_value(zero));
+ BOOST_TEST(x1(minus_zero) == BOOST_HASH_TEST_NAMESPACE::hash_value(minus_zero));
+#endif
+
+ BOOST_TEST(x1(zero) != x1(0.5));
+ BOOST_TEST(x1(minus_zero) != x1(0.5));
+ BOOST_TEST(x1(0.5) != x1(-0.5));
+ BOOST_TEST(x1(1) != x1(-1));
+
+ using namespace std;
+
+// Doing anything with infinity causes borland to crash.
+#if defined(__BORLANDC__)
+ std::cerr
+ << "Not running infinity checks on Borland, as it causes it to crash."
+ "\n";
+#else
+ if(boost::hash_detail::limits<T>::has_infinity) {
+ T infinity = -log(zero);
+ T infinity2 = (T) 1. / zero;
+ T infinity3 = (T) -1. / minus_zero;
+ T infinity4 = boost::hash_detail::limits<T>::infinity();
+
+ T minus_infinity = log(zero);
+ T minus_infinity2 = (T) -1. / zero;
+ T minus_infinity3 = (T) 1. / minus_zero;
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(x1(infinity) == BOOST_HASH_TEST_NAMESPACE::hash_value(infinity));
+ BOOST_TEST(x1(minus_infinity)
+ == BOOST_HASH_TEST_NAMESPACE::hash_value(minus_infinity));
+#endif
+
+ if(infinity == infinity2)
+ BOOST_TEST(x1(infinity) == x1(infinity2));
+ if(infinity == infinity3)
+ BOOST_TEST(x1(infinity) == x1(infinity3));
+ if(infinity == infinity4)
+ BOOST_TEST(x1(infinity) == x1(infinity4));
+
+ if(minus_infinity == minus_infinity2)
+ BOOST_TEST(x1(minus_infinity) == x1(minus_infinity2));
+ if(minus_infinity == minus_infinity3)
+ BOOST_TEST(x1(minus_infinity) == x1(minus_infinity3));
+
+ BOOST_TEST(infinity != minus_infinity);
+
+ if(x1(infinity) == x1(minus_infinity)) {
+ std::cerr<<"x1(infinity) == x1(-infinity) == "<<x1(infinity)<<"\n";
+ }
+
+ // This should really be 'has_denorm == denorm_present' but some
+ // compilers don't have 'denorm_present'. See also a later use.
+ if(boost::hash_detail::limits<T>::has_denorm) {
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(infinity))
+ {
+ std::cerr
+ << "x1(denorm_min) == x1(infinity) == "
+ << x1(infinity)
+ << "\n";
+ }
+
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) ==
+ x1(minus_infinity))
+ {
+ std::cerr
+ << "x1(denorm_min) == x1(-infinity) == "
+ << x1(minus_infinity)
+ << "\n";
+ }
+ }
+
+ if(boost::hash_detail::limits<T>::has_quiet_NaN) {
+ if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(infinity))
+ {
+ std::cerr
+ << "x1(quiet_NaN) == x1(infinity) == "
+ << x1(infinity)
+ << "\n";
+ }
+
+ if(x1(boost::hash_detail::limits<T>::quiet_NaN()) ==
+ x1(minus_infinity))
+ {
+ std::cerr
+ << "x1(quiet_NaN) == x1(-infinity) == "
+ << x1(minus_infinity)
+ << "\n";
+ }
+ }
+ }
+#endif
+
+ T max = (boost::hash_detail::limits<T>::max)();
+ T half_max = max / 2;
+ T quarter_max = max / 4;
+ T three_quarter_max = max - quarter_max;
+
+ // Check the limits::max is in range.
+ BOOST_TEST(max != half_max);
+ BOOST_TEST(max != quarter_max);
+ BOOST_TEST(max != three_quarter_max);
+ BOOST_TEST(half_max != quarter_max);
+ BOOST_TEST(half_max != three_quarter_max);
+ BOOST_TEST(quarter_max != three_quarter_max);
+
+ BOOST_TEST(max != -max);
+ BOOST_TEST(half_max != -half_max);
+ BOOST_TEST(quarter_max != -quarter_max);
+ BOOST_TEST(three_quarter_max != -three_quarter_max);
+
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(x1(max) == BOOST_HASH_TEST_NAMESPACE::hash_value(max));
+ BOOST_TEST(x1(half_max) == BOOST_HASH_TEST_NAMESPACE::hash_value(half_max));
+ BOOST_TEST(x1(quarter_max) == BOOST_HASH_TEST_NAMESPACE::hash_value(quarter_max));
+ BOOST_TEST(x1(three_quarter_max) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_value(three_quarter_max));
+#endif
+
+ // The '!=' tests could legitimately fail, but with my hash it indicates a
+ // bug.
+ BOOST_TEST(x1(max) == x1(max));
+ BOOST_TEST(x1(max) != x1(quarter_max));
+ BOOST_TEST(x1(max) != x1(half_max));
+ BOOST_TEST(x1(max) != x1(three_quarter_max));
+ BOOST_TEST(x1(quarter_max) == x1(quarter_max));
+ BOOST_TEST(x1(quarter_max) != x1(half_max));
+ BOOST_TEST(x1(quarter_max) != x1(three_quarter_max));
+ BOOST_TEST(x1(half_max) == x1(half_max));
+ BOOST_TEST(x1(half_max) != x1(three_quarter_max));
+ BOOST_TEST(x1(three_quarter_max) == x1(three_quarter_max));
+
+ BOOST_TEST(x1(max) != x1(-max));
+ BOOST_TEST(x1(half_max) != x1(-half_max));
+ BOOST_TEST(x1(quarter_max) != x1(-quarter_max));
+ BOOST_TEST(x1(three_quarter_max) != x1(-three_quarter_max));
+
+
+// Intel with gcc stdlib sometimes segfaults on calls to asin and acos.
+#if !((defined(__INTEL_COMPILER) || defined(__ICL) || \
+ defined(__ICC) || defined(__ECC)) && \
+ (defined(__GLIBCPP__) || defined(__GLIBCXX__)))
+ T v1 = asin((T) 1);
+ T v2 = acos((T) 0);
+ if(v1 == v2)
+ BOOST_TEST(x1(v1) == x1(v2));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(x1(v1) == BOOST_HASH_TEST_NAMESPACE::hash_value(v1));
+ BOOST_TEST(x1(v2) == BOOST_HASH_TEST_NAMESPACE::hash_value(v2));
+#endif
+
+#endif
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(x1(boost::hash_detail::limits<T>::epsilon()) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_value(
+ boost::hash_detail::limits<T>::epsilon()));
+#endif
+
+ BOOST_TEST(boost::hash_detail::limits<T>::epsilon() != (T) 0);
+ if(x1(boost::hash_detail::limits<T>::epsilon()) == x1((T) 0))
+ std::cerr<<"x1(epsilon) == x1(0) == "<<x1((T) 0)<<"\n";
+
+ BOOST_TEST(-boost::hash_detail::limits<T>::epsilon() != (T) 0);
+ if(x1(-boost::hash_detail::limits<T>::epsilon()) == x1((T) 0))
+ std::cerr<<"x1(-epsilon) == x1(0) == "<<x1((T) 0)<<"\n";
+
+ BOOST_TEST((T) 1 + boost::hash_detail::limits<T>::epsilon() != (T) 1);
+ if(x1((T) 1 + boost::hash_detail::limits<T>::epsilon()) == x1((T) 1))
+ std::cerr<<"x1(1 + epsilon) == x1(1) == "<<x1((T) 1)<<"\n";
+
+ BOOST_TEST((T) 1 - boost::hash_detail::limits<T>::epsilon() != (T) 1);
+ if(x1((T) 1 - boost::hash_detail::limits<T>::epsilon()) == x1((T) 1))
+ std::cerr<<"x1(1 - epsilon) == x1(1) == "<<x1((T) 1)<<"\n";
+
+ BOOST_TEST((T) -1 + boost::hash_detail::limits<T>::epsilon() != (T) -1);
+ if(x1((T) -1 + boost::hash_detail::limits<T>::epsilon()) == x1((T) -1))
+ std::cerr<<"x1(-1 + epsilon) == x1(-1) == "<<x1((T) -1)<<"\n";
+
+ BOOST_TEST((T) -1 - boost::hash_detail::limits<T>::epsilon() != (T) -1);
+ if(x1((T) -1 - boost::hash_detail::limits<T>::epsilon()) == x1((T) -1))
+ std::cerr<<"x1(-1 - epsilon) == x1(-1) == "<<x1((T) -1)<<"\n";
+
+ // As before.
+ if(boost::hash_detail::limits<T>::has_denorm) {
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) == x1(zero)) {
+ std::cerr<<"x1(denorm_min) == x1(zero) == "<<x1(zero)<<"\n";
+ }
+#if !BOOST_WORKAROUND(__DECCXX_VER,<70190006) && defined(BOOST_HASH_TEST_EXTENSIONS)
+ // The Tru64/CXX standard library prior to 7.1 contains a bug in the
+ // specialization of boost::hash_detail::limits::denorm_min() for long
+ // doubles which causes this test to fail.
+ if(x1(boost::hash_detail::limits<T>::denorm_min()) !=
+ BOOST_HASH_TEST_NAMESPACE::hash_value(
+ boost::hash_detail::limits<T>::denorm_min()))
+ {
+ std::cerr
+ << "x1(boost::hash_detail::limits<T>::denorm_min()) = "
+ << x1(boost::hash_detail::limits<T>::denorm_min())
+ << "\nhash_value(boost::hash_detail::limits<T>::denorm_min())"
+ " = "
+ << BOOST_HASH_TEST_NAMESPACE::hash_value(
+ boost::hash_detail::limits<T>::denorm_min())
+ << "\nx1(0) = "
+ << x1(0)
+ << "\n";
+ }
+#endif
+ }
+
+// NaN also causes borland to crash.
+#if !defined(__BORLANDC__) && defined(BOOST_HASH_TEST_EXTENSIONS)
+ if(boost::hash_detail::limits<T>::has_quiet_NaN) {
+ if(x1(boost::hash_detail::limits<T>::quiet_NaN()) == x1(1.0)) {
+ std::cerr<<"x1(quiet_NaN) == x1(1.0) == "<<x1(1.0)<<"\n";
+ }
+ BOOST_TEST(x1(boost::hash_detail::limits<T>::quiet_NaN()) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_value(
+ boost::hash_detail::limits<T>::quiet_NaN()));
+ }
+#endif
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
diff --git a/src/boost/libs/container_hash/test/hash_friend_test.cpp b/src/boost/libs/container_hash/test/hash_friend_test.cpp
new file mode 100644
index 000000000..60d172ebb
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_friend_test.cpp
@@ -0,0 +1,103 @@
+
+// Copyright 2006-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 "./config.hpp"
+
+#include <boost/config.hpp>
+#include <cstddef>
+
+namespace test
+{
+ template <class T>
+ struct custom
+ {
+ int value_;
+
+ std::size_t hash() const
+ {
+ return static_cast<std::size_t>(value_ * 10);
+ }
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+ friend std::size_t hash_value(custom const& x)
+ {
+ return x.hash();
+ }
+#endif
+
+ custom(int x) : value_(x) {}
+ };
+}
+
+#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+namespace boost
+{
+ template <class T>
+ std::size_t hash_value(test::custom<T> x)
+ {
+ return x.hash();
+ }
+}
+#endif
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <vector>
+#include <string>
+#include <cctype>
+
+void custom_tests()
+{
+ BOOST_HASH_TEST_NAMESPACE::hash<test::custom<int> > custom_hasher;
+ BOOST_TEST(custom_hasher(10) == 100u);
+ test::custom<int> x(55);
+ BOOST_TEST(custom_hasher(x) == 550u);
+
+ {
+ using namespace BOOST_HASH_TEST_NAMESPACE;
+ BOOST_TEST(custom_hasher(x) == hash_value(x));
+ }
+
+ std::vector<test::custom<int> > custom_vector;
+ custom_vector.push_back(5);
+ custom_vector.push_back(25);
+ custom_vector.push_back(35);
+
+ std::size_t seed = 0;
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom<int>(5));
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom<int>(25));
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom<int>(35));
+
+ std::size_t seed2 = 0;
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 50u);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 250u);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 350u);
+
+ BOOST_TEST(seed == BOOST_HASH_TEST_NAMESPACE::hash_range(
+ custom_vector.begin(), custom_vector.end()));
+ BOOST_TEST(seed == seed2);
+}
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ custom_tests();
+#endif
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_function_pointer_test.cpp b/src/boost/libs/container_hash/test/hash_function_pointer_test.cpp
new file mode 100644
index 000000000..abc8c4a84
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_function_pointer_test.cpp
@@ -0,0 +1,57 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+#include "./compile_time.hpp"
+
+void void_func1() { static int x = 1; ++x; }
+void void_func2() { static int x = 2; --x; }
+int int_func1(int) { return 0; }
+int int_func2(int) { return 1; }
+
+void function_pointer_tests()
+{
+ compile_time_tests((void(**)()) 0);
+ compile_time_tests((int(**)(int)) 0);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<void(*)()> hasher_void;
+ BOOST_HASH_TEST_NAMESPACE::hash<int(*)(int)> hasher_int;
+
+ BOOST_TEST(&void_func1 != &void_func2);
+ BOOST_TEST(&int_func1 != &int_func2);
+
+ BOOST_TEST(hasher_void(0) == hasher_void(0));
+ BOOST_TEST(hasher_void(&void_func1) == hasher_void(&void_func1));
+ BOOST_TEST(hasher_void(&void_func1) != hasher_void(&void_func2));
+ BOOST_TEST(hasher_void(&void_func1) != hasher_void(0));
+ BOOST_TEST(hasher_int(0) == hasher_int(0));
+ BOOST_TEST(hasher_int(&int_func1) == hasher_int(&int_func1));
+ BOOST_TEST(hasher_int(&int_func1) != hasher_int(&int_func2));
+ BOOST_TEST(hasher_int(&int_func1) != hasher_int(0));
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(hasher_void(&void_func1)
+ == BOOST_HASH_TEST_NAMESPACE::hash_value(&void_func1));
+ BOOST_TEST(hasher_int(&int_func1)
+ == BOOST_HASH_TEST_NAMESPACE::hash_value(&int_func1));
+
+ // This isn't specified in Peter's proposal:
+ BOOST_TEST(hasher_void(0) == 0);
+#endif
+}
+
+int main()
+{
+ function_pointer_tests();
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_fwd_test.hpp b/src/boost/libs/container_hash/test/hash_fwd_test.hpp
new file mode 100644
index 000000000..76fce57cb
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_fwd_test.hpp
@@ -0,0 +1,104 @@
+
+// Copyright 2006-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 "./config.hpp"
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_HASH_TEST_STD_INCLUDES)
+#include <boost/container_hash/hash_fwd.hpp>
+
+#include <boost/config.hpp>
+#include <cstddef>
+#include <vector>
+
+namespace test {
+
+ template <class T>
+ struct test_type1
+ {
+ T value;
+ test_type1(T const& x) : value(x) {}
+ };
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+ template <class T>
+ std::size_t hash_value(test_type1<T> const& x)
+ {
+ BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;
+ return hasher(x.value);
+ }
+#endif
+
+ template <class T>
+ struct test_type2
+ {
+ T value1, value2;
+ test_type2(T const& x, T const& y) : value1(x), value2(y) {}
+ };
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+ template <class T>
+ std::size_t hash_value(test_type2<T> const& x)
+ {
+ std::size_t seed = 0;
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value1);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value2);
+ return seed;
+ }
+#endif
+
+ template <class T>
+ struct test_type3
+ {
+ std::vector<T> values;
+ test_type3(typename std::vector<T>::iterator x,
+ typename std::vector<T>::iterator y) : values(x, y) {}
+ };
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+ template <class T>
+ std::size_t hash_value(test_type3<T> const& x)
+ {
+ std::size_t seed =
+ BOOST_HASH_TEST_NAMESPACE::hash_range(x.values.begin(), x.values.end());
+ BOOST_HASH_TEST_NAMESPACE::hash_range(seed, x.values.begin(), x.values.end());
+ return seed;
+ }
+#endif
+
+}
+
+#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+
+namespace boost
+{
+ template <class T>
+ std::size_t hash_value(test::test_type1<T> const& x)
+ {
+ BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;
+ return hasher(x.value);
+ }
+
+ template <class T>
+ std::size_t hash_value(test::test_type2<T> const& x)
+ {
+ std::size_t seed = 0;
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value1);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value2);
+ return seed;
+ }
+
+ template <class T>
+ std::size_t hash_value(test::test_type3<T> const& x)
+ {
+ std::size_t seed =
+ BOOST_HASH_TEST_NAMESPACE::hash_range(x.values.begin(), x.values.end());
+ BOOST_HASH_TEST_NAMESPACE::hash_range(seed, x.values.begin(), x.values.end());
+ return seed;
+ }
+}
+
+#endif
+
+#endif
diff --git a/src/boost/libs/container_hash/test/hash_fwd_test_1.cpp b/src/boost/libs/container_hash/test/hash_fwd_test_1.cpp
new file mode 100644
index 000000000..70ab3c7dc
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_fwd_test_1.cpp
@@ -0,0 +1,96 @@
+
+// Copyright 2006-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)
+
+// This checks that template code implemented using hash_fwd will work.
+
+#include "./config.hpp"
+
+#include "./hash_fwd_test.hpp"
+
+#include <boost/core/lightweight_test.hpp>
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_HASH_TEST_STD_INCLUDES)
+
+#include <boost/container_hash/hash.hpp>
+#include <string>
+
+void fwd_test1()
+{
+ test::test_type1<int> x(5);
+ test::test_type1<std::string> y("Test");
+
+ BOOST_HASH_TEST_NAMESPACE::hash<int> hasher_int;
+ BOOST_HASH_TEST_NAMESPACE::hash<std::string> hasher_string;
+ BOOST_HASH_TEST_NAMESPACE::hash<test::test_type1<int> > hasher_test_int;
+ BOOST_HASH_TEST_NAMESPACE::hash<test::test_type1<std::string> > hasher_test_string;
+
+ BOOST_TEST(hasher_int(5) == hasher_test_int(x));
+ BOOST_TEST(hasher_string("Test") == hasher_test_string(y));
+}
+
+void fwd_test2()
+{
+ test::test_type2<int> x(5, 10);
+ test::test_type2<std::string> y("Test1", "Test2");
+
+ std::size_t seed1 = 0;
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed1, 5);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed1, 10);
+
+ std::size_t seed2 = 0;
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, std::string("Test1"));
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, std::string("Test2"));
+
+ BOOST_HASH_TEST_NAMESPACE::hash<test::test_type2<int> > hasher_test_int;
+ BOOST_HASH_TEST_NAMESPACE::hash<test::test_type2<std::string> > hasher_test_string;
+
+ BOOST_TEST(seed1 == hasher_test_int(x));
+ BOOST_TEST(seed2 == hasher_test_string(y));
+}
+
+void fwd_test3()
+{
+ std::vector<int> values1;
+ values1.push_back(10);
+ values1.push_back(15);
+ values1.push_back(20);
+ values1.push_back(3);
+
+ std::vector<std::string> values2;
+ values2.push_back("Chico");
+ values2.push_back("Groucho");
+ values2.push_back("Harpo");
+ values2.push_back("Gummo");
+ values2.push_back("Zeppo");
+
+ test::test_type3<int> x(values1.begin(), values1.end());
+ test::test_type3<std::string> y(values2.begin(), values2.end());
+
+ std::size_t seed1 =
+ BOOST_HASH_TEST_NAMESPACE::hash_range(values1.begin(), values1.end());
+ BOOST_HASH_TEST_NAMESPACE::hash_range(seed1, values1.begin(), values1.end());
+
+ std::size_t seed2 =
+ BOOST_HASH_TEST_NAMESPACE::hash_range(values2.begin(), values2.end());
+ BOOST_HASH_TEST_NAMESPACE::hash_range(seed2, values2.begin(), values2.end());
+
+ BOOST_HASH_TEST_NAMESPACE::hash<test::test_type3<int> > hasher_test_int;
+ BOOST_HASH_TEST_NAMESPACE::hash<test::test_type3<std::string> > hasher_test_string;
+
+ BOOST_TEST(seed1 == hasher_test_int(x));
+ BOOST_TEST(seed2 == hasher_test_string(y));
+}
+
+#endif
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ fwd_test1();
+ fwd_test2();
+ fwd_test3();
+#endif
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_fwd_test_2.cpp b/src/boost/libs/container_hash/test/hash_fwd_test_2.cpp
new file mode 100644
index 000000000..44f07c459
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_fwd_test_2.cpp
@@ -0,0 +1,47 @@
+
+// Copyright 2006-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)
+
+// This test just makes sure a header which uses hash_fwd can compile without
+// the main hash headers.
+
+#include "./config.hpp"
+
+#if !defined(BOOST_HASH_TEST_EXTENSIONS) || defined(BOOST_HASH_TEST_STD_INCLUDES)
+
+int main() {}
+
+#else
+
+#include "./hash_fwd_test.hpp"
+#include <boost/core/lightweight_test.hpp>
+
+template <class T> void unused(T const&) {}
+
+void fwd_test()
+{
+ test::test_type1<int> x1(3);
+ test::test_type1<std::string> y1("Black");
+ test::test_type2<int> x2(25, 16);
+ test::test_type2<std::string> y2("White", "Green");
+
+ std::vector<int> empty;
+ std::vector<std::string> empty2;
+
+ test::test_type3<int> x3(empty.begin(), empty.end());
+ test::test_type3<std::string> y3(empty2.begin(), empty2.end());
+
+ // Prevent gcc warnings:
+ unused(x1); unused(x2); unused(x3);
+ unused(y1); unused(y2); unused(y3);
+}
+
+int main()
+{
+ fwd_test();
+
+ return boost::report_errors();
+}
+
+#endif // defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_HASH_TEST_STD_INCLUDES)
diff --git a/src/boost/libs/container_hash/test/hash_global_namespace_test.cpp b/src/boost/libs/container_hash/test/hash_global_namespace_test.cpp
new file mode 100644
index 000000000..6062ba966
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_global_namespace_test.cpp
@@ -0,0 +1,103 @@
+
+// Copyright 2006-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)
+
+// This test demonstrates an ADL bug in Borland 5.5 where ADL isn't performed
+// in the global namespace.
+
+#include "./config.hpp"
+
+#include <boost/config.hpp>
+#include <cstddef>
+
+struct custom
+{
+ int value_;
+
+ std::size_t hash() const
+ {
+ return static_cast<std::size_t>(value_ * 10);
+ }
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+ friend std::size_t hash_value(custom const& x )
+ {
+ return x.hash();
+ }
+#endif
+
+ custom(int x) : value_(x) {}
+};
+
+#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+namespace boost
+{
+ std::size_t hash_value(custom x)
+ {
+ return x.hash();
+ }
+}
+#endif
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <vector>
+#include <string>
+#include <cctype>
+
+void custom_tests()
+{
+ BOOST_HASH_TEST_NAMESPACE::hash<custom> custom_hasher;
+ BOOST_TEST(custom_hasher(10) == 100u);
+ custom x(55);
+ BOOST_TEST(custom_hasher(x) == 550u);
+
+ {
+ using namespace BOOST_HASH_TEST_NAMESPACE;
+ BOOST_TEST(custom_hasher(x) == hash_value(x));
+ }
+
+ std::vector<custom> custom_vector;
+ custom_vector.push_back(5);
+ custom_vector.push_back(25);
+ custom_vector.push_back(35);
+
+ std::size_t seed = 0;
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, custom(5));
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, custom(25));
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, custom(35));
+
+ std::size_t seed2 = 0;
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 50u);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 250u);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 350u);
+
+ BOOST_TEST(seed == BOOST_HASH_TEST_NAMESPACE::hash_range(
+ custom_vector.begin(), custom_vector.end()));
+ BOOST_TEST(seed == seed2);
+}
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ custom_tests();
+#endif
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/container_hash/test/hash_info.cpp b/src/boost/libs/container_hash/test/hash_info.cpp
new file mode 100644
index 000000000..b68374649
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_info.cpp
@@ -0,0 +1,102 @@
+
+// Copyright 2017 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)
+
+// Not a test, just a small program to write out configuration info
+
+#include <boost/container_hash/hash.hpp>
+#include <iostream>
+#include <algorithm>
+
+#if defined(BOOST_MSVC)
+
+struct msvc_version {
+ unsigned version;
+ char const* description;
+
+ friend bool operator<(msvc_version const& v1, msvc_version const& v2) {
+ return v1.version < v2.version;
+ }
+};
+
+void write_compiler_info() {
+ // From:
+ // https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B
+ // https://blogs.msdn.microsoft.com/vcblog/2017/11/15/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2017/
+ msvc_version versions[] = {
+ {0, "Old Visual C++"},
+ {1000, "Visual C++ 4.x, VS4.0?"},
+ {1100, "Visual C++ 5.0, VS97"},
+ {1200, "Visual C++ 6.0, VS6.0"},
+ {1300, "Visual C++ 7.0, VS.NET 2002"},
+ {1310, "Visual C++ 7.1, VS.NET 2003"},
+ {1400, "Visual C++ 8.0, VS2005"},
+ {1500, "Visual C++ 9.0, VS2008"},
+ {1600, "Visual C++ 10.0, VS2010"},
+ {1700, "Visual C++ 11.0, VS2012"},
+ {1800, "Visual C++ 12.0, VS2013"},
+ {1900, "Visual C++ 14.00, VS2015"},
+ {1910, "Visual C++ 14.10, VS2017 15.1/2"},
+ {1911, "Visual C++ 14.11, VS2017 15.3/4"},
+ {1912, "Visual C++ 14.12, VS2017 15.5"},
+ {1913, "Visual C++ 14.13, VS2017 15.6"}
+ };
+
+ msvc_version msvc = { BOOST_MSVC, "" };
+ msvc_version* v = std::upper_bound(versions,
+ versions + sizeof(versions) / sizeof(*versions),
+ msvc) - 1;
+ unsigned difference = msvc.version - v->version;
+
+ std::cout << v->description << std::endl;
+ if (difference) {
+ std::cout << "+" << difference << std::endl;
+ }
+}
+
+#else
+
+void write_compiler_info() {
+}
+
+#endif
+
+int main() {
+ write_compiler_info();
+
+#if defined(__cplusplus)
+ std::cout << "__cplusplus: "
+ << __cplusplus
+ << std::endl;
+#endif
+
+ std::cout << "BOOST_HASH_CXX17: "
+ << BOOST_HASH_CXX17
+ << std::endl;
+
+ std::cout << "BOOST_HASH_HAS_STRING_VIEW: "
+ << BOOST_HASH_HAS_STRING_VIEW
+ << std::endl;
+
+ std::cout << "BOOST_HASH_HAS_OPTIONAL: "
+ << BOOST_HASH_HAS_OPTIONAL
+ << std::endl;
+
+ std::cout << "BOOST_HASH_HAS_VARIANT: "
+ << BOOST_HASH_HAS_VARIANT
+ << std::endl;
+
+#if defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
+ std::cout << "No <typeindex>" << std::endl;
+#else
+ std::cout << "<typeindex>" << std::endl;
+#endif
+
+#if defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR)
+ std::cout << "No <system_error>" << std::endl;
+#else
+ std::cout << "<system_error>" << std::endl;
+#endif
+
+}
diff --git a/src/boost/libs/container_hash/test/hash_list_test.cpp b/src/boost/libs/container_hash/test/hash_list_test.cpp
new file mode 100644
index 000000000..9b2c25f11
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_list_test.cpp
@@ -0,0 +1,35 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <list>
+
+using std::list;
+#define CONTAINER_TYPE list
+#include "./hash_sequence_test.hpp"
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ list_tests::list_hash_integer_tests();
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_long_double_test.cpp b/src/boost/libs/container_hash/test/hash_long_double_test.cpp
new file mode 100644
index 000000000..860a67981
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_long_double_test.cpp
@@ -0,0 +1,17 @@
+
+// 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 "hash_float_test.hpp"
+
+int main()
+{
+ std::cerr<<"Compiler: "<<BOOST_COMPILER<<"\n";
+ std::cerr<<"Platform: "<<BOOST_PLATFORM<<"\n";
+ std::cerr<<"Library: "<<BOOST_STDLIB<<"\n\n";
+
+ float_tests("long double", (long double*) 0);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_map_test.cpp b/src/boost/libs/container_hash/test/hash_map_test.cpp
new file mode 100644
index 000000000..b70a9be72
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_map_test.cpp
@@ -0,0 +1,40 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#include <map>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+using std::map;
+#define CONTAINER_TYPE map
+#include "./hash_map_test.hpp"
+
+using std::multimap;
+#define CONTAINER_TYPE multimap
+#include "./hash_map_test.hpp"
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ map_tests::map_hash_integer_tests();
+ multimap_tests::multimap_hash_integer_tests();
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_map_test.hpp b/src/boost/libs/container_hash/test/hash_map_test.hpp
new file mode 100644
index 000000000..95ca62cf6
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_map_test.hpp
@@ -0,0 +1,74 @@
+
+// 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)
+
+#if !defined(CONTAINER_TYPE)
+#error "CONTAINER_TYPE not defined"
+#else
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4244) // conversion from 'int' to 'float'
+#pragma warning(disable:4245) // signed/unsigned mismatch
+#endif
+
+namespace HASH_TEST_CAT(CONTAINER_TYPE, _tests)
+{
+ template <class T>
+ void integer_tests(T* = 0)
+ {
+ const int number_of_containers = 10;
+ T containers[number_of_containers];
+ typedef BOOST_DEDUCED_TYPENAME T::value_type pair;
+ typedef BOOST_DEDUCED_TYPENAME T::key_type key;
+ typedef BOOST_DEDUCED_TYPENAME T::mapped_type value;
+
+ for(int i = 0; i < 5; ++i) {
+ for(int j = 0; j < i; ++j)
+ containers[i].insert(pair(key(0), value(0)));
+ }
+
+ containers[6].insert(pair(key(1),value(0)));
+ containers[7].insert(pair(key(1),value(0)));
+ containers[7].insert(pair(key(1),value(0)));
+ containers[8].insert(pair(key(-1),value(1)));
+ containers[9].insert(pair(key(-1),value(3)));
+ containers[9].insert(pair(key(-1),value(3)));
+
+ BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;
+
+ for(int i2 = 0; i2 < number_of_containers; ++i2) {
+ BOOST_TEST(hasher(containers[i2]) == hasher(containers[i2]));
+
+ BOOST_TEST(hasher(containers[i2]) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_value(containers[i2]));
+
+ BOOST_TEST(hasher(containers[i2])
+ == BOOST_HASH_TEST_NAMESPACE::hash_range(
+ containers[i2].begin(), containers[i2].end()));
+
+ for(int j2 = i2 + 1; j2 < number_of_containers; ++j2) {
+ BOOST_TEST(
+ (containers[i2] == containers[j2]) ==
+ (hasher(containers[i2]) == hasher(containers[j2]))
+ );
+ }
+ }
+ }
+
+ void HASH_TEST_CAT(CONTAINER_TYPE, _hash_integer_tests())
+ {
+ integer_tests((CONTAINER_TYPE<char, unsigned char>*) 0);
+ integer_tests((CONTAINER_TYPE<int, float>*) 0);
+ integer_tests((CONTAINER_TYPE<unsigned long, unsigned long>*) 0);
+ integer_tests((CONTAINER_TYPE<double, short>*) 0);
+ }
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#undef CONTAINER_TYPE
+#endif
diff --git a/src/boost/libs/container_hash/test/hash_no_ext_fail_test.cpp b/src/boost/libs/container_hash/test/hash_no_ext_fail_test.cpp
new file mode 100644
index 000000000..ee35950b2
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_no_ext_fail_test.cpp
@@ -0,0 +1,28 @@
+
+// Copyright 2006-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 "./config.hpp"
+
+// Simple test to make sure BOOST_HASH_NO_EXTENSIONS does disable extensions
+// (or at least one of them).
+#if !defined(BOOST_HASH_NO_EXTENSIONS)
+# define BOOST_HASH_NO_EXTENSIONS
+#endif
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+
+template <class T> void ignore(T const&) {}
+
+int main()
+{
+ BOOST_HASH_TEST_NAMESPACE::hash< int[10] > hasher;
+ ignore(hasher);
+
+ return 0;
+}
diff --git a/src/boost/libs/container_hash/test/hash_no_ext_macro_1.cpp b/src/boost/libs/container_hash/test/hash_no_ext_macro_1.cpp
new file mode 100644
index 000000000..1bfcb954b
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_no_ext_macro_1.cpp
@@ -0,0 +1,37 @@
+
+// Copyright 2006-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 "./config.hpp"
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+
+// Include header without BOOST_HASH_NO_EXTENSIONS defined
+# if defined(BOOST_HASH_NO_EXTENSIONS)
+# undef BOOST_HASH_NO_EXTENSIONS
+# endif
+# include <boost/container_hash/hash.hpp>
+
+// Include header with BOOST_HASH_NO_EXTENSIONS defined
+# define BOOST_HASH_NO_EXTENSIONS
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+#include <deque>
+
+int main()
+{
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ std::deque<int> x;
+
+ x.push_back(1);
+ x.push_back(2);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<std::deque<int> > hasher;
+ BOOST_TEST(hasher(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x));
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_no_ext_macro_2.cpp b/src/boost/libs/container_hash/test/hash_no_ext_macro_2.cpp
new file mode 100644
index 000000000..6f4601800
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_no_ext_macro_2.cpp
@@ -0,0 +1,37 @@
+
+// Copyright 2006-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 "./config.hpp"
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+
+// Include header with BOOST_HASH_NO_EXTENSIONS defined
+# if !defined(BOOST_HASH_NO_EXTENSIONS)
+# define BOOST_HASH_NO_EXTENSIONS
+# endif
+# include <boost/container_hash/hash.hpp>
+
+// Include header without BOOST_HASH_NO_EXTENSIONS defined
+# undef BOOST_HASH_NO_EXTENSIONS
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+#include <map>
+
+int main()
+{
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ std::map<int, int> x;
+
+ x.insert(std::map<int, int>::value_type(53, -42));
+ x.insert(std::map<int, int>::value_type(14, -75));
+
+ BOOST_HASH_TEST_NAMESPACE::hash<std::map<int, int> > hasher;
+ BOOST_TEST(hasher(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x));
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_number_test.cpp b/src/boost/libs/container_hash/test/hash_number_test.cpp
new file mode 100644
index 000000000..72ab626dc
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_number_test.cpp
@@ -0,0 +1,203 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <iostream>
+#include <boost/core/lightweight_test.hpp>
+
+#include <boost/container_hash/detail/limits.hpp>
+#include <boost/core/enable_if.hpp>
+
+#include "./compile_time.hpp"
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4127) // conditional expression is constant
+#pragma warning(disable:4309) // truncation of constant value
+#pragma warning(disable:4310) // cast truncates constant value
+#endif
+
+#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION)
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+
+template <class T>
+void numeric_extra_tests(typename
+ boost::enable_if_c<boost::hash_detail::limits<T>::is_integer,
+ void*>::type = 0)
+{
+ typedef boost::hash_detail::limits<T> limits;
+
+ if(limits::is_signed ||
+ limits::digits <= boost::hash_detail::limits<std::size_t>::digits)
+ {
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(-5)) == (std::size_t)T(-5));
+ }
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(0)) == (std::size_t)T(0u));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(10)) == (std::size_t)T(10u));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(25)) == (std::size_t)T(25u));
+}
+
+template <class T>
+void numeric_extra_tests(typename
+ boost::disable_if_c<boost::hash_detail::limits<T>::is_integer,
+ void*>::type = 0)
+{
+}
+
+template <class T>
+void numeric_test(T*)
+{
+ compile_time_tests((T*) 0);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<T> x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<T> x2;
+
+ T v1 = (T) -5;
+ BOOST_TEST(x1(v1) == x2(v1));
+ BOOST_TEST(x1(T(-5)) == x2(T(-5)));
+ BOOST_TEST(x1(T(0)) == x2(T(0)));
+ BOOST_TEST(x1(T(10)) == x2(T(10)));
+ BOOST_TEST(x1(T(25)) == x2(T(25)));
+ BOOST_TEST(x1(T(5) - T(5)) == x2(T(0)));
+ BOOST_TEST(x1(T(6) + T(4)) == x2(T(10)));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(x1(T(-5)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(-5)));
+ BOOST_TEST(x1(T(0)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(0)));
+ BOOST_TEST(x1(T(10)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(10)));
+ BOOST_TEST(x1(T(25)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(25)));
+
+ numeric_extra_tests<T>();
+#endif
+}
+
+template <class T>
+void limits_test(T*)
+{
+ typedef boost::hash_detail::limits<T> limits;
+
+ if(limits::is_specialized)
+ {
+ BOOST_HASH_TEST_NAMESPACE::hash<T> x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<T> x2;
+
+ T min_value = (limits::min)();
+ T max_value = (limits::max)();
+
+ BOOST_TEST(x1(min_value) == x2((limits::min)()));
+ BOOST_TEST(x1(max_value) == x2((limits::max)()));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(x1(min_value) == BOOST_HASH_TEST_NAMESPACE::hash_value(min_value));
+ BOOST_TEST(x1(max_value) == BOOST_HASH_TEST_NAMESPACE::hash_value(max_value));
+
+ if (limits::is_integer)
+ {
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(min_value)
+ == std::size_t(min_value));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(max_value)
+ == std::size_t(max_value));
+ }
+#endif
+ }
+}
+
+template <class T>
+void poor_quality_tests(T*)
+{
+ typedef boost::hash_detail::limits<T> limits;
+
+ BOOST_HASH_TEST_NAMESPACE::hash<T> x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<T> x2;
+
+ // A hash function can legally fail these tests, but it'll not be a good
+ // sign.
+ if(T(1) != T(-1))
+ BOOST_TEST(x1(T(1)) != x2(T(-1)));
+ if(T(1) != T(2))
+ BOOST_TEST(x1(T(1)) != x2(T(2)));
+
+ // TODO: This test is useless for floating point numbers.
+ T max_number = static_cast<T>((limits::max)());
+ T max_minus_one = static_cast<T>(max_number - 1);
+ if (max_number != max_minus_one) {
+ BOOST_TEST(x1(max_number) != x1(max_minus_one));
+ }
+}
+
+void bool_test()
+{
+ BOOST_HASH_TEST_NAMESPACE::hash<bool> x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<bool> x2;
+
+ BOOST_TEST(x1(true) == x2(true));
+ BOOST_TEST(x1(false) == x2(false));
+ BOOST_TEST(x1(true) != x2(false));
+ BOOST_TEST(x1(false) != x2(true));
+}
+
+#define NUMERIC_TEST(type, name) \
+ std::cerr<<"Testing: " BOOST_STRINGIZE(name) "\n"; \
+ numeric_test((type*) 0); \
+ limits_test((type*) 0); \
+ poor_quality_tests((type*) 0);
+#define NUMERIC_TEST_NO_LIMITS(type, name) \
+ std::cerr<<"Testing: " BOOST_STRINGIZE(name) "\n"; \
+ numeric_test((type*) 0); \
+ poor_quality_tests((type*) 0);
+
+int main()
+{
+ NUMERIC_TEST(char, char)
+ NUMERIC_TEST(signed char, schar)
+ NUMERIC_TEST(unsigned char, uchar)
+#ifndef BOOST_NO_INTRINSIC_WCHAR_T
+ NUMERIC_TEST(wchar_t, wchar)
+#endif
+#ifndef BOOST_NO_CXX11_CHAR16_T
+ NUMERIC_TEST(char16_t, char16)
+#endif
+#ifndef BOOST_NO_CXX11_CHAR32_T
+ NUMERIC_TEST(char32_t, char32)
+#endif
+ NUMERIC_TEST(short, short)
+ NUMERIC_TEST(unsigned short, ushort)
+ NUMERIC_TEST(int, int)
+ NUMERIC_TEST(unsigned int, uint)
+ NUMERIC_TEST(long, hash_long)
+ NUMERIC_TEST(unsigned long, ulong)
+
+#if !defined(BOOST_NO_LONG_LONG)
+ NUMERIC_TEST_NO_LIMITS(boost::long_long_type, long_long)
+ NUMERIC_TEST_NO_LIMITS(boost::ulong_long_type, ulong_long)
+#endif
+
+#if defined(BOOST_HAS_INT128)
+ NUMERIC_TEST_NO_LIMITS(boost::int128_type, int128)
+ NUMERIC_TEST_NO_LIMITS(boost::uint128_type, uint128)
+#endif
+
+ NUMERIC_TEST(float, float)
+ NUMERIC_TEST(double, double)
+
+ NUMERIC_TEST(std::size_t, size_t)
+ NUMERIC_TEST(std::ptrdiff_t, ptrdiff_t)
+
+ bool_test();
+
+ return boost::report_errors();
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
diff --git a/src/boost/libs/container_hash/test/hash_optional_test.cpp b/src/boost/libs/container_hash/test/hash_optional_test.cpp
new file mode 100644
index 000000000..44693953b
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_optional_test.cpp
@@ -0,0 +1,70 @@
+
+// Copyright 2018 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 "./config.hpp"
+
+#ifndef BOOST_HASH_TEST_STD_INCLUDES
+# include <boost/container_hash/hash.hpp>
+#endif
+#include <boost/config.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+#if BOOST_HASH_HAS_OPTIONAL
+
+#include <optional>
+#include <string>
+
+void test_optional_int()
+{
+ std::optional<int> x1a;
+ std::optional<int> x1b;
+ std::optional<int> x2a(10);
+ std::optional<int> x2b(x2a);
+ std::optional<int> x3(20);
+
+ boost::hash<std::optional<int> > hasher;
+
+ BOOST_TEST(hasher(x1a) == hasher(x1a));
+ BOOST_TEST(hasher(x1a) == hasher(x1b));
+ BOOST_TEST(hasher(x1a) != hasher(x2a));
+ BOOST_TEST(hasher(x1a) != hasher(x3));
+ BOOST_TEST(hasher(x2a) == hasher(x2a));
+ BOOST_TEST(hasher(x2b) == hasher(x2b));
+ BOOST_TEST(hasher(x2a) != hasher(x3));
+ BOOST_TEST(hasher(x3) == hasher(x3));
+}
+
+void test_optional_string()
+{
+ std::optional<std::string> x1a;
+ std::optional<std::string> x1b;
+ std::optional<std::string> x2a("10");
+ std::optional<std::string> x2b(x2a);
+ std::optional<std::string> x3("20");
+
+ boost::hash<std::optional<std::string> > hasher;
+
+ BOOST_TEST(hasher(x1a) == hasher(x1a));
+ BOOST_TEST(hasher(x1a) == hasher(x1b));
+ BOOST_TEST(hasher(x1a) != hasher(x2a));
+ BOOST_TEST(hasher(x1a) != hasher(x3));
+ BOOST_TEST(hasher(x2a) == hasher(x2a));
+ BOOST_TEST(hasher(x2b) == hasher(x2b));
+ BOOST_TEST(hasher(x2a) != hasher(x3));
+ BOOST_TEST(hasher(x3) == hasher(x3));
+}
+
+#endif
+
+int main()
+{
+#if BOOST_HASH_HAS_OPTIONAL
+ test_optional_int();
+ test_optional_string();
+#else
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM << "<optional> not available." << std::endl;
+#endif
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_pointer_test.cpp b/src/boost/libs/container_hash/test/hash_pointer_test.cpp
new file mode 100644
index 000000000..7086a617a
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_pointer_test.cpp
@@ -0,0 +1,45 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+#include <boost/limits.hpp>
+#include "./compile_time.hpp"
+
+void pointer_tests()
+{
+ compile_time_tests((int**) 0);
+ compile_time_tests((void**) 0);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<int*> x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<int*> x2;
+
+ int int1;
+ int int2;
+
+ BOOST_TEST(x1(0) == x2(0));
+ BOOST_TEST(x1(&int1) == x2(&int1));
+ BOOST_TEST(x1(&int2) == x2(&int2));
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(x1(&int1) == BOOST_HASH_TEST_NAMESPACE::hash_value(&int1));
+ BOOST_TEST(x1(&int2) == BOOST_HASH_TEST_NAMESPACE::hash_value(&int2));
+
+ // This isn't specified in Peter's proposal:
+ BOOST_TEST(x1(0) == 0);
+#endif
+}
+
+int main()
+{
+ pointer_tests();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_range_test.cpp b/src/boost/libs/container_hash/test/hash_range_test.cpp
new file mode 100644
index 000000000..4a309e3e7
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_range_test.cpp
@@ -0,0 +1,85 @@
+
+// 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 "./config.hpp"
+
+#if !defined(BOOST_HASH_TEST_EXTENSIONS)
+
+int main() {}
+
+#else
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+#include <boost/limits.hpp>
+#include <vector>
+
+void hash_range_tests()
+{
+ std::vector<int> empty, values1, values2, values3, values4, values5;
+ values1.push_back(0);
+ values2.push_back(10);
+ values3.push_back(10);
+ values3.push_back(20);
+ values4.push_back(15);
+ values4.push_back(75);
+ values5.push_back(10);
+ values5.push_back(20);
+ values5.push_back(15);
+ values5.push_back(75);
+ values5.push_back(10);
+ values5.push_back(20);
+
+ std::vector<int> x;
+
+ std::size_t x_seed = 0;
+ BOOST_TEST(x_seed == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end())
+ == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end())
+ != BOOST_HASH_TEST_NAMESPACE::hash_range(values1.begin(), values1.end()));
+
+ x.push_back(10);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(x_seed, 10);
+ BOOST_TEST(x_seed == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end())
+ != BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(values2.begin(), values2.end())
+ == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+
+ x.push_back(20);
+ BOOST_HASH_TEST_NAMESPACE::hash_combine(x_seed, 20);
+ BOOST_TEST(x_seed == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end())
+ != BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(values2.begin(), values2.end())
+ != BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(values3.begin(), values3.end())
+ == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+
+ std::size_t seed =
+ BOOST_HASH_TEST_NAMESPACE::hash_range(values3.begin(), values3.end());
+ BOOST_HASH_TEST_NAMESPACE::hash_range(seed, values4.begin(), values4.end());
+ BOOST_HASH_TEST_NAMESPACE::hash_range(seed, x.begin(), x.end());
+ BOOST_TEST(seed ==
+ BOOST_HASH_TEST_NAMESPACE::hash_range(values5.begin(), values5.end()));
+}
+
+int main()
+{
+ hash_range_tests();
+
+ return boost::report_errors();
+}
+
+#endif // TEST_EXTESNIONS
diff --git a/src/boost/libs/container_hash/test/hash_sequence_test.hpp b/src/boost/libs/container_hash/test/hash_sequence_test.hpp
new file mode 100644
index 000000000..3e915f8c5
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_sequence_test.hpp
@@ -0,0 +1,76 @@
+
+// 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)
+
+#if !defined(CONTAINER_TYPE)
+#error "CONTAINER_TYPE not defined"
+#else
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4245) // signed/unsigned mismatch
+#endif
+
+namespace HASH_TEST_CAT(CONTAINER_TYPE, _tests)
+{
+ template <class T>
+ void integer_tests(T* = 0)
+ {
+ typedef typename T::value_type value_type;
+
+ const int number_of_containers = 11;
+ T containers[number_of_containers];
+
+ for(int i = 0; i < 5; ++i) {
+ for(int j = 0; j < i; ++j)
+ containers[i].push_back(0);
+ }
+
+ containers[5].push_back(value_type(1));
+ containers[6].push_back(value_type(1));
+ containers[6].push_back(value_type(1));
+ containers[7].push_back(value_type(-1));
+ containers[8].push_back(value_type(-1));
+ containers[8].push_back(value_type(-1));
+ containers[9].push_back(value_type(1));
+ containers[9].push_back(value_type(-1));
+ containers[10].push_back(value_type(-1));
+ containers[10].push_back(value_type(1));
+
+ BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;
+
+ for(int i2 = 0; i2 < number_of_containers; ++i2) {
+ BOOST_TEST(hasher(containers[i2]) == hasher(containers[i2]));
+
+ BOOST_TEST(hasher(containers[i2]) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_value(containers[i2]));
+
+ BOOST_TEST(hasher(containers[i2])
+ == BOOST_HASH_TEST_NAMESPACE::hash_range(
+ containers[i2].begin(), containers[i2].end()));
+
+ for(int j2 = i2 + 1; j2 < number_of_containers; ++j2) {
+ BOOST_TEST(
+ (containers[i2] == containers[j2]) ==
+ (hasher(containers[i2]) == hasher(containers[j2]))
+ );
+ }
+ }
+ }
+
+ void HASH_TEST_CAT(CONTAINER_TYPE, _hash_integer_tests())
+ {
+ integer_tests((CONTAINER_TYPE<char>*) 0);
+ integer_tests((CONTAINER_TYPE<int>*) 0);
+ integer_tests((CONTAINER_TYPE<unsigned long>*) 0);
+ integer_tests((CONTAINER_TYPE<double>*) 0);
+ }
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#undef CONTAINER_TYPE
+#endif
diff --git a/src/boost/libs/container_hash/test/hash_set_test.cpp b/src/boost/libs/container_hash/test/hash_set_test.cpp
new file mode 100644
index 000000000..48dcc2b80
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_set_test.cpp
@@ -0,0 +1,40 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <set>
+
+using std::set;
+#define CONTAINER_TYPE set
+#include "./hash_set_test.hpp"
+
+using std::multiset;
+#define CONTAINER_TYPE multiset
+#include "./hash_set_test.hpp"
+
+#endif
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ set_tests::set_hash_integer_tests();
+ multiset_tests::multiset_hash_integer_tests();
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_set_test.hpp b/src/boost/libs/container_hash/test/hash_set_test.hpp
new file mode 100644
index 000000000..9a777569b
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_set_test.hpp
@@ -0,0 +1,79 @@
+
+// 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)
+
+#if !defined(CONTAINER_TYPE)
+#error "CONTAINER_TYPE not defined"
+#else
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4245) // signed/unsigned mismatch
+#endif
+
+namespace HASH_TEST_CAT(CONTAINER_TYPE, _tests)
+{
+ template <class T>
+ void integer_tests(T* = 0)
+ {
+ typedef typename T::value_type value_type;
+
+ const int number_of_containers = 12;
+ T containers[number_of_containers];
+
+ for(int i = 0; i < 5; ++i) {
+ for(int j = 0; j < i; ++j)
+ containers[i].insert(0);
+ }
+
+ containers[6].insert(value_type(1));
+ containers[7].insert(value_type(1));
+ containers[7].insert(value_type(1));
+ containers[8].insert(value_type(-1));
+ containers[9].insert(value_type(-1));
+ containers[9].insert(value_type(-1));
+ containers[10].insert(value_type(-1));
+ containers[10].insert(value_type(1));
+ containers[11].insert(value_type(1));
+ containers[11].insert(value_type(2));
+ containers[11].insert(value_type(3));
+ containers[11].insert(value_type(4));
+ containers[11].insert(value_type(5));
+
+ BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;
+
+ for(int i2 = 0; i2 < number_of_containers; ++i2) {
+ BOOST_TEST(hasher(containers[i2]) == hasher(containers[i2]));
+
+ BOOST_TEST(hasher(containers[i2]) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_value(containers[i2]));
+
+ BOOST_TEST(hasher(containers[i2])
+ == BOOST_HASH_TEST_NAMESPACE::hash_range(
+ containers[i2].begin(), containers[i2].end()));
+
+ for(int j2 = i2 + 1; j2 < number_of_containers; ++j2) {
+ BOOST_TEST(
+ (containers[i2] == containers[j2]) ==
+ (hasher(containers[i2]) == hasher(containers[j2]))
+ );
+ }
+ }
+ }
+
+ void HASH_TEST_CAT(CONTAINER_TYPE, _hash_integer_tests())
+ {
+ integer_tests((CONTAINER_TYPE<char>*) 0);
+ integer_tests((CONTAINER_TYPE<int>*) 0);
+ integer_tests((CONTAINER_TYPE<unsigned long>*) 0);
+ integer_tests((CONTAINER_TYPE<double>*) 0);
+ }
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#undef CONTAINER_TYPE
+#endif
diff --git a/src/boost/libs/container_hash/test/hash_std_array_test.cpp b/src/boost/libs/container_hash/test/hash_std_array_test.cpp
new file mode 100644
index 000000000..d8faee4f6
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_std_array_test.cpp
@@ -0,0 +1,103 @@
+
+// Copyright 2012 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/config.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_HDR_ARRAY)
+#define TEST_ARRAY
+#include <array>
+#include <vector>
+#endif
+
+#ifdef TEST_ARRAY
+
+template <typename T>
+void array_tests(T const& v) {
+ boost::hash<typename T::value_type> hf;
+ for(typename T::const_iterator i = v.begin(); i != v.end(); ++i) {
+ for(typename T::const_iterator j = v.begin(); j != v.end(); ++j) {
+ if (i != j)
+ BOOST_TEST(hf(*i) != hf(*j));
+ else
+ BOOST_TEST(hf(*i) == hf(*j));
+ }
+ }
+}
+
+void empty_array_test() {
+/*
+ boost::hash<std::array<int, 0> > empty_array_hash;
+ std::array<int, 0> empty_array;
+ BOOST_TEST(empty_array_hash(empty_array) == boost::hash_value(empty_array));
+*/
+}
+
+void int_1_array_test()
+{
+ std::vector<std::array<int, 1> > arrays;
+ std::array<int, 1> val;
+ val[0] = 0;
+ arrays.push_back(val);
+ val[0] = 1;
+ arrays.push_back(val);
+ val[0] = 2;
+ arrays.push_back(val);
+ array_tests(arrays);
+}
+
+void string_1_array_test()
+{
+ std::vector<std::array<std::string, 1> > arrays;
+ std::array<std::string, 1> val;
+ arrays.push_back(val);
+ val[0] = "one";
+ arrays.push_back(val);
+ val[0] = "two";
+ arrays.push_back(val);
+ array_tests(arrays);
+}
+
+void string_3_array_test()
+{
+ std::vector<std::array<std::string,3 > > arrays;
+ std::array<std::string, 3> val;
+ arrays.push_back(val);
+ val[0] = "one";
+ arrays.push_back(val);
+ val[0] = ""; val[1] = "one"; val[2] = "";
+ arrays.push_back(val);
+ val[0] = ""; val[1] = ""; val[2] = "one";
+ arrays.push_back(val);
+ val[0] = "one"; val[1] = "one"; val[2] = "one";
+ arrays.push_back(val);
+ val[0] = "one"; val[1] = "two"; val[2] = "three";
+ arrays.push_back(val);
+ array_tests(arrays);
+}
+
+#endif // TEST_ARRAY
+
+int main()
+{
+#ifdef TEST_ARRAY
+ empty_array_test();
+ int_1_array_test();
+ string_1_array_test();
+ string_3_array_test();
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_std_smart_ptr_test.cpp b/src/boost/libs/container_hash/test/hash_std_smart_ptr_test.cpp
new file mode 100644
index 000000000..b8625fec5
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_std_smart_ptr_test.cpp
@@ -0,0 +1,80 @@
+
+// Copyright 2012 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+#include "./compile_time.hpp"
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_SMART_PTR)
+#define TEST_SMART_PTRS
+#include <memory>
+#endif
+
+#ifdef TEST_SMART_PTRS
+
+void shared_ptr_tests()
+{
+ std::shared_ptr<int> x;
+ compile_time_tests(&x);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<std::shared_ptr<int> > x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<std::shared_ptr<int> > x2;
+
+ std::shared_ptr<int> ptr1(new int(10));
+ std::shared_ptr<int> ptr2;
+
+ BOOST_TEST(x1(x) == x2(ptr2));
+ BOOST_TEST(x1(x) != x2(ptr1));
+ ptr2.reset(new int(10));
+ BOOST_TEST(x1(ptr1) == x2(ptr1));
+ BOOST_TEST(x1(ptr1) != x2(ptr2));
+ ptr2 = ptr1;
+ BOOST_TEST(x1(ptr1) == x2(ptr2));
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(x1(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x));
+ BOOST_TEST(x1(ptr1) == BOOST_HASH_TEST_NAMESPACE::hash_value(ptr2));
+#endif
+}
+
+void unique_ptr_tests()
+{
+ std::unique_ptr<int> x;
+ compile_time_tests(&x);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<std::unique_ptr<int> > x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<std::unique_ptr<int> > x2;
+
+ std::unique_ptr<int> ptr1(new int(10));
+ std::unique_ptr<int> ptr2;
+
+ BOOST_TEST(x1(x) == x2(ptr2));
+ BOOST_TEST(x1(x) != x2(ptr1));
+ ptr2.reset(new int(10));
+ BOOST_TEST(x1(ptr1) == x2(ptr1));
+ BOOST_TEST(x1(ptr1) != x2(ptr2));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ BOOST_TEST(x1(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x));
+#endif
+}
+
+#endif
+
+int main()
+{
+#ifdef TEST_SMART_PTRS
+ shared_ptr_tests();
+ unique_ptr_tests();
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_std_tuple_test.cpp b/src/boost/libs/container_hash/test/hash_std_tuple_test.cpp
new file mode 100644
index 000000000..df4ef37ff
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_std_tuple_test.cpp
@@ -0,0 +1,77 @@
+
+// Copyright 2012 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/config.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
+#define TEST_TUPLE
+#include <tuple>
+#include <vector>
+#endif
+
+#ifdef TEST_TUPLE
+
+template <typename T>
+void tuple_tests(T const& v) {
+ boost::hash<typename T::value_type> hf;
+ for(typename T::const_iterator i = v.begin(); i != v.end(); ++i) {
+ for(typename T::const_iterator j = v.begin(); j != v.end(); ++j) {
+ if (i != j)
+ BOOST_TEST(hf(*i) != hf(*j));
+ else
+ BOOST_TEST(hf(*i) == hf(*j));
+ }
+ }
+}
+
+void empty_tuple_test() {
+ boost::hash<std::tuple<> > empty_tuple_hash;
+ std::tuple<> empty_tuple;
+ BOOST_TEST(empty_tuple_hash(empty_tuple) == boost::hash_value(empty_tuple));
+}
+
+void int_tuple_test() {
+ std::vector<std::tuple<int> > int_tuples;
+ int_tuples.push_back(std::make_tuple(0));
+ int_tuples.push_back(std::make_tuple(1));
+ int_tuples.push_back(std::make_tuple(2));
+ tuple_tests(int_tuples);
+}
+
+void int_string_tuple_test() {
+ std::vector<std::tuple<int, std::string> > int_string_tuples;
+ int_string_tuples.push_back(std::make_tuple(0, std::string("zero")));
+ int_string_tuples.push_back(std::make_tuple(1, std::string("one")));
+ int_string_tuples.push_back(std::make_tuple(2, std::string("two")));
+ int_string_tuples.push_back(std::make_tuple(0, std::string("one")));
+ int_string_tuples.push_back(std::make_tuple(1, std::string("zero")));
+ int_string_tuples.push_back(std::make_tuple(0, std::string("")));
+ int_string_tuples.push_back(std::make_tuple(1, std::string("")));
+ tuple_tests(int_string_tuples);
+}
+
+#endif // TEST_TUPLE
+
+int main()
+{
+#ifdef TEST_TUPLE
+ empty_tuple_test();
+ int_tuple_test();
+ int_string_tuple_test();
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_string_test.cpp b/src/boost/libs/container_hash/test/hash_string_test.cpp
new file mode 100644
index 000000000..712c6395e
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_string_test.cpp
@@ -0,0 +1,184 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+#include <string>
+#include "./compile_time.hpp"
+
+void string_tests()
+{
+ compile_time_tests((std::string*) 0);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<std::string> x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<std::string> x2;
+
+ BOOST_TEST(x1("Hello") == x2(std::string("Hel") + "lo"));
+ BOOST_TEST(x1("") == x2(std::string()));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ std::string value1;
+ std::string value2("Hello");
+
+ BOOST_TEST(x1(value1) == BOOST_HASH_TEST_NAMESPACE::hash_value(value1));
+ BOOST_TEST(x1(value2) == BOOST_HASH_TEST_NAMESPACE::hash_value(value2));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value1) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_range(value1.begin(), value1.end()));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value2) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_range(value2.begin(), value2.end()));
+#endif
+}
+
+void string0_tests()
+{
+ std::string x1(1, '\0');
+ std::string x2(2, '\0');
+ std::string x3(3, '\0');
+ std::string x4(10, '\0');
+
+ BOOST_HASH_TEST_NAMESPACE::hash<std::string> hasher;
+
+ BOOST_TEST(hasher(x1) != hasher(x2));
+ BOOST_TEST(hasher(x1) != hasher(x3));
+ BOOST_TEST(hasher(x1) != hasher(x4));
+ BOOST_TEST(hasher(x2) != hasher(x3));
+ BOOST_TEST(hasher(x2) != hasher(x4));
+ BOOST_TEST(hasher(x3) != hasher(x4));
+}
+
+#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+void wstring_tests()
+{
+ compile_time_tests((std::wstring*) 0);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<std::wstring> x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<std::wstring> x2;
+
+ BOOST_TEST(x1(L"Hello") == x2(std::wstring(L"Hel") + L"lo"));
+ BOOST_TEST(x1(L"") == x2(std::wstring()));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ std::wstring value1;
+ std::wstring value2(L"Hello");
+
+ BOOST_TEST(x1(value1) == BOOST_HASH_TEST_NAMESPACE::hash_value(value1));
+ BOOST_TEST(x1(value2) == BOOST_HASH_TEST_NAMESPACE::hash_value(value2));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value1) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_range(value1.begin(), value1.end()));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value2) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_range(value2.begin(), value2.end()));
+#endif
+}
+#endif
+
+#if !defined(BOOST_NO_CXX11_CHAR16_T)
+void u16string_tests()
+{
+ compile_time_tests((std::u16string*) 0);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<std::u16string> x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<std::u16string> x2;
+
+ BOOST_TEST(x1(u"Hello") == x2(std::u16string(u"Hel") + u"lo"));
+ BOOST_TEST(x1(u"") == x2(std::u16string()));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ std::u16string value1;
+ std::u16string value2(u"Hello");
+
+ BOOST_TEST(x1(value1) == BOOST_HASH_TEST_NAMESPACE::hash_value(value1));
+ BOOST_TEST(x1(value2) == BOOST_HASH_TEST_NAMESPACE::hash_value(value2));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value1) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_range(value1.begin(), value1.end()));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value2) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_range(value2.begin(), value2.end()));
+#endif
+}
+#endif
+
+#if !defined(BOOST_NO_CXX11_CHAR32_T)
+void u32string_tests()
+{
+ compile_time_tests((std::u32string*) 0);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<std::u32string> x1;
+ BOOST_HASH_TEST_NAMESPACE::hash<std::u32string> x2;
+
+ BOOST_TEST(x1(U"Hello") == x2(std::u32string(U"Hel") + U"lo"));
+ BOOST_TEST(x1(U"") == x2(std::u32string()));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+ std::u32string value1;
+ std::u32string value2(U"Hello");
+
+ BOOST_TEST(x1(value1) == BOOST_HASH_TEST_NAMESPACE::hash_value(value1));
+ BOOST_TEST(x1(value2) == BOOST_HASH_TEST_NAMESPACE::hash_value(value2));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value1) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_range(value1.begin(), value1.end()));
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value2) ==
+ BOOST_HASH_TEST_NAMESPACE::hash_range(value2.begin(), value2.end()));
+#endif
+}
+#endif
+
+template <typename StringType>
+void generic_string_tests(StringType*)
+{
+ std::string x1(1, '\0');
+ std::string x2(2, '\0');
+ std::string x3(3, '\0');
+ std::string x4(10, '\0');
+ std::string x5 = x2 + "hello" + x2;
+
+ StringType strings[] = {
+ "",
+ "hello",
+ x1,
+ x2,
+ x3,
+ x4,
+ x5
+ };
+
+ std::size_t const strings_length = sizeof(strings) / sizeof(StringType);
+ boost::hash<StringType> hash;
+
+ for (std::size_t i = 0; i < strings_length; ++i) {
+ std::size_t hash_i = hash(strings[i]);
+ for (std::size_t j = 0; j < strings_length; ++j) {
+ std::size_t hash_j = hash(strings[j]);
+ BOOST_TEST((hash_i == hash_j) == (i == j));
+ }
+ }
+}
+
+int main()
+{
+ string_tests();
+ string0_tests();
+#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+ wstring_tests();
+#endif
+#if !defined(BOOST_NO_CXX11_CHAR16_T)
+ u16string_tests();
+#endif
+#if !defined(BOOST_NO_CXX11_CHAR32_T)
+ u32string_tests();
+#endif
+
+ generic_string_tests((std::string*) 0);
+#if BOOST_HASH_HAS_STRING_VIEW
+ generic_string_tests((std::string_view*) 0);
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_system_error_test.cpp b/src/boost/libs/container_hash/test/hash_system_error_test.cpp
new file mode 100644
index 000000000..14228d15a
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_system_error_test.cpp
@@ -0,0 +1,55 @@
+
+// Copyright 2018 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 "./config.hpp"
+
+#ifndef BOOST_HASH_TEST_STD_INCLUDES
+# include <boost/container_hash/hash.hpp>
+#endif
+#include <boost/config.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR)
+
+#include <system_error>
+
+void test_error_code()
+{
+ std::error_code err1a = std::make_error_code(std::errc::argument_list_too_long);
+ std::error_code err1b = std::make_error_code(std::errc::argument_list_too_long);
+ std::error_code err2 = std::make_error_code(std::errc::bad_file_descriptor);
+
+ boost::hash<std::error_code> hasher;
+
+ BOOST_TEST(hasher(err1a) == hasher(err1a));
+ BOOST_TEST(hasher(err1a) == hasher(err1b));
+ BOOST_TEST(hasher(err1a) != hasher(err2));
+}
+
+void test_error_condition()
+{
+ std::error_condition err1a = std::make_error_condition(std::errc::directory_not_empty);
+ std::error_condition err1b = std::make_error_condition(std::errc::directory_not_empty);
+ std::error_condition err2 = std::make_error_condition(std::errc::filename_too_long);
+
+ boost::hash<std::error_condition> hasher;
+
+ BOOST_TEST(hasher(err1a) == hasher(err1a));
+ BOOST_TEST(hasher(err1a) == hasher(err1b));
+ BOOST_TEST(hasher(err1a) != hasher(err2));
+}
+
+#endif
+
+int main()
+{
+#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR)
+ test_error_code();
+ test_error_condition();
+#else
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM << "<system_error> not available." << std::endl;
+#endif
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_type_index_test.cpp b/src/boost/libs/container_hash/test/hash_type_index_test.cpp
new file mode 100644
index 000000000..f03750f47
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_type_index_test.cpp
@@ -0,0 +1,53 @@
+
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/container_hash/hash.hpp>
+#endif
+#include <boost/config.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
+
+#include <typeindex>
+
+void test_type_index() {
+ BOOST_HASH_TEST_NAMESPACE::hash<std::type_index> hasher;
+
+#if defined(BOOST_NO_TYPEID)
+ std::cout<<"Unable to test std::type_index, as typeid isn't available"
+ <<std::endl;
+#else
+ std::type_index int_index = typeid(int);
+ std::type_index int2_index = typeid(int);
+ std::type_index char_index = typeid(char);
+
+ BOOST_TEST(hasher(int_index) == int_index.hash_code());
+ BOOST_TEST(hasher(int_index) == int2_index.hash_code());
+ BOOST_TEST(hasher(char_index) == char_index.hash_code());
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(int_index) == int_index.hash_code());
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(int_index) == int2_index.hash_code());
+ BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(char_index) == char_index.hash_code());
+
+ BOOST_TEST(hasher(int_index) == hasher(int2_index));
+ BOOST_TEST(hasher(int_index) != hasher(char_index));
+#endif
+}
+#endif
+
+int main()
+{
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
+ test_type_index();
+#else
+ std::cout<<"<type_index> not available."<<std::endl;
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_value_array_test.cpp b/src/boost/libs/container_hash/test/hash_value_array_test.cpp
new file mode 100644
index 000000000..d0d7fe624
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_value_array_test.cpp
@@ -0,0 +1,64 @@
+
+// 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)
+
+// On some compilers hash_value isn't available for arrays, so I test it
+// separately from the main array tests.
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+void array_int_test()
+{
+ const int array1[25] = {
+ 26, -43, 32, 65, 45,
+ 12, 67, 32, 12, 23,
+ 0, 0, 0, 0, 0,
+ 8, -12, 23, 65, 45,
+ -1, 93, -54, 987, 3
+ };
+ BOOST_HASH_TEST_NAMESPACE::hash<int[25]> hasher1;
+
+ int array2[1] = {3};
+ BOOST_HASH_TEST_NAMESPACE::hash<int[1]> hasher2;
+
+ int array3[2] = {2, 3};
+ BOOST_HASH_TEST_NAMESPACE::hash<int[2]> hasher3;
+
+ BOOST_TEST(hasher1(array1) == BOOST_HASH_TEST_NAMESPACE::hash_value(array1));
+ BOOST_TEST(hasher2(array2) == BOOST_HASH_TEST_NAMESPACE::hash_value(array2));
+ BOOST_TEST(hasher3(array3) == BOOST_HASH_TEST_NAMESPACE::hash_value(array3));
+}
+
+void two_dimensional_array_test()
+{
+ int array[3][2] = {{-5, 6}, {7, -3}, {26, 1}};
+ BOOST_HASH_TEST_NAMESPACE::hash<int[3][2]> hasher;
+
+ BOOST_TEST(hasher(array) == BOOST_HASH_TEST_NAMESPACE::hash_value(array));
+}
+
+#endif
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ array_int_test();
+ two_dimensional_array_test();
+#endif
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/container_hash/test/hash_variant_test.cpp b/src/boost/libs/container_hash/test/hash_variant_test.cpp
new file mode 100644
index 000000000..31520f4f9
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_variant_test.cpp
@@ -0,0 +1,100 @@
+
+// Copyright 2018 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 "./config.hpp"
+
+#ifndef BOOST_HASH_TEST_STD_INCLUDES
+# include <boost/container_hash/hash.hpp>
+#endif
+#include <boost/config.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+#if BOOST_HASH_HAS_VARIANT
+
+#include <variant>
+#include <string>
+
+void test_monostate()
+{
+ std::monostate x1;
+ std::monostate x2;
+
+ boost::hash<std::monostate> hasher;
+
+ BOOST_TEST(hasher(x1) == hasher(x2));
+}
+
+void test_variant_int()
+{
+ std::variant<std::monostate, int> x1a;
+ std::variant<std::monostate, int> x1b;
+ std::variant<std::monostate, int> x2a(10);
+ std::variant<std::monostate, int> x2b(x2a);
+ std::variant<std::monostate, int> x3(20);
+
+ boost::hash<std::variant<std::monostate, int> > hasher;
+
+ BOOST_TEST(hasher(x1a) == hasher(x1a));
+ BOOST_TEST(hasher(x1a) == hasher(x1b));
+ BOOST_TEST(hasher(x1a) != hasher(x2a));
+ BOOST_TEST(hasher(x1a) != hasher(x3));
+ BOOST_TEST(hasher(x2a) == hasher(x2a));
+ BOOST_TEST(hasher(x2b) == hasher(x2b));
+ BOOST_TEST(hasher(x2a) != hasher(x3));
+ BOOST_TEST(hasher(x3) == hasher(x3));
+}
+
+struct custom1 {
+ int value;
+ friend std::size_t hash_value(custom1 v) { return boost::hash_value(v.value); }
+};
+
+struct custom2 {
+ int value;
+ friend std::size_t hash_value(custom2 v) { return boost::hash_value(v.value); }
+};
+
+void test_variant_unique_types()
+{
+ custom1 x11 = { 0 };
+ custom1 x12 = { 1 };
+ custom2 x21 = { 0 };
+ custom2 x22 = { 1 };
+
+ boost::hash<custom1> hasher1;
+ boost::hash<custom2> hasher2;
+
+ BOOST_TEST(hasher1(x11) == hasher2(x21));
+ BOOST_TEST(hasher1(x11) != hasher2(x22));
+ BOOST_TEST(hasher1(x12) != hasher2(x21));
+ BOOST_TEST(hasher1(x12) == hasher2(x22));
+
+ typedef std::variant<custom1, custom2> variant_type;
+
+ variant_type y11(x11);
+ variant_type y12(x12);
+ variant_type y21(x21);
+ variant_type y22(x22);
+
+ boost::hash<variant_type> hasher;
+
+ BOOST_TEST(hasher(y11) != hasher(y21));
+ BOOST_TEST(hasher(y11) != hasher(y22));
+ BOOST_TEST(hasher(y12) != hasher(y21));
+ BOOST_TEST(hasher(y12) != hasher(y22));
+}
+
+#endif
+
+int main()
+{
+#if BOOST_HASH_HAS_VARIANT
+ test_variant_int();
+ test_variant_unique_types();
+#else
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM << "<variant> not available." << std::endl;
+#endif
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/hash_vector_test.cpp b/src/boost/libs/container_hash/test/hash_vector_test.cpp
new file mode 100644
index 000000000..9e63f5bac
--- /dev/null
+++ b/src/boost/libs/container_hash/test/hash_vector_test.cpp
@@ -0,0 +1,68 @@
+
+// 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 "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+# ifdef BOOST_HASH_TEST_STD_INCLUDES
+# include <functional>
+# else
+# include <boost/container_hash/hash.hpp>
+# endif
+#endif
+
+#include <boost/core/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <vector>
+
+using std::vector;
+#define CONTAINER_TYPE vector
+#include "./hash_sequence_test.hpp"
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+namespace vector_bool_tests
+{
+ void vector_bool_test() {
+ std::vector<bool> x_empty1,x_empty2,x1,x1a,x2,x3;
+
+ x1.push_back(0);
+ x1a.push_back(0);
+ x2.push_back(1);
+ x3.push_back(0);
+ x3.push_back(0);
+
+ BOOST_HASH_TEST_NAMESPACE::hash<std::vector<bool> > hasher;
+
+ BOOST_TEST_EQ(hasher(x_empty1), hasher(x_empty1));
+ BOOST_TEST_EQ(hasher(x_empty1), hasher(x_empty2));
+ BOOST_TEST_NE(hasher(x_empty1), hasher(x1));
+ BOOST_TEST_NE(hasher(x_empty1), hasher(x2));
+ BOOST_TEST_NE(hasher(x_empty1), hasher(x3));
+
+ BOOST_TEST_EQ(hasher(x1), hasher(x1));
+ BOOST_TEST_EQ(hasher(x1), hasher(x1a));
+ BOOST_TEST_NE(hasher(x1), hasher(x2));
+ BOOST_TEST_NE(hasher(x1), hasher(x3));
+
+ BOOST_TEST_EQ(hasher(x2), hasher(x2));
+ BOOST_TEST_NE(hasher(x2), hasher(x3));
+
+ BOOST_TEST_EQ(hasher(x3), hasher(x3));
+ }
+}
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+ vector_tests::vector_hash_integer_tests();
+#endif
+
+ vector_bool_tests::vector_bool_test();
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/implicit_test.cpp b/src/boost/libs/container_hash/test/implicit_test.cpp
new file mode 100644
index 000000000..67859da71
--- /dev/null
+++ b/src/boost/libs/container_hash/test/implicit_test.cpp
@@ -0,0 +1,21 @@
+
+// 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)
+
+#include <boost/container_hash/hash.hpp>
+
+namespace test
+{
+ struct base {};
+ std::size_t hash_value(base const&) { return 0; }
+
+ struct converts { operator base() const { return base(); } };
+}
+
+int main() {
+ boost::hash<test::converts> hash;
+ test::converts x;
+
+ hash(x);
+}
diff --git a/src/boost/libs/container_hash/test/link_ext_test.cpp b/src/boost/libs/container_hash/test/link_ext_test.cpp
new file mode 100644
index 000000000..de4964b6c
--- /dev/null
+++ b/src/boost/libs/container_hash/test/link_ext_test.cpp
@@ -0,0 +1,33 @@
+
+// Copyright 2006-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 "./config.hpp"
+
+#define BOOST_HASH_TEST_NAMESPACE boost
+#include <boost/container_hash/hash.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <vector>
+
+int f(std::size_t hash1, int* x1) {
+
+ // Check that BOOST_HASH_TEST_NAMESPACE::hash<int*> works in both files.
+ BOOST_HASH_TEST_NAMESPACE::hash<int*> ptr_hasher;
+ BOOST_TEST(hash1 == ptr_hasher(x1));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+
+ // Check that std::vector<std::size_t> is avaiable in this file.
+ std::vector<std::size_t> x;
+ x.push_back(static_cast<std::size_t>(*x1));
+ BOOST_HASH_TEST_NAMESPACE::hash<std::vector<std::size_t> > vector_hasher;
+ return vector_hasher(x) != BOOST_HASH_TEST_NAMESPACE::hash_value(x);
+
+#else
+
+ return 0;
+
+#endif
+}
+
diff --git a/src/boost/libs/container_hash/test/link_no_ext_test.cpp b/src/boost/libs/container_hash/test/link_no_ext_test.cpp
new file mode 100644
index 000000000..b325bd6e7
--- /dev/null
+++ b/src/boost/libs/container_hash/test/link_no_ext_test.cpp
@@ -0,0 +1,20 @@
+
+// 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 "./config.hpp"
+
+#define BOOST_HASH_TEST_NAMESPACE boost
+#define BOOST_HASH_NO_EXTENSIONS
+#include <boost/container_hash/hash.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+extern int f(std::size_t, int*);
+
+int main() {
+ BOOST_HASH_TEST_NAMESPACE::hash<int*> ptr_hasher;
+ int x = 55;
+ BOOST_TEST(!f(ptr_hasher(&x), &x));
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/container_hash/test/link_test.cpp b/src/boost/libs/container_hash/test/link_test.cpp
new file mode 100644
index 000000000..4acc301b7
--- /dev/null
+++ b/src/boost/libs/container_hash/test/link_test.cpp
@@ -0,0 +1,11 @@
+
+// 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 "./config.hpp"
+
+#include <boost/container_hash/hash.hpp>
+
+extern int f();
+int main() { return f(); }
diff --git a/src/boost/libs/container_hash/test/link_test_2.cpp b/src/boost/libs/container_hash/test/link_test_2.cpp
new file mode 100644
index 000000000..ff50e52ac
--- /dev/null
+++ b/src/boost/libs/container_hash/test/link_test_2.cpp
@@ -0,0 +1,10 @@
+
+// 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 "./config.hpp"
+
+#include <boost/container_hash/hash.hpp>
+
+int f() { return 0; }
diff --git a/src/boost/libs/container_hash/test/namespace_fail_test.cpp b/src/boost/libs/container_hash/test/namespace_fail_test.cpp
new file mode 100644
index 000000000..700d07489
--- /dev/null
+++ b/src/boost/libs/container_hash/test/namespace_fail_test.cpp
@@ -0,0 +1,16 @@
+
+// Copyright 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)
+
+// Check that I haven't inadvertantly pulled namespace std into the global
+// namespace.
+
+#include "./config.hpp"
+
+#include <list>
+#include <boost/container_hash/hash.hpp>
+
+typedef list<int> foo;
+
+int main() {}