SectionPairRowSingleValueValidatorTest.cpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-19
  6. * Changed: 2023-02-19
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls-std/ls-std-core.hpp>
  11. #include <ls-std/ls-std-io.hpp>
  12. #include <string>
  13. using namespace ls::std::core;
  14. using namespace ls::std::io;
  15. using namespace ::std;
  16. namespace
  17. {
  18. class SectionPairRowSingleValueValidatorTest : public ::testing::Test
  19. {
  20. protected:
  21. SectionPairRowSingleValueValidatorTest() = default;
  22. ~SectionPairRowSingleValueValidatorTest() override = default;
  23. void SetUp() override
  24. {}
  25. void TearDown() override
  26. {}
  27. };
  28. class SectionPairRowSingleValueValidatorIsValidTest : public ::testing::TestWithParam<string>
  29. {
  30. protected:
  31. SectionPairRowSingleValueValidatorIsValidTest() = default;
  32. ~SectionPairRowSingleValueValidatorIsValidTest() override = default;
  33. };
  34. class SectionPairRowSingleValueValidatorNotValidTest : public ::testing::TestWithParam<string>
  35. {
  36. protected:
  37. SectionPairRowSingleValueValidatorNotValidTest() = default;
  38. ~SectionPairRowSingleValueValidatorNotValidTest() override = default;
  39. };
  40. TEST_F(SectionPairRowSingleValueValidatorTest, getClassName)
  41. {
  42. ASSERT_STREQ("SectionPairRowSingleValueValidator", SectionPairRowSingleValueValidator{"tmp-key"}.getClassName().c_str());
  43. }
  44. TEST_P(SectionPairRowSingleValueValidatorIsValidTest, isValid)
  45. {
  46. ASSERT_TRUE(SectionPairRowSingleValueValidator{GetParam()}.isValid());
  47. }
  48. TEST_P(SectionPairRowSingleValueValidatorNotValidTest, isValid_not_valid)
  49. {
  50. ASSERT_FALSE(SectionPairRowSingleValueValidator{GetParam()}.isValid());
  51. }
  52. INSTANTIATE_TEST_SUITE_P(SectionPairRowSingleValueValidatorTest, SectionPairRowSingleValueValidatorIsValidTest, ::testing::Values("favourite-color=blue" + NewLine::getUnixNewLine(), "hair-color=red" + NewLine::getWindowsNewLine(), "height=167"));
  53. INSTANTIATE_TEST_SUITE_P(SectionPairRowSingleValueValidatorTest, SectionPairRowSingleValueValidatorNotValidTest, ::testing::Values("color blue"));
  54. }