HAL
hgl_writer.cpp
Go to the documentation of this file.
1 #include "gate_library_test_utils.h"
4 #include "netlist_test_utils.h"
5 
6 namespace hal
7 {
8  class HGLWriterTest : public ::testing::Test
9  {
10  protected:
11  virtual void SetUp()
12  {
13  test_utils::init_log_channels();
14  test_utils::create_sandbox_directory();
15  }
16 
17  virtual void TearDown()
18  {
19  test_utils::remove_sandbox_directory();
20  }
21  };
22 
28  TEST_F(HGLWriterTest, check_library)
29  {
30  TEST_START
31  {
32  std::string path_lib = test_utils::create_sandbox_path("test.hgl");
33  const GateLibrary* gl_original = test_utils::get_gate_library();
34  ASSERT_NE(gl_original, nullptr);
35 
36  HGLWriter writer;
37  ASSERT_TRUE(writer.write(gl_original, path_lib));
39  auto gl_res = parser.parse(path_lib);
40  ASSERT_TRUE(gl_res.is_ok());
41  std::unique_ptr<GateLibrary> gl_written = gl_res.get();
42  ASSERT_NE(gl_written, nullptr);
43 
44  EXPECT_TRUE(test_utils::gate_libraries_are_equal(gl_original, gl_written.get()));
45  }
46  TEST_END
47  }
48 } //namespace hal
bool write(const GateLibrary *gate_lib, const std::filesystem::path &file_path) override
Definition: hgl_writer.cpp:20
virtual void SetUp()
Definition: hgl_writer.cpp:11
virtual void TearDown()
Definition: hgl_writer.cpp:17
parser
Definition: control.py:13
GateLibrary * get_gate_library(const std::string &file_path)
TEST_F(HGLParserTest, check_library)
Definition: hgl_parser.cpp:26