mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 20:59:36 +08:00
[test] Fix dawg.
This commit is contained in:
parent
482824c109
commit
f8957ebcc5
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user