testDeltaT.cpp   testDeltaT.cpp 
skipping to change at line 27 skipping to change at line 27
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "tests/testDeltaT.hpp" #include "tests/testDeltaT.hpp"
#include <QDateTime> #include <QDateTime>
#include <QVariantList> #include <QVariantList>
#include <QString> #include <QString>
#include <QDebug> #include <QDebug>
#include <QtGlobal> #include <QtGlobal>
#include <QVector>
#include <cstdlib>
#include "StelUtils.hpp" #include "StelUtils.hpp"
#define ERROR_THRESHOLD_PERCENT 5.0
QTEST_MAIN(TestDeltaT) QTEST_MAIN(TestDeltaT)
void TestDeltaT::initTestCase() void TestDeltaT::initTestCase()
{ {
} }
void TestDeltaT::historicalTest() void TestDeltaT::testDeltaTByEspenakMeeus()
{ {
// test data from http://eclipse.gsfc.nasa.gov/SEcat5/deltat.html#ta b1 // test data from http://eclipse.gsfc.nasa.gov/SEcat5/deltat.html#ta b1
QVariantList data; QVariantList data;
data << -500 << 17190 << 430; data << -500 << 17190 << 430;
data << -400 << 15530 << 390; data << -400 << 15530 << 390;
data << -300 << 14080 << 360; data << -300 << 14080 << 360;
data << -200 << 12790 << 330; data << -200 << 12790 << 330;
data << -100 << 11640 << 290; data << -100 << 11640 << 290;
data << 0 << 10580 << 260; data << 0 << 10580 << 260;
skipping to change at line 95 skipping to change at line 90
while(data.count() >= 3) while(data.count() >= 3)
{ {
int year = data.takeFirst().toInt(); int year = data.takeFirst().toInt();
int yout, mout, dout; int yout, mout, dout;
double JD; double JD;
double expectedResult = data.takeFirst().toDouble(); double expectedResult = data.takeFirst().toDouble();
double acceptableError = data.takeFirst().toDouble(); double acceptableError = data.takeFirst().toDouble();
StelUtils::getJDFromDate(&JD, year, 1, 1, 0, 0, 0); StelUtils::getJDFromDate(&JD, year, 1, 1, 0, 0, 0);
double result = StelUtils::getDeltaTByEspenakMeeus(JD); double result = StelUtils::getDeltaTByEspenakMeeus(JD);
double actualError = qAbs(expectedResult) - qAbs(result); double actualError = qAbs(qAbs(expectedResult) - qAbs(result ));
StelUtils::getDateFromJulianDay(JD, &yout, &mout, &dout); StelUtils::getDateFromJulianDay(JD, &yout, &mout, &dout);
QVERIFY2(actualError <= acceptableError, QString("date=%2 ye ar=%3 result=%4 error=%5 acceptable=%6") QVERIFY2(actualError <= acceptableError, QString("date=%2 ye ar=%3 result=%4 expected=%5 error=%6 acceptable=%7")
.arg(QString("%1-%2- %3 00:00:00").arg(yout).arg(mout).arg(dout)) .arg(QString("%1-%2- %3 00:00:00").arg(yout).arg(mout).arg(dout))
.arg(year) .arg(year)
.arg(result) .arg(result)
.arg(expectedResult)
.arg(actualError) .arg(actualError)
.arg(acceptableError ) .arg(acceptableError )
.toUtf8()); .toUtf8());
} }
} }
 End of changes. 6 change blocks. 
8 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/