summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2018-10-10 08:49:02 (GMT)
committerTobias Markmann <tm@ayena.de>2018-10-10 14:24:27 (GMT)
commit66b60e9ac2ef9c12d22dcc31201e22e6eeb4804d (patch)
treea4201c9f537b3ad6cb66b9c4408c2ce22248dc19 /Swiften/JID/UnitTest
parent5c7ac2eeb74e7c29b72f2e78065ff814dc3a6939 (diff)
downloadswift-66b60e9ac2ef9c12d22dcc31201e22e6eeb4804d.zip
swift-66b60e9ac2ef9c12d22dcc31201e22e6eeb4804d.tar.bz2
Remove JID prep caching from JID class
Ran a flamegraph diff on Swift login to an account with a moderate number of JIDs in roster and more than 10 rooms in auto join. It showed a difference less that 0.1% on the changed method. As it does not make much of a difference for Swift at least, caching is removed. Test-Information: Unit tests passes, Swift still logins fine on macOS. Change-Id: Id33d6d1a655580e06e1364df717fd6f34cce5327
Diffstat (limited to 'Swiften/JID/UnitTest')
-rw-r--r--Swiften/JID/UnitTest/JIDTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Swiften/JID/UnitTest/JIDTest.cpp b/Swiften/JID/UnitTest/JIDTest.cpp
index 0101a4f..aefda33 100644
--- a/Swiften/JID/UnitTest/JIDTest.cpp
+++ b/Swiften/JID/UnitTest/JIDTest.cpp
@@ -64,6 +64,7 @@ class JIDTest : public CppUnit::TestFixture
64 CPPUNIT_TEST(testGetEscapedNode_BackslashAtEnd); 64 CPPUNIT_TEST(testGetEscapedNode_BackslashAtEnd);
65 CPPUNIT_TEST(testGetUnescapedNode); 65 CPPUNIT_TEST(testGetUnescapedNode);
66 CPPUNIT_TEST(testGetUnescapedNode_XEP106Examples); 66 CPPUNIT_TEST(testGetUnescapedNode_XEP106Examples);
67 CPPUNIT_TEST(testStringPrepFailures);
67 CPPUNIT_TEST_SUITE_END(); 68 CPPUNIT_TEST_SUITE_END();
68 69
69 public: 70 public:
@@ -159,6 +160,12 @@ class JIDTest : public CppUnit::TestFixture
159 CPPUNIT_ASSERT(!testling.isValid()); 160 CPPUNIT_ASSERT(!testling.isValid());
160 } 161 }
161 162
163 void testStringPrepFailures() {
164 CPPUNIT_ASSERT_EQUAL(false, JID("foo@bar", "example.com").isValid());
165 CPPUNIT_ASSERT_EQUAL(false, JID("foo^", "example*com").isValid());
166 CPPUNIT_ASSERT_EQUAL(false, JID("foobar", "example^com").isValid());
167 }
168
162 void testConstructorWithString_EmptyDomainWithResource() { 169 void testConstructorWithString_EmptyDomainWithResource() {
163 JID testling("bar@/resource"); 170 JID testling("bar@/resource");
164 171