File indexing completed on 2024-10-06 12:24:11

0001 /*
0002     SPDX-FileCopyrightText: 2021 Igor Kushnir <igorkuo@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "katemodemanager_benchmark.h"
0008 
0009 #include <katemodemanager.h>
0010 
0011 #include <QString>
0012 #include <QTest>
0013 
0014 void KateModeManagerBenchmark::benchmarkWildcardsFind_data()
0015 {
0016     wildcardsFindTestData();
0017 }
0018 
0019 void KateModeManagerBenchmark::benchmarkWildcardsFind()
0020 {
0021     QFETCH(QString, fileName);
0022     QFETCH(QString, fileTypeName);
0023 
0024     // Warm up and check correctness.
0025     QCOMPARE(m_modeManager->wildcardsFind(fileName), fileTypeName);
0026 
0027     QBENCHMARK {
0028         m_modeManager->wildcardsFind(fileName);
0029     }
0030 }
0031 
0032 void KateModeManagerBenchmark::benchmarkMimeTypesFind_data()
0033 {
0034     mimeTypesFindTestData();
0035 }
0036 
0037 void KateModeManagerBenchmark::benchmarkMimeTypesFind()
0038 {
0039     QFETCH(QString, mimeTypeName);
0040     QFETCH(QString, fileTypeName);
0041 
0042     // Warm up and check correctness.
0043     QCOMPARE(m_modeManager->mimeTypesFind(mimeTypeName), fileTypeName);
0044 
0045     QBENCHMARK {
0046         m_modeManager->mimeTypesFind(mimeTypeName);
0047     }
0048 }
0049 
0050 QTEST_MAIN(KateModeManagerBenchmark)
0051 
0052 #include "moc_katemodemanager_benchmark.cpp"