Commit Graph

377 Commits

Author SHA1 Message Date
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
Stefan Weil
a702f2d2aa unittest: Replace ABSL_ARRAYSIZE by ARRAYSIZE
Remove the local definition of ABSL_ARRAYSIZE
to avoid a conflict with Abseil.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-23 13:54:27 +01:00
Stefan Weil
2c0ddb4220 Update file paths in dawg_test
Get unicharset and wordlist files from test/testing and use the latest
test submodule which provides those files.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-21 20:08:11 +01:00
Shree Devi Kumar
57f74d2b73 Fix file location for unicharset for mastertrainer_test 2019-01-21 17:36:08 +01:00
Shree Devi Kumar
0ee4f63019 Formatting LOG messages from layout_test 2019-01-21 17:36:08 +01:00
Stefan Weil
4edc61fd3f unittest: Add missing license headers for dawg_test and layout_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-21 17:36:08 +01:00
Stefan Weil
05cdbc7c9c Fix and enable dawg_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-21 17:36:08 +01:00
Stefan Weil
aec992ebf8 Update test submmodule and enable additional test in layout_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-21 17:36:08 +01:00
Stefan Weil
4b821b2c6b Fix and enable layout_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-21 17:36:08 +01:00
Shree Devi Kumar
0d6d8108c8 Add sources for layout_test and dawg_test to Makefile 2019-01-21 17:36:08 +01:00
Shree Devi Kumar
0f0eaa9f30 Partial fix for layout_test and dawg_test 2019-01-21 17:36:08 +01:00
Stefan Weil
0ae8fdc859 Fix build for unicharcompress_test
* Add abseil library
* Add minimalistic implementation for WriteStringToFile
* Add missing namespace for std::string

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-19 08:34:00 +01:00
Shree Devi Kumar
e67ad46fca fix typo 2019-01-19 05:24:17 +00:00
Shree Devi Kumar
9e599e1e54 Partial fix for unicharcompress_test 2019-01-19 05:13:03 +00:00
Stefan Weil
9b2bf10391 Fix build for unichar_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-18 21:15:33 +01:00
Shree Devi Kumar
20ed60b31f Fix unicharset_test 2019-01-18 16:41:29 +00:00
Stefan Weil
502bb624c2 More optimisations for IntSimdMatrix
* Move IntDotProductSSE. That allows inlining of the code.
* Improve IntDotProductSSE by moving some instructions.
* Remove unused num_input_groups_ from IntSimdMatrix.
* Re-order elements in IntSimdMatrix to avoid padding.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 21:34:37 +01:00
Stefan Weil
95606398f5 Clean code for IntSimdMatrix
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 21:34:37 +01:00
Stefan Weil
7fc7d28dd0 Compile files for AVX, AVX2 or SSE only when needed
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 21:34:37 +01:00
Stefan Weil
a9a1035e55 Move IntSimdMatrixNative from IntSimdMatrix to unittest
It is only used for the unit test.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 21:34:37 +01:00
Stefan Weil
605b4d66c7 Replace dynamically allocated IntSimdMatrix instances by constants
Two header files are no longer needed and could be removed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 21:34:37 +01:00
Stefan Weil
26be7c5d2e Use constructor with parameters for IntSimdMatrix
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 21:34:37 +01:00
Stefan Weil
7c70147701 Move shaped weights from IntSimMatrix to WeightMatrix
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 21:34:37 +01:00
Stefan Weil
c4de29d16f unittest: Allow more time for apiexample_test when using a debug build
OCR of an image needs much more time than 55 s when running with
a debug build without optimisations on a slow host.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 17:56:35 +01:00
Stefan Weil
e67751633a unittest: Fix comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 17:56:35 +01:00
Stefan Weil
a5283f293d Add test for the C++ implementation of MatrixDotVector
Check also whether the sum of all results matches the expected value.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 17:56:35 +01:00
Stefan Weil
5d3d251267 Fix build for unittest
Debug builds failed because libpthread (needed for googletest) was missing.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-14 17:56:35 +01:00
Stefan Weil
5dd606c631 Replace NULL by nullptr
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-01-01 22:45:49 +01:00
Stefan Weil
7ebd3153ae Fix several typos (most of them found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-12-10 18:59:58 +01:00
Stefan Weil
9b783822a0 Remove unused include statements for tprintf.h
Format also a call of tprintf and add a missing explicit include statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-11-18 17:25:01 +01:00
Stefan Weil
ff5347c4ad Fix memory leak in osd_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-11-13 09:09:23 +01:00
Stefan Weil
5209aa6c95 Fix memory leak in loadlang_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-11-13 09:09:10 +01:00
Stefan Weil
74f6d0e7ff Fix memory leak in apiexample_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-11-13 09:08:42 +01:00
Stefan Weil
303ac97102 Fix memory leaks and typos in progress_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-11-13 08:24:50 +01:00
Stefan Weil
f4ec5beedc Remove dummy test
This reverts commit 99755b0732.
The dummy test is no longer needed as there exist a lot of real tests now.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-11-08 18:53:15 +01:00
Stefan Weil
d04133f07e unittest: Add more files from Google
They were provided by Jeff Breidenbach <jbreiden@google.com>.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-18 16:39:35 +02:00
Stefan Weil
98843e0d81 Fix uninitialized scalar variable (CID 1395880)
This fixes a warning from Coverity Scan.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-16 16:53:24 +02:00
Stefan Weil
d8fdbdb9fd CycleTimer: Add missing initialization (CID 1396168)
This fixes a warning from Coverity Scan.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-16 16:53:23 +02:00
Shree Devi Kumar
f5dfab1559 Add Leptonica lib for baseapi_test 2018-10-13 17:22:49 +00:00
Stefan Weil
3f5c36191f unittest: Disable build rules for tests which still fail to build
This fixes warnings from autogen.sh.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-12 17:48:57 +02:00
Stefan Weil
2916dc86dd unittest: Add mastertrainer_test (only works partially)
The test currently has subtests which fail because of missing files.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-12 16:23:13 +02:00
Stefan Weil
f93fb9de74 unittest: Add lang_model_test (only works partially)
The test currently has subtests which fail because of missing files.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-12 16:23:13 +02:00
Stefan Weil
de6a759744 unittest: Add paragraphs_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-12 16:23:10 +02:00
Stefan Weil
53f0e7658f unittest: Add imagedata_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-12 15:15:02 +02:00
Stefan Weil
420a0286fd unittest: Add fileio_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-12 08:13:39 +02:00
Stefan Weil
d3cf423748 unittest: Add qrsequence_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-12 08:01:58 +02:00
Stefan Weil
11f82f5c1e unittest: Add baseapi_test
* Add Abseil sources to build process.

* Add copyright comment.

* InitConfigOnlyTest no longer tests
  hin.traineddata because it is LSTM only.

* Fix std::string.

* Deactivate tests with missing test data.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-11 22:18:58 +02:00
Stefan Weil
db16fea6b1 Add a basic implementation of class CycleTimer
It is used by baseapi_test.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-11 22:18:58 +02:00
Stefan Weil
27bfaccf73 Enhance LOG emulation
It is needed for baseapi_test and other unit tests.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-11 22:18:58 +02:00
Stefan Weil
db07a69b56 Add more hacks for use with Google unittests
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-11 22:18:58 +02:00
Stefan Weil
4ec9c86226 unittest: Replace NULL by nullptr
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-29 09:27:12 +02:00
Stefan Weil
9e66fb918f unittest: Format code
It was formatted with clang-format-7 -i unittest/*.{c*,h}.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-29 09:19:13 +02:00
Stefan Weil
5178142ab1 NthItemTest: Add definition for virtual destructor
This fixes a compiler warning from clang:

unittest/nthitem_test.cc:22:7: warning:
 'NthItemTest' has no out-of-line virtual method definitions;
 its vtable will be emitted in every translation unit [-Wweak-vtables]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-04 12:11:23 +02:00
Stefan Weil
80c1235c12 HeapTest: Add definition for virtual destructor
This fixes a compiler warning from clang:

unittest/heap_test.cc:27:7: warning:
 'HeapTest' has no out-of-line virtual method definitions;
 its vtable will be emitted in every translation unit [-Wweak-vtables]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-04 12:11:23 +02:00
Shree Devi Kumar
b5d41b77eb Add leptonica-libs for apply-boxes test 2018-08-30 04:25:28 +00:00
Shree Devi Kumar
85b03723ea DISABLE some tests by default since they take long to run. They can be forced to run by --gtest_also_run_disabled_tests argument 2018-08-29 20:28:20 +00:00
Stefan Weil
46f65bf0c2 unittest: Fix and enable applybox_test
It needs an update of the test submodule.

The tests only pass with a small modification of the ground truth texts
(kTruthTextWords, kTruthTextLine).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-28 21:03:49 +02:00
Stefan Weil
c1af1f6694 unittest: Fix and enable commandlineflags_test
It only works if training is enabled and built.

The test "PrintUsageAndExit" had to be disabled because it
currently fails.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-27 11:55:23 +02:00
Stefan Weil
ca7ae1c3a6 unittest: Fix and enable validator_test
It requires additional training libraries, so this test only works
if training is enabled and build.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-27 11:45:35 +02:00
Stefan Weil
70665721f4 unittest: Fix and enable tfile_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-26 19:15:06 +02:00
Stefan Weil
8e404679c1 unittest: Fix and enable tabvector_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-26 19:15:06 +02:00
Stefan Weil
aac00836d5 unittest: Fix and enable tablerecog_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-26 19:15:06 +02:00
Stefan Weil
7aef7a304f unittest: Fix and enable tablefind_test
This requires a local definition for macro ABSL_ARRAYSIZE
(normally defined as part of the Abseil API).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-26 19:15:06 +02:00
Stefan Weil
f95725afcb unittest: Fix and enable stats_test
This requires a local definition for macro ABSL_ARRAYSIZE
(normally defined as part of the Abseil API).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-26 19:15:06 +02:00
Stefan Weil
6df28fb3f0 unittest: Fix and enable rect_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-26 19:15:06 +02:00
Stefan Weil
3d38e8ceb7 unittest: Fix and enable nthitem_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-26 19:15:06 +02:00
Stefan Weil
f876ddb084 unittest: Fix and enable linlsq_test
Sort also the tests alphabetically.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-26 19:15:06 +02:00
Stefan Weil
aec9ce7757 unittest: Fix and enable intfeaturemap_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-25 18:39:41 +02:00
Stefan Weil
c4eda838aa unittest: Fix and enable indexmapbidi_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-25 18:39:40 +02:00
Stefan Weil
de7676c88e unittest: Fix and enable heap_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-25 18:39:40 +02:00
Stefan Weil
778092838a Add ARRAYSIZE macro for Google test environment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-25 18:39:40 +02:00
Stefan Weil
2dc0b68147 unittest: Fix and enable denorm_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-25 18:16:46 +02:00
Stefan Weil
bb101defdb unittest: Fix and enable colpartition_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-25 18:16:46 +02:00
Stefan Weil
68db6aa5df unittest: Fix and enable cleanapi_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-25 18:16:46 +02:00
Stefan Weil
0dc5c8ef3f unittest: Fix and enable bitvector_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-25 18:16:46 +02:00
Stefan Weil
2b7df59187 Add more unittests from Google
They were provided by Jeff Breidenbach <jbreiden@google.com>.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-25 18:16:46 +02:00
Stefan Weil
f0337c2d1a Add more portability hacks for Google test environment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-25 18:16:46 +02:00
Stefan Weil
6a28cce96b Fix whitespace issues
* Remove whitespace (blanks, tabs, cr) at line endings

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-08-01 13:19:52 +02:00
Stefan Weil
7768f9b336 Clean more include files and include statements
The changes are based on an analysis done with include-what-you-use.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-24 19:45:12 +02:00
Stefan Weil
c8dd4456e0 Fix CID 1393240 (Missing return statement)
This also fixes a compiler warning:

unittest/progress_test.cc:59:9: warning:
 no return statement in function returning non-void [-Wreturn-type]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-20 17:14:53 +02:00
Shreeshrii
0e9929f2ab
Update osd_test.cc 2018-06-19 10:23:48 +05:30
Shreeshrii
39ead95f51
Update loadlang_test.cc 2018-06-19 10:23:21 +05:30
Shreeshrii
873586ec9b
Update apiexample_test.cc 2018-06-19 10:22:46 +05:30
Shree Devi Kumar
90b29d9d53 Add tesseract/ to API header file invocation 2018-06-18 18:53:01 +00:00
Shree Devi Kumar
16e45d21a0 Test load of all langs and scripts for all 3 tessdata repos 2018-06-17 05:31:32 +00:00
Stefan Weil
165622c745 Fix symbolic link in unittest
The unittest could not run when building out of source tree.
Fix the symbolic link and make sure that the directory for it exists.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-06-09 14:15:13 +02:00
Shree Devi Kumar
2563380d51 move testing and testdata to test, add unlvtests 2018-06-06 12:20:14 +00:00
Jaroslaw Kubik
67ceae8385 Fix the progres increase test
The progress increase test must compare the input value against
the variable that contains a previous value, not against it's
initial value.
2018-06-02 02:29:42 +02:00
Jaroslaw Kubik
e05d333378 Added tests for progress reporting API
The progress reporting API is now tested using googlemock tools.
2018-06-02 00:47:34 +02:00
Jaroslaw Kubik
92168c5e8b Added googlemock building instructions
The googlemock tools are already present, so why not make use of
it. It can be usefull for testing callbacks.
2018-06-02 00:42:37 +02:00
Shreeshrii
07a6e64174
remove non-essential logging function
Also got error while building on  
Linux tesseract-ocr 4.4.0-122-generic #146-Ubuntu SMP Mon Apr 23 15:33:25 UTC 2018 ppc64le ppc64le ppc64le GNU/Linux
with 
g++ (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609

```
g++ -DHAVE_CONFIG_H -I. -I..  -DNDEBUG -DTESSDATA_DIR="\"/home/ubuntu/tessdata\"" -DTESTING_DIR="\"/home/ubuntu/tesseract/testing\"" -DPANGO_ENABLE_ENGINE -I../src/api -I../src/api -I../src/arch -I../src/ccmain -I../src/ccstruct -I../src/ccutil -I../src/classify -I../src/cutil -I../src/dict -I../src/display -I../src/lstm -I../src/textord -I../src/viewer -I../src/wordrec -isystem ../googletest/googletest/include -I/usr/local/include/leptonica -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/powerpc64le-linux-gnu/glib-2.0/include -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/powerpc64le-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12  -g -O2 -std=c++11 -MT osd_test.o -MD -MP -MF $depbase.Tpo -c -o osd_test.o osd_test.cc &&\
mv -f $depbase.Tpo $depbase.Po
In file included from /usr/include/features.h:367:0,
                 from /usr/include/powerpc64le-linux-gnu/c++/5/bits/os_defines.h:39,
                 from /usr/include/powerpc64le-linux-gnu/c++/5/bits/c++config.h:482,
                 from /usr/include/c++/5/iostream:38,
                 from log.h:19,
                 from osd_test.cc:20:
/usr/include/powerpc64le-linux-gnu/bits/mathcalls.h:109:1: error: ‘double log(double)’ redeclared as different kind of symbol
 __MATHCALL_VEC (log,, (_Mdouble_ __x));
 ^
In file included from osd_test.cc:20:0:
log.h:26:3: note: previous declaration ‘LOG log’
 } log;
   ^
```
2018-05-05 16:34:26 +05:30
Stefan Weil
a2a12a4469 Fix unittest for autotools configuration after source tree reorganisation
Now "make check" also works again.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-04-25 21:33:28 +02:00
Stefan Weil
95f39142ac Fix unittest (missing include path)
Add include path for api/tess_version.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-04-24 13:17:57 +02:00
amitdo
c3e6083e42 Remove 'AUTOMAKE_OPTIONS' from all Makefile.am files
'AM_INIT_AUTOMAKE()' in configure.ac sets options globally.
2018-04-23 14:01:16 +03:00
Stefan Weil
39cfbd04fe unittest: Replace NULL by nullptr
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-04-22 17:42:36 +02:00
Stefan Weil
3fcb952dbf Remove unneeded CPPFLAGS (#1425)
* training: Remove unneeded CPPFLAGS

The training code does not need vs2010/port.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* unittest: Remove unneeded CPPFLAGS

The unittest code does not need vs2010/port.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-25 21:04:45 +02:00
Stefan Weil
023e1b340e Use POSIX data types and macros (#878)
* api: Replace Tesseract data types by POSIX data types

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* ccmain: Replace Tesseract data types by POSIX data types

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* ccstruct: Replace Tesseract data types by POSIX data types

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* classify: Replace Tesseract data types by POSIX data types

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* cutil: Replace Tesseract data types by POSIX data types

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* dict: Replace Tesseract data types by POSIX data types

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* textord: Replace Tesseract data types by POSIX data types

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* training: Replace Tesseract data types by POSIX data types

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* wordrec: Replace Tesseract data types by POSIX data types

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* ccutil: Replace Tesseract data types by POSIX data types

Now all Tesseract data types which are no longer needed can be removed
from ccutil/host.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX

Remove the macros which are now unused from ccutil/host.h.
Remove also the obsolete history comments.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* Fix build error caused by ambiguous ClipToRange

Error message vom Appveyor CI:

    C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj]
    C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj]
      c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange'
      C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char'
      C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or       'int'

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-13 21:36:30 +01:00
Stefan Weil
40c71bfcb8 Update unittest for new script data location and fix out-of-tree build (#1386)
tessdata_best and tessdata_fast recently changed the path for script data,
so the tests have to be updated, too.

In addition, the relative paths did not work with out-of-tree builds.
Use absolute paths and add them as C macros to the compiler flags.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-13 21:15:44 +01:00
Shreeshrii
5845e1a27d Add unit test for OSD, update apiexample test (#1359)
* Update apiexample_test.cc

* Add OSD test and logging function

* Add images for OSD unittest
2018-03-04 14:52:27 +01:00
Stefan Weil
7972b13e3a Remove macro USE_STD_NAMESPACE (#1360)
The related code in training/util.h now uses the GOOGLE_TESSERACT macro
to enable Google specific code to disable heap checking.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-04 14:43:28 +01:00
Stefan Weil
67f706f9ef 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>
2017-09-13 13:50:39 +02:00
Stefan Weil
b42df389be unittest/apiexample_test: Report missing test image
This avoids a runtime error (SIGSEGV caused by nullptr) for that case.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-09-13 13:43:49 +02:00
Stefan Weil
5c7600c282 unittest/apiexample_test: Fix test for out-of-tree builds
The test expects to find phototest.tif and phototest.txt
in directory ../testing. Create symbolic links if those
files don't exist there.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-09-13 13:29:16 +02:00
Stefan Weil
8655524772 unittest/apiexample_test: Use "C" locale
We cannot assume that the locale "en_US.UTF-8" is always available.
Using the "C" locale should work better.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-09-13 13:26:09 +02:00
Stefan Weil
4ae227df53 unittest: Fix path for libtesseract in out of tree builds
The library is provided in the build path (which is not
the same as the source path for out of tree builds).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-09-12 17:24:34 +02:00
amitdo
a905548ed6 Autotools build: Remove the option 'USING_MULTIPLELIBS'
Libtool's convenience libraries should never be installed. Fixes #985.
2017-09-11 15:03:53 +03:00
Shree Devi Kumar
f6c22dbf66 remove duplicate - gunit.h 2017-09-10 14:50:59 +05:30
Ray Smith
3493785f7d Fixed apiexample and intsimdmatrix tests and prepared Makefile.am for more tests 2017-09-08 17:34:31 +01:00
Ray Smith
fc6a390c6c Added intsimdmatrix as a generic integer matrixdotvector function with AVX2 and SSE specializations 2017-09-08 15:06:19 +01:00
Shreeshrii
e0464a0d31 Delete readme.md 2017-09-04 10:45:44 +05:30
Shreeshrii
f7284569ff Use groundtruth from testing directory 2017-09-04 10:44:43 +05:30
Shreeshrii
0ed7317c38 Rename unittest/testfiles/phototest.txt to testing/phototest.txt
Add groundtruth in the testing directory
2017-09-04 10:42:37 +05:30
Shreeshrii
10cf508442 Changed syntax for AM_CPPFLAGS
as per suggestion in https://github.com/tesseract-ocr/tesseract/pull/1088#discussion_r136700733

Not ALL of these are needed currently.
2017-09-03 08:09:18 +05:30
Shreeshrii
3b05b3e28b revert blank line at end
as not needed after 
8bb5a89d5a
2017-09-02 20:00:45 +05:30
Shreeshrii
6773e8b909 add blank lines to match OCRed text 2017-08-19 19:17:08 +05:30
Shreeshrii
f3dc156f22 updated version of apiexample_test 2017-08-19 18:46:23 +05:30
Shreeshrii
7b409a1bfa unittest testfile 2017-08-19 18:43:57 +05:30
Shreeshrii
436ad77e44 Create readme.md 2017-08-19 18:43:10 +05:30
Shreeshrii
88e4c62b39 Add files via upload 2017-08-19 18:42:06 +05:30
Ray Smith
8e55e52be7 Harder unittest that uses file i/o and string manipulation 2017-08-03 15:51:18 -07:00
Ray Smith
4572940639 Portability fix to help tests compile with the same code in both Google and github 2017-08-03 15:42:26 -07:00
Ray Smith
2fbcba62e5 Initial push of one simple unittest 2017-08-02 17:35:29 -07:00