SectionPairFileReaderParameterTest.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-21
  6. * Changed: 2023-03-25
  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. public:
  21. SectionPairFileReaderParameterTest() = default;
  22. ~SectionPairFileReaderParameterTest() override = default;
  23. };
  24. TEST_F(SectionPairFileReaderParameterTest, getDocument)
  25. {
  26. ASSERT_TRUE(SectionPairFileReaderParameter{}.getDocument() == nullptr);
  27. }
  28. TEST_F(SectionPairFileReaderParameterTest, getFileExistenceEvaluator)
  29. {
  30. ASSERT_TRUE(SectionPairFileReaderParameter{}.getFileExistenceEvaluator() == nullptr);
  31. }
  32. TEST_F(SectionPairFileReaderParameterTest, getFilePath)
  33. {
  34. ASSERT_TRUE(SectionPairFileReaderParameter{}.getFilePath().empty());
  35. }
  36. TEST_F(SectionPairFileReaderParameterTest, getReader)
  37. {
  38. ASSERT_TRUE(SectionPairFileReaderParameter{}.getReader() == nullptr);
  39. }
  40. TEST_F(SectionPairFileReaderParameterTest, setDocument)
  41. {
  42. SectionPairFileReaderParameter parameter{};
  43. parameter.setDocument(make_shared<SectionPairDocument>());
  44. ASSERT_FALSE(parameter.getDocument() == nullptr);
  45. }
  46. TEST_F(SectionPairFileReaderParameterTest, setFileExistenceEvaluator)
  47. {
  48. SectionPairFileReaderParameter parameter{};
  49. parameter.setFileExistenceEvaluator(make_shared<FileExistenceEvaluator>("/var/log/file.txt"));
  50. ASSERT_FALSE(parameter.getFileExistenceEvaluator() == nullptr);
  51. }
  52. TEST_F(SectionPairFileReaderParameterTest, setFilePath)
  53. {
  54. SectionPairFileReaderParameter parameter{};
  55. parameter.setFilePath("var/log/log.txt");
  56. ASSERT_FALSE(parameter.getFilePath().empty());
  57. }
  58. }