mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-06 17:53:23 +08:00
refs #108, added find methods in CSequence and CCollection;
CSequence uses std::find, and CCollection uses the more efficient find method of the implementation type, which requires that the implementation type be an associative container like QSet or std::set. Modified CContainerBase::contains to use these new find methods.
This commit is contained in:
@@ -7,8 +7,10 @@
|
||||
#include "blackmisc/collection.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QSet>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
@@ -19,9 +21,9 @@ namespace BlackMiscTest
|
||||
{
|
||||
CCollection<int> c1;
|
||||
QVERIFY2(c1.empty(), "Uninitialized collection is empty");
|
||||
auto c2 = CCollection<int>::fromImpl(QList<int>());
|
||||
auto c2 = CCollection<int>::fromImpl(QSet<int>());
|
||||
QVERIFY2(c1 == c2, "Uninitialized and empty collections are equal");
|
||||
c1.changeImpl(std::vector<int>());
|
||||
c1.changeImpl(std::set<int>());
|
||||
QVERIFY2(c1 == c2, "Two empty collections are equal");
|
||||
c1.insert(1);
|
||||
QVERIFY2(c1 != c2, "Different collections are not equal");
|
||||
|
||||
Reference in New Issue
Block a user