(ixwebsocket) Fix #252 / regression in 11.0.2 with string comparisons
This commit is contained in:
@ -13,7 +13,6 @@ option(USE_TLS "Add TLS support" ON)
|
||||
set (TEST_TARGET_NAMES
|
||||
IXSocketTest
|
||||
IXSocketConnectTest
|
||||
# IXWebSocketLeakTest.cpp # commented until we have a fix for #224
|
||||
IXWebSocketServerTest
|
||||
IXWebSocketTestConnectionDisconnection
|
||||
IXUrlParserTest
|
||||
@ -28,6 +27,7 @@ set (TEST_TARGET_NAMES
|
||||
IXWebSocketBroadcastTest
|
||||
IXWebSocketPerMessageDeflateCompressorTest
|
||||
IXStreamSqlTest
|
||||
IXStrCaseCompareTest
|
||||
)
|
||||
|
||||
# Some unittest don't work on windows yet
|
||||
@ -47,6 +47,9 @@ endif()
|
||||
# IXWebSocketPingTest.cpp
|
||||
# IXWebSocketPingTimeoutTest.cpp
|
||||
|
||||
# IXWebSocketLeakTest.cpp # commented until we have a fix for #224 /
|
||||
# that was was fixed but now the test does not compile
|
||||
|
||||
# Disable tests for now that are failing or not reliable
|
||||
|
||||
find_package(JsonCpp)
|
||||
|
46
test/IXStrCaseCompareTest.cpp
Normal file
46
test/IXStrCaseCompareTest.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* IXStrCaseCompareTest.cpp
|
||||
* Author: Benjamin Sergeant
|
||||
* Copyright (c) 2020 Machine Zone. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "IXTest.h"
|
||||
#include "catch.hpp"
|
||||
#include <iostream>
|
||||
#include <ixwebsocket/IXUrlParser.h>
|
||||
#include <string.h>
|
||||
|
||||
using namespace ix;
|
||||
|
||||
namespace ix
|
||||
{
|
||||
TEST_CASE("str_case_compare", "[str_case_compare]")
|
||||
{
|
||||
SECTION("1")
|
||||
{
|
||||
using HttpHeaders = std::map<std::string, std::string, CaseInsensitiveLess>;
|
||||
|
||||
HttpHeaders httpHeaders;
|
||||
|
||||
httpHeaders["foo"] = "foo";
|
||||
|
||||
REQUIRE(httpHeaders["foo"] == "foo");
|
||||
REQUIRE(httpHeaders["missing"] == "");
|
||||
|
||||
// Comparison should be case insensitive
|
||||
REQUIRE(httpHeaders["Foo"] == "foo");
|
||||
}
|
||||
|
||||
SECTION("2")
|
||||
{
|
||||
using HttpHeaders = std::map<std::string, std::string, CaseInsensitiveLess>;
|
||||
|
||||
HttpHeaders headers;
|
||||
|
||||
headers["Upgrade"] = "webSocket";
|
||||
|
||||
REQUIRE(CaseInsensitiveLess::cmp(headers["upgrade"], "WebSocket") == 0);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ix
|
Reference in New Issue
Block a user