[Libreoffice-commits] online.git: loolwsd/test

Tor Lillqvist tml at collabora.com
Wed Apr 27 11:09:14 UTC 2016


 loolwsd/test/httpwstest.cpp |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 8480cad8ee098d0de2246fce4f48ca16f9c7f2b7
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Apr 27 10:20:25 2016 +0300

    Use CPPUNIT_ASSERT_EQUAL
    
    It is useful to see the expected and actual values when the assertion
    fails.

diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 299b1e0..13f121c 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -232,21 +232,19 @@ void HTTPWSTest::testHandShake()
         {
             // After document broker finish searching it sends editlok
             // it should be at end on handshake
-            CPPUNIT_ASSERT(prefixEdit.compare(0, prefixEdit.size(), buffer, 0, prefixEdit.size()) == 0);
+            CPPUNIT_ASSERT_EQUAL(prefixEdit, std::string(buffer, bytes));
             CPPUNIT_ASSERT(flags == Poco::Net::WebSocket::FRAME_TEXT);
 
             payload = "statusindicator: connect";
             bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
-            CPPUNIT_ASSERT_EQUAL((int) payload.size(), bytes);
-            CPPUNIT_ASSERT(payload.compare(0, payload.size(), buffer, 0, bytes) == 0);
+            CPPUNIT_ASSERT_EQUAL(payload, std::string(buffer, bytes));
             CPPUNIT_ASSERT(flags == Poco::Net::WebSocket::FRAME_TEXT);
 
             bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
             if (!std::strstr(buffer, fail))
             {
                 payload = "statusindicator: ready";
-                CPPUNIT_ASSERT_EQUAL((int) payload.size(), bytes);
-                CPPUNIT_ASSERT(payload.compare(0, payload.size(), buffer, 0, bytes) == 0);
+                CPPUNIT_ASSERT_EQUAL(payload, std::string(buffer, bytes));
                 CPPUNIT_ASSERT(flags == Poco::Net::WebSocket::FRAME_TEXT);
             }
             else


More information about the Libreoffice-commits mailing list