MOS Source Code
Loading...
Searching...
No Matches
test_oneof.c
Go to the documentation of this file.
1#include <pb_decode.h>
2#include <unittests.h>
3#include "oneof.pb.h"
4
5int main()
6{
7 const uint8_t input_data[] = {
8 0x08, 0x01, 0x10, 0x0F, 0x18, 0xAC, 0x02, 0x20,
9 0xF1, 0x82, 0xA0, 0x85, 0x0C, 0x62, 0x00, 0x58,
10 0xF1, 0x82, 0xA0, 0x85, 0x0C
11 };
12
13 int status = 0;
14 TestMessage msg = TestMessage_init_zero;
15 pb_istream_t stream = pb_istream_from_buffer(input_data, sizeof(input_data));
16
17 TEST(pb_decode(&stream, TestMessage_fields, &msg));
18 TEST(msg.which_payload == TestMessage_plb11_tag);
19 TEST(msg.payload.plb11.name[0] == 0);
20
21 return status;
22}
bool pb_decode(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct)
Definition pb_decode.c:1182
pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t msglen)
Definition pb_decode.c:143
unsigned char uint8_t
Definition pb_syshdr.h:20
#define TEST(x)
Definition test.h:3
int main()
Definition test_oneof.c:5