ExceptionMessageTest.cpp 929 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-07
  6. * Changed: 2023-03-25
  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. public:
  19. ExceptionMessageTest() = default;
  20. ~ExceptionMessageTest() override = default;
  21. };
  22. TEST_F(ExceptionMessageTest, toCharacterPointer)
  23. {
  24. string text = "hello!";
  25. ExceptionMessage message{text};
  26. char *characterPointer = message.toCharacterPointer();
  27. ASSERT_STREQ(text.c_str(), characterPointer);
  28. delete characterPointer;
  29. }
  30. TEST_F(ExceptionMessageTest, toCharacterPointer_empty)
  31. {
  32. ExceptionMessage message{""};
  33. ASSERT_TRUE(message.toCharacterPointer() == nullptr);
  34. }
  35. }