MOS Source Code
Loading...
Searching...
No Matches
test_multiple_files.c
Go to the documentation of this file.
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
12int main()
13{
14 int status = 0;
15
16 /* Test that included file options are properly loaded */
17 TEST(OneofMessage_size == 27);
18
19 /* Check that enum signedness is detected properly */
20 {
21 pb_field_iter_t iter;
22 Enums msg;
23 TEST(pb_field_iter_begin(&iter, Enums_fields, &msg));
24 TEST(PB_LTYPE(iter.type) == PB_LTYPE_VARINT);
26 TEST(PB_LTYPE(iter.type) == PB_LTYPE_UVARINT);
27 }
28
29 /* Test that subdir file is correctly included */
30 {
31 subdir_SubdirMessage foo = subdir_SubdirMessage_init_default;
32 TEST(foo.foo == 15);
33 TEST(subdir_OneofMessage_size >= 27); /* Note: not perfectly accurate due to issue 172 */
34 TEST(subdir_OneofMessage_size <= 30);
35 }
36
37 return status;
38}
#define PB_LTYPE_UVARINT
Definition pb.h:241
#define PB_LTYPE(x)
Definition pb.h:299
#define PB_LTYPE_VARINT
Definition pb.h:240
bool pb_field_iter_next(pb_field_iter_t *iter)
Definition pb_common.c:188
bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message)
Definition pb_common.c:156
#define TEST(x)
Definition test.h:3
int main()