1// Copyright Louis Dionne 2013-2022
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4
5#include <boost/hana/assert.hpp>
6#include <boost/hana/equal.hpp>
7#include <boost/hana/not.hpp>
8#include <boost/hana/not_equal.hpp> // for operator !=
9#include <boost/hana/optional.hpp>
10
11#include <laws/base.hpp>
12namespace hana = boost::hana;
13
14
15int main() {
16 hana::test::ct_eq<3> x{};
17 hana::test::ct_eq<4> y{};
18
19 BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::nothing, hana::nothing));
20 BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::nothing, hana::just(x))));
21 BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::just(x), hana::nothing)));
22 BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::just(x), hana::just(x)));
23 BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::just(x), hana::just(y))));
24
25 BOOST_HANA_CONSTANT_CHECK(hana::nothing == hana::nothing);
26 BOOST_HANA_CONSTANT_CHECK(hana::just(x) == hana::just(x));
27 BOOST_HANA_CONSTANT_CHECK(hana::just(x) != hana::just(y));
28 BOOST_HANA_CONSTANT_CHECK(hana::just(x) != hana::nothing);
29 BOOST_HANA_CONSTANT_CHECK(hana::nothing != hana::just(x));
30}
31

source code of boost/libs/hana/test/optional/equal.cpp