ExceptionMessageTest.cpp 1011 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-07
  6. * Changed: 2023-02-22
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls-std/ls-std-core.hpp>
  11. using ls::std::core::ExceptionMessage;
  12. using std::string;
  13. using testing::Test;
  14. namespace
  15. {
  16. class ExceptionMessageTest : public Test
  17. {
  18. protected:
  19. ExceptionMessageTest() = default;
  20. ~ExceptionMessageTest() override = default;
  21. void SetUp() override
  22. {}
  23. void TearDown() override
  24. {}
  25. };
  26. TEST_F(ExceptionMessageTest, toCharacterPointer)
  27. {
  28. string text = "hello!";
  29. ExceptionMessage message{text};
  30. char *characterPointer = message.toCharacterPointer();
  31. ASSERT_STREQ(text.c_str(), characterPointer);
  32. delete characterPointer;
  33. }
  34. TEST_F(ExceptionMessageTest, toCharacterPointer_empty)
  35. {
  36. ExceptionMessage message{""};
  37. ASSERT_TRUE(message.toCharacterPointer() == nullptr);
  38. }
  39. }