File indexing completed on 2022-11-29 18:25:07

0001 /*
0002     Copyright (c) 2006 Volker Krause <vkrause@kde.org>
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 #include "kasciitest.h"
0020 #include "qtest_kde.h"
0021 
0022 #include <kascii.h>
0023 
0024 QTEST_KDEMAIN_CORE(KAsciiTest)
0025 
0026 void KAsciiTest::testkasciistricmp()
0027 {
0028     QVERIFY(kasciistricmp("test", "test") == 0);
0029     QVERIFY(kasciistricmp("test", "Test") == 0);
0030     QVERIFY(kasciistricmp("TeSt", "tEst") == 0);
0031 
0032     QVERIFY(kasciistricmp(nullptr, nullptr) == 0);
0033     QVERIFY(kasciistricmp("", "") == 0);
0034     QVERIFY(kasciistricmp(nullptr, "") < 0);
0035     QVERIFY(kasciistricmp("", nullptr) > 0);
0036 
0037     QVERIFY(kasciistricmp("", "foo") < 0);
0038     QVERIFY(kasciistricmp("foo", "") > 0);
0039 
0040     QVERIFY(kasciistricmp("test", "testtest") < 0);
0041     QVERIFY(kasciistricmp("testtest", "test") > 0);
0042 
0043     QVERIFY(kasciistricmp("a", "b") < 0);
0044     QVERIFY(kasciistricmp("b", "a") > 0);
0045     QVERIFY(kasciistricmp("A", "b") < 0);
0046     QVERIFY(kasciistricmp("b", "A") > 0);
0047     QVERIFY(kasciistricmp("a", "B") < 0);
0048     QVERIFY(kasciistricmp("B", "a") > 0);
0049     QVERIFY(kasciistricmp("A", "B") < 0);
0050     QVERIFY(kasciistricmp("B", "A") > 0);
0051 }
0052