Commit Graph

244 Commits

Author SHA1 Message Date
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