testDates.cpp   testDates.cpp 
skipping to change at line 20 skipping to change at line 20
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* 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/testDates.hpp"
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
#include <QDate> #include <QDate>
#include <QMap> #include <QMap>
#include <QList> #include <QList>
#include <QtGlobal> #include <QtGlobal>
#include <QLocale> #include <QLocale>
#include <QtDebug> #include <QDebug>
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "tests/testDates.hpp"
#define IGREG 2299161 #define IGREG 2299161
QTEST_MAIN(TestDates); QTEST_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 79 skipping to change at line 81
map[-365.0] = "-4713-01-01T12:00:00"; map[-365.0] = "-4713-01-01T12:00:00";
map[-699.0] = "-4714-02-01T12:00:00"; // 28 days map[-699.0] = "-4714-02-01T12:00:00"; // 28 days
map[-1064.0] = "-4715-02-01T12:00:00"; // 28 days map[-1064.0] = "-4715-02-01T12:00:00"; // 28 days
map[-1430.0] = "-4716-02-01T12:00:00"; // 29 days map[-1430.0] = "-4716-02-01T12:00:00"; // 29 days
map[-1795.0] = "-4717-02-01T12:00:00"; // 28 days map[-1795.0] = "-4717-02-01T12:00:00"; // 28 days
map[-39388.5] = "-4820-02-29T00:00:00"; // 29 days map[-39388.5] = "-4820-02-29T00:00:00"; // 29 days
map[-1930711.0] ="-9998-01-01T12:00:00"; map[-1930711.0] ="-9998-01-01T12:00:00";
map[-1930712.0] ="-9999-12-31T12:00:00"; map[-1930712.0] ="-9999-12-31T12:00:00";
bool ok; bool ok;
Q_UNUSED(ok);
for (QMap<double, QString>::ConstIterator i=map.constBegin();i!=map. constEnd();++i) for (QMap<double, QString>::ConstIterator i=map.constBegin();i!=map. constEnd();++i)
{ {
QCOMPARE(StelUtils::julianDayToISO8601String(i.key()), i.val ue()); QCOMPARE(StelUtils::julianDayToISO8601String(i.key()), i.val ue());
double tmp = StelUtils::getJulianDayFromISO8601String(i.valu e(), &ok); double tmp = StelUtils::getJulianDayFromISO8601String(i.valu e(), &ok);
QVERIFY(ok); QVERIFY(ok);
if (i.key()!=0.0) if (i.key()!=0.0)
qFuzzyCompare(i.key(), tmp); qFuzzyCompare(i.key(), tmp);
else else
qFuzzyCompare(i.key()+1.0, tmp+1.0); qFuzzyCompare(i.key()+1.0, tmp+1.0);
} }
 End of changes. 5 change blocks. 
3 lines changed or deleted 6 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/