CppUnit - The Unit Testing Library

CppUnit project page | FAQ

CompilerOutputter.h
Go to the documentation of this file.
1#ifndef CPPUNIT_COMPILERTESTRESULTOUTPUTTER_H
2#define CPPUNIT_COMPILERTESTRESULTOUTPUTTER_H
3
4#include <cppunit/Portability.h>
5#include <cppunit/Outputter.h>
6#include <cppunit/portability/Stream.h>
7
8 CPPUNIT_NS_BEGIN
9
10
11class Exception;
12class SourceLine;
13class Test;
14class TestFailure;
15class TestResultCollector;
16
55 class CPPUNIT_API CompilerOutputter : public Outputter
56{
57public:
66 CompilerOutputter( TestResultCollector *result,
67 OStream &stream,
68 const std::string &locationFormat = CPPUNIT_COMPILER_LOCATION_FORMAT );
69
71 virtual ~CompilerOutputter();
72
96 void setLocationFormat( const std::string &locationFormat );
97
102 static CompilerOutputter *defaultOutputter( TestResultCollector *result,
103 OStream &stream );
104
105 void write();
106
107 void setNoWrap();
108
109 void setWrapColumn( int wrapColumn );
110
111 int wrapColumn() const;
112
113 virtual void printSuccess();
114 virtual void printFailureReport();
115 virtual void printFailuresList();
116 virtual void printStatistics();
117 virtual void printFailureDetail( TestFailure *failure );
118 virtual void printFailureLocation( SourceLine sourceLine );
119 virtual void printFailureType( TestFailure *failure );
120 virtual void printFailedTestName( TestFailure *failure );
121 virtual void printFailureMessage( TestFailure *failure );
122
123private:
125 CompilerOutputter( const CompilerOutputter &copy );
126
128 void operator =( const CompilerOutputter &copy );
129
130 virtual bool processLocationFormatCommand( char command,
131 const SourceLine &sourceLine );
132
133 virtual std::string extractBaseName( const std::string &fileName ) const;
134
135private:
136 TestResultCollector *m_result;
137 OStream &m_stream;
138 std::string m_locationFormat;
139 int m_wrapColumn;
140};
141
142
143 CPPUNIT_NS_END
144
145
146#endif // CPPUNIT_COMPILERTESTRESULTOUTPUTTER_H
CPPUNIT_API
#define CPPUNIT_API
Definition CppUnitApi.h:27
Outputter.h
Portability.h
CPPUNIT_COMPILER_LOCATION_FORMAT
#define CPPUNIT_COMPILER_LOCATION_FORMAT
Definition Portability.h:72
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition Portability.h:106
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition Portability.h:105
Stream.h
OStream
CPPUNIT_NS_BEGIN typedef std::ostream OStream
Definition Stream.h:330
CompilerOutputter::m_stream
OStream & m_stream
Definition CompilerOutputter.h:137
CompilerOutputter::m_result
TestResultCollector * m_result
Definition CompilerOutputter.h:136
CompilerOutputter::setLocationFormat
void setLocationFormat(const std::string &locationFormat)
Sets the error location format.
Definition CompilerOutputter.cpp:31
CompilerOutputter::printFailuresList
virtual void printFailuresList()
Definition CompilerOutputter.cpp:71
CompilerOutputter::wrapColumn
int wrapColumn() const
Definition CompilerOutputter.cpp:210
CompilerOutputter::extractBaseName
virtual std::string extractBaseName(const std::string &fileName) const
Definition CompilerOutputter.cpp:140
CompilerOutputter::CompilerOutputter
CompilerOutputter(const CompilerOutputter &copy)
Prevents the use of the copy constructor.
CompilerOutputter::printFailureDetail
virtual void printFailureDetail(TestFailure *failure)
Definition CompilerOutputter.cpp:81
CompilerOutputter::processLocationFormatCommand
virtual bool processLocationFormatCommand(char command, const SourceLine &sourceLine)
Definition CompilerOutputter.cpp:119
CompilerOutputter::printFailedTestName
virtual void printFailedTestName(TestFailure *failure)
Definition CompilerOutputter.cpp:162
CompilerOutputter::printSuccess
virtual void printSuccess()
Definition CompilerOutputter.cpp:56
CompilerOutputter::printFailureReport
virtual void printFailureReport()
Definition CompilerOutputter.cpp:63
CompilerOutputter::printFailureLocation
virtual void printFailureLocation(SourceLine sourceLine)
Definition CompilerOutputter.cpp:91
CompilerOutputter::printFailureType
virtual void printFailureType(TestFailure *failure)
Definition CompilerOutputter.cpp:155
CompilerOutputter::m_wrapColumn
int m_wrapColumn
Definition CompilerOutputter.h:139
CompilerOutputter::setNoWrap
void setNoWrap()
Definition CompilerOutputter.cpp:203
CompilerOutputter::defaultOutputter
static CompilerOutputter * defaultOutputter(TestResultCollector *result, OStream &stream)
Creates an instance of an outputter that matches your current compiler.
Definition CompilerOutputter.cpp:38
CompilerOutputter::setWrapColumn
void setWrapColumn(int wrapColumn)
Definition CompilerOutputter.cpp:196
CompilerOutputter::m_locationFormat
std::string m_locationFormat
Definition CompilerOutputter.h:138
CompilerOutputter::printFailureMessage
virtual void printFailureMessage(TestFailure *failure)
Definition CompilerOutputter.cpp:169
CompilerOutputter::printStatistics
virtual void printStatistics()
Definition CompilerOutputter.cpp:184
CompilerOutputter::CompilerOutputter
CompilerOutputter(TestResultCollector *result, OStream &stream, const std::string &locationFormat=CPPUNIT_COMPILER_LOCATION_FORMAT)
Constructs a CompilerOutputter object.
Definition CompilerOutputter.cpp:14
Exception
Exceptions thrown by failed assertions.
Definition Exception.h:20
Outputter
Abstract outputter to print test result summary.
Definition Outputter.h:14
Outputter::write
virtual void write()=0
SourceLine
Represents a source line location.
Definition SourceLine.h:31
TestFailure
Record of a failed Test execution.
Definition TestFailure.h:25
Test
Base class for all test objects.
Definition Test.h:26
TestResultCollector
Collects test result.
Definition TestResultCollector.h:32

| Send comments to: CppUnit Developers