File indexing completed on 2024-04-28 03:51:39

0001 /*
0002     This file is part of the KDE Baloo project.
0003     SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-or-later
0006 */
0007 
0008 #include "documentdatadb.h"
0009 #include "singledbtest.h"
0010 
0011 using namespace Baloo;
0012 
0013 class DocumentDataDBTest : public SingleDBTest
0014 {
0015     Q_OBJECT
0016 private Q_SLOTS:
0017     void test() {
0018         DocumentDataDB db(DocumentDataDB::create(m_txn), m_txn);
0019 
0020         QByteArray arr = "/home/blah";
0021         db.put(1, arr);
0022 
0023         QCOMPARE(db.get(1), arr);
0024         QVERIFY(db.contains(1));
0025 
0026         db.del(1);
0027         QCOMPARE(db.get(1), QByteArray());
0028         QVERIFY(!db.contains(1));
0029     }
0030 };
0031 
0032 QTEST_MAIN(DocumentDataDBTest)
0033 
0034 #include "documentdatadbtest.moc"