The following issues were found
src/mongo/db/pipeline/sharded_union_test.cpp
1 issues
Line: 87
future.default_timed_get();
}
TEST_F(ShardedUnionTest, ForwardsMaxTimeMSToRemotes) {
// Sharded by {_id: 1}, [MinKey, 0) on shard "0", [0, MaxKey) on shard "1".
setupNShards(2);
loadRoutingTableWithTwoChunksAndTwoShards(kTestAggregateNss);
auto pipeline = Pipeline::create({}, expCtx());
Reported by Cppcheck.
src/mongo/db/pipeline/skip_and_limit_test.cpp
1 issues
Line: 47
ASSERT_EQ(*source.getSkip(), 5);
}
TEST(LimitThenSkip, FlipToSkipThenLimit) {
LimitThenSkip source(15, 5);
SkipThenLimit converted = source.flip();
ASSERT_EQ(*converted.getSkip(), 5);
ASSERT_EQ(*converted.getLimit(), 10);
}
Reported by Cppcheck.
src/mongo/db/pipeline/tee_buffer_test.cpp
1 issues
Line: 50
ASSERT_THROWS_CODE(TeeBuffer::create(0), AssertionException, 40309);
}
TEST_F(TeeBufferTest, ShouldRequirePositiveBatchSize) {
ASSERT_THROWS_CODE(TeeBuffer::create(1, 0), AssertionException, 40310);
ASSERT_THROWS_CODE(TeeBuffer::create(1, -2), AssertionException, 40310);
}
TEST_F(TeeBufferTest, ShouldBeExhaustedIfInputIsExhausted) {
Reported by Cppcheck.
src/mongo/db/pipeline/window_function/partition_iterator_test.cpp
1 issues
Line: 75
std::unique_ptr<PartitionIterator> _iter;
};
TEST_F(PartitionIteratorTest, IndexAccessPullsInRequiredDocument) {
const auto docs = std::deque<DocumentSource::GetNextResult>{
Document{{"a", 1}}, Document{{"b", 1}}, Document{{"c", 1}}};
const auto mock = DocumentSourceMock::createForTest(docs, getExpCtx());
auto partIter = makeDefaultAccessor(mock);
ASSERT_DOCUMENT_EQ(docs[0].getDocument(), *partIter[0]);
Reported by Cppcheck.
src/mongo/db/pipeline/window_function/spillable_cache_test.cpp
1 issues
Line: 139
int _lastIndex = 0;
};
TEST_F(SpillableCacheTest, CanReadAndWriteDocumentsInMem) {
_expCtx->allowDiskUse = false;
auto cache = createSpillableCache(1000);
buildAndLoadDocumentSet(2, cache.get());
verifyDocsInCache(0, 2, cache.get());
}
Reported by Cppcheck.
src/mongo/db/pipeline/window_function/window_function_add_to_set_test.cpp
1 issues
Line: 53
WindowFunctionAddToSet addToSet;
};
TEST_F(WindowFunctionAddToSetTest, EmptyWindowReturnsDefault) {
ASSERT_VALUE_EQ(addToSet.getValue(), Value{std::vector<Value>()});
addToSet.add(Value{1});
addToSet.remove(Value{1});
ASSERT_VALUE_EQ(addToSet.getValue(), Value{std::vector<Value>()});
Reported by Cppcheck.
src/mongo/db/pipeline/window_function/window_function_avg_test.cpp
1 issues
Line: 47
WindowFunctionAvg avg;
};
TEST_F(WindowFunctionAvgTest, EmptyWindow) {
ASSERT_VALUE_EQ(avg.getValue(), Value{BSONNULL});
}
TEST_F(WindowFunctionAvgTest, SingletonWindow) {
avg.add(Value{5});
Reported by Cppcheck.
src/mongo/db/pipeline/window_function/window_function_covariance_test.cpp
1 issues
Line: 62
}
// -------------- Test CovarianceSamp window function ----------
TEST_F(WindowFunctionCovarianceSampTest, EmptyWindowShouldReturnNull) {
ASSERT_VALUE_EQ(covariance.getValue(), Value(BSONNULL));
}
TEST_F(WindowFunctionCovarianceSampTest, SingletonWindowShouldReturnNull) {
covariance.add(Value(std::vector<Value>({Value(1.0), Value(2.0)})));
Reported by Cppcheck.
src/mongo/db/pipeline/window_function/window_function_exec_derivative_test.cpp
1 issues
Line: 92
std::unique_ptr<PartitionIterator> _iter;
};
TEST_F(WindowFunctionExecDerivativeTest, LookBehind) {
const auto docs = std::deque<DocumentSource::GetNextResult>{
Document{{"t", 0}, {"y", 1}},
Document{{"t", 1}, {"y", 2}},
Document{{"t", 2}, {"y", 4}},
Document{{"t", 3}, {"y", 8}},
Reported by Cppcheck.
src/mongo/db/pipeline/window_function/window_function_exec_first_last_test.cpp
1 issues
Line: 80
std::unique_ptr<PartitionIterator> _iter;
};
TEST_F(WindowFunctionExecFirstLastTest, LookBehind) {
const auto docs = std::deque<DocumentSource::GetNextResult>{
Document{{"val", 0}},
Document{{"val", 1}},
Document{{"val", 2}},
};
Reported by Cppcheck.