OTest2
A C++ testing framework
regressionsimpl.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_REGRESSIONSIMPL_H_
21 #define OTest2__INCLUDE_OTEST2_REGRESSIONSIMPL_H_
22 
23 #include <otest2/regressions.h>
24 
25 #include <otest2/testmarkbuilder.h>
26 
27 namespace OTest2 {
28 
35 template<typename Object_>
37  static void generateTestMark(
38  TestMarkBuilder& builder_,
39  const Object_& object_) {
40  object_.test_testMark(builder_);
41  }
42 };
43 
44 
45 
46 template<typename Object_>
48  const std::string& key_,
49  const Object_& object_) {
50  /* -- create the mark */
51  TestMarkBuilder builder_;
53 
54  /* -- compare the mark */
55  return compareObjectMark(key_, builder_.stealMark(), false);
56 }
57 
58 template<typename Object_>
60  const std::string& key_,
61  const Object_& object_) {
62  /* -- create the mark */
63  TestMarkBuilder builder_;
65 
66  /* -- compare the mark */
67  return compareObjectMark(key_, builder_.stealMark(), true);
68 }
69 
70 template<typename Object_>
72  const std::string& key_,
73  const Object_& object_) {
74  /* -- create the mark */
75  TestMarkBuilder builder_;
77 
78  return storeObjectMark(key_, builder_.stealMark());
79 }
80 
81 } /* -- namespace OTest2 */
82 
83 #endif /* -- OTest2__INCLUDE_OTEST2_REGRESSIONSIMPL_H_ */
OTest2::RegressionTrait::generateTestMark
static void generateTestMark(TestMarkBuilder &builder_, const Object_ &object_)
Definition: regressionsimpl.h:37
testmarkbuilder.h
regressions.h
OTest2::TestMarkBuilder::stealMark
TestMarkPtr stealMark() const
Get constructed testmark and reset the builder.
Definition: testmarkbuilder.cpp:187
OTest2::RegressionAssertion::testRegressionP
bool testRegressionP(const std::string &key_, const Object_ &object_)
Definition: regressionsimpl.h:59
OTest2
Definition: assertbean.h:25
OTest2::RegressionTrait
Generic regression trait.
Definition: regressionsimpl.h:36
OTest2::RegressionAssertion::testRegression
bool testRegression(const std::string &key_, const Object_ &object_)
Definition: regressionsimpl.h:47
OTest2::TestMarkBuilder
Builder of test marks.
Definition: testmarkbuilder.h:37
OTest2::RegressionAssertion::testRegressionW
bool testRegressionW(const std::string &key_, const Object_ &object_)
Definition: regressionsimpl.h:71