From 3d6a752111e867d32c09e3f82cd91017c3f400ad Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Tue, 9 Feb 2010 21:05:47 +0000 Subject: [PATCH] Add simple test for strbuf Need more SVN revision: 46024 --- legacy/eina/src/tests/Makefile.am | 3 +- legacy/eina/src/tests/eina_suite.c | 1 + legacy/eina/src/tests/eina_suite.h | 1 + legacy/eina/src/tests/eina_test_strbuf.c | 51 ++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 legacy/eina/src/tests/eina_test_strbuf.c diff --git a/legacy/eina/src/tests/Makefile.am b/legacy/eina/src/tests/Makefile.am index 30d69b18c3..c9948e06a2 100644 --- a/legacy/eina/src/tests/Makefile.am +++ b/legacy/eina/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/legacy/eina/src/tests/eina_suite.c b/legacy/eina/src/tests/eina_suite.c index 4fdc7b4c2e..1317bfcae2 100644 --- a/legacy/eina/src/tests/eina_suite.c +++ b/legacy/eina/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/legacy/eina/src/tests/eina_suite.h b/legacy/eina/src/tests/eina_suite.h index a2ad389e44..92b3969d13 100644 --- a/legacy/eina/src/tests/eina_suite.h +++ b/legacy/eina/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/legacy/eina/src/tests/eina_test_strbuf.c b/legacy/eina/src/tests/eina_test_strbuf.c new file mode 100644 index 0000000000..6c666fac53 --- /dev/null +++ b/legacy/eina/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); +}