OTest2
A C++ testing framework
testmarkmap.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_TESTMARKMAP_H_
20 #define OTest2__INCLUDE_OTEST2_TESTMARKMAP_H_
21 
22 #include <map>
23 #include <string>
24 
25 #include <otest2/testmarkprefix.h>
26 #include <otest2/testmarkptr.h>
27 
28 namespace OTest2 {
29 
30 struct CtorMark;
31 
35 class TestMarkMap : public TestMarkPrefix {
36  private:
37  typedef std::multimap<std::string, TestMarkPtr> Map;
38  Map map;
39 
40  /* -- test mark interface */
41  virtual bool doIsEqualPrefixed(
42  const TestMark& other_,
43  long double precision_) const;
44  virtual void doDiffArray(
45  int level_,
46  std::vector<LinearizedRecord>& array_) const;
47  virtual void doLinearizedMark(
48  int level_,
49  const std::string& label_,
50  std::vector<LinearizedRecord>& array_) const;
51  virtual const char* getParenthesis() const;
52  virtual void serializeItems(
53  TestMarkOut& serializer_) const;
54  virtual void deserializeItems(
55  TestMarkFactory& factory_,
56  TestMarkIn& deserializer_);
57 
58  public:
62  TestMarkMap();
63 
69  explicit TestMarkMap(
70  const std::string& prefix_);
71 
75  explicit TestMarkMap(
76  const CtorMark*);
77 
81  virtual ~TestMarkMap();
82 
83  /* -- avoid copying */
85  const TestMarkMap&) = delete;
87  const TestMarkMap&) = delete;
88 
92  static const char* typeMark();
93 
100  void append(
101  const std::string& key_,
102  TestMarkPtr mark_);
103 };
104 
105 } /* namespace OTest2 */
106 
107 #endif /* OTest2__INCLUDE_OTEST2_TESTMARKMAP_H_ */
testmarkptr.h
OTest2::TestMarkMap::TestMarkMap
TestMarkMap()
Ctor.
Definition: testmarkmap.cpp:35
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::TestMarkMap
Unordered indexed multimap of test marks.
Definition: testmarkmap.h:35
OTest2::TestMarkMap::typeMark
static const char * typeMark()
Get serialization typemark.
Definition: testmarkmap.cpp:59
OTest2::TestMarkOut
A generic interface of a serializer of test marks.
Definition: testmarkout.h:31
OTest2::TestMarkMap::operator=
TestMarkMap & operator=(const TestMarkMap &)=delete
OTest2::TestMarkPtr
std::shared_ptr< TestMark > TestMarkPtr
Definition: testmarkptr.h:26
OTest2
Definition: assertbean.h:25
OTest2::TestMarkMap::append
void append(const std::string &key_, TestMarkPtr mark_)
Append a mark.
Definition: testmarkmap.cpp:126
OTest2::TestMarkMap::~TestMarkMap
virtual ~TestMarkMap()
Dtor.
Definition: testmarkmap.cpp:55
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