OTest2
A C++ testing framework
testmarknull.cpp
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 #include <testmarknull.h>
21 
22 #include <assert.h>
23 #include <iostream>
24 
25 #include <testmarkhash.h>
26 #include <testmarkout.h>
27 
28 namespace OTest2 {
29 
30 namespace {
31 
32 const char SERIALIZE_TYPE_MARK[] = "ot2:null";
33 
34 } /* -- namespace */
35 
37 
38 }
39 
41  const CtorMark*) {
42 
43 }
44 
46 
47 }
48 
49 const char* TestMarkNull::typeMark() {
50  return SERIALIZE_TYPE_MARK;
51 }
52 
53 TestMarkHashCode TestMarkNull::doGetHashCode() const noexcept {
54  return TestMarkHash::hashBasicType(SERIALIZE_TYPE_MARK, nullptr);
55 }
56 
57 bool TestMarkNull::doIsEqual(
58  const TestMark& other_,
59  long double precision_) const {
60  return true; /* -- the type of the node is enough */
61 }
62 
63 bool TestMarkNull::doIsEqualValue(
64  const TestMark& other_,
65  long double precision_) const {
66  return true; /* -- the type of the node is enough */
67 }
68 
69 void TestMarkNull::doDiffArray(
70  int level_,
71  std::vector<LinearizedRecord>& array_) const
72 {
73  /* -- there are no children */
74 }
75 
76 void TestMarkNull::doLinearizedMark(
77  int level_,
78  const std::string& label_,
79  std::vector<LinearizedRecord>& array_) const {
80  array_.push_back({level_, this, label_});
81 }
82 
83 void TestMarkNull::doPrintOpen(
84  std::ostream& os_,
85  const std::string& prefix_) const {
86  os_ << prefix_ << "<NULL>\n";
87 }
88 
89 void TestMarkNull::doPrintClose(
90  std::ostream& os_,
91  const std::string& prefix_) const {
92  /* -- nothing to do */
93 }
94 
95 void TestMarkNull::doSerializeMark(
96  TestMarkOut& serializer_) const {
97  serializer_.writeTypeMark(SERIALIZE_TYPE_MARK);
98 }
99 
100 void TestMarkNull::doDeserializeMark(
101  TestMarkFactory& factory_,
102  TestMarkIn& deserializer_) {
103  /* -- nothing to deserialize, the object keeps no data */
104 }
105 
106 } /* namespace OTest2 */
OTest2::TestMarkNull::TestMarkNull
TestMarkNull()
Ctor.
Definition: testmarknull.cpp:36
testmarkhash.h
OTest2::TestMarkNull::typeMark
static const char * typeMark()
Get serialization typemark.
Definition: testmarknull.cpp:49
OTest2::TestMarkHashCode
std::uint64_t TestMarkHashCode
Definition: testmarkhashcode.h:28
OTest2::TestMarkHash::hashBasicType
static TestMarkHashCode hashBasicType(const char *type_name_, Type_ value_)
Definition: testmarkhash.h:122
OTest2::TestMarkNull::~TestMarkNull
virtual ~TestMarkNull()
Dtor.
Definition: testmarknull.cpp:45
OTest2
Definition: assertbean.h:25
testmarknull.h
testmarkout.h