diff options
author | Tobias Markmann <tm@ayena.de> | 2016-11-23 07:09:39 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-11-23 11:30:02 (GMT) |
commit | e405ff3561be3d3c0bd79d7d5173923a8828cf02 (patch) | |
tree | 9118ef838ebfaec1df90ec24761944b5d833774c /Swift/Controllers/UnitTest | |
parent | 8a71b91be885652f37c5aab5e1ecf25af4599fbc (diff) | |
download | swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.zip swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.tar.bz2 |
Migrate remaining Swiften/Base/foreach.h use to range-based for loop
Test-Information:
Build on macOS 10.12.1 and all tests pass.
Change-Id: Iedaa3fa7e7672c77909fd0568bf30e9393cb87e0
Diffstat (limited to 'Swift/Controllers/UnitTest')
-rw-r--r-- | Swift/Controllers/UnitTest/ContactSuggesterTest.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Swift/Controllers/UnitTest/ContactSuggesterTest.cpp b/Swift/Controllers/UnitTest/ContactSuggesterTest.cpp index 217a2f0..6ac51b2 100644 --- a/Swift/Controllers/UnitTest/ContactSuggesterTest.cpp +++ b/Swift/Controllers/UnitTest/ContactSuggesterTest.cpp @@ -12,8 +12,6 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include <Swiften/Base/foreach.h> - #include <Swift/Controllers/ContactSuggester.h> using namespace Swift; @@ -55,9 +53,9 @@ public: std::vector<Contact::ref> contacts; std::vector<std::string> words = wordList(); std::vector<StatusShow::Type> statuses = statusList(); - foreach (const std::string& name, words) { - foreach (const std::string& jid, words) { - foreach (const StatusShow::Type& status, statuses) { + for (const auto& name : words) { + for (const auto& jid : words) { + for (const auto& status : statuses) { contacts.push_back(std::make_shared<Contact>(name, jid, status, "")); } } @@ -68,7 +66,7 @@ public: /* a = a */ bool isReflexive(const boost::function<bool (const Contact::ref&, const Contact::ref&)>& comparitor) { std::vector<Contact::ref> contacts = contactList(); - foreach (const Contact::ref& a, contacts) { + for (const auto& a : contacts) { if (!comparitor(a, a)) { return false; } @@ -79,8 +77,8 @@ public: /* a = b -> b = a */ bool isSymmetric(const boost::function<bool (const Contact::ref&, const Contact::ref&)>& comparitor) { std::vector<Contact::ref> contacts = contactList(); - foreach (const Contact::ref& a, contacts) { - foreach (const Contact::ref& b, contacts) { + for (const auto& a : contacts) { + for (const auto& b : contacts) { if (comparitor(a, b)) { if (!comparitor(b, a)) { return false; @@ -94,9 +92,9 @@ public: /* a = b && b = c -> a = c */ bool isTransitive(const boost::function<bool (const Contact::ref&, const Contact::ref&)>& comparitor) { std::vector<Contact::ref> contacts = contactList(); - foreach (const Contact::ref& a, contacts) { - foreach (const Contact::ref& b, contacts) { - foreach (const Contact::ref& c, contacts) { + for (const auto& a : contacts) { + for (const auto& b : contacts) { + for (const auto& c : contacts) { if (comparitor(a, b) && comparitor(b, c)) { if (!comparitor(a, c)) { return false; @@ -120,7 +118,7 @@ public: void sortTest() { std::vector<std::string> words = wordList(); - foreach (const std::string& word, words) { + for (const auto& word : words) { CPPUNIT_ASSERT(isTransitive(boost::bind(Contact::sortPredicate, _1, _2, word))); } } |