File indexing completed on 2024-04-28 08:32:02
0001 /* 0002 SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include <../src/lib/easter.cpp> 0008 0009 #include <QTest> 0010 0011 using namespace KOpeningHours; 0012 0013 class EasterTest : public QObject 0014 { 0015 Q_OBJECT 0016 private Q_SLOTS: 0017 void testEaster_data() 0018 { 0019 QTest::addColumn<int>("year"); 0020 QTest::addColumn<QDate>("date"); 0021 0022 QTest::newRow("2001") << 2001 << QDate(2001, 4, 15); 0023 QTest::newRow("2020") << 2020 << QDate(2020, 4, 12); 0024 QTest::newRow("2021") << 2021 << QDate(2021, 4, 4); 0025 QTest::newRow("2022") << 2022 << QDate(2022, 4, 17); 0026 QTest::newRow("2023") << 2023 << QDate(2023, 4, 9); 0027 QTest::newRow("2024") << 2024 << QDate(2024, 3, 31); 0028 QTest::newRow("2025") << 2025 << QDate(2025, 4, 20); 0029 } 0030 0031 void testEaster() 0032 { 0033 QFETCH(int, year); 0034 QFETCH(QDate, date); 0035 QCOMPARE(Easter::easterDate(year), date); 0036 QCOMPARE(date.dayOfWeek(), 7); 0037 } 0038 }; 0039 0040 QTEST_GUILESS_MAIN(EasterTest) 0041 0042 #include "eastertest.moc"