fixed misaligned memory access in test_ucx_buffer_write

Fri, 11 Mar 2016 18:06:27 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 11 Mar 2016 18:06:27 +0100
changeset 219
2df780a4482b
parent 218
b20d6088795c
child 220
1f57f196d221

fixed misaligned memory access in test_ucx_buffer_write

test/buffer_tests.c file | annotate | diff | comparison | revisions
test/mpool_tests.c file | annotate | diff | comparison | revisions
--- a/test/buffer_tests.c	Fri Feb 26 16:33:04 2016 +0100
+++ b/test/buffer_tests.c	Fri Mar 11 18:06:27 2016 +0100
@@ -381,15 +381,19 @@
     UCX_TEST_ASSERT(memcmp(buffer, "    test string7\0\0", 18) == 0,
         "incorrect buffer content (test string)");
     
+    r = ucx_buffer_write(".", 1, 1, b);
+    UCX_TEST_ASSERT(r == 1, "returned incorrect number of written elements");
+    UCX_TEST_ASSERT(b->pos == 16, "incorrect position");
+    
     int32_t testarr[4] = {0x09abcdef, 0x05fedcba, 0x01abefcd, 0x3cd07ab};
     r = ucx_buffer_write(testarr, 4, 4, b);
     UCX_TEST_ASSERT(r = 4, "returned incorrect number of written elements");
-    UCX_TEST_ASSERT(b->pos == 31, "incorrect position");
+    UCX_TEST_ASSERT(b->pos == 32, "incorrect position");
     
     char cmp[32];
     memset(cmp, 0, 32);
-    memcpy(cmp, "    test string", 15);
-    int32_t *ptr = (int32_t*) (cmp+15);
+    memcpy(cmp, "    test string.", 16);
+    int32_t *ptr = (int32_t*) (cmp+16);
     ptr[0] = testarr[0];
     ptr[1] = testarr[1];
     ptr[2] = testarr[2];
--- a/test/mpool_tests.c	Fri Feb 26 16:33:04 2016 +0100
+++ b/test/mpool_tests.c	Fri Mar 11 18:06:27 2016 +0100
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <stdint.h>
+#include <inttypes.h>
 
 #include "mpool_tests.h"
 

mercurial