SectionPairRowSingleValueTest.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-10
  6. * Changed: 2023-02-10
  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 SectionPairRowSingleValueTest : public ::testing::Test
  18. {
  19. protected:
  20. SectionPairRowSingleValueTest() = default;
  21. ~SectionPairRowSingleValueTest() override = default;
  22. void SetUp() override
  23. {}
  24. void TearDown() override
  25. {}
  26. };
  27. TEST_F(SectionPairRowSingleValueTest, getClassName)
  28. {
  29. ASSERT_STREQ("SectionPairRowSingleValue", SectionPairRowSingleValue{"blue"}.getClassName().c_str());
  30. }
  31. TEST_F(SectionPairRowSingleValueTest, constructor_empty_value)
  32. {
  33. EXPECT_THROW(
  34. {
  35. try
  36. {
  37. SectionPairRowSingleValue value{""};
  38. }
  39. catch (const IllegalArgumentException &_exception)
  40. {
  41. throw;
  42. }
  43. },
  44. IllegalArgumentException);
  45. }
  46. TEST_F(SectionPairRowSingleValueTest, constructor_invalid_value)
  47. {
  48. EXPECT_THROW(
  49. {
  50. try
  51. {
  52. SectionPairRowSingleValue value{"=33"};
  53. }
  54. catch (const IllegalArgumentException &_exception)
  55. {
  56. throw;
  57. }
  58. },
  59. IllegalArgumentException);
  60. }
  61. TEST_F(SectionPairRowSingleValueTest, get)
  62. {
  63. SectionPairRowSingleValue value{"blue"};
  64. ASSERT_STREQ("blue", value.get().c_str());
  65. }
  66. TEST_F(SectionPairRowSingleValueTest, getType)
  67. {
  68. SectionPairRowSingleValue value{"blue"};
  69. ASSERT_EQ(ls::std::io::SECTION_PAIR_ROW_SINGLE_VALUE, value.getType());
  70. }
  71. }