diff options
Diffstat (limited to 'CAN-binder/libs/nanopb/tests/regression')
54 files changed, 0 insertions, 807 deletions
diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_118/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_118/SConscript deleted file mode 100644 index 833d9de..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_118/SConscript +++ /dev/null @@ -1,12 +0,0 @@ -# Regression test for Issue 118: Short enum names in imported proto files are not honoured - -Import("env") -env = env.Clone() -env.Append(PROTOCPATH = "#regression/issue_118") - -env.NanopbProto("enumdef") -env.Object('enumdef.pb.c') - -env.NanopbProto(["enumuse", "enumdef.proto"]) -env.Object('enumuse.pb.c') - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_118/enumdef.proto b/CAN-binder/libs/nanopb/tests/regression/issue_118/enumdef.proto deleted file mode 100644 index 46845bc..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_118/enumdef.proto +++ /dev/null @@ -1,8 +0,0 @@ -syntax = "proto2"; - -import 'nanopb.proto'; - -enum MyEnum { - option (nanopb_enumopt).long_names = false; - FOOBAR = 1; -} diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_118/enumuse.proto b/CAN-binder/libs/nanopb/tests/regression/issue_118/enumuse.proto deleted file mode 100644 index 4afc452..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_118/enumuse.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto2"; - -import 'enumdef.proto'; - -message MyMessage { - required MyEnum myenum = 1 [default = FOOBAR]; -} diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_125/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_125/SConscript deleted file mode 100644 index f2155e6..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_125/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -# Regression test for Issue 125: Wrong identifier name for extension fields - -Import("env") - -env.NanopbProto(["extensionbug", "extensionbug.options"]) -env.Object('extensionbug.pb.c') - -env.Match(['extensionbug.pb.h', 'extensionbug.expected']) - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_125/extensionbug.expected b/CAN-binder/libs/nanopb/tests/regression/issue_125/extensionbug.expected deleted file mode 100644 index fc21335..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_125/extensionbug.expected +++ /dev/null @@ -1,3 +0,0 @@ -pb_extension_type_t Message2_extras -uint32_t field2 - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_125/extensionbug.options b/CAN-binder/libs/nanopb/tests/regression/issue_125/extensionbug.options deleted file mode 100644 index 30b464a..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_125/extensionbug.options +++ /dev/null @@ -1,4 +0,0 @@ -* type:FT_IGNORE - -Message2.extras type:FT_STATIC -Message2.field2 type:FT_STATIC diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_125/extensionbug.proto b/CAN-binder/libs/nanopb/tests/regression/issue_125/extensionbug.proto deleted file mode 100644 index fd1e74f..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_125/extensionbug.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto2"; - -message Message1 -{ - optional uint32 fieldA = 1; - extensions 30 to max; -} - -message Message2 -{ - extend Message1 - { - optional Message2 extras = 30; - } - - optional uint32 field1 = 1; - optional uint32 field2 = 2; -} diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_141/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_141/SConscript deleted file mode 100644 index b6526be..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_141/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -# Regression test for issue 141: wrong encoded size #define for oneof messages - -Import("env") - -env.NanopbProto("testproto") -env.Object('testproto.pb.c') -env.Match(['testproto.pb.h', 'testproto.expected']) - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_141/testproto.expected b/CAN-binder/libs/nanopb/tests/regression/issue_141/testproto.expected deleted file mode 100644 index 75bc195..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_141/testproto.expected +++ /dev/null @@ -1,7 +0,0 @@ -define SubMessage_size \s* 88 -define OneOfMessage_size \s* 113 -define topMessage_size \s* 70 -define MyMessage1_size \s* 46 -define MyMessage2_size \s* 8 -define MyMessage3_size \s* 5 -define MyMessage4_size \s* 18 diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_141/testproto.proto b/CAN-binder/libs/nanopb/tests/regression/issue_141/testproto.proto deleted file mode 100644 index a445c68..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_141/testproto.proto +++ /dev/null @@ -1,52 +0,0 @@ -syntax = "proto2"; - -import 'nanopb.proto'; - -message SubMessage -{ - repeated int32 array = 1 [(nanopb).max_count = 8]; -} - -message OneOfMessage -{ - required int32 prefix = 1; - oneof values - { - int32 first = 5; - string second = 6 [(nanopb).max_size = 8]; - SubMessage third = 7; - } - required int32 suffix = 99; -} - -message topMessage { - required int32 start = 1; - oneof msg { - MyMessage1 msg1 = 2; - MyMessage2 msg2 = 3; - } - required int32 end = 4; -} - -message MyMessage1 { - required uint32 n1 = 1; - required uint32 n2 = 2; - required string s = 3 [(nanopb).max_size = 32]; -} - -message MyMessage2 { - required uint32 num = 1; - required bool b = 2; -} - -message MyMessage3 { - required bool bbb = 1; - required string ss = 2 [(nanopb).max_size = 1]; -} - -message MyMessage4 { - required bool bbbb = 1; - required string sss = 2 [(nanopb).max_size = 2]; - required uint32 num = 3; - required uint32 num2 = 4; -} diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_145/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_145/SConscript deleted file mode 100644 index 0b793a7..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_145/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -# Regression test for Issue 145: Allow /* */ and // comments in .options files - -Import("env") - -env.NanopbProto(["comments", "comments.options"]) -env.Object('comments.pb.c') - -env.Match(['comments.pb.h', 'comments.expected']) - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_145/comments.expected b/CAN-binder/libs/nanopb/tests/regression/issue_145/comments.expected deleted file mode 100644 index 7f87458..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_145/comments.expected +++ /dev/null @@ -1,3 +0,0 @@ -char foo\[5\]; -char bar\[16\]; - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_145/comments.options b/CAN-binder/libs/nanopb/tests/regression/issue_145/comments.options deleted file mode 100644 index 89959ba..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_145/comments.options +++ /dev/null @@ -1,6 +0,0 @@ -/* Block comment */ -# Line comment -// Line comment -DummyMessage.foo /* Block comment */ max_size:5 -DummyMessage.bar max_size:16 # Line comment ### - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_145/comments.proto b/CAN-binder/libs/nanopb/tests/regression/issue_145/comments.proto deleted file mode 100644 index 621779f..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_145/comments.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto2"; - -message DummyMessage { - required string foo = 1; - required string bar = 2; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_166/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_166/SConscript deleted file mode 100644 index c50b919..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_166/SConscript +++ /dev/null @@ -1,13 +0,0 @@ -# Verify that the maximum encoded size is calculated properly -# for enums. - -Import('env') - -env.NanopbProto('enums') - -p = env.Program(["enum_encoded_size.c", - "enums.pb.c", - "$COMMON/pb_encode.o", - "$COMMON/pb_common.o"]) -env.RunTest(p) - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_166/enum_encoded_size.c b/CAN-binder/libs/nanopb/tests/regression/issue_166/enum_encoded_size.c deleted file mode 100644 index 84e1c7d..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_166/enum_encoded_size.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <pb_encode.h> -#include "unittests.h" -#include "enums.pb.h" - -int main() -{ - int status = 0; - - uint8_t buf[256]; - SignedMsg msg1; - UnsignedMsg msg2; - pb_ostream_t s; - - { - COMMENT("Test negative value of signed enum"); - /* Negative value should take up the maximum size */ - msg1.value = SignedEnum_SE_MIN; - s = pb_ostream_from_buffer(buf, sizeof(buf)); - TEST(pb_encode(&s, SignedMsg_fields, &msg1)); - TEST(s.bytes_written == SignedMsg_size); - - COMMENT("Test positive value of signed enum"); - /* Positive value should be smaller */ - msg1.value = SignedEnum_SE_MAX; - s = pb_ostream_from_buffer(buf, sizeof(buf)); - TEST(pb_encode(&s, SignedMsg_fields, &msg1)); - TEST(s.bytes_written < SignedMsg_size); - } - - { - COMMENT("Test positive value of unsigned enum"); - /* This should take up the maximum size */ - msg2.value = UnsignedEnum_UE_MAX; - s = pb_ostream_from_buffer(buf, sizeof(buf)); - TEST(pb_encode(&s, UnsignedMsg_fields, &msg2)); - TEST(s.bytes_written == UnsignedMsg_size); - } - - return status; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_166/enums.proto b/CAN-binder/libs/nanopb/tests/regression/issue_166/enums.proto deleted file mode 100644 index 3694804..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_166/enums.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto2"; - -enum SignedEnum { - SE_MIN = -1; - SE_MAX = 255; -} - -enum UnsignedEnum { - UE_MAX = 65536; -} - -message SignedMsg { - required SignedEnum value = 1; -} - -message UnsignedMsg { - required UnsignedEnum value = 1; -} diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_172/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_172/SConscript deleted file mode 100644 index 49c919e..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_172/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -# Verify that _size define is generated for messages that have -# includes from another directory. - -Import('env') - -incpath = env.Clone() -incpath.Append(PROTOCPATH="#regression/issue_172/submessage") -incpath.Append(CPPPATH="$BUILD/regression/issue_172/submessage") -incpath.NanopbProto('test') -incpath.NanopbProto(['submessage/submessage', 'submessage/submessage.options']) - -p = incpath.Program(["msg_size.c", - "test.pb.c", - "submessage/submessage.pb.c"]) - - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_172/msg_size.c b/CAN-binder/libs/nanopb/tests/regression/issue_172/msg_size.c deleted file mode 100644 index be45acb..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_172/msg_size.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "test.pb.h" - -PB_STATIC_ASSERT(testmessage_size >= 1+1+1+1+16, TESTMESSAGE_SIZE_IS_WRONG) - -int main() -{ - return 0; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_172/submessage/submessage.options b/CAN-binder/libs/nanopb/tests/regression/issue_172/submessage/submessage.options deleted file mode 100644 index 12fb198..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_172/submessage/submessage.options +++ /dev/null @@ -1 +0,0 @@ -submessage.data max_size: 16 diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_172/submessage/submessage.proto b/CAN-binder/libs/nanopb/tests/regression/issue_172/submessage/submessage.proto deleted file mode 100644 index ce6804a..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_172/submessage/submessage.proto +++ /dev/null @@ -1,4 +0,0 @@ -syntax = "proto2"; -message submessage { - required bytes data = 1; -} diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_172/test.proto b/CAN-binder/libs/nanopb/tests/regression/issue_172/test.proto deleted file mode 100644 index fbd97be..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_172/test.proto +++ /dev/null @@ -1,6 +0,0 @@ -syntax = "proto2"; -import "submessage.proto"; - -message testmessage { - optional submessage sub = 1; -} diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_188/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_188/SConscript deleted file mode 100644 index 6bc3271..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_188/SConscript +++ /dev/null @@ -1,6 +0,0 @@ -# Regression test for issue with Enums inside OneOf. - -Import('env') - -env.NanopbProto('oneof') - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_188/oneof.proto b/CAN-binder/libs/nanopb/tests/regression/issue_188/oneof.proto deleted file mode 100644 index e37f5c0..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_188/oneof.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto2"; - -message MessageOne -{ - required uint32 one = 1; - required uint32 two = 2; - required uint32 three = 3; - required int32 four = 4; -} - -enum EnumTwo -{ - SOME_ENUM_1 = 1; - SOME_ENUM_2 = 5; - SOME_ENUM_3 = 6; - SOME_ENUM_4 = 9; - SOME_ENUM_5 = 10; - SOME_ENUM_6 = 12; - SOME_ENUM_7 = 39; - SOME_ENUM_8 = 401; -} - -message OneofMessage -{ - oneof payload { - MessageOne message = 1; - EnumTwo enum = 2; - } -} diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_195/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_195/SConscript deleted file mode 100644 index 78326d3..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_195/SConscript +++ /dev/null @@ -1,10 +0,0 @@ -# Regression test for Issue 195: Message size not calculated if a submessage includes -# bytes. Basically a non-working #define being generated. - -Import("env") - -env.NanopbProto(["test"]) -env.Object('test.pb.c') - -env.Match(['test.pb.h', 'test.expected']) - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_195/test.expected b/CAN-binder/libs/nanopb/tests/regression/issue_195/test.expected deleted file mode 100644 index 83ea7ab..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_195/test.expected +++ /dev/null @@ -1 +0,0 @@ -/\* TestMessage_size depends diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_195/test.proto b/CAN-binder/libs/nanopb/tests/regression/issue_195/test.proto deleted file mode 100644 index 7a77d69..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_195/test.proto +++ /dev/null @@ -1,8 +0,0 @@ -message TestMessage { - required uint32 id = 1; - required bytes payload = 2; -} -message EncapsulatedMessage { - required uint32 id = 1; - required TestMessage test = 2; -} diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_203/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_203/SConscript deleted file mode 100644 index 8b4d6cc..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_203/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -# Regression test for issue with multiple files generated at once - -Import('env') - -env.Command(['file1.pb.c', 'file1.pb.h', 'file2.pb.c', 'file2.pb.h'], ['file1.proto', 'file2.proto'], - env['NANOPB_PROTO_CMD']) - -env.Object('file1.pb.c') -env.Object('file2.pb.c') diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_203/file1.proto b/CAN-binder/libs/nanopb/tests/regression/issue_203/file1.proto deleted file mode 100644 index dae250b..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_203/file1.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto2"; - -message SubMessage1 { - required int32 foo = 1; -} - -message Message1 { - required SubMessage1 bar = 1; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_203/file2.proto b/CAN-binder/libs/nanopb/tests/regression/issue_203/file2.proto deleted file mode 100644 index 513b0f0..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_203/file2.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto2"; - -message SubMessage2 { - required int32 foo = 1; -} - -message Message2 { - required SubMessage2 bar = 1; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_205/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_205/SConscript deleted file mode 100644 index ed8899d..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_205/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# Check that pb_release() correctly handles corrupted size fields of -# static arrays. - -Import('env', 'malloc_env') - -env.NanopbProto('size_corruption') - -p = malloc_env.Program(["size_corruption.c", - "size_corruption.pb.c", - "$COMMON/pb_decode_with_malloc.o", - "$COMMON/pb_common_with_malloc.o", - "$COMMON/malloc_wrappers.o"]) -env.RunTest(p) - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_205/size_corruption.c b/CAN-binder/libs/nanopb/tests/regression/issue_205/size_corruption.c deleted file mode 100644 index 08cef45..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_205/size_corruption.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "size_corruption.pb.h" -#include <pb_decode.h> - -int main() -{ - MainMessage msg = MainMessage_init_zero; - msg.bar_count = (pb_size_t)-1; - pb_release(MainMessage_fields, &msg); - - return 0; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_205/size_corruption.proto b/CAN-binder/libs/nanopb/tests/regression/issue_205/size_corruption.proto deleted file mode 100644 index 6c9c245..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_205/size_corruption.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto2"; -import 'nanopb.proto'; - -message SubMessage { - repeated int32 foo = 1 [(nanopb).type = FT_POINTER]; -} - -message MainMessage { - repeated SubMessage bar = 1 [(nanopb).max_count = 5]; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_227/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_227/SConscript deleted file mode 100644 index 1074124..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_227/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# Regression test for Issue 227:Using proto3 type fields can cause unaligned access -# NOTE: This test will only detect problems when run with clang sanitizer (which -# is done regularly by a jenkins run). - -Import('env') - -env.NanopbProto('unaligned_uint64') - -p = env.Program(["unaligned_uint64.c", - "unaligned_uint64.pb.c", - "$COMMON/pb_encode.o", - "$COMMON/pb_common.o"]) -env.RunTest(p) - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_227/unaligned_uint64.c b/CAN-binder/libs/nanopb/tests/regression/issue_227/unaligned_uint64.c deleted file mode 100644 index 17c1d77..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_227/unaligned_uint64.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "unaligned_uint64.pb.h" -#include <pb_encode.h> - -int main() -{ - uint8_t buf[128]; - pb_ostream_t stream = pb_ostream_from_buffer(buf, sizeof(buf)); - MainMessage msg = MainMessage_init_zero; - msg.bar[0] = 'A'; - pb_encode(&stream, MainMessage_fields, &msg); - - return 0; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_227/unaligned_uint64.proto b/CAN-binder/libs/nanopb/tests/regression/issue_227/unaligned_uint64.proto deleted file mode 100644 index f0269f6..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_227/unaligned_uint64.proto +++ /dev/null @@ -1,8 +0,0 @@ -syntax = "proto3"; -import 'nanopb.proto'; - -message MainMessage { - string foo = 1 [(nanopb).max_size = 3]; - string bar = 2 [(nanopb).max_size = 8]; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_229/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_229/SConscript deleted file mode 100644 index b0f8376..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_229/SConscript +++ /dev/null @@ -1,13 +0,0 @@ -# Regression test for Issue 229: problem encoding message that has -# multiple oneof fields -Import('env') - -env.NanopbProto('multiple_oneof') - -p = env.Program(["multiple_oneof.c", - "multiple_oneof.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_229/multiple_oneof.c b/CAN-binder/libs/nanopb/tests/regression/issue_229/multiple_oneof.c deleted file mode 100644 index 902248d..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_229/multiple_oneof.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "multiple_oneof.pb.h" -#include <unittests.h> -#include <pb_encode.h> -#include <pb_decode.h> - -int main() -{ - int status = 0; - uint8_t buf[128]; - size_t msglen; - - { - pb_ostream_t stream = pb_ostream_from_buffer(buf, sizeof(buf)); - MainMessage msg = MainMessage_init_zero; - msg.which_oneof1 = MainMessage_oneof1_uint32_tag; - msg.oneof1.oneof1_uint32 = 1234; - msg.which_oneof2 = MainMessage_oneof2_uint32_tag; - msg.oneof2.oneof2_uint32 = 5678; - TEST(pb_encode(&stream, MainMessage_fields, &msg)); - msglen = stream.bytes_written; - } - - { - pb_istream_t stream = pb_istream_from_buffer(buf, msglen); - MainMessage msg = MainMessage_init_zero; - TEST(pb_decode(&stream, MainMessage_fields, &msg)); - TEST(msg.which_oneof1 == MainMessage_oneof1_uint32_tag); - TEST(msg.oneof1.oneof1_uint32 == 1234); - TEST(msg.which_oneof2 == MainMessage_oneof2_uint32_tag); - TEST(msg.oneof2.oneof2_uint32 == 5678); - } - - return status; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_229/multiple_oneof.proto b/CAN-binder/libs/nanopb/tests/regression/issue_229/multiple_oneof.proto deleted file mode 100644 index 22373e1..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_229/multiple_oneof.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto2"; - -message MainMessage { - oneof oneof1 { - uint32 oneof1_uint32 = 1; - } - oneof oneof2 { - uint32 oneof2_uint32 = 2; - } -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_242/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_242/SConscript deleted file mode 100644 index 000063e..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_242/SConscript +++ /dev/null @@ -1,13 +0,0 @@ -# Regression test for Issue 242: pb_encode does not encode tag for -# extension fields that is all zeros -Import('env') - -env.NanopbProto('zero_value') - -p = env.Program(["zero_value.c", - "zero_value.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_242/zero_value.c b/CAN-binder/libs/nanopb/tests/regression/issue_242/zero_value.c deleted file mode 100644 index b3d96b7..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_242/zero_value.c +++ /dev/null @@ -1,51 +0,0 @@ -#include <unittests.h> -#include <pb_encode.h> -#include <pb_decode.h> -#include <string.h> -#include "zero_value.pb.h" - -int main() -{ - int status = 0; - - COMMENT("Test extension fields with zero values"); - { - uint8_t buffer[256] = {0}; - pb_ostream_t ostream; - int32_t value = 0; - Extendable source = {0}; - - pb_extension_t source_ext = {0}; - source_ext.type = &opt_int32; - source_ext.dest = &value; - source.extensions = &source_ext; - - ostream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - TEST(pb_encode(&ostream, Extendable_fields, &source)); - - TEST(ostream.bytes_written == 2); - TEST(memcmp(buffer, "\x58\x00", 2) == 0); - } - - /* Note: There never was a bug here, but this check is included - * in the regression test because the logic is closely related. - */ - COMMENT("Test pointer fields with zero values"); - { - uint8_t buffer[256] = {0}; - pb_ostream_t ostream; - int32_t value = 0; - PointerMessage source = {0}; - - source.opt_int32 = &value; - - ostream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - TEST(pb_encode(&ostream, PointerMessage_fields, &source)); - - TEST(ostream.bytes_written == 2); - TEST(memcmp(buffer, "\x58\x00", 2) == 0); - } - - return status; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_242/zero_value.proto b/CAN-binder/libs/nanopb/tests/regression/issue_242/zero_value.proto deleted file mode 100644 index 020a39a..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_242/zero_value.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto2"; -import "nanopb.proto"; - -message Extendable { - extensions 10 to 100; -} - -extend Extendable { - optional int32 opt_int32 = 11; -} - -message PointerMessage { - optional int32 opt_int32 = 11 [(nanopb).type = FT_POINTER]; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_247/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_247/SConscript deleted file mode 100644 index b41e9f2..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_247/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# Test that pb_check_proto3_default_value() correctly skips padding -# bytes in submessage structures. - -Import("env") - -env.NanopbProto("padding") - -p = env.Program(["padding.c", - "padding.pb.c", - "$COMMON/pb_encode.o", - "$COMMON/pb_common.o"]) - -env.RunTest(p) - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_247/padding.c b/CAN-binder/libs/nanopb/tests/regression/issue_247/padding.c deleted file mode 100644 index 8860179..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_247/padding.c +++ /dev/null @@ -1,32 +0,0 @@ -#include <pb_encode.h> -#include <unittests.h> -#include <string.h> -#include "padding.pb.h" - -int main() -{ - int status = 0; - - TestMessage msg; - - /* Set padding bytes to garbage */ - memset(&msg, 0xAA, sizeof(msg)); - - /* Set all meaningful fields to 0 */ - msg.submsg.boolfield = false; - msg.submsg.intfield = 0; - - /* Test encoding */ - { - pb_byte_t buf[128] = {0}; - pb_ostream_t stream = pb_ostream_from_buffer(buf, sizeof(buf)); - TEST(pb_encode(&stream, TestMessage_fields, &msg)); - - /* Because all fields have zero values, proto3 encoder - * shouldn't write out anything. */ - TEST(stream.bytes_written == 0); - } - - return status; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_247/padding.proto b/CAN-binder/libs/nanopb/tests/regression/issue_247/padding.proto deleted file mode 100644 index 20bddac..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_247/padding.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -import "nanopb.proto"; - -message SubMessage { - bool boolfield = 1; - int64 intfield = 2; -} - -message TestMessage { - SubMessage submsg = 1; -} - 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 ba66712..0000000 --- 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 a37180f..0000000 --- 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 = ∑ - 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 eaa2abd..0000000 --- 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; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_253/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_253/SConscript deleted file mode 100644 index 5a16948..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_253/SConscript +++ /dev/null @@ -1,15 +0,0 @@ -# Regression test for Issue 253: Wrong calculated message maximum size - -Import('env') - -env.NanopbProto('short_array') - -p = env.Program(['short_array.c', - 'short_array.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_253/short_array.c b/CAN-binder/libs/nanopb/tests/regression/issue_253/short_array.c deleted file mode 100644 index 5ed6c3f..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_253/short_array.c +++ /dev/null @@ -1,24 +0,0 @@ -#include <unittests.h> -#include <pb_encode.h> -#include "short_array.pb.h" - -int main() -{ - int status = 0; - - COMMENT("Test message length calculation for short arrays"); - { - uint8_t buffer[TestMessage_size] = {0}; - pb_ostream_t ostream = pb_ostream_from_buffer(buffer, TestMessage_size); - TestMessage msg = TestMessage_init_zero; - - msg.rep_uint32_count = 1; - msg.rep_uint32[0] = (1 << 31); - - TEST(pb_encode(&ostream, TestMessage_fields, &msg)); - TEST(ostream.bytes_written == TestMessage_size); - } - - return status; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_253/short_array.proto b/CAN-binder/libs/nanopb/tests/regression/issue_253/short_array.proto deleted file mode 100644 index 5a5d8a3..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_253/short_array.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto2"; -import "nanopb.proto"; - -message TestMessage { - repeated uint32 rep_uint32 = 1 [(nanopb).max_count = 1]; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_256/SConscript b/CAN-binder/libs/nanopb/tests/regression/issue_256/SConscript deleted file mode 100644 index b2c3e86..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_256/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -# Regression test for Issue 256: Proto3 mode skips submessages even when -# later array fields have non-zero value - -Import('env') - -env.NanopbProto('submsg_array') - -p = env.Program(['submsg_array.c', - 'submsg_array.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_256/submsg_array.c b/CAN-binder/libs/nanopb/tests/regression/issue_256/submsg_array.c deleted file mode 100644 index c63bd30..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_256/submsg_array.c +++ /dev/null @@ -1,38 +0,0 @@ -#include <unittests.h> -#include <pb_encode.h> -#include <pb_decode.h> -#include "submsg_array.pb.h" - -int main() -{ - int status = 0; - - COMMENT("Test encoding for submessage with array"); - { - uint8_t buffer[TestMessage_size] = {0}; - pb_ostream_t ostream = pb_ostream_from_buffer(buffer, TestMessage_size); - TestMessage msg = TestMessage_init_zero; - - msg.submsg.rep_uint32_count = 3; - msg.submsg.rep_uint32[0] = 0; - msg.submsg.rep_uint32[1] = 1; - msg.submsg.rep_uint32[2] = 2; - - TEST(pb_encode(&ostream, TestMessage_fields, &msg)); - TEST(ostream.bytes_written > 0); - - { - pb_istream_t istream = pb_istream_from_buffer(buffer, ostream.bytes_written); - TestMessage msg2 = TestMessage_init_zero; - - TEST(pb_decode(&istream, TestMessage_fields, &msg2)); - TEST(msg2.submsg.rep_uint32_count == 3); - TEST(msg2.submsg.rep_uint32[0] == 0); - TEST(msg2.submsg.rep_uint32[1] == 1); - TEST(msg2.submsg.rep_uint32[2] == 2); - } - } - - return status; -} - diff --git a/CAN-binder/libs/nanopb/tests/regression/issue_256/submsg_array.proto b/CAN-binder/libs/nanopb/tests/regression/issue_256/submsg_array.proto deleted file mode 100644 index 4964a05..0000000 --- a/CAN-binder/libs/nanopb/tests/regression/issue_256/submsg_array.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; -import "nanopb.proto"; - -message SubMessage { - repeated uint32 rep_uint32 = 1 [(nanopb).max_count = 3]; -} - -message TestMessage { - SubMessage submsg = 1; -} - |