The following issues were found
src/mongo/db/fts/fts_unicode_phrase_matcher_test.cpp
1 issues
Line: 57
}
// Case sensitive & diacritic insensitive match.
TEST(FtsUnicodePhraseMatcher, CaseSensitiveAndDiacriticInsensitive) {
std::string str =
"El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, añoraba";
std::string find1 = "pinguino Wenceslao";
std::string find2 = "El pinguino";
Reported by Cppcheck.
src/mongo/db/fts/fts_unicode_tokenizer_test.cpp
1 issues
Line: 56
}
// Ensure punctuation is filtered out of the indexed document and the 's is not separated
TEST(FtsUnicodeTokenizer, English) {
std::vector<std::string> terms =
tokenizeString("Do you see Mark's dog running?", "english", FTSTokenizer::kNone);
ASSERT_EQUALS(6U, terms.size());
ASSERT_EQUALS("do", terms[0]);
Reported by Cppcheck.
src/mongo/db/fts/stemmer_test.cpp
1 issues
Line: 48
}
} // namespace
TEST(English, Stemmer1) {
Stemmer s(languageEnglishV2());
ASSERT_EQUALS("run", s.stem("running"));
ASSERT_EQUALS("Run", s.stem("Running"));
}
Reported by Cppcheck.
src/mongo/db/fts/tokenizer_test.cpp
1 issues
Line: 48
}
} // namespace
TEST(Tokenizer, Empty1) {
Tokenizer i(languageEnglishV2(), "");
ASSERT(!i.more());
}
TEST(Tokenizer, Basic1) {
Reported by Cppcheck.
src/mongo/db/fts/unicode/byte_vector_test.cpp
1 issues
Line: 57
}
}
TEST(ByteVector, Splat) {
uint8_t outputBuf[ByteVector::size] = {};
ByteVector(0x12).store(outputBuf);
for (size_t i = 0; i < ByteVector::size; i++) {
ASSERT_EQ(outputBuf[i], 0x12);
Reported by Cppcheck.
src/mongo/db/fts/unicode/codepoints_test.cpp
1 issues
Line: 43
* codepoints in the array.
*/
TEST(UnicodeCodepoints, Diacritics) {
// There are no character literals for combining marks.
const char32_t marks[] = {'^', '`', 0x0301, 0x0339, 0x1AB4, 0x1DC5, 0xA69D};
// const char32_t not_marks[] = {U'-', U'.', U'\'', U'*', U'm'};
const char32_t not_marks[] = {0x2D, 0x2E, 0x27, 0x2A, 0x6D};
Reported by Cppcheck.
src/mongo/db/fts/unicode/string_test.cpp
1 issues
Line: 82
String::caseFoldAndStripDiacritics(&buf, input + filler, options, caseFoldMode)); \
} while (0)
TEST(UnicodeString, SubstrTest) {
StackBufBuilder buf;
String indexes("01234");
ASSERT_EQ("123", indexes.substrToBuf(&buf, 1, 3));
ASSERT_EQ("4", indexes.substrToBuf(&buf, 4, 3)); // len too long.
ASSERT_EQ("", indexes.substrToBuf(&buf, 6, 3)); // pos past end.
Reported by Cppcheck.
src/mongo/db/geo/big_polygon_test.cpp
1 issues
Line: 81
// e.g. points() << LatLng(10.0, 10.0) << LatLng(10.0, -10.0) << LatLng(0.0, 0.0))
typedef PointBuilder points;
TEST(BigSimplePolygon, Basic) {
// A 20x20 square centered at [0,0]
BigSimplePolygon bigPoly20(loop(points() << LatLng(10.0, 10.0) << LatLng(10.0, -10.0)
<< LatLng(-10.0, -10.0) << LatLng(-10.0, 10.0)));
// A 10x10 square centered at [0,0]
Reported by Cppcheck.
src/mongo/db/geo/geoparser_test.cpp
1 issues
Line: 66
GeoParser::GEOMETRY);
}
TEST(GeoParser, parseGeoJSONPoint) {
PointWithCRS point;
ASSERT_OK(
GeoParser::parseGeoJSONPoint(fromjson("{'type':'Point', 'coordinates': [40, 5]}"), &point));
ASSERT_OK(GeoParser::parseGeoJSONPoint(
Reported by Cppcheck.
src/mongo/db/hasher_test.cpp
1 issues
Line: 54
}
// Test different oids hash to different things
TEST(BSONElementHasher, DifferentOidsAreDifferentHashes) {
HashSeed seed = 0;
long long int oidHash =
BSONElementHasher::hash64(BSONObjBuilder().genOID().obj().firstElement(), seed);
long long int oidHash2 =
Reported by Cppcheck.