From 9c5df58a5b97880e7ac80abdf9d7d3f74e0de723 Mon Sep 17 00:00:00 2001 From: Marcus Winter Date: Mon, 19 Jan 2015 10:46:13 +0100 Subject: [PATCH] algorithms_cpp: removed cppcheck warnings --- algorithms_cpp/test/scan_test.cc | 4 ---- algorithms_cpp/test/zip_iterator_test.cc | 12 ++++++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/algorithms_cpp/test/scan_test.cc b/algorithms_cpp/test/scan_test.cc index f1e10d0..47988df 100644 --- a/algorithms_cpp/test/scan_test.cc +++ b/algorithms_cpp/test/scan_test.cc @@ -115,13 +115,9 @@ void ScanTest::TestFunctionPointers() { std::vector vector(kCountSize); std::vector init(kCountSize); std::vector outputVector(kCountSize); - int sum = 0; - int sqr_sum = 0; for (size_t i = 0; i < kCountSize; i++) { vector[i] = static_cast(i+2); init[i] = 0; - sum += static_cast(i + 2); - sqr_sum += static_cast((i + 2) * (i + 2)); } Scan(vector.begin(), vector.end(), outputVector.begin(), 0, &AddFunction); diff --git a/algorithms_cpp/test/zip_iterator_test.cc b/algorithms_cpp/test/zip_iterator_test.cc index 6d59aba..0b85671 100644 --- a/algorithms_cpp/test/zip_iterator_test.cc +++ b/algorithms_cpp/test/zip_iterator_test.cc @@ -110,14 +110,14 @@ void ZipIteratorTest::TestZipReduce() { sum += static_cast((i + 2) * (i + 2)); } - std::vector::const_iterator iterA; - std::vector::const_iterator iterB; embb::algorithms::ZipIterator - start_iterator = embb::algorithms::Zip(iterA = vectorA.begin(), - iterB = vectorB.begin()); + start_iterator = embb::algorithms::Zip( + std::vector::const_iterator(vectorA.begin()), + std::vector::const_iterator(vectorB.begin())); embb::algorithms::ZipIterator - end_iterator = embb::algorithms::Zip(iterA = vectorA.end(), - iterB = vectorB.end()); + end_iterator = embb::algorithms::Zip( + std::vector::const_iterator(vectorA.end()), + std::vector::const_iterator(vectorB.end())); PT_EXPECT_EQ(embb::algorithms::Reduce(start_iterator, end_iterator, 0, std::plus(), DotProductFunctor()), sum); -- libgit2 0.26.0