diff --git a/src/test/fuzz/addrman.cpp b/src/test/fuzz/addrman.cpp
index 3699abb597704..ba917dec2a1fc 100644
--- a/src/test/fuzz/addrman.cpp
+++ b/src/test/fuzz/addrman.cpp
@@ -137,7 +137,7 @@ class AddrManDeterministic : public AddrMan
      * - vvNew entries refer to the same addresses
      * - vvTried entries refer to the same addresses
      */
-    bool operator==(const AddrManDeterministic& other)
+    bool operator==(const AddrManDeterministic& other) const
     {
         LOCK2(m_impl->cs, other.m_impl->cs);
 
diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp
index 2441847f99313..8c7c650cb1656 100644
--- a/src/test/serialize_tests.cpp
+++ b/src/test/serialize_tests.cpp
@@ -38,13 +38,13 @@ class CSerializeMethodsTestSingle
         READWRITE(obj.txval);
     }
 
-    bool operator==(const CSerializeMethodsTestSingle& rhs)
+    bool operator==(const CSerializeMethodsTestSingle& rhs) const
     {
-        return  intval == rhs.intval && \
-                boolval == rhs.boolval && \
-                stringval == rhs.stringval && \
-                strcmp(charstrval, rhs.charstrval) == 0 && \
-                *txval == *rhs.txval;
+        return intval == rhs.intval &&
+               boolval == rhs.boolval &&
+               stringval == rhs.stringval &&
+               strcmp(charstrval, rhs.charstrval) == 0 &&
+               *txval == *rhs.txval;
     }
 };