testConversions.cpp   testConversions.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 "config.h"
#include "tests/testConversions.hpp" #include "tests/testConversions.hpp"
#include "StelUtils.hpp"
#include <QString> #include <QString>
#include <QDebug> #include <QDebug>
#include <QtGlobal> #include <QtGlobal>
#include <QVariantList> #include <QVariantList>
#include <QMap> #include <QMap>
#include "StelUtils.hpp"
#define ERROR_LIMIT 1e-6 #define ERROR_LIMIT 1e-6
QTEST_MAIN(TestConversions) QTEST_MAIN(TestConversions)
void TestConversions::testHMSToRad() void TestConversions::testHMSToRad()
{ {
QVariantList data; QVariantList data;
data << 0 << 0 << 0 << 0.; data << 0 << 0 << 0 << 0.;
data << 1 << 0 << 0 << M_PI/12; data << 1 << 0 << 0 << M_PI/12;
skipping to change at line 158 skipping to change at line 161
unsigned int dego, mino; unsigned int dego, mino;
bool sign; bool sign;
QString s; QString s;
rad = data.takeFirst().toDouble(); rad = data.takeFirst().toDouble();
deg = data.takeFirst().toInt(); deg = data.takeFirst().toInt();
min = data.takeFirst().toInt(); min = data.takeFirst().toInt();
sec = data.takeFirst().toDouble(); sec = data.takeFirst().toDouble();
if (deg>=0) if (deg>=0)
angle1 = sec+min*60+deg*3600; angle1 = sec+min*60+deg*3600;
else else
angle1 = -1*(sec+min*60+std::abs(deg)*3600); angle1 = -1*(sec+min*60+std::abs((double)deg)*3600);
StelUtils::radToDms(rad, sign, dego, mino, seco); StelUtils::radToDms(rad, sign, dego, mino, seco);
angle2 = seco+mino*60+dego*3600; angle2 = seco+mino*60+dego*3600;
if (!sign) if (!sign)
{ {
angle2 = -1*angle2; angle2 = -1*angle2;
s = "-"; s = "-";
} }
else else
s = "+"; s = "+";
QVERIFY2(std::abs(angle1-angle2)<=ERROR_LIMIT, qPrintable(QS tring("%1rad=%2%3d%4m%5s").arg(rad).arg(s).arg(dego).arg(mino).arg(seco))); QVERIFY2(std::abs(angle1-angle2)<=ERROR_LIMIT, qPrintable(QS tring("%1rad=%2%3d%4m%5s").arg(rad).arg(s).arg(dego).arg(mino).arg(seco)));
 End of changes. 4 change blocks. 
2 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/