From 46777274fed3d20d823c70e3eaf1eba5a815530d Mon Sep 17 00:00:00 2001 From: Vivek Ellur Date: Tue, 10 Nov 2015 14:44:14 -0800 Subject: [PATCH] eina: add test case for binbuf append function Summary: Added test case for eina_binbuf_append_buffer function Signed-off-by: Vivek Ellur Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3304 Signed-off-by: Cedric BAIL --- src/tests/eina/eina_test_binbuf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tests/eina/eina_test_binbuf.c b/src/tests/eina/eina_test_binbuf.c index 1b0de2873c..ce778038f5 100644 --- a/src/tests/eina/eina_test_binbuf.c +++ b/src/tests/eina/eina_test_binbuf.c @@ -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));