diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-30 20:50:45 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2019-07-01 07:18:16 +0200 |
commit | 706798376f42771f9c644852eeaeed5540f421ef (patch) | |
tree | 81e4b1e9278694018a3b42f732411fe304427756 /test/source/sheet/xdatapilottable2.cxx | |
parent | bfc19d77cb8db445f1c6123347c19a4c0c6a6cf8 (diff) |
Simplify Sequence iterations in test
Use range-based loops or replace with STL functions
Change-Id: I93efa86f49eb49dbdd3b7572dbd538bc300ded05
Reviewed-on: https://gerrit.libreoffice.org/74932
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'test/source/sheet/xdatapilottable2.cxx')
-rw-r--r-- | test/source/sheet/xdatapilottable2.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/source/sheet/xdatapilottable2.cxx b/test/source/sheet/xdatapilottable2.cxx index 7e4714db2378..98ecf2742453 100644 --- a/test/source/sheet/xdatapilottable2.cxx +++ b/test/source/sheet/xdatapilottable2.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/sheet/DataResult.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <cppunit/extensions/HelperMacros.h> +#include <numeric> using namespace css; using namespace css::uno; @@ -78,13 +79,13 @@ void XDataPilotTable2::testGetDrillDownData() if( aData.getLength() > 1 ) { - for ( sal_Int32 row = 1; row < aData.getLength(); ++row) - { - Any aAny = aData[row][nDim]; - double nValue = 0; - if (aAny >>= nValue) - sum += nValue; - } + sum = std::accumulate(std::next(aData.begin()), aData.end(), double(0), + [nDim](double res, const Sequence<Any>& rSeq) { + double nValue = 0; + if (rSeq[nDim] >>= nValue) + return res + nValue; + return res; + }); } CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, sum, 1E-12); |