XmlParseParameterTest.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-05
  6. * Changed: 2023-02-05
  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 XmlParseParameterTest : public ::testing::Test
  18. {
  19. protected:
  20. XmlParseParameterTest() = default;
  21. ~XmlParseParameterTest() override = default;
  22. void SetUp() override
  23. {}
  24. void TearDown() override
  25. {}
  26. };
  27. TEST_F(XmlParseParameterTest, getLevel)
  28. {
  29. XmlParseParameter parameter{};
  30. ASSERT_EQ(0, parameter.getLevel());
  31. }
  32. TEST_F(XmlParseParameterTest, getNode)
  33. {
  34. XmlParseParameter parameter{};
  35. ASSERT_TRUE(parameter.getNode() == nullptr);
  36. }
  37. TEST_F(XmlParseParameterTest, setLevel)
  38. {
  39. XmlParseParameter parameter{};
  40. parameter.setLevel(3);
  41. ASSERT_EQ(3, parameter.getLevel());
  42. }
  43. TEST_F(XmlParseParameterTest, setNode)
  44. {
  45. XmlParseParameter parameter{};
  46. parameter.setNode(make_shared<XmlNode>("node"));
  47. ASSERT_TRUE(parameter.getNode() != nullptr);
  48. }
  49. TEST_F(XmlParseParameterTest, setNode_no_reference)
  50. {
  51. XmlParseParameter parameter{};
  52. EXPECT_THROW(
  53. {
  54. try
  55. {
  56. parameter.setNode(nullptr);
  57. }
  58. catch (const IllegalArgumentException &_exception)
  59. {
  60. throw;
  61. }
  62. },
  63. IllegalArgumentException);
  64. }
  65. }