FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
test_ununpack-iso.c
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright (C) 2010-2012 Hewlett-Packard Development Company, L.P.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 version 2 as published by the Free Software Foundation.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along
14 with this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 *********************************************************************/
17 #include "run_tests.h"
22 /* locals */
23 static int Result = 0;
24 
32 {
33  deleteTmpFiles("./test-result/");
34  exists = file_dir_exists("./test-result/");
35  FO_ASSERT_EQUAL(exists, 0); // not existing
36  Filename = "../testdata/test.iso";
37  MkDirs("./test-result/test.iso.dir");
38  Result = ExtractISO(Filename, "./test-result/test.iso.dir");
39  FO_ASSERT_EQUAL(Result, 0);
40 
41  exists = file_dir_exists("./test-result/test.iso.dir/test1.zip.tar.dir/test1.zip");
42  FO_ASSERT_EQUAL(exists, 1);
43 }
44 
52 {
53  deleteTmpFiles("./test-result/");
54  exists = file_dir_exists("./test-result/");
55  FO_ASSERT_EQUAL(exists, 0); // not existing
56  Result = ExtractISO("", ""); // empty parameters
57  FO_ASSERT_EQUAL(Result, 1); // fail to Extract
58 }
59 
67 {
68  deleteTmpFiles("./test-result/");
69  exists = file_dir_exists("./test-result/");
70  FO_ASSERT_EQUAL(exists, 0); // not existing
71  Filename = "../testdata/test_1.orig.tar.gz";
72  MkDirs("./test-result/test_1.orig.tar.gz.dir");
73  Result = ExtractISO(Filename, "./test-result/test_1.orig.tar.gz.dir");
74  FO_ASSERT_EQUAL(Result, 0); // fail to Extract
75 }
76 
77 /* ************************************************************************** */
78 /* **** cunit test cases **************************************************** */
79 /* ************************************************************************** */
80 
81 CU_TestInfo ununpack_iso_testcases[] =
82 {
83  {"testExtractISO: iso file:", testExtractISO},
84  {"testExtractISO: abnormal parameters:", testExtractISO4EmptyParameters},
85  {"testExtractISO: error parameters:", testExtractISO4ErrorParameters},
86  CU_TEST_INFO_NULL
87 };
static int Result
Result of calls.
Definition: test_CopyFile.c:28
void testExtractISO()
unpack iso file
void testExtractISO4EmptyParameters()
abnormal parameters
int file_dir_exists(char *path_name)
test if a file or directory exists
Definition: run_tests.c:136
int ExtractISO(char *Source, char *Destination)
Given an ISO image and a directory, extract the image to the directory.
Definition: ununpack-iso.c:79
char * Filename
Filename.
Definition: run_tests.c:28
int exists
Default not exists.
Definition: run_tests.c:31
int MkDirs(char *Fname)
Same as command-line "mkdir -p".
Definition: utils.c:259
void testExtractISO4ErrorParameters()
abnormal parameters
CU_TestInfo ununpack_iso_testcases[]
ISO test cases.