]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Split test_read_format_7zip by a compression type in order to test
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 2 Dec 2012 23:46:19 +0000 (08:46 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 2 Dec 2012 23:46:19 +0000 (08:46 +0900)
a specific compression easily.

libarchive/test/test_read_format_7zip.c

index 0858b920adb3171791195cf4b12eebaff82e6dd9..62657a82165a9b0c32acce24212937a710919552 100644 (file)
@@ -648,13 +648,24 @@ DEFINE_TEST(test_read_format_7zip)
 {
        struct archive *a;
 
-       test_copy();
-       test_empty_archive();
-       test_empty_file();
-       test_ppmd();
-       test_bcj("test_read_format_7zip_bcj_copy.7z");
-       test_bcj("test_read_format_7zip_bcj2_copy_1.7z");
-       test_bcj("test_read_format_7zip_bcj2_copy_2.7z");
+       assert((a = archive_read_new()) != NULL);
+
+       /* Extracting with liblzma */
+       if (ARCHIVE_OK != archive_read_support_filter_xz(a)) {
+               skipping("7zip:lzma decoding is not supported on this platform");
+       } else {
+               test_symname();
+               test_extract_all_files("test_read_format_7zip_copy_2.7z");
+               test_extract_last_file("test_read_format_7zip_copy_2.7z");
+               test_extract_all_files2("test_read_format_7zip_lzma1_lzma2.7z");
+               test_bcj("test_read_format_7zip_bcj2_copy_lzma.7z");
+       }
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_7zip_bzip2)
+{
+       struct archive *a;
 
        assert((a = archive_read_new()) != NULL);
 
@@ -667,37 +678,83 @@ DEFINE_TEST(test_read_format_7zip)
                test_bcj("test_read_format_7zip_bcj2_bzip2.7z");
        }
 
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_7zip_copy)
+{
+       test_copy();
+       test_bcj("test_read_format_7zip_bcj_copy.7z");
+       test_bcj("test_read_format_7zip_bcj2_copy_1.7z");
+       test_bcj("test_read_format_7zip_bcj2_copy_2.7z");
+}
+
+DEFINE_TEST(test_read_format_7zip_deflate)
+{
+       struct archive *a;
+
+       assert((a = archive_read_new()) != NULL);
+
        /* Extracting with libz */
        if (ARCHIVE_OK != archive_read_support_filter_gzip(a)) {
-               skipping("7zip:deflate decoding is not supported on this platform");
+               skipping(
+                   "7zip:deflate decoding is not supported on this platform");
        } else {
                test_plain_header("test_read_format_7zip_deflate.7z");
                test_bcj("test_read_format_7zip_bcj_deflate.7z");
                test_bcj("test_read_format_7zip_bcj2_deflate.7z");
        }
 
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_7zip_empty)
+{
+       test_empty_archive();
+       test_empty_file();
+}
+
+DEFINE_TEST(test_read_format_7zip_lzma1)
+{
+       struct archive *a;
+
+       assert((a = archive_read_new()) != NULL);
+
        /* Extracting with liblzma */
        if (ARCHIVE_OK != archive_read_support_filter_xz(a)) {
                skipping("7zip:lzma decoding is not supported on this platform");
        } else {
-               test_symname();
                test_plain_header("test_read_format_7zip_lzma1.7z");
-               test_plain_header("test_read_format_7zip_lzma2.7z");
-               test_extract_all_files("test_read_format_7zip_copy_2.7z");
                test_extract_all_files("test_read_format_7zip_lzma1_2.7z");
-               test_extract_last_file("test_read_format_7zip_copy_2.7z");
                test_extract_last_file("test_read_format_7zip_lzma1_2.7z");
-               test_extract_all_files2("test_read_format_7zip_lzma1_lzma2.7z");
                test_bcj("test_read_format_7zip_bcj_lzma1.7z");
-               test_bcj("test_read_format_7zip_bcj_lzma2.7z");
-               test_bcj("test_read_format_7zip_bcj2_copy_lzma.7z");
                test_bcj("test_read_format_7zip_bcj2_lzma1_1.7z");
                test_bcj("test_read_format_7zip_bcj2_lzma1_2.7z");
+               test_delta_lzma("test_read_format_7zip_delta_lzma1.7z");
+       }
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_7zip_lzma2)
+{
+       struct archive *a;
+
+       assert((a = archive_read_new()) != NULL);
+
+       /* Extracting with liblzma */
+       if (ARCHIVE_OK != archive_read_support_filter_xz(a)) {
+               skipping("7zip:lzma decoding is not supported on this platform");
+       } else {
+               test_plain_header("test_read_format_7zip_lzma2.7z");
+               test_bcj("test_read_format_7zip_bcj_lzma2.7z");
                test_bcj("test_read_format_7zip_bcj2_lzma2_1.7z");
                test_bcj("test_read_format_7zip_bcj2_lzma2_2.7z");
-               test_delta_lzma("test_read_format_7zip_delta_lzma1.7z");
                test_delta_lzma("test_read_format_7zip_delta_lzma2.7z");
        }
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
 
+DEFINE_TEST(test_read_format_7zip_ppmd)
+{
+       test_ppmd();
+}