FOSSology  4.4.0
Open Source License Compliance by Open Source Software
test_PathCheck.c
Go to the documentation of this file.
1 /*
2  SPDX-FileCopyrightText: © 2012 Hewlett-Packard Development Company, L.P.
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 #include "run_tests.h"
18 {
19  char *DirPath = "%H%R/!%U";
20  char *NewPath = NULL;
21  char HostName[1024];
22  char TmpPath[1024];
23  char *subs;
24 
25  NewPath = PathCheck(DirPath);
26  subs = strstr(NewPath, "!");
27  gethostname(HostName, sizeof(HostName));
28 
29  snprintf(TmpPath, sizeof(TmpPath), "%s%s%s%s", HostName,fo_config_get(sysconfig, "FOSSOLOGY", "path", NULL),"/", subs);
30  FO_ASSERT_STRING_EQUAL(NewPath, TmpPath);
31 }
32 
40 void testUsage()
41 {
42  Usage("ununpack", "2.0");
43 }
44 
45 /* ************************************************************************** */
46 /* **** cunit test cases **************************************************** */
47 /* ************************************************************************** */
48 
49 CU_TestInfo PathCheck_testcases[] =
50 {
51  {"PathCheck:", testPathCheck},
52  {"Usage:", testUsage},
53  CU_TEST_INFO_NULL
54 };
Usage()
Print Usage statement.
Definition: fo_dbcheck.php:63
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,...
Definition: fossconfig.c:336
fo_conf * sysconfig
CU_TestInfo PathCheck_testcases[]
Pacth check test cases.
void testPathCheck()
function PathCheck
void testUsage()
function Usage
char * PathCheck(char *DirPath)
Check if path contains a "%U" or "%H". If so, substitute a unique ID for U.
Definition: utils.c:1662