aboutsummaryrefslogtreecommitdiffstats
path: root/CAN-binder/libs/nanopb/tests/missing_fields
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-02 18:29:37 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-02 18:29:37 +0200
commitb9e1b4435a406a8a27c078ea05dee1240e51704a (patch)
tree3bd5e75d001d0c1d57710c47375af5c8ba84c26c /CAN-binder/libs/nanopb/tests/missing_fields
parent0242c26c2f5dc96387bca7efb118364c800f4ee7 (diff)
Added external libraries from openXC CMake files.
Now libraries are cleanly included and built. Change-Id: Iaa85639578b55b2da8357bc438426403e2cca8de Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/libs/nanopb/tests/missing_fields')
-rw-r--r--CAN-binder/libs/nanopb/tests/missing_fields/SConscript8
-rw-r--r--CAN-binder/libs/nanopb/tests/missing_fields/missing_fields.c53
-rw-r--r--CAN-binder/libs/nanopb/tests/missing_fields/missing_fields.proto140
3 files changed, 0 insertions, 201 deletions
diff --git a/CAN-binder/libs/nanopb/tests/missing_fields/SConscript b/CAN-binder/libs/nanopb/tests/missing_fields/SConscript
deleted file mode 100644
index 86ba0833..00000000
--- a/CAN-binder/libs/nanopb/tests/missing_fields/SConscript
+++ /dev/null
@@ -1,8 +0,0 @@
-# Check that the decoder properly detects when required fields are missing.
-
-Import("env")
-
-env.NanopbProto("missing_fields")
-test = env.Program(["missing_fields.c", "missing_fields.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"])
-env.RunTest(test)
-
diff --git a/CAN-binder/libs/nanopb/tests/missing_fields/missing_fields.c b/CAN-binder/libs/nanopb/tests/missing_fields/missing_fields.c
deleted file mode 100644
index 8aded827..00000000
--- a/CAN-binder/libs/nanopb/tests/missing_fields/missing_fields.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Checks that missing required fields are detected properly */
-
-#include <stdio.h>
-#include <pb_encode.h>
-#include <pb_decode.h>
-#include "missing_fields.pb.h"
-
-int main()
-{
- uint8_t buffer[512];
- size_t size;
-
- /* Create a message with one missing field */
- {
- MissingField msg = {0};
- pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
-
- if (!pb_encode(&stream, MissingField_fields, &msg))
- {
- printf("Encode failed.\n");
- return 1;
- }
-
- size = stream.bytes_written;
- }
-
- /* Test that it decodes properly if we don't require that field */
- {
- MissingField msg = {0};
- pb_istream_t stream = pb_istream_from_buffer(buffer, size);
-
- if (!pb_decode(&stream, MissingField_fields, &msg))
- {
- printf("Decode failed: %s\n", PB_GET_ERROR(&stream));
- return 2;
- }
- }
-
- /* Test that it does *not* decode properly if we require the field */
- {
- AllFields msg = {0};
- pb_istream_t stream = pb_istream_from_buffer(buffer, size);
-
- if (pb_decode(&stream, AllFields_fields, &msg))
- {
- printf("Decode didn't detect missing field.\n");
- return 3;
- }
- }
-
- return 0; /* All ok */
-}
-
diff --git a/CAN-binder/libs/nanopb/tests/missing_fields/missing_fields.proto b/CAN-binder/libs/nanopb/tests/missing_fields/missing_fields.proto
deleted file mode 100644
index cc5e550b..00000000
--- a/CAN-binder/libs/nanopb/tests/missing_fields/missing_fields.proto
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Test for one missing field among many */
-
-syntax = "proto2";
-
-message AllFields
-{
- required int32 field1 = 1;
- required int32 field2 = 2;
- required int32 field3 = 3;
- required int32 field4 = 4;
- required int32 field5 = 5;
- required int32 field6 = 6;
- required int32 field7 = 7;
- required int32 field8 = 8;
- required int32 field9 = 9;
- required int32 field10 = 10;
- required int32 field11 = 11;
- required int32 field12 = 12;
- required int32 field13 = 13;
- required int32 field14 = 14;
- required int32 field15 = 15;
- required int32 field16 = 16;
- required int32 field17 = 17;
- required int32 field18 = 18;
- required int32 field19 = 19;
- required int32 field20 = 20;
- required int32 field21 = 21;
- required int32 field22 = 22;
- required int32 field23 = 23;
- required int32 field24 = 24;
- required int32 field25 = 25;
- required int32 field26 = 26;
- required int32 field27 = 27;
- required int32 field28 = 28;
- required int32 field29 = 29;
- required int32 field30 = 30;
- required int32 field31 = 31;
- required int32 field32 = 32;
- required int32 field33 = 33;
- required int32 field34 = 34;
- required int32 field35 = 35;
- required int32 field36 = 36;
- required int32 field37 = 37;
- required int32 field38 = 38;
- required int32 field39 = 39;
- required int32 field40 = 40;
- required int32 field41 = 41;
- required int32 field42 = 42;
- required int32 field43 = 43;
- required int32 field44 = 44;
- required int32 field45 = 45;
- required int32 field46 = 46;
- required int32 field47 = 47;
- required int32 field48 = 48;
- required int32 field49 = 49;
- required int32 field50 = 50;
- required int32 field51 = 51;
- required int32 field52 = 52;
- required int32 field53 = 53;
- required int32 field54 = 54;
- required int32 field55 = 55;
- required int32 field56 = 56;
- required int32 field57 = 57;
- required int32 field58 = 58;
- required int32 field59 = 59;
- required int32 field60 = 60;
- required int32 field61 = 61;
- required int32 field62 = 62;
- required int32 field63 = 63;
- required int32 field64 = 64;
-}
-
-message MissingField
-{
- required int32 field1 = 1;
- required int32 field2 = 2;
- required int32 field3 = 3;
- required int32 field4 = 4;
- required int32 field5 = 5;
- required int32 field6 = 6;
- required int32 field7 = 7;
- required int32 field8 = 8;
- required int32 field9 = 9;
- required int32 field10 = 10;
- required int32 field11 = 11;
- required int32 field12 = 12;
- required int32 field13 = 13;
- required int32 field14 = 14;
- required int32 field15 = 15;
- required int32 field16 = 16;
- required int32 field17 = 17;
- required int32 field18 = 18;
- required int32 field19 = 19;
- required int32 field20 = 20;
- required int32 field21 = 21;
- required int32 field22 = 22;
- required int32 field23 = 23;
- required int32 field24 = 24;
- required int32 field25 = 25;
- required int32 field26 = 26;
- required int32 field27 = 27;
- required int32 field28 = 28;
- required int32 field29 = 29;
- required int32 field30 = 30;
- required int32 field31 = 31;
- required int32 field32 = 32;
- required int32 field33 = 33;
- required int32 field34 = 34;
- required int32 field35 = 35;
- required int32 field36 = 36;
- required int32 field37 = 37;
- required int32 field38 = 38;
- required int32 field39 = 39;
- required int32 field40 = 40;
- required int32 field41 = 41;
- required int32 field42 = 42;
- required int32 field43 = 43;
- required int32 field44 = 44;
- required int32 field45 = 45;
- required int32 field46 = 46;
- required int32 field47 = 47;
- required int32 field48 = 48;
- required int32 field49 = 49;
- required int32 field50 = 50;
- required int32 field51 = 51;
- required int32 field52 = 52;
- required int32 field53 = 53;
- required int32 field54 = 54;
- required int32 field55 = 55;
- required int32 field56 = 56;
- required int32 field57 = 57;
- required int32 field58 = 58;
- required int32 field59 = 59;
- required int32 field60 = 60;
- required int32 field61 = 61;
- required int32 field62 = 62;
-/* required int32 field63 = 63; */
- required int32 field64 = 64;
-}
-