Spaces:
Runtime error
Runtime error
File size: 1,106 Bytes
be11144 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
#pragma once
#include <string>
#include <iostream>
#include <sstream>
namespace unittest
{
class UnitTestException
{
public:
std::string message;
UnitTestException() {}
UnitTestException(const std::string& msg) : message(msg) {}
friend std::ostream& operator<<(std::ostream& os, const UnitTestException& e)
{
return os << e.message;
}
template <typename T>
UnitTestException& operator<<(const T& t)
{
std::ostringstream oss;
oss << t;
message += oss.str();
return *this;
}
};
class UnitTestError : public UnitTestException
{
public:
UnitTestError() {}
UnitTestError(const std::string& msg) : UnitTestException(msg) {}
};
class UnitTestFailure : public UnitTestException
{
public:
UnitTestFailure() {}
UnitTestFailure(const std::string& msg) : UnitTestException(msg) {}
};
class UnitTestKnownFailure : public UnitTestException
{
public:
UnitTestKnownFailure() {}
UnitTestKnownFailure(const std::string& msg) : UnitTestException(msg) {}
};
}; //end namespace unittest
|