• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015-2017 Hans Dembinski
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
6 
7 #include <boost/core/lightweight_test.hpp>
8 #include <boost/core/lightweight_test_trait.hpp>
9 #include <boost/histogram/detail/relaxed_equal.hpp>
10 #include "std_ostream.hpp"
11 
12 using namespace boost::histogram::detail;
13 
main()14 int main() {
15   struct Stateless {
16   } a, b;
17 
18   struct Stateful {
19     int state; // has state
20   } c, d;
21 
22   struct HasEqual {
23     int state;
24     bool operator==(const HasEqual& rhs) const { return state == rhs.state; }
25   } e{1}, f{1}, g{2};
26 
27   BOOST_TEST(relaxed_equal{}(a, b));
28   BOOST_TEST_NOT(relaxed_equal{}(a, c));
29   BOOST_TEST_NOT(relaxed_equal{}(c, d));
30   BOOST_TEST(relaxed_equal{}(e, f));
31   BOOST_TEST_NOT(relaxed_equal{}(e, g));
32 
33   return boost::report_errors();
34 }
35