BsTestOutput.h 1.0 KB

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