soylent r231 - trunk/libsoylent/test



Author: svenp
Date: Mon Jul 21 16:58:34 2008
New Revision: 231
URL: http://svn.gnome.org/viewvc/soylent?rev=231&view=rev

Log:
added tests for people creation / management (in test_playground)

Modified:
   trunk/libsoylent/test/test-playground.c

Modified: trunk/libsoylent/test/test-playground.c
==============================================================================
--- trunk/libsoylent/test/test-playground.c	(original)
+++ trunk/libsoylent/test/test-playground.c	Mon Jul 21 16:58:34 2008
@@ -31,14 +31,29 @@
   test_init ("Playground");
   test_soylent_init ();
   
-  SlPerson *person = sl_person_new ("Tim");
+  SlBook *testbook = test_setup_testbook ();
   
-  if (!sl_book_add_person (SL_BOOK_DEFAULT, person, &error))
+  test_print ("creating some people");
+  SlPerson *person_tim = sl_person_new ("Tim");
+  SlPerson *person_joe = sl_person_new ("Joe");
+  
+  test_print ("adding \"Tim\" and \"Joe\" to the addressbook");
+  if (!sl_book_add_person (testbook, person_tim, &error) ||
+      !sl_book_add_person (testbook, person_joe, &error))
     {
       test_fail ("couldn't add person to addressbook: %s", error->message);
     }
   
-  g_object_unref (person);
+  test_print ("removing \"Tim\" from the addressbook again");
+  if (!sl_book_remove_person (testbook, person_tim, &error))
+    {
+      test_fail ("couldn't remove person from addressbook: %s", error->message);
+    }
+  
+  g_object_unref (person_tim);
+  g_object_unref (person_joe);
+  
+  test_clean_testbook (testbook);
   
   /*test_print ("foo\n");
   SlEntity *entity = sl_entity_new ();



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