soylent r166 - trunk/libsoylent/test



Author: svenp
Date: Tue Jun 17 21:34:44 2008
New Revision: 166
URL: http://svn.gnome.org/viewvc/soylent?rev=166&view=rev

Log:
added test-case for libsoylent addressbook

Added:
   trunk/libsoylent/test/test-book.c
   trunk/libsoylent/test/test.c-old
      - copied unchanged from r162, /trunk/libsoylent/test/test.c
Modified:
   trunk/libsoylent/test/   (props changed)

Added: trunk/libsoylent/test/test-book.c
==============================================================================
--- (empty file)
+++ trunk/libsoylent/test/test-book.c	Tue Jun 17 21:34:44 2008
@@ -0,0 +1,35 @@
+/**/
+
+#include "test.h"
+
+int
+main (int argc, char **argv)
+{
+  GError *error = NULL;
+  
+  test_init ("Book");
+  
+  sl_book_get_books ();
+  
+  test_print ("creating addressbook krank\n");
+  if (!sl_book_create ("krank", &error)) {
+    test_fail("%s", error->message);
+  }
+  
+  SlBook *book = sl_book_create ("krank", &error);
+  if (book)
+    {
+      test_fail("created book with same name twice");
+    } 
+  else
+    {
+      if (error->code != SL_BOOK_ERROR_ALREADY_EXISTS)
+        {
+          test_fail("unexpected error: %s", error->message);
+        }
+    }
+  
+  sl_book_get_books ();
+  
+  test_success ();
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]