OTest2
A C++ testing framework
lib
testmarkinbinios.cpp
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
#include <
testmarkinbinios.h
>
21
22
#include <assert.h>
23
#include <istream>
24
25
#include <
exctestmarkin.h
>
26
27
namespace
OTest2
{
28
29
TestMarkInBinIOS::TestMarkInBinIOS
(
30
std::istream* is_) :
31
is(is_) {
32
assert(is !=
nullptr
);
33
34
}
35
36
void
TestMarkInBinIOS::readBinaryData(
37
std::uint64_t size_,
38
std::uint8_t* buffer_) {
39
is->read(
reinterpret_cast<
char
*
>
(buffer_), size_);
40
if
(!*is)
41
throw
ExcTestMarkIn
(
"an input error"
);
42
if
(
static_cast<
std::uint64_t
>
(is->gcount()) != size_)
43
throw
ExcTestMarkIn
(
"missing data in the stream"
);
44
}
45
46
TestMarkInBinIOS::~TestMarkInBinIOS
() {
47
48
}
49
50
}
/* -- namespace OTest2 */
OTest2::TestMarkInBinIOS::TestMarkInBinIOS
TestMarkInBinIOS(std::istream *is_)
Ctor.
Definition:
testmarkinbinios.cpp:29
OTest2::ExcTestMarkIn
An exception thrown from the testmark deserializer.
Definition:
exctestmarkin.h:33
exctestmarkin.h
OTest2
Definition:
assertbean.h:25
testmarkinbinios.h
OTest2::TestMarkInBinIOS::~TestMarkInBinIOS
virtual ~TestMarkInBinIOS()
Dtor.
Definition:
testmarkinbinios.cpp:46
Generated by
1.8.17