From f95725afcb7f897c989438b1a76d415e700a4df8 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 26 Aug 2018 18:45:57 +0200 Subject: [PATCH] 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 --- unittest/Makefile.am | 4 ++++ unittest/include_gunit.h | 1 + unittest/stats_test.cc | 29 ++++++++++++++++------------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/unittest/Makefile.am b/unittest/Makefile.am index 38e4a301be..e54a84c265 100644 --- a/unittest/Makefile.am +++ b/unittest/Makefile.am @@ -67,6 +67,7 @@ check_PROGRAMS = \ osd_test \ progress_test \ rect_test \ + stats_test \ tesseracttests TESTS = $(check_PROGRAMS) @@ -123,6 +124,9 @@ progress_test_LDADD = $(GTEST_LIBS) $(GMOCK_LIBS) $(TESS_LIBS) $(LEPTONICA_LIBS) rect_test_SOURCES = rect_test.cc rect_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS) +stats_test_SOURCES = stats_test.cc +stats_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS) + tesseracttests_SOURCES = ../tests/tesseracttests.cpp tesseracttests_LDADD = $(GTEST_LIBS) $(TESS_LIBS) $(LEPTONICA_LIBS) diff --git a/unittest/include_gunit.h b/unittest/include_gunit.h index b2ac851e49..f4e0773167 100644 --- a/unittest/include_gunit.h +++ b/unittest/include_gunit.h @@ -22,6 +22,7 @@ const char* FLAGS_test_tmpdir = "."; class file: public tesseract::File { }; +#define ABSL_ARRAYSIZE(arr) (sizeof(arr) / sizeof(arr[0])) #define ARRAYSIZE(arr) (sizeof(arr) / sizeof(arr[0])) #define CHECK(test) ASSERT_HOST(test) diff --git a/unittest/stats_test.cc b/unittest/stats_test.cc index bbefa10bca..771d01c8c2 100644 --- a/unittest/stats_test.cc +++ b/unittest/stats_test.cc @@ -1,7 +1,19 @@ - -#include "tesseract/ccstruct/statistc.h" -#include "tesseract/ccutil/genericvector.h" -#include "tesseract/ccutil/kdpair.h" +// (C) Copyright 2017, Google Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "statistc.h" +#include "genericvector.h" +#include "kdpair.h" + +#include "include_gunit.h" namespace { @@ -45,12 +57,3 @@ TEST_F(STATSTest, TopNModes) { } } // namespace. - - - - - - - - -