OTest2
A C++ testing framework
testmarklist.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 #ifndef OTest2__INCLUDE_OTEST2_TESTMARKLIST_H_
20 #define OTest2__INCLUDE_OTEST2_TESTMARKLIST_H_
21 
22 #include <vector>
23 
24 #include <otest2/testmarkprefix.h>
25 #include <otest2/testmarkptr.h>
26 
27 namespace OTest2 {
28 
29 struct CtorMark;
30 
34 class TestMarkList : public TestMarkPrefix {
35  private:
36  typedef std::vector<TestMarkPtr> List;
37  List list;
38 
39  /* -- prefixed test mark interface */
40  virtual bool doIsEqualPrefixed(
41  const TestMark& other_,
42  long double precision_) const;
43  virtual void doDiffArray(
44  int level_,
45  std::vector<LinearizedRecord>& array_) const;
46  virtual void doLinearizedMark(
47  int level_,
48  const std::string& label_,
49  std::vector<LinearizedRecord>& array_) const;
50  virtual const char* getParenthesis() const;
51  virtual void serializeItems(
52  TestMarkOut& serializer_) const;
53  virtual void deserializeItems(
54  TestMarkFactory& factory_,
55  TestMarkIn& deserializer_);
56 
57  public:
61  TestMarkList();
62 
68  explicit TestMarkList(
69  const std::string& prefix_);
70 
74  explicit TestMarkList(
75  const CtorMark*);
76 
80  virtual ~TestMarkList();
81 
82  /* -- avoid copying */
84  const TestMarkList&) = delete;
86  const TestMarkList&) = delete;
87 
91  static const char* typeMark();
92 
98  void append(
99  TestMarkPtr mark_);
100 };
101 
102 } /* namespace OTest2 */
103 
104 #endif /* OTest2__INCLUDE_OTEST2_TESTMARKLIST_H_ */
testmarkptr.h
OTest2::TestMarkList::~TestMarkList
virtual ~TestMarkList()
Dtor.
Definition: testmarklist.cpp:54
OTest2::TestMarkIn
A generic interface of a testmark deserializer.
Definition: testmarkin.h:35
OTest2::TestMarkPrefix
A generic test mark with string prefix.
Definition: testmarkprefix.h:35
OTest2::TestMarkList::append
void append(TestMarkPtr mark_)
Append a test mark into the list.
Definition: testmarklist.cpp:115
OTest2::TestMarkOut
A generic interface of a serializer of test marks.
Definition: testmarkout.h:31
OTest2::TestMarkList::TestMarkList
TestMarkList()
Ctor.
Definition: testmarklist.cpp:35
OTest2::TestMarkPtr
std::shared_ptr< TestMark > TestMarkPtr
Definition: testmarkptr.h:26
OTest2
Definition: assertbean.h:25
OTest2::TestMarkList::operator=
TestMarkList & operator=(const TestMarkList &)=delete
OTest2::TestMarkList::typeMark
static const char * typeMark()
Get serialization typemark.
Definition: testmarklist.cpp:58
OTest2::TestMarkList
Ordered list of nested test marks.
Definition: testmarklist.h:34
OTest2::TestMark
Generic interface of a test mark node.
Definition: testmark.h:41
OTest2::TestMarkFactory
A factory of testmark objects used for deserialization.
Definition: testmarkfactory.h:45
testmarkprefix.h