From 8b1940763283357abec7d0b6aff5dd0f45b5bffc Mon Sep 17 00:00:00 2001 From: englebass Date: Tue, 9 Feb 2010 21:05:47 +0000 Subject: [PATCH] Add simple test for strbuf Need more git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@46024 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/tests/Makefile.am | 3 ++- src/tests/eina_suite.c | 1 + src/tests/eina_suite.h | 1 + src/tests/eina_test_strbuf.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/tests/eina_test_strbuf.c diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 30d69b1..c9948e0 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -60,7 +60,8 @@ eina_test_mempool.c \ eina_test_rectangle.c \ eina_test_list.c \ eina_test_matrixsparse.c \ -eina_test_tiler.c +eina_test_tiler.c \ +eina_test_strbuf.c eina_suite_LDADD = @CHECK_LIBS@ $(top_builddir)/src/lib/libeina.la diff --git a/src/tests/eina_suite.c b/src/tests/eina_suite.c index 4fdc7b4..1317bfc 100644 --- a/src/tests/eina_suite.c +++ b/src/tests/eina_suite.c @@ -55,6 +55,7 @@ static const Eina_Test_Case etc[] = { { "Rectangle", eina_test_rectangle }, { "Matrix Sparse", eina_test_matrixsparse }, { "Eina Tiler", eina_test_tiler }, + { "Eina Strbuf", eina_test_strbuf }, { NULL, NULL } }; diff --git a/src/tests/eina_suite.h b/src/tests/eina_suite.h index a2ad389..92b3969 100644 --- a/src/tests/eina_suite.h +++ b/src/tests/eina_suite.h @@ -43,5 +43,6 @@ void eina_test_mempool(TCase *tc); void eina_test_rectangle(TCase *tc); void eina_test_matrixsparse(TCase *tc); void eina_test_tiler(TCase *tc); +void eina_test_strbuf(TCase *tc); #endif /* EINA_SUITE_H_ */ diff --git a/src/tests/eina_test_strbuf.c b/src/tests/eina_test_strbuf.c new file mode 100644 index 0000000..6c666fa --- /dev/null +++ b/src/tests/eina_test_strbuf.c @@ -0,0 +1,51 @@ +/* EINA - EFL data type library + * Copyright (C) 2010 Sebastian Dransfeld + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; + * if not, see . + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "eina_suite.h" +#include "Eina.h" + +START_TEST(eina_strbuf_simple) +{ + Eina_Strbuf *buf; + char text[] = "This test should be so long that it is longer than the initial size of strbuf"; + + eina_init(); + + buf = eina_strbuf_new(); + fail_if(!buf); + + eina_strbuf_append(buf, text); + fail_if(strcmp(eina_strbuf_string_get(buf), text)); + + eina_strbuf_free(buf); + + eina_shutdown(); +} +END_TEST + +void +eina_test_strbuf(TCase *tc) +{ + tcase_add_test(tc, eina_strbuf_simple); +} -- 2.7.4