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,11 +31,9 @@
class TestCachingDms : public QObject
{
Q_OBJECT
public:
/**
* @short Constructor
*/
......
......@@ -28,7 +28,7 @@
#include <QDir>
#include <QTemporaryFile>
TestCSVParser::TestCSVParser(): QObject()
TestCSVParser::TestCSVParser() : QObject()
{
}
......@@ -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,8 +23,7 @@
#include "ksparser.h"
#include "ksfilereader.h"
class TestCSVParser: public QObject
class TestCSVParser : public QObject
{
Q_OBJECT
public:
......@@ -43,9 +41,9 @@ class TestCSVParser: public QObject
private:
QStringList test_cases_;
QList< QPair<QString, KSParser::DataTypes> > sequence_;
QList<QPair<QString, KSParser::DataTypes>> sequence_;
QString test_file_name_;
KSParser * test_parser_;
KSParser *test_parser_;
};
#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,9 +58,9 @@ 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.Hours() == (angle + 360) / 15.0);
QVERIFY(d.hour() == 16);
QVERIFY(d.minute() == 29);
QVERIFY(d.second() == 45);
......@@ -77,15 +76,14 @@ 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;
......@@ -93,39 +91,38 @@ void TestDMS::testReduceToRange()
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;
d.setD( c );
d.reduceToRange( dms::MINUSPI_TO_PI );
QVERIFY( fabs( d.Degrees() - ( base - 180.0 ) ) < 1e-9 );
d.setD( e );
d.reduceToRange( dms::MINUSPI_TO_PI );
QVERIFY( fabs( d.Degrees() - base ) < 1e-9 );
d.setD(c);
d.reduceToRange(dms::MINUSPI_TO_PI);
QVERIFY(fabs(d.Degrees() - (base - 180.0)) < 1e-9);
d.setD( f );
d.reduceToRange( dms::MINUSPI_TO_PI );
QVERIFY( fabs( d.Degrees() - ( base - 180.0 ) ) < 1e-9 );
d.setD(e);
d.reduceToRange(dms::MINUSPI_TO_PI);
QVERIFY(fabs(d.Degrees() - base) < 1e-9);
d.setD( g );
d.reduceToRange( dms::MINUSPI_TO_PI );
QVERIFY( fabs( d.Degrees() - base ) < 1e-9 );
d.setD(f);
d.reduceToRange(dms::MINUSPI_TO_PI);
QVERIFY(fabs(d.Degrees() - (base - 180.0)) < 1e-9);
d.setD(g);
d.reduceToRange(dms::MINUSPI_TO_PI);
QVERIFY(fabs(d.Degrees() - base) < 1e-9);
}
QTEST_GUILESS_MAIN(TestDMS)
......@@ -15,12 +15,10 @@
#include "auxiliary/dms.h"
class TestDMS: public QObject
class TestDMS : public QObject
{
Q_OBJECT
public:
TestDMS();
~TestDMS();
......@@ -32,7 +30,6 @@ class TestDMS: public QObject
void angleCtor();
void stringCtor();
void testReduceToRange();
};
#endif
......@@ -20,16 +20,14 @@
#include <QDir>
#include <QTemporaryFile>
TestFWParser::TestFWParser(): QObject()
TestFWParser::TestFWParser() : QObject()
{
}
void TestFWParser::initTestCase()
{
test_cases_.append(
"this is an exam ple of 256 cases being tested -3.14 times\n");
test_cases_.append(
" \n");
test_cases_.append("this is an exam ple of 256 cases being tested -3.14 times\n");
test_cases_.append(" \n");
test_cases_.append("this is an ex\n\n");
QTemporaryFile temp_file;
......@@ -39,7 +37,7 @@ void TestFWParser::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();
......@@ -185,5 +183,3 @@ void TestFWParser::FWReadMissingFile()
}
QTEST_GUILESS_MAIN(TestFWParser)