From d3cf423748ebab98e53b9d2d468e8410d845d72c Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 12 Oct 2018 08:01:58 +0200 Subject: [PATCH] unittest: Add qrsequence_test Signed-off-by: Stefan Weil --- unittest/Makefile.am | 7 +++++++ unittest/qrsequence_test.cc | 20 ++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/unittest/Makefile.am b/unittest/Makefile.am index 4bea942cdd..8934c92254 100644 --- a/unittest/Makefile.am +++ b/unittest/Makefile.am @@ -92,6 +92,7 @@ check_PROGRAMS = \ nthitem_test \ osd_test \ progress_test \ + qrsequence_test \ rect_test \ stats_test \ tablefind_test \ @@ -119,6 +120,9 @@ applybox_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS) $(LEPTONICA_LIBS) baseapi_test_SOURCES = baseapi_test.cc baseapi_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TESS_LIBS) +baseapi_thread_test_SOURCES = baseapi_thread_test.cc +baseapi_thread_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TESS_LIBS) + bitvector_test_SOURCES = bitvector_test.cc bitvector_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS) @@ -165,6 +169,9 @@ progress_test_SOURCES = progress_test.cc progress_test_LDFLAGS = $(OPENCL_LDFLAGS) $(LEPTONICA_LIBS) progress_test_LDADD = $(GTEST_LIBS) $(GMOCK_LIBS) $(TESS_LIBS) $(LEPTONICA_LIBS) +qrsequence_test_SOURCES = qrsequence_test.cc +qrsequence_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TESS_LIBS) + rect_test_SOURCES = rect_test.cc rect_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS) diff --git a/unittest/qrsequence_test.cc b/unittest/qrsequence_test.cc index 4d748caf60..8ce3eba485 100644 --- a/unittest/qrsequence_test.cc +++ b/unittest/qrsequence_test.cc @@ -1,10 +1,23 @@ -// +// (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 "tesseract/ccutil/qrsequence.h" #include #include +#include "cycletimer.h" +#include "include_gunit.h" +#include "log.h" +#include "qrsequence.h" + namespace { class TestableQRSequenceGenerator : public QRSequenceGenerator { @@ -33,8 +46,7 @@ TEST_P(QRSequenceGeneratorTest, GeneratesValidSequence) { CycleTimer timer; timer.Restart(); for (int i = 0; i < kRangeSize; ++i) vals[i] = generator.GetVal(); - LOG(INFO) << kRangeSize << "-length sequence took " << timer.Get() * 1e3 - << "ms"; + LOG(INFO) << kRangeSize << "-length sequence took " << timer.GetInMs() << "ms"; // Sort the numbers to verify that we've covered the range without repetition. std::sort(vals.begin(), vals.end()); for (int i = 0; i < kRangeSize; ++i) {