OTest2
A C++ testing framework
reporter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Ondrej Starek
3  *
4  * This file is part of OTest2.
5  *
6  * OTest2 is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License,
9  * or (at your option) any later version.
10  *
11  * OTest2 is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with OTest2. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OTest2__INCLUDE_OTEST2_REPORTER_H_
21 #define OTest2__INCLUDE_OTEST2_REPORTER_H_
22 
23 #include <otest2/assertbufferptr.h>
24 #include <string>
25 
26 namespace OTest2 {
27 
28 class Context;
29 class Parameters;
30 
34 class Reporter {
35  public:
36  /* -- avoid copying */
37  Reporter(
38  const Reporter&) = delete;
40  const Reporter&) = delete;
41 
45  Reporter();
46 
50  virtual ~Reporter();
51 
59  virtual void enterTest(
60  const Context& context_,
61  const std::string& name_,
62  const Parameters& params_) = 0;
63 
71  virtual void enterSuite(
72  const Context& context_,
73  const std::string& name_,
74  const Parameters& params_) = 0;
75 
83  virtual void enterCase(
84  const Context& context_,
85  const std::string& name_,
86  const Parameters& params_) = 0;
87 
94  virtual void enterState(
95  const Context& context_,
96  const std::string& name_) = 0;
97 
115  const Context& context_,
116  bool condition_,
117  const std::string& file_,
118  int lineno_) = 0;
119 
139  virtual AssertBufferPtr enterError(
140  const Context& context_) = 0;
141 
149  virtual void leaveState(
150  const Context& context_,
151  const std::string& name_,
152  bool result_) = 0;
153 
162  virtual void leaveCase(
163  const Context& context_,
164  const std::string& name_,
165  const Parameters& params_,
166  bool result_) = 0;
167 
176  virtual void leaveSuite(
177  const Context& context_,
178  const std::string& name_,
179  const Parameters& params_,
180  bool result_) = 0;
181 
190  virtual void leaveTest(
191  const Context& context_,
192  const std::string& name_,
193  const Parameters& params_,
194  bool result_) = 0;
195 };
196 
197 } /* namespace OTest2 */
198 
199 #endif /* OTest2__INCLUDE_OTEST2_REPORTER_H_ */
OTest2::Reporter::leaveTest
virtual void leaveTest(const Context &context_, const std::string &name_, const Parameters &params_, bool result_)=0
Leave entire test.
OTest2::Reporter::operator=
Reporter & operator=(const Reporter &)=delete
OTest2::Reporter::leaveSuite
virtual void leaveSuite(const Context &context_, const std::string &name_, const Parameters &params_, bool result_)=0
Leave a suite.
OTest2::Reporter
Generic test reporter.
Definition: reporter.h:34
OTest2::Reporter::enterError
virtual AssertBufferPtr enterError(const Context &context_)=0
Enter an error report.
OTest2::Reporter::enterState
virtual void enterState(const Context &context_, const std::string &name_)=0
Enter a state.
OTest2::Reporter::enterTest
virtual void enterTest(const Context &context_, const std::string &name_, const Parameters &params_)=0
Enter entire test.
OTest2::Reporter::enterCase
virtual void enterCase(const Context &context_, const std::string &name_, const Parameters &params_)=0
Enter a case.
OTest2::Parameters
Generic parameters of a run of an testing object.
Definition: parameters.h:30
OTest2
Definition: assertbean.h:25
OTest2::Reporter::enterSuite
virtual void enterSuite(const Context &context_, const std::string &name_, const Parameters &params_)=0
Enter a suite.
OTest2::Reporter::enterAssert
virtual AssertBufferPtr enterAssert(const Context &context_, bool condition_, const std::string &file_, int lineno_)=0
Enter an assertion.
OTest2::Reporter::leaveState
virtual void leaveState(const Context &context_, const std::string &name_, bool result_)=0
Leave a state.
OTest2::Reporter::~Reporter
virtual ~Reporter()
Dtor.
OTest2::Reporter::Reporter
Reporter()
Ctor.
OTest2::Context
OTest2 runtime context.
Definition: context.h:38
assertbufferptr.h
OTest2::Reporter::leaveCase
virtual void leaveCase(const Context &context_, const std::string &name_, const Parameters &params_, bool result_)=0
Leave a case.
OTest2::AssertBufferPtr
std::shared_ptr< AssertBuffer > AssertBufferPtr
Definition: assertbufferptr.h:27