FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
test_PathCheck.c
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright (C) 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"
29 {
30  char *DirPath = "%H%R/!%U";
31  char *NewPath = NULL;
32  char HostName[1024];
33  char TmpPath[1024];
34  char *subs;
35 
36  NewPath = PathCheck(DirPath);
37  subs = strstr(NewPath, "!");
38  gethostname(HostName, sizeof(HostName));
39 
40  snprintf(TmpPath, sizeof(TmpPath), "%s%s%s%s", HostName,fo_config_get(sysconfig, "FOSSOLOGY", "path", NULL),"/", subs);
41  FO_ASSERT_STRING_EQUAL(NewPath, TmpPath);
42 }
43 
51 void testUsage()
52 {
53  Usage("ununpack", "2.0");
54 }
55 
56 /* ************************************************************************** */
57 /* **** cunit test cases **************************************************** */
58 /* ************************************************************************** */
59 
60 CU_TestInfo PathCheck_testcases[] =
61 {
62  {"PathCheck:", testPathCheck},
63  {"Usage:", testUsage},
64  CU_TEST_INFO_NULL
65 };
char * PathCheck(char *DirPath)
Check if path contains a "%U" or "%H". If so, substitute a unique ID for U.
Definition: utils.c:1672
fo_conf * sysconfig
char * fo_config_get(fo_conf *conf, const char *group, const char *key, GError **error)
Gets an element based on its group name and key name. If the group or key is not found, the error object is set and NULL is returned.
Definition: fossconfig.c:341
void testPathCheck()
function PathCheck
Usage()
Print Usage statement.
Definition: fo_dbcheck.php:75
CU_TestInfo PathCheck_testcases[]
Pacth check test cases.
void testUsage()
function Usage