| 32 | #include "CppUTest/SimpleString.h" |
| 33 | |
| 34 | class FileForJUnitOutputTests |
| 35 | { |
| 36 | SimpleString name_; |
| 37 | bool isOpen_; |
| 38 | SimpleString buffer_; |
| 39 | FileForJUnitOutputTests* next_; |
| 40 | |
| 41 | SimpleStringCollection linesOfFile_; |
| 42 | |
| 43 | public: |
| 44 | |
| 45 | FileForJUnitOutputTests(const SimpleString& filename, FileForJUnitOutputTests* next) : |
| 46 | name_(filename), isOpen_(true), next_(next) {} |
| 47 | |
| 48 | FileForJUnitOutputTests* nextFile() |
| 49 | { |
| 50 | return next_; |
| 51 | } |
| 52 | |
| 53 | SimpleString name() |
| 54 | { |
| 55 | return name_; |
| 56 | } |
| 57 | |
| 58 | void write(const SimpleString& buffer) |
| 59 | { |
| 60 | buffer_ += buffer; |
| 61 | } |
| 62 | |
| 63 | void close() |
| 64 | { |
| 65 | isOpen_ = false; |
| 66 | } |
| 67 | |
| 68 | const char* line(size_t lineNumber) |
| 69 | { |
| 70 | buffer_.split("\n", linesOfFile_); |
| 71 | return linesOfFile_[lineNumber-1].asCharString(); |
| 72 | |
| 73 | } |
| 74 | |
| 75 | const char* lineFromTheBack(size_t lineNumberFromTheBack) |
| 76 | { |
| 77 | return line(amountOfLines() - (lineNumberFromTheBack - 1)); |
| 78 | } |
| 79 | |
| 80 | size_t amountOfLines() |
| 81 | { |
| 82 | buffer_.split("\n", linesOfFile_); |
| 83 | return linesOfFile_.size(); |
| 84 | } |
| 85 | |
| 86 | SimpleString content() |
| 87 | { |
| 88 | return buffer_; |
| 89 | } |
| 90 | }; |
| 91 |
nothing calls this directly
no outgoing calls
no test coverage detected