OTest2
A C++ testing framework
dfltenvironment.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_DFLTENVIRONMENT_H_
21 #define OTest2__INCLUDE_OTEST2_DFLTENVIRONMENT_H_
22 
23 #include <string>
24 
25 namespace OTest2 {
26 
27 class ExcCatcher;
28 class Reporter;
29 class Runner;
30 class UserData;
31 
36  private:
37  struct Impl;
38  Impl* pimpl;
39 
40  public:
41  /* -- avoid copying */
43  const DfltEnvironment&) = delete;
45  const DfltEnvironment&) = delete;
46 
52  explicit DfltEnvironment(
53  const std::string& testname_);
54 
62  int argc_,
63  char* argv_[]);
64 
69 
76  void addReporter(
77  Reporter* reporter_);
78 
86  ExcCatcher* catcher_);
87 
91  UserData& getUserData() noexcept;
92 
96  Runner& getRunner();
97 };
98 
99 } /* namespace OTest2 */
100 
101 #endif /* OTest2__INCLUDE_OTEST2_DFLTENVIRONMENT_H_ */
OTest2::DfltEnvironment::addReporter
void addReporter(Reporter *reporter_)
Append a test reporter.
Definition: dfltenvironment.cpp:208
OTest2::DfltEnvironment::getRunner
Runner & getRunner()
Get constructed runner.
Definition: dfltenvironment.cpp:227
OTest2::Reporter
Generic test reporter.
Definition: reporter.h:34
OTest2::DfltEnvironment::~DfltEnvironment
~DfltEnvironment()
Dtor.
Definition: dfltenvironment.cpp:204
OTest2::DfltEnvironment::setExceptionCatcher
void setExceptionCatcher(ExcCatcher *catcher_)
Set exception catcher.
Definition: dfltenvironment.cpp:216
OTest2::UserData
An object keeping user data passed from user's custom main function.
Definition: userdata.h:120
OTest2::DfltEnvironment::DfltEnvironment
DfltEnvironment(const DfltEnvironment &)=delete
OTest2::DfltEnvironment::getUserData
UserData & getUserData() noexcept
Access the container of user data.
Definition: dfltenvironment.cpp:223
OTest2::Runner
Generic test runner.
Definition: runner.h:112
OTest2
Definition: assertbean.h:25
OTest2::ExcCatcher
Generic exception catcher interface.
Definition: exccatcher.h:39
OTest2::DfltEnvironment
Default test environment.
Definition: dfltenvironment.h:35
OTest2::DfltEnvironment::operator=
DfltEnvironment & operator=(const DfltEnvironment &)=delete