• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KUnitTest

  • sources
  • kde-4.12
  • kdelibs
  • kde3support
  • kunittest
Classes | Namespaces | Macros | Typedefs | Functions
tester.h File Reference
#include <iostream>
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include <QtCore/QHash>
#include <QtCore/QTextStream>
#include "kunittest_export.h"
Include dependency graph for tester.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  KUnitTest::SlotTester
 
class  KUnitTest::Tester
 
class  KUnitTest::TestResults
 

Namespaces

 KUnitTest
 

Macros

#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)
 

Typedefs

typedef QHash< QByteArray,
TestResults * > 
KUnitTest::TestResultsList
 

Functions

QTextStream & operator<< (QTextStream &str, const QRect &r)
 
QTextStream & operator<< (QTextStream &str, const QPoint &r)
 
QTextStream & operator<< (QTextStream &str, const QSize &r)
 

Macro Definition Documentation

#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()) \
{ \
success(QString(__FILE__) + "[" + QString::number(__LINE__) + "]: passed " + #expression); \
} \
else \
{ \
failure(QString(__FILE__) + "[" + QString::number(__LINE__) + QString("]: failed to throw " \
"an exception on: ") + #expression); \
} \
setExceptionRaised(false);
QString

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.

#define SKIP (   x)    skip( __FILE__, __LINE__, QLatin1String(#x))

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: ")\
.arg(QString(#exceptionCatch)).arg(QString(" Test expression: ")).arg(QString(#expression)))
QString

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

VERIFY( numberOfRows() > 0 );

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 \
{ \
expectedFailure(QString(__FILE__) + "[" + QString::number(__LINE__) + QString("]: failed to throw an exception on: ") + #expression); \
} \
setExceptionRaised(false);
QString

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.

Function Documentation

QTextStream& operator<< ( QTextStream &  str,
const QRect &  r 
)

Definition at line 102 of file tester.cpp.

QTextStream& operator<< ( QTextStream &  str,
const QPoint &  r 
)

Definition at line 107 of file tester.cpp.

QTextStream& operator<< ( QTextStream &  str,
const QSize &  r 
)

Definition at line 112 of file tester.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:52:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KUnitTest

Skip menu "KUnitTest"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal