@@ -125,6 +125,39 private: | |||||
125 | expectedValuesData); |
|
125 | expectedValuesData); | |
126 | } |
|
126 | } | |
127 |
|
127 | |||
|
128 | template <typename SourceType, typename DestType> | |||
|
129 | void testMergeDifferentTypesStructure() | |||
|
130 | { | |||
|
131 | // ////////////// // | |||
|
132 | // Test structure // | |||
|
133 | // ////////////// // | |||
|
134 | ||||
|
135 | // Data series to merge | |||
|
136 | QTest::addColumn<std::shared_ptr<DestType> >("dest"); | |||
|
137 | QTest::addColumn<std::shared_ptr<SourceType> >("source"); | |||
|
138 | ||||
|
139 | // Expected values in the dest data series after merge | |||
|
140 | QTest::addColumn<DataContainer>("expectedXAxisData"); | |||
|
141 | QTest::addColumn<DataContainer>("expectedValuesData"); | |||
|
142 | } | |||
|
143 | ||||
|
144 | template <typename SourceType, typename DestType> | |||
|
145 | void testMergeDifferentTypes() | |||
|
146 | { | |||
|
147 | // Merges series | |||
|
148 | QFETCH(std::shared_ptr<SourceType>, source); | |||
|
149 | QFETCH(std::shared_ptr<DestType>, dest); | |||
|
150 | ||||
|
151 | dest->merge(source.get()); | |||
|
152 | ||||
|
153 | // Validates results : we check that the merge is valid and the data series is sorted on its | |||
|
154 | // x-axis data | |||
|
155 | QFETCH(DataContainer, expectedXAxisData); | |||
|
156 | QFETCH(DataContainer, expectedValuesData); | |||
|
157 | ||||
|
158 | validateRange(dest->cbegin(), dest->cend(), expectedXAxisData, expectedValuesData); | |||
|
159 | } | |||
|
160 | ||||
128 | private slots: |
|
161 | private slots: | |
129 |
|
162 | |||
130 | /// Input test data |
|
163 | /// Input test data | |
@@ -142,6 +175,13 private slots: | |||||
142 | void testMerge(); |
|
175 | void testMerge(); | |
143 |
|
176 | |||
144 | /// Input test data |
|
177 | /// Input test data | |
|
178 | /// @sa testMergeVectorInScalar() | |||
|
179 | void testMergeVectorInScalar_data(); | |||
|
180 | ||||
|
181 | /// Tests merge of vector series in scalar series | |||
|
182 | void testMergeVectorInScalar(); | |||
|
183 | ||||
|
184 | /// Input test data | |||
145 | /// @sa testPurgeScalar() |
|
185 | /// @sa testPurgeScalar() | |
146 | void testPurgeScalar_data(); |
|
186 | void testPurgeScalar_data(); | |
147 |
|
187 | |||
@@ -323,6 +363,26 void TestDataSeries::testMerge() | |||||
323 | validateRange(dataSeries->cbegin(), dataSeries->cend(), expectedXAxisData, expectedValuesData); |
|
363 | validateRange(dataSeries->cbegin(), dataSeries->cend(), expectedXAxisData, expectedValuesData); | |
324 | } |
|
364 | } | |
325 |
|
365 | |||
|
366 | void TestDataSeries::testMergeVectorInScalar_data() | |||
|
367 | { | |||
|
368 | testMergeDifferentTypesStructure<VectorSeries, ScalarSeries>(); | |||
|
369 | ||||
|
370 | // ////////// // | |||
|
371 | // Test cases // | |||
|
372 | // ////////// // | |||
|
373 | ||||
|
374 | QTest::newRow("purgeVectorInScalar") | |||
|
375 | << createScalarSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.}) | |||
|
376 | << createVectorSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.}, | |||
|
377 | {610., 710., 810., 910., 1010.}, {620., 720., 820., 920., 1020.}) | |||
|
378 | << DataContainer{1., 2., 3., 4., 5.} << DataContainer{100., 200., 300., 400., 500.}; | |||
|
379 | } | |||
|
380 | ||||
|
381 | void TestDataSeries::testMergeVectorInScalar() | |||
|
382 | { | |||
|
383 | testMergeDifferentTypes<VectorSeries, ScalarSeries>(); | |||
|
384 | } | |||
|
385 | ||||
326 | void TestDataSeries::testPurgeScalar_data() |
|
386 | void TestDataSeries::testPurgeScalar_data() | |
327 | { |
|
387 | { | |
328 | testPurgeStructure<ScalarSeries>(); |
|
388 | testPurgeStructure<ScalarSeries>(); |
General Comments 0
You need to be logged in to leave comments.
Login now