27static bool file_exists(
const char *filename) {
29 return _access(filename, 0) == 0;
31 return access(filename, 0) == 0;
38 static std::locale system_locale(
"");
39 std::locale::global(system_locale);
44 if (file_exists(filename.c_str())) {
45 std::string wordlist(
"\u0640");
51 for (
auto it = text.
begin(); it != text.
end(); ++it) {
52 std::string utf8 = it.get_utf8_string();
53 if (utf8.find(
"\u0640") != std::string::npos)
57 LOG(
INFO) <<
"Num tatweels in source data=" << num_tatweel;
70 for (
int i = 0;
i < unicharset_.size(); ++
i) {
71 const char *utf8 = unicharset_.id_to_unichar(
i);
72 EXPECT_EQ(strstr(utf8,
reinterpret_cast<const char *
>(u8
"\u0640")),
nullptr);
80 if (!file_exists(filename.c_str())) {
81 LOG(
INFO) <<
"Skip test because of missing " << filename;
94 if (!file_exists(filename.c_str())) {
95 LOG(
INFO) <<
"Skip test because of missing " << filename;
98 EXPECT_TRUE(unicharset_.load_from_file(filename.c_str()));
100 for (
int i = 0;
i < unicharset_.size(); ++
i) {
101 const char *utf8 = unicharset_.id_to_unichar(
i);
102 if (strstr(utf8,
reinterpret_cast<const char *
>(u8
"\u0640")) !=
nullptr) {
106 LOG(
INFO) <<
"Num tatweels in unicharset=" << num_tatweel;
#define EXPECT_EQ(val1, val2)
#define EXPECT_GT(val1, val2)
#define EXPECT_TRUE(condition)
std::string TestDataNameToPath(const std::string &name)
TEST_F(EuroText, FastLatinOCR)
void unichar_insert(const char *const unichar_repr, OldUncleanUnichars old_style)
int check_for_words(const char *filename, const UNICHARSET &unicharset, bool enable_wildcard) const
bool read_and_add_word_list(const char *filename, const UNICHARSET &unicharset, Trie::RTLReversePolicy reverse)
static std::string JoinPath(const std::string &s1, const std::string &s2)
static bool GetContents(const std::string &filename, std::string *out, int)
std::string TestDataNameToPath(const std::string &name)
const_iterator end() const
UnicodeText & PointToUTF8(const char *utf8_buffer, int byte_length)
const_iterator begin() const