[kazehakase-svn] [3737] more.

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
Wed Feb 18 12:56:08 JST 2009


Revision: 3737
          http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3737
Author:   ikezoe
Date:     2009-02-18 12:56:08 +0900 (Wed, 18 Feb 2009)

Log Message:
-----------
more.

Modified Paths:
--------------
    kazehakase/trunk/test/test-downloader.c

Modified: kazehakase/trunk/test/test-downloader.c
===================================================================
--- kazehakase/trunk/test/test-downloader.c	2009-02-18 03:16:29 UTC (rev 3736)
+++ kazehakase/trunk/test/test-downloader.c	2009-02-18 03:56:08 UTC (rev 3737)
@@ -7,6 +7,7 @@
 void test_new_with_filename (void);
 void test_to_buffer (void);
 void test_to_file (void);
+void test_uri (void);
 
 static KzDownloader *downloader;
 
@@ -16,6 +17,7 @@
 static gchar *error_message;
 static gchar *expected_buffer;
 static gchar *actual_buffer;
+static gchar *file_path;
 static const gchar target_uri[] = "http://svn.sourceforge.jp/view/kazehakase/trunk/test/fixtures/bookmarkbar.xml?view=co&root=kazehakase";
 static const gchar download_filename[] = "downloaded-file";
 
@@ -39,6 +41,7 @@
         g_object_unref(downloader);
     g_free(expected_buffer);
     g_free(actual_buffer);
+    g_free(file_path);
 
     cut_remove_path(download_filename, NULL);
 }
@@ -115,8 +118,8 @@
 void
 test_to_buffer (void)
 {
-    gchar *file_path;
     GError *error = NULL;
+    gsize expected_size;
 
     cut_trace(test_new());
 
@@ -132,19 +135,20 @@
     file_path = g_build_filename(kz_test_get_base_dir(),
                                  "fixtures", "bookmarkbar.xml",
                                  NULL);
-    cut_take_string(file_path);
 
-    g_file_get_contents(file_path, &expected_buffer, NULL, &error);
+    g_file_get_contents(file_path, &expected_buffer, &expected_size, &error);
     gcut_assert_error(error);
 
     cut_assert_equal_string(expected_buffer, kz_downloader_get_buffer(downloader));
+    cut_assert_equal_uint(expected_size,
+                          kz_downloader_get_size(downloader));
 }
 
 void
 test_to_file (void)
 {
-    gchar *file_path;
     GError *error = NULL;
+    gsize expected_size;
 
     cut_trace(test_new_with_filename());
 
@@ -164,14 +168,33 @@
     file_path = g_build_filename(kz_test_get_base_dir(),
                                  "fixtures", "bookmarkbar.xml",
                                  NULL);
-    cut_take_string(file_path);
 
-    g_file_get_contents(file_path, &expected_buffer, NULL, &error);
+    g_file_get_contents(file_path, &expected_buffer, &expected_size, &error);
     gcut_assert_error(error);
 
     cut_assert_equal_string(expected_buffer, actual_buffer);
+    cut_assert_equal_uint(expected_size,
+                          kz_downloader_get_size(downloader));
 }
 
+void
+test_uri (void)
+{
+    cut_trace(test_new());
+
+    cut_assert_equal_string(target_uri,
+                            kz_downloader_get_uri(downloader));
+}
+
+void
+test_filename (void)
+{
+    cut_trace(test_new_with_filename());
+
+    cut_assert_equal_string(download_filename,
+                            kz_downloader_get_filename(downloader));
+}
+
 /*
 vi:ts=4:nowrap:ai:expandtab:sw=4
 */




More information about the Kazehakase-cvs mailing list
アーカイブの一覧に戻る