mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 02:59:07 +08:00
unittest: Add qrsequence_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
11f82f5c1e
commit
d3cf423748
@ -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)
|
||||
|
||||
|
@ -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 <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#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) {
|
||||
|
Loading…
Reference in New Issue
Block a user