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
12
int
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
);
25
TEST
(
pb_field_iter_next
(&iter));
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
}
PB_LTYPE_UVARINT
#define PB_LTYPE_UVARINT
Definition
pb.h:241
PB_LTYPE
#define PB_LTYPE(x)
Definition
pb.h:299
PB_LTYPE_VARINT
#define PB_LTYPE_VARINT
Definition
pb.h:240
pb_field_iter_next
bool pb_field_iter_next(pb_field_iter_t *iter)
Definition
pb_common.c:188
pb_field_iter_begin
bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message)
Definition
pb_common.c:156
TEST
#define TEST(x)
Definition
test.h:3
main
int main()
Definition
test_multiple_files.c:12
unittests.h
libs
nanopb
nanopb
tests
multiple_files
test_multiple_files.c
Generated on Sun Sep 1 2024 18:22:52 for MOS Source Code by
1.12.0