XmlParseParameterTest.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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-22
  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. using namespace ::testing;
  16. namespace
  17. {
  18. class XmlParseParameterTest : public Test
  19. {
  20. protected:
  21. XmlParseParameterTest() = default;
  22. ~XmlParseParameterTest() override = default;
  23. void SetUp() override
  24. {}
  25. void TearDown() override
  26. {}
  27. };
  28. TEST_F(XmlParseParameterTest, getLevel)
  29. {
  30. XmlParseParameter parameter{};
  31. ASSERT_EQ(0, parameter.getLevel());
  32. }
  33. TEST_F(XmlParseParameterTest, getNode)
  34. {
  35. XmlParseParameter parameter{};
  36. ASSERT_TRUE(parameter.getNode() == nullptr);
  37. }
  38. TEST_F(XmlParseParameterTest, setLevel)
  39. {
  40. XmlParseParameter parameter{};
  41. parameter.setLevel(3);
  42. ASSERT_EQ(3, parameter.getLevel());
  43. }
  44. TEST_F(XmlParseParameterTest, setNode)
  45. {
  46. XmlParseParameter parameter{};
  47. parameter.setNode(make_shared<XmlNode>("node"));
  48. ASSERT_TRUE(parameter.getNode() != nullptr);
  49. }
  50. TEST_F(XmlParseParameterTest, setNode_no_reference)
  51. {
  52. XmlParseParameter parameter{};
  53. EXPECT_THROW(
  54. {
  55. try
  56. {
  57. parameter.setNode(nullptr);
  58. }
  59. catch (const IllegalArgumentException &_exception)
  60. {
  61. throw;
  62. }
  63. },
  64. IllegalArgumentException);
  65. }
  66. }