The following issues were found
src/mongo/db/exec/sbe/expressions/sbe_bson_size_test.cpp
1 issues
Line: 57
ASSERT_EQUALS(value::bitcastTo<int32_t>(val), bsonObj.objsize());
}
TEST_F(SBEBsonSizeTest, ComputesSizeForSbeObject) {
value::ViewOfValueAccessor slotAccessor;
auto argSlot = bindAccessor(&slotAccessor);
auto bsonSizeExpr =
sbe::makeE<sbe::EFunction>("bsonSize", sbe::makeEs(makeE<EVariable>(argSlot)));
auto compiledExpr = compileExpression(*bsonSizeExpr);
Reported by Cppcheck.
src/mongo/db/exec/sbe/expressions/sbe_coerce_to_string_test.cpp
1 issues
Line: 54
}
};
TEST_F(SBECoerceToStringTest, BasicCoerceToString) {
value::OwnedValueAccessor coerceToStringAccessor;
auto coerceToStringSlot = bindAccessor(&coerceToStringAccessor);
auto coerceToStringExpr = sbe::makeE<sbe::EFunction>(
"coerceToString", sbe::makeEs(makeE<EVariable>(coerceToStringSlot)));
auto compiledExpr = compileExpression(*coerceToStringExpr);
Reported by Cppcheck.
src/mongo/db/exec/sbe/expressions/sbe_concat_test.cpp
1 issues
Line: 52
}
};
TEST_F(SBEConcatTest, ComputesEmptyStringsConcat) {
value::OwnedValueAccessor slotAccessor1;
value::OwnedValueAccessor slotAccessor2;
auto argSlot1 = bindAccessor(&slotAccessor1);
auto argSlot2 = bindAccessor(&slotAccessor2);
auto concatExpr = sbe::makeE<sbe::EFunction>(
Reported by Cppcheck.
src/mongo/db/exec/sbe/expressions/sbe_date_add_test.cpp
1 issues
Line: 52
}
};
TEST_F(SBEBuiltinDateAddTest, ComputesDateAdd) {
value::OwnedValueAccessor timezoneDBAccessor;
auto timezoneDBSlot = bindAccessor(&timezoneDBAccessor);
value::OwnedValueAccessor startDateAccessor;
auto startDateSlot = bindAccessor(&startDateAccessor);
value::OwnedValueAccessor unitAccessor;
Reported by Cppcheck.
src/mongo/db/exec/sbe/expressions/sbe_date_diff_test.cpp
1 issues
Line: 89
/**
* A test for SBE built-in function "dateDiff".
*/
TEST_F(SBEDateDiffTest, BasicDateDiff) {
value::OwnedValueAccessor timezoneDBAccessor;
auto timezoneDBSlot = bindAccessor(&timezoneDBAccessor);
value::OwnedValueAccessor startDateAccessor;
auto startDateSlot = bindAccessor(&startDateAccessor);
value::OwnedValueAccessor endDateAccessor;
Reported by Cppcheck.
src/mongo/db/exec/sbe/expressions/sbe_date_to_parts_test.cpp
1 issues
Line: 87
}
};
TEST_F(SBEDateToPartsTest, BasicDateToParts) {
value::OwnedValueAccessor timezoneDBAccessor;
auto timezoneDBSlot = bindAccessor(&timezoneDBAccessor);
value::OwnedValueAccessor dateAccessor;
auto dateSlot = bindAccessor(&dateAccessor);
value::OwnedValueAccessor timezoneAccessor;
Reported by Cppcheck.
src/mongo/db/exec/sbe/expressions/sbe_day_of_expressions_test.cpp
1 issues
Line: 55
}
};
TEST_F(SBEDayOfExpressionTest, BasicDayOfYear) {
value::OwnedValueAccessor timezoneDBAccessor;
auto timezoneDBSlot = bindAccessor(&timezoneDBAccessor);
value::OwnedValueAccessor dateAccessor;
auto dateSlot = bindAccessor(&dateAccessor);
value::OwnedValueAccessor timezoneAccessor;
Reported by Cppcheck.
src/mongo/db/exec/sbe/expressions/sbe_extract_sub_array_builtin_test.cpp
1 issues
Line: 148
std::vector<TestCase> testCases;
};
TEST_F(SBEBuiltinExtractSubArrayTest, Array) {
for (const auto& testCase : testCases) {
runAndAssertExpression(testCase, makeArray);
}
}
Reported by Cppcheck.
src/mongo/db/exec/sbe/expressions/sbe_get_element_builtin_test.cpp
1 issues
Line: 120
std::vector<TestCase> testCases;
};
TEST_F(SBEBuiltinGetElementTest, GetElementBSONArray) {
for (const auto& testCase : testCases) {
auto bsonArray = makeBsonArray(testCase.array);
value::ValueGuard guard{bsonArray};
runAndAssertExpression(bsonArray, testCase.index, testCase.expected);
}
Reported by Cppcheck.
src/mongo/db/exec/sbe/expressions/sbe_index_of_test.cpp
1 issues
Line: 89
compileExpression(*indexOfCPExprStartIndex);
};
TEST_F(SBEIndexOfTest, IndexOfBytesBasicTest) {
// Test $indexOfBytes returns first substring found.
auto [strTag, strVal] = value::makeNewString("cafeteria");
stringAccessor.reset(strTag, strVal);
auto [substrTag, substrVal] = value::makeNewString("e");
substringAccessor.reset(substrTag, substrVal);
Reported by Cppcheck.