15
15
#include " normstrngs_test.h"
16
16
#include " strngs.h"
17
17
#include " unichar.h"
18
- #if defined(HAS_UNILIB_H)
19
- #include " unilib.h"
20
- #endif
18
+ #include " util/utf8/unilib.h"
21
19
22
20
#include " include_gunit.h"
23
21
24
22
namespace tesseract {
25
23
namespace {
26
24
27
- #if defined(HAS_UNILIB_H )
25
+ #if defined(MISSING_CODE )
28
26
static std::string EncodeAsUTF8 (const char32 ch32) {
29
27
UNICHAR uni_ch (ch32);
30
28
return std::string (uni_ch.utf8 (), uni_ch.utf8_len ());
@@ -363,7 +361,6 @@ TEST(NormstrngsTest, SpanUTF8NotWhitespace) {
363
361
EXPECT_EQ (12 , SpanUTF8NotWhitespace (kMixedText ));
364
362
}
365
363
366
- #if defined(HAS_UNILIB_H)
367
364
// Test that the method clones the util/utf8/public/unilib definition of
368
365
// interchange validity.
369
366
TEST (NormstrngsTest, IsInterchangeValid) {
@@ -374,12 +371,11 @@ TEST(NormstrngsTest, IsInterchangeValid) {
374
371
EXPECT_EQ (UniLib::IsInterchangeValid (ch), IsInterchangeValid (ch));
375
372
}
376
373
}
377
- #endif
378
374
379
- #if defined(HAS_UNILIB_H)
380
375
// Test that the method clones the util/utf8/public/unilib definition of
381
376
// 7-bit ASCII interchange validity.
382
377
TEST (NormstrngsTest, IsInterchangeValid7BitAscii) {
378
+ #if defined(MISSING_CODE)
383
379
const int32_t kMinUnicodeValue = 33 ;
384
380
const int32_t kMaxUnicodeValue = 0x10FFFF ;
385
381
for (int32_t ch = kMinUnicodeValue ; ch <= kMaxUnicodeValue ; ++ch) {
@@ -388,8 +384,11 @@ TEST(NormstrngsTest, IsInterchangeValid7BitAscii) {
388
384
EXPECT_EQ (UniLib::IsInterchangeValid7BitAscii (str),
389
385
IsInterchangeValid7BitAscii (ch));
390
386
}
391
- }
387
+ #else
388
+ // Skipped because of missing UniLib::IsInterchangeValid7BitAscii.
389
+ GTEST_SKIP ();
392
390
#endif
391
+ }
393
392
394
393
// Test that the method clones the util/utf8/public/unilib definition of
395
394
// fullwidth-halfwidth .
@@ -401,7 +400,8 @@ TEST(NormstrngsTest, FullwidthToHalfwidth) {
401
400
// U+FFE6 -> U+20A9 (won sign)
402
401
EXPECT_EQ (0x20A9 , FullwidthToHalfwidth (0xFFE6 ));
403
402
404
- #if defined(HAS_UNILIB_H)
403
+ #if defined(MISSING_CODE)
404
+ // Skipped because of missing UniLib::FullwidthToHalfwidth.
405
405
const int32_t kMinUnicodeValue = 33 ;
406
406
const int32_t kMaxUnicodeValue = 0x10FFFF ;
407
407
for (int32_t ch = kMinUnicodeValue ; ch <= kMaxUnicodeValue ; ++ch) {
0 commit comments