userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
struct_to_binary_test.cpp
1
#
include
<
gmock
/
gmock
.
h
>
2
#
include
<
gtest
/
gtest
.
h
>
3
4
#
include
<
userver
/
proto
-
structs
/
convert
.
hpp
>
5
#
include
<
userver
/
utest
/
assert_macros
.
hpp
>
6
7
#
include
"messages.pb.h"
8
#
include
"structs.hpp"
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
proto_structs::tests {
13
14
TEST(StructToBinary, Scalar) {
15
{
16
messages::Scalar msg;
17
structs::
Scalar
obj{
18
.f1 =
true
,
19
.f2 = std::numeric_limits<int32_t>::min(),
20
.f3 = std::numeric_limits<uint32_t>::max(),
21
.f4 = std::numeric_limits<int64_t>::min(),
22
.f5 = std::numeric_limits<uint64_t>::max(),
23
.f6 =
static_cast
<
float
>(1.5),
24
.f7 = -2.5,
25
.f8 =
"test1"
,
26
.f9 =
"test2"
,
27
.f10 = structs::TestEnum::kValue1,
28
.f11 = 987
29
};
30
31
std::string serialized_from_obj = StructToBinary(obj);
32
ASSERT_TRUE(msg.ParseFromString(serialized_from_obj));
33
34
CheckScalarEqual(obj, msg);
35
}
36
}
37
}
// namespace proto_structs::tests
38
39
USERVER_NAMESPACE_END
proto-structs
tests
struct_to_binary_test.cpp
Generated on
for userver by
Doxygen
1.17.0