Commit 9096ca38 authored by Csaba Kertesz's avatar Csaba Kertesz

Update the source format with clang-format

parent 679fbc8b
This diff is collapsed.
......@@ -15,8 +15,6 @@
* *
***************************************************************************/
#ifndef TESTCACHINGDMS_H
#define TESTCACHINGDMS_H
......@@ -33,33 +31,31 @@
class TestCachingDms : public QObject
{
Q_OBJECT
Q_OBJECT
public:
/**
public:
/**
* @short Constructor
*/
TestCachingDms();
TestCachingDms();
/**
/**
* @short Destructor
*/
~TestCachingDms();
private slots:
void defaultCtor();
void explicitSexigesimalCtor();
void angleCtor();
void stringCtor();
void setUsing_atan2();
void setUsing_asin();
void setUsing_acos();
void additionOperator();
void subtractionOperator();
void unaryMinusOperator();
void testFailsafeUseOfBaseClassPtr();
~TestCachingDms();
private slots:
void defaultCtor();
void explicitSexigesimalCtor();
void angleCtor();
void stringCtor();
void setUsing_atan2();
void setUsing_asin();
void setUsing_acos();
void additionOperator();
void subtractionOperator();
void unaryMinusOperator();
void testFailsafeUseOfBaseClassPtr();
};
#endif
......@@ -28,7 +28,7 @@
#include <QDir>
#include <QTemporaryFile>
TestCSVParser::TestCSVParser(): QObject()
TestCSVParser::TestCSVParser() : QObject()
{
}
......@@ -72,7 +72,7 @@ void TestCSVParser::initTestCase()
"3,"
"\"isn't, pi\","
"and,"
"\"\",")); // less than required fields
"\"\",")); // less than required fields
test_cases_.append(QString(","
"isn't,"
"it,"
......@@ -81,7 +81,7 @@ void TestCSVParser::initTestCase()
"3,"
"\"isn't, pi\","
"and,"
"\"," // no matching "
"\"," // no matching "
"-3.141,"
"isn't,"
"either\n"));
......@@ -94,7 +94,7 @@ void TestCSVParser::initTestCase()
QVERIFY(temp_file.open());
test_file_name_ = temp_file.fileName();
QTextStream out_stream(&temp_file);
foreach(const QString &test_case, test_cases_)
foreach (const QString &test_case, test_cases_)
out_stream << test_case;
temp_file.close();
......@@ -125,7 +125,6 @@ void TestCSVParser::cleanupTestCase()
delete test_parser_;
}
/*
* The following tests checks for the following cases for CSV files
* 1. Mixed inputs (See test case for description)
......@@ -138,7 +137,6 @@ void TestCSVParser::cleanupTestCase()
*
*/
void TestCSVParser::CSVMixedInputs()
{
/*
......@@ -194,7 +192,6 @@ void TestCSVParser::CSVQuotesInQuotes()
QCOMPARE(row_content["field12"].toString(), QString("either"));
}
void TestCSVParser::CSVEmptyRow()
{
/* Test 2. Row with less rows than required (to be skipped)
......@@ -269,7 +266,6 @@ void TestCSVParser::CSVIgnoreHasNextRow()
}
}
void TestCSVParser::CSVReadMissingFile()
{
/*
......@@ -298,5 +294,4 @@ void TestCSVParser::CSVReadMissingFile()
}
}
QTEST_GUILESS_MAIN(TestCSVParser)
......@@ -15,7 +15,6 @@
* *
***************************************************************************/
#ifndef TESTCSVPARSER_H
#define TESTCSVPARSER_H
......@@ -24,28 +23,27 @@
#include "ksparser.h"
#include "ksfilereader.h"
class TestCSVParser: public QObject
class TestCSVParser : public QObject
{
Q_OBJECT
public:
TestCSVParser();
~TestCSVParser();
private slots:
void initTestCase();
void cleanupTestCase();
void CSVMixedInputs();
void CSVQuotesInQuotes();
void CSVEmptyRow();
void CSVNoRow();
void CSVIgnoreHasNextRow();
void CSVReadMissingFile();
private:
QStringList test_cases_;
QList< QPair<QString, KSParser::DataTypes> > sequence_;
QString test_file_name_;
KSParser * test_parser_;
Q_OBJECT
public:
TestCSVParser();
~TestCSVParser();
private slots:
void initTestCase();
void cleanupTestCase();
void CSVMixedInputs();
void CSVQuotesInQuotes();
void CSVEmptyRow();
void CSVNoRow();
void CSVIgnoreHasNextRow();
void CSVReadMissingFile();
private:
QStringList test_cases_;
QList<QPair<QString, KSParser::DataTypes>> sequence_;
QString test_file_name_;
KSParser *test_parser_;
};
#endif // TESTKSPARSER_H
#endif // TESTKSPARSER_H
......@@ -10,7 +10,7 @@
#include "testdms.h"
#include "nan.h"
TestDMS::TestDMS(): QObject()
TestDMS::TestDMS() : QObject()
{
}
......@@ -27,7 +27,6 @@ void TestDMS::defaultCtor()
// Check default empty constructor
dms d;
QVERIFY(std::isnan(d.Degrees()));
}
void TestDMS::explicitSexigesimalCtor()
......@@ -44,7 +43,7 @@ void TestDMS::explicitSexigesimalCtor()
QVERIFY(d.degree() == 14);
QVERIFY(d.arcmin() == 55);
QVERIFY(d.arcsec() == 20);
QVERIFY(d.Degrees() == (14.0+55.0/60.0+20.0/3600.0));
QVERIFY(d.Degrees() == (14.0 + 55.0 / 60.0 + 20.0 / 3600.0));
}
void TestDMS::angleCtor()
......@@ -59,10 +58,10 @@ void TestDMS::angleCtor()
dms d(angle);
QVERIFY(d.degree() == (int) angle);
QVERIFY(d.degree() == (int)angle);
QVERIFY(d.Hours() == (angle+360)/15.0);
QVERIFY(d.hour() == 16);
QVERIFY(d.Hours() == (angle + 360) / 15.0);
QVERIFY(d.hour() == 16);
QVERIFY(d.minute() == 29);
QVERIFY(d.second() == 45);
}
......@@ -77,55 +76,53 @@ void TestDMS::stringCtor()
QVERIFY(d.degree() == 14);
QVERIFY(d.arcmin() == 55);
QVERIFY(d.arcsec() == 20);
QVERIFY(d.Degrees() == (14.0+55.0/60.0+20.0/3600.0));
QVERIFY(d.Degrees() == (14.0 + 55.0 / 60.0 + 20.0 / 3600.0));
// From Hours
dms h(hms, false);
QVERIFY(h.Degrees() == d.Degrees()*15.0);
QVERIFY(h.Degrees() == d.Degrees() * 15.0);
QVERIFY(h.Hours() == d.Degrees());
}
void TestDMS::testReduceToRange()
{
double base = 67.8;
double a = 360.0 * 11. + base;
double b = -360.0 * 12. + base;
double a = 360.0 * 11. + base;
double b = -360.0 * 12. + base;
dms d;
d.setD( a );
d.reduceToRange( dms::ZERO_TO_2PI );
QVERIFY( fabs( d.Degrees() - base ) < 1e-9 );
d.setD(a);
d.reduceToRange(dms::ZERO_TO_2PI);
QVERIFY(fabs(d.Degrees() - base) < 1e-9);
d.setD( b );
d.reduceToRange( dms::ZERO_TO_2PI );
QVERIFY( fabs( d.Degrees() - base ) < 1e-9 );
d.setD(b);
d.reduceToRange(dms::ZERO_TO_2PI);
QVERIFY(fabs(d.Degrees() - base) < 1e-9);
d.setD( 360.0 );
d.reduceToRange( dms::ZERO_TO_2PI );
QVERIFY( fabs( d.Degrees() - 0. ) < 1e-9 );
d.setD(360.0);
d.reduceToRange(dms::ZERO_TO_2PI);
QVERIFY(fabs(d.Degrees() - 0.) < 1e-9);
double c = 180.0 * 13. + base;
double e = 180.0 * 14. + base;
double f = -180.0 * 15. + base;
double g = -180.0 * 16. + base;