eina: add test case for binbuf append function
authorVivek Ellur <vivek.ellur@samsung.com>
Tue, 10 Nov 2015 22:44:14 +0000 (14:44 -0800)
committerCedric BAIL <cedric@osg.samsung.com>
Tue, 10 Nov 2015 22:44:17 +0000 (14:44 -0800)
Summary:
Added test case for eina_binbuf_append_buffer function

Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com>
Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3304

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/tests/eina/eina_test_binbuf.c

index 1b0de28..ce77803 100644 (file)
@@ -26,7 +26,7 @@
 
 START_TEST(binbuf_simple)
 {
-   Eina_Binbuf *buf;
+   Eina_Binbuf *buf, *test_buf;
    unsigned char *txt;
    const unsigned char cbuf[] = "Null in the middle \0 and more text afterwards and \0 anotehr null just there and another one \0 here.";
    size_t size = sizeof(cbuf) - 1; /* We don't care about the real NULL */
@@ -41,6 +41,12 @@ START_TEST(binbuf_simple)
    fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
    fail_if(size != eina_binbuf_length_get(buf));
 
+   test_buf = eina_binbuf_new();
+   fail_if(!test_buf);
+   fail_if(!eina_binbuf_append_buffer(test_buf, buf));
+   fail_if(memcmp(eina_binbuf_string_get(test_buf), cbuf, size));
+   fail_if(size != eina_binbuf_length_get(test_buf));
+
    eina_binbuf_append_length(buf, cbuf, size);
    fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
    fail_if(memcmp(eina_binbuf_string_get(buf) + size, cbuf, size));