1 #include "callback_pointer.pb.h"
2 #include <unittests.h>
3 #include <pb_decode.h>
4
main()5 int 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
31