Skip to content

Commit d3cf423

Browse files
committed
unittest: Add qrsequence_test
Signed-off-by: Stefan Weil <[email protected]>
1 parent 11f82f5 commit d3cf423

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

unittest/Makefile.am

+7
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ check_PROGRAMS = \
9292
nthitem_test \
9393
osd_test \
9494
progress_test \
95+
qrsequence_test \
9596
rect_test \
9697
stats_test \
9798
tablefind_test \
@@ -119,6 +120,9 @@ applybox_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS) $(LEPTONICA_LIBS)
119120
baseapi_test_SOURCES = baseapi_test.cc
120121
baseapi_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TESS_LIBS)
121122

123+
baseapi_thread_test_SOURCES = baseapi_thread_test.cc
124+
baseapi_thread_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TESS_LIBS)
125+
122126
bitvector_test_SOURCES = bitvector_test.cc
123127
bitvector_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS)
124128

@@ -165,6 +169,9 @@ progress_test_SOURCES = progress_test.cc
165169
progress_test_LDFLAGS = $(OPENCL_LDFLAGS) $(LEPTONICA_LIBS)
166170
progress_test_LDADD = $(GTEST_LIBS) $(GMOCK_LIBS) $(TESS_LIBS) $(LEPTONICA_LIBS)
167171

172+
qrsequence_test_SOURCES = qrsequence_test.cc
173+
qrsequence_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TESS_LIBS)
174+
168175
rect_test_SOURCES = rect_test.cc
169176
rect_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS)
170177

unittest/qrsequence_test.cc

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
//
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.
211

3-
#include "tesseract/ccutil/qrsequence.h"
412

513
#include <algorithm>
614
#include <vector>
715

16+
#include "cycletimer.h"
17+
#include "include_gunit.h"
18+
#include "log.h"
19+
#include "qrsequence.h"
20+
821
namespace {
922

1023
class TestableQRSequenceGenerator : public QRSequenceGenerator {
@@ -33,8 +46,7 @@ TEST_P(QRSequenceGeneratorTest, GeneratesValidSequence) {
3346
CycleTimer timer;
3447
timer.Restart();
3548
for (int i = 0; i < kRangeSize; ++i) vals[i] = generator.GetVal();
36-
LOG(INFO) << kRangeSize << "-length sequence took " << timer.Get() * 1e3
37-
<< "ms";
49+
LOG(INFO) << kRangeSize << "-length sequence took " << timer.GetInMs() << "ms";
3850
// Sort the numbers to verify that we've covered the range without repetition.
3951
std::sort(vals.begin(), vals.end());
4052
for (int i = 0; i < kRangeSize; ++i) {

0 commit comments

Comments
 (0)