RawNullPointerArgumentEvaluatorTest.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-05-23
  6. * Changed: 2023-05-23
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls-std/ls-std-core.hpp>
  11. using ls::std::core::IllegalArgumentException;
  12. using ls::std::core::RawNullPointerArgumentEvaluator;
  13. using ls::std::core::type::RawPointer;
  14. using std::string;
  15. using testing::Test;
  16. namespace
  17. {
  18. class RawNullPointerArgumentEvaluatorTest : public Test
  19. {
  20. public:
  21. RawNullPointerArgumentEvaluatorTest() = default;
  22. ~RawNullPointerArgumentEvaluatorTest() override = default;
  23. };
  24. TEST_F(RawNullPointerArgumentEvaluatorTest, evaluate_raw_pointer)
  25. {
  26. EXPECT_THROW(
  27. {
  28. try
  29. {
  30. RawNullPointerArgumentEvaluator<void>{RawPointer<void>{nullptr}}.evaluate();
  31. }
  32. catch (const IllegalArgumentException &_exception)
  33. {
  34. string actual = _exception.what();
  35. string expected = _exception.getName() + " thrown - passed argument is null!";
  36. ASSERT_STREQ(expected.c_str(), actual.c_str());
  37. throw;
  38. }
  39. },
  40. IllegalArgumentException);
  41. }
  42. }