FOSSology  4.4.0
Open Source License Compliance by Open Source Software
test_ununpack-iso.c
Go to the documentation of this file.
1 /*
2  SPDX-FileCopyrightText: © 2010-2012 Hewlett-Packard Development Company, L.P.
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 #include "run_tests.h"
11 /* locals */
12 static int Result = 0;
13 
21 {
22  deleteTmpFiles("./test-result/");
23  exists = file_dir_exists("./test-result/");
24  FO_ASSERT_EQUAL(exists, 0); // not existing
25  Filename = "../testdata/test.iso";
26  MkDirs("./test-result/test.iso.dir");
27  Result = ExtractISO(Filename, "./test-result/test.iso.dir");
28  FO_ASSERT_EQUAL(Result, 0);
29 
30  exists = file_dir_exists("./test-result/test.iso.dir/test1.zip.tar.dir/test1.zip");
31  FO_ASSERT_EQUAL(exists, 1);
32 }
33 
41 {
42  deleteTmpFiles("./test-result/");
43  exists = file_dir_exists("./test-result/");
44  FO_ASSERT_EQUAL(exists, 0); // not existing
45  Result = ExtractISO("", ""); // empty parameters
46  FO_ASSERT_EQUAL(Result, 1); // fail to Extract
47 }
48 
56 {
57  deleteTmpFiles("./test-result/");
58  exists = file_dir_exists("./test-result/");
59  FO_ASSERT_EQUAL(exists, 0); // not existing
60  Filename = "../testdata/test_1.orig.tar.gz";
61  MkDirs("./test-result/test_1.orig.tar.gz.dir");
62  Result = ExtractISO(Filename, "./test-result/test_1.orig.tar.gz.dir");
63  FO_ASSERT_EQUAL(Result, 0); // fail to Extract
64 }
65 
66 /* ************************************************************************** */
67 /* **** cunit test cases **************************************************** */
68 /* ************************************************************************** */
69 
70 CU_TestInfo ununpack_iso_testcases[] =
71 {
72  {"testExtractISO: iso file:", testExtractISO},
73  {"testExtractISO: abnormal parameters:", testExtractISO4EmptyParameters},
74  {"testExtractISO: error parameters:", testExtractISO4ErrorParameters},
75  CU_TEST_INFO_NULL
76 };
static int Result
Result of calls.
Definition: test_CopyFile.c:17
void testExtractISO4ErrorParameters()
abnormal parameters
void testExtractISO()
unpack iso file
CU_TestInfo ununpack_iso_testcases[]
ISO test cases.
void testExtractISO4EmptyParameters()
abnormal parameters
int ExtractISO(char *Source, char *Destination)
Given an ISO image and a directory, extract the image to the directory.
Definition: ununpack-iso.c:68
int MkDirs(char *Fname)
Same as command-line "mkdir -p".
Definition: utils.c:248
int file_dir_exists(char *path_name)
test if a file or directory exists
Definition: run_tests.c:90
int exists
Default not exists.
Definition: run_tests.c:20
char * Filename
Filename.
Definition: run_tests.c:17