MOS Source Code
Loading...
Searching...
No Matches
short_array.c
Go to the documentation of this file.
1
#include <
unittests.h
>
2
#include <pb_encode.h>
3
#include "short_array.pb.h"
4
5
int
main
()
6
{
7
int
status = 0;
8
9
COMMENT
(
"Test message length calculation for short arrays"
);
10
{
11
uint8_t
buffer
[TestMessage_size] = {0};
12
pb_ostream_t ostream =
pb_ostream_from_buffer
(
buffer
, TestMessage_size);
13
TestMessage msg = TestMessage_init_zero;
14
15
msg.rep_uint32_count = 1;
16
msg.rep_uint32[0] = ((
uint32_t
)1 << 31);
17
18
TEST
(
pb_encode
(&ostream, TestMessage_fields, &msg));
19
TEST
(ostream.bytes_written == TestMessage_size);
20
}
21
22
return
status;
23
}
24
pb_ostream_from_buffer
pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize)
Definition
pb_encode.c:63
pb_encode
bool pb_encode(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct)
Definition
pb_encode.c:512
uint32_t
unsigned int uint32_t
Definition
pb_syshdr.h:24
uint8_t
unsigned char uint8_t
Definition
pb_syshdr.h:20
main
int main()
Definition
short_array.c:5
TEST
#define TEST(x)
Definition
test.h:3
buffer
static char buffer[2048]
Definition
test_printf.c:7
unittests.h
COMMENT
#define COMMENT(x)
Definition
unittests.h:17
libs
nanopb
nanopb
tests
regression
issue_253
short_array.c
Generated on Sun Sep 1 2024 18:22:52 for MOS Source Code by
1.12.0