XMLAttributeTest.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-23
  6. * Changed: 2021-04-23
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls_std/ls_std.hpp>
  11. namespace
  12. {
  13. class XMLAttributeTest : public ::testing::Test
  14. {
  15. protected:
  16. XMLAttributeTest() = default;
  17. ~XMLAttributeTest() override = default;
  18. void SetUp() override
  19. {}
  20. void TearDown() override
  21. {}
  22. };
  23. TEST_F(XMLAttributeTest, getName)
  24. {
  25. ls_std::XMLAttribute attribute{"id"};
  26. ASSERT_STREQ("id", attribute.getName().c_str());
  27. }
  28. TEST_F(XMLAttributeTest, getValue)
  29. {
  30. ls_std::XMLAttribute attribute{"id"};
  31. ASSERT_TRUE(attribute.getValue().empty());
  32. }
  33. TEST_F(XMLAttributeTest, setName)
  34. {
  35. ls_std::XMLAttribute attribute{"id"};
  36. attribute.setName("id2");
  37. ASSERT_STREQ("id2", attribute.getName().c_str());
  38. }
  39. TEST_F(XMLAttributeTest, setValue)
  40. {
  41. ls_std::XMLAttribute attribute{"id"};
  42. attribute.setValue("some_content");
  43. ASSERT_STREQ("some_content", attribute.getValue().c_str());
  44. }
  45. TEST_F(XMLAttributeTest, toXML)
  46. {
  47. ls_std::XMLAttribute attribute{"id"};
  48. attribute.setValue("some_content");
  49. ASSERT_STREQ(R"(id="some_content")", attribute.toXML().c_str());
  50. }
  51. }