Skip to content

Commit d67287a

Browse files
committed
unittest: Fix and enable validate_khmer_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 611d5e6 commit d67287a

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

unittest/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ check_PROGRAMS += unicharset_test
137137
check_PROGRAMS += unicharcompress_test
138138
check_PROGRAMS += validate_grapheme_test
139139
check_PROGRAMS += validate_indic_test
140+
check_PROGRAMS += validate_khmer_test
140141
check_PROGRAMS += validator_test
141142
endif
142143

@@ -270,6 +271,9 @@ validate_grapheme_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TRAINING_LIBS) $(T
270271
validate_indic_test_SOURCES = validate_indic_test.cc
271272
validate_indic_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS_LIBS) $(ICU_I18N_LIBS) $(ICU_UC_LIBS)
272273

274+
validate_khmer_test_SOURCES = validate_khmer_test.cc
275+
validate_khmer_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS_LIBS) $(ICU_I18N_LIBS) $(ICU_UC_LIBS)
276+
273277
validator_test_SOURCES = validator_test.cc
274278
validator_test_LDADD = $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS_LIBS) $(ICU_UC_LIBS)
275279

unittest/validate_khmer_test.cc

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
#include "tesseract/training/normstrngs.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.
211

3-
#include "tesseract/unittest/normstrngs_test.h"
12+
#include "include_gunit.h"
13+
#include "normstrngs.h"
14+
#include "normstrngs_test.h"
415

516
namespace tesseract {
617
namespace {
718

819
// Test some random Khmer words.
920
TEST(ValidateKhmerTest, GoodKhmerWords) {
10-
string str = "ព័ត៏មានប្លែកៗ";
21+
std::string str = "ព័ត៏មានប្លែកៗ";
1122
ExpectGraphemeModeResults(str, UnicodeNormMode::kNFC, 13, 12, 7, str);
1223
str = "ទំនុកច្រៀង";
1324
ExpectGraphemeModeResults(str, UnicodeNormMode::kNFC, 10, 9, 5, str);
@@ -19,9 +30,9 @@ TEST(ValidateKhmerTest, GoodKhmerWords) {
1930

2031
// Test some random Khmer words with dotted circles.
2132
TEST(ValidateKhmerTest, BadKhmerWords) {
22-
string result;
33+
std::string result;
2334
// Multiple dependent vowels not allowed
24-
string str = "\u1796\u17b6\u17b7";
35+
std::string str = "\u1796\u17b6\u17b7";
2536
EXPECT_FALSE(NormalizeUTF8String(UnicodeNormMode::kNFC, OCRNorm::kNone,
2637
GraphemeNorm::kNormalize, str.c_str(),
2738
&result));

0 commit comments

Comments
 (0)