mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-23 18:49:08 +08:00
Modernize code (clang-tidy -checks='-*,modernize-use-override')
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
7bada4e629
commit
cb80eb6963
@ -36,10 +36,10 @@ namespace tesseract {
|
||||
|
||||
class QuickTest : public testing::Test {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
start_time_ = time(nullptr);
|
||||
}
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
#ifndef NDEBUG
|
||||
// Debug builds can be very slow, so allow 4 min for OCR of a test image.
|
||||
// apitest_example including disabled tests takes about 18 min on ARMv7.
|
||||
|
@ -36,7 +36,7 @@ protected:
|
||||
ApplyBoxTest() {
|
||||
src_pix_ = nullptr;
|
||||
}
|
||||
~ApplyBoxTest() {
|
||||
~ApplyBoxTest() override {
|
||||
pixDestroy(&src_pix_);
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,11 @@ public:
|
||||
|
||||
class ColPartitionTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
}
|
||||
|
||||
void TearDown() {}
|
||||
void TearDown() override {}
|
||||
};
|
||||
|
||||
TEST_F(ColPartitionTest, IsInSameColumnAsReflexive) {
|
||||
|
@ -33,7 +33,7 @@ namespace tesseract {
|
||||
// aka Directed Acyclic Word Graphs).
|
||||
class DawgTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
file::MakeTmpdir();
|
||||
}
|
||||
|
@ -18,12 +18,12 @@ namespace tesseract {
|
||||
|
||||
class DENORMTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
}
|
||||
|
||||
public:
|
||||
void TearDown() {}
|
||||
void TearDown() override {}
|
||||
|
||||
void ExpectCorrectTransform(const DENORM &denorm, const TPOINT &src, const TPOINT &result,
|
||||
bool local) {
|
||||
|
@ -120,7 +120,7 @@ protected:
|
||||
// The directory for testdata;
|
||||
std::string testdata_dir_;
|
||||
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
tesseract_ = std::make_unique<Tesseract>();
|
||||
tesseract_->init_tesseract(TESSDATA_DIR, "eng", OEM_TESSERACT_ONLY);
|
||||
@ -131,7 +131,7 @@ protected:
|
||||
testdata_dir_ = TESTDATA_DIR;
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
void TearDown() override {
|
||||
tesseract_.reset(nullptr);
|
||||
equation_det_.reset(nullptr);
|
||||
}
|
||||
|
@ -25,12 +25,12 @@ int test_data[] = {8, 1, 2, -4, 7, 9, 65536, 4, 9, 0};
|
||||
// The fixture for testing GenericHeap and DoublePtr.
|
||||
class HeapTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~HeapTest();
|
||||
~HeapTest() override;
|
||||
// Pushes the test data onto both the heap and the KDVector.
|
||||
void PushTestData(GenericHeap<IntKDPair> *heap, KDVector *v) {
|
||||
for (size_t i = 0; i < countof(test_data); ++i) {
|
||||
|
@ -25,7 +25,7 @@ namespace tesseract {
|
||||
|
||||
class ImagedataTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
file::MakeTmpdir();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace tesseract {
|
||||
|
||||
class IndexMapBiDiTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
file::MakeTmpdir();
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace tesseract {
|
||||
|
||||
class IntFeatureMapTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace tesseract {
|
||||
|
||||
class IntSimdMatrixTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ protected:
|
||||
LayoutTest() {
|
||||
src_pix_ = nullptr;
|
||||
}
|
||||
~LayoutTest() {
|
||||
~LayoutTest() override {
|
||||
pixDestroy(&src_pix_);
|
||||
}
|
||||
|
||||
|
@ -17,12 +17,12 @@ namespace tesseract {
|
||||
|
||||
class LLSQTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
}
|
||||
|
||||
public:
|
||||
void TearDown() {}
|
||||
void TearDown() override {}
|
||||
|
||||
void ExpectCorrectLine(const LLSQ &llsq, double m, double c, double rms, double pearson,
|
||||
double tolerance) {
|
||||
|
@ -25,10 +25,10 @@ namespace tesseract {
|
||||
|
||||
class QuickTest : public testing::Test {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
start_time_ = time(nullptr);
|
||||
}
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
const time_t end_time = time(nullptr);
|
||||
EXPECT_TRUE(end_time - start_time_ <= 25)
|
||||
<< "The test took too long - " << ::testing::PrintToString(end_time - start_time_);
|
||||
|
@ -45,7 +45,7 @@ const int kBatchIterations = 1;
|
||||
// The fixture for testing LSTMTrainer.
|
||||
class LSTMTrainerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
file::MakeTmpdir();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
false_unichar_id_ = 67;
|
||||
false_shape_ = shape_table_->AddShape(false_unichar_id_, 25);
|
||||
}
|
||||
virtual ~MockClassifier() {}
|
||||
~MockClassifier() override {}
|
||||
|
||||
// Classifies the given [training] sample, writing to results.
|
||||
// If debug is non-zero, then various degrees of classifier dependent debug
|
||||
@ -146,7 +146,7 @@ const double kMin1lDistance = 0.25;
|
||||
class MasterTrainerTest : public testing::Test {
|
||||
#ifndef DISABLED_LEGACY_ENGINE
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
file::MakeTmpdir();
|
||||
}
|
||||
@ -162,7 +162,7 @@ protected:
|
||||
shape_table_ = nullptr;
|
||||
master_trainer_ = nullptr;
|
||||
}
|
||||
~MasterTrainerTest() {
|
||||
~MasterTrainerTest() override {
|
||||
delete shape_table_;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~NthItemTest();
|
||||
~NthItemTest() override;
|
||||
// Pushes the test data onto the KDVector.
|
||||
void PushTestData(KDVector *v) {
|
||||
for (size_t i = 0; i < countof(test_data); ++i) {
|
||||
|
@ -36,7 +36,7 @@ static bool file_exists(const char *filename) {
|
||||
class PageSegModeTest : public testing::Test {
|
||||
protected:
|
||||
PageSegModeTest() = default;
|
||||
~PageSegModeTest() {
|
||||
~PageSegModeTest() override {
|
||||
pixDestroy(&src_pix_);
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,10 @@ namespace tesseract {
|
||||
|
||||
class QuickTest : public testing::Test {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
start_time_ = time(nullptr);
|
||||
}
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
const time_t end_time = time(nullptr);
|
||||
EXPECT_TRUE(end_time - start_time_ <= 25)
|
||||
<< "The test took too long - " << ::testing::PrintToString(end_time - start_time_);
|
||||
|
@ -38,7 +38,7 @@ TEST(QRSequenceGenerator, GetBinaryReversedInteger) {
|
||||
// Trivial test fixture for a parameterized test.
|
||||
class QRSequenceGeneratorTest : public ::testing::TestWithParam<int> {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
}
|
||||
};
|
||||
|
@ -59,13 +59,13 @@ const float kVi2ndScores[] = {0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01};
|
||||
|
||||
class RecodeBeamTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
file::MakeTmpdir();
|
||||
}
|
||||
|
||||
RecodeBeamTest() : lstm_dict_(&ccutil_) {}
|
||||
~RecodeBeamTest() {
|
||||
~RecodeBeamTest() override {
|
||||
lstm_dict_.End();
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@ namespace tesseract {
|
||||
|
||||
class TBOXTest : public testing::Test {
|
||||
public:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
}
|
||||
|
||||
void TearDown() {}
|
||||
void TearDown() override {}
|
||||
};
|
||||
|
||||
TEST_F(TBOXTest, OverlapInside) {
|
||||
|
@ -31,7 +31,7 @@ protected:
|
||||
ResultIteratorTest() {
|
||||
src_pix_ = nullptr;
|
||||
}
|
||||
~ResultIteratorTest() {}
|
||||
~ResultIteratorTest() override {}
|
||||
|
||||
void SetImage(const char *filename) {
|
||||
src_pix_ = pixRead(TestDataNameToPath(filename).c_str());
|
||||
|
@ -54,7 +54,7 @@ static void Expect352(int font_id, const Shape &shape) {
|
||||
// The fixture for testing Shape.
|
||||
class ShapeTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
file::MakeTmpdir();
|
||||
}
|
||||
|
@ -20,14 +20,14 @@ const int kTestData[] = {2, 0, 12, 1, 1, 2, 10, 1, 0, 0, 0, 2, 0, 4, 1, 1};
|
||||
|
||||
class STATSTest : public testing::Test {
|
||||
public:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
stats_.set_range(0, 16);
|
||||
for (size_t i = 0; i < countof(kTestData); ++i)
|
||||
stats_.add(i, kTestData[i]);
|
||||
}
|
||||
|
||||
void TearDown() {}
|
||||
void TearDown() override {}
|
||||
|
||||
STATS stats_;
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
|
||||
class StridemapTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
class TableFinderTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
free_boxes_it_.set_to_list(&free_boxes_);
|
||||
finder_ = std::make_unique<TestableTableFinder>();
|
||||
@ -70,7 +70,7 @@ protected:
|
||||
finder_->set_global_median_blob_width(5);
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
void TearDown() override {
|
||||
if (partition_.get() != nullptr)
|
||||
partition_->DeleteBoxes();
|
||||
DeletePartitionListBoxes();
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
|
||||
class SharedTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
ICOORD bleft(0, 0);
|
||||
ICOORD tright(1000, 1000);
|
||||
@ -74,7 +74,7 @@ protected:
|
||||
line_grid_ = std::make_unique<ColPartitionGrid>(5, bleft, tright);
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
void TearDown() override {
|
||||
tesseract::ColPartition_IT memory(&allocated_parts_);
|
||||
for (memory.mark_cycle_pt(); !memory.cycled_list(); memory.forward()) {
|
||||
memory.data()->DeleteBoxes();
|
||||
@ -141,7 +141,7 @@ protected:
|
||||
|
||||
class TableRecognizerTest : public SharedTest {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
SharedTest::SetUp();
|
||||
recognizer_ = std::make_unique<TestableTableRecognizer>();
|
||||
recognizer_->Init();
|
||||
@ -154,7 +154,7 @@ protected:
|
||||
|
||||
class StructuredTableTest : public SharedTest {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
SharedTest::SetUp();
|
||||
table_ = std::make_unique<TestableStructuredTable>();
|
||||
table_->Init();
|
||||
|
@ -19,12 +19,12 @@ namespace tesseract {
|
||||
|
||||
class TabVectorTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
vector_.reset();
|
||||
}
|
||||
|
||||
void TearDown() {}
|
||||
void TearDown() override {}
|
||||
|
||||
void MakeSimpleTabVector(int x1, int y1, int x2, int y2) {
|
||||
vector_ = std::make_unique<TabVector>();
|
||||
|
@ -45,7 +45,7 @@ protected:
|
||||
denorm_ = nullptr;
|
||||
projection_ = nullptr;
|
||||
}
|
||||
virtual ~TextlineProjectionTest() {
|
||||
~TextlineProjectionTest() override {
|
||||
pixDestroy(&src_pix_);
|
||||
pixDestroy(&bin_pix_);
|
||||
delete finder_;
|
||||
|
@ -20,7 +20,7 @@ namespace tesseract {
|
||||
|
||||
class TfileTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace tesseract {
|
||||
|
||||
class UnicharcompressTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
std::locale::global(std::locale(""));
|
||||
file::MakeTmpdir();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user