File indexing completed on 2024-04-21 04:40:05
0001 /* This file is part of the KDE project 0002 Copyright (C) 2011 Adam Pigg <piggz1@gmail.com> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #include "StaticSetOfStringsTest.h" 0021 #include <QtTest> 0022 0023 QTEST_GUILESS_MAIN(StaticSetOfStringsTest) 0024 0025 const char* StaticSetOfStringsTest::keywords[] = { 0026 "ABORT", 0027 "ABSOLUTE", 0028 "ACCESS", 0029 "ACTION", 0030 "ADD", 0031 "AGGREGATE", 0032 "ALTER", 0033 "ANALYSE", 0034 "ANALYZE", 0035 "ANY", 0036 "ARRAY", 0037 "ASSERTION", 0038 "ASSIGNMENT", 0039 "AT", 0040 "AUTHORIZATION", 0041 "BACKWARD", 0042 "BIGINT", 0043 "BINARY", 0044 nullptr 0045 }; 0046 0047 void StaticSetOfStringsTest::initTestCase() 0048 { 0049 strings.setStrings(keywords); 0050 } 0051 0052 void StaticSetOfStringsTest::testContains() 0053 { 0054 QVERIFY(strings.contains("ANY")); //test a random string 0055 QVERIFY(strings.contains(QString("backward").toUpper().toLocal8Bit())); 0056 QVERIFY(!strings.contains("BIGIN")); //test a sub-string 0057 QVERIFY(!strings.contains("XXXXXXXXXX")); //test some garbage 0058 QVERIFY(!strings.isEmpty()); 0059 QVERIFY(strings.contains("ABORT")); //test start of list 0060 QVERIFY(strings.contains("BINARY")); //test end of list 0061 } 0062 0063 void StaticSetOfStringsTest::cleanupTestCase() 0064 { 0065 }