@@ -173,7 +173,8 void TestDataSeries::testCtor() | |||||
173 |
|
173 | |||
174 | namespace { |
|
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 | return std::make_shared<ScalarSeries>(std::move(xAxisData), std::move(valuesData), Unit{}, |
|
179 | return std::make_shared<ScalarSeries>(std::move(xAxisData), std::move(valuesData), Unit{}, | |
179 | Unit{}); |
|
180 | Unit{}); | |
@@ -210,26 +211,26 void TestDataSeries::testMerge_data() | |||||
210 | // ////////// // |
|
211 | // ////////// // | |
211 |
|
212 | |||
212 | QTest::newRow("sortedMerge") |
|
213 | QTest::newRow("sortedMerge") | |
213 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) |
|
214 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) | |
214 | << createSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.}) |
|
215 | << createScalarSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.}) | |
215 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} |
|
216 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} | |
216 | << QVector<double>{100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.}; |
|
217 | << QVector<double>{100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.}; | |
217 |
|
218 | |||
218 | QTest::newRow("unsortedMerge") |
|
219 | QTest::newRow("unsortedMerge") | |
219 | << createSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.}) |
|
220 | << createScalarSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.}) | |
220 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) |
|
221 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) | |
221 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} |
|
222 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} | |
222 | << QVector<double>{100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.}; |
|
223 | << QVector<double>{100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.}; | |
223 |
|
224 | |||
224 | QTest::newRow("unsortedMerge2") |
|
225 | QTest::newRow("unsortedMerge2") | |
225 | << createSeries({1., 2., 8., 9., 10}, {100., 200., 300., 400., 500.}) |
|
226 | << createScalarSeries({1., 2., 8., 9., 10}, {100., 200., 300., 400., 500.}) | |
226 | << createSeries({3., 4., 5., 6., 7.}, {600., 700., 800., 900., 1000.}) |
|
227 | << createScalarSeries({3., 4., 5., 6., 7.}, {600., 700., 800., 900., 1000.}) | |
227 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} |
|
228 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} | |
228 | << QVector<double>{100., 200., 600., 700., 800., 900., 1000., 300., 400., 500.}; |
|
229 | << QVector<double>{100., 200., 600., 700., 800., 900., 1000., 300., 400., 500.}; | |
229 |
|
230 | |||
230 | QTest::newRow("unsortedMerge3") |
|
231 | QTest::newRow("unsortedMerge3") | |
231 | << createSeries({3., 5., 8., 7., 2}, {100., 200., 300., 400., 500.}) |
|
232 | << createScalarSeries({3., 5., 8., 7., 2}, {100., 200., 300., 400., 500.}) | |
232 | << createSeries({6., 4., 9., 10., 1.}, {600., 700., 800., 900., 1000.}) |
|
233 | << createScalarSeries({6., 4., 9., 10., 1.}, {600., 700., 800., 900., 1000.}) | |
233 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} |
|
234 | << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.} | |
234 | << QVector<double>{1000., 500., 100., 700., 200., 600., 400., 300., 800., 900.}; |
|
235 | << QVector<double>{1000., 500., 100., 700., 200., 600., 400., 300., 800., 900.}; | |
235 | } |
|
236 | } | |
@@ -278,17 +279,22 void TestDataSeries::testMinXAxisData_data() | |||||
278 | // Test cases // |
|
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 | << 0. << true << 1.; |
|
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 | << 1. << true << 1.; |
|
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 | << 1.1 << true << 2.; |
|
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 | << 5. << true << 5.; |
|
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 | << 5.1 << false << std::numeric_limits<double>::quiet_NaN(); |
|
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 | << std::numeric_limits<double>::quiet_NaN(); |
|
298 | << std::numeric_limits<double>::quiet_NaN(); | |
293 | } |
|
299 | } | |
294 |
|
300 | |||
@@ -332,17 +338,22 void TestDataSeries::testMaxXAxisData_data() | |||||
332 | // Test cases // |
|
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 | << 6. << true << 5.; |
|
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 | << 5. << true << 5.; |
|
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 | << 4.9 << true << 4.; |
|
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 | << 1.1 << true << 1.; |
|
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 | << 1. << true << 1.; |
|
355 | << 1. << true << 1.; | |
345 | QTest::newRow("maxData6") << createSeries({}, {}) << 1.1 << false |
|
356 | QTest::newRow("maxData6") << createScalarSeries({}, {}) << 1.1 << false | |
346 | << std::numeric_limits<double>::quiet_NaN(); |
|
357 | << std::numeric_limits<double>::quiet_NaN(); | |
347 | } |
|
358 | } | |
348 |
|
359 | |||
@@ -385,32 +396,32 void TestDataSeries::testXAxisRange_data() | |||||
385 | // Test cases // |
|
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 | {100., 200., 300., 400., 500.}) |
|
400 | {100., 200., 300., 400., 500.}) | |
390 | << -1. << 3.2 << QVector<double>{1., 2., 3.} |
|
401 | << -1. << 3.2 << QVector<double>{1., 2., 3.} | |
391 | << QVector<double>{100., 200., 300.}; |
|
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 | {100., 200., 300., 400., 500.}) |
|
404 | {100., 200., 300., 400., 500.}) | |
394 | << 1. << 4. << QVector<double>{1., 2., 3., 4.} |
|
405 | << 1. << 4. << QVector<double>{1., 2., 3., 4.} | |
395 | << QVector<double>{100., 200., 300., 400.}; |
|
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 | {100., 200., 300., 400., 500.}) |
|
408 | {100., 200., 300., 400., 500.}) | |
398 | << 1. << 3.9 << QVector<double>{1., 2., 3.} |
|
409 | << 1. << 3.9 << QVector<double>{1., 2., 3.} | |
399 | << QVector<double>{100., 200., 300.}; |
|
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 | {100., 200., 300., 400., 500.}) |
|
412 | {100., 200., 300., 400., 500.}) | |
402 | << 0. << 0.9 << QVector<double>{} << QVector<double>{}; |
|
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 | {100., 200., 300., 400., 500.}) |
|
415 | {100., 200., 300., 400., 500.}) | |
405 | << 0. << 1. << QVector<double>{1.} << QVector<double>{100.}; |
|
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 | {100., 200., 300., 400., 500.}) |
|
418 | {100., 200., 300., 400., 500.}) | |
408 | << 2.1 << 6. << QVector<double>{3., 4., 5.} |
|
419 | << 2.1 << 6. << QVector<double>{3., 4., 5.} | |
409 | << QVector<double>{300., 400., 500.}; |
|
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 | {100., 200., 300., 400., 500.}) |
|
422 | {100., 200., 300., 400., 500.}) | |
412 | << 6. << 9. << QVector<double>{} << QVector<double>{}; |
|
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 | {100., 200., 300., 400., 500.}) |
|
425 | {100., 200., 300., 400., 500.}) | |
415 | << 5. << 9. << QVector<double>{5.} << QVector<double>{500.}; |
|
426 | << 5. << 9. << QVector<double>{5.} << QVector<double>{500.}; | |
416 | } |
|
427 | } | |
@@ -440,39 +451,31 void TestDataSeries::testValuesBoundsScalar_data() | |||||
440 | // ////////// // |
|
451 | // ////////// // | |
441 | // Test cases // |
|
452 | // Test cases // | |
442 | // ////////// // |
|
453 | // ////////// // | |
443 |
|
454 | auto nan = std::numeric_limits<double>::quiet_NaN(); | ||
444 | QTest::newRow("valuesBounds1") |
|
455 | ||
445 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 0. << 6. << true |
|
456 | QTest::newRow("scalarBounds1") | |
446 | << 100. << 500.; |
|
457 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 0. << 6. | |
447 | QTest::newRow("valuesBounds2") |
|
458 | << true << 100. << 500.; | |
448 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 2. << 4. << true |
|
459 | QTest::newRow("scalarBounds2") | |
449 | << 200. << 400.; |
|
460 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 2. << 4. | |
450 | QTest::newRow("valuesBounds3") |
|
461 | << true << 200. << 400.; | |
451 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 0. << 0.5 << false |
|
462 | QTest::newRow("scalarBounds3") | |
452 | << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN(); |
|
463 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 0. << 0.5 | |
453 | QTest::newRow("valuesBounds4") |
|
464 | << false << nan << nan; | |
454 | << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 5.1 << 6. << false |
|
465 | QTest::newRow("scalarBounds4") | |
455 | << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN(); |
|
466 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) << 5.1 << 6. | |
456 | QTest::newRow("valuesBounds5") |
|
467 | << false << nan << nan; | |
457 | << createSeries({1.}, {100.}) << 0. << 2. << true << 100. << 100.; |
|
468 | QTest::newRow("scalarBounds5") | |
458 | QTest::newRow("valuesBounds6") |
|
469 | << createScalarSeries({1.}, {100.}) << 0. << 2. << true << 100. << 100.; | |
459 | << createSeries({}, {}) << 0. << 2. << false << std::numeric_limits<double>::quiet_NaN() |
|
470 | QTest::newRow("scalarBounds6") << createScalarSeries({}, {}) << 0. << 2. << false << nan << nan; | |
460 | << std::numeric_limits<double>::quiet_NaN(); |
|
|||
461 |
|
471 | |||
462 | // Tests with NaN values: NaN values are not included in min/max search |
|
472 | // Tests with NaN values: NaN values are not included in min/max search | |
463 |
QTest::newRow(" |
|
473 | QTest::newRow("scalarBounds7") | |
464 | << createSeries({1., 2., 3., 4., 5.}, |
|
474 | << createScalarSeries({1., 2., 3., 4., 5.}, {nan, 200., 300., 400., nan}) << 0. << 6. | |
465 | {std::numeric_limits<double>::quiet_NaN(), 200., 300., 400., |
|
475 | << true << 200. << 400.; | |
466 | std::numeric_limits<double>::quiet_NaN()}) |
|
476 | QTest::newRow("scalarBounds8") | |
467 | << 0. << 6. << true << 200. << 400.; |
|
477 | << createScalarSeries({1., 2., 3., 4., 5.}, {nan, nan, nan, nan, nan}) << 0. << 6. << true | |
468 | QTest::newRow("valuesBounds8") |
|
478 | << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN(); | |
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(); |
|
|||
476 | } |
|
479 | } | |
477 |
|
480 | |||
478 | void TestDataSeries::testValuesBoundsScalar() |
|
481 | void TestDataSeries::testValuesBoundsScalar() | |
@@ -487,6 +490,7 void TestDataSeries::testValuesBoundsVector_data() | |||||
487 | // ////////// // |
|
490 | // ////////// // | |
488 | // Test cases // |
|
491 | // Test cases // | |
489 | // ////////// // |
|
492 | // ////////// // | |
|
493 | auto nan = std::numeric_limits<double>::quiet_NaN(); | |||
490 |
|
494 | |||
491 | QTest::newRow("vectorBounds1") |
|
495 | QTest::newRow("vectorBounds1") | |
492 | << createVectorSeries({1., 2., 3., 4., 5.}, {10., 15., 20., 13., 12.}, |
|
496 | << createVectorSeries({1., 2., 3., 4., 5.}, {10., 15., 20., 13., 12.}, | |
@@ -503,13 +507,8 void TestDataSeries::testValuesBoundsVector_data() | |||||
503 |
|
507 | |||
504 | // Tests with NaN values: NaN values are not included in min/max search |
|
508 | // Tests with NaN values: NaN values are not included in min/max search | |
505 | QTest::newRow("vectorBounds4") |
|
509 | QTest::newRow("vectorBounds4") | |
506 | << createVectorSeries( |
|
510 | << createVectorSeries({1., 2.}, {nan, nan}, {nan, nan}, {nan, nan}) << 0. << 6. << true | |
507 | {1., 2.}, |
|
511 | << nan << nan; | |
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(); |
|
|||
513 | } |
|
512 | } | |
514 |
|
513 | |||
515 | void TestDataSeries::testValuesBoundsVector() |
|
514 | void TestDataSeries::testValuesBoundsVector() |
General Comments 0
You need to be logged in to leave comments.
Login now