summaryrefslogtreecommitdiffstats
path: root/tests/backwards_compatibility
diff options
context:
space:
mode:
Diffstat (limited to 'tests/backwards_compatibility')
-rw-r--r--tests/backwards_compatibility/SConscript11
-rw-r--r--tests/backwards_compatibility/alltypes_legacy.c2
-rw-r--r--tests/backwards_compatibility/decode_legacy.c10
-rw-r--r--tests/backwards_compatibility/encode_legacy.c8
4 files changed, 21 insertions, 10 deletions
diff --git a/tests/backwards_compatibility/SConscript b/tests/backwards_compatibility/SConscript
new file mode 100644
index 00000000..5fb978f3
--- /dev/null
+++ b/tests/backwards_compatibility/SConscript
@@ -0,0 +1,11 @@
+# Check that the old generated .pb.c/.pb.h files are still compatible with the
+# current version of nanopb.
+
+Import("env")
+
+enc = env.Program(["encode_legacy.c", "alltypes_legacy.c", "#common/pb_encode.o"])
+dec = env.Program(["decode_legacy.c", "alltypes_legacy.c", "#common/pb_decode.o"])
+
+env.RunTest(enc)
+env.RunTest([dec, "encode_legacy.output"])
+
diff --git a/tests/backwards_compatibility/alltypes_legacy.c b/tests/backwards_compatibility/alltypes_legacy.c
index b144b1e3..9134d5e6 100644
--- a/tests/backwards_compatibility/alltypes_legacy.c
+++ b/tests/backwards_compatibility/alltypes_legacy.c
@@ -5,7 +5,7 @@
* incompatible changes made to the generator in future versions.
*/
-#include "bc_alltypes.pb.h"
+#include "alltypes_legacy.h"
const char SubMessage_substuff1_default[16] = "1";
const int32_t SubMessage_substuff2_default = 2;
diff --git a/tests/backwards_compatibility/decode_legacy.c b/tests/backwards_compatibility/decode_legacy.c
index b74172fd..315b16ef 100644
--- a/tests/backwards_compatibility/decode_legacy.c
+++ b/tests/backwards_compatibility/decode_legacy.c
@@ -1,16 +1,16 @@
/* Tests the decoding of all types.
- * This is a backwards-compatibility test, using bc_alltypes.pb.h.
- * It is similar to test_decode3, but duplicated in order to allow
- * test_decode3 to test any new features introduced later.
+ * This is a backwards-compatibility test, using alltypes_legacy.h.
+ * It is similar to decode_alltypes, but duplicated in order to allow
+ * decode_alltypes to test any new features introduced later.
*
- * Run e.g. ./bc_encode | ./bc_decode
+ * Run e.g. ./encode_legacy | ./decode_legacy
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pb_decode.h>
-#include "bc_alltypes.pb.h"
+#include "alltypes_legacy.h"
#define TEST(x) if (!(x)) { \
printf("Test " #x " failed.\n"); \
diff --git a/tests/backwards_compatibility/encode_legacy.c b/tests/backwards_compatibility/encode_legacy.c
index e84f0908..0e313093 100644
--- a/tests/backwards_compatibility/encode_legacy.c
+++ b/tests/backwards_compatibility/encode_legacy.c
@@ -1,14 +1,14 @@
/* Attempts to test all the datatypes supported by ProtoBuf.
- * This is a backwards-compatibility test, using bc_alltypes.pb.h.
- * It is similar to test_encode3, but duplicated in order to allow
- * test_encode3 to test any new features introduced later.
+ * This is a backwards-compatibility test, using alltypes_legacy.h.
+ * It is similar to encode_alltypes, but duplicated in order to allow
+ * encode_alltypes to test any new features introduced later.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pb_encode.h>
-#include "bc_alltypes.pb.h"
+#include "alltypes_legacy.h"
int main(int argc, char **argv)
{