-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: inject mockable RawIOManipulator in TestCaseDriver
- Loading branch information
Showing
8 changed files
with
88 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include <ostream> | ||
#include <string> | ||
|
||
using std::endl; | ||
using std::ostream; | ||
using std::string; | ||
|
||
namespace tcframe { | ||
|
||
class RawIOManipulator { | ||
public: | ||
virtual ~RawIOManipulator() {} | ||
|
||
virtual void print(ostream* out, const string& data) { | ||
*out << data; | ||
} | ||
|
||
virtual void printLine(ostream* out, const string& data) { | ||
*out << data << endl; | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
#include "gmock/gmock.h" | ||
|
||
#include "tcframe/driver/RawIOManipulator.hpp" | ||
|
||
namespace tcframe { | ||
|
||
class MockRawIOManipulator : public RawIOManipulator { | ||
public: | ||
MOCK_METHOD2(print, void(ostream*, const string&)); | ||
MOCK_METHOD2(printLine, void(ostream*, const string&)); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters