SectionPairFileReaderParameterTest.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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-23
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls-std/ls-std-io.hpp>
  11. using ls::std::io::FileExistenceEvaluator;
  12. using ls::std::io::SectionPairDocument;
  13. using ls::std::io::SectionPairFileReaderParameter;
  14. using std::make_shared;
  15. using testing::Test;
  16. namespace
  17. {
  18. class SectionPairFileReaderParameterTest : public Test
  19. {
  20. protected:
  21. SectionPairFileReaderParameterTest() = default;
  22. ~SectionPairFileReaderParameterTest() override = default;
  23. void SetUp() override
  24. {}
  25. void TearDown() override
  26. {}
  27. };
  28. TEST_F(SectionPairFileReaderParameterTest, getDocument)
  29. {
  30. ASSERT_TRUE(SectionPairFileReaderParameter{}.getDocument() == nullptr);
  31. }
  32. TEST_F(SectionPairFileReaderParameterTest, getFileExistenceEvaluator)
  33. {
  34. ASSERT_TRUE(SectionPairFileReaderParameter{}.getFileExistenceEvaluator() == nullptr);
  35. }
  36. TEST_F(SectionPairFileReaderParameterTest, getFilePath)
  37. {
  38. ASSERT_TRUE(SectionPairFileReaderParameter{}.getFilePath().empty());
  39. }
  40. TEST_F(SectionPairFileReaderParameterTest, getReader)
  41. {
  42. ASSERT_TRUE(SectionPairFileReaderParameter{}.getReader() == nullptr);
  43. }
  44. TEST_F(SectionPairFileReaderParameterTest, setDocument)
  45. {
  46. SectionPairFileReaderParameter parameter{};
  47. parameter.setDocument(make_shared<SectionPairDocument>());
  48. ASSERT_FALSE(parameter.getDocument() == nullptr);
  49. }
  50. TEST_F(SectionPairFileReaderParameterTest, setFileExistenceEvaluator)
  51. {
  52. SectionPairFileReaderParameter parameter{};
  53. parameter.setFileExistenceEvaluator(make_shared<FileExistenceEvaluator>("/var/log/file.txt"));
  54. ASSERT_FALSE(parameter.getFileExistenceEvaluator() == nullptr);
  55. }
  56. TEST_F(SectionPairFileReaderParameterTest, setFilePath)
  57. {
  58. SectionPairFileReaderParameter parameter{};
  59. parameter.setFilePath("var/log/log.txt");
  60. ASSERT_FALSE(parameter.getFilePath().empty());
  61. }
  62. }