Skip to content

Fix CPPCheck issues - Argument is passed by value #8

@eljonny

Description

@eljonny

These should be refactored to be passed by reference instead to avoid copy overhead.

include/internal/TestCPPAssertions.h:78:24: performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
                string failureMessage = "Arguments are not equivalent!"
                       ^
include/internal/TestCPPAssertions.h:109:24: performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
                string failureMessage = "Arguments are equivalent!"
                       ^
include/internal/TestCPPAssertions.h:136:24: performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
                string failureMessage = "Object is not null!"
                       ^
include/internal/TestCPPAssertions.h:163:24: performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
                string failureMessage = "Object is null!"
                       ^
src/TestCPPAssertions.cpp:92:20: performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
            string failureMessage
                   ^
src/TestCPPAssertions.cpp:107:20: performance: Function parameter 'failureMessage' should be passed by const reference. [passedByValue]
            string failureMessage

src/TestCPPTestCase.cpp:479:40: performance: Function parameter 'against' should be passed by const reference. [passedByValue]
    bool TestCase::checkStdout (string against) {
                                       ^
src/TestCPPTestCase.cpp:484:37: performance: Function parameter 'against' should be passed by const reference. [passedByValue]
    bool TestCase::checkLog (string against) {
                                    ^
src/TestCPPTestCase.cpp:489:40: performance: Function parameter 'against' should be passed by const reference. [passedByValue]
    bool TestCase::checkStderr (string against) {
                                       ^
src/TestCPPTestCase.cpp:494:40: performance: Function parameter 'source' should be passed by const reference. [passedByValue]
    bool TestCase::checkOutput (string source, string against)
                                       ^
src/TestCPPTestCase.cpp:494:55: performance: Function parameter 'against' should be passed by const reference. [passedByValue]
    bool TestCase::checkOutput (string source, string against)
                                                      ^

Sub-issues

Metadata

Metadata

Assignees

Labels

static-analysisAn issue related to a static analysis resulttest-assertionsRelating to the TestCPP assertionstest-caseRelating to TestCPP TestCase

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions