diff --git a/unittest/apiexample_test.cc b/unittest/apiexample_test.cc index 438b9216ad..281b4ac605 100644 --- a/unittest/apiexample_test.cc +++ b/unittest/apiexample_test.cc @@ -27,6 +27,7 @@ #include #include #include +#include // std::unique_ptr #include #include "baseapi.h" #include "include_gunit.h" @@ -55,7 +56,7 @@ void OCRTester(const char* imgname, const char* groundtruth, file.imbue(loc); // Use it for file input std::string gtText((std::istreambuf_iterator(file)), std::istreambuf_iterator()); - tesseract::TessBaseAPI* api = new tesseract::TessBaseAPI(); + std::unique_ptr api(new tesseract::TessBaseAPI()); ASSERT_FALSE(api->Init(tessdatadir, lang)) << "Could not initialize tesseract."; Pix* image = pixRead(imgname); diff --git a/unittest/loadlang_test.cc b/unittest/loadlang_test.cc index aba2945dc0..01b467f856 100644 --- a/unittest/loadlang_test.cc +++ b/unittest/loadlang_test.cc @@ -16,6 +16,7 @@ // limitations under the License. /////////////////////////////////////////////////////////////////////// +#include // std::unique_ptr #include #include "baseapi.h" #include "include_gunit.h" @@ -35,7 +36,7 @@ class QuickTest : public testing::Test { }; void LangLoader(const char* lang, const char* tessdatadir) { - tesseract::TessBaseAPI* api = new tesseract::TessBaseAPI(); + std::unique_ptr api(new tesseract::TessBaseAPI()); ASSERT_FALSE(api->Init(tessdatadir, lang)) << "Could not initialize tesseract for $lang."; api->End(); diff --git a/unittest/osd_test.cc b/unittest/osd_test.cc index cf49cb2e15..dedb20cc4d 100644 --- a/unittest/osd_test.cc +++ b/unittest/osd_test.cc @@ -20,6 +20,7 @@ //#include "log.h" #include +#include // std::unique_ptr #include #include "baseapi.h" #include "include_gunit.h" @@ -33,7 +34,7 @@ class TestClass : public testing::Test { void OSDTester(int expected_deg, const char* imgname, const char* tessdatadir) { // log.info() << tessdatadir << " for image: " << imgname << std::endl; - tesseract::TessBaseAPI* api = new tesseract::TessBaseAPI(); + std::unique_ptr api(new tesseract::TessBaseAPI()); ASSERT_FALSE(api->Init(tessdatadir, "osd")) << "Could not initialize tesseract."; Pix* image = pixRead(imgname); diff --git a/unittest/progress_test.cc b/unittest/progress_test.cc index b5c5b37d1f..bd7e1d8b54 100644 --- a/unittest/progress_test.cc +++ b/unittest/progress_test.cc @@ -21,6 +21,7 @@ #include #include #include +#include // std::unique_ptr #include #include "baseapi.h" #include "gmock/gmock.h" @@ -88,7 +89,7 @@ void ClassicProgressTester(const char* imgname, const char* tessdatadir, using ::testing::Return; using ::testing::SaveArg; - tesseract::TessBaseAPI* api = new tesseract::TessBaseAPI(); + std::unique_ptr api(new tesseract::TessBaseAPI()); ASSERT_FALSE(api->Init(tessdatadir, lang)) << "Could not initialize tesseract."; Pix* image = pixRead(imgname); @@ -124,7 +125,7 @@ void NewProgressTester(const char* imgname, const char* tessdatadir, using ::testing::Return; using ::testing::SaveArg; - tesseract::TessBaseAPI* api = new tesseract::TessBaseAPI(); + std::unique_ptr api(new tesseract::TessBaseAPI()); ASSERT_FALSE(api->Init(tessdatadir, lang)) << "Could not initialize tesseract."; Pix* image = pixRead(imgname); @@ -149,12 +150,12 @@ void NewProgressTester(const char* imgname, const char* tessdatadir, pixDestroy(&image); } -TEST(QuickTest, ClassicProgressReporitng) { +TEST(QuickTest, ClassicProgressReporting) { ClassicProgressTester(TESTING_DIR "/phototest.tif", TESSDATA_DIR "_fast", "eng"); } -TEST(QuickTest, NewProgressReporitng) { +TEST(QuickTest, NewProgressReporting) { NewProgressTester(TESTING_DIR "/phototest.tif", TESSDATA_DIR "_fast", "eng"); }