@@ -0,0 +1,6 | |||||
|
1 | #Sampling Time : 60 | |||
|
2 | #Time Format : YYYY-MM-DDThh:mm:ss.mls | |||
|
3 | #imf(0) - Type : Local Parameter @ CDPP/AMDA - Name : bx_gse - Units : nT - Size : 1 - Frame : GSE - Mission : ACE - Instrument : MFI - Dataset : mfi_final-prelim | |||
|
4 | 2013-09-23T09:00:30.000 NaN | |||
|
5 | 2013-09-23T09:01:30.000 -2.71850 | |||
|
6 | 2013-09-23T09:02:30.000 -2.52150 No newline at end of file |
@@ -0,0 +1,2 | |||||
|
1 | #Sampling Time : 60 | |||
|
2 | #Time Format : YYYY-MM-DDThh:mm:ss.mls No newline at end of file |
@@ -0,0 +1,6 | |||||
|
1 | #Sampling Time : 60 | |||
|
2 | #Time Format : YYYY-MM-DDThh:mm:ss.mls | |||
|
3 | #imf(0) - Type : Local Parameter @ CDPP/AMDA - Name : bx_gse - Units : nT - Size : 1 - Frame : GSE - Mission : ACE - Instrument : MFI - Dataset : mfi_final-prelim | |||
|
4 | 2013-09-23T09:00:30.000 -2.83950 1.05141 3.01547 | |||
|
5 | 2013-09-23T09:01:30.000 -2.71850 | |||
|
6 | 2013-09-23T09:02:30.000 -2.52150 No newline at end of file |
@@ -0,0 +1,13 | |||||
|
1 | #Sampling Time : 60 | |||
|
2 | #Time Format : YYYY-MM-DDThh:mm:ss.mls | |||
|
3 | #imf(0) - Type : Local Parameter @ CDPP/AMDA - Name : bx_gse - Units : nT - Size : 1 - Frame : GSE - Mission : ACE - Instrument : MFI - Dataset : mfi_final-prelim | |||
|
4 | 2013-09-23T09:00:30.000 -2.83950 | |||
|
5 | 2013-09-23T09:01:30.000 -2.71850 | |||
|
6 | 2013-09-23T09:02:30.000 -2.52150 | |||
|
7 | 2013-09-23T09:03:30.000 -2.57633 | |||
|
8 | 2013-09-23T09:04:30.000 -2.58050 | |||
|
9 | 2013-09-23T09:05:30.000 -2.48325 | |||
|
10 | 2013-09-23T09:06:30.000 -2.63025 | |||
|
11 | 2013-09-23T09:07:30.000 -2.55800 | |||
|
12 | 2013-09-23T09:08:30.000 -2.43250 | |||
|
13 | 2013-09-23T09:09:30.000 -2.42200 No newline at end of file |
@@ -0,0 +1,6 | |||||
|
1 | #Sampling Time : 60 | |||
|
2 | #Time Format : YYYY-MM-DDThh:mm:ss.mls | |||
|
3 | #imf(0) - Type : Local Parameter @ CDPP/AMDA - Name : bx_gse - Units : nT - Size : 1 - Frame : GSE - Mission : ACE - Instrument : MFI - Dataset : mfi_final-prelim | |||
|
4 | 23/09/2013 07:50:30 -2.83950 | |||
|
5 | 2013-09-23T09:01:30.000 -2.71850 | |||
|
6 | 2013-09-23T09:02:30.000 -2.52150 No newline at end of file |
@@ -0,0 +1,6 | |||||
|
1 | #Sampling Time : 60 | |||
|
2 | #Time Format : YYYY-MM-DDThh:mm:ss.mls | |||
|
3 | #Wrong unit comment | |||
|
4 | 2013-09-23T09:00:30.000 -2.83950 | |||
|
5 | 2013-09-23T09:01:30.000 -2.71850 | |||
|
6 | 2013-09-23T09:02:30.000 -2.52150 No newline at end of file |
@@ -0,0 +1,6 | |||||
|
1 | #Sampling Time : 60 | |||
|
2 | #Time Format : YYYY-MM-DDThh:mm:ss.mls | |||
|
3 | #imf(0) - Type : Local Parameter @ CDPP/AMDA - Name : bx_gse - Units : nT - Size : 1 - Frame : GSE - Mission : ACE - Instrument : MFI - Dataset : mfi_final-prelim | |||
|
4 | 2013-09-23T09:00:30.000 abc | |||
|
5 | 2013-09-23T09:01:30.000 -2.71850 | |||
|
6 | 2013-09-23T09:02:30.000 -2.52150 No newline at end of file |
@@ -1,5 +1,7 | |||||
1 | #include "AmdaResultParser.h" |
|
1 | #include "AmdaResultParser.h" | |
2 |
|
2 | |||
|
3 | #include <Data/ScalarSeries.h> | |||
|
4 | ||||
3 | #include <QObject> |
|
5 | #include <QObject> | |
4 | #include <QtTest> |
|
6 | #include <QtTest> | |
5 |
|
7 | |||
@@ -92,6 +94,70 void TestAmdaResultParser::testReadTxt_data() | |||||
92 | // Expected results |
|
94 | // Expected results | |
93 | QTest::addColumn<ExpectedResults>("expectedResults"); |
|
95 | QTest::addColumn<ExpectedResults>("expectedResults"); | |
94 |
|
96 | |||
|
97 | // ////////// // | |||
|
98 | // Test cases // | |||
|
99 | // ////////// // | |||
|
100 | ||||
|
101 | auto dateTime = [](int year, int month, int day, int hours, int minutes, int seconds) { | |||
|
102 | return QDateTime{{year, month, day}, {hours, minutes, seconds}}; | |||
|
103 | }; | |||
|
104 | ||||
|
105 | // Valid file | |||
|
106 | QTest::newRow("Valid file") | |||
|
107 | << QStringLiteral("ValidScalar1.txt") | |||
|
108 | << ExpectedResults{ | |||
|
109 | Unit{QStringLiteral("nT"), true}, Unit{}, | |||
|
110 | QVector<QDateTime>{dateTime(2013, 9, 23, 9, 0, 30), dateTime(2013, 9, 23, 9, 1, 30), | |||
|
111 | dateTime(2013, 9, 23, 9, 2, 30), dateTime(2013, 9, 23, 9, 3, 30), | |||
|
112 | dateTime(2013, 9, 23, 9, 4, 30), dateTime(2013, 9, 23, 9, 5, 30), | |||
|
113 | dateTime(2013, 9, 23, 9, 6, 30), dateTime(2013, 9, 23, 9, 7, 30), | |||
|
114 | dateTime(2013, 9, 23, 9, 8, 30), dateTime(2013, 9, 23, 9, 9, 30)}, | |||
|
115 | QVector<double>{-2.83950, -2.71850, -2.52150, -2.57633, -2.58050, -2.48325, -2.63025, | |||
|
116 | -2.55800, -2.43250, -2.42200}}; | |||
|
117 | ||||
|
118 | // Valid files but with some invalid lines (wrong unit, wrong values, etc.) | |||
|
119 | QTest::newRow("No unit file") << QStringLiteral("NoUnit.txt") | |||
|
120 | << ExpectedResults{Unit{QStringLiteral(""), true}, Unit{}, | |||
|
121 | QVector<QDateTime>{}, QVector<double>{}}; | |||
|
122 | QTest::newRow("Wrong unit file") | |||
|
123 | << QStringLiteral("WrongUnit.txt") | |||
|
124 | << ExpectedResults{Unit{QStringLiteral(""), true}, Unit{}, | |||
|
125 | QVector<QDateTime>{dateTime(2013, 9, 23, 9, 0, 30), | |||
|
126 | dateTime(2013, 9, 23, 9, 1, 30), | |||
|
127 | dateTime(2013, 9, 23, 9, 2, 30)}, | |||
|
128 | QVector<double>{-2.83950, -2.71850, -2.52150}}; | |||
|
129 | ||||
|
130 | QTest::newRow("Wrong results file (date of first line is invalid") | |||
|
131 | << QStringLiteral("WrongDate.txt") | |||
|
132 | << ExpectedResults{ | |||
|
133 | Unit{QStringLiteral("nT"), true}, Unit{}, | |||
|
134 | QVector<QDateTime>{dateTime(2013, 9, 23, 9, 1, 30), dateTime(2013, 9, 23, 9, 2, 30)}, | |||
|
135 | QVector<double>{-2.71850, -2.52150}}; | |||
|
136 | ||||
|
137 | QTest::newRow("Wrong results file (too many values for first line") | |||
|
138 | << QStringLiteral("TooManyValues.txt") | |||
|
139 | << ExpectedResults{ | |||
|
140 | Unit{QStringLiteral("nT"), true}, Unit{}, | |||
|
141 | QVector<QDateTime>{dateTime(2013, 9, 23, 9, 1, 30), dateTime(2013, 9, 23, 9, 2, 30)}, | |||
|
142 | QVector<double>{-2.71850, -2.52150}}; | |||
|
143 | ||||
|
144 | QTest::newRow("Wrong results file (value of first line is invalid") | |||
|
145 | << QStringLiteral("WrongValue.txt") | |||
|
146 | << ExpectedResults{ | |||
|
147 | Unit{QStringLiteral("nT"), true}, Unit{}, | |||
|
148 | QVector<QDateTime>{dateTime(2013, 9, 23, 9, 1, 30), dateTime(2013, 9, 23, 9, 2, 30)}, | |||
|
149 | QVector<double>{-2.71850, -2.52150}}; | |||
|
150 | ||||
|
151 | QTest::newRow("Wrong results file (value of first line is NaN") | |||
|
152 | << QStringLiteral("NaNValue.txt") | |||
|
153 | << ExpectedResults{ | |||
|
154 | Unit{QStringLiteral("nT"), true}, Unit{}, | |||
|
155 | QVector<QDateTime>{dateTime(2013, 9, 23, 9, 1, 30), dateTime(2013, 9, 23, 9, 2, 30)}, | |||
|
156 | QVector<double>{-2.71850, -2.52150}}; | |||
|
157 | ||||
|
158 | // Invalid file | |||
|
159 | QTest::newRow("Invalid file (unexisting file)") | |||
|
160 | << QStringLiteral("UnexistingFile.txt") << ExpectedResults{}; | |||
95 | } |
|
161 | } | |
96 |
|
162 | |||
97 | void TestAmdaResultParser::testReadTxt() |
|
163 | void TestAmdaResultParser::testReadTxt() |
General Comments 0
You need to be logged in to leave comments.
Login now