The following issues were found

src/mongo/db/pipeline/memory_usage_tracker_test.cpp
1 issues
syntax error
Error

Line: 48

                  MemoryUsageTracker::PerFunctionMemoryTracker _funcTracker;
};

TEST_F(MemoryUsageTrackerTest, SetUpdatesCurrentAndMax) {
    _tracker.set(50LL);
    ASSERT_EQ(_tracker.currentMemoryBytes(), 50LL);
    ASSERT_EQ(_tracker.maxMemoryBytes(), 50LL);

    _tracker.set(_tracker.currentMemoryBytes() + 50);

            

Reported by Cppcheck.

src/mongo/db/pipeline/partition_key_comparator_test.cpp
1 issues
syntax error
Error

Line: 52

                  std::unique_ptr<PartitionKeyComparator> _keyComparator = nullptr;
};

TEST_F(PartitionKeyComparatorTest, DetectsPartitionChangeBetweenDocuments) {
    Document docOne{{"a", 1}};
    makeWithDefaultExpression(docOne);
    Document docTwo{{"a", 2}};
    ASSERT_TRUE(_keyComparator->isDocumentNewPartition(docTwo));
}

            

Reported by Cppcheck.

src/mongo/db/pipeline/pipeline_metadata_tree_test.cpp
1 issues
syntax error
Error

Line: 108

              
using namespace pipeline_metadata_tree;

TEST_F(PipelineMetadataTreeTest, LinearPipelinesConstructProperTrees) {
    struct TestThing {
        auto operator==(const TestThing& other) const {
            return number == other.number;
        }
        int number;

            

Reported by Cppcheck.

src/mongo/db/pipeline/pipeline_test.cpp
1 issues
syntax error
Error

Line: 156

                  assertPipelineOptimizesAndSerializesTo(inputPipeJson, outputPipeJson, outputPipeJson);
}

TEST(PipelineOptimizationTest, MoveSkipBeforeProject) {
    assertPipelineOptimizesTo("[{$project: {a : 1}}, {$skip : 5}]",
                              "[{$skip : 5}, {$project: {_id: true, a : true}}]");
}

TEST(PipelineOptimizationTest, LimitDoesNotMoveBeforeProject) {

            

Reported by Cppcheck.

src/mongo/db/pipeline/process_interface/mongos_process_interface_test.cpp
1 issues
syntax error
Error

Line: 63

                  }
};

TEST_F(MongosProcessInterfaceTest, FailsToEnsureFieldsUniqueIfTargetCollectionVersionIsSpecified) {
    auto expCtx = getExpCtx();
    auto targetCollectionVersion =
        boost::make_optional(ChunkVersion(0, 0, OID::gen(), boost::none /* timestamp */));
    auto processInterface = makeProcessInterface();


            

Reported by Cppcheck.

src/mongo/db/pipeline/process_interface/standalone_process_interface_test.cpp
1 issues
syntax error
Error

Line: 66

                  }
};

TEST_F(ProcessInterfaceStandaloneTest,
       FailsToEnsureFieldsUniqueIfTargetCollectionVersionIsSpecifiedOnMongos) {
    auto expCtx = getExpCtx();
    auto targetCollectionVersion =
        boost::make_optional(ChunkVersion(0, 0, OID::gen(), boost::none /* timestamp */));
    auto processInterface = makeProcessInterface();

            

Reported by Cppcheck.

src/mongo/db/pipeline/resharding_initial_split_policy_test.cpp
1 issues
syntax error
Error

Line: 48

              
const ShardId primaryShardId = ShardId("0");

TEST_F(ReshardingSplitPolicyTest, ShardKeyWithNonDottedFieldAndIdIsNotProjectedSucceeds) {
    auto shardKeyPattern = ShardKeyPattern(BSON("a" << 1));

    auto pipeline =
        Pipeline::parse(ReshardingSplitPolicy::createRawPipeline(
                            shardKeyPattern, 2 /* samplingRatio */, 1 /* numSplitPoints */),

            

Reported by Cppcheck.

src/mongo/db/pipeline/resume_token_test.cpp
1 issues
syntax error
Error

Line: 58

                  ASSERT_EQ(resumeTokenDataIn, tokenData);
}

TEST(ResumeToken, EncodesTimestampOnlyTokenFromData) {
    Timestamp ts(1001, 3);

    ResumeTokenData resumeTokenDataIn;
    resumeTokenDataIn.clusterTime = ts;
    ResumeToken token(resumeTokenDataIn);

            

Reported by Cppcheck.

src/mongo/db/pipeline/semantic_analysis_test.cpp
1 issues
syntax error
Error

Line: 61

                  }
};

TEST_F(SemanticAnalysisRenamedPaths, DoesReturnSimpleRenameFromFiniteSetRename) {
    RenamesAToB renamesAToB(getExpCtx());
    {
        auto renames = renamedPaths({"a"}, renamesAToB, Direction::kForward);
        ASSERT(static_cast<bool>(renames));
        auto map = *renames;

            

Reported by Cppcheck.

src/mongo/db/pipeline/sequential_document_cache_test.cpp
1 issues
syntax error
Error

Line: 43

              
const size_t kCacheSizeBytes = 1024;

TEST(SequentialDocumentCacheTest, CacheIsInBuildingModeUponInstantiation) {
    SequentialDocumentCache cache(kCacheSizeBytes);
    ASSERT(cache.isBuilding());
}

TEST(SequentialDocumentCacheTest, CanAddDocumentsToCacheWhileBuilding) {

            

Reported by Cppcheck.