ExceptionMessageTest.cpp 932 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-07
  6. * Changed: 2023-05-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 std::string_view;
  14. using testing::Test;
  15. namespace
  16. {
  17. class ExceptionMessageTest : public Test
  18. {
  19. public:
  20. ExceptionMessageTest() = default;
  21. ~ExceptionMessageTest() override = default;
  22. };
  23. TEST_F(ExceptionMessageTest, toCharacterPointer)
  24. {
  25. string text = "hello!";
  26. ExceptionMessage message{text};
  27. string_view characterField = message.toCharacterPointer();
  28. ASSERT_STREQ(text.c_str(), characterField.data());
  29. }
  30. TEST_F(ExceptionMessageTest, toCharacterPointer_empty)
  31. {
  32. ExceptionMessage message{""};
  33. ASSERT_TRUE(message.toCharacterPointer() == nullptr);
  34. }
  35. }