forked from ivogeorg/ucd-csci2312-pa4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ErrorContext.h
47 lines (34 loc) · 1.27 KB
/
ErrorContext.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// Created by Ivo Georgiev on 11/22/15.
//
#ifndef PA5GAME_ERRORCONTEXT_H
#define PA5GAME_ERRORCONTEXT_H
/**
* Acknowledgement: Donnie Pinkston, CALTECH
*/
#include <iostream>
#include <set>
#include <sstream>
namespace Testing {
using std::set;
using std::ostream;
using std::string;
class ErrorContext // displays test results
{
public:
ErrorContext(ostream &os); // write header to stream
void desc(const char *msg, int line); // write line/description
void desc(string msg, int line);
void result(bool good); // write test result
~ErrorContext(); // write summary info
bool ok() const; // true iff all tests passed
private:
ostream &os; // output stream to use
int passed; // # of tests which passed
int total; // total # of tests
int lastline; // line # of most recent test
set<int> badlines; // line #'s of failed tests
bool skip; // skip a line before title?
};
}
#endif //PA5GAME_ERRORCONTEXT_H