Line data Source code
1 : #include <unittests.h> 2 : #include <pb_encode.h> 3 : #include "short_array.pb.h" 4 : 5 1 : int main() 6 : { 7 1 : int status = 0; 8 : 9 1 : COMMENT("Test message length calculation for short arrays"); 10 : { 11 1 : uint8_t buffer[TestMessage_size] = {0}; 12 1 : pb_ostream_t ostream = pb_ostream_from_buffer(buffer, TestMessage_size); 13 1 : TestMessage msg = TestMessage_init_zero; 14 : 15 1 : msg.rep_uint32_count = 1; 16 1 : msg.rep_uint32[0] = ((uint32_t)1 << 31); 17 : 18 1 : TEST(pb_encode(&ostream, TestMessage_fields, &msg)); 19 1 : TEST(ostream.bytes_written == TestMessage_size); 20 : } 21 : 22 1 : return status; 23 : } 24 :