Commit Graph

371 Commits

Author SHA1 Message Date
Stefan Weil
fc4002dda8 Remove helpers.h from public API
Remove also outdated references to apitypes.h which no longer exists.

Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-31 09:06:16 +01:00
Egor Pugin
7b8af67eb5 [test] Fix intsimdmatrix test. Update result value based on updated TRand engine. 2020-12-31 03:28:36 +03:00
Stefan Weil
eb9349a0eb Run more unittests without requiring tensorflow
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-30 20:10:26 +01:00
Stefan Weil
a520b2a2fa Improve CHECK macro for unittest
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-30 20:08:34 +01:00
Stefan Weil
f7d7aa6b95 Make tmp directory for all unit tests
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-30 18:17:58 +01:00
Egor Pugin
b7df4bc1dd [test] Create tmp dir in more tests. 2020-12-30 16:44:59 +03:00
Egor Pugin
a3f8172918 [test] Remove set locale as it causes errors on some systems. It includes grouping for numbers, then pid and some other numbers in gtest are formatted incorrectly. 2020-12-30 16:30:40 +03:00
Egor Pugin
aacd8ec3cf Fix more lstm tests. 6 failing tests left. 2020-12-30 15:15:11 +03:00
Egor Pugin
79226fa7cf [test] Fix params model test. 2020-12-30 14:20:15 +03:00
Egor Pugin
7300e87f3e Merge branch 'master' of github.com-egorpugin:tesseract-ocr/tesseract 2020-12-30 14:16:33 +03:00
Egor Pugin
14cc5fca5a [test] Fix shapetable test. 2020-12-30 14:16:10 +03:00
Stefan Weil
688ef20f62 Replace GenericVector<RowInfo> by std::vector<RowInfo>
This fixes an LGTM alert:

    This parameter of type RowInfo is 144 bytes -
    consider passing a const pointer/reference instead.

It might also improve the performance.

Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-30 12:14:43 +01:00
Egor Pugin
fa776eefd9 [test] Disable loading equ.traineddata in equationsdetect test until IdentifySpecialText is turned back on. 2020-12-30 14:12:49 +03:00
Egor Pugin
b538a25809 [test] Reorder includes. 2020-12-30 13:53:49 +03:00
Stefan Weil
3a34f17037 Order and clean include statements
Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-30 10:50:39 +01:00
Stefan Weil
deec8ef46f Replace std::list by std::vector
Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-30 07:10:29 +01:00
Stefan Weil
4043204c2b Use old genericvector.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-30 07:10:29 +01:00
Egor Pugin
7e3ea8e3d3 [test] Fix bitvector test by creating tmp dir. 15 failing tests left. 2020-12-30 03:39:07 +03:00
Egor Pugin
3817fed897 [test] Reorder includes. 2020-12-30 03:33:38 +03:00
Egor Pugin
dc9bfde8ec [test] Fix mkdir on unix in dawg test. 2020-12-30 03:33:28 +03:00
Egor Pugin
f8957ebcc5 [test] Fix dawg. 2020-12-30 02:38:11 +03:00
Egor Pugin
694f0097fd Fix baseapi test. Use C++ regex instead of gtest ones. 2020-12-30 01:28:50 +03:00
Stefan Weil
f4e380f64a Remove serialis.h from public API
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-29 11:28:50 +01:00
Stefan Weil
90af3e7b5c Remove strngs.h from public API
Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-28 21:03:29 +01:00
Stefan Weil
fec9c11c8c Use std::vector, std::string in baseapi.h
Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-28 21:03:29 +01:00
Stefan Weil
64e902ddf7 Remove genericvector.h from public API
Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-28 21:03:29 +01:00
Stefan Weil
085f6b2572 Use std::list for paragraph models
Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-28 21:03:29 +01:00
Egor Pugin
98974a6913 [test] Fix include order. 2020-12-28 20:36:04 +03:00
Egor Pugin
4dcfb5006c [test] Correctly use assert instead of expect. 2020-12-28 03:24:05 +03:00
Egor Pugin
3187f2ef08 Move doubleptr.h to unittests as it is used only there. 2020-12-28 02:32:27 +03:00
Egor Pugin
6cc00aa332 Improve some unit tests. 2020-12-28 01:11:13 +03:00
Stefan Weil
2fe1532926 Fix some compiler errors for heap_test (more remaining)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-27 18:30:56 +01:00
Stefan Weil
a61d7ac2ee Add / fix namespace tesseract for unittest
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-27 10:54:43 +01:00
Stefan Weil
5c579de68a Fix dependency on tmp directory for unittest programs
Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-24 08:54:54 +01:00
Stefan Weil
30e3f10b3f Fix tar command for variants which require -j or -z
Signed-off-by: Stefan Weil <sw@weil.de>
2020-12-23 20:06:18 +01:00
Stefan Weil
49deadd799 Simplify code for equationdetect_test
It no longer depends on TensorFlow code, so it is now always enabled.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-23 17:03:06 +01:00
Stefan Weil
fef6004e6f Simplify code for cleanapi_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-23 17:01:07 +01:00
Stefan Weil
ce8ee86204 Remove unwanted # at EOL
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-23 16:44:23 +01:00
Stefan Weil
2bfa52d517 Force fontconfig pangocairo backend for stringrenderer_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-23 12:59:57 +01:00
Stefan Weil
0d1e540267 Force fontconfig pangocairo backend for ligature_table_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-23 12:59:57 +01:00
Stefan Weil
4ce4e5ef66 Add more dependencies for unittest
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-23 12:59:57 +01:00
Stefan Weil
5aec08d9f2 Add rules to get fonts required for unittest
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-23 12:59:57 +01:00
Stefan Weil
00a09c2f42 Force fontconfig pangocairo backend for pango_font_info_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-22 21:32:05 +01:00
Stefan Weil
e75b217b37 Enable pango_font_info_test for unit tests
Most parts of that test can now be used without Tensorflow code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-22 08:29:53 +01:00
Stefan Weil
e66243fcea Fix unittest for flag training build
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-21 16:24:02 +01:00
Stefan Weil
0b97bc5c16 Fix include statements for Leptonica header
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-13 13:26:36 +01:00
Stefan Weil
6fcf8d23bc Use more compiler and linker flags from pkg-config
This fixes some build issues with Homebrew on MacOS.

Signed-off-by: Stefan Weil <stefan@Sabines-Mac-mini.fritz.box>
2020-12-13 13:24:46 +01:00
Stefan Weil
b303dd6ac2 Add more patterns to suppress memory leaks from libfontconfig
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-04 13:30:58 +01:00
Stefan Weil
5eb5e6ea23 Suppress some LeakSanitizer errors in unit tests
The fontconfig library has some (intentional) memory leaks which
must be suppressed for unit tests with the LeakSanitizer.

This fixes the issues #3156 and #3157.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-12-04 07:25:49 +01:00
Shree Devi Kumar
31710098e3 fixes issue 3099 2020-11-23 13:30:26 +00:00
Stefan Weil
92b6c652f3 Use std::vector for scales_
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-10-29 08:00:11 +01:00
Stefan Weil
c15dd26b84 Don't pass scales_ to IntSimdMatrix::Init
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-10-28 20:35:53 +01:00
Stefan Weil
fe76142a3d Remove GenericVector::scale() again
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-10-28 16:24:59 +01:00
Robin Watts
872816897a Rejig intsimdmatrix to reduce FP ops.
Avoid 1) floating point division by 127, 2) conversion of
bias to double, 3) FP addition, in favour of 1) integer
multiplication by 127, and 2) integer addition.

(Also costs extra work in the serialisation/deserialisation of
the scale values, and conversion of weights to int formats, but
these are all one offs).
2020-10-12 04:30:46 -07:00
Robin Watts
9dfdac51c6 Tweak scales array for intSimdMatrix case.
Currently, the size of the scales array is not rounded up
in the same way as the weights are. This blocks us pushing
the scale calculations into the SIMD, as when we "overread"
the end of the scale array, we potentially get errors.

Here, we adjust the intSimdMatrix stuff to ensure that the
scales array reserves enough entries to allow such overreads
to work.

This doesn't make any difference for now, but opens the way
for future optimisations.
2020-10-12 11:47:16 +01:00
amitdo
06154e028b Improve disabled legacy engine build 2020-10-12 11:47:16 +01:00
amitdo
e81b485066 Improve disabled legacy engine build 2020-10-12 11:47:15 +01:00
Stefan Weil
7c4ef88dab Remove unused functions FontUtils::GetAllRenderableCharacters
They used the function pango_coverage_max which does nothing and
which has been deprecated since pango version 1.44.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-10-03 12:04:40 +02:00
Stefan Weil
8137cf35a6 Use const char* for filename parameters
This replaces the proprietary STRING data type
(801 instead of 838 lines remaining).

It also removes STRING from osdetect.h and serialis.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-07 14:20:09 +02:00
Stefan Weil
d01b2e43b8 unittest: Update comments in normstrngs_test.cc
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-07 11:29:48 +02:00
Stefan Weil
7c77b40e8c unittest: Remove unused local variables
This fixes two compiler warnings:

    unittest/recodebeam_test.cc:318:11: warning: unused variable 'min_t' [-Wunused-variable]
    unittest/resultiterator_test.cc:478:36: warning: unused variable 'dZ' [-Wunused-const-variable]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-29 16:19:23 +02:00
Stefan Weil
d4cf77c92b Don't check for limits.h (now unused)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-20 10:39:13 +02:00
Stefan Weil
fe966cc0b1 Add build script for oss-fuzz fuzzers
This is a copy of projects/tesseract-ocr/build.sh including its history from
https://github.com/google/oss-fuzz.git.

It allows maintaining the build rules with the Tesseract source code.

The build rules for Leptonica were slightly modified to avoid
unneeded compilations.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-05-08 17:37:37 +02:00
Stefan Weil
9173e6e3f7 Add TessBaseAPI::GetPageRes again
It is now added unconditionally, so it is always available for the unittest.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-05-04 14:03:39 +02:00
Stefan Weil
6f2f310fdf Remove redundant method from class GenericVector
length() is not needed: it can be replaced by size().

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-01-18 11:30:14 +01:00
Stefan Weil
6ce1a29d5a Update fuzzer code to use TESSERACT_FUZZER_WIDTH, TESSERACT_FUZZER_HEIGHT
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-01-03 15:54:59 +01:00
Stefan Weil
688f6490bb Fix broken build for pango_font_info_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-12-28 09:35:40 +01:00
Stefan Weil
dfdc2abef0 unittest: Improve logging for intsimdmatrix_test
Use GTEST_SKIP if AVX2 or SSE tests are skipped.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-28 17:51:37 +01:00
Stefan Weil
a1a139cbd2 Replace AVX_OPT, ..., AVX macros by HAVE_AVX, ... and clean related code
- Replace AVX_OPT, AVX2_OPT, FMA_OPT, SSE41_OPT
- Replace AVX, AVX2, FMA, SSE4_1
- Write new HAVE_AVX, HAVE_AVX2, HAVE_FMA, HAVE_SSE4_1 into config_auto.h
- Put related conditionals in Makefile.am in one place

This makes the code clearer and fixes a log message in
IntSimdMatrixTest.AVX2.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-28 17:51:37 +01:00
Stefan Weil
cafb1bbfd7 automake: Flat build for src/api
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-26 16:20:46 +01:00
Stefan Weil
e3e7a9bf33 Use #include <tesseract/*.h> for unittest
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-10-29 18:01:18 +01:00
Stefan Weil
7bd94a9354 Remove old code for no longer existing src/api/*.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-10-29 12:47:04 +01:00
Stefan Weil
26ba7e2f81 Fix #include path of public headers for unittest
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-10-29 08:41:47 +01:00
amitdo
2f8884a64e Fix autotools build 2019-10-28 21:23:58 +02:00
amitdo
e1bae15547 Fix #include path of public headers 2019-10-28 19:10:30 +02:00
zdenop
3762feb200 Provide more details for sucessfull running of unittests. 2019-10-20 22:15:21 +02:00
Stefan Weil
eec9c96767 Remove member functions STRING::string and StringParam::string (continued)
Commit 994ec697d8 did not update unittest.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-09-25 10:07:51 +02:00
Stefan Weil
46e2a0f106 Remove more code for builds with disabled legacy engine
Now the Tesseract library no longer includes unused code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-13 17:49:10 +02:00
Egor Pugin
73f713519c
Merge pull request #2614 from stweil/training
Move source files which are used for training only to src/training
2019-08-12 19:35:50 +03:00
Stefan Weil
e84cb24def Move source files which are used for training only to src/training
They are moved from src/classify and src/lstm to src/training.

This reduces the size of the Tesseract library.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 17:08:08 +02:00
Stefan Weil
bce585286d Remove global array kPolyBlockNames from Tesseract library
It is only used in unittest/layout_test.cc after moving a test from
baseapi_test.cc to that file, so it can be made local.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 14:33:55 +02:00
Stefan Weil
beec85e023 Remove UNICHARSET::load_from_inmemory_file and related code
The method was only used in unittest where it can be replaced by
UNICHARSET::load_from_file which also simplifies the code.

This allows removing the class InMemoryFilePointer and fixes a TODO.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 13:07:15 +02:00
Stefan Weil
ab953c1d51 unittest: Fix build and simplify build rules
Now more tests (those which use fileio) depend on the training build.
This is required since commit c5a50b93ce.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-07 13:58:12 +02:00
Stefan Weil
2ba90f02cb unittest: Initialize non-static class members in RecodeBeamTest (CID 1402765)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 16:52:27 +02:00
Stefan Weil
d40a2423e8 unittest: Fix two issues reported by Coverity Scan (CID 1402761, 1402755)
GTEST_SKIP() returns from the function which caused two warnings:

CID 1402755 (#1 of 1): Resource leak (RESOURCE_LEAK)
CID 1402761 (#1 of 1): Structurally dead code (UNREACHABLE)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 16:38:30 +02:00
Stefan Weil
a85045eeb5 unittest: Add missing precision specifiers (CID 1402752)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 16:33:08 +02:00
Stefan Weil
7fab891e36 unittest: Don't build tatweel_test when TensorFlow is disabled
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 16:06:27 +02:00
Stefan Weil
ba27deb3a0 unittest: Add missing libraries to fix linker errors
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 15:11:51 +02:00
Stefan Weil
e94392ef10 Update test submodule and fix pagesegmode_test
The test submodule now adds an image which is needed by the
pagesegmode_test.

That image was newly created for the test. Therefore the box
coordinates in the test had to be fixed by using data from
the hOCR output for the full image.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-09 11:48:56 +02:00
Stefan Weil
098180982a Update test submodule and fix tatweel_test
The test submodule now includes the files needed by the tatweel_test.
Fix also a linker error for tatweel_test.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-09 08:03:11 +02:00
Stefan Weil
71e7e16a61 unittest: Fix and enable pagesegmode_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-07 12:35:41 +02:00
Stefan Weil
6668f2fc9e unittest: Fix and enable tatweel_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-07 10:59:27 +02:00
Stefan Weil
cf46eaeac8 unittest: Fix and enable baseapi_thread_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-30 20:21:56 +02:00
Stefan Weil
b00e53fabf unittest: Fix and enable stridemap_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-30 15:30:03 +02:00
Stefan Weil
4e576f844c unittest: Fix and enable networkio_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-30 15:28:42 +02:00
Stefan Weil
2833db7c67 unittest: Fix and enable equationdetect_test
It requires Tensorflow. Skip one test because equ_gt1.tif is missing.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-30 12:39:54 +02:00
Stefan Weil
5409299763 unittest: Fix tests which need Tensorflow headers
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-29 11:43:12 +02:00
Stefan Weil
655ba7af10 unittest: Fix compiler warnings (signed/unsigned)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-28 08:11:42 +02:00
Stefan Weil
40c1cf671f unittest: Fix and enable pango_font_info_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-28 08:09:28 +02:00
Stefan Weil
04d85b4c0f Add more test code for normstrngs_test
unilib.h is now available, so more code can be enabled.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-28 07:35:27 +02:00
Stefan Weil
aa54bf0f8b Fix code from tensorflow/models/research/syntaxnet/util/utf8
See https://github.com/tensorflow/models/issues/7090.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-28 07:30:40 +02:00
Stefan Weil
0702194246 Add code from tensorflow/models
The new code was copied from the latest code on GitHub
(https://github.com/tensorflow/models/tree/master/research/syntaxnet).

It is required for pango_font_info_test and other unit tests.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-28 07:30:40 +02:00
Stefan Weil
252d80cb6d unittest: Fix function QCHECK (issue #2517)
The function must print an error message if the condition fails.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-23 19:05:42 +02:00
Stefan Weil
efa3cae06d Simplify unittest/Makefile.am
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-22 20:29:39 +02:00
Stefan Weil
bd13069fe8 Simplify class LSTMTrainer
The function pointers and callbacks file_reader_, file_writer_,
checkpointer_reader_ and checkpoint_writer_ are always set to
the same values. Replacing them by direct function calls
simplifies the code and allows removing more code from tesscallback.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-22 09:18:13 +02:00
Stefan Weil
b967c62880 unittest: Add missing Leptonica library for textlineprojection_test
It is needed for builds with --enable-shared.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-17 15:10:16 +02:00
Stefan Weil
ceabab8373 unittest: Catch missing eng.traineddata in baseapi_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-16 08:11:16 +02:00
Stefan Weil
bbd3626d77 unittest: Fix and enable normstrngs_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-16 08:01:11 +02:00
Stefan Weil
73e5241004 unittest: Fix and enable textlineprojection_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-15 10:22:44 +02:00
Stefan Weil
e0e29126ac unittest: Fix and enable scanutils_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-14 16:51:39 +02:00
Stefan Weil
3c507100c6 unittest: Fix and enable ligature_table_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-11 16:40:23 +02:00
Stefan Weil
9a4bd041c8 Fix build for unittests
Commit 29f2cff203 was the wrong fix
for the compiler warnings because it broke the unittest build.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-26 21:36:34 +02:00
Stefan Weil
9551c3d413 unittest: Remove unused methods
This fixes compiler warnings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-26 20:27:21 +02:00
zdenop
12847d58ad
Merge pull request #2455 from bact/master
Unittest: Fix Thai valid text and add Thai illegal sequences
2019-05-25 18:36:17 +02:00
Stefan Weil
1ba8c97cac Fix linking of unittest with Tensorflow
This does not add Tensorflow tests. It only fixes the linker errors.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-24 17:08:48 +02:00
bact
aac6f593f3
Update normstrngs_test.cc 2019-05-22 15:21:16 +07:00
bact
e05c5ecfcc
Fix Thai valid text and add Thai illegal sequences
- Fix a invalid sequence in "valid text" `kScriptText`
- Add two illegal sequence in `kBadlyFormedThaiWords`
2019-05-22 15:19:49 +07:00
Stefan Weil
639781b5c8 stringrenderer_test: Get system locale only once
This fixes a runtime exception on macOS.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-18 13:24:13 +02:00
Stefan Weil
8e7b1119b5 Run more unittests with the user's locale
Hopefully this improves the test coverage.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-16 18:12:55 +02:00
Stefan Weil
59e31e958b Fix more build error for compilation without legacy engine
Skip the tests which need the legacy code.
Add also code to those tests to use the user's locale to test that, too.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-16 18:12:55 +02:00
Stefan Weil
780986ebfb Fix linker error for baseapi_test when building without legacy engine
Linker error reported in issue #2439:

    unittest/baseapi_test.cc:190:
      undefined reference to
      `tesseract::TessBaseAPI::AdaptToWordStr(tesseract::PageSegMode, char const*)'

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-16 18:12:55 +02:00
Stefan Weil
28a521fec2 Fix some typos (most found and fixed by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-01 20:30:41 +02:00
Stefan Weil
4194b93e3a unittest: Add missing unittests to Makefile.am as comments
This gives a good overview of the missing unittests.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-04-19 11:14:43 +02:00
Stefan Weil
5529a5db11 unittest: Fix and enable params_model_test
This needs the latest test submodule.

The test uses LoadFromFile which is not used otherwise, so remove that
function from class ParamsModel.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-04-18 17:06:48 +02:00
Stefan Weil
bb52887c36 unittest: Replace TRUE, FALSE by true, false
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-31 17:54:48 +02:00
Stefan Weil
2718b81a3e fuzzer-api: Use environment variable TESSDATA_PREFIX if set
Clean also the code a little bit.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-26 11:09:22 +01:00
Stefan Weil
7e9970b4b1 Format fuzzer code with clang-format
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-26 11:09:22 +01:00
Stefan Weil
7cd012f3dd Move fuzzer-api.cpp to subdirectory unittest/fuzzers
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-26 11:09:10 +01:00
Stefan Weil
aaf8c50a12 unittest: Use range-for-loops
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-25 09:36:32 +01:00
Stefan Weil
631882a346 Fix compiler warnings (signed / unsigned mismatch)
clang warnings:

    src/ccutil/unicharcompress.cpp:172:27: warning: comparison of integers of different signs: 'int' and 'std::__cxx1998::vector::size_type' (aka 'unsigned long') [-Wsign-compare]
    src/lstm/recodebeam.cpp:129:29: warning: comparison of integers of different signs: 'std::__cxx1998::vector::size_type' (aka 'unsigned long') and 'int' [-Wsign-compare]
    src/lstm/recodebeam.cpp:276:48: warning: comparison of integers of different signs: 'std::__cxx1998::vector::size_type' (aka 'unsigned long') and 'int' [-Wsign-compare]
    unittest/imagedata_test.cc:101:21: warning: comparison of integers of different signs: 'int' and 'std::__cxx1998::vector::size_type' (aka 'unsigned long') [-Wsign-compare]
    unittest/linlsq_test.cc:33:23: warning: comparison of integers of different signs: 'int' and 'std::__cxx1998::vector::size_type' (aka 'unsigned long') [-Wsign-compare]
    unittest/linlsq_test.cc:44:23: warning: comparison of integers of different signs: 'int' and 'std::__cxx1998::vector::size_type' (aka 'unsigned long') [-Wsign-compare]
    unittest/nthitem_test.cc:27:23: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
    unittest/nthitem_test.cc:68:21: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
    unittest/stats_test.cc:26:23: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-25 08:36:07 +01:00
Stefan Weil
b7279f6d67 unittest: Remove tmp directory from repository and create it during build
This fixes out of tree builds.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-08 16:08:16 +01:00
Stefan Weil
bd95c9d2b8 unittest: Add missing libarchive
It is needed for the tests if Tesseract was built with libarchive.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-08 15:50:14 +01:00
Stefan Weil
b20f89006e unittest: Add another file from Abseil
It is needed for newer versions of Abseil.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-08 15:46:38 +01:00
Stefan Weil
b3bd23edb7 Remove whitespace at line endings
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-02-19 13:53:31 +01:00
Shree Devi Kumar
8612170321 fix resultiterator_test for extra \n
resultiterator_test.cc
2019-02-10 04:58:40 +00:00
Shree Devi Kumar
32af6be4ba disable some subtests in resultiterator_test
(cherry picked from commit 147ef6e5f17f6cd5eedae9c81d291ad296f37090)
2019-02-02 11:54:17 +00:00
Shree Devi Kumar
1ac76d8825 Partially fix and enable more unittests
Add more subtests to langmodel_test

Add more subtests to langmodel_test

fix and enable lstmtrainer_test

fix and enable some subtests from recodebeam_test

partial fix for resultiterator_test

fix typo removing the terminating linefeed.

fix typo

changes
2019-01-27 06:49:57 +00:00
Shree Devi Kumar
eaf5deb6b3 Disable ligature related subtest in stringrenderer 2019-01-27 06:49:56 +00:00
Stefan Weil
50f5662723
Merge pull request #2193 from Shreeshrii/master
More updates to LSTM related unittests
2019-01-24 17:11:00 +01:00
Shree Devi Kumar
dbb12d6fde more updates to lstm related unittests 2019-01-24 15:39:37 +00:00
Stefan Weil
86b0f3625e unittest: Skip test is traineddata is missing in applybox_test
Many tests have preconditions like a correct version of the test submodule
or installed traineddata files at the right location. They fail or even
crash if those preconditions are not met.

The latest version of Googletest supports skipping single tests with
GTEST_SKIP which is used here to skip tests in applybox_test when
tessdata/eng.traineddata is missing.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-24 16:10:52 +01:00
Shree Devi Kumar
36906064a5 Add LF to INFO msgs in lstm_test 2019-01-24 11:40:53 +00:00
Stefan Weil
14086af474 unittest: Add missing Leptonica library for stringrenderer_test
It is needed for builds without `--disable-shared`.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-24 11:29:22 +01:00
Stefan Weil
6b7f7db63e Fix and enable shapetable_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-24 11:23:20 +01:00
Shreeshrii
bbd23bbfd2 Fix and enable lstm related unittests (#2180)
* Fix and build lstm related unittests
* Use ./tmp instead of ./ for files created by unittests
2019-01-24 08:01:19 +01:00
Stefan Weil
4b24d8cdf6 Fix and enable stringrenderer_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:55:13 +01:00
Stefan Weil
a6da64234e unittest: Fix and enable validate_myanmar_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:54:27 +01:00
Stefan Weil
d67287a5d9 unittest: Fix and enable validate_khmer_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:54:27 +01:00
Stefan Weil
611d5e6358 unittest: Fix and enable validate_indic_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:54:27 +01:00
Stefan Weil
d97f67da63 unittest: Fix and enable validate_grapheme_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:54:27 +01:00