[test] Fix dawg.

This commit is contained in:
Egor Pugin 2020-12-30 02:38:11 +03:00
parent 482824c109
commit f8957ebcc5

View File

@ -21,6 +21,11 @@
#include "include_gunit.h" #include "include_gunit.h"
#ifndef SW_TESTING
#define wordlist2dawg_prog "wordlist2dawg"
#define dawg2wordlist_prog "dawg2wordlist"
#endif
namespace tesseract { namespace tesseract {
// Test some basic functionality dealing with Dawgs (compressed dictionaries, // Test some basic functionality dealing with Dawgs (compressed dictionaries,
@ -68,11 +73,12 @@ class DawgTest : public testing::Test {
std::string orig_wordlist = file::JoinPath(TESTING_DIR, wordlist_filename); std::string orig_wordlist = file::JoinPath(TESTING_DIR, wordlist_filename);
std::string output_dawg = OutputNameToPath(wordlist_filename + ".dawg"); std::string output_dawg = OutputNameToPath(wordlist_filename + ".dawg");
std::string output_wordlist = OutputNameToPath(wordlist_filename); std::string output_wordlist = OutputNameToPath(wordlist_filename);
mkdir(FLAGS_test_tmpdir);
LoadWordlist(orig_wordlist, &orig_words); LoadWordlist(orig_wordlist, &orig_words);
EXPECT_EQ( EXPECT_EQ(
RunCommand("wordlist2dawg", orig_wordlist, output_dawg, unicharset), 0); RunCommand(wordlist2dawg_prog, orig_wordlist, output_dawg, unicharset), 0);
EXPECT_EQ( EXPECT_EQ(
RunCommand("dawg2wordlist", unicharset, output_dawg, output_wordlist), RunCommand(dawg2wordlist_prog, unicharset, output_dawg, output_wordlist),
0); 0);
LoadWordlist(output_wordlist, &roundtrip_words); LoadWordlist(output_wordlist, &roundtrip_words);
EXPECT_EQ(orig_words, roundtrip_words); EXPECT_EQ(orig_words, roundtrip_words);