1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "Prerequisites/BsPrerequisitesUtil.h"
6
7namespace bs
8{
9 /** @addtogroup Testing
10 * @{
11 */
12
13 /** Abstract interface used for outputting unit test results. */
14 class BS_UTILITY_EXPORT TestOutput
15 {
16 public:
17 virtual ~TestOutput() {}
18
19 /**
20 * Triggered when a unit test fails.
21 *
22 * @param[in] desc Reason why the unit test failed.
23 * @param[in] function Name of the function the test failed in.
24 * @param[in] file File the unit test failed in.
25 * @param[in] line Line of code the unit test failed on.
26 */
27 virtual void outputFail(const String& desc, const String& function, const String& file, long line) = 0;
28 };
29
30 /** Outputs unit test results so that failures are reported as exceptions. Success is not reported. */
31 class BS_UTILITY_EXPORT ExceptionTestOutput : public TestOutput
32 {
33 public:
34 /** @copydoc TestOutput::outputFail */
35 void outputFail(const String& desc, const String& function, const String& file, long line) final override;
36 };
37
38 /** @} */
39}