KUnitTest
#include <iostream>
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include <QtCore/QHash>
#include <QtCore/QTextStream>
#include "kunittest_export.h"
Go to the source code of this file.
|
#define | CHECK(x, y) check( __FILE__, __LINE__, #x, x, y, false ) |
|
#define | CHECK_EXCEPTION(exceptionCatch, expression) |
|
#define | SKIP(x) skip( __FILE__, __LINE__, QLatin1String(#x)) |
|
#define | SKIP_EXCEPTION(exceptionCatch, expression) |
|
#define | VERIFY(cond) check( __FILE__, __LINE__, #cond, cond, true, false ) |
|
#define | XFAIL(x, y) check( __FILE__, __LINE__, #x, x, y, true ) |
|
#define | XFAIL_EXCEPTION(exceptionCatch, expression) |
|
#define CHECK |
( |
|
x, |
|
|
|
y |
|
) |
| check( __FILE__, __LINE__, #x, x, y, false ) |
Use this macro to perform an equality check. For example
CHECK( numberOfErrors(), 0 );
Definition at line 335 of file tester.h.
#define CHECK_EXCEPTION |
( |
|
exceptionCatch, |
|
|
|
expression |
|
) |
| |
Value:try \
{ \
expression; \
} \
catch(exceptionCatch) \
{ \
setExceptionRaised(true); \
} \
if(exceptionRaised()) \
{ \
} \
else \
{ \
"an exception on: ") + #expression); \
} \
setExceptionRaised(false);
QString number(int n, int base)
An macro testing that expression
throws an exception that is caught with exceptionCatch
. Use it to test that an expression, such as a function call, throws a certain exception.
- Note
- this macro assumes it's used in a function which is a sub-class of the Tester class.
Definition at line 368 of file tester.h.
Use this macro to indicate that a test is skipped.
SKIP(
"Test skipped because of lack of foo support.");
Definition at line 359 of file tester.h.
#define SKIP_EXCEPTION |
( |
|
exceptionCatch, |
|
|
|
expression |
|
) |
| |
Value:skip( __FILE__, __LINE__,
QString(
"Exception catch: ")\
This macro is similar to SKIP, but is for exceptions instead. Skip testing expression
and the exceptionCatch
which is supposed to catch the exception, and register the test as being skipped.
Definition at line 416 of file tester.h.
#define VERIFY |
( |
|
cond | ) |
check( __FILE__, __LINE__, #cond, cond, true, false ) |
Use this macro to check that a boolean condition is true. For example
Definition at line 342 of file tester.h.
#define XFAIL |
( |
|
x, |
|
|
|
y |
|
) |
| check( __FILE__, __LINE__, #x, x, y, true ) |
Use this macro to perform a check you expect to fail. For example
XFAIL( numberOfErrors(), 1 );
If the test fails, it will be counted as such, however it will also be registered separately.
Definition at line 352 of file tester.h.
#define XFAIL_EXCEPTION |
( |
|
exceptionCatch, |
|
|
|
expression |
|
) |
| |
Value:try \
{ \
expression; \
} \
catch(exceptionCatch) \
{ \
setExceptionRaised(true); \
} \
if(exceptionRaised()) \
{ \
unexpectedSuccess(
QString(__FILE__) +
"[" +
QString::number(__LINE__) +
"]: unexpectedly threw an exception and passed: " + #expression); \
}\
else \
{ \
} \
setExceptionRaised(false);
QString number(int n, int base)
This macro is similar to XFAIL, but is for exceptions instead. Flags expression
as being expected to fail to throw an exception that exceptionCatch
is supposed to catch.
Definition at line 392 of file tester.h.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:57 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.