diff --git a/test/test_circ.cpp b/test/test_circ.cpp index b42d2a5..af1be9b 100644 --- a/test/test_circ.cpp +++ b/test/test_circ.cpp @@ -320,6 +320,30 @@ void Unit::test_prod_cons_performance() { test_prod_cons <3 , 3 >(); // test & verify } +#ifndef QVERIFY_EXCEPTION_THROWN +#define QVERIFY_EXCEPTION_THROWN(expression, exceptiontype) \ +do {\ + QT_TRY {\ + QT_TRY {\ + expression;\ + QTest::qFail("Expected exception of type " #exceptiontype " to be thrown" \ + " but no exception caught", __FILE__, __LINE__);\ + return;\ + } QT_CATCH (const exceptiontype &) {\ + }\ + } QT_CATCH (const std::exception &e) {\ + QByteArray msg = QByteArray() + "Expected exception of type " #exceptiontype \ + " to be thrown but std::exception caught with message: " + e.what(); \ + QTest::qFail(msg.constData(), __FILE__, __LINE__);\ + return;\ + } QT_CATCH (...) {\ + QTest::qFail("Expected exception of type " #exceptiontype " to be thrown" \ + " but unknown exception caught", __FILE__, __LINE__);\ + return;\ + }\ +} while (false) +#endif/*!QVERIFY_EXCEPTION_THROWN*/ + void Unit::test_queue() { ipc::circ::queue queue; queue.push(1, 2);