// SPDX-License-Identifier: LGPL-2.1-or-later
//
// SPDX-FileCopyrightText: 2013 Adrian Draghici <draghici.adrian.b@gmail.com>
//

#include "MarbleGlobal.h"
#include "MarbleMath.h"
#include "TestUtils.h"

namespace Marble
{

class TestGudermannian : public QObject
{
    Q_OBJECT

private Q_SLOTS:
    void testGudermannian_data();
    void testGudermannian();
};

void TestGudermannian::testGudermannian_data()
{
    QTest::addColumn<qreal>("angle");

    addRow() << 1.0;
    addRow() << 5.0;
    addRow() << 15.0;
    addRow() << 20.0;
    addRow() << 30.0;
    addRow() << 40.0;
    addRow() << 60.0;
    addRow() << 70.0;
    addRow() << 80.0;
}

void TestGudermannian::testGudermannian()
{
    QFETCH(qreal, angle);

    QFUZZYCOMPARE(atan(sinh(angle * DEG2RAD)) * RAD2DEG, gd(angle * DEG2RAD) * RAD2DEG, 0.1);
}

}

QTEST_MAIN(Marble::TestGudermannian)

#include "TestGudermannian.moc"
