Skip to content

Commit

Permalink
Fix build for unicharcompress_test
Browse files Browse the repository at this point in the history
* Add abseil library
* Add minimalistic implementation for WriteStringToFile
* Add missing namespace for std::string

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Jan 19, 2019
1 parent e67ad46 commit 0ae8fdc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion unittest/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion unittest/include_gunit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion unittest/unicharcompress_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

1 comment on commit 0ae8fdc

@Shreeshrii
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @stweil

Please sign in to comment.