Add support for inverted patterns in test framework.
[apps/agl-service-can-low-level.git] / tests / encode_unittests / encode_unittests.c
index fd9a730..06935f9 100644 (file)
@@ -1,8 +1,8 @@
-#define NANOPB_INTERNALS
+/* This includes the whole .c file to get access to static functions. */
+#include "pb_encode.c"
 
 #include <stdio.h>
 #include <string.h>
-#include "pb_encode.h"
 #include "unittests.h"
 #include "unittestproto.pb.h"
 
@@ -281,6 +281,15 @@ int main()
         TEST(WRITES(pb_encode_delimited(&s, IntegerContainer_fields, &msg),
                     "\x09\x0A\x07\x0A\x05\x01\x02\x03\x04\x05"))
     }
+
+    {
+        IntegerContainer msg = {{5, {1,2,3,4,5}}};
+        size_t size;
+        
+        COMMENT("Test pb_get_encoded_size.")
+        TEST(pb_get_encoded_size(&size, IntegerContainer_fields, &msg) &&
+             size == 9);
+    }
     
     {
         uint8_t buffer[10];