1 #include "pb_encode.h"
2 #include "pb_decode.h"
3 
4 #include "test.h"
5 
6 #include "pio_without_options.pb.h"
7 
main(int argc,char * argv[])8 int main(int argc, char *argv[]) {
9 
10     int status = 0;
11 
12     uint8_t buffer[256];
13     pb_ostream_t ostream;
14     pb_istream_t istream;
15     size_t written;
16 
17     TestMessageWithoutOptions original = TestMessageWithoutOptions_init_zero;
18     original.number = 45;
19 
20     ostream = pb_ostream_from_buffer(buffer, sizeof(buffer));
21 
22     TEST(pb_encode(&ostream, &TestMessageWithoutOptions_msg, &original));
23 
24     written = ostream.bytes_written;
25 
26     istream = pb_istream_from_buffer(buffer, written);
27 
28     TestMessageWithoutOptions decoded = TestMessageWithoutOptions_init_zero;
29 
30     TEST(pb_decode(&istream, &TestMessageWithoutOptions_msg, &decoded));
31 
32     TEST(decoded.number == 45);
33 
34     return status;
35 }
36