incpath = env.Clone()
incpath.Append(PROTOCPATH = '#multiple_files')
-incpath.NanopbProto("callbacks")
-incpath.NanopbProto("callbacks2")
-test = incpath.Program(["test_multiple_files.c", "callbacks.pb.c", "callbacks2.pb.c"])
+incpath.NanopbProto("multifile1")
+incpath.NanopbProto("multifile2")
+test = incpath.Program(["test_multiple_files.c", "multifile1.pb.c", "multifile2.pb.c"])
env.RunTest(test)
+++ /dev/null
-// Test if including generated header file for this file + implicit include of
-// callbacks.pb.h still compiles. Used with test_compiles.c.
-import "callbacks.proto";
-
-message Callback2Message {
- required TestMessage tstmsg = 1;
- required SubMessage submsg = 2;
-}
-
repeated string repeatedstring = 6;
}
+enum SignedEnum {
+ SE_MIN = -128;
+ SE_MAX = 127;
+}
+
+enum UnsignedEnum {
+ UE_MIN = 0;
+ UE_MAX = 255;
+}
+
+
+
--- /dev/null
+// Test if including generated header file for this file + implicit include of
+// multifile2.pb.h still compiles. Used with test_compiles.c.
+import "multifile1.proto";
+
+message Callback2Message {
+ required TestMessage tstmsg = 1;
+ required SubMessage submsg = 2;
+}
+
+message OneofMessage {
+ oneof msgs {
+ TestMessage tstmsg = 1;
+ SubMessage submsg = 2;
+ }
+}
+
+message Enums {
+ required SignedEnum senum = 1;
+ required UnsignedEnum uenum = 2;
+}
+
#include <stdio.h>
#include <pb_encode.h>
-#include "callbacks2.pb.h"
+#include "unittests.h"
+#include "multifile2.pb.h"
+
+/* Check that the size definition is obtained properly */
+static const int foo = OneofMessage_size;
int main()
{
- return 0;
+ int status = 0;
+
+ /* Check that enum signedness is detected properly */
+ TEST(PB_LTYPE(Enums_fields[0].type) == PB_LTYPE_VARINT);
+ TEST(PB_LTYPE(Enums_fields[0].type) == PB_LTYPE_UVARINT);
+
+ return status;
}