FOSSology  4.4.0
Open Source License Compliance by Open Source Software
testSetEnv.c
Go to the documentation of this file.
1 /*
2  SPDX-FileCopyrightText: © 2011-2012 Hewlett-Packard Development Company, L.P.
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
7 /* cunit includes */
8 #include <CUnit/CUnit.h>
9 #include "wget_agent.h"
10 #include "utility.h"
11 
17 static char Source[MAX_LENGTH];
18 static char TempFileDir[MAX_LENGTH];
19 
20 /* test functions */
21 
26 {
27  GlobalUploadKey = -1;
28  memset(GlobalTempFile, 0, STRMAX);
29  memset(GlobalURL, 0, URLMAX);
30  memset(GlobalParam, 0, STRMAX);
31  return 0;
32 }
33 
38 {
39  GlobalUploadKey = -1;
40  memset(GlobalTempFile, 0, STRMAX);
41  memset(GlobalURL, 0, URLMAX);
42  memset(GlobalParam, 0, STRMAX);
43  return 0;
44 }
53 {
54  strcpy(Source, "38 - https://mirrors.kernel.org/fossology/releases/3.0.0/ubuntu/ -l 1 -R *.deb");
55  strcpy(TempFileDir, "./test_result");
56  SetEnv(Source, TempFileDir);
57  CU_ASSERT_EQUAL(GlobalUploadKey, 38);
58  char *cptr = strstr(GlobalTempFile, "./test_result/wget."); /* is like ./test_result/wget.29923 */
59  CU_ASSERT_PTR_NOT_NULL(cptr);
60  CU_ASSERT_STRING_EQUAL(GlobalURL, "https://mirrors.kernel.org/fossology/releases/3.0.0/ubuntu/");
61  CU_ASSERT_STRING_EQUAL(GlobalParam, "-l 1 -R *.deb");
62 }
63 
67 CU_TestInfo testcases_SetEnv[] =
68 {
69 #if 0
70 #endif
71 {"SetEnv:Normal", testSetEnvNormal},
72  CU_TEST_INFO_NULL
73 };
74 
int SetEnvInit()
initialize
Definition: testSetEnv.c:25
int SetEnvClean()
clean the env
Definition: testSetEnv.c:37
void testSetEnvNormal()
set the global variables
Definition: testSetEnv.c:52
CU_TestInfo testcases_SetEnv[]
testcases for function SetEnv
Definition: testSetEnv.c:67
char GlobalParam[STRMAX]
Additional parameters.
Definition: wget_agent.c:27
char GlobalURL[URLMAX]
URL to download.
Definition: wget_agent.c:25
void SetEnv(char *S, char *TempFileDir)
Convert input pairs into globals.
Definition: wget_agent.c:683
long GlobalUploadKey
Input for this system.
Definition: wget_agent.c:23
char GlobalTempFile[STRMAX]
Temp file to be used.
Definition: wget_agent.c:24