##// END OF EJS Templates
Implements unit tests for vectors
Alexandre Leroux -
r573:c1739842c2ee
parent child
Show More
@@ -101,6 +101,13 private slots:
101
101
102 /// Tests get values bounds of a scalar series
102 /// Tests get values bounds of a scalar series
103 void testValuesBoundsScalar();
103 void testValuesBoundsScalar();
104
105 /// Input test data
106 /// @sa testValuesBoundsVector()
107 void testValuesBoundsVector_data();
108
109 /// Tests get values bounds of a vector series
110 void testValuesBoundsVector();
104 };
111 };
105
112
106 void TestDataSeries::testCtor_data()
113 void TestDataSeries::testCtor_data()
@@ -172,6 +179,16 std::shared_ptr<ScalarSeries> createSeries(QVector<double> xAxisData, QVector<do
172 Unit{});
179 Unit{});
173 }
180 }
174
181
182 std::shared_ptr<VectorSeries> createVectorSeries(QVector<double> xAxisData,
183 QVector<double> xValuesData,
184 QVector<double> yValuesData,
185 QVector<double> zValuesData)
186 {
187 return std::make_shared<VectorSeries>(std::move(xAxisData), std::move(xValuesData),
188 std::move(yValuesData), std::move(zValuesData), Unit{},
189 Unit{});
190 }
191
175 } // namespace
192 } // namespace
176
193
177 void TestDataSeries::testMerge_data()
194 void TestDataSeries::testMerge_data()
@@ -463,5 +480,42 void TestDataSeries::testValuesBoundsScalar()
463 testValuesBounds<ScalarSeries>();
480 testValuesBounds<ScalarSeries>();
464 }
481 }
465
482
483 void TestDataSeries::testValuesBoundsVector_data()
484 {
485 testValuesBoundsStructure<VectorSeries>();
486
487 // ////////// //
488 // Test cases //
489 // ////////// //
490
491 QTest::newRow("vectorBounds1")
492 << createVectorSeries({1., 2., 3., 4., 5.}, {10., 15., 20., 13., 12.},
493 {35., 24., 10., 9., 0.3}, {13., 14., 12., 9., 24.})
494 << 0. << 6. << true << 0.3 << 35.; // min/max in same component
495 QTest::newRow("vectorBounds2")
496 << createVectorSeries({1., 2., 3., 4., 5.}, {2.3, 15., 20., 13., 12.},
497 {35., 24., 10., 9., 4.}, {13., 14., 12., 9., 24.})
498 << 0. << 6. << true << 2.3 << 35.; // min/max in same entry
499 QTest::newRow("vectorBounds3")
500 << createVectorSeries({1., 2., 3., 4., 5.}, {2.3, 15., 20., 13., 12.},
501 {35., 24., 10., 9., 4.}, {13., 14., 12., 9., 24.})
502 << 2. << 3. << true << 10. << 24.;
503
504 // Tests with NaN values: NaN values are not included in min/max search
505 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();
513 }
514
515 void TestDataSeries::testValuesBoundsVector()
516 {
517 testValuesBounds<VectorSeries>();
518 }
519
466 QTEST_MAIN(TestDataSeries)
520 QTEST_MAIN(TestDataSeries)
467 #include "TestDataSeries.moc"
521 #include "TestDataSeries.moc"
General Comments 0
You need to be logged in to leave comments. Login now