SST/macro
Classes | Macros | Functions
test.h File Reference
#include <vector>
#include <iostream>
#include <string.h>
#include <sprockit/test/output.h>
#include <sprockit/test/equality.h>
#include <sprockit/test/container.h>
#include <sprockit/test/fxn.h>
#include <sprockit/spkt_string.h>
Include dependency graph for test.h:

Go to the source code of this file.

Classes

class  TestCase
 
class  TestCase_impl< T >
 
class  UnitTest
 
class  AssertEqual< T, A >
 
class  AssertEqual< T, T >
 
class  AssertEqual< std::vector< T >, A >
 
class  AssertEqual< std::vector< T >, std::vector< T > >
 
class  ExceptionTestCase
 

Macros

#define THIS_FILE   truncate_file(__FILE__)
 
#define SPROCKIT_RUN_TEST(fxn, unit_tester, ...)
 
#define SPROCKIT_RUN_TEST_NO_ARGS(fxn, unit_tester)
 
#define assertThrows(test_set, descr, exc, fxn)   assertThrows_impl<exc>(test_set, descr, THIS_FILE, __LINE__, #exc, fxn)
 
#define assertEqual(test_set, descr, ...)   _assertEqual(test_set, descr, THIS_FILE, __LINE__, __VA_ARGS__)
 
#define assertNotEqual(test_set, descr, ...)   _assertNotEqual(test_set, descr, THIS_FILE, __LINE__, __VA_ARGS__)
 
#define assertTrue(test_set, descr, ...)   _assertTrue(test_set, descr, THIS_FILE, __LINE__, __VA_ARGS__)
 
#define assertFalse(test_set, descr, ...)   _assertFalse(test_set, descr, THIS_FILE, __LINE__, __VA_ARGS__)
 

Functions

const char * truncate_file (const char *file)
 
void _assertFalse (UnitTest &test_set, const char *descr, const char *file, int line, bool test)
 
void _assertTrue (UnitTest &test_set, const char *descr, const char *file, int line, bool test)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &asserted, bool should_be_equal)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, bool should_be_equal)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3, bool should_be_equal)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3, const A &assert4, bool should_be_equal)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3, const A &assert4, const A &assert5, bool should_be_equal)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3, const A &assert4, const A &assert5, const A &assert6, bool should_be_equal)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &asserted)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3, const A &assert4)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3, const A &assert4, const A &assert5)
 
template<class T , class A >
void _assertEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3, const A &assert4, const A &assert5, const A &assert6)
 
template<class T , class A >
void _assertNotEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &asserted)
 
template<class T , class A >
void _assertNotEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2)
 
template<class T , class A >
void _assertNotEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3)
 
template<class T , class A >
void _assertNotEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3, const A &assert4)
 
template<class T , class A >
void _assertNotEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3, const A &assert4, const A &assert5)
 
template<class T , class A >
void _assertNotEqual (UnitTest &test_set, const char *descr, const char *file, int line, const T &test, const A &assert1, const A &assert2, const A &assert3, const A &assert4, const A &assert5, const A &assert6)
 
template<class Exc >
void assertThrows_impl (UnitTest &test_set, const char *descr, const char *file, int line, const char *exc, TestFxn *fxn)
 

Macro Definition Documentation

#define assertEqual (   test_set,
  descr,
  ... 
)    _assertEqual(test_set, descr, THIS_FILE, __LINE__, __VA_ARGS__)

Definition at line 586 of file test.h.

#define assertFalse (   test_set,
  descr,
  ... 
)    _assertFalse(test_set, descr, THIS_FILE, __LINE__, __VA_ARGS__)

Definition at line 595 of file test.h.

#define assertNotEqual (   test_set,
  descr,
  ... 
)    _assertNotEqual(test_set, descr, THIS_FILE, __LINE__, __VA_ARGS__)

Definition at line 589 of file test.h.

#define assertThrows (   test_set,
  descr,
  exc,
  fxn 
)    assertThrows_impl<exc>(test_set, descr, THIS_FILE, __LINE__, #exc, fxn)

Definition at line 583 of file test.h.

#define assertTrue (   test_set,
  descr,
  ... 
)    _assertTrue(test_set, descr, THIS_FILE, __LINE__, __VA_ARGS__)

Definition at line 592 of file test.h.

#define SPROCKIT_RUN_TEST (   fxn,
  unit_tester,
  ... 
)
Value:
try { \
fxn(unit_tester, __VA_ARGS__); \
} catch (std::exception& e) { \
unit_tester.append(new ExceptionTestCase("unexpected exception in " #fxn, THIS_FILE, __LINE__, "none", e.what(), "exception thown", false)); \
}
#define THIS_FILE
Definition: test.h:567

Definition at line 569 of file test.h.

#define SPROCKIT_RUN_TEST_NO_ARGS (   fxn,
  unit_tester 
)
Value:
try { \
fxn(unit_tester); \
} catch (std::exception& e) { \
unit_tester.append(new ExceptionTestCase("unexpected exception in " #fxn, THIS_FILE, __LINE__, "none", e.what(), "exception thown", false)); \
}
#define THIS_FILE
Definition: test.h:567

Definition at line 576 of file test.h.

#define THIS_FILE   truncate_file(__FILE__)

Definition at line 567 of file test.h.

Function Documentation

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  asserted,
bool  should_be_equal 
)

Definition at line 195 of file test.h.

References AssertEqual< T, A >::add_test().

Referenced by _assertEqual(), and _assertNotEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
bool  should_be_equal 
)

Definition at line 208 of file test.h.

References AssertEqual< T, A >::add_test(), and ContainerAppend< C, A >::append().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3,
bool  should_be_equal 
)

Definition at line 225 of file test.h.

References AssertEqual< T, A >::add_test(), and ContainerAppend< C, A >::append().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3,
const A &  assert4,
bool  should_be_equal 
)

Definition at line 244 of file test.h.

References AssertEqual< T, A >::add_test(), and ContainerAppend< C, A >::append().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3,
const A &  assert4,
const A &  assert5,
bool  should_be_equal 
)

Definition at line 265 of file test.h.

References AssertEqual< T, A >::add_test(), and ContainerAppend< C, A >::append().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3,
const A &  assert4,
const A &  assert5,
const A &  assert6,
bool  should_be_equal 
)

Definition at line 288 of file test.h.

References AssertEqual< T, A >::add_test(), and ContainerAppend< C, A >::append().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  asserted 
)

Definition at line 313 of file test.h.

References _assertEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2 
)

Definition at line 324 of file test.h.

References _assertEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3 
)

Definition at line 336 of file test.h.

References _assertEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3,
const A &  assert4 
)

Definition at line 350 of file test.h.

References _assertEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3,
const A &  assert4,
const A &  assert5 
)

Definition at line 365 of file test.h.

References _assertEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3,
const A &  assert4,
const A &  assert5,
const A &  assert6 
)

Definition at line 381 of file test.h.

References _assertEqual().

Here is the call graph for this function:

void _assertFalse ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
bool  test 
)
template<class T , class A >
void _assertNotEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  asserted 
)

Definition at line 398 of file test.h.

References _assertEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertNotEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2 
)

Definition at line 409 of file test.h.

References _assertEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertNotEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3 
)

Definition at line 421 of file test.h.

References _assertEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertNotEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3,
const A &  assert4 
)

Definition at line 435 of file test.h.

References _assertEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertNotEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3,
const A &  assert4,
const A &  assert5 
)

Definition at line 450 of file test.h.

References _assertEqual().

Here is the call graph for this function:

template<class T , class A >
void _assertNotEqual ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const T &  test,
const A &  assert1,
const A &  assert2,
const A &  assert3,
const A &  assert4,
const A &  assert5,
const A &  assert6 
)

Definition at line 466 of file test.h.

References _assertEqual().

Here is the call graph for this function:

void _assertTrue ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
bool  test 
)
template<class Exc >
void assertThrows_impl ( UnitTest test_set,
const char *  descr,
const char *  file,
int  line,
const char *  exc,
TestFxn fxn 
)

Definition at line 545 of file test.h.

References UnitTest::append(), and TestFxn::run().

Here is the call graph for this function:

const char* truncate_file ( const char *  file)