summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/QA')
-rw-r--r--Swiften/QA/ClientTest/ClientTest.cpp15
-rw-r--r--Swiften/QA/DNSSDTest/DNSSDTest.cpp8
-rw-r--r--Swiften/QA/DNSSDTest/SConscript2
-rw-r--r--Swiften/QA/FileTransferTest/FileTransferTest.cpp9
-rw-r--r--Swiften/QA/NetworkTest/DomainNameResolverTest.cpp10
-rw-r--r--Swiften/QA/StorageTest/SConscript3
-rw-r--r--Swiften/QA/TLSTest/CertificateTest.cpp2
-rw-r--r--Swiften/QA/TLSTest/SConscript2
8 files changed, 32 insertions, 19 deletions
diff --git a/Swiften/QA/ClientTest/ClientTest.cpp b/Swiften/QA/ClientTest/ClientTest.cpp
index 5cb1765..c5117fa 100644
--- a/Swiften/QA/ClientTest/ClientTest.cpp
+++ b/Swiften/QA/ClientTest/ClientTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -8,6 +8,7 @@
#include <thread>
#include <boost/bind.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Client/Client.h>
#include <Swiften/Client/ClientXMLTracer.h>
@@ -74,7 +75,17 @@ int main(int, char**) {
if (boshHost && boshPort && boshPath) {
std::cout << "Using BOSH with URL: http://" << boshHost << ":" << boshPort << boshPath << std::endl;
- options.boshURL = URL("http", boshHost, atoi(boshPort), boshPath);
+ try {
+ options.boshURL = URL("http", boshHost, boost::numeric_cast<unsigned short>(boost::lexical_cast<int>(boshPort)), boshPath);
+ }
+ catch (const boost::numeric::bad_numeric_cast& e) {
+ std::cerr << "SWIFT_CLIENTTEST_BOSH_PORT doesn't hold a valid port number: " << e.what() << std::endl;
+ return -1;
+ }
+ catch (const boost::bad_lexical_cast& e) {
+ std::cerr << "SWIFT_CLIENTTEST_BOSH_PORT doesn't hold a valid port number: " << e.what() << std::endl;
+ return -1;
+ }
}
client = new Swift::Client(JID(jid), std::string(pass), &networkFactories);
diff --git a/Swiften/QA/DNSSDTest/DNSSDTest.cpp b/Swiften/QA/DNSSDTest/DNSSDTest.cpp
index ae2fafd..5a78d2f 100644
--- a/Swiften/QA/DNSSDTest/DNSSDTest.cpp
+++ b/Swiften/QA/DNSSDTest/DNSSDTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -35,7 +35,7 @@ class DNSSDTest : public CppUnit::TestFixture {
public:
void setUp() {
eventLoop = new DummyEventLoop();
- querier = std::make_shared<DNSSDQuerier>();
+ querier = std::make_shared<DNSSDQuerierType>(eventLoop);
querier->start();
}
@@ -55,7 +55,7 @@ class DNSSDTest : public CppUnit::TestFixture {
// Publish the service
LinkLocalServiceInfo info;
- std::shared_ptr<DNSSDRegisterQuery> registerQuery = querier->createRegisterQuery("DNSSDTest", 1234, info.toTXTRecord());
+ std::shared_ptr<DNSSDRegisterQuery> registerQuery = querier->createRegisterQuery("DNSSDTest", 1234, *info.toTXTRecord());
registerQuery->onRegisterFinished.connect(boost::bind(&DNSSDTest::handleRegisterFinished, this, _1));
registerQuery->registerService();
@@ -137,7 +137,7 @@ class DNSSDTest : public CppUnit::TestFixture {
private:
DummyEventLoop* eventLoop;
- std::shared_ptr<DNSSDQuerier> querier;
+ std::shared_ptr<DNSSDQuerierType> querier;
std::vector<DNSSDServiceID> added;
std::vector<DNSSDServiceID> registered;
std::vector<DNSSDServiceID> toRemove;
diff --git a/Swiften/QA/DNSSDTest/SConscript b/Swiften/QA/DNSSDTest/SConscript
index 275a314..d9c9b04 100644
--- a/Swiften/QA/DNSSDTest/SConscript
+++ b/Swiften/QA/DNSSDTest/SConscript
@@ -7,6 +7,7 @@ if env["TEST"] :
myenv.MergeFlags(myenv["CHECKER_FLAGS"])
myenv.MergeFlags(myenv["SWIFTEN_FLAGS"])
myenv.MergeFlags(myenv["CPPUNIT_FLAGS"])
+ myenv.MergeFlags(myenv["GOOGLETEST_FLAGS"])
myenv.MergeFlags(myenv["BOOST_FLAGS"])
myenv.MergeFlags(myenv["LIBIDN_FLAGS"])
if myenv.get("HAVE_BONJOUR", 0) :
@@ -14,6 +15,7 @@ if env["TEST"] :
elif myenv.get("HAVE_AVAHI", 0) :
myenv.Append(CPPDEFINES = ["HAVE_AVAHI"])
myenv.MergeFlags(myenv["AVAHI_FLAGS"])
+ myenv.MergeFlags(myenv["PLATFORM_FLAGS"])
tester = myenv.Program("DNSSDTest", [
"DNSSDTest.cpp",
diff --git a/Swiften/QA/FileTransferTest/FileTransferTest.cpp b/Swiften/QA/FileTransferTest/FileTransferTest.cpp
index ebdb36a..7d69277 100644
--- a/Swiften/QA/FileTransferTest/FileTransferTest.cpp
+++ b/Swiften/QA/FileTransferTest/FileTransferTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2016 Isode Limited.
+ * Copyright (c) 2014-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -8,7 +8,6 @@
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
-#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Base/Debug.h>
@@ -78,14 +77,14 @@ class FileTransferTest {
sendFilePath_ = boost::filesystem::unique_path("ft_send_%%%%%%%%%%%%%%%%.bin");
receiveFilePath_ = boost::filesystem::unique_path("ft_receive_%%%%%%%%%%%%%%%%.bin");
- size_t size = 1024 + boost::numeric_cast<size_t>(randGen.generateRandomInteger(1024 * 10));
+ size_t size = 1024 + static_cast<size_t>(randGen.generateRandomInteger(1024 * 10));
sendData_.resize(size);
for (unsigned char& n : sendData_) {
- n = boost::numeric_cast<unsigned char>(randGen.generateRandomInteger(255));
+ n = static_cast<unsigned char>(randGen.generateRandomInteger(255));
}
std::ofstream outfile(sendFilePath_.native().c_str(), std::ios::out | std::ios::binary);
- outfile.write(reinterpret_cast<char *>(&sendData_[0]), boost::numeric_cast<ptrdiff_t>(sendData_.size()));
+ outfile.write(reinterpret_cast<char *>(&sendData_[0]), static_cast<ptrdiff_t>(sendData_.size()));
outfile.close();
}
diff --git a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
index 95ebb6d..69e6fe8 100644
--- a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
+++ b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -179,19 +179,19 @@ class DomainNameResolverTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(4, static_cast<int>(serviceQueryResult.size()));
CPPUNIT_ASSERT_EQUAL(std::string("xmpp1.test.swift.im"), serviceQueryResult[0].hostname);
- CPPUNIT_ASSERT_EQUAL(5000, serviceQueryResult[0].port);
+ CPPUNIT_ASSERT_EQUAL(static_cast<unsigned short>(5000), serviceQueryResult[0].port);
CPPUNIT_ASSERT_EQUAL(0, serviceQueryResult[0].priority);
CPPUNIT_ASSERT_EQUAL(1, serviceQueryResult[0].weight);
CPPUNIT_ASSERT_EQUAL(std::string("xmpp-invalid.test.swift.im"), serviceQueryResult[1].hostname);
- CPPUNIT_ASSERT_EQUAL(5000, serviceQueryResult[1].port);
+ CPPUNIT_ASSERT_EQUAL(static_cast<unsigned short>(5000), serviceQueryResult[1].port);
CPPUNIT_ASSERT_EQUAL(1, serviceQueryResult[1].priority);
CPPUNIT_ASSERT_EQUAL(100, serviceQueryResult[1].weight);
CPPUNIT_ASSERT_EQUAL(std::string("xmpp3.test.swift.im"), serviceQueryResult[2].hostname);
- CPPUNIT_ASSERT_EQUAL(5000, serviceQueryResult[2].port);
+ CPPUNIT_ASSERT_EQUAL(static_cast<unsigned short>(5000), serviceQueryResult[2].port);
CPPUNIT_ASSERT_EQUAL(3, serviceQueryResult[2].priority);
CPPUNIT_ASSERT_EQUAL(100, serviceQueryResult[2].weight);
CPPUNIT_ASSERT_EQUAL(std::string("xmpp2.test.swift.im"), serviceQueryResult[3].hostname);
- CPPUNIT_ASSERT_EQUAL(5000, serviceQueryResult[3].port);
+ CPPUNIT_ASSERT_EQUAL(static_cast<unsigned short>(5000), serviceQueryResult[3].port);
CPPUNIT_ASSERT_EQUAL(5, serviceQueryResult[3].priority);
CPPUNIT_ASSERT_EQUAL(100, serviceQueryResult[3].weight);
}
diff --git a/Swiften/QA/StorageTest/SConscript b/Swiften/QA/StorageTest/SConscript
index b8360ec..46107a0 100644
--- a/Swiften/QA/StorageTest/SConscript
+++ b/Swiften/QA/StorageTest/SConscript
@@ -10,7 +10,8 @@ if env["TEST"] :
myenv.MergeFlags(myenv["CPPUNIT_FLAGS"])
myenv.MergeFlags(myenv["GOOGLETEST_FLAGS"])
myenv.MergeFlags(myenv["BOOST_FLAGS"])
- myenv.MergeFlags(myenv["LIBIDN_FLAGS"])
+ myenv.MergeFlags(myenv.get("LIBIDN_FLAGS", {}))
+ myenv.MergeFlags(myenv.get("ICU_FLAGS", {}))
myenv.MergeFlags(myenv.get("EXPAT_FLAGS", {}))
myenv.MergeFlags(myenv.get("LIBXML_FLAGS", {}))
myenv.MergeFlags(myenv["PLATFORM_FLAGS"])
diff --git a/Swiften/QA/TLSTest/CertificateTest.cpp b/Swiften/QA/TLSTest/CertificateTest.cpp
index b53cd2f..02ec0f8 100644
--- a/Swiften/QA/TLSTest/CertificateTest.cpp
+++ b/Swiften/QA/TLSTest/CertificateTest.cpp
@@ -34,7 +34,7 @@ class CertificateTest : public CppUnit::TestFixture {
public:
void setUp() {
- pathProvider = std::unique_ptr<PlatformApplicationPathProvider>(new PlatformApplicationPathProvider("FileReadBytestreamTest"));
+ pathProvider = std::make_unique<PlatformApplicationPathProvider>("FileReadBytestreamTest");
readByteArrayFromFile(certificateData, (pathProvider->getExecutableDir() / "jabber_org.crt"));
certificateFactory = std::unique_ptr<CertificateFactory>(new CERTIFICATE_FACTORY());
}
diff --git a/Swiften/QA/TLSTest/SConscript b/Swiften/QA/TLSTest/SConscript
index 7811b50..81e2471 100644
--- a/Swiften/QA/TLSTest/SConscript
+++ b/Swiften/QA/TLSTest/SConscript
@@ -24,4 +24,4 @@ if env["TEST"] :
# Reenable if either http://www.tls-o-matic.com/ is fixed or we have setup a replacement.
#"CertificateErrorTest.cpp"
])
- myenv.Test(tester, "system") \ No newline at end of file
+ myenv.Test(tester, "system")