@@ -173,7 +173,8 void TestDataSeries::testCtor() | |||
|
173 | 173 | |
|
174 | 174 | namespace { |
|
175 | 175 | |
|
176 |
std::shared_ptr<ScalarSeries> createSeries(QVector<double> xAxisData, |
|
|
176 | std::shared_ptr<ScalarSeries> createScalarSeries(QVector<double> xAxisData, | |
|
177 | QVector<double> valuesData) | |
|
177 | 178 | { |
|
178 | 179 | return std::make_shared<ScalarSeries>(std::move(xAxisData), std::move(valuesData), Unit{}, |
|
179 | 180 | Unit{}); |
@@ -210,26 +211,26 void TestDataSeries::testMerge_data() | |||
|
210 | 211 | // ////////// // |
|
211 | 212 | |
|
212 | 213 | QTest::newRow("sortedMerge") |
|
213 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) | |
|
214 | << createSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.}) | |
|
214 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) | |
|
215 | << createScalarSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.}) | |
|
215 | 216 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} |
|
216 | 217 | << QVector<double>{100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.}; |
|
217 | 218 | |
|
218 | 219 | QTest::newRow("unsortedMerge") |
|
219 | << createSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.}) | |
|
220 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) | |
|
220 | << createScalarSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.}) | |
|
221 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) | |
|
221 | 222 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} |
|
222 | 223 | << QVector<double>{100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.}; |
|
223 | 224 | |
|
224 | 225 | QTest::newRow("unsortedMerge2") |
|
225 | << createSeries({1., 2., 8., 9., 10}, {100., 200., 300., 400., 500.}) | |
|
226 | << createSeries({3., 4., 5., 6., 7.}, {600., 700., 800., 900., 1000.}) | |
|
226 | << createScalarSeries({1., 2., 8., 9., 10}, {100., 200., 300., 400., 500.}) | |
|
227 | << createScalarSeries({3., 4., 5., 6., 7.}, {600., 700., 800., 900., 1000.}) | |
|
227 | 228 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} |
|
228 | 229 | << QVector<double>{100., 200., 600., 700., 800., 900., 1000., 300., 400., 500.}; |
|
229 | 230 | |
|
230 | 231 | QTest::newRow("unsortedMerge3") |
|
231 | << createSeries({3., 5., 8., 7., 2}, {100., 200., 300., 400., 500.}) | |
|
232 | << createSeries({6., 4., 9., 10., 1.}, {600., 700., 800., 900., 1000.}) | |
|
232 | << createScalarSeries({3., 5., 8., 7., 2}, {100., 200., 300., 400., 500.}) | |
|
233 | << createScalarSeries({6., 4., 9., 10., 1.}, {600., 700., 800., 900., 1000.}) | |
|
233 | 234 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} |
|
234 | 235 | << QVector<double>{1000., 500., 100., 700., 200., 600., 400., 300., 800., 900.}; |
|
235 | 236 | } |
@@ -278,17 +279,22 void TestDataSeries::testMinXAxisData_data() | |||
|
278 | 279 | // Test cases // |
|
279 | 280 | // ////////// // |
|
280 | 281 | |
|
281 |
QTest::newRow("minData1") << createSeries({1., 2., 3., 4., 5.}, |
|
|
282 | QTest::newRow("minData1") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
283 | {100., 200., 300., 400., 500.}) | |
|
282 | 284 | << 0. << true << 1.; |
|
283 |
QTest::newRow("minData2") << createSeries({1., 2., 3., 4., 5.}, |
|
|
285 | QTest::newRow("minData2") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
286 | {100., 200., 300., 400., 500.}) | |
|
284 | 287 | << 1. << true << 1.; |
|
285 |
QTest::newRow("minData3") << createSeries({1., 2., 3., 4., 5.}, |
|
|
288 | QTest::newRow("minData3") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
289 | {100., 200., 300., 400., 500.}) | |
|
286 | 290 | << 1.1 << true << 2.; |
|
287 |
QTest::newRow("minData4") << createSeries({1., 2., 3., 4., 5.}, |
|
|
291 | QTest::newRow("minData4") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
292 | {100., 200., 300., 400., 500.}) | |
|
288 | 293 | << 5. << true << 5.; |
|
289 |
QTest::newRow("minData5") << createSeries({1., 2., 3., 4., 5.}, |
|
|
294 | QTest::newRow("minData5") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
295 | {100., 200., 300., 400., 500.}) | |
|
290 | 296 | << 5.1 << false << std::numeric_limits<double>::quiet_NaN(); |
|
291 | QTest::newRow("minData6") << createSeries({}, {}) << 1.1 << false | |
|
297 | QTest::newRow("minData6") << createScalarSeries({}, {}) << 1.1 << false | |
|
292 | 298 | << std::numeric_limits<double>::quiet_NaN(); |
|
293 | 299 | } |
|
294 | 300 | |
@@ -332,17 +338,22 void TestDataSeries::testMaxXAxisData_data() | |||
|
332 | 338 | // Test cases // |
|
333 | 339 | // ////////// // |
|
334 | 340 | |
|
335 |
QTest::newRow("maxData1") << createSeries({1., 2., 3., 4., 5.}, |
|
|
341 | QTest::newRow("maxData1") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
342 | {100., 200., 300., 400., 500.}) | |
|
336 | 343 | << 6. << true << 5.; |
|
337 |
QTest::newRow("maxData2") << createSeries({1., 2., 3., 4., 5.}, |
|
|
344 | QTest::newRow("maxData2") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
345 | {100., 200., 300., 400., 500.}) | |
|
338 | 346 | << 5. << true << 5.; |
|
339 |
QTest::newRow("maxData3") << createSeries({1., 2., 3., 4., 5.}, |
|
|
347 | QTest::newRow("maxData3") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
348 | {100., 200., 300., 400., 500.}) | |
|
340 | 349 | << 4.9 << true << 4.; |
|
341 |
QTest::newRow("maxData4") << createSeries({1., 2., 3., 4., 5.}, |
|
|
350 | QTest::newRow("maxData4") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
351 | {100., 200., 300., 400., 500.}) | |
|
342 | 352 | << 1.1 << true << 1.; |
|
343 |
QTest::newRow("maxData5") << createSeries({1., 2., 3., 4., 5.}, |
|
|
353 | QTest::newRow("maxData5") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
354 | {100., 200., 300., 400., 500.}) | |
|
344 | 355 | << 1. << true << 1.; |
|
345 | QTest::newRow("maxData6") << createSeries({}, {}) << 1.1 << false | |
|
356 | QTest::newRow("maxData6") << createScalarSeries({}, {}) << 1.1 << false | |
|
346 | 357 | << std::numeric_limits<double>::quiet_NaN(); |
|
347 | 358 | } |
|
348 | 359 | |
@@ -385,32 +396,32 void TestDataSeries::testXAxisRange_data() | |||
|
385 | 396 | // Test cases // |
|
386 | 397 | // ////////// // |
|
387 | 398 | |
|
388 | QTest::newRow("xAxisRange1") << createSeries({1., 2., 3., 4., 5.}, | |
|
399 | QTest::newRow("xAxisRange1") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
389 | 400 | {100., 200., 300., 400., 500.}) |
|
390 | 401 | << -1. << 3.2 << QVector<double>{1., 2., 3.} |
|
391 | 402 | << QVector<double>{100., 200., 300.}; |
|
392 | QTest::newRow("xAxisRange2") << createSeries({1., 2., 3., 4., 5.}, | |
|
403 | QTest::newRow("xAxisRange2") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
393 | 404 | {100., 200., 300., 400., 500.}) |
|
394 | 405 | << 1. << 4. << QVector<double>{1., 2., 3., 4.} |
|
395 | 406 | << QVector<double>{100., 200., 300., 400.}; |
|
396 | QTest::newRow("xAxisRange3") << createSeries({1., 2., 3., 4., 5.}, | |
|
407 | QTest::newRow("xAxisRange3") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
397 | 408 | {100., 200., 300., 400., 500.}) |
|
398 | 409 | << 1. << 3.9 << QVector<double>{1., 2., 3.} |
|
399 | 410 | << QVector<double>{100., 200., 300.}; |
|
400 | QTest::newRow("xAxisRange4") << createSeries({1., 2., 3., 4., 5.}, | |
|
411 | QTest::newRow("xAxisRange4") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
401 | 412 | {100., 200., 300., 400., 500.}) |
|
402 | 413 | << 0. << 0.9 << QVector<double>{} << QVector<double>{}; |
|
403 | QTest::newRow("xAxisRange5") << createSeries({1., 2., 3., 4., 5.}, | |
|
414 | QTest::newRow("xAxisRange5") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
404 | 415 | {100., 200., 300., 400., 500.}) |
|
405 | 416 | << 0. << 1. << QVector<double>{1.} << QVector<double>{100.}; |
|
406 | QTest::newRow("xAxisRange6") << createSeries({1., 2., 3., 4., 5.}, | |
|
417 | QTest::newRow("xAxisRange6") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
407 | 418 | {100., 200., 300., 400., 500.}) |
|
408 | 419 | << 2.1 << 6. << QVector<double>{3., 4., 5.} |
|
409 | 420 | << QVector<double>{300., 400., 500.}; |
|
410 | QTest::newRow("xAxisRange7") << createSeries({1., 2., 3., 4., 5.}, | |
|
421 | QTest::newRow("xAxisRange7") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
411 | 422 | {100., 200., 300., 400., 500.}) |
|
412 | 423 | << 6. << 9. << QVector<double>{} << QVector<double>{}; |
|
413 | QTest::newRow("xAxisRange8") << createSeries({1., 2., 3., 4., 5.}, | |
|
424 | QTest::newRow("xAxisRange8") << createScalarSeries({1., 2., 3., 4., 5.}, | |
|
414 | 425 | {100., 200., 300., 400., 500.}) |
|
415 | 426 | << 5. << 9. << QVector<double>{5.} << QVector<double>{500.}; |
|
416 | 427 | } |
@@ -440,39 +451,31 void TestDataSeries::testValuesBoundsScalar_data() | |||
|
440 | 451 | // ////////// // |
|
441 | 452 | // Test cases // |
|
442 | 453 | // ////////// // |
|
443 | ||
|
444 | QTest::newRow("valuesBounds1") | |
|
445 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 0. << 6. << true | |
|
446 | << 100. << 500.; | |
|
447 | QTest::newRow("valuesBounds2") | |
|
448 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 2. << 4. << true | |
|
449 | << 200. << 400.; | |
|
450 | QTest::newRow("valuesBounds3") | |
|
451 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 0. << 0.5 << false | |
|
452 | << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN(); | |
|
453 | QTest::newRow("valuesBounds4") | |
|
454 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 5.1 << 6. << false | |
|
455 | << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN(); | |
|
456 | QTest::newRow("valuesBounds5") | |
|
457 | << createSeries({1.}, {100.}) << 0. << 2. << true << 100. << 100.; | |
|
458 | QTest::newRow("valuesBounds6") | |
|
459 | << createSeries({}, {}) << 0. << 2. << false << std::numeric_limits<double>::quiet_NaN() | |
|
460 | << std::numeric_limits<double>::quiet_NaN(); | |
|
454 | auto nan = std::numeric_limits<double>::quiet_NaN(); | |
|
455 | ||
|
456 | QTest::newRow("scalarBounds1") | |
|
457 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 0. << 6. | |
|
458 | << true << 100. << 500.; | |
|
459 | QTest::newRow("scalarBounds2") | |
|
460 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 2. << 4. | |
|
461 | << true << 200. << 400.; | |
|
462 | QTest::newRow("scalarBounds3") | |
|
463 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 0. << 0.5 | |
|
464 | << false << nan << nan; | |
|
465 | QTest::newRow("scalarBounds4") | |
|
466 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 5.1 << 6. | |
|
467 | << false << nan << nan; | |
|
468 | QTest::newRow("scalarBounds5") | |
|
469 | << createScalarSeries({1.}, {100.}) << 0. << 2. << true << 100. << 100.; | |
|
470 | QTest::newRow("scalarBounds6") << createScalarSeries({}, {}) << 0. << 2. << false << nan << nan; | |
|
461 | 471 | |
|
462 | 472 | // Tests with NaN values: NaN values are not included in min/max search |
|
463 |
QTest::newRow(" |
|
|
464 | << createSeries({1., 2., 3., 4., 5.}, | |
|
465 | {std::numeric_limits<double>::quiet_NaN(), 200., 300., 400., | |
|
466 | std::numeric_limits<double>::quiet_NaN()}) | |
|
467 | << 0. << 6. << true << 200. << 400.; | |
|
468 | QTest::newRow("valuesBounds8") | |
|
469 | << createSeries( | |
|
470 | {1., 2., 3., 4., 5.}, | |
|
471 | {std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), | |
|
472 | std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), | |
|
473 | std::numeric_limits<double>::quiet_NaN()}) | |
|
474 | << 0. << 6. << true << std::numeric_limits<double>::quiet_NaN() | |
|
475 | << std::numeric_limits<double>::quiet_NaN(); | |
|
473 | QTest::newRow("scalarBounds7") | |
|
474 | << createScalarSeries({1., 2., 3., 4., 5.}, {nan, 200., 300., 400., nan}) << 0. << 6. | |
|
475 | << true << 200. << 400.; | |
|
476 | QTest::newRow("scalarBounds8") | |
|
477 | << createScalarSeries({1., 2., 3., 4., 5.}, {nan, nan, nan, nan, nan}) << 0. << 6. << true | |
|
478 | << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN(); | |
|
476 | 479 | } |
|
477 | 480 | |
|
478 | 481 | void TestDataSeries::testValuesBoundsScalar() |
@@ -487,6 +490,7 void TestDataSeries::testValuesBoundsVector_data() | |||
|
487 | 490 | // ////////// // |
|
488 | 491 | // Test cases // |
|
489 | 492 | // ////////// // |
|
493 | auto nan = std::numeric_limits<double>::quiet_NaN(); | |
|
490 | 494 | |
|
491 | 495 | QTest::newRow("vectorBounds1") |
|
492 | 496 | << createVectorSeries({1., 2., 3., 4., 5.}, {10., 15., 20., 13., 12.}, |
@@ -503,13 +507,8 void TestDataSeries::testValuesBoundsVector_data() | |||
|
503 | 507 | |
|
504 | 508 | // Tests with NaN values: NaN values are not included in min/max search |
|
505 | 509 | QTest::newRow("vectorBounds4") |
|
506 | << createVectorSeries( | |
|
507 | {1., 2.}, | |
|
508 | {std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()}, | |
|
509 | {std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()}, | |
|
510 | {std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()}) | |
|
511 | << 0. << 6. << true << std::numeric_limits<double>::quiet_NaN() | |
|
512 | << std::numeric_limits<double>::quiet_NaN(); | |
|
510 | << createVectorSeries({1., 2.}, {nan, nan}, {nan, nan}, {nan, nan}) << 0. << 6. << true | |
|
511 | << nan << nan; | |
|
513 | 512 | } |
|
514 | 513 | |
|
515 | 514 | void TestDataSeries::testValuesBoundsVector() |
General Comments 0
You need to be logged in to leave comments.
Login now