OTest2
A C++ testing framework
assertbean.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_ASSERTBEAN_H_
21 #define OTest2__INCLUDE_OTEST2_ASSERTBEAN_H_
22 
23 #include <string>
24 
25 namespace OTest2 {
26 
31 class AssertBean {
32  private:
33  bool condition;
34  std::string message;
35 
36  public:
40  AssertBean();
41 
48  explicit AssertBean(
49  bool condition_,
50  const std::string& message_);
51 
55  AssertBean(
56  const AssertBean& src_);
57 
61  ~AssertBean();
62 
66  void swap(
67  AssertBean& b2_) noexcept;
68 
73  const AssertBean& src_);
74 
78  bool getCondition() const;
79 
83  const std::string& getMessage() const;
84 };
85 
86 } /* namespace OTest2 */
87 
88 #endif /* OTest2__INCLUDE_OTEST2_ASSERTBEAN_H_ */
OTest2::AssertBean::getCondition
bool getCondition() const
Get assertion condition.
Definition: assertbean.cpp:54
OTest2::AssertBean::~AssertBean
~AssertBean()
Dtor.
OTest2::AssertBean::AssertBean
AssertBean()
Default ctor - false condition, empty message.
Definition: assertbean.cpp:26
OTest2::AssertBean::operator=
AssertBean & operator=(const AssertBean &src_)
Copy operator.
OTest2::AssertBean
A helper class packing assertion condition and an assertion message together.
Definition: assertbean.h:31
OTest2::AssertBean::getMessage
const std::string & getMessage() const
Get assertion message.
Definition: assertbean.cpp:58
OTest2
Definition: assertbean.h:25
OTest2::AssertBean::swap
void swap(AssertBean &b2_) noexcept
Swap contents.
Definition: assertbean.cpp:45