unittest/apiexample_test: Use googletest API for error handling

Use the Google C++ Testing Framework instead of calling fprint / exit.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2017-09-13 13:50:39 +02:00
parent b42df389be
commit 67f706f9ef

View File

@ -32,10 +32,7 @@ TEST(TesseractTest, ApiExample)
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
// Initialize tesseract-ocr with English, without specifying tessdata path
if (api->Init(NULL, "eng")) {
fprintf(stderr, "Could not initialize tesseract.\n");
exit(1);
}
ASSERT_FALSE(api->Init(nullptr, "eng")) << "Could not initialize tesseract.";
// Open input image with leptonica library
Pix *image = pixRead("../testing/phototest.tif");