[kazehakase-svn] [3575] more tests

Back to archive index

svnno****@sourc***** svnno****@sourc*****
Mon Jan 26 15:04:26 JST 2009


Revision: 3575
          http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3575
Author:   ikezoe
Date:     2009-01-26 15:04:26 +0900 (Mon, 26 Jan 2009)

Log Message:
-----------
more tests

Modified Paths:
--------------
    kazehakase/trunk/test/test-bookmark-file.c

Modified: kazehakase/trunk/test/test-bookmark-file.c
===================================================================
--- kazehakase/trunk/test/test-bookmark-file.c	2009-01-26 06:03:27 UTC (rev 3574)
+++ kazehakase/trunk/test/test-bookmark-file.c	2009-01-26 06:04:26 UTC (rev 3575)
@@ -6,14 +6,21 @@
 void test_new (void);
 void test_file_type (void);
 void test_location (void);
+void test_interval (void);
+void test_xmlrpc_address (void);
+void test_xmlrpc_user (void);
+void test_xmlrpc_pass (void);
+void test_load (void);
 
 static KzBookmarkFile *file;
+static KzBookmark *expected;
 static gchar *file_path;
 
 void
 setup (void)
 {
     file =  NULL;
+    expected = NULL;
     file_path = g_build_filename(kz_test_get_base_dir(),
                                  "fixtures", "bookmarks.xml",
                                  NULL);
@@ -24,6 +31,8 @@
 {
     if (file)
         g_object_unref(file);
+    if (expected)
+        g_object_unref(expected);
     g_free(file_path);
 }
 
@@ -50,8 +59,78 @@
     cut_trace(test_new());
 
     cut_assert_equal_string(file_path, kz_bookmark_file_get_location(file));
+
+    kz_bookmark_file_set_location(file, "Where am I?");
+    cut_assert_equal_string("Where am I?", kz_bookmark_file_get_location(file));
 }
 
+void
+test_interval (void)
+{
+    cut_trace(test_new());
+
+    kz_bookmark_file_set_interval(file, 9999);
+    cut_assert_equal_uint(9999, kz_bookmark_file_get_interval(file));
+
+    kz_bookmark_file_set_interval(file, G_MAXUINT);
+    cut_assert_equal_uint(G_MAXUINT, kz_bookmark_file_get_interval(file));
+}
+
+void
+test_xmlrpc_address (void)
+{
+    cut_trace(test_new());
+
+    kz_bookmark_file_set_xmlrpc(file, "http://example.com/");
+    cut_assert_equal_string("http://example.com/",  kz_bookmark_file_get_xmlrpc(file));
+
+    kz_bookmark_file_set_xmlrpc(file, "http://example.com/1/");
+    cut_assert_equal_string("http://example.com/1/",  kz_bookmark_file_get_xmlrpc(file));
+}
+
+void
+test_xmlrpc_user (void)
+{
+    cut_trace(test_new());
+
+    kz_bookmark_file_set_xmlrpc_user(file, "user1");
+    cut_assert_equal_string("user1",  kz_bookmark_file_get_xmlrpc_user(file));
+
+    kz_bookmark_file_set_xmlrpc_user(file, "user2");
+    cut_assert_equal_string("user2",  kz_bookmark_file_get_xmlrpc_user(file));
+}
+
+void
+test_xmlrpc_pass (void)
+{
+    cut_trace(test_new());
+
+    kz_bookmark_file_set_xmlrpc_pass(file, "pass1");
+    cut_assert_equal_string("pass1",  kz_bookmark_file_get_xmlrpc_pass(file));
+
+    kz_bookmark_file_set_xmlrpc_pass(file, "pass2");
+    cut_assert_equal_string("pass2",  kz_bookmark_file_get_xmlrpc_pass(file));
+}
+
+void
+test_load (void)
+{
+    cut_trace(test_new());
+
+    kz_bookmark_file_load(file);
+
+    expected = KZ_BOOKMARK(g_object_new(KZ_TYPE_BOOKMARK_FILE,
+                                        "location", file_path,
+                                        "title", "Bookmark file",
+                                        "file-type", "XBEL",
+                                        NULL));
+    kz_bookmark_append(expected,
+                       kz_bookmark_new_with_attrs("Kazehakase",
+                                                  "http://kazehakase.sourceforge.jp/",
+                                                  NULL));
+    kz_assert_equal_bookmark(expected, KZ_BOOKMARK(file));
+}
+
 /*
 vi:ts=4:nowrap:ai:expandtab:sw=4
 */



More information about the Kazehakase-cvs mailing list
Back to archive index