Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
w
Functions
a
b
d
e
f
g
i
m
n
p
r
s
t
w
Variables
a
c
d
e
f
h
i
m
n
p
r
s
t
w
Typedefs
Enumerations
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
~
Functions
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
~
Variables
_
a
c
d
e
f
h
i
k
l
m
n
p
r
s
t
u
x
Typedefs
a
b
c
e
m
p
r
s
t
Files
File List
File Members
All
d
f
h
i
m
o
s
t
u
Functions
d
i
m
s
t
Variables
Macros
foxglove_bridge_base
tests
serialization_test.cpp
Go to the documentation of this file.
1
#include <gtest/gtest.h>
2
3
#include <
foxglove_bridge/serialization.hpp
>
4
5
TEST
(SerializationTest, ServiceRequestSerialization) {
6
foxglove::ServiceRequest
req;
7
req.
serviceId
= 2;
8
req.
callId
= 1;
9
req.
encoding
=
"json"
;
10
req.
data
= {1, 2, 3};
11
12
std::vector<uint8_t> data(req.
size
());
13
req.
write
(data.data());
14
15
foxglove::ServiceRequest
req2;
16
req2.
read
(data.data(), data.size());
17
EXPECT_EQ(req.
serviceId
, req2.
serviceId
);
18
EXPECT_EQ(req.
callId
, req2.
callId
);
19
EXPECT_EQ(req.
encoding
, req2.
encoding
);
20
EXPECT_EQ(req.
data
.size(), req2.
data
.size());
21
EXPECT_EQ(req.
data
, req2.
data
);
22
}
23
24
int
main
(
int
argc,
char
** argv) {
25
testing::InitGoogleTest(&argc, argv);
26
return
RUN_ALL_TESTS();
27
}
foxglove::ServiceResponse::encoding
std::string encoding
Definition:
common.hpp:133
foxglove::ServiceResponse
Definition:
common.hpp:130
foxglove::ServiceResponse::callId
uint32_t callId
Definition:
common.hpp:132
TEST
TEST(SerializationTest, ServiceRequestSerialization)
Definition:
serialization_test.cpp:5
foxglove::ServiceResponse::size
size_t size() const
Definition:
common.hpp:136
foxglove::ServiceResponse::data
std::vector< uint8_t > data
Definition:
common.hpp:134
serialization.hpp
foxglove::ServiceResponse::serviceId
ServiceId serviceId
Definition:
common.hpp:131
main
int main(int argc, char **argv)
Definition:
serialization_test.cpp:24
foxglove::ServiceResponse::write
void write(uint8_t *data) const
Definition:
serialization.cpp:158
foxglove::ServiceResponse::read
void read(const uint8_t *data, size_t size)
Definition:
serialization.cpp:143
foxglove_bridge
Author(s): Foxglove
autogenerated on Wed Mar 5 2025 03:34:31