diff options
Diffstat (limited to 'libcontextsubscriber/unit-tests/cdbreader/cdbreaderunittest.cpp')
-rw-r--r-- | libcontextsubscriber/unit-tests/cdbreader/cdbreaderunittest.cpp | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/libcontextsubscriber/unit-tests/cdbreader/cdbreaderunittest.cpp b/libcontextsubscriber/unit-tests/cdbreader/cdbreaderunittest.cpp deleted file mode 100644 index 0d48a5cd..00000000 --- a/libcontextsubscriber/unit-tests/cdbreader/cdbreaderunittest.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2008, 2009 Nokia Corporation. - * - * Contact: Marius Vollmer <marius.vollmer@nokia.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include <QtTest/QtTest> -#include <QtCore> -#include <stdlib.h> -#include "cdbreader.h" -#include "fileutils.h" - -class CDBReaderUnitTest : public QObject -{ - Q_OBJECT - -private slots: - void basicCreation(); - void doesNotExist(); - void readingNotPresent(); - void readingFromBad(); -}; - -void CDBReaderUnitTest::basicCreation() -{ - CDBReader reader(LOCAL_FILE("test.cdb")); - QCOMPARE(reader.isReadable(), true); - QVERIFY(reader.fileDescriptor() > 0); - - QCOMPARE(reader.valueForKey("KEY1"), QString("KEY1Value")); - - QStringList list = reader.valuesForKey("KEYS"); - QCOMPARE(list.size(), 3); - - QCOMPARE(list.at(0), QString("KEYSValue1")); - QCOMPARE(list.at(1), QString("KEYSValue2")); - QCOMPARE(list.at(2), QString("KEYSValue3")); - - reader.close(); -} - -void CDBReaderUnitTest::doesNotExist() -{ - CDBReader reader("/usr/test.cdb"); - QCOMPARE(reader.isReadable(), false); - reader.close(); -} - -void CDBReaderUnitTest::readingFromBad() -{ - CDBReader reader("/usr/test.cdb"); - QCOMPARE(reader.isReadable(), false); - QVERIFY(reader.fileDescriptor() <= 0); - - QString v = reader.valueForKey("SOMETHING"); - QCOMPARE(v, QString()); -} - -void CDBReaderUnitTest::readingNotPresent() -{ - CDBReader reader(LOCAL_FILE("test.cdb")); - QCOMPARE(reader.isReadable(), true); - - QCOMPARE(reader.valueForKey("DOESNOTEXIST"), QString("")); - - QStringList list = reader.valuesForKey("DOESNOTEXIST"); - QCOMPARE(list.size(), 0); -} - -#include "cdbreaderunittest.moc" -QTEST_MAIN(CDBReaderUnitTest); |