summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2016-02-09 12:23:23 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-02-10 09:25:43 (GMT)
commit59c64a11e0bceca4876ba69ef2f30519629b108c (patch)
tree391c4bf8ed5bdc3a31a01c0d0d0489352dd7b239 /Swiften/JID
parent062ba3f8d7e99008863499c02224c1aae7b31d8d (diff)
downloadswift-59c64a11e0bceca4876ba69ef2f30519629b108c.zip
swift-59c64a11e0bceca4876ba69ef2f30519629b108c.tar.bz2
Add more tests for JID validity
Test-Information: Tests pass locally (OS/X 10.11.3) Change-Id: I223cdf213f87a4efd574bdd917556aec23e4fd4c
Diffstat (limited to 'Swiften/JID')
-rw-r--r--Swiften/JID/UnitTest/JIDTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Swiften/JID/UnitTest/JIDTest.cpp b/Swiften/JID/UnitTest/JIDTest.cpp
index 2b6f2a8..307243a 100644
--- a/Swiften/JID/UnitTest/JIDTest.cpp
+++ b/Swiften/JID/UnitTest/JIDTest.cpp
@@ -72,6 +72,7 @@ class JIDTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain());
CPPUNIT_ASSERT_EQUAL(std::string("baz"), testling.getResource());
CPPUNIT_ASSERT(!testling.isBare());
+ CPPUNIT_ASSERT(testling.isValid());
}
void testConstructorWithString_NoResource() {
@@ -81,6 +82,7 @@ class JIDTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain());
CPPUNIT_ASSERT_EQUAL(std::string(""), testling.getResource());
CPPUNIT_ASSERT(testling.isBare());
+ CPPUNIT_ASSERT(testling.isValid());
}
void testConstructorWithString_EmptyResource() {
@@ -97,6 +99,7 @@ class JIDTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain());
CPPUNIT_ASSERT_EQUAL(std::string("baz"), testling.getResource());
CPPUNIT_ASSERT(!testling.isBare());
+ CPPUNIT_ASSERT(testling.isValid());
}
void testConstructorWithString_OnlyDomain() {
@@ -106,6 +109,7 @@ class JIDTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain());
CPPUNIT_ASSERT_EQUAL(std::string(""), testling.getResource());
CPPUNIT_ASSERT(testling.isBare());
+ CPPUNIT_ASSERT(testling.isValid());
}
void testConstructorWithString_InvalidDomain() {
@@ -117,18 +121,21 @@ class JIDTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(std::string("fo\xCF\x89"), testling.getNode());
CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain());
+ CPPUNIT_ASSERT(testling.isValid());
}
void testConstructorWithString_UpperCaseDomain() {
JID testling("Fo\xCE\xA9");
CPPUNIT_ASSERT_EQUAL(std::string("fo\xCF\x89"), testling.getDomain());
+ CPPUNIT_ASSERT(testling.isValid());
}
void testConstructorWithString_UpperCaseResource() {
JID testling("bar/Fo\xCE\xA9");
CPPUNIT_ASSERT_EQUAL(testling.getResource(), std::string("Fo\xCE\xA9"));
+ CPPUNIT_ASSERT(testling.isValid());
}
void testConstructorWithString_EmptyNode() {
@@ -154,6 +161,7 @@ class JIDTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(std::string("foo"), testling.getNode());
CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain());
CPPUNIT_ASSERT_EQUAL(std::string("baz"), testling.getResource());
+ CPPUNIT_ASSERT(testling.isValid());
}
void testConstructorWithStrings_EmptyDomain() {
@@ -184,6 +192,7 @@ class JIDTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(std::string(""), testling.toBare().getNode());
CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.toBare().getDomain());
CPPUNIT_ASSERT(testling.toBare().isBare());
+ CPPUNIT_ASSERT(testling.isValid());
}
void testToBare_EmptyResource() {