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

          Line data    Source code
       1             : #include <string.h>
       2             : #include <pb_encode.h>
       3             : #include <unittests.h>
       4             : #include "test.pb.h"
       5             : 
       6           1 : int main()
       7             : {
       8             :     pb_byte_t buf[512];
       9           1 :     MyMessage msg = MyMessage_init_zero;
      10           1 :     pb_ostream_t stream = pb_ostream_from_buffer(buf, sizeof(buf));
      11             : 
      12           1 :     msg.mybytes.size = 0xFFFFFFFF;
      13             :     
      14           1 :     if (pb_encode(&stream, MyMessage_fields, &msg))
      15             :     {
      16           0 :         fprintf(stderr, "Failure: expected pb_encode() to fail.\n");
      17           0 :         return 1;
      18             :     }
      19           1 :     else if (strcmp(PB_GET_ERROR(&stream), "bytes size exceeded") != 0)
      20             :     {
      21           0 :         fprintf(stderr, "Unexpected encoding error: %s\n", PB_GET_ERROR(&stream));
      22           0 :         return 2;
      23             :     }
      24             :     else
      25             :     {
      26           1 :         return 0;
      27             :     }
      28             : }

Generated by: LCOV version 1.14