#include <string.h>
#include <pb_encode.h>
#include "alltypes.pb.h"
+#include "test_helpers.h"
int main(int argc, char **argv)
{
alltypes.rep_enum_count = 5; alltypes.rep_enum[4] = MyEnum_Truth;
alltypes.rep_emptymsg_count = 5;
+ alltypes.req_limits.int32_min = INT32_MIN;
+ alltypes.req_limits.int32_max = INT32_MAX;
+ alltypes.req_limits.uint32_min = 0;
+ alltypes.req_limits.uint32_max = UINT32_MAX;
+ alltypes.req_limits.int64_min = INT64_MIN;
+ alltypes.req_limits.int64_max = INT64_MAX;
+ alltypes.req_limits.uint64_min = 0;
+ alltypes.req_limits.uint64_max = UINT64_MAX;
+ alltypes.req_limits.enum_min = HugeEnum_Negative;
+ alltypes.req_limits.enum_max = HugeEnum_Positive;
+
if (mode != 0)
{
/* Fill in values for optional fields */
alltypes.end = 1099;
{
- uint8_t buffer[1024];
+ uint8_t buffer[AllTypes_size];
pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
/* Now encode it and check if we succeeded. */
if (pb_encode(&stream, AllTypes_fields, &alltypes))
{
+ SET_BINARY_MODE(stdout);
fwrite(buffer, 1, stream.bytes_written, stdout);
return 0; /* Success */
}