tesseract v5.3.3.20231005
tesseract::ParamsModelTest Class Reference
Inheritance diagram for tesseract::ParamsModelTest:
testing::Test

Protected Member Functions

void SetUp () override
 
std::string TestDataNameToPath (const std::string &name) const
 
std::string OutputNameToPath (const std::string &name) const
 
void TestParamsModelRoundTrip (const std::string &params_model_filename) const
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 

Additional Inherited Members

- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestSuite ()
 
static void TearDownTestSuite ()
 
static void TearDownTestCase ()
 
static void SetUpTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool IsSkipped ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 

Detailed Description

Definition at line 35 of file params_model_test.cc.

Member Function Documentation

◆ OutputNameToPath()

std::string tesseract::ParamsModelTest::OutputNameToPath ( const std::string &  name) const
inlineprotected

Definition at line 45 of file params_model_test.cc.

45 {
46 return file::JoinPath(FLAGS_test_tmpdir, name);
47 }
static std::string JoinPath(const std::string &s1, const std::string &s2)
Definition: include_gunit.h:65

◆ SetUp()

void tesseract::ParamsModelTest::SetUp ( )
inlineoverrideprotectedvirtual

Reimplemented from testing::Test.

Definition at line 38 of file params_model_test.cc.

38 {
39 std::locale::global(std::locale(""));
40 }

◆ TestDataNameToPath()

std::string tesseract::ParamsModelTest::TestDataNameToPath ( const std::string &  name) const
inlineprotected

Definition at line 42 of file params_model_test.cc.

42 {
43 return file::JoinPath(TESTDATA_DIR, name);
44 }

◆ TestParamsModelRoundTrip()

void tesseract::ParamsModelTest::TestParamsModelRoundTrip ( const std::string &  params_model_filename) const
inlineprotected

Definition at line 50 of file params_model_test.cc.

50 {
51 tesseract::ParamsModel orig_model;
52 tesseract::ParamsModel duplicate_model;
54 std::string orig_file = TestDataNameToPath(params_model_filename);
55 std::string out_file = OutputNameToPath(params_model_filename);
56
57 EXPECT_TRUE(LoadFromFile(orig_model, "eng", orig_file.c_str()));
58 EXPECT_TRUE(orig_model.SaveToFile(out_file.c_str()));
59
60 EXPECT_TRUE(LoadFromFile(duplicate_model, "eng", out_file.c_str()));
61 EXPECT_TRUE(orig_model.Equivalent(duplicate_model));
62 }
#define EXPECT_TRUE(condition)
Definition: gtest.h:1982
bool SaveToFile(const char *full_path) const
bool Equivalent(const ParamsModel &that) const
static void MakeTmpdir()
Definition: include_gunit.h:38
std::string OutputNameToPath(const std::string &name) const
std::string TestDataNameToPath(const std::string &name) const

The documentation for this class was generated from the following file: