The following issues were found
unittest/rect_test.cc
1 issues
Line: 27
void TearDown() override {}
};
TEST_F(TBOXTest, OverlapInside) {
TBOX a(10, 10, 20, 20);
TBOX b(11, 11, 12, 12);
EXPECT_TRUE(a.overlap(b));
EXPECT_TRUE(b.overlap(a));
Reported by Cppcheck.
unittest/resultiterator_test.cc
1 issues
Line: 256
//}
// Tests that Tesseract gets exactly the right answer on phototest.
TEST_F(ResultIteratorTest, EasyTest) {
SetImage("phototest.tif");
// Just run layout analysis.
PageIterator *p_it = api_.AnalyseLayout();
EXPECT_FALSE(p_it == nullptr);
// Check iterator position.
Reported by Cppcheck.
unittest/stats_test.cc
1 issues
Line: 37
};
// Tests some basic numbers from the stats_.
TEST_F(STATSTest, BasicStats) {
EXPECT_EQ(37, stats_.get_total());
EXPECT_EQ(2, stats_.mode());
EXPECT_EQ(12, stats_.pile_count(2));
}
Reported by Cppcheck.
unittest/stridemap_test.cc
1 issues
Line: 63
#endif
};
TEST_F(StridemapTest, Indexing) {
// This test verifies that with a batch of arrays of different sizes, the
// iteration index each of them in turn, without going out of bounds.
#ifdef INCLUDE_TENSORFLOW
std::vector<std::unique_ptr<xla::Array2D<int>>> arrays;
arrays.push_back(SetupArray(3, 4, 0));
Reported by Cppcheck.
unittest/tablefind_test.cc
1 issues
Line: 133
tesseract::ColPartition_C_IT free_boxes_it_;
};
TEST_F(TableFinderTest, GapInXProjectionNoGap) {
int data[100];
for (int &i : data) {
i = 10;
}
EXPECT_FALSE(finder_->GapInXProjection(data, 100));
Reported by Cppcheck.
unittest/tablerecog_test.cc
1 issues
Line: 175
std::unique_ptr<TestableStructuredTable> table_;
};
TEST_F(TableRecognizerTest, HasSignificantLinesBasicPass) {
InsertLines();
TBOX smaller_guess(120, 15, 370, 45);
TBOX larger_guess(90, 5, 490, 70);
EXPECT_TRUE(recognizer_->HasSignificantLines(line_box_));
EXPECT_TRUE(recognizer_->HasSignificantLines(larger_guess));
Reported by Cppcheck.
unittest/tabvector_test.cc
1 issues
Line: 38
std::unique_ptr<TabVector> vector_;
};
TEST_F(TabVectorTest, SetStartEndPointsMatch) {
vector_ = std::make_unique<TabVector>();
ICOORD start(51, 65);
ICOORD end(7568, 234);
// Test coordinates individually to avoid adding an ostream operator
// explicitly to the ICOORD class (Droid doesn't support it).
Reported by Cppcheck.
unittest/textlineprojection_test.cc
1 issues
Line: 245
};
// Tests all word boxes on an unrotated image.
TEST_F(TextlineProjectionTest, Unrotated) {
VerifyBoxes("phototest.tif", 31);
}
// Tests character-level applyboxes on italic Times New Roman.
TEST_F(TextlineProjectionTest, Rotated) {
Reported by Cppcheck.
unittest/third_party/utf/rune.c
1 issues
Line: 300
Column: 3
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
int runelen(Rune rune) {
char str[10];
return runetochar(str, &rune);
}
int runenlen(const Rune *r, int nrune) {
Reported by FlawFinder.
unittest/unichar_test.cc
1 issues
Line: 31
EXPECT_STREQ(kUTF8Src, utf8.c_str());
}
TEST(UnicharTest, InvalidText) {
// This test verifies that Unichar correctly deals with invalid text.
const char *kInvalidUTF8 = "a b\200d string";
const std::vector<char32> kInvalidUTF32 = {'a', ' ', 0x200000, 'x'};
// Invalid utf8 produces an empty vector.
std::vector<char32> utf32 = UNICHAR::UTF8ToUTF32(kInvalidUTF8);
Reported by Cppcheck.