SectionPairRowValueValidatorTest.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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-11
  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. }
  38. TEST_F(SectionPairRowValueValidatorTest, isValid_not_valid)
  39. {
  40. ASSERT_FALSE(SectionPairRowValueValidator{"1+2=3"}.isValid());
  41. ASSERT_FALSE(SectionPairRowValueValidator{"\\escape"}.isValid());
  42. }
  43. }