testDates.cpp   testDates.cpp 
skipping to change at line 35 skipping to change at line 35
#include <QMap> #include <QMap>
#include <QList> #include <QList>
#include <QtGlobal> #include <QtGlobal>
#include <QLocale> #include <QLocale>
#include <QDebug> #include <QDebug>
#include "StelUtils.hpp" #include "StelUtils.hpp"
#define IGREG 2299161 #define IGREG 2299161
QTEST_MAIN(TestDates) QTEST_GUILESS_MAIN(TestDates)
void TestDates::dateRoundTrip() void TestDates::dateRoundTrip()
{ {
QMap<double, QString> map; QMap<double, QString> map;
map[0.0] = "-4712-01-01T12:00:00"; map[0.0] = "-4712-01-01T12:00:00";
map[-1.0] = "-4713-12-31T12:00:00"; map[-1.0] = "-4713-12-31T12:00:00";
map[2454466.0] = "2007-12-31T12:00:00"; map[2454466.0] = "2007-12-31T12:00:00";
map[1721058.0] = "0000-01-01T12:00:00"; map[1721058.0] = "0000-01-01T12:00:00";
map[2500000.0] = "2132-08-31T12:00:00"; map[2500000.0] = "2132-08-31T12:00:00";
map[366.0] = "-4711-01-01T12:00:00"; map[366.0] = "-4711-01-01T12:00:00";
skipping to change at line 126 skipping to change at line 126
// QLocale::setDefault(QLocale::English); // QLocale::setDefault(QLocale::English);
// QString easyLong("d dd ddd dddd M MM MMM MMMM yy yyyy"); // QString easyLong("d dd ddd dddd M MM MMM MMMM yy yyyy");
// QVERIFY2(QString::compare(QString("9 09 Sun Sunday 3 03 Mar March 08 2008"), StelUtils::localeDateString(2008, 3, 9, 6, easyLong)) == 0, // QVERIFY2(QString::compare(QString("9 09 Sun Sunday 3 03 Mar March 08 2008"), StelUtils::localeDateString(2008, 3, 9, 6, easyLong)) == 0,
// qPrintable("formatter1 not working: " + StelUtils:: localeDateString(2008, 3, 9, 6, easyLong))); // qPrintable("formatter1 not working: " + StelUtils:: localeDateString(2008, 3, 9, 6, easyLong)));
// QString hardLong("dddddddd '''doh' ''yyyyyyy"); // QString hardLong("dddddddd '''doh' ''yyyyyyy");
// QVERIFY2(QString::compare(QString("SundaySunday 'doh '200808y"), Ste lUtils::localeDateString(2008, 3, 9, 6, hardLong)) == 0, // QVERIFY2(QString::compare(QString("SundaySunday 'doh '200808y"), Ste lUtils::localeDateString(2008, 3, 9, 6, hardLong)) == 0,
// qPrintable("formatter2 not working: " + StelUtils:: localeDateString(2008, 3, 9, 6, hardLong))); // qPrintable("formatter2 not working: " + StelUtils:: localeDateString(2008, 3, 9, 6, hardLong)));
// test detection of offset from UTC. // test detection of offset from UTC.
double mar122008 = QDate(2008,3,12).toJulianDay(); // double mar122008 = QDate(2008,3,12).toJulianDay();
qFuzzyCompare(StelUtils::getGMTShiftFromQT(mar122008), -4.f); // qFuzzyCompare(StelUtils::getGMTShiftFromQT(mar122008), -4.f);
double mar012008 = QDate(2008,3,1).toJulianDay(); // double mar012008 = QDate(2008,3,1).toJulianDay();
qFuzzyCompare(StelUtils::getGMTShiftFromQT(mar012008), -5.f); // qFuzzyCompare(StelUtils::getGMTShiftFromQT(mar012008), -5.f);
} }
void TestDates::testRolloverAndValidity() void TestDates::testRolloverAndValidity()
{ {
QVERIFY2(31==StelUtils::numberOfDaysInMonthInYear(1, 2008), "1a"); QVERIFY2(31==StelUtils::numberOfDaysInMonthInYear(1, 2008), "1a");
QVERIFY2(29==StelUtils::numberOfDaysInMonthInYear(2, 2008), "1b"); QVERIFY2(29==StelUtils::numberOfDaysInMonthInYear(2, 2008), "1b");
QVERIFY2(28==StelUtils::numberOfDaysInMonthInYear(2, 2007), "1c"); QVERIFY2(28==StelUtils::numberOfDaysInMonthInYear(2, 2007), "1c");
QVERIFY2(29==StelUtils::numberOfDaysInMonthInYear(2, 2000), "1d"); QVERIFY2(29==StelUtils::numberOfDaysInMonthInYear(2, 2000), "1d");
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 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/