Classes | Namespaces | Defines

test.h File Reference

#include "kdchart_export.h"
#include "kdganttglobal.h"
#include <string>
#include <iostream>
#include "testregistry.h"
#include "libutil.h"
Include dependency graph for test.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  KDAB::UnitTest::GenericFactory< T_Test >
class  KDAB::UnitTest::Test
class  KDAB::UnitTest::TestFactory

Namespaces

namespace  KDAB
namespace  KDAB::UnitTest

Defines

#define assertDoesNotThrowException(x, E)
#define assertEqual(x, y)   _assertEqual( (x), (y), #x, #y, __FILE__, __LINE__ )
#define assertEqualWithEpsilons(x, y, z)   _assertEqualWithEpsilons( (x), (y), (z), #x, #y, #z, __FILE__, __LINE__ )
#define assertFalse(x)   _assertFalse( (x), #x, __FILE__, __LINE__ )
#define assertNearEqual(x, y, z)
#define assertNotEqual(x, y)   _assertNotEqual( (x), (y), #x, #y, __FILE__, __LINE__ )
#define assertNotNull(x)   _assertNotNull( ( x ), #x, __FILE__, __LINE__ )
#define assertNull(x)   _assertNull( ( x ), #x, __FILE__, __LINE__ )
#define assertThrowsException(x, E)   assertThrowsExceptionWithCode( x, E, do{}while(0) )
#define assertThrowsExceptionWithCode(x, E, code)
#define assertTrue(x)   _assertTrue( (x), #x, __FILE__, __LINE__ )
#define KDAB_EXPORT_SCOPED_UNITTEST(Namespace, Class, Group)
#define KDAB_EXPORT_UNITTEST(Class, Group)
#define KDAB_IMPORT_UNITTEST(Class)   KDAB_IMPORT_STATIC_SYMBOLS( Class )
#define KDAB_SCOPED_UNITTEST_SIMPLE(Namespace, Class, Group)
#define KDAB_UNITTEST_SIMPLE(Class, Group)

Define Documentation

#define assertDoesNotThrowException (   x,
  E 
)
Value:
do {                           \
  try {                        \
    x;                         \
    success();                 \
  } catch ( E & ) {         \
    fail( __FILE__, __LINE__ ) \
      << "\"" #x "\" threw \"" #E "\", but shouldn't" << std::endl; \
  } catch ( ... ) {            \
    fail( __FILE__, __LINE__ ) \
      << "\"" #x "\" threw something, but it wasn't \"" #E "\"" << std::endl; \
  }                            \
} while ( false )

Definition at line 69 of file test.h.

#define assertEqual (   x,
  y 
)    _assertEqual( (x), (y), #x, #y, __FILE__, __LINE__ )

Definition at line 41 of file test.h.

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

#define assertEqualWithEpsilons (   x,
  y,
  z 
)    _assertEqualWithEpsilons( (x), (y), (z), #x, #y, #z, __FILE__, __LINE__ )

Definition at line 45 of file test.h.

#define assertFalse (   x  )     _assertFalse( (x), #x, __FILE__, __LINE__ )

Definition at line 40 of file test.h.

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

#define assertNearEqual (   x,
  y,
  z 
)

Definition at line 44 of file test.h.

#define assertNotEqual (   x,
  y 
)    _assertNotEqual( (x), (y), #x, #y, __FILE__, __LINE__ )

Definition at line 42 of file test.h.

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

#define assertNotNull (   x  )     _assertNotNull( ( x ), #x, __FILE__, __LINE__ )

Definition at line 37 of file test.h.

#define assertNull (   x  )     _assertNull( ( x ), #x, __FILE__, __LINE__ )

Definition at line 38 of file test.h.

#define assertThrowsException (   x,
  E 
)    assertThrowsExceptionWithCode( x, E, do{}while(0) )

Definition at line 67 of file test.h.

#define assertThrowsExceptionWithCode (   x,
  E,
  code 
)
Value:
do {                           \
  try {                        \
    x;                         \
    fail( __FILE__, __LINE__ ) \
      << "\"" #x "\" didn't throw \"" #E "\"" << std::endl; \
  } catch ( E & ppq_ut_thrown ) {                           \
    success();                 \
    ( void )ppq_ut_thrown;     \
    code;                      \
  } catch ( ... ) {            \
    fail( __FILE__, __LINE__ ) \
      << "\"" #x "\" threw something, but it wasn't \"" #E "\"" << std::endl; \
  }                            \
} while ( false )

Definition at line 51 of file test.h.

#define assertTrue (   x  )     _assertTrue( (x), #x, __FILE__, __LINE__ )

Definition at line 39 of file test.h.

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

#define KDAB_EXPORT_SCOPED_UNITTEST (   Namespace,
  Class,
  Group 
)
Value:
static const KDAB::UnitTest::GenericFactory< Namespace::Class > __##Class##_unittest( Group ); \
    KDAB_EXPORT_STATIC_SYMBOLS( Class )

Definition at line 171 of file test.h.

#define KDAB_EXPORT_UNITTEST (   Class,
  Group 
)
Value:
static const KDAB::UnitTest::GenericFactory< Class > __##Class##_unittest( Group ); \
    KDAB_EXPORT_STATIC_SYMBOLS( Class )

Definition at line 167 of file test.h.

#define KDAB_IMPORT_UNITTEST (   Class  )     KDAB_IMPORT_STATIC_SYMBOLS( Class )

Definition at line 176 of file test.h.

#define KDAB_SCOPED_UNITTEST_SIMPLE (   Namespace,
  Class,
  Group 
)
Value:
namespace Namespace {                                       \
        class Class##Test : public KDAB::UnitTest::Test {  \
        public:                                                 \
            Class##Test() : Test( #Namespace "::" #Class ){}    \
            void run();                                         \
        };                                                      \
    }                                                           \
    KDAB_EXPORT_SCOPED_UNITTEST( Namespace, Class##Test, Group ) \
    void Namespace::Class##Test::run()

Definition at line 189 of file test.h.

#define KDAB_UNITTEST_SIMPLE (   Class,
  Group 
)
Value:
class Class##Test : public KDAB::UnitTest::Test {  \
    public:                                                 \
        Class##Test() : Test( #Class ) {}                   \
        void run();                                         \
    };                                                      \
    KDAB_EXPORT_UNITTEST( Class##Test, Group )               \
    void Class##Test::run()

Definition at line 180 of file test.h.