File: test_Utils.cpp

package info (click to toggle)
kwave 25.04.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,272 kB
  • sloc: cpp: 56,173; xml: 817; perl: 688; sh: 57; makefile: 11
file content (32 lines) | stat: -rw-r--r-- 1,061 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-FileCopyrightText: 2023 Mark Penner <mrp@markpenner.space>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "Utils.h"
#include <QTest>

class TestUtils : public QObject
{
    Q_OBJECT

private Q_SLOTS:
    void test_string2date();
};

void TestUtils::test_string2date()
{
    QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
    QCOMPARE(Kwave::string2date(QStringLiteral("2023-12-23")),
             QStringLiteral("2023-12-23"));
    QCOMPARE(Kwave::string2date(QStringLiteral("2023-12-23T01:23:45")),
             QStringLiteral("2023-12-23T01:23:45"));
    QCOMPARE(Kwave::string2date(QStringLiteral("Wed May 20 03:40:13 1998")),
             QStringLiteral("1998-05-20T03:40:13"));
    QCOMPARE(Kwave::string2date(QStringLiteral("12/23/99 1:23 PM")),
             QStringLiteral("1999-12-23T13:23:00"));
    QCOMPARE(Kwave::string2date(
                QStringLiteral("Saturday, December 23, 2023 1:23:45 AM CET")),
             QStringLiteral("2023-12-23T01:23:45"));
}

QTEST_MAIN(TestUtils)
#include "test_Utils.moc"