diff --git a/core/include/Data/ArrayData.h b/core/include/Data/ArrayData.h index ab14657..16f54fe 100644 --- a/core/include/Data/ArrayData.h +++ b/core/include/Data/ArrayData.h @@ -94,7 +94,6 @@ public: } int distance(const ArrayDataIteratorValue::Impl &other) const override try { - /// @todo ALX : validate const auto &otherImpl = dynamic_cast(other); return std::distance(otherImpl.m_It, m_It) / m_NbComponents; } diff --git a/core/include/Data/DataSeries.h b/core/include/Data/DataSeries.h index dff18f8..e7d74c9 100644 --- a/core/include/Data/DataSeries.h +++ b/core/include/Data/DataSeries.h @@ -146,7 +146,7 @@ public: /// @sa IDataSeries::valuesUnit() Unit valuesUnit() const override { return m_ValuesUnit; } - int nbPoints() const override { return m_XAxisData->totalSize() + m_ValuesData->totalSize(); } + int nbPoints() const override { return m_ValuesData->totalSize(); } void clear() { diff --git a/core/include/Data/IDataSeries.h b/core/include/Data/IDataSeries.h index 19778fb..44ed1dd 100644 --- a/core/include/Data/IDataSeries.h +++ b/core/include/Data/IDataSeries.h @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -12,22 +13,6 @@ template class ArrayData; -struct Unit { - explicit Unit(const QString &name = {}, bool timeUnit = false) - : m_Name{name}, m_TimeUnit{timeUnit} - { - } - - inline bool operator==(const Unit &other) const - { - return std::tie(m_Name, m_TimeUnit) == std::tie(other.m_Name, other.m_TimeUnit); - } - inline bool operator!=(const Unit &other) const { return !(*this == other); } - - QString m_Name; ///< Unit name - bool m_TimeUnit; ///< The unit is a unit of time (UTC) -}; - /** * @brief The IDataSeries aims to declare a data series. * diff --git a/core/include/Data/Unit.h b/core/include/Data/Unit.h new file mode 100644 index 0000000..24cdc47 --- /dev/null +++ b/core/include/Data/Unit.h @@ -0,0 +1,23 @@ +#ifndef SCIQLOP_UNIT_H +#define SCIQLOP_UNIT_H + +#include +#include + +struct Unit { + explicit Unit(const QString &name = {}, bool timeUnit = false) + : m_Name{name}, m_TimeUnit{timeUnit} + { + } + + inline bool operator==(const Unit &other) const + { + return std::tie(m_Name, m_TimeUnit) == std::tie(other.m_Name, other.m_TimeUnit); + } + inline bool operator!=(const Unit &other) const { return !(*this == other); } + + QString m_Name; ///< Unit name + bool m_TimeUnit; ///< The unit is a unit of time (UTC) +}; + +#endif // SCIQLOP_UNIT_H diff --git a/core/tests/Variable/TestVariable.cpp b/core/tests/Variable/TestVariable.cpp index e3389e8..a8fca16 100644 --- a/core/tests/Variable/TestVariable.cpp +++ b/core/tests/Variable/TestVariable.cpp @@ -296,21 +296,21 @@ void TestVariable::testNbPoints_data() // ////////// // NbPointsOperations operations{}; - // Sets cache range (expected nb points = series xAxis data + series values data) + // Sets cache range (expected nb points = values data) auto cacheRange = SqpRange{date(2017, 1, 1, 12, 0, 0), date(2017, 1, 1, 12, 0, 9)}; - operations.push_back({cacheRange, dataSeries(cacheRange), 20}); + operations.push_back({cacheRange, dataSeries(cacheRange), 10}); // Doubles cache but don't add data series (expected nb points don't change) cacheRange = SqpRange{date(2017, 1, 1, 12, 0, 0), date(2017, 1, 1, 12, 0, 19)}; - operations.push_back({cacheRange, dataSeries(INVALID_RANGE), 20}); + operations.push_back({cacheRange, dataSeries(INVALID_RANGE), 10}); // Doubles cache and data series (expected nb points change) cacheRange = SqpRange{date(2017, 1, 1, 12, 0, 0), date(2017, 1, 1, 12, 0, 19)}; - operations.push_back({cacheRange, dataSeries(cacheRange), 40}); + operations.push_back({cacheRange, dataSeries(cacheRange), 20}); // Decreases cache (expected nb points decreases as the series is purged) cacheRange = SqpRange{date(2017, 1, 1, 12, 0, 5), date(2017, 1, 1, 12, 0, 9)}; - operations.push_back({cacheRange, dataSeries(INVALID_RANGE), 10}); + operations.push_back({cacheRange, dataSeries(INVALID_RANGE), 5}); QTest::newRow("nbPoints1") << operations; }