Commit 9c5df58a by Marcus Winter

algorithms_cpp: removed cppcheck warnings

parent a38149f8
...@@ -115,13 +115,9 @@ void ScanTest::TestFunctionPointers() { ...@@ -115,13 +115,9 @@ void ScanTest::TestFunctionPointers() {
std::vector<int> vector(kCountSize); std::vector<int> vector(kCountSize);
std::vector<int> init(kCountSize); std::vector<int> init(kCountSize);
std::vector<int> outputVector(kCountSize); std::vector<int> outputVector(kCountSize);
int sum = 0;
int sqr_sum = 0;
for (size_t i = 0; i < kCountSize; i++) { for (size_t i = 0; i < kCountSize; i++) {
vector[i] = static_cast<int>(i+2); vector[i] = static_cast<int>(i+2);
init[i] = 0; init[i] = 0;
sum += static_cast<int>(i + 2);
sqr_sum += static_cast<int>((i + 2) * (i + 2));
} }
Scan(vector.begin(), vector.end(), outputVector.begin(), 0, &AddFunction); Scan(vector.begin(), vector.end(), outputVector.begin(), 0, &AddFunction);
......
...@@ -110,14 +110,14 @@ void ZipIteratorTest::TestZipReduce() { ...@@ -110,14 +110,14 @@ void ZipIteratorTest::TestZipReduce() {
sum += static_cast<long>((i + 2) * (i + 2)); sum += static_cast<long>((i + 2) * (i + 2));
} }
std::vector<int>::const_iterator iterA;
std::vector<int>::const_iterator iterB;
embb::algorithms::ZipIterator<constVectorIterator, constVectorIterator> embb::algorithms::ZipIterator<constVectorIterator, constVectorIterator>
start_iterator = embb::algorithms::Zip(iterA = vectorA.begin(), start_iterator = embb::algorithms::Zip(
iterB = vectorB.begin()); std::vector<int>::const_iterator(vectorA.begin()),
std::vector<int>::const_iterator(vectorB.begin()));
embb::algorithms::ZipIterator<constVectorIterator, constVectorIterator> embb::algorithms::ZipIterator<constVectorIterator, constVectorIterator>
end_iterator = embb::algorithms::Zip(iterA = vectorA.end(), end_iterator = embb::algorithms::Zip(
iterB = vectorB.end()); std::vector<int>::const_iterator(vectorA.end()),
std::vector<int>::const_iterator(vectorB.end()));
PT_EXPECT_EQ(embb::algorithms::Reduce(start_iterator, end_iterator, 0, PT_EXPECT_EQ(embb::algorithms::Reduce(start_iterator, end_iterator, 0,
std::plus<int>(), DotProductFunctor()), sum); std::plus<int>(), DotProductFunctor()), sum);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment