Declare overloaded comparison operators as non-member functions
Change-Id: I4fd4638c29d01b39df69ad6d8cbc3a0dc9604db3
diff --git a/tests/unit/util/signal.t.cpp b/tests/unit/util/signal.t.cpp
index f0eb192..2c53336 100644
--- a/tests/unit/util/signal.t.cpp
+++ b/tests/unit/util/signal.t.cpp
@@ -444,6 +444,35 @@
BOOST_CHECK_EQUAL(hit, 2); // handler called
}
+BOOST_AUTO_TEST_CASE(ConnectionEquality)
+{
+ SignalOwner0 so;
+
+ Connection conn1, conn2;
+ BOOST_CHECK(conn1 == conn2);
+
+ conn1 = so.sig.connect([]{});
+ BOOST_CHECK(conn1 != conn2);
+
+ conn2 = so.sig.connect([]{});
+ BOOST_CHECK(conn1 != conn2);
+
+ conn1.disconnect();
+ BOOST_CHECK(conn1 != conn2);
+ BOOST_CHECK(conn1 == Connection{});
+
+ conn2.disconnect();
+ BOOST_CHECK(conn1 == conn2);
+
+ conn1 = conn2 = so.sig.connect([]{});
+ BOOST_CHECK(conn1 == conn2);
+ BOOST_CHECK(conn1 != Connection{});
+
+ conn1.disconnect();
+ BOOST_CHECK(conn1 == conn2);
+ BOOST_CHECK(conn1 == Connection{});
+}
+
BOOST_AUTO_TEST_SUITE_END() // TestSignal
BOOST_AUTO_TEST_SUITE_END() // Util