summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/hana/test/integral_constant
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/boost/libs/hana/test/integral_constant/arithmetic.cpp29
-rw-r--r--src/boost/libs/hana/test/integral_constant/comparable.cpp23
-rw-r--r--src/boost/libs/hana/test/integral_constant/constant.cpp38
-rw-r--r--src/boost/libs/hana/test/integral_constant/constexpr_init.cpp50
-rw-r--r--src/boost/libs/hana/test/integral_constant/github_354.cpp20
-rw-r--r--src/boost/libs/hana/test/integral_constant/hash.cpp110
-rw-r--r--src/boost/libs/hana/test/integral_constant/hashable.cpp26
-rw-r--r--src/boost/libs/hana/test/integral_constant/logical.cpp55
-rw-r--r--src/boost/libs/hana/test/integral_constant/operators.cpp57
-rw-r--r--src/boost/libs/hana/test/integral_constant/orderable.cpp23
-rw-r--r--src/boost/libs/hana/test/integral_constant/std_api.cpp44
-rw-r--r--src/boost/libs/hana/test/integral_constant/tag.cpp26
-rw-r--r--src/boost/libs/hana/test/integral_constant/times.cpp61
-rw-r--r--src/boost/libs/hana/test/integral_constant/udl.cpp75
14 files changed, 637 insertions, 0 deletions
diff --git a/src/boost/libs/hana/test/integral_constant/arithmetic.cpp b/src/boost/libs/hana/test/integral_constant/arithmetic.cpp
new file mode 100644
index 000000000..5968ebe31
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/arithmetic.cpp
@@ -0,0 +1,29 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/tuple.hpp>
+
+#include <laws/euclidean_ring.hpp>
+#include <laws/group.hpp>
+#include <laws/monoid.hpp>
+#include <laws/ring.hpp>
+namespace hana = boost::hana;
+
+
+int main() {
+ constexpr auto ints = hana::make_tuple(
+ hana::int_c<-10>,
+ hana::int_c<-2>,
+ hana::int_c<0>,
+ hana::int_c<1>,
+ hana::int_c<3>,
+ hana::int_c<4>
+ );
+
+ hana::test::TestMonoid<hana::integral_constant_tag<int>>{ints};
+ hana::test::TestGroup<hana::integral_constant_tag<int>>{ints};
+ hana::test::TestRing<hana::integral_constant_tag<int>>{ints};
+ hana::test::TestEuclideanRing<hana::integral_constant_tag<int>>{ints};
+}
diff --git a/src/boost/libs/hana/test/integral_constant/comparable.cpp b/src/boost/libs/hana/test/integral_constant/comparable.cpp
new file mode 100644
index 000000000..a9677341e
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/comparable.cpp
@@ -0,0 +1,23 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/tuple.hpp>
+
+#include <laws/comparable.hpp>
+namespace hana = boost::hana;
+
+
+int main() {
+ constexpr auto ints = hana::make_tuple(
+ hana::int_c<-10>,
+ hana::int_c<-2>,
+ hana::int_c<0>,
+ hana::int_c<1>,
+ hana::int_c<3>,
+ hana::int_c<4>
+ );
+
+ hana::test::TestComparable<hana::integral_constant_tag<int>>{ints};
+}
diff --git a/src/boost/libs/hana/test/integral_constant/constant.cpp b/src/boost/libs/hana/test/integral_constant/constant.cpp
new file mode 100644
index 000000000..5ef1248ca
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/constant.cpp
@@ -0,0 +1,38 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/tuple.hpp>
+#include <boost/hana/value.hpp>
+
+#include <laws/constant.hpp>
+namespace hana = boost::hana;
+
+
+int main() {
+ // value
+ static_assert(hana::value(hana::integral_c<int, 0>) == 0, "");
+ static_assert(hana::value(hana::integral_c<int, 1>) == 1, "");
+
+
+ // laws
+ hana::test::TestConstant<hana::integral_constant_tag<int>>{
+ hana::make_tuple(
+ hana::int_c<-10>,
+ hana::int_c<-2>,
+ hana::int_c<0>,
+ hana::int_c<1>,
+ hana::int_c<3>,
+ hana::int_c<4>
+ ),
+ hana::tuple_t<int, long, long long>
+ };
+
+ hana::test::TestConstant<hana::integral_constant_tag<bool>>{
+ hana::make_tuple(
+ hana::true_c, hana::false_c
+ ),
+ hana::tuple_t<bool>
+ };
+}
diff --git a/src/boost/libs/hana/test/integral_constant/constexpr_init.cpp b/src/boost/libs/hana/test/integral_constant/constexpr_init.cpp
new file mode 100644
index 000000000..0656eb6d0
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/constexpr_init.cpp
@@ -0,0 +1,50 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/bool.hpp>
+#include <boost/hana/integral_constant.hpp>
+namespace hana = boost::hana;
+
+
+/*
+When we use `int_<...>` in a template, Clang 3.5 says:
+
+--------------------------------
+include/boost/hana/integral_constant.hpp:80:20: error: constexpr variable 'int_<1>' must be initialized by a constant expression
+ constexpr auto int_ = integral<int, i>;
+ ^ ~~~~~~~~~~~~~~~~
+test/integral/constexpr_bug.cpp:41:37: note: in instantiation of variable template specialization 'boost::hana::int_' requested here
+constexpr auto check_int() { return int_<1>; }
+ ^
+include/boost/hana/integral_constant.hpp:80:27: note: subexpression not valid in a constant expression
+ constexpr auto int_ = integral<int, i>;
+ ^
+include/boost/hana/integral_constant.hpp:80:27: note: in call to 'integral_type(integral)'
+--------------------------------
+
+if we define int_ & friends like
+
+ template <int i>
+ constexpr auto int_ = integral<int, i>;
+
+Instead, we do
+
+ template <int i>
+ constexpr decltype(integral<int, i>) int_{};
+
+which is equivalent but uglier. Note that everything works just fine when
+we're not in a template.
+*/
+
+template <typename T>
+constexpr auto check_int() { return hana::int_c<1>; }
+
+template <typename T>
+constexpr auto check_true() { return hana::true_c; }
+
+template <typename T>
+constexpr auto check_size_t() { return hana::size_c<0>; }
+
+
+int main() { }
diff --git a/src/boost/libs/hana/test/integral_constant/github_354.cpp b/src/boost/libs/hana/test/integral_constant/github_354.cpp
new file mode 100644
index 000000000..33ce2f37b
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/github_354.cpp
@@ -0,0 +1,20 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/bool.hpp>
+#include <boost/hana/core/to.hpp>
+#include <boost/hana/integral_constant.hpp>
+namespace hana = boost::hana;
+
+
+static_assert(hana::is_convertible<hana::bool_<true>, bool>::value, "");
+static_assert(hana::to<bool>(hana::bool_c<true>) == true, "");
+
+static_assert(hana::is_convertible<hana::integral_constant<int, 1>, int>::value, "");
+static_assert(hana::to<int>(hana::integral_c<int, 1>) == 1, "");
+
+static_assert(hana::is_convertible<hana::integral_constant<long, 1l>, long>::value, "");
+static_assert(hana::to<long>(hana::integral_c<long, 1l>) == 1l, "");
+
+int main() { }
diff --git a/src/boost/libs/hana/test/integral_constant/hash.cpp b/src/boost/libs/hana/test/integral_constant/hash.cpp
new file mode 100644
index 000000000..59cf07057
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/hash.cpp
@@ -0,0 +1,110 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/bool.hpp>
+#include <boost/hana/config.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/hash.hpp>
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/type.hpp>
+
+#include <type_traits>
+namespace hana = boost::hana;
+
+
+int main() {
+ // Unsigned integral constants should hash to `unsigned long long`
+ {
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<unsigned char, 10>),
+ hana::type_c<hana::integral_constant<unsigned long long, 10>>
+ ));
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<unsigned short, 10>),
+ hana::type_c<hana::integral_constant<unsigned long long, 10>>
+ ));
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<unsigned int, 10>),
+ hana::type_c<hana::integral_constant<unsigned long long, 10>>
+ ));
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<unsigned long, 10>),
+ hana::type_c<hana::integral_constant<unsigned long long, 10>>
+ ));
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<unsigned long long, 10>),
+ hana::type_c<hana::integral_constant<unsigned long long, 10>>
+ ));
+ }
+
+ // Signed integral constants should hash to `signed long long`
+ {
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<signed char, 10>),
+ hana::type_c<hana::integral_constant<signed long long, 10>>
+ ));
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<signed short, 10>),
+ hana::type_c<hana::integral_constant<signed long long, 10>>
+ ));
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<signed int, 10>),
+ hana::type_c<hana::integral_constant<signed long long, 10>>
+ ));
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<signed long, 10>),
+ hana::type_c<hana::integral_constant<signed long long, 10>>
+ ));
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<signed long long, 10>),
+ hana::type_c<hana::integral_constant<signed long long, 10>>
+ ));
+ }
+
+ // `char` should hash to either `signed long long` or `unsigned long long`,
+ // depending on its signedness
+ {
+ using T = std::conditional_t<
+ std::is_signed<char>::value,
+ signed long long,
+ unsigned long long
+ >;
+
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::integral_c<char, 10>),
+ hana::type_c<hana::integral_constant<T, 10>>
+ ));
+ }
+
+ // Pointers to members should hash to themselves.
+ // This test is disabled in pre-C++17, because pointers to non-static
+ // data members can't be used as non-type template arguments before that.
+ // See http://stackoverflow.com/q/35398848/627587.
+ {
+#if __cplusplus > 201402L
+
+ struct Foo { int bar; };
+ constexpr auto x = hana::integral_constant<int Foo::*, &Foo::bar>{};
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(x),
+ hana::type_c<hana::integral_constant<int Foo::*, &Foo::bar>>
+ ));
+
+#endif
+ }
+
+ // Booleans should hash to themselves
+ {
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::true_c),
+ hana::type_c<hana::true_>
+ ));
+
+ BOOST_HANA_CONSTANT_ASSERT(hana::equal(
+ hana::hash(hana::false_c),
+ hana::type_c<hana::false_>
+ ));
+ }
+}
diff --git a/src/boost/libs/hana/test/integral_constant/hashable.cpp b/src/boost/libs/hana/test/integral_constant/hashable.cpp
new file mode 100644
index 000000000..5c31355d0
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/hashable.cpp
@@ -0,0 +1,26 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/tuple.hpp>
+
+#include <laws/hashable.hpp>
+namespace hana = boost::hana;
+
+
+int main() {
+ constexpr auto ints = hana::make_tuple(
+ hana::integral_constant<char, 42>{}
+ , hana::integral_constant<signed char, 42>{}
+ , hana::integral_constant<signed short, 42>{}
+ , hana::integral_constant<signed int, 42>{}
+ , hana::integral_constant<signed long, 42>{}
+ , hana::integral_constant<unsigned char, 42>{}
+ , hana::integral_constant<unsigned short, 42>{}
+ , hana::integral_constant<unsigned int, 42>{}
+ , hana::integral_constant<unsigned long, 42>{}
+ );
+
+ hana::test::TestHashable<hana::integral_constant_tag<void>>{ints};
+}
diff --git a/src/boost/libs/hana/test/integral_constant/logical.cpp b/src/boost/libs/hana/test/integral_constant/logical.cpp
new file mode 100644
index 000000000..70641d370
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/logical.cpp
@@ -0,0 +1,55 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/eval_if.hpp>
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/not.hpp>
+#include <boost/hana/tuple.hpp>
+
+#include <laws/base.hpp>
+#include <laws/logical.hpp>
+namespace hana = boost::hana;
+
+
+int main() {
+ // eval_if
+ {
+ auto t = [](auto) { return hana::test::ct_eq<3>{}; };
+ auto e = [](auto) { return hana::test::ct_eq<4>{}; };
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::eval_if(hana::true_c, t, e),
+ hana::test::ct_eq<3>{}
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::eval_if(hana::false_c, t, e),
+ hana::test::ct_eq<4>{}
+ ));
+ }
+
+ // not_
+ {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::not_(hana::true_c),
+ hana::false_c
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::not_(hana::false_c),
+ hana::true_c
+ ));
+ }
+
+ // laws
+ hana::test::TestLogical<hana::integral_constant_tag<int>>{hana::make_tuple(
+ hana::int_c<-2>, hana::int_c<0>, hana::int_c<1>, hana::int_c<3>
+ )};
+
+ hana::test::TestLogical<hana::integral_constant_tag<bool>>{hana::make_tuple(
+ hana::false_c, hana::true_c
+ )};
+}
diff --git a/src/boost/libs/hana/test/integral_constant/operators.cpp b/src/boost/libs/hana/test/integral_constant/operators.cpp
new file mode 100644
index 000000000..339198580
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/operators.cpp
@@ -0,0 +1,57 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/integral_constant.hpp>
+
+#include <boost/hana/and.hpp>
+#include <boost/hana/div.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/greater.hpp>
+#include <boost/hana/greater_equal.hpp>
+#include <boost/hana/less.hpp>
+#include <boost/hana/less_equal.hpp>
+#include <boost/hana/minus.hpp>
+#include <boost/hana/mod.hpp>
+#include <boost/hana/mult.hpp>
+#include <boost/hana/negate.hpp>
+#include <boost/hana/not.hpp>
+#include <boost/hana/not_equal.hpp>
+#include <boost/hana/or.hpp>
+#include <boost/hana/plus.hpp>
+namespace hana = boost::hana;
+
+
+// Arithmetic operators
+BOOST_HANA_CONSTANT_CHECK(+hana::int_c<1> == hana::int_c<1>);
+BOOST_HANA_CONSTANT_CHECK(-hana::int_c<1> == hana::int_c<-1>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<1> + hana::int_c<2> == hana::int_c<3>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<1> - hana::int_c<2> == hana::int_c<-1>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<3> * hana::int_c<2> == hana::int_c<6>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<6> / hana::int_c<3> == hana::int_c<2>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<6> % hana::int_c<4> == hana::int_c<2>);
+BOOST_HANA_CONSTANT_CHECK(~hana::int_c<6> == hana::int_c<~6>);
+BOOST_HANA_CONSTANT_CHECK((hana::int_c<6> & hana::int_c<3>) == hana::int_c<6 & 3>);
+BOOST_HANA_CONSTANT_CHECK((hana::int_c<4> | hana::int_c<2>) == hana::int_c<4 | 2>);
+BOOST_HANA_CONSTANT_CHECK((hana::int_c<6> ^ hana::int_c<3>) == hana::int_c<6 ^ 3>);
+BOOST_HANA_CONSTANT_CHECK((hana::int_c<6> << hana::int_c<3>) == hana::int_c<(6 << 3)>);
+BOOST_HANA_CONSTANT_CHECK((hana::int_c<6> >> hana::int_c<3>) == hana::int_c<(6 >> 3)>);
+
+// Comparison operators
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<0> == hana::int_c<0>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<1> != hana::int_c<0>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<0> < hana::int_c<1>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<0> <= hana::int_c<1>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<0> <= hana::int_c<0>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<1> > hana::int_c<0>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<1> >= hana::int_c<0>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<0> >= hana::int_c<0>);
+
+// Logical operators
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<3> || hana::int_c<0>);
+BOOST_HANA_CONSTANT_CHECK(hana::int_c<3> && hana::int_c<1>);
+BOOST_HANA_CONSTANT_CHECK(!hana::int_c<0>);
+BOOST_HANA_CONSTANT_CHECK(!!hana::int_c<3>);
+
+int main() { }
diff --git a/src/boost/libs/hana/test/integral_constant/orderable.cpp b/src/boost/libs/hana/test/integral_constant/orderable.cpp
new file mode 100644
index 000000000..b32b33c53
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/orderable.cpp
@@ -0,0 +1,23 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/tuple.hpp>
+
+#include <laws/orderable.hpp>
+namespace hana = boost::hana;
+
+
+int main() {
+ constexpr auto ints = hana::make_tuple(
+ hana::int_c<-10>,
+ hana::int_c<-2>,
+ hana::int_c<0>,
+ hana::int_c<1>,
+ hana::int_c<3>,
+ hana::int_c<4>
+ );
+
+ hana::test::TestOrderable<hana::integral_constant_tag<int>>{ints};
+}
diff --git a/src/boost/libs/hana/test/integral_constant/std_api.cpp b/src/boost/libs/hana/test/integral_constant/std_api.cpp
new file mode 100644
index 000000000..95e9d5fe3
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/std_api.cpp
@@ -0,0 +1,44 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/integral_constant.hpp>
+
+#include <cstddef>
+#include <type_traits>
+namespace hana = boost::hana;
+
+
+// operator()
+static_assert(hana::size_c<0>() == 0, "");
+static_assert(hana::size_c<1>() == 1, "");
+static_assert(hana::int_c<-3>() == -3, "");
+
+// decltype(operator())
+static_assert(std::is_same<decltype(hana::size_c<0>()), std::size_t>{}, "");
+static_assert(std::is_same<decltype(hana::int_c<-3>()), int>{}, "");
+
+// conversions
+constexpr std::size_t a = hana::size_c<0>, b = hana::size_c<1>;
+static_assert(a == 0 && b == 1, "");
+
+constexpr int c = hana::int_c<0>, d = hana::int_c<-3>;
+static_assert(c == 0 && d == -3, "");
+
+// nested ::value
+static_assert(decltype(hana::int_c<1>)::value == 1, "");
+
+// nested ::type
+static_assert(std::is_same<
+ decltype(hana::int_c<1>)::type,
+ std::remove_cv_t<decltype(hana::int_c<1>)>
+>{}, "");
+
+// nested ::value_type
+static_assert(std::is_same<decltype(hana::int_c<1>)::value_type, int>{}, "");
+
+// inherits from std::integral_constant
+static_assert(std::is_base_of<std::integral_constant<int, 3>,
+ hana::integral_constant<int, 3>>{}, "");
+
+int main() { }
diff --git a/src/boost/libs/hana/test/integral_constant/tag.cpp b/src/boost/libs/hana/test/integral_constant/tag.cpp
new file mode 100644
index 000000000..35b420201
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/tag.cpp
@@ -0,0 +1,26 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/core/tag_of.hpp>
+#include <boost/hana/ext/std/integral_constant.hpp>
+#include <boost/hana/integral_constant.hpp>
+
+#include <type_traits>
+namespace hana = boost::hana;
+
+
+// Make sure we have the right tag, even when including ext/std/integral_constant.hpp
+static_assert(std::is_same<
+ hana::tag_of_t<hana::integral_constant<int, 10>>,
+ hana::integral_constant_tag<int>
+>{}, "");
+
+struct derived : hana::integral_constant<int, 10> { };
+static_assert(std::is_same<
+ hana::tag_of_t<derived>,
+ hana::integral_constant_tag<int>
+>{}, "");
+
+
+int main() { }
diff --git a/src/boost/libs/hana/test/integral_constant/times.cpp b/src/boost/libs/hana/test/integral_constant/times.cpp
new file mode 100644
index 000000000..51f354fd7
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/times.cpp
@@ -0,0 +1,61 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/core/is_a.hpp>
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/value.hpp>
+namespace hana = boost::hana;
+
+
+void function() { }
+void function_index(...) { }
+
+int main() {
+ // times member function
+ {
+ int counter = 0;
+ hana::int_c<3>.times([&] { ++counter; });
+ BOOST_HANA_RUNTIME_CHECK(counter == 3);
+
+ // Call .times with a normal function used to fail.
+ hana::int_c<3>.times(function);
+
+ // make sure times can be accessed as a static member function too
+ decltype(hana::int_c<5>)::times([]{ });
+
+ // make sure xxx.times can be used as a function object
+ auto z = hana::int_c<5>.times;
+ (void)z;
+ }
+
+ // times.with_index
+ {
+ int index = 0;
+ hana::int_c<3>.times.with_index([&](auto i) {
+ static_assert(hana::is_an<hana::integral_constant_tag<int>>(i), "");
+ BOOST_HANA_RUNTIME_CHECK(hana::value(i) == index);
+ ++index;
+ });
+
+ // Calling .times.with_index with a normal function used to fail.
+ hana::int_c<3>.times.with_index(function_index);
+
+ // make sure times.with_index can be accessed as a static member
+ // function too
+ auto times = hana::int_c<5>.times;
+ decltype(times)::with_index([](auto) { });
+
+ // make sure xxx.times.with_index can be used as a function object
+ auto z = hana::int_c<5>.times.with_index;
+ (void)z;
+
+ // make sure we're calling the function in the right order
+ int current = 0;
+ hana::int_c<5>.times.with_index([&](auto i) {
+ BOOST_HANA_RUNTIME_CHECK(hana::value(i) == current);
+ ++current;
+ });
+ }
+}
diff --git a/src/boost/libs/hana/test/integral_constant/udl.cpp b/src/boost/libs/hana/test/integral_constant/udl.cpp
new file mode 100644
index 000000000..05b0186fc
--- /dev/null
+++ b/src/boost/libs/hana/test/integral_constant/udl.cpp
@@ -0,0 +1,75 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/less.hpp>
+#include <boost/hana/negate.hpp>
+
+#include <type_traits>
+namespace hana = boost::hana;
+using namespace hana::literals;
+
+
+BOOST_HANA_CONSTANT_CHECK(0_c == hana::llong_c<0>);
+BOOST_HANA_CONSTANT_CHECK(1_c == hana::llong_c<1>);
+BOOST_HANA_CONSTANT_CHECK(12_c == hana::llong_c<12>);
+BOOST_HANA_CONSTANT_CHECK(123_c == hana::llong_c<123>);
+BOOST_HANA_CONSTANT_CHECK(1234567_c == hana::llong_c<1234567>);
+BOOST_HANA_CONSTANT_CHECK(-34_c == hana::llong_c<-34>);
+
+
+static_assert(std::is_same<
+ decltype(-1234_c)::value_type,
+ long long
+>{}, "");
+static_assert(-1234_c == -1234ll, "");
+BOOST_HANA_CONSTANT_CHECK(-12_c < 0_c);
+
+
+constexpr auto deadbeef = hana::llong_c<0xDEADBEEF>;
+
+//hexadecimal
+BOOST_HANA_CONSTANT_CHECK(deadbeef == 0xDEADBEEF_c);
+BOOST_HANA_CONSTANT_CHECK(deadbeef == 0xDeAdBeEf_c);
+BOOST_HANA_CONSTANT_CHECK(deadbeef == 0xdeadbeef_c);
+
+//decimal
+BOOST_HANA_CONSTANT_CHECK(deadbeef == hana::llong_c<3735928559>); // test the test
+BOOST_HANA_CONSTANT_CHECK(deadbeef == 3735928559_c);
+
+//binary
+BOOST_HANA_CONSTANT_CHECK(deadbeef == hana::llong_c<0b11011110101011011011111011101111>); // test the test
+BOOST_HANA_CONSTANT_CHECK(deadbeef == 0b11011110101011011011111011101111_c);
+
+//octal
+BOOST_HANA_CONSTANT_CHECK(deadbeef == hana::llong_c<033653337357>); // test the test
+BOOST_HANA_CONSTANT_CHECK(deadbeef == 033653337357_c);
+
+BOOST_HANA_CONSTANT_CHECK(0x0_c == hana::llong_c<0>);
+BOOST_HANA_CONSTANT_CHECK(0b0_c == hana::llong_c<0>);
+BOOST_HANA_CONSTANT_CHECK(00_c == hana::llong_c<0>);
+
+BOOST_HANA_CONSTANT_CHECK(0x1_c == hana::llong_c<1>);
+BOOST_HANA_CONSTANT_CHECK(0b1_c == hana::llong_c<1>);
+BOOST_HANA_CONSTANT_CHECK(01_c == hana::llong_c<1>);
+
+BOOST_HANA_CONSTANT_CHECK(-0x1_c == hana::llong_c<-1>);
+BOOST_HANA_CONSTANT_CHECK(-0b1_c == hana::llong_c<-1>);
+BOOST_HANA_CONSTANT_CHECK(-01_c == hana::llong_c<-1>);
+
+BOOST_HANA_CONSTANT_CHECK(0x10_c == hana::llong_c<16>);
+BOOST_HANA_CONSTANT_CHECK(0b10_c == hana::llong_c<2>);
+BOOST_HANA_CONSTANT_CHECK(010_c == hana::llong_c<8>);
+
+BOOST_HANA_CONSTANT_CHECK(-0x10_c == hana::llong_c<-16>);
+BOOST_HANA_CONSTANT_CHECK(-0b10_c == hana::llong_c<-2>);
+BOOST_HANA_CONSTANT_CHECK(-010_c == hana::llong_c<-8>);
+
+// digit separators
+static_assert(123'456 == 123456, ""); // test the test
+BOOST_HANA_CONSTANT_CHECK(123'456_c == hana::llong_c<123456>);
+
+int main() { }