SectionPairFileReaderIT.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-21
  6. * Changed: 2023-02-21
  7. *
  8. * */
  9. #include <classes/TestHelper.hpp>
  10. #include <gtest/gtest.h>
  11. #include <ls-std/ls-std-core.hpp>
  12. #include <ls-std/ls-std-io.hpp>
  13. #include <string>
  14. using namespace ls::std::core;
  15. using namespace ls::std::io;
  16. using namespace ::std;
  17. using namespace ls::std::test;
  18. namespace
  19. {
  20. class SectionPairFileReaderIT : public ::testing::Test
  21. {
  22. protected:
  23. SectionPairFileReaderIT() = default;
  24. ~SectionPairFileReaderIT() override = default;
  25. void SetUp() override
  26. {}
  27. void TearDown() override
  28. {}
  29. static string getSectionPairFileLocation()
  30. {
  31. return TestHelper::getResourcesFolderLocation() + "server-settings-unix.txt";
  32. }
  33. };
  34. TEST_F(SectionPairFileReaderIT, read)
  35. {
  36. SectionPairFileReaderParameter parameter{};
  37. shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
  38. parameter.setDocument(document);
  39. parameter.setFilePath(SectionPairFileReaderIT::getSectionPairFileLocation());
  40. SectionPairFileReader reader{parameter};
  41. reader.read();
  42. ASSERT_TRUE(!reader.getDocument()->getSectionList().empty());
  43. ASSERT_STREQ("general", reader.getDocument()->get(0)->getSectionId().c_str());
  44. ASSERT_EQ(2, reader.getDocument()->get(0)->getRowAmount());
  45. }
  46. }