aboutsummaryrefslogtreecommitdiffstats
path: root/CAN-binder/libs/nanopb/tests/regression/issue_249
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/regression/issue_249
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/regression/issue_249')
-rw-r--r--CAN-binder/libs/nanopb/tests/regression/issue_249/SConscript12
-rw-r--r--CAN-binder/libs/nanopb/tests/regression/issue_249/test.c59
-rw-r--r--CAN-binder/libs/nanopb/tests/regression/issue_249/test.proto10
3 files changed, 0 insertions, 81 deletions
diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_249/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_249/SConscript
deleted file mode 100644
index ba667129..00000000
--- a/CAN-binder/libs/nanopb/tests/regression/issue_249/SConscript
+++ /dev/null
@@ -1,12 +0,0 @@
-# Regression test for Issue 249: proto3 mode pb_decode() corrupts callback fields
-Import('env')
-
-env.NanopbProto('test')
-
-p = env.Program(["test.c",
- "test.pb.c",
- "$COMMON/pb_decode.o",
- "$COMMON/pb_encode.o",
- "$COMMON/pb_common.o"])
-env.RunTest(p)
-
diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_249/test.c b/CAN-binder/libs/nanopb/tests/regression/issue_249/test.c
deleted file mode 100644
index a37180fd..00000000
--- a/CAN-binder/libs/nanopb/tests/regression/issue_249/test.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "test.pb.h"
-#include <unittests.h>
-#include <pb_encode.h>
-#include <pb_decode.h>
-
-static bool write_array(pb_ostream_t *stream, const pb_field_t *field, void * const *arg)
-{
- int i;
- for (i = 0; i < 5; i++)
- {
- if (!pb_encode_tag_for_field(stream, field))
- return false;
- if (!pb_encode_varint(stream, 1000 + i))
- return false;
- }
-
- return true;
-}
-
-static bool read_array(pb_istream_t *stream, const pb_field_t *field, void **arg)
-{
- uint32_t i;
- int *sum = *arg;
-
- if (!pb_decode_varint32(stream, &i))
- return false;
-
- *sum += i;
-
- return true;
-}
-
-int main()
-{
- int status = 0;
- pb_byte_t buf[128] = {0};
- pb_size_t msglen;
-
- {
- MainMessage msg = MainMessage_init_zero;
- pb_ostream_t stream = pb_ostream_from_buffer(buf, sizeof(buf));
- msg.submsg.foo.funcs.encode = &write_array;
- TEST(pb_encode(&stream, MainMessage_fields, &msg));
- msglen = stream.bytes_written;
- }
-
- {
- MainMessage msg = MainMessage_init_zero;
- pb_istream_t stream = pb_istream_from_buffer(buf, msglen);
- int sum = 0;
- msg.submsg.foo.funcs.decode = &read_array;
- msg.submsg.foo.arg = &sum;
- TEST(pb_decode(&stream, MainMessage_fields, &msg));
- TEST(sum == 1000 + 1001 + 1002 + 1003 + 1004);
- }
-
- return status;
-}
-
diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_249/test.proto b/CAN-binder/libs/nanopb/tests/regression/issue_249/test.proto
deleted file mode 100644
index eaa2abde..00000000
--- a/CAN-binder/libs/nanopb/tests/regression/issue_249/test.proto
+++ /dev/null
@@ -1,10 +0,0 @@
-syntax = "proto3";
-
-message SubMessage {
- repeated int32 foo = 1;
-}
-
-message MainMessage {
- SubMessage submsg = 1;
-}
-