Line data Source code
1 : #include "callback_pointer.pb.h" 2 : #include <unittests.h> 3 : #include <pb_decode.h> 4 : 5 1 : int main() 6 : { 7 1 : int status = 0; 8 1 : const uint8_t msgdata[] = {0x0A, 0x02, 0x08, 0x7F}; 9 : 10 1 : MainMessage msg = MainMessage_init_zero; 11 : 12 : { 13 1 : pb_istream_t stream = pb_istream_from_buffer(msgdata, sizeof(msgdata)); 14 1 : COMMENT("Running first decode"); 15 1 : TEST(pb_decode(&stream, MainMessage_fields, &msg)); 16 1 : pb_release(MainMessage_fields, &msg); 17 : } 18 : 19 : { 20 1 : pb_istream_t stream = pb_istream_from_buffer(msgdata, sizeof(msgdata)); 21 1 : COMMENT("Running second decode"); 22 1 : TEST(pb_decode(&stream, MainMessage_fields, &msg)); 23 1 : pb_release(MainMessage_fields, &msg); 24 : } 25 : 26 1 : TEST(get_alloc_count() == 0); 27 : 28 1 : return status; 29 : } 30 :