12 Commits

Author SHA1 Message Date
Ilya Lipnitskiy
7634c0e6e6 protobuf-c.c: Pack negative enum values correctly
Fix a few casts where ints were cast to uints unnecessarily

Fixes #199. Previously, enums were treated as uint32's, but they need to
be treated as int32's instead.

t: Add a few test cases with negative enum values
2015-12-12 20:36:35 -08:00
Ilya Lipnitskiy
6090d9a924 t: Add tests for oneoffs
Add test cases for parsing multiple fields of the same oneof from the wire
Add more tests for submessage merging, including oneofs
2014-11-19 23:07:23 -08:00
Robert Edmonds
c4a0e69337 t/test-full.proto: add 'allow_alias' option to TestEnumDupValues
protobuf 2.5.0 started warning that we would need to enable the
'allow_alias' option on this enum due to the duplicate enum values, and
protobuf 2.6.0 turned this into an error. Turn this option on, now that
protobuf 2.5.0 is more common (e.g., it's now in Ubuntu 14.04 LTS). This
will break with older protobuf versions, so we now require >= 2.5.0.

We should now see diagnostics like these disappear from the build log:

    [libprotobuf ERROR google/protobuf/descriptor.cc:4153] "foo.VALUE_B" uses the same enum value as "foo.VALUE_A". If this is intended, set 'option allow_alias = true;' to the enum definition.

Based on a patch from Ilya Lipnitskiy.
2014-09-05 15:38:26 -04:00
Andrei Nigmatulin
6136f54b22 added check for PROTOBUF_C_TYPE_BYTES fields, including repeated
added check that repeated fields vectors are not NULL
fixed repeated field quantity type: it's "size_t", not "unsigned"
cleaner code, no cast porn
all covered with tests
2014-06-30 19:28:04 +01:00
Robert Edmonds
3fccff9381 t/: add test case test_field_flags 2014-04-03 12:09:54 -04:00
Robert Edmonds
ec961cb007 t/: rename the required fields bitmap test case 2014-03-31 16:14:33 -04:00
Andrei Nigmatulin
cfb919f100 added unit test for required_fields_bitmap hashing issue 2014-03-31 16:10:41 -04:00
Oleg Efimov
9c7f8ce798 t/: add test case for Issue #129 from Oleg Efimov 2014-03-24 18:07:04 -04:00
Ilya Lipnitskiy
f4b9fd20a5 protobuf-c/protobuf-c.c: add functionality to merge multiple instances
of the same field on the wire (Fixes #91)
t/generated-code2/test-generated-code2.c: add a test case for merging
messages
t/test-full.proto: expand message definitions to test for merging nested
messages
2013-11-22 15:34:07 -08:00
Robert Edmonds
3128296851 t/test-full.proto: revert 'option allow_alias = true;'
this option is only supported by the upstream protobuf compiler starting
with version 2.5.0. this version is not yet widely available in the
debian/ubuntu repositories, and we would like to avoid breaking the
build on those platforms with the distribution version of protobuf
installed, so revert the following commits:

 - 5ee9c03478ea13bba03e7d7edacf723f324200c2
 - 84e41e7329f1f0fc09b41ee96e17b28a792cefcf
2013-11-18 13:00:44 -05:00
Robert Edmonds
5ee9c03478 t/test-full.proto: add 'option allow_alias = true;' to silence warnings from the protobuf compiler 2013-11-16 18:08:51 -05:00
Robert Edmonds
cd2c8a5835 t/: fix paths to generated protobuf code 2013-11-16 17:32:26 -05:00