BsTestOutput.h 968 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include "BsPrerequisitesUtil.h"
  3. namespace BansheeEngine
  4. {
  5. /**
  6. * @brief Abstract interface used for outputting unit test results.
  7. */
  8. class BS_UTILITY_EXPORT TestOutput
  9. {
  10. public:
  11. virtual ~TestOutput() {}
  12. /**
  13. * @brief Triggered when a unit test fails.
  14. *
  15. * @param desc Reason why the unit test failed.
  16. * @param function Name of the function the test failed in.
  17. * @param file File the unit test failed in.
  18. * @param line Line of code the unit test failed on.
  19. */
  20. virtual void outputFail(const String& desc, const String& function, const String& file, long line) = 0;
  21. };
  22. /**
  23. * @brief Outputs unit test results so that failures are reported as exceptions. Success is not reported.
  24. */
  25. class BS_UTILITY_EXPORT ExceptionTestOutput : public TestOutput
  26. {
  27. public:
  28. /**
  29. * @copydoc TestOutput::outputFail
  30. */
  31. void outputFail(const String& desc, const String& function, const String& file, long line) final;
  32. };
  33. }