mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-24 06:04:15 +01:00
case-insensitivity for SessionPool
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstdio>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
|
||||
using Poco::trimLeft;
|
||||
@@ -73,6 +75,7 @@ using Poco::doubleToStr;
|
||||
using Poco::thousandSeparator;
|
||||
using Poco::decimalSeparator;
|
||||
using Poco::format;
|
||||
using Poco::CILess;
|
||||
using Poco::MemoryInputStream;
|
||||
using Poco::Stopwatch;
|
||||
using Poco::RangeException;
|
||||
@@ -305,6 +308,39 @@ void StringTest::testIcompare()
|
||||
}
|
||||
|
||||
|
||||
void StringTest::testCILessThan()
|
||||
{
|
||||
typedef std::map<std::string, int, CILess> CIMapType;
|
||||
CIMapType ciMap;
|
||||
|
||||
ciMap["z"] = 1;
|
||||
ciMap["b"] = 2;
|
||||
ciMap["A"] = 3;
|
||||
ciMap["Z"] = 4;
|
||||
|
||||
assert (ciMap.size() == 3);
|
||||
CIMapType::iterator it = ciMap.begin();
|
||||
assert (it->first == "A"); ++it;
|
||||
assert (it->first == "b"); ++it;
|
||||
assert (it->first == "z");
|
||||
assert (it->second == 4);
|
||||
|
||||
typedef std::set<std::string, CILess> CISetType;
|
||||
|
||||
CISetType ciSet;
|
||||
ciSet.insert("z");
|
||||
ciSet.insert("b");
|
||||
ciSet.insert("A");
|
||||
ciSet.insert("Z");
|
||||
|
||||
assert (ciSet.size() == 3);
|
||||
CISetType::iterator sIt = ciSet.begin();
|
||||
assert (*sIt == "A"); ++sIt;
|
||||
assert (*sIt == "b"); ++sIt;
|
||||
assert (*sIt == "z");
|
||||
}
|
||||
|
||||
|
||||
void StringTest::testTranslate()
|
||||
{
|
||||
std::string s = "aabbccdd";
|
||||
@@ -1080,6 +1116,7 @@ CppUnit::Test* StringTest::suite()
|
||||
CppUnit_addTest(pSuite, StringTest, testToLower);
|
||||
CppUnit_addTest(pSuite, StringTest, testIstring);
|
||||
CppUnit_addTest(pSuite, StringTest, testIcompare);
|
||||
CppUnit_addTest(pSuite, StringTest, testCILessThan);
|
||||
CppUnit_addTest(pSuite, StringTest, testTranslate);
|
||||
CppUnit_addTest(pSuite, StringTest, testTranslateInPlace);
|
||||
CppUnit_addTest(pSuite, StringTest, testReplace);
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
void testToLower();
|
||||
void testIstring();
|
||||
void testIcompare();
|
||||
void testCILessThan();
|
||||
void testTranslate();
|
||||
void testTranslateInPlace();
|
||||
void testReplace();
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "Poco/Windows1250Encoding.h"
|
||||
#include "Poco/Windows1251Encoding.h"
|
||||
#include "Poco/Windows1252Encoding.h"
|
||||
#include "Poco/UTF8Encoding.h"
|
||||
|
||||
|
||||
using namespace Poco;
|
||||
@@ -105,6 +106,10 @@ void TextEncodingTest::testTextEncoding()
|
||||
TextEncoding::global(new Windows1252Encoding);
|
||||
TextEncoding& glob7 = TextEncoding::global();
|
||||
assert (std::string("Windows-1252") == glob7.canonicalName());
|
||||
|
||||
TextEncoding::global(new UTF8Encoding);
|
||||
TextEncoding& glob8 = TextEncoding::global();
|
||||
assert (std::string("UTF-8") == glob8.canonicalName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user