CxxTest Namespace Reference

Classes

class  TestDescription
class  SuiteDescription
class  WorldDescription
class  DummyTestDescription
class  DummySuiteDescription
class  DummyWorldDescription
class  OutputStream
class  ErrorFormatter
class  ErrorPrinter
class  GlobalFixture
class  GuiListener
class  GuiTuiRunner
struct  List
class  Link
class  ParenPrinter
class  QtGui
class  RealTestDescription
class  RealSuiteDescription
class  StaticSuiteDescription
class  CommonDynamicSuiteDescription
class  DynamicSuiteDescription
class  RealWorldDescription
class  StdioFilePrinter
class  StdioPrinter
class  StdTraitsBase
class  ValueTraits< const CXXTEST_STD(string)>
class  ValueTraits< const CXXTEST_STD(basic_string< wchar_t >)>
class  TeeListener
class  TestListener
class  TestRunner
class  TestSuite
class  AbortTest
class  TestTracker
class  ValueTraits
class  ValueTraits< const char *const & >
class  ValueTraits< const bool >
class  ValueTraits< const signed long int >
class  ValueTraits< const unsigned long int >
class  ValueTraits< const char >
class  ValueTraits< const double >
class  Win32Gui
class  X11Gui
class  YesNoRunner
class  ValueTraits< const Pet >
class  MultiPrinter
class  PylogFormatter
class  TRPIFormatter

Functions

void activateAllTests ()
bool leaveOnly (const char *suiteName, const char *testName)
 CXXTEST_COPY_CONST_TRAITS (CXXTEST_STD(string))
 CXXTEST_COPY_CONST_TRAITS (CXXTEST_STD(basic_string< wchar_t >))
template<class Stream , class Iterator >
void dumpRange (Stream &s, Iterator first, Iterator last)
void initialize ()
bool abortTestOnFail ()
void setAbortTestOnFail (bool value)
void doAbortTest ()
unsigned maxDumpSize ()
void setMaxDumpSize (unsigned value)
void doTrace (const char *file, unsigned line, const char *message)
void doWarn (const char *file, unsigned line, const char *message)
void doFailTest (const char *file, unsigned line, const char *message)
void doFailAssert (const char *file, unsigned line, const char *expression, const char *message)
bool sameData (const void *x, const void *y, unsigned size)
void doAssertSameData (const char *file, unsigned line, const char *xExpr, const void *x, const char *yExpr, const void *y, const char *sizeExpr, unsigned size, const char *message)
void doFailAssertThrows (const char *file, unsigned line, const char *expr, const char *type, bool otherThrown, const char *message)
void doFailAssertThrowsNot (const char *file, unsigned line, const char *expression, const char *message)
template<class X , class Y >
bool equals (X x, Y y)
template<class X , class Y >
void doAssertEquals (const char *file, unsigned line, const char *xExpr, X x, const char *yExpr, Y y, const char *message)
template<class X , class Y >
bool differs (X x, Y y)
template<class X , class Y >
void doAssertDiffers (const char *file, unsigned line, const char *xExpr, X x, const char *yExpr, Y y, const char *message)
template<class X , class Y >
bool lessThan (X x, Y y)
template<class X , class Y >
void doAssertLessThan (const char *file, unsigned line, const char *xExpr, X x, const char *yExpr, Y y, const char *message)
template<class X , class Y >
bool lessThanEquals (X x, Y y)
template<class X , class Y >
void doAssertLessThanEquals (const char *file, unsigned line, const char *xExpr, X x, const char *yExpr, Y y, const char *message)
template<class X , class P >
void doAssertPredicate (const char *file, unsigned line, const char *pExpr, const P &p, const char *xExpr, X x, const char *message)
template<class X , class Y , class R >
void doAssertRelation (const char *file, unsigned line, const char *rExpr, const R &r, const char *xExpr, X x, const char *yExpr, Y y, const char *message)
template<class X , class Y , class D >
bool delta (X x, Y y, D d)
template<class X , class Y , class D >
void doAssertDelta (const char *file, unsigned line, const char *xExpr, X x, const char *yExpr, Y y, const char *dExpr, D d, const char *message)
TestTrackertracker ()
char digitToChar (unsigned digit)
const char * byteToHex (unsigned char byte)
char * copyString (char *dst, const char *src)
bool stringsEqual (const char *s1, const char *s2)
char * charToString (unsigned long c, char *s)
char * charToString (char c, char *s)
char * bytesToString (const unsigned char *bytes, unsigned numBytes, unsigned maxBytes, char *s)
template<class T >
ValueTraits< T > traits (T t)
template<class N >
bool negative (N n)
template<class N >
N abs (N n)
template<class N >
char * numberToString (N n, char *s, N base=10, unsigned skipDigits=0, unsigned maxDigits=(unsigned)-1)
 CXXTEST_COPY_TRAITS (const char *, const char *const &)
 CXXTEST_COPY_TRAITS (char *, const char *const &)
 CXXTEST_COPY_CONST_TRAITS (bool)
 CXXTEST_COPY_CONST_TRAITS (signed long int)
 CXXTEST_COPY_CONST_TRAITS (unsigned long int)
 CXXTEST_COPY_TRAITS (const signed int, const signed long int)
 CXXTEST_COPY_TRAITS (const unsigned int, const unsigned long int)
 CXXTEST_COPY_TRAITS (const signed short int, const signed long int)
 CXXTEST_COPY_TRAITS (const unsigned short int, const unsigned long int)
 CXXTEST_COPY_CONST_TRAITS (signed int)
 CXXTEST_COPY_CONST_TRAITS (unsigned int)
 CXXTEST_COPY_CONST_TRAITS (signed short int)
 CXXTEST_COPY_CONST_TRAITS (unsigned short int)
 CXXTEST_COPY_CONST_TRAITS (char)
 CXXTEST_COPY_TRAITS (const signed char, const char)
 CXXTEST_COPY_CONST_TRAITS (double)
 CXXTEST_COPY_TRAITS (const float, const double)
 CXXTEST_COPY_CONST_TRAITS (float)
 CXXTEST_COPY_CONST_TRAITS (Pet)

Variables

static bool currentAbortTestOnFail = false
static unsigned currentMaxDumpSize = CXXTEST_MAX_DUMP_SIZE

Function Documentation

bool CxxTest::abortTestOnFail (  ) 
template<class N >
N CxxTest::abs ( N  n  )  [inline]

Definition at line 120 of file ValueTraits.h.

References negative().

Referenced by numberToString().

00120 { return negative(n) ? -n : n; }

void CxxTest::activateAllTests (  ) 
char * CxxTest::bytesToString ( const unsigned char *  bytes,
unsigned  numBytes,
unsigned  maxBytes,
char *  s 
)
const char * CxxTest::byteToHex ( unsigned char  byte  ) 
char * CxxTest::charToString ( char  c,
char *  s 
)
CxxTest::CXXTEST_COPY_CONST_TRAITS ( Pet   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( float   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( double   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( char   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( unsigned short  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( signed short  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( unsigned  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( signed  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( unsigned long  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( signed long  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( bool   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( CXXTEST_STD(basic_string< wchar_t >)   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( CXXTEST_STD(string)   ) 
CxxTest::CXXTEST_COPY_TRAITS ( const   float,
const   double 
)
CxxTest::CXXTEST_COPY_TRAITS ( const signed  char,
const   char 
)
CxxTest::CXXTEST_COPY_TRAITS ( const unsigned short  int,
const unsigned long  int 
)
CxxTest::CXXTEST_COPY_TRAITS ( const signed short  int,
const signed long  int 
)
CxxTest::CXXTEST_COPY_TRAITS ( const unsigned  int,
const unsigned long  int 
)
CxxTest::CXXTEST_COPY_TRAITS ( const signed  int,
const signed long  int 
)
CxxTest::CXXTEST_COPY_TRAITS ( char *  ,
const char *const &   
)
CxxTest::CXXTEST_COPY_TRAITS ( const char *  ,
const char *const &   
)
template<class X , class Y , class D >
bool CxxTest::delta ( x,
y,
d 
) [inline]

Definition at line 160 of file TestSuite.h.

Referenced by Inkscape::UI::ControlPointSelection::_keyboardMove(), Inkscape::UI::ControlPointSelection::_pointDragged(), AlphaLigne::Affiche(), Path::AttemptSimplify(), compute_pderivs(), Path::ConvertPositionsToForced(), create_single_menu_item(), doAssertDelta(), Inkscape::UI::Node::dragged(), Inkscape::UI::CurveDragPoint::dragged(), eek_preview_set_size_mappings(), NR::Eigen::Eigen(), Geom::Eigen::Eigen(), find_bounds_for_lambda0(), find_group_at_point(), find_item_at_point(), Inkscape::UI::CurveDragPoint::grabbed(), PatternKnotHolderEntityScale::knot_get(), PatternKnotHolderEntityAngle::knot_get(), ArcKnotHolderEntityEnd::knot_set(), ArcKnotHolderEntityStart::knot_set(), PatternKnotHolderEntityAngle::knot_set(), Inkscape::UI::Node::move(), Inkscape::UI::Handle::move(), Inkscape::UI::PreviewHolder::on_size_allocate(), Inkscape::Debug::GdkEventLatencyTracker::process(), AlphaLigne::Raster(), Shape::ReFormeArcTo(), render_curveto(), Geom::NL::detail::lsf_solution< ModelT, Point >::result(), Geom::NL::detail::lsf_solution< ModelT, double >::result(), Geom::SVGEllipticalArc::roots(), Geom::EllipticalArc::roots(), SPDashSelector::set_dash(), Inkscape::UI::PathManipulator::setControlsTransform(), Inkscape::snap_rectangular_box(), sp_color_rgb_to_hsl_floatv(), sp_color_rgb_to_hsv_floatv(), sp_color_wheel_process_in_triangle(), sp_document_item_from_list_at_point_bottom(), sp_node_path_value_changed(), sp_spiral_drag(), sp_ui_drag_data_received(), spdc_endpoint_snap_rotation(), spdc_pen_set_ctrl(), and Inkscape::Trace::Potrace::PotraceTracingEngine::traceBrightnessMulti().

00161     {
00162         return ((y >= x - d) && (y <= x + d));
00163     }

template<class X , class Y >
bool CxxTest::differs ( x,
y 
) [inline]

Definition at line 71 of file TestSuite.h.

Referenced by doAssertDiffers().

00072     {
00073         return !(x == y);
00074     }

char CxxTest::digitToChar ( unsigned  digit  ) 

Referenced by numberToString().

void CxxTest::doAbortTest (  ) 
template<class X , class Y , class D >
void CxxTest::doAssertDelta ( const char *  file,
unsigned  line,
const char *  xExpr,
x,
const char *  yExpr,
y,
const char *  dExpr,
d,
const char *  message 
) [inline]

Definition at line 166 of file TestSuite.h.

References delta(), CxxTest::TestTracker::failedAssertDelta(), CxxTest::TestTracker::failedTest(), tracker(), TS_ABORT, and TS_AS_STRING.

00171     {
00172         if ( !delta( x, y, d ) ) {
00173             if ( message )
00174                 tracker().failedTest( file, line, message );
00175             
00176             tracker().failedAssertDelta( file, line, xExpr, yExpr, dExpr,
00177                                          TS_AS_STRING(x), TS_AS_STRING(y), TS_AS_STRING(d) );
00178             TS_ABORT();
00179         }
00180     }

template<class X , class Y >
void CxxTest::doAssertDiffers ( const char *  file,
unsigned  line,
const char *  xExpr,
x,
const char *  yExpr,
y,
const char *  message 
) [inline]

Definition at line 77 of file TestSuite.h.

References differs(), CxxTest::TestTracker::failedAssertDiffers(), CxxTest::TestTracker::failedTest(), tracker(), TS_ABORT, and TS_AS_STRING.

00081     {
00082         if ( !differs( x, y ) ) {
00083             if ( message )
00084                 tracker().failedTest( file, line, message );
00085             tracker().failedAssertDiffers( file, line, xExpr, yExpr, TS_AS_STRING(x) );
00086             TS_ABORT();
00087         }
00088     }

template<class X , class Y >
void CxxTest::doAssertEquals ( const char *  file,
unsigned  line,
const char *  xExpr,
x,
const char *  yExpr,
y,
const char *  message 
) [inline]

Definition at line 51 of file TestSuite.h.

References equals(), CxxTest::TestTracker::failedAssertEquals(), CxxTest::TestTracker::failedTest(), tracker(), TS_ABORT, and TS_AS_STRING.

00055     {
00056         if ( !equals( x, y ) ) {
00057             if ( message )
00058                 tracker().failedTest( file, line, message );
00059             tracker().failedAssertEquals( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) );
00060             TS_ABORT();
00061         }
00062     }

template<class X , class Y >
void CxxTest::doAssertLessThan ( const char *  file,
unsigned  line,
const char *  xExpr,
x,
const char *  yExpr,
y,
const char *  message 
) [inline]

Definition at line 97 of file TestSuite.h.

References CxxTest::TestTracker::failedAssertLessThan(), CxxTest::TestTracker::failedTest(), lessThan(), tracker(), TS_ABORT, and TS_AS_STRING.

00101     {
00102         if ( !lessThan(x, y) ) {
00103             if ( message )
00104                 tracker().failedTest( file, line, message );
00105             tracker().failedAssertLessThan( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) );
00106             TS_ABORT();
00107         }
00108     }

template<class X , class Y >
void CxxTest::doAssertLessThanEquals ( const char *  file,
unsigned  line,
const char *  xExpr,
x,
const char *  yExpr,
y,
const char *  message 
) [inline]

Definition at line 117 of file TestSuite.h.

References CxxTest::TestTracker::failedAssertLessThanEquals(), CxxTest::TestTracker::failedTest(), lessThanEquals(), tracker(), TS_ABORT, and TS_AS_STRING.

00121     {
00122         if ( !lessThanEquals( x, y ) ) {
00123             if ( message )
00124                 tracker().failedTest( file, line, message );
00125             tracker().failedAssertLessThanEquals( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) );
00126             TS_ABORT();
00127         }
00128     }

template<class X , class P >
void CxxTest::doAssertPredicate ( const char *  file,
unsigned  line,
const char *  pExpr,
const P &  p,
const char *  xExpr,
x,
const char *  message 
) [inline]

Definition at line 131 of file TestSuite.h.

References CxxTest::TestTracker::failedAssertPredicate(), CxxTest::TestTracker::failedTest(), uniconv-ext::p, tracker(), TS_ABORT, and TS_AS_STRING.

00135     {
00136         if ( !p( x ) ) {
00137             if ( message )
00138                 tracker().failedTest( file, line, message );
00139             tracker().failedAssertPredicate( file, line, pExpr, xExpr, TS_AS_STRING(x) );
00140             TS_ABORT();
00141         }
00142     }

template<class X , class Y , class R >
void CxxTest::doAssertRelation ( const char *  file,
unsigned  line,
const char *  rExpr,
const R &  r,
const char *  xExpr,
x,
const char *  yExpr,
y,
const char *  message 
) [inline]

Definition at line 145 of file TestSuite.h.

References CxxTest::TestTracker::failedAssertRelation(), CxxTest::TestTracker::failedTest(), polyhedron_3d::r, tracker(), TS_ABORT, and TS_AS_STRING.

00150     {
00151         if ( !r( x, y ) ) {
00152             if ( message )
00153                 tracker().failedTest( file, line, message );
00154             tracker().failedAssertRelation( file, line, rExpr, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) );
00155             TS_ABORT();
00156         }
00157     }

void CxxTest::doAssertSameData ( const char *  file,
unsigned  line,
const char *  xExpr,
const void *  x,
const char *  yExpr,
const void *  y,
const char *  sizeExpr,
unsigned  size,
const char *  message 
)
void CxxTest::doFailAssert ( const char *  file,
unsigned  line,
const char *  expression,
const char *  message 
)
void CxxTest::doFailAssertThrows ( const char *  file,
unsigned  line,
const char *  expr,
const char *  type,
bool  otherThrown,
const char *  message 
)
void CxxTest::doFailAssertThrowsNot ( const char *  file,
unsigned  line,
const char *  expression,
const char *  message 
)
void CxxTest::doFailTest ( const char *  file,
unsigned  line,
const char *  message 
)
void CxxTest::doTrace ( const char *  file,
unsigned  line,
const char *  message 
)
void CxxTest::doWarn ( const char *  file,
unsigned  line,
const char *  message 
)
template<class Stream , class Iterator >
void CxxTest::dumpRange ( Stream &  s,
Iterator  first,
Iterator  last 
) [inline]

Definition at line 92 of file StdValueTraits.h.

References TS_AS_STRING.

00093     {
00094         s << "{ ";
00095         while ( first != last ) {
00096             s << TS_AS_STRING(*first);
00097             ++ first;
00098             s << ((first == last) ? " }" : ", ");
00099         }
00100     }

template<class X , class Y >
bool CxxTest::equals ( x,
y 
) [inline]

Definition at line 45 of file TestSuite.h.

Referenced by doAssertEquals().

00046     {
00047         return (x == y);
00048     }

void CxxTest::initialize (  ) 
bool CxxTest::leaveOnly ( const char *  suiteName,
const char *  testName 
)
template<class X , class Y >
bool CxxTest::lessThan ( x,
y 
) [inline]

Definition at line 91 of file TestSuite.h.

Referenced by doAssertLessThan(), and Avoid::linesort().

00092     {
00093         return (x < y);
00094     }

template<class X , class Y >
bool CxxTest::lessThanEquals ( x,
y 
) [inline]

Definition at line 111 of file TestSuite.h.

Referenced by doAssertLessThanEquals().

00112     {
00113         return (x <= y);
00114     }

unsigned CxxTest::maxDumpSize (  ) 
template<class N >
bool CxxTest::negative ( N  n  )  [inline]

Definition at line 119 of file ValueTraits.h.

Referenced by abs(), org::w3c::dom::io::dprintDouble(), org::w3c::dom::xpath::XPathParser::getNumber(), and numberToString().

00119 { return n < 0; }

template<class N >
char* CxxTest::numberToString ( N  n,
char *  s,
N  base = 10,
unsigned  skipDigits = 0,
unsigned  maxDigits = (unsigned)-1 
) [inline]

Definition at line 143 of file ValueTraits.h.

References abs(), digitToChar(), N, and negative().

Referenced by CxxTest::ValueTraits< const double >::hugeNumber(), CxxTest::ValueTraits< const double >::normalNumber(), CxxTest::MultiPrinter::FileAdapter::operator<<(), CxxTest::ErrorPrinter::Adapter::operator<<(), and CxxTest::WorldDescription::strTotalTests().

00147     {
00148         if ( negative(n) ) {
00149             *s++ = '-';
00150             n = abs(n);
00151         }
00152     
00153         N digit = 1;
00154         while ( digit <= (n / base) )
00155             digit *= base;
00156         N digitValue;
00157         for ( ; digit >= 1 && skipDigits; n -= digit * digitValue, digit /= base, -- skipDigits )
00158             digitValue = (unsigned)(n / digit);
00159         for ( ; digit >= 1 && maxDigits; n -= digit * digitValue, digit /= base, -- maxDigits )
00160             *s++ = digitToChar( (unsigned)(digitValue = (unsigned)(n / digit)) );
00161 
00162         *s = '\0';
00163         return s;
00164     }

bool CxxTest::sameData ( const void *  x,
const void *  y,
unsigned  size 
)

Definition at line 81 of file TestSuite.cpp.

00082     {
00083         if ( size == 0 )
00084             return true;
00085         
00086         if ( x == y )
00087             return true;
00088 
00089         if ( !x || !y )
00090             return false;
00091 
00092         const char *cx = (const char *)x;
00093         const char *cy = (const char *)y;
00094         while ( size -- )
00095             if ( *cx++ != *cy++ )
00096                 return false;
00097 
00098         return true;
00099     }

void CxxTest::setAbortTestOnFail ( bool  value  ) 
void CxxTest::setMaxDumpSize ( unsigned  value  ) 
bool CxxTest::stringsEqual ( const char *  s1,
const char *  s2 
)
TestTracker& CxxTest::tracker (  )  [inline]

Definition at line 111 of file TestTracker.h.

References CxxTest::TestTracker::tracker().

Referenced by Inkscape::GC::Finalized::_invoke_dtor(), Inkscape::XML::SimpleNode::addChild(), Inkscape::XML::CompositeNodeObserver::addListener(), Inkscape::GC::Anchored::anchor(), Inkscape::XML::SimpleNode::changeOrder(), Inkscape::Debug::GdkEventLatencyTracker::default_tracker(), destroy_tracker(), doAssertDelta(), doAssertDiffers(), doAssertEquals(), doAssertLessThan(), doAssertLessThanEquals(), doAssertPredicate(), doAssertRelation(), Inkscape::UI::Widget::SelectedStyle::dragDataReceived(), ege_color_prof_tracker_get_property(), ege_color_prof_tracker_new(), ege_color_prof_tracker_set_property(), event_after_cb(), fire(), CxxTest::X11Gui::getTotalTests(), CxxTest::Win32Gui::getTotalTests(), CxxTest::QtGui::getTotalTests(), inkscape_crash_handler(), CxxTest::ErrorFormatter::leaveTest(), CxxTest::ErrorFormatter::leaveWorld(), lpetool_unit_changed(), paintbucket_offset_changed(), rect_tb_event_attr_changed(), Inkscape::GC::Anchored::release(), Inkscape::XML::SimpleNode::removeChild(), Inkscape::XML::CompositeNodeObserver::removeListenerByData(), CxxTest::ErrorFormatter::reportTest(), CxxTest::YesNoRunner::run(), CxxTest::MultiPrinter::run(), CxxTest::GuiTuiRunner< GuiT, TuiT >::run(), CxxTest::ErrorFormatter::run(), CxxTest::TestRunner::runAllTests(), CxxTest::TestRunner::runSuite(), CxxTest::TestRunner::runTest(), CxxTest::TestRunner::runWorld(), Inkscape::XML::SimpleNode::setAttribute(), Inkscape::XML::SimpleNode::setContent(), CxxTest::Win32Gui::setSummaryStatusBar(), CxxTest::QtGui::showSummary(), sp_action_perform(), sp_document_maybe_done(), sp_document_redo(), sp_document_undo(), sp_lpetool_toolbox_prep(), sp_node_path_value_changed(), sp_node_toolbox_coord_changed(), sp_node_toolbox_prep(), sp_object_layout_any_value_changed(), sp_object_ref(), sp_object_unref(), sp_paintbucket_toolbox_prep(), sp_rect_toolbox_prep(), sp_repr_begin_transaction(), sp_repr_commit(), sp_repr_commit_undoable(), sp_repr_replay_log(), sp_repr_rollback(), sp_repr_undo_log(), sp_rtb_value_changed(), sp_select_toolbox_prep(), sp_selection_layout_widget_update(), CxxTest::ErrorFormatter::totalTests(), and track_latency().

00111 { return TestTracker::tracker(); }

template<class T >
ValueTraits<T> CxxTest::traits ( t  )  [inline]

Definition at line 89 of file ValueTraits.h.

00090     {
00091         return ValueTraits<T>( t );
00092     }


Variable Documentation

bool CxxTest::currentAbortTestOnFail = false [static]

Definition at line 18 of file TestSuite.cpp.

unsigned CxxTest::currentMaxDumpSize = CXXTEST_MAX_DUMP_SIZE [static]

Definition at line 41 of file TestSuite.cpp.