Fix build for unicharcompress_test

* Add abseil library
* Add minimalistic implementation for WriteStringToFile
* Add missing namespace for std::string

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-01-19 08:34:00 +01:00
parent e67ad46fca
commit 0ae8fdc859
3 changed files with 6 additions and 3 deletions

View File

@ -244,7 +244,7 @@ unichar_test_SOURCES = unichar_test.cc
unichar_test_LDADD = $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS_LIBS) $(ICU_UC_LIBS)
unicharcompress_test_SOURCES = unicharcompress_test.cc
unicharcompress_test_LDADD = $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS_LIBS) $(ICU_UC_LIBS)
unicharcompress_test_LDADD = $(ABSEIL_LIBS) $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS_LIBS) $(ICU_UC_LIBS)
unicharset_test_SOURCES = unicharset_test.cc
unicharset_test_LDADD = $(GTEST_LIBS) $(TRAINING_LIBS) $(TESS_LIBS) $(ICU_UC_LIBS)

View File

@ -23,7 +23,10 @@ class file : public tesseract::File {
public:
// Create a file and write a string to it.
static bool WriteStringToFile(const std::string& contents, const std::string& name);
static bool WriteStringToFile(const std::string& contents, const std::string& filename) {
File::WriteStringToFileOrDie(contents, filename);
return true;
}
static bool GetContents(const std::string& filename, std::string* out, int) {
return File::ReadFileToString(filename, out);

View File

@ -237,7 +237,7 @@ TEST_F(UnicharcompressTest, GetEncodingAsString) {
ExpectCorrect("trivial");
STRING encoding = compressed_.GetEncodingAsString(unicharset_);
std::string encoding_str(&encoding[0], encoding.length());
std::vector<string> lines =
std::vector<std::string> lines =
absl::StrSplit(encoding_str, "\n", absl::SkipEmpty());
EXPECT_EQ(5, lines.size());
// The first line is always space.