summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/hana/test/type/equal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/hana/test/type/equal.cpp')
-rw-r--r--src/boost/libs/hana/test/type/equal.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/boost/libs/hana/test/type/equal.cpp b/src/boost/libs/hana/test/type/equal.cpp
new file mode 100644
index 000000000..4d5a18a84
--- /dev/null
+++ b/src/boost/libs/hana/test/type/equal.cpp
@@ -0,0 +1,35 @@
+// 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/not.hpp>
+#include <boost/hana/not_equal.hpp> // for operator !=
+#include <boost/hana/type.hpp>
+namespace hana = boost::hana;
+
+
+struct T;
+struct U;
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::type_c<T>, hana::type_c<T>));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::type_c<T>, hana::type_c<U>)));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::type_c<void>, hana::type_c<U>)));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::type_c<T>, hana::type_c<void>)));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::type_c<void>, hana::type_c<void>));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::type_c<T&>, hana::type_c<T&>));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::type_c<T&>, hana::type_c<T&&>)));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::type_c<T const>, hana::type_c<T>)));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::type_c<T const>, hana::type_c<T const>));
+
+ // make sure we don't read from a non-constexpr variable in hana::equal
+ auto t = hana::type_c<T>;
+ static_assert(hana::equal(t, hana::type_c<T>), "");
+
+ // check operators
+ BOOST_HANA_CONSTANT_CHECK(hana::type_c<T> == hana::type_c<T>);
+ BOOST_HANA_CONSTANT_CHECK(hana::type_c<T> != hana::type_c<U>);
+}