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().

{ 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 ( CXXTEST_STD(basic_string< wchar_t >)   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( bool   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( signed long  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( unsigned long  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( signed  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( unsigned  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( signed short  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( CXXTEST_STD(string)   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( unsigned short  int  ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( char   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( double   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( float   ) 
CxxTest::CXXTEST_COPY_CONST_TRAITS ( Pet   ) 
CxxTest::CXXTEST_COPY_TRAITS ( const signed  char,
const   char 
)
CxxTest::CXXTEST_COPY_TRAITS ( char *  ,
const char *const &   
)
CxxTest::CXXTEST_COPY_TRAITS ( const char *  ,
const char *const &   
)
CxxTest::CXXTEST_COPY_TRAITS ( const signed  int,
const signed long  int 
)
CxxTest::CXXTEST_COPY_TRAITS ( const unsigned  int,
const unsigned long  int 
)
CxxTest::CXXTEST_COPY_TRAITS ( const signed short  int,
const signed long  int 
)
CxxTest::CXXTEST_COPY_TRAITS ( const unsigned short  int,
const unsigned long  int 
)
CxxTest::CXXTEST_COPY_TRAITS ( const   float,
const   double 
)
template<class X , class Y , class D >
bool CxxTest::delta ( x,
y,
d 
)

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(), 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_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().

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

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

Definition at line 71 of file TestSuite.h.

Referenced by doAssertDiffers().

    {
        return !(x == y);
    }

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 
)

Definition at line 166 of file TestSuite.h.

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

    {
        if ( !delta( x, y, d ) ) {
            if ( message )
                tracker().failedTest( file, line, message );
            
            tracker().failedAssertDelta( file, line, xExpr, yExpr, dExpr,
                                         TS_AS_STRING(x), TS_AS_STRING(y), TS_AS_STRING(d) );
            TS_ABORT();
        }
    }

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

Definition at line 77 of file TestSuite.h.

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

    {
        if ( !differs( x, y ) ) {
            if ( message )
                tracker().failedTest( file, line, message );
            tracker().failedAssertDiffers( file, line, xExpr, yExpr, TS_AS_STRING(x) );
            TS_ABORT();
        }
    }

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

Definition at line 51 of file TestSuite.h.

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

    {
        if ( !equals( x, y ) ) {
            if ( message )
                tracker().failedTest( file, line, message );
            tracker().failedAssertEquals( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) );
            TS_ABORT();
        }
    }

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

Definition at line 97 of file TestSuite.h.

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

    {
        if ( !lessThan(x, y) ) {
            if ( message )
                tracker().failedTest( file, line, message );
            tracker().failedAssertLessThan( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) );
            TS_ABORT();
        }
    }

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

Definition at line 117 of file TestSuite.h.

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

    {
        if ( !lessThanEquals( x, y ) ) {
            if ( message )
                tracker().failedTest( file, line, message );
            tracker().failedAssertLessThanEquals( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) );
            TS_ABORT();
        }
    }

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 
)

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.

    {
        if ( !p( x ) ) {
            if ( message )
                tracker().failedTest( file, line, message );
            tracker().failedAssertPredicate( file, line, pExpr, xExpr, TS_AS_STRING(x) );
            TS_ABORT();
        }
    }

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 
)

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.

    {
        if ( !r( x, y ) ) {
            if ( message )
                tracker().failedTest( file, line, message );
            tracker().failedAssertRelation( file, line, rExpr, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) );
            TS_ABORT();
        }
    }

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 
)

Definition at line 92 of file StdValueTraits.h.

References TS_AS_STRING.

    {
        s << "{ ";
        while ( first != last ) {
            s << TS_AS_STRING(*first);
            ++ first;
            s << ((first == last) ? " }" : ", ");
        }
    }

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

Definition at line 45 of file TestSuite.h.

Referenced by doAssertEquals().

    {
        return (x == y);
    }

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

Definition at line 91 of file TestSuite.h.

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

    {
        return (x < y);
    }

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

Definition at line 111 of file TestSuite.h.

Referenced by doAssertLessThanEquals().

    {
        return (x <= y);
    }

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

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().

    {
        if ( negative(n) ) {
            *s++ = '-';
            n = abs(n);
        }
    
        N digit = 1;
        while ( digit <= (n / base) )
            digit *= base;
        N digitValue;
        for ( ; digit >= 1 && skipDigits; n -= digit * digitValue, digit /= base, -- skipDigits )
            digitValue = (unsigned)(n / digit);
        for ( ; digit >= 1 && maxDigits; n -= digit * digitValue, digit /= base, -- maxDigits )
            *s++ = digitToChar( (unsigned)(digitValue = (unsigned)(n / digit)) );

        *s = '\0';
        return s;
    }

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

Definition at line 81 of file TestSuite.cpp.

    {
        if ( size == 0 )
            return true;
        
        if ( x == y )
            return true;

        if ( !x || !y )
            return false;

        const char *cx = (const char *)x;
        const char *cy = (const char *)y;
        while ( size -- )
            if ( *cx++ != *cy++ )
                return false;

        return true;
    }

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(), 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(), 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(), sp_text_toolbox_prep(), CxxTest::ErrorFormatter::totalTests(), and track_latency().

{ return TestTracker::tracker(); }

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

Definition at line 89 of file ValueTraits.h.

    {
        return ValueTraits<T>( t );
    }


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.