MCPcopy Create free account
hub / github.com/Singular/Singular / ErrorFormatter

Class ErrorFormatter

libpolys/tests/cxxtest/ErrorFormatter.h:33–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 };
32
33 class ErrorFormatter : public TestListener
34 {
35 public:
36 ErrorFormatter( OutputStream *o, const char *preLine = ":", const char *postLine = "" ) :
37 _dotting( true ),
38 _reported( false ),
39 _o(o),
40 _preLine(preLine),
41 _postLine(postLine)
42 {
43 }
44
45 int run()
46 {
47 TestRunner::runAllTests( *this );
48 return tracker().failedTests();
49 }
50
51 void enterWorld( const WorldDescription & /*desc*/ )
52 {
53 (*_o) << "Running " << totalTests;
54 _o->flush();
55 _dotting = true;
56 _reported = false;
57 }
58
59 static void totalTests( OutputStream &o )
60 {
61 char s[WorldDescription::MAX_STRLEN_TOTAL_TESTS];
62 const WorldDescription &wd = tracker().world();
63 o << wd.strTotalTests( s ) << (wd.numTotalTests() == 1 ? " test" : " tests");
64 }
65
66 void enterSuite( const SuiteDescription & )
67 {
68 _reported = false;
69 }
70
71 void enterTest( const TestDescription & )
72 {
73 _reported = false;
74 }
75
76 void leaveTest( const TestDescription & )
77 {
78 if ( !tracker().testFailed() ) {
79 ((*_o) << ".").flush();
80 _dotting = true;
81 }
82 }
83
84 void leaveWorld( const WorldDescription &desc )
85 {
86 if ( !tracker().failedTests() ) {
87 (*_o) << "OK!" << endl;
88 return;
89 }
90 newLine();

Callers 1

ErrorPrinterClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected