From 32e25cbca210a359b09768537b6f443fe90a3070 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 20 Jun 2017 10:24:05 +0000 Subject: Separation Generator to a dedicated repo Change-Id: Id94831651c3266861435272a6e36c7884bef2c45 Signed-off-by: Romain Forlot --- libs/nanopb/tests/extra_fields/SConscript | 16 ++++++++++++++++ .../tests/extra_fields/alltypes_with_extra_fields.pb | Bin 0 -> 523 bytes .../tests/extra_fields/person_with_extra_field.expected | 14 ++++++++++++++ .../tests/extra_fields/person_with_extra_field.pb | Bin 0 -> 124 bytes 4 files changed, 30 insertions(+) create mode 100644 libs/nanopb/tests/extra_fields/SConscript create mode 100644 libs/nanopb/tests/extra_fields/alltypes_with_extra_fields.pb create mode 100644 libs/nanopb/tests/extra_fields/person_with_extra_field.expected create mode 100644 libs/nanopb/tests/extra_fields/person_with_extra_field.pb (limited to 'libs/nanopb/tests/extra_fields') diff --git a/libs/nanopb/tests/extra_fields/SConscript b/libs/nanopb/tests/extra_fields/SConscript new file mode 100644 index 00000000..75ac5c5e --- /dev/null +++ b/libs/nanopb/tests/extra_fields/SConscript @@ -0,0 +1,16 @@ +# Test that the decoder properly handles unknown fields in the input. + +Import("env") + +dec = env.GetBuildPath('$BUILD/basic_buffer/${PROGPREFIX}decode_buffer${PROGSUFFIX}') +env.RunTest('person_with_extra_field.output', [dec, "person_with_extra_field.pb"]) +env.Compare(["person_with_extra_field.output", "person_with_extra_field.expected"]) + +dec = env.GetBuildPath('$BUILD/basic_stream/${PROGPREFIX}decode_stream${PROGSUFFIX}') +env.RunTest('person_with_extra_field_stream.output', [dec, "person_with_extra_field.pb"]) +env.Compare(["person_with_extra_field_stream.output", "person_with_extra_field.expected"]) + +# This uses the backwards compatibility alltypes test, so that +# alltypes_with_extra_fields.pb doesn't have to be remade so often. +dec2 = env.GetBuildPath('$BUILD/backwards_compatibility/${PROGPREFIX}decode_legacy${PROGSUFFIX}') +env.RunTest('alltypes_with_extra_fields.output', [dec2, 'alltypes_with_extra_fields.pb']) diff --git a/libs/nanopb/tests/extra_fields/alltypes_with_extra_fields.pb b/libs/nanopb/tests/extra_fields/alltypes_with_extra_fields.pb new file mode 100644 index 00000000..f9f53941 Binary files /dev/null and b/libs/nanopb/tests/extra_fields/alltypes_with_extra_fields.pb differ diff --git a/libs/nanopb/tests/extra_fields/person_with_extra_field.expected b/libs/nanopb/tests/extra_fields/person_with_extra_field.expected new file mode 100644 index 00000000..da9c32df --- /dev/null +++ b/libs/nanopb/tests/extra_fields/person_with_extra_field.expected @@ -0,0 +1,14 @@ +name: "Test Person 99" +id: 99 +email: "test@person.com" +phone { + number: "555-12345678" + type: MOBILE +} +phone { + number: "99-2342" +} +phone { + number: "1234-5678" + type: WORK +} diff --git a/libs/nanopb/tests/extra_fields/person_with_extra_field.pb b/libs/nanopb/tests/extra_fields/person_with_extra_field.pb new file mode 100644 index 00000000..ffb303dd Binary files /dev/null and b/libs/nanopb/tests/extra_fields/person_with_extra_field.pb differ -- cgit 1.2.3-korg