CompilerOutputter

   
CompilerOutputter

Description

The class CompilerOutputter (see Figure C-3) is a subclass of Outputter . It outputs test results in the format that the Microsoft Visual C++ (VC++) IDE uses for compiler errors, enabling the IDE to locate test assertions in the code.

CompilerOutputter belongs to the namespace CppUnit . It is declared in CompilerOutputter.h and implemented in CompilerOutputter.cpp .

Figure C-3. The class CompilerOutputter
figs/utf_ac03.gif

Declaration

 class CompilerOutputter : public Outputter 

Constructors/Destructors


CompilerOutputter(TestResultCollector *result, ostream & stream)

Creates a CompilerOutputter to get test results from result and outputs them to stream .


virtual ~CompilerOutputter( )

A destructor.

Public Methods


static CompilerOutputter *defaultOutputter( TestResultCollector *result, ostream& stream)

A static method that returns a new CompilerOutputter .


virtual void printDefaultMessage(Exception *thrownException)

virtual void printFailedTestName(TestFailure *failure)

virtual void printFailureDetail(TestFailure *failure)

virtual void printFailureLocation(SourceLine sourceLine)

virtual void printFailureMessage(TestFailure *failure)

virtual void printFailureReport( )

virtual void printFailuresList( )

virtual void printFailureType(TestFailure *failure)

virtual void printNotEqualMessage(Exception *thrownException)

virtual void printStatistics( )

virtual void printSucess( )

Methods that write test results from m_result to m_stream . Called by write( ) .


virtual string wrap(string message)

Returns message with carriage returns inserted to fit 80-column output width.


void write( )

A method called to output results. Depending on test success or failure, calls printSucess( ) or printFailureReport( ) , which in turn call the other print methods just described.

Protected/Private Methods


static Lines splitMessageIntoLines(string message)

Breaks message into Lines ( private ).


CompilerOutputter(const CompilerOutputter& copy)

A copy constructor, which is scoped private to prevent its use.


void operator=(const CompilerOutputter& copy)

A copy operator, which is scoped private to prevent its use.

Attributes


typedef vector<string> Lines

Defines the type Lines as a vector of string ( private ).


TestResultCollector *m_result

The TestResultCollector passed in the constructor ( private )


ostream& m_stream

The output stream passed in the constructor ( private ).



Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net