Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TestNotPassedException : public std::exception {
- public:
- TestNotPassedException() : m_errMessage("Some test failed.\n"){};
- explicit TestNotPassedException(const char* msg) : m_errMessage(msg) {}
- virtual const char* what() const throw() {
- return m_errMessage;
- }
- private:
- const char* m_errMessage;
- };
- define ASSERT_EQUAL(first, second) do { \
- if (first != second) { \
- std::ostringstream oss; \
- oss << "Required equal failed: " << #first << " != " << #second << "\n" \
- << "At " << __FILE__ << " : " << __LINE__ << "\n"; \
- throw TestNotPassedException(oss.str().c_str()); \
- }\
- }while (false)
- int runTests() {
- try {
- TestCreate();
- } catch (std::exception& e) {
- std::cerr << "Tests failed\n";
- std::cerr << e.what();
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement