summaryrefslogtreecommitdiffstats
path: root/libs/nanopb/tests/message_sizes
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-06-20 10:24:05 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-20 10:24:05 +0000
commit32e25cbca210a359b09768537b6f443fe90a3070 (patch)
tree3309794c15d8a8f8e9c1c08cad072ee1378813ba /libs/nanopb/tests/message_sizes
parent76c43dec62b2e21cd6446360c00d4fe6b437533f (diff)
Separation Generator to a dedicated repo
Change-Id: Id94831651c3266861435272a6e36c7884bef2c45 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'libs/nanopb/tests/message_sizes')
-rw-r--r--libs/nanopb/tests/message_sizes/SConscript11
-rw-r--r--libs/nanopb/tests/message_sizes/dummy.c9
-rw-r--r--libs/nanopb/tests/message_sizes/messages1.proto29
-rw-r--r--libs/nanopb/tests/message_sizes/messages2.proto10
4 files changed, 59 insertions, 0 deletions
diff --git a/libs/nanopb/tests/message_sizes/SConscript b/libs/nanopb/tests/message_sizes/SConscript
new file mode 100644
index 00000000..e7524e02
--- /dev/null
+++ b/libs/nanopb/tests/message_sizes/SConscript
@@ -0,0 +1,11 @@
+# Test the generation of message size #defines
+
+Import('env')
+
+incpath = env.Clone()
+incpath.Append(PROTOCPATH = '#message_sizes')
+
+incpath.NanopbProto("messages1")
+incpath.NanopbProto("messages2")
+
+incpath.Program(['dummy.c', 'messages1.pb.c', 'messages2.pb.c'])
diff --git a/libs/nanopb/tests/message_sizes/dummy.c b/libs/nanopb/tests/message_sizes/dummy.c
new file mode 100644
index 00000000..767ad463
--- /dev/null
+++ b/libs/nanopb/tests/message_sizes/dummy.c
@@ -0,0 +1,9 @@
+/* Just test that the file can be compiled successfully. */
+
+#include "messages2.pb.h"
+
+int main()
+{
+ return xmit_size;
+}
+
diff --git a/libs/nanopb/tests/message_sizes/messages1.proto b/libs/nanopb/tests/message_sizes/messages1.proto
new file mode 100644
index 00000000..b66fad71
--- /dev/null
+++ b/libs/nanopb/tests/message_sizes/messages1.proto
@@ -0,0 +1,29 @@
+syntax = "proto2";
+
+enum MessageStatus {
+ FAIL = 0;
+ OK = 1;
+};
+
+message MessageInfo {
+ required fixed32 msg_id = 1;
+ optional fixed32 interface_id = 2;
+}
+
+message MessageResponseInfo {
+ required fixed64 interface_id = 1;
+ required fixed32 seq = 2;
+ required fixed32 msg_id = 3;
+}
+
+message MessageHeader {
+ required MessageInfo info = 1;
+ optional MessageResponseInfo response_info = 2;
+ optional MessageResponse response = 3;
+}
+
+message MessageResponse {
+ required MessageStatus status = 1;
+ required fixed32 seq = 2;
+}
+
diff --git a/libs/nanopb/tests/message_sizes/messages2.proto b/libs/nanopb/tests/message_sizes/messages2.proto
new file mode 100644
index 00000000..67614080
--- /dev/null
+++ b/libs/nanopb/tests/message_sizes/messages2.proto
@@ -0,0 +1,10 @@
+syntax = "proto2";
+
+import 'nanopb.proto';
+import 'messages1.proto';
+
+message xmit {
+ required MessageHeader header = 1;
+ required bytes data = 2 [(nanopb).max_size = 128];
+}
+