LCOV - code coverage report
Current view: top level - regression/issue_376 - test_fixarray.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 16 16 100.0 %
Date: 2023-02-14 20:10:26 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include <stdio.h>
       2             : #include <stdlib.h>
       3             : #include <string.h>
       4             : #include <pb_encode.h>
       5             : #include <pb_decode.h>
       6             : #include "fixed_array.pb.h"
       7             : #include "unittests.h"
       8             : 
       9           1 : int main(int argc, char **argv)
      10             : {
      11           1 :     int status = 0;
      12             :     uint8_t buffer[64];
      13           1 :     pb_size_t msglen = 0;
      14             :     
      15             :     {
      16           1 :         pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
      17           1 :         MainMessage msg = MainMessage_init_zero;
      18             :         
      19           1 :         msg.submsg.data[0] = 0;
      20           1 :         msg.submsg.data[4] = 5;
      21             :         
      22           1 :         TEST(pb_encode(&stream, MainMessage_fields, &msg));
      23             : 
      24           1 :         msglen = stream.bytes_written;
      25           1 :         TEST(msglen > 5);
      26             :     }
      27             :     
      28             :     {
      29           1 :         pb_istream_t stream = pb_istream_from_buffer(buffer, msglen);
      30           1 :         MainMessage msg = MainMessage_init_zero;
      31             :         
      32           1 :         TEST(pb_decode(&stream, MainMessage_fields, &msg));
      33             :         
      34           1 :         TEST(msg.submsg.data[0] == 0);
      35           1 :         TEST(msg.submsg.data[4] == 5);
      36             :     }
      37             :     
      38           1 :     return status;
      39             : }
      40             : 

Generated by: LCOV version 1.14