MOS Source Code
Loading...
Searching...
No Matches
callback_pointer.c
Go to the documentation of this file.
1#include "callback_pointer.pb.h"
2#include <unittests.h>
3#include <pb_decode.h>
4
5int main()
6{
7 int status = 0;
8 const uint8_t msgdata[] = {0x0A, 0x02, 0x08, 0x7F};
9
10 MainMessage msg = MainMessage_init_zero;
11
12 {
13 pb_istream_t stream = pb_istream_from_buffer(msgdata, sizeof(msgdata));
14 COMMENT("Running first decode");
15 TEST(pb_decode(&stream, MainMessage_fields, &msg));
16 pb_release(MainMessage_fields, &msg);
17 }
18
19 {
20 pb_istream_t stream = pb_istream_from_buffer(msgdata, sizeof(msgdata));
21 COMMENT("Running second decode");
22 TEST(pb_decode(&stream, MainMessage_fields, &msg));
23 pb_release(MainMessage_fields, &msg);
24 }
25
26 TEST(get_alloc_count() == 0);
27
28 return status;
29}
30
int main()
size_t get_alloc_count()
bool pb_decode(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct)
Definition pb_decode.c:1182
void pb_release(const pb_msgdesc_t *fields, void *dest_struct)
Definition pb_decode.c:1336
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
#define COMMENT(x)
Definition unittests.h:17