Line data Source code
1 : /* 2 : * Tests if this still compiles when multiple .proto files are involved. 3 : */ 4 : 5 : #include <stdio.h> 6 : #include <pb_encode.h> 7 : #include <pb_common.h> 8 : #include "unittests.h" 9 : #include "multifile2.pb.h" 10 : #include "subdir/multifile2.pb.h" 11 : 12 1 : int main() 13 : { 14 1 : int status = 0; 15 : 16 : /* Test that included file options are properly loaded */ 17 1 : TEST(OneofMessage_size == 27); 18 : 19 : /* Check that enum signedness is detected properly */ 20 : { 21 : pb_field_iter_t iter; 22 : Enums msg; 23 1 : TEST(pb_field_iter_begin(&iter, Enums_fields, &msg)); 24 1 : TEST(PB_LTYPE(iter.type) == PB_LTYPE_VARINT); 25 1 : TEST(pb_field_iter_next(&iter)); 26 1 : TEST(PB_LTYPE(iter.type) == PB_LTYPE_UVARINT); 27 : } 28 : 29 : /* Test that subdir file is correctly included */ 30 : { 31 1 : subdir_SubdirMessage foo = subdir_SubdirMessage_init_default; 32 1 : TEST(foo.foo == 15); 33 1 : TEST(subdir_OneofMessage_size >= 27); /* Note: not perfectly accurate due to issue 172 */ 34 1 : TEST(subdir_OneofMessage_size <= 30); 35 : } 36 : 37 1 : return status; 38 : }