The following issues were found

src/mongo/db/matcher/schema/encrypt_schema_types_test.cpp
1 issues
syntax error
Error

Line: 53

                  ASSERT_FALSE(UUID::parse(keyid.jsonPointer().toString()).isOK());
}

TEST(EncryptSchemaTest, KeyIDTypeArrayTest) {
    auto tempObj =
        BSON("array" << BSON_ARRAY(UUID::gen() << UUID::gen() << UUID::gen() << UUID::gen()));
    auto elem = tempObj["array"];
    auto keyid = EncryptSchemaKeyId::parseFromBSON(elem);
    ASSERT(keyid.type() == EncryptSchemaKeyId::Type::kUUIDs);

            

Reported by Cppcheck.

src/mongo/db/matcher/schema/expression_internal_schema_all_elem_match_from_index_test.cpp
1 issues
syntax error
Error

Line: 51

                  ASSERT_TRUE(expr.getValue()->matchesBSON(BSON("a" << BSON_ARRAY(1 << 2 << 3 << 4))));
}

TEST(InternalSchemaAllElemMatchFromIndexMatchExpression, MatchesValidQueries) {
    auto query = fromjson("{a: {$_internalSchemaAllElemMatchFromIndex: [2, {a: {$lt: 5}}]}}");
    boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest());
    auto expr = MatchExpressionParser::parse(query, expCtx);
    ASSERT_OK(expr.getStatus());
    ASSERT_TRUE(expr.getValue()->matchesBSON(BSON("a" << BSON_ARRAY(1 << 2 << 3 << 4))));

            

Reported by Cppcheck.

src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties_test.cpp
1 issues
syntax error
Error

Line: 54

                  ASSERT_TRUE(expr.getValue()->matchesBSON(fromjson("{b: 1}")));
}

TEST(InternalSchemaAllowedPropertiesMatchExpression, MatchesObjectsWithMatchingPatternProperties) {
    auto filter = fromjson(R"(
        {$_internalSchemaAllowedProperties: {
            properties: [],
            namePlaceholder: 'i',
            patternProperties: [

            

Reported by Cppcheck.

src/mongo/db/matcher/schema/expression_internal_schema_cond_test.cpp
1 issues
syntax error
Error

Line: 64

                  return cond;
}

TEST(InternalSchemaCondMatchExpressionTest, AcceptsObjectsThatMatch) {
    auto conditionQuery = BSON("age" << BSON("$lt" << 18));
    auto thenQuery = BSON("job"
                          << "student");
    auto elseQuery = BSON("job"
                          << "engineer");

            

Reported by Cppcheck.

src/mongo/db/matcher/schema/expression_internal_schema_eq_test.cpp
1 issues
syntax error
Error

Line: 58

                                                                << "string")));
}

TEST(InternalSchemaEqMatchExpression, CorrectlyMatchesArrayElement) {
    BSONObj operand = BSON("a" << BSON_ARRAY("b" << 5));

    InternalSchemaEqMatchExpression eq("a", operand["a"]);
    ASSERT_TRUE(eq.matchesBSON(BSON("a" << BSON_ARRAY("b" << 5))));
    ASSERT_FALSE(eq.matchesBSON(BSON("a" << BSON_ARRAY(5 << "b"))));

            

Reported by Cppcheck.

src/mongo/db/matcher/schema/expression_internal_schema_fmod_test.cpp
1 issues
syntax error
Error

Line: 52

                  ASSERT_FALSE(fmod.matchesSingleElement(negativeNotMatch.firstElement()));
}

TEST(InternalSchemaFmodMatchExpression, ZeroDivisor) {
    ASSERT_THROWS_CODE(InternalSchemaFmodMatchExpression("", Decimal128(0), Decimal128(1)),
                       AssertionException,
                       ErrorCodes::BadValue);
}


            

Reported by Cppcheck.

src/mongo/db/matcher/schema/expression_internal_schema_match_array_index_test.cpp
1 issues
syntax error
Error

Line: 56

                  ASSERT_FALSE(expr.getValue()->matchesBSON(fromjson("{foo: {i: []}}")));
}

TEST(InternalSchemaMatchArrayIndexMatchExpression, MatchesArraysWithMatchingElement) {
    auto filter = fromjson(
        "{foo: {$_internalSchemaMatchArrayIndex:"
        "{index: 0, namePlaceholder: 'i', expression: {i: {$elemMatch: {'bar': 7}}}}}}");
    boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest());
    auto expr = MatchExpressionParser::parse(filter, expCtx);

            

Reported by Cppcheck.

src/mongo/db/matcher/schema/expression_internal_schema_max_items_test.cpp
1 issues
syntax error
Error

Line: 49

                                                    << "string")));
}

TEST(InternalSchemaMaxItemsMatchExpression, RejectsArraysWithTooManyElements) {
    InternalSchemaMaxItemsMatchExpression maxItems("a", 0);

    ASSERT(!maxItems.matchesBSON(BSON("a" << BSON_ARRAY(1))));
    ASSERT(!maxItems.matchesBSON(BSON("a" << BSON_ARRAY(1 << 2))));
}

            

Reported by Cppcheck.

src/mongo/db/matcher/schema/expression_internal_schema_max_length_test.cpp
1 issues
syntax error
Error

Line: 49

                  ASSERT_FALSE(maxLength.matchesBSON(BSON("a" << BSON_ARRAY(1))));
}

TEST(InternalSchemaMaxLengthMatchExpression, RejectsStringsWithTooManyChars) {
    InternalSchemaMaxLengthMatchExpression maxLength("a", 2);

    ASSERT_FALSE(maxLength.matchesBSON(BSON("a"
                                            << "abc")));
    ASSERT_FALSE(maxLength.matchesBSON(BSON("a"

            

Reported by Cppcheck.

src/mongo/db/matcher/schema/expression_internal_schema_max_properties_test.cpp
1 issues
syntax error
Error

Line: 48

                  ASSERT_FALSE(maxProperties.matchesBSON(BSON("b" << 21 << "c" << 3)));
}

TEST(InternalSchemaMaxPropertiesMatchExpression, AcceptsObjectWithLessThanOrEqualToMaxElements) {
    InternalSchemaMaxPropertiesMatchExpression maxProperties(2);

    ASSERT_TRUE(maxProperties.matchesBSON(BSONObj()));
    ASSERT_TRUE(maxProperties.matchesBSON(BSON("b" << BSONNULL)));
    ASSERT_TRUE(maxProperties.matchesBSON(BSON("b" << 21)));

            

Reported by Cppcheck.