Skip to content

Commit a6da642

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

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

unittest/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ check_PROGRAMS += unicharcompress_test
138138
check_PROGRAMS += validate_grapheme_test
139139
check_PROGRAMS += validate_indic_test
140140
check_PROGRAMS += validate_khmer_test
141+
check_PROGRAMS += validate_myanmar_test
141142
check_PROGRAMS += validator_test
142143
endif
143144

@@ -274,6 +275,9 @@ validate_indic_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS
274275
validate_khmer_test_SOURCES = validate_khmer_test.cc
275276
validate_khmer_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS_LIBS) $(ICU_I18N_LIBS) $(ICU_UC_LIBS)
276277

278+
validate_myanmar_test_SOURCES = validate_myanmar_test.cc
279+
validate_myanmar_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS_LIBS) $(ICU_I18N_LIBS) $(ICU_UC_LIBS)
280+
277281
validator_test_SOURCES = validator_test.cc
278282
validator_test_LDADD = $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS_LIBS) $(ICU_UC_LIBS)
279283

unittest/validate_myanmar_test.cc

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,37 @@
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 Myanmar words.
920
TEST(ValidateMyanmarTest, GoodMyanmarWords) {
10-
string str = "လျှာကသိသည် "; // No viramas in this one.
21+
std::string str = "လျှာကသိသည် "; // No viramas in this one.
1122
ExpectGraphemeModeResults(str, UnicodeNormMode::kNFC, 11, 11, 5, str);
1223
str = "တုန္လႈပ္မႈ ";
1324
ExpectGraphemeModeResults(str, UnicodeNormMode::kNFC, 11, 9, 4, str);
1425
}
1526

1627
// Test some random Myanmar words with dotted circles.
1728
TEST(ValidateMyanmarTest, BadMyanmarWords) {
18-
string str = "က်န္းမာေရး";
19-
std::vector<string> glyphs;
29+
std::string str = "က်န္းမာေရး";
30+
std::vector<std::string> glyphs;
2031
EXPECT_FALSE(NormalizeCleanAndSegmentUTF8(
2132
UnicodeNormMode::kNFC, OCRNorm::kNone, GraphemeNormMode::kCombined, true,
2233
str.c_str(), &glyphs));
23-
string result;
34+
std::string result;
2435
EXPECT_FALSE(NormalizeUTF8String(UnicodeNormMode::kNFC, OCRNorm::kNone,
2536
GraphemeNorm::kNormalize, str.c_str(),
2637
&result));

0 commit comments

Comments
 (0)