XMLAttributeTest.cpp 1.3 KB

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