File indexing completed on 2024-05-05 05:51:44

0001 /*
0002     SPDX-FileCopyrightText: 2021 Ilia Kats <ilia-kats@gmx.net>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 // this is just to confirm that string sorting in Python is the same as sorting with Qt
0008 
0009 #include "completiontable.h"
0010 
0011 #include <algorithm>
0012 #include <string>
0013 
0014 #include <QObject>
0015 #include <QTest>
0016 
0017 class LatexCompletionTableTest : public QObject
0018 {
0019     Q_OBJECT
0020 private Q_SLOTS:
0021     static void testSorting()
0022     {
0023         for (int i = 0; i < n_completions - 1; ++i) {
0024             QVERIFY(std::char_traits<char16_t>::compare(completiontable[i].completion,
0025                                                         completiontable[i + 1].completion,
0026                                                         std::max(completiontable[i].completion_strlen, completiontable[i + 1].completion_strlen))
0027                     < 0);
0028         }
0029     }
0030 };
0031 
0032 QTEST_MAIN(LatexCompletionTableTest)
0033 
0034 #include "testcompletiontable.moc"