Skip to content

Commit f95725a

Browse files
committed
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>
1 parent 6df28fb commit f95725a

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

unittest/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ check_PROGRAMS = \
6767
osd_test \
6868
progress_test \
6969
rect_test \
70+
stats_test \
7071
tesseracttests
7172

7273
TESTS = $(check_PROGRAMS)
@@ -123,6 +124,9 @@ progress_test_LDADD = $(GTEST_LIBS) $(GMOCK_LIBS) $(TESS_LIBS) $(LEPTONICA_LIBS)
123124
rect_test_SOURCES = rect_test.cc
124125
rect_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS)
125126

127+
stats_test_SOURCES = stats_test.cc
128+
stats_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS)
129+
126130
tesseracttests_SOURCES = ../tests/tesseracttests.cpp
127131
tesseracttests_LDADD = $(GTEST_LIBS) $(TESS_LIBS) $(LEPTONICA_LIBS)
128132

unittest/include_gunit.h

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const char* FLAGS_test_tmpdir = ".";
2222
class file: public tesseract::File {
2323
};
2424

25+
#define ABSL_ARRAYSIZE(arr) (sizeof(arr) / sizeof(arr[0]))
2526
#define ARRAYSIZE(arr) (sizeof(arr) / sizeof(arr[0]))
2627
#define CHECK(test) ASSERT_HOST(test)
2728

unittest/stats_test.cc

+16-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
2-
#include "tesseract/ccstruct/statistc.h"
3-
#include "tesseract/ccutil/genericvector.h"
4-
#include "tesseract/ccutil/kdpair.h"
1+
// (C) Copyright 2017, Google Inc.
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an "AS IS" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
12+
#include "statistc.h"
13+
#include "genericvector.h"
14+
#include "kdpair.h"
15+
16+
#include "include_gunit.h"
517

618
namespace {
719

@@ -45,12 +57,3 @@ TEST_F(STATSTest, TopNModes) {
4557
}
4658

4759
} // namespace.
48-
49-
50-
51-
52-
53-
54-
55-
56-

0 commit comments

Comments
 (0)