SectionPairFileReaderIT.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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-22
  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. using namespace ::testing;
  19. namespace
  20. {
  21. class SectionPairFileReaderIT : public Test
  22. {
  23. protected:
  24. SectionPairFileReaderIT() = default;
  25. ~SectionPairFileReaderIT() override = default;
  26. void SetUp() override
  27. {}
  28. void TearDown() override
  29. {}
  30. static string getSectionPairFileLocation()
  31. {
  32. return TestHelper::getResourcesFolderLocation() + "server-settings-unix.txt";
  33. }
  34. };
  35. TEST_F(SectionPairFileReaderIT, read)
  36. {
  37. SectionPairFileReaderParameter parameter{};
  38. shared_ptr<SectionPairDocument> document = make_shared<SectionPairDocument>();
  39. parameter.setDocument(document);
  40. parameter.setFilePath(SectionPairFileReaderIT::getSectionPairFileLocation());
  41. SectionPairFileReader reader{parameter};
  42. reader.read();
  43. ASSERT_TRUE(!reader.getDocument()->getSectionList().empty());
  44. ASSERT_STREQ("general", reader.getDocument()->get(0)->getSectionId().c_str());
  45. ASSERT_EQ(2, reader.getDocument()->get(0)->getRowAmount());
  46. }
  47. }