OTest2
A C++ testing framework
testmarkoutbin.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_TESTMARKOUTBIN_H_
21 #define OTest2__INCLUDE_OTEST2_TESTMARKOUTBIN_H_
22 
23 #include <cstdint>
24 
25 #include <otest2/testmarkout.h>
26 
27 namespace OTest2 {
28 
29 enum class TestMarkOutBinTag : std::uint8_t;
30 
35 class TestMarkOutBin : public TestMarkOut {
36  private:
43  virtual void writeBinaryData(
44  std::uint64_t size_,
45  const std::uint8_t* data_) = 0;
46 
47  void writeTag(
48  TestMarkOutBinTag tag_);
49 
50  public:
55 
59  virtual ~TestMarkOutBin();
60 
61  /* -- avoid copying */
63  const TestMarkOutBin&) = delete;
64  TestMarkOutBin& operator = (
65  const TestMarkOutBin&) = delete;
66 
67  /* -- testmark serializer */
68  virtual void writeTypeMark(
69  const char* typemark_) override;
70  virtual void writeInt(
71  std::int64_t value_) override;
72  virtual void writeFloat(
73  long double value_) override;
74  virtual void writeString(
75  const std::string& string_) override;
76 };
77 
78 } /* -- namespace OTest2 */
79 
80 #endif /* -- OTest2__INCLUDE_OTEST2_TESTMARKOUTBIN_H_ */
OTest2::TestMarkOutBinTag
TestMarkOutBinTag
Definition: testmarkoutbintags.h:27
OTest2::TestMarkOutBin
Generic implementation of the testmark serializer based on a binary stream.
Definition: testmarkoutbin.h:35
OTest2::TestMarkOut
A generic interface of a serializer of test marks.
Definition: testmarkout.h:31
OTest2
Definition: assertbean.h:25
testmarkout.h