Modernize code (clang-tidy -checks='-*,modernize-use-override')

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2021-03-22 08:26:05 +01:00
parent 7bada4e629
commit cb80eb6963
32 changed files with 50 additions and 50 deletions

View File

@ -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.

View File

@ -36,7 +36,7 @@ protected:
ApplyBoxTest() {
src_pix_ = nullptr;
}
~ApplyBoxTest() {
~ApplyBoxTest() override {
pixDestroy(&src_pix_);
}

View File

@ -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) {

View File

@ -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();
}

View File

@ -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) {

View File

@ -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);
}

View File

@ -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) {

View File

@ -25,7 +25,7 @@ namespace tesseract {
class ImagedataTest : public ::testing::Test {
protected:
void SetUp() {
void SetUp() override {
std::locale::global(std::locale(""));
file::MakeTmpdir();
}

View File

@ -23,7 +23,7 @@ namespace tesseract {
class IndexMapBiDiTest : public testing::Test {
protected:
void SetUp() {
void SetUp() override {
std::locale::global(std::locale(""));
file::MakeTmpdir();
}

View File

@ -24,7 +24,7 @@ namespace tesseract {
class IntFeatureMapTest : public testing::Test {
protected:
void SetUp() {
void SetUp() override {
std::locale::global(std::locale(""));
}

View File

@ -28,7 +28,7 @@ namespace tesseract {
class IntSimdMatrixTest : public ::testing::Test {
protected:
void SetUp() {
void SetUp() override {
std::locale::global(std::locale(""));
}

View File

@ -64,7 +64,7 @@ protected:
LayoutTest() {
src_pix_ = nullptr;
}
~LayoutTest() {
~LayoutTest() override {
pixDestroy(&src_pix_);
}

View File

@ -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) {

View File

@ -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_);

View File

@ -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();
}

View File

@ -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_;
}

View File

@ -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) {

View File

@ -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_);
}

View File

@ -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_);

View File

@ -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(""));
}
};

View File

@ -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();
}

View File

@ -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) {

View File

@ -31,7 +31,7 @@ protected:
ResultIteratorTest() {
src_pix_ = nullptr;
}
~ResultIteratorTest() {}
~ResultIteratorTest() override {}
void SetImage(const char *filename) {
src_pix_ = pixRead(TestDataNameToPath(filename).c_str());

View File

@ -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();
}

View File

@ -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_;
};

View File

@ -36,7 +36,7 @@ public:
class StridemapTest : public ::testing::Test {
protected:
void SetUp() {
void SetUp() override {
std::locale::global(std::locale(""));
}

View File

@ -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();

View File

@ -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();

View File

@ -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>();

View File

@ -45,7 +45,7 @@ protected:
denorm_ = nullptr;
projection_ = nullptr;
}
virtual ~TextlineProjectionTest() {
~TextlineProjectionTest() override {
pixDestroy(&src_pix_);
pixDestroy(&bin_pix_);
delete finder_;

View File

@ -20,7 +20,7 @@ namespace tesseract {
class TfileTest : public ::testing::Test {
protected:
void SetUp() {
void SetUp() override {
std::locale::global(std::locale(""));
}

View File

@ -26,7 +26,7 @@ namespace tesseract {
class UnicharcompressTest : public ::testing::Test {
protected:
void SetUp() {
void SetUp() override {
std::locale::global(std::locale(""));
file::MakeTmpdir();
}