summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-12-06 21:00:51 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-12-06 21:01:49 (GMT)
commit519b8c8767ce938eaa5990d71e5e8901069874f7 (patch)
tree48862e687ac334d8c04f8aa1d802e329fdaf47f5 /Swiften
parent4fc7861cebaa82e5057a7ff7d385b49b79e442a4 (diff)
downloadswift-519b8c8767ce938eaa5990d71e5e8901069874f7.zip
swift-519b8c8767ce938eaa5990d71e5e8901069874f7.tar.bz2
Added IPv6 test.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/QA/NetworkTest/BoostConnectionTest.cpp16
-rw-r--r--Swiften/QA/NetworkTest/DomainNameResolverTest.cpp2
-rw-r--r--Swiften/QA/NetworkTest/SConscript2
3 files changed, 19 insertions, 1 deletions
diff --git a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
index 6d6fddf..0f7f742 100644
--- a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
+++ b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
@@ -25,6 +25,9 @@ class BoostConnectionTest : public CppUnit::TestFixture {
CPPUNIT_TEST(testDestructor);
CPPUNIT_TEST(testDestructor_PendingEvents);
CPPUNIT_TEST(testWrite);
+#ifdef TEST_IPV6
+ CPPUNIT_TEST(testWrite_IPv6);
+#endif
CPPUNIT_TEST_SUITE_END();
public:
@@ -72,6 +75,19 @@ class BoostConnectionTest : public CppUnit::TestFixture {
testling->disconnect();
}
+ void testWrite_IPv6() {
+ BoostConnection::ref testling(BoostConnection::create(&boostIOServiceThread_->getIOService(), eventLoop_));
+ testling->onConnectFinished.connect(boost::bind(&BoostConnectionTest::doWrite, this, testling.get()));
+ testling->onDataRead.connect(boost::bind(&BoostConnectionTest::handleDataRead, this, _1));
+ testling->onDisconnected.connect(boost::bind(&BoostConnectionTest::handleDisconnected, this));
+ testling->connect(HostAddressPort(HostAddress("2001:470:1f0e:852::2"), 80));
+ while (receivedData.isEmpty()) {
+ Swift::sleep(10);
+ eventLoop_->processEvents();
+ }
+ testling->disconnect();
+ }
+
void doWrite(BoostConnection* connection) {
connection->write(ByteArray("<stream:stream>"));
}
diff --git a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
index c853d68..1bda585 100644
--- a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
+++ b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
@@ -79,7 +79,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture {
waitForResults();
CPPUNIT_ASSERT(!addressQueryError);
- CPPUNIT_ASSERT_EQUAL(std::string("::ffff:10.0.1.4"), addressQueryResult[0].toString());
+ CPPUNIT_ASSERT_EQUAL(std::string("2001:470:1f0e:852::2"), addressQueryResult[0].toString());
}
void testResolveAddress_IPv4and6() {
diff --git a/Swiften/QA/NetworkTest/SConscript b/Swiften/QA/NetworkTest/SConscript
index 33c4b6d..f9308f6 100644
--- a/Swiften/QA/NetworkTest/SConscript
+++ b/Swiften/QA/NetworkTest/SConscript
@@ -4,6 +4,8 @@ Import("env")
if env["TEST"] :
myenv = env.Clone()
+ if "test_ipv6" in ARGUMENTS :
+ myenv.Append(CPPDEFINES = ["TEST_IPV6"])
myenv.MergeFlags(myenv["CHECKER_FLAGS"])
myenv.MergeFlags(myenv["SWIFTEN_FLAGS"])
myenv.MergeFlags(myenv["CPPUNIT_FLAGS"])