173 Commits

Author SHA1 Message Date
Petteri Aimonen
ef422656a5 Fix oneof submessage initialization bug.
Update issue 149
Status: FixedInGit
2015-03-07 10:25:09 +02:00
Petteri Aimonen
4a6580726e Fix generator error when long_names:false is combined with Oneofs.
Update issue 147
Status: FixedInGit
2015-02-26 17:33:36 +02:00
Petteri Aimonen
25b92c5b4e Fix generator bug when oneof is first field in a message.
Added test case for the same.

Update issue 142
Status: FixedInGit
2015-01-27 17:47:25 +02:00
Petteri Aimonen
d32d04ba10 Fix encoded_size #defines for oneof messages.
The sizes are represented as EncodedSize() instances, which cause
max() operation to sort them by address instead of value. This caused
pretty much random item to be selected for the maximum.

Update issue 141
Status: FixedInGit
2015-01-23 21:29:29 +02:00
Petteri Aimonen
24a45b0a9c Fix clang compiler warning in intsizes unit test. 2015-01-15 19:18:48 +02:00
Petteri Aimonen
e1c50496d9 Release memory when overwriting oneof fields.
Update issue 131
Status: FixedInGit
2015-01-15 18:58:08 +02:00
Petteri Aimonen
f4b3a1c202 Add oneofs to AllTypes test case 2015-01-11 19:47:27 +02:00
Petteri Aimonen
cc3c8732fd Actually make the protoc version check work 2015-01-04 20:20:40 +02:00
Petteri Aimonen
7135e2797a Only run oneof test when protoc >= 2.6 is available 2015-01-04 20:00:37 +02:00
Petteri Aimonen
7713d43bc3 Implement support for oneofs (C unions).
Basic test included, should probably add an oneof to the AllTypes test also.

Update issue 131
Status: Started
2015-01-04 19:39:37 +02:00
Petteri Aimonen
a0f0440394 Detect too large varint values when decoding.
Because Issue #139 now allows limiting integer fields, it is good
to check the values received from other protobuf libraries against
the lower limits.
2015-01-04 12:17:24 +02:00
Petteri Aimonen
50c67ecec4 Add int_size option for generator.
This allows overriding the integer field types to e.g. uint8_t for
saving RAM.

Update issue 139
Status: FixedInGit
2015-01-04 12:02:15 +02:00
Petteri Aimonen
b0d31468da Change PB_RETURN_ERROR() macro to avoid compiler warnings.
Update issue 140
Status: FixedInGit
2015-01-03 10:59:19 +02:00
Petteri Aimonen
7be7c7769f Fix build failure due to missing dependency in SConscript 2014-12-27 00:37:59 +02:00
Petteri Aimonen
58643217b1 Fix bug in backwards_compatibility test case.
The memset() filled also the extensions field, which was just
waiting for a crash to happen.
2014-12-26 23:27:34 +02:00
Petteri Aimonen
1515cfb5c2 Add testcase for releasing memory in submessages/extensions 2014-12-26 23:27:29 +02:00
Petteri Aimonen
0f3c0f79bc Move malloc support to tests/common directory 2014-12-26 17:34:45 +02:00
Petteri Aimonen
8a28b70351 Move malloc_wrappers.c to tests/common 2014-12-26 17:08:17 +02:00
Petteri Aimonen
e5cbee84e1 Verify build with protobuf-3.0.0, fix problems.
Also updated descriptor.proto from protobuf-3.0.0.
2014-12-22 22:52:36 +02:00
Petteri Aimonen
07e9ffb97b Add a fuzz testing stub for ability to use external generators also 2014-09-11 19:22:57 +03:00
Petteri Aimonen
0dce9ef635 Add a better fuzz test.
Attempts to verify all the properties defined in the security model,
while also being portable and able to run on many platforms.
2014-09-11 19:22:57 +03:00
Petteri Aimonen
8189d538dd Add test case for simulated io errors.
Update issue 126
Status: FixedInGit
2014-09-07 20:31:36 +03:00
Petteri Aimonen
38613acdb4 Add a few missing unit tests 2014-09-07 20:30:17 +03:00
Petteri Aimonen
d0299d87ec Code coverage results were ignoring the data from encode/decode unittests.
Update issue 126
Status: Started
2014-09-07 19:25:09 +03:00
Petteri Aimonen
df7234fd8b Fix cyclic messages support in generator. Beginnings of test.
Update issue 130
Status: Started
2014-08-28 21:23:28 +03:00
Petteri Aimonen
3ed219382e Add #if guard for .pb.h version.
The version in PB_PROTO_HEADER_VERSION can be bumped whenever there
is a breaking change to the generated files, and it will then alert
to the difference.

Update issue 129
Status: FixedInGit
2014-08-19 17:55:44 +03:00
Petteri Aimonen
be0b9e047a Rename poorly named identifier to avoid name conflicts.
Update issue 106
Status: FixedInGit
2014-08-18 21:11:10 +03:00
Petteri Aimonen
62b4a8ecaa Rename UNUSED() and STATIC_ASSERT() macros with PB_ prefix.
This avoids possible namespace conflicts with other macros.
2014-08-18 20:49:48 +03:00
Petteri Aimonen
1dd9f1900f Change the _count fields to use pb_size_t datatype.
Update issue 82
Status: FixedInGit
2014-08-18 20:09:52 +03:00
Petteri Aimonen
0b517b0778 Fix windows build error in tests 2014-08-10 17:44:27 +03:00
Petteri Aimonen
7edf250a62 Switch pb_encode to use the common iterator logic in pb_common.c
Update issue 128
Status: FixedInGit
2014-08-10 13:01:09 +03:00
Petteri Aimonen
a641e21b34 Separate field iterator logic from pb_decode to pb_common. 2014-08-10 12:42:01 +03:00
Petteri Aimonen
ec3bff4ba1 Generate #defines for initializing message structures.
Usage like:
MyMessage foo = MyMessage_init_default;

MyMessage_init_default will initialize to default values defined in .proto.

MyMessage_init_zero will initialize to null/zero values. Same results as {}
or {0}, but will avoid compiler warnings by initializing everything explicitly.

Update issue 79
Status: FixedInGit
2014-08-04 18:40:40 +03:00
Petteri Aimonen
1d7f60fec3 Add skip_message option to generator.
Update issue 121
Status: FixedInGit
2014-07-20 14:56:12 +03:00
Petteri Aimonen
5749606f5d Add support for inverted patterns in test framework. 2014-07-20 14:55:47 +03:00
Petteri Aimonen
f2f9f8a9ed Fix problem with .options file and extension fields.
The options for an extension field were being looked up under wrong name
(MessageName instead of MessageName.fieldname).

Fixed the problem and added regression test. Created a new subfolder for
regression test cases.

Update issue 125
Status: FixedInGit
2014-07-20 14:02:56 +03:00
Petteri Aimonen
788d2825b0 Add unit tests for allocate_field(). 2014-06-02 21:20:57 +03:00
Petteri Aimonen
9cf788de54 Fix bug in alltypes test case that made fuzzing difficult. 2014-05-17 20:28:33 +03:00
Petteri Aimonen
d177af1639 Fix typos in scons command line options 2014-04-15 20:30:50 +03:00
Petteri Aimonen
3b36235cef Remove -O0 from tests CFLAGS so that optimized builds can be tested also 2014-04-15 20:27:38 +03:00
Petteri Aimonen
1d249a48ea Fix bug in missing_fields test case 2014-04-09 19:39:12 +03:00
Petteri Aimonen
3e83d81b09 Use -fsanitize=undefined when running tests with clang 2014-04-09 19:28:57 +03:00
Petteri Aimonen
a8de6acf2d Add rule for building coverage summary using lcov.
Also modified a few tests to be more compatible with coverage information,
so that they use the same pb_encode/decode.c instead of making a copy.
2014-04-05 13:26:37 +03:00
Petteri Aimonen
b63e582bdb Add a convenience function pb_get_encoded_size()
There is minimal size penalty from this, and it is probably much more
intuitive to use than PB_OSTREAM_SIZING itself.

This has been suggested before also, but I ended up refusing it back
them. Reconsidering it now, I see that an intuitive API is much better
than any amount of documentation explaining a non-intuitive API.

Update issue 16
Status: FixedInGit
2014-04-05 11:26:39 +03:00
Petteri Aimonen
e5b855fec5 Add a 'found' field to pb_extension_t.
Update issue 112
Status: FixedInGit
2014-04-05 11:11:05 +03:00
Petteri Aimonen
99434724d0 Fix splint warnings, add splint test case 2014-04-02 21:07:30 +03:00
Petteri Aimonen
6c90e824c4 Fix compile error when default value given for extension field.
Update issue 111
Status: FixedInGit
2014-04-01 16:47:53 +03:00
Petteri Aimonen
f4949119ad Add stdlib.h to pb_syshdr.h for dynamic allocation 2014-03-18 16:13:54 +02:00
Petteri Aimonen
ab62402059 Documentation updates 2014-03-16 15:52:19 +02:00
Petteri Aimonen
108864963f Finish the alltypes_pointer testcase, use valgrind if available. 2014-03-15 09:39:27 +02:00