OTest2
A C++ testing framework
testmarkint.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 
20 #ifndef OTest2__INCLUDE_OTEST2_TESTMARKINT_H_
21 #define OTest2__INCLUDE_OTEST2_TESTMARKINT_H_
22 
23 #include <cstdint>
24 
25 #include <otest2/testmark.h>
26 
27 namespace OTest2 {
28 
29 struct CtorMark;
30 
34 class TestMarkInt : public TestMark {
35  private:
36  int64_t value;
37 
38  /* -- test mark interface */
39  virtual TestMarkHashCode doGetHashCode() const noexcept;
40  virtual bool doIsEqual(
41  const TestMark& other_,
42  long double precision_) const;
43  virtual bool doIsEqualValue(
44  const TestMark& other_,
45  long double precision_) const;
46  virtual void doDiffArray(
47  int level_,
48  std::vector<LinearizedRecord>& array_) const;
49  virtual void doLinearizedMark(
50  int level_,
51  const std::string& label_,
52  std::vector<LinearizedRecord>& array_) const;
53  virtual void doPrintOpen(
54  std::ostream& os_,
55  const std::string& prefix_) const;
56  virtual void doPrintClose(
57  std::ostream& os_,
58  const std::string& prefix_) const;
59  virtual void doSerializeMark(
60  TestMarkOut& serializer_) const;
61  virtual void doDeserializeMark(
62  TestMarkFactory& factory_,
63  TestMarkIn& deserializer_);
64 
65  public:
71  explicit TestMarkInt(
72  int64_t value_);
73 
77  explicit TestMarkInt(
78  const CtorMark*);
79 
83  virtual ~TestMarkInt();
84 
85  /* -- avoid copying */
87  const TestMarkInt&) = delete;
89  const TestMarkInt&) = delete;
90 
94  static const char* typeMark();
95 };
96 
97 } /* namespace OTest2 */
98 
99 #endif /* OTest2__INCLUDE_OTEST2_TESTMARKINT_H_ */
OTest2::TestMarkInt::operator=
TestMarkInt & operator=(const TestMarkInt &)=delete
OTest2::TestMarkIn
A generic interface of a testmark deserializer.
Definition: testmarkin.h:35
OTest2::TestMarkHashCode
std::uint64_t TestMarkHashCode
Definition: testmarkhashcode.h:28
OTest2::TestMarkOut
A generic interface of a serializer of test marks.
Definition: testmarkout.h:31
OTest2::TestMarkInt::typeMark
static const char * typeMark()
Get serialization typemark.
Definition: testmarkint.cpp:52
OTest2
Definition: assertbean.h:25
OTest2::TestMarkInt
Integer test mark.
Definition: testmarkint.h:34
OTest2::TestMarkInt::TestMarkInt
TestMarkInt(int64_t value_)
Ctor.
Definition: testmarkint.cpp:36
testmark.h
OTest2::TestMarkInt::~TestMarkInt
virtual ~TestMarkInt()
Dtor.
Definition: testmarkint.cpp:48
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