Changeset View
Changeset View
Standalone View
Standalone View
autotests/unit/engine/positiondbtest.cpp
Show All 14 Lines | |||||
15 | * You should have received a copy of the GNU Lesser General Public | 15 | * You should have received a copy of the GNU Lesser General Public | ||
16 | * License along with this library; if not, write to the Free Software | 16 | * License along with this library; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | * | 18 | * | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "positiondb.h" | 21 | #include "positiondb.h" | ||
22 | #include "positioninfo.h" | 22 | #include "positioninfo.h" | ||
23 | #include "postingiterator.h" | 23 | #include "vectorpositioninfoiterator.h" | ||
24 | #include "singledbtest.h" | 24 | #include "singledbtest.h" | ||
25 | 25 | | |||
26 | using namespace Baloo; | 26 | using namespace Baloo; | ||
27 | 27 | | |||
28 | class PositionDBTest : public SingleDBTest | 28 | class PositionDBTest : public SingleDBTest | ||
29 | { | 29 | { | ||
30 | Q_OBJECT | 30 | Q_OBJECT | ||
31 | private Q_SLOTS: | 31 | private Q_SLOTS: | ||
Show All 27 Lines | 51 | void testIter() { | |||
59 | PositionInfo pos2; | 59 | PositionInfo pos2; | ||
60 | pos2.docId = 5; | 60 | pos2.docId = 5; | ||
61 | pos2.positions = QVector<uint>() << 41 << 96 << 116; | 61 | pos2.positions = QVector<uint>() << 41 << 96 << 116; | ||
62 | 62 | | |||
63 | QVector<PositionInfo> list = {pos1, pos2}; | 63 | QVector<PositionInfo> list = {pos1, pos2}; | ||
64 | 64 | | |||
65 | db.put(word, list); | 65 | db.put(word, list); | ||
66 | 66 | | |||
67 | QScopedPointer<PostingIterator> it{db.iter(word)}; | 67 | QScopedPointer<VectorPositionInfoIterator> it{db.iter(word)}; | ||
68 | QCOMPARE(it->docId(), static_cast<quint64>(0)); | 68 | QCOMPARE(it->docId(), static_cast<quint64>(0)); | ||
69 | QVERIFY(it->positions().isEmpty()); | 69 | QVERIFY(it->positions().isEmpty()); | ||
70 | 70 | | |||
71 | QCOMPARE(it->next(), static_cast<quint64>(1)); | 71 | QCOMPARE(it->next(), static_cast<quint64>(1)); | ||
72 | QCOMPARE(it->docId(), static_cast<quint64>(1)); | 72 | QCOMPARE(it->docId(), static_cast<quint64>(1)); | ||
73 | QCOMPARE(it->positions(), pos1.positions); | 73 | QCOMPARE(it->positions(), pos1.positions); | ||
74 | 74 | | |||
75 | QCOMPARE(it->next(), static_cast<quint64>(5)); | 75 | QCOMPARE(it->next(), static_cast<quint64>(5)); | ||
Show All 12 Lines |