OTest2
A C++ testing framework
regressions.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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_REGRESSIONS_H_
21 #define OTest2__INCLUDE_OTEST2_REGRESSIONS_H_
22 
23 #include <string>
24 
25 #include <otest2/assertcontext.h>
27 #include <otest2/testmarkptr.h>
28 
29 namespace OTest2 {
30 
35  private:
36  bool compareObjectMark(
37  const std::string& key_,
38  TestMarkPtr test_mark_,
39  bool print_);
40  bool storeObjectMark(
41  const std::string& key_,
42  TestMarkPtr test_mark_);
43 
44  public:
45  /* -- avoid copying */
47  const RegressionAssertion&) = delete;
49  const RegressionAssertion&) = delete;
50 
51  /* -- inherit the constructor */
53 
54  template<typename Object_>
55  bool testRegression(
56  const std::string& key_,
57  const Object_& object_);
58  template<typename Object_>
59  bool testRegressionP(
60  const std::string& key_,
61  const Object_& object_);
62  template<typename Object_>
63  bool testRegressionW(
64  const std::string& key_,
65  const Object_& object_);
66 };
67 
68 namespace Assertions {
69 
81 template<typename Object_>
82 bool testRegression(
83  const std::string& key_,
84  const Object_& object_) TEST_ASSERTION_MARK_TMPL("::OTest2::RegressionAssertion", "testRegression< $1 >");
85 
97 template<typename Object_>
98 bool testRegressionP(
99  const std::string& key_,
100  const Object_& object_) TEST_ASSERTION_MARK_TMPL("::OTest2::RegressionAssertion", "testRegressionP< $1 >");
101 
111 template<typename Object_>
112 bool testRegressionW(
113  const std::string& key_,
114  const Object_& object_)TEST_ASSERTION_MARK_TMPL("::OTest2::RegressionAssertion", "testRegressionW< $1 >");
115 
116 } /* -- namespace Assertions */
117 
118 } /* -- namespace OTest2 */
119 
120 #endif /* -- OTest2__INCLUDE_OTEST2_REGRESSIONS_H_ */
OTest2::AssertContext::AssertContext
AssertContext(const AssertContext &)=delete
testmarkptr.h
OTest2::RegressionAssertion::RegressionAssertion
RegressionAssertion(const RegressionAssertion &)=delete
assertcontext.h
OTest2::AssertContext
Assertion context.
Definition: assertcontext.h:37
TEST_ASSERTION_MARK_TMPL
#define TEST_ASSERTION_MARK_TMPL(class_, method_)
Definition: assertionannotation.h:26
OTest2::TestMarkPtr
std::shared_ptr< TestMark > TestMarkPtr
Definition: testmarkptr.h:26
OTest2::RegressionAssertion::testRegressionP
bool testRegressionP(const std::string &key_, const Object_ &object_)
Definition: regressionsimpl.h:59
OTest2
Definition: assertbean.h:25
OTest2::RegressionAssertion::operator=
RegressionAssertion & operator=(const RegressionAssertion &)=delete
OTest2::RegressionAssertion::testRegression
bool testRegression(const std::string &key_, const Object_ &object_)
Definition: regressionsimpl.h:47
OTest2::RegressionAssertion
Implementation class of the regression assertions.
Definition: regressions.h:34
assertionannotation.h
OTest2::RegressionAssertion::testRegressionW
bool testRegressionW(const std::string &key_, const Object_ &object_)
Definition: regressionsimpl.h:71