SectionPairRowValueValidatorTest.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-09
  6. * Changed: 2023-02-17
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls-std/ls-std-core.hpp>
  11. #include <ls-std/ls-std-io.hpp>
  12. using namespace ls::std::core;
  13. using namespace ls::std::io;
  14. using namespace ::std;
  15. namespace
  16. {
  17. class SectionPairRowValueValidatorTest : public ::testing::Test
  18. {
  19. protected:
  20. SectionPairRowValueValidatorTest() = default;
  21. ~SectionPairRowValueValidatorTest() override = default;
  22. void SetUp() override
  23. {}
  24. void TearDown() override
  25. {}
  26. };
  27. TEST_F(SectionPairRowValueValidatorTest, getClassName)
  28. {
  29. ASSERT_STREQ("SectionPairRowValueValidator", SectionPairRowValueValidator{"any value"}.getClassName().c_str());
  30. }
  31. TEST_F(SectionPairRowValueValidatorTest, isValid)
  32. {
  33. ASSERT_TRUE(SectionPairRowValueValidator{"blue is my favourite color!"}.isValid());
  34. ASSERT_TRUE(SectionPairRowValueValidator{"Age"}.isValid());
  35. ASSERT_TRUE(SectionPairRowValueValidator{"Tom"}.isValid());
  36. ASSERT_TRUE(SectionPairRowValueValidator{"\"Tom\""}.isValid());
  37. ASSERT_TRUE(SectionPairRowValueValidator{"Hello!" + NewLine::get()}.isValid());
  38. ASSERT_TRUE(SectionPairRowValueValidator{"Hello!" + NewLine::getWindowsNewLine()}.isValid());
  39. }
  40. TEST_F(SectionPairRowValueValidatorTest, isValid_not_valid)
  41. {
  42. ASSERT_FALSE(SectionPairRowValueValidator{"1+2=3"}.isValid());
  43. ASSERT_FALSE(SectionPairRowValueValidator{"\\escape"}.isValid());
  44. }
  45. }