integrated changes from 1.3.5

This commit is contained in:
Guenter Obiltschnig
2009-06-16 17:04:40 +00:00
parent 99c48cff49
commit c93c16008b
9 changed files with 53 additions and 62 deletions

View File

@@ -1,7 +1,7 @@
//
// DNSTest.cpp
//
// $Id: //poco/svn/Net/testsuite/src/DNSTest.cpp#2 $
// $Id: //poco/Main/Net/testsuite/src/DNSTest.cpp#8 $
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
@@ -61,10 +61,13 @@ void DNSTest::testHostByName()
{
HostEntry he1 = DNS::hostByName("www.appinf.com");
assert (he1.name() == "appinf.com");
#if !defined(_WIN32) && !defined(POCO_HAVE_IPv6)
// getaddrinfo() does not report any aliases
assert (!he1.aliases().empty());
assert (he1.aliases()[0] == "www.appinf.com");
#endif
assert (he1.addresses().size() == 1);
assert (he1.addresses()[0].toString() == "213.229.60.82");
assert (he1.addresses()[0].toString() == "216.146.46.35");
try
{
@@ -82,12 +85,12 @@ void DNSTest::testHostByName()
void DNSTest::testHostByAddress()
{
IPAddress ip1("213.229.60.82");
IPAddress ip1("216.146.46.35");
HostEntry he1 = DNS::hostByAddress(ip1);
assert (he1.name() == "quentin.inode.at");
assert (he1.name() == "web.appinf.com");
assert (he1.aliases().empty());
assert (he1.addresses().size() == 1);
assert (he1.addresses()[0].toString() == "213.229.60.82");
assert (he1.addresses()[0].toString() == "216.146.46.35");
IPAddress ip2("10.0.244.253");
try

View File

@@ -1,7 +1,7 @@
//
// NameValueCollectionTest.cpp
//
// $Id: //poco/svn/Net/testsuite/src/NameValueCollectionTest.cpp#2 $
// $Id: //poco/Main/Net/testsuite/src/NameValueCollectionTest.cpp#7 $
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
@@ -108,7 +108,7 @@ void NameValueCollectionTest::testNameValueCollection()
std::string v2 = it->second;
assert (it->first == "name3");
assert (v1 == "value3" && v2 == "value31" || v1 == "value31" && v2 == "value3");
assert ((v1 == "value3" && v2 == "value31") || (v1 == "value31" && v2 == "value3"));
nvc.erase("name3");
assert (!nvc.has("name3"));

View File

@@ -1,7 +1,7 @@
//
// SocketTest.cpp
//
// $Id: //poco/1.3/Net/testsuite/src/SocketTest.cpp#2 $
// $Id: //poco/Main/Net/testsuite/src/SocketTest.cpp#10 $
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
@@ -282,8 +282,8 @@ void SocketTest::testTimeout()
void SocketTest::testBufferSize()
{
EchoServer echoServer;
StreamSocket ss;
ss.connect(SocketAddress("localhost", echoServer.port()));
SocketAddress sa("localhost", 1234);
StreamSocket ss(sa.family());
int osz = ss.getSendBufferSize();
int rsz = 32000;
@@ -335,15 +335,6 @@ void SocketTest::testOptions()
void SocketTest::testSelect()
{
doSelectOrPoll1(Socket::select);
#if defined(POCO_HAVE_FD_POLL)
doSelectOrPoll1(Socket::poll);
#endif
}
void SocketTest::doSelectOrPoll1(SelectPtr pAction)
{
Timespan timeout(250000);
@@ -356,7 +347,7 @@ void SocketTest::doSelectOrPoll1(SelectPtr pAction)
Socket::SocketList exceptList;
readList.push_back(ss);
assert (pAction(readList, writeList, exceptList, timeout) == 0);
assert (Socket::select(readList, writeList, exceptList, timeout) == 0);
assert (readList.empty());
assert (writeList.empty());
assert (exceptList.empty());
@@ -367,7 +358,7 @@ void SocketTest::doSelectOrPoll1(SelectPtr pAction)
readList.push_back(ss);
writeList.push_back(ss);
assert (pAction(readList, writeList, exceptList, timeout) == 2);
assert (Socket::select(readList, writeList, exceptList, timeout) == 2);
assert (!readList.empty());
assert (!writeList.empty());
assert (exceptList.empty());
@@ -381,15 +372,6 @@ void SocketTest::doSelectOrPoll1(SelectPtr pAction)
void SocketTest::testSelect2()
{
doSelectOrPoll2(Socket::select);
#if defined(POCO_HAVE_FD_POLL)
doSelectOrPoll2(Socket::poll);
#endif
}
void SocketTest::doSelectOrPoll2(SelectPtr pAction)
{
Timespan timeout(100000);
@@ -404,7 +386,7 @@ void SocketTest::doSelectOrPoll2(SelectPtr pAction)
readList.push_back(ss1);
readList.push_back(ss2);
assert (pAction(readList, writeList, exceptList, timeout) == 0);
assert (Socket::select(readList, writeList, exceptList, timeout) == 0);
assert (readList.empty());
assert (writeList.empty());
assert (exceptList.empty());
@@ -415,7 +397,7 @@ void SocketTest::doSelectOrPoll2(SelectPtr pAction)
readList.push_back(ss1);
readList.push_back(ss2);
assert (pAction(readList, writeList, exceptList, timeout) == 1);
assert (Socket::select(readList, writeList, exceptList, timeout) == 1);
assert (readList.size() == 1);
assert (readList[0] == ss1);
@@ -431,7 +413,7 @@ void SocketTest::doSelectOrPoll2(SelectPtr pAction)
exceptList.clear();
writeList.push_back(ss1);
writeList.push_back(ss2);
assert (pAction(readList, writeList, exceptList, timeout) == 2);
assert (Socket::select(readList, writeList, exceptList, timeout) == 2);
assert (readList.empty());
assert (writeList.size() == 2);
assert (writeList[0] == ss1);
@@ -444,22 +426,13 @@ void SocketTest::doSelectOrPoll2(SelectPtr pAction)
void SocketTest::testSelect3()
{
doSelectOrPoll3(Socket::select);
#if defined(POCO_HAVE_FD_POLL)
doSelectOrPoll3(Socket::poll);
#endif
}
void SocketTest::doSelectOrPoll3(SelectPtr pAction)
{
Socket::SocketList readList;
Socket::SocketList writeList;
Socket::SocketList exceptList;
Timespan timeout(1000);
int rc = pAction(readList, writeList, exceptList, timeout);
int rc = Socket::select(readList, writeList, exceptList, timeout);
assert (rc == 0);
}
@@ -492,5 +465,6 @@ CppUnit::Test* SocketTest::suite()
CppUnit_addTest(pSuite, SocketTest, testSelect);
CppUnit_addTest(pSuite, SocketTest, testSelect2);
CppUnit_addTest(pSuite, SocketTest, testSelect3);
return pSuite;
}