OTest2
A C++ testing framework
|
Go to the documentation of this file.
33 std::initializer_list<const char*> parameters_) :
34 std::ostream(buffer_.get()),
38 parameters(parameters_) {
39 assert(buffer !=
nullptr);
45 context(other_.context),
46 buffer(std::move(other_.buffer)),
47 result(other_.result),
48 parameters(other_.parameters) {
49 other_.buffer =
nullptr;
54 buffer->commitAssertion(*context);
59 assert(buffer !=
nullptr);
60 buffer->setForeground(color_);
65 assert(buffer !=
nullptr);
66 buffer->setBackground(color_);
71 assert(buffer !=
nullptr);
72 buffer->setTextStyle(style_);
76 assert(buffer !=
nullptr);
77 buffer->resetAttributes();
82 assert(index_ >= 0 && index_ < parameters.size());
83 auto iter_(parameters.begin());
84 std::advance(iter_, index_);
89 assert(buffer !=
nullptr);
90 buffer->commitMessage(*context);
110 template<
int N_,
int... Seq_>
115 template<
int... Seq_>
120 template<
typename... Values_,
int... indexes_>
125 const std::tuple<Values_...>& args_) {
126 (stream_->*fce_)(std::get<indexes_>(args_)...);
129 template<
typename... Values_>
138 template<
typename... Values_>
140 std::ostream& os_)
const {
142 assert(stream_ !=
nullptr);
144 typename GenSequence<
sizeof...(Values_)>::SeqType(), stream_, fce, args);
156 template<
typename... Values_>
166 const Private::Manipulator<Color>&);
169 const Private::Manipulator<Style>&);
172 const Private::Manipulator<int>&);
175 const Private::Manipulator<>&);
Private::Manipulator resetAttrs()
Reset color and style attributes - manipulator.
void printParameter(int index_)
Print assertion parameter at the zero based index_.
Private::Manipulator< Style > textStyle(Style style_)
Text style manipulator.
void resetAttributes()
Reset the color and style attributes.
Style
Style of shown text.
Private::Manipulator< int > assertPar(int index_)
Print assertion parameter.
Compile-time generator of the sequence of integers.
virtual ~AssertStream()
Dtor.
bool getResult()
Return the assertion result.
Private::Manipulator commitMsg()
Commit current assertion message.
void setTextStyle(Style style_)
Set text style.
AssertStream(const AssertStream &)=delete
void setForeground(Color color_)
Set foreground color.
Color
List of colors supported by the reporters.
void invokeFunction(NumSequence< indexes_... >, AssertStream *stream_, void(AssertStream::*fce_)(Values_...), const std::tuple< Values_... > &args_)
void commitMessage()
Commit the assertion message.
void setBackground(Color color_)
Set background color.
NumSequence< Seq_... > SeqType
std::ostream & operator<<(std::ostream &os_, const Private::Manipulator< Values_... > &manip_)
Application of manipulators.
Compile-time sequence of integers.
std::shared_ptr< AssertBuffer > AssertBufferPtr
Manipulator(void(AssertStream::*fce_)(Values_...), Values_... args_)
Private::Manipulator< Color > background(Color color_)
Background color manipulator.
std::ostream & doTheJob(std::ostream &os_) const
Private::Manipulator< Color > foreground(Color color_)
Foreground color manipulator.