OTest2
A C++ testing framework
assertbean.cpp
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 #include <assertbean.h>
21 
22 #include <algorithm>
23 
24 namespace OTest2 {
25 
27  condition(false),
28  message() {
29 
30 }
31 
33  bool condition_,
34  const std::string& message_) :
35  condition(condition_),
36  message(message_) {
37 
38 }
39 
41  const AssertBean& src_) = default;
42 
43 AssertBean::~AssertBean() = default;
44 
46  AssertBean& b2_) noexcept {
47  std::swap(condition, b2_.condition);
48  message.swap(b2_.message);
49 }
50 
52  const AssertBean& src_) = default;
53 
55  return condition;
56 }
57 
58 const std::string& AssertBean::getMessage() const {
59  return message;
60 }
61 
62 } /* namespace OTest2 */
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
assertbean.h