Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nanopb/nanopb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2022-08-05 19:56:52 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2022-08-05 19:56:52 +0300
commit404b2f072d46d53c12b87818b86b34ebb6ad1184 (patch)
treec67822f185d7a59c555a39ca97a5b016e18f0200 /tests
parent952f5fc317fdaf7d7c3d8e81243c0bb7cd5e5a45 (diff)
Move ENUMTYPE together with other enum defines & add test (#803)
Diffstat (limited to 'tests')
-rw-r--r--tests/enum_mapping/SConscript8
-rw-r--r--tests/enum_mapping/enum_mapping.expected3
-rw-r--r--tests/enum_mapping/enum_mapping.proto26
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/enum_mapping/SConscript b/tests/enum_mapping/SConscript
new file mode 100644
index 0000000..92c7eb5
--- /dev/null
+++ b/tests/enum_mapping/SConscript
@@ -0,0 +1,8 @@
+# Test generated ENUMTYPE defines
+
+Import('env')
+
+env.NanopbProto('enum_mapping')
+env.Object("enum_mapping.pb.c")
+env.Match(["enum_mapping.pb.h", "enum_mapping.expected"])
+
diff --git a/tests/enum_mapping/enum_mapping.expected b/tests/enum_mapping/enum_mapping.expected
new file mode 100644
index 0000000..fd19de7
--- /dev/null
+++ b/tests/enum_mapping/enum_mapping.expected
@@ -0,0 +1,3 @@
+define TestMsg_test1_ENUMTYPE TestEnum1
+define TestMsg_oneof1_test2_ENUMTYPE TestEnum2
+
diff --git a/tests/enum_mapping/enum_mapping.proto b/tests/enum_mapping/enum_mapping.proto
new file mode 100644
index 0000000..0e26096
--- /dev/null
+++ b/tests/enum_mapping/enum_mapping.proto
@@ -0,0 +1,26 @@
+syntax = "proto3";
+
+enum TestEnum1
+{
+ A = 0;
+ B = 2;
+ C = -3;
+}
+
+enum TestEnum2
+{
+ X = 0;
+ Y = 5;
+}
+
+message TestMsg
+{
+ TestEnum1 test1 = 1;
+
+ oneof oneof1
+ {
+ TestEnum2 test2 = 2;
+ }
+}
+
+