add unittest for IXWebSocketPerMessageDeflateCompressor
This commit is contained in:
parent
7c1b57c8cd
commit
e2180a1f31
@ -55,6 +55,7 @@ set (SOURCES
|
|||||||
IXSentryClientTest.cpp
|
IXSentryClientTest.cpp
|
||||||
IXWebSocketChatTest.cpp
|
IXWebSocketChatTest.cpp
|
||||||
IXWebSocketBroadcastTest.cpp
|
IXWebSocketBroadcastTest.cpp
|
||||||
|
IXWebSocketPerMessageDeflateCompressorTest.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Some unittest don't work on windows yet
|
# Some unittest don't work on windows yet
|
||||||
|
36
test/IXWebSocketPerMessageDeflateCompressorTest.cpp
Normal file
36
test/IXWebSocketPerMessageDeflateCompressorTest.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* IXSocketTest.cpp
|
||||||
|
* Author: Korchynskyi Dmytro
|
||||||
|
* Copyright (c) 2019 Machine Zone. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "IXTest.h"
|
||||||
|
#include "catch.hpp"
|
||||||
|
#include <iostream>
|
||||||
|
#include <ixwebsocket/IXWebSocketPerMessageDeflateCodec.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
using namespace ix;
|
||||||
|
|
||||||
|
namespace ix
|
||||||
|
{
|
||||||
|
TEST_CASE("per-message-deflate-codec", "[zlib]")
|
||||||
|
{
|
||||||
|
SECTION("http://google.com")
|
||||||
|
{
|
||||||
|
std::string a = "foobarbaz";
|
||||||
|
std::string b, c;
|
||||||
|
|
||||||
|
WebSocketPerMessageDeflateCompressor compressor;
|
||||||
|
compressor.compress(a, b);
|
||||||
|
|
||||||
|
WebSocketPerMessageDeflateDecompressor decompressor;
|
||||||
|
decompressor.decompress(b, c);
|
||||||
|
|
||||||
|
REQUIRE(a != b);
|
||||||
|
REQUIRE(b != c);
|
||||||
|
REQUIRE(a == c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ix
|
Loading…
Reference in New Issue
Block a user