Add simple test for strbuf
authorenglebass <englebass@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 9 Feb 2010 21:05:47 +0000 (21:05 +0000)
committerenglebass <englebass@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 9 Feb 2010 21:05:47 +0000 (21:05 +0000)
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
src/tests/eina_suite.c
src/tests/eina_suite.h
src/tests/eina_test_strbuf.c [new file with mode: 0644]

index 30d69b1..c9948e0 100644 (file)
@@ -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
 
index 4fdc7b4..1317bfc 100644 (file)
@@ -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 }
 };
 
index a2ad389..92b3969 100644 (file)
@@ -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 (file)
index 0000000..6c666fa
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+
+#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);
+}