Commit Graph

178 Commits

Author SHA1 Message Date
Stefan Weil
bdad068686 unittest: Add missing precision specifiers (CID 1402752)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-16 14:13:56 +01:00
zdenop
95733433d9 unittest: Don't build tatweel_test when TensorFlow is disabled
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-16 14:12:49 +01:00
zdenop
2b04ff7617 unittest: Add missing libraries to fix linker errors
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-11-16 14:09:35 +01:00
zdenop
16b1e5d2a0 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>

# Conflicts:
#	unittest/pagesegmode_test.cc
2019-11-16 14:05:39 +01:00
zdenop
50a41b63ca 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-11-16 14:02:44 +01:00
zdenop
cca107d5f6 fix autotools build of tesseract library 2019-11-01 17:36:13 +01:00
zdenop
0d8be252cc 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>

# Conflicts:
#	src/cutil/Makefile.am
#	unittest/Makefile.am
2019-11-01 13:58:37 +01:00
zdenop
c9ecab8854 Move source files which are used for training only to src/training 2019-11-01 13:50:26 +01:00
Stefan Weil
c3d4742af6 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-11-01 13:35:55 +01:00
Stefan Weil
1d5a320d4a Revert "Simplify class LSTMTrainer"
This reverts commit 563a1717d4.
It removed global symbols, so the binary API was incompatible.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-02 06:38:19 +02:00
Stefan Weil
4b03d13fff 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-25 14:55:03 +02:00
Stefan Weil
7b58962246 Simplify unittest/Makefile.am
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-23 08:54:40 +02:00
Stefan Weil
563a1717d4 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-23 08:51:44 +02:00
Stefan Weil
9491538fb9 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:07:42 +02:00
Stefan Weil
153b921c35 unittest: Catch missing eng.traineddata in baseapi_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-16 18:37:03 +02:00
Stefan Weil
ce82facc2f unittest: Fix and enable normstrngs_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-16 18:37:03 +02:00
Stefan Weil
c01b3229fe unittest: Fix and enable textlineprojection_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-16 18:37:03 +02:00
Stefan Weil
bb2ea347b1 unittest: Fix and enable scanutils_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-16 18:36:21 +02:00
Stefan Weil
35b8826289 unittest: Fix and enable ligature_table_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-16 18:35:19 +02:00
Stefan Weil
b0e0e27abf 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-06-16 18:31:42 +02:00
Stefan Weil
fdb3f58c6c unittest: Remove unused methods
This fixes compiler warnings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-16 18:31:01 +02:00
Stefan Weil
34311b36d9 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-06-16 18:26:51 +02:00
bact
c2e45cffef Update normstrngs_test.cc 2019-06-16 18:23:27 +02:00
bact
cd49b61c67 Fix Thai valid text and add Thai illegal sequences
- Fix a invalid sequence in "valid text" `kScriptText`
- Add two illegal sequence in `kBadlyFormedThaiWords`
2019-06-16 18:23:14 +02:00
Stefan Weil
4763f24cbb 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:59:07 +02:00
Stefan Weil
8887cad12f 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 20:25:12 +02:00
Stefan Weil
ce6b0c024c 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 20:24:54 +02:00
Stefan Weil
80ba28ef65 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 20:24:35 +02:00
Stefan Weil
1d14d15902 Fix some typos (most found and fixed by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-04 14:34:34 +02:00
Stefan Weil
9477eeab3c 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-05-01 11:22:27 +02:00
Stefan Weil
918d46641a 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-05-01 11:21:29 +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