FOSSology  4.4.0
Open Source License Compliance by Open Source Software
testUtilities.c File Reference

testing for functions GetPosition, IsFile, TaintURL More...

#include <CUnit/CUnit.h>
#include "wget_agent.h"
#include "utility.h"
Include dependency graph for testUtilities.c:

Go to the source code of this file.

Functions

void testIsFileNormal_RegulerFile ()
 Test for function IsFile() More...
 
void testIsFileNormal_SymLink ()
 Test for function IsFile() a symlink. More...
 
void testGetPositionNormal ()
 Test for function GetPosition() More...
 
void testTaintURL ()
 Test for function TaintURL() More...
 
void test_PathCheck ()
 Test for function PathCheck() More...
 
void test_Archivefs_dir ()
 Test for function Archivefs(), dir. More...
 
void test_Archivefs_file ()
 Test for function Archivefs(), reguler file. More...
 

Variables

CU_TestInfo testcases_Utiliies []
 testcases for function SetEnv More...
 

Detailed Description

testing for functions GetPosition, IsFile, TaintURL

Definition in file testUtilities.c.

Function Documentation

◆ test_Archivefs_dir()

void test_Archivefs_dir ( )

Test for function Archivefs(), dir.

Test:
  1. Create a directory with a file
  2. Call Archivefs()
  3. Check if the result is a tar archive

Definition at line 137 of file testUtilities.c.

◆ test_Archivefs_file()

void test_Archivefs_file ( )

Test for function Archivefs(), reguler file.

Test:
  1. Create a test file
  2. Call Archivefs()
  3. Check if the result is normal file

Definition at line 164 of file testUtilities.c.

◆ test_PathCheck()

void test_PathCheck ( )

Test for function PathCheck()

Test:
  1. Create a path string with "%H"
  2. Call PathCheck
  3. Check if "%H" was replaced with HostName
Note
free the pointer from PathCheck()

Definition at line 118 of file testUtilities.c.

◆ testGetPositionNormal()

void testGetPositionNormal ( )

Test for function GetPosition()

Test:
  1. Create 3 URLs (http, https and ftp)
  2. Call GetPosition() on 3 URLs
  3. Check if correct position was returned

Definition at line 70 of file testUtilities.c.

◆ testIsFileNormal_RegulerFile()

void testIsFileNormal_RegulerFile ( )

Test for function IsFile()

Test:
  1. Create a file
  2. Call IsFile()
  3. Check if result is 1

Definition at line 26 of file testUtilities.c.

◆ testIsFileNormal_SymLink()

void testIsFileNormal_SymLink ( )

Test for function IsFile() a symlink.

Test:
  1. Create a file and a symlink to the file
  2. Call IsFile() to follow symlink
  3. Check if result is 1

Definition at line 45 of file testUtilities.c.

◆ testTaintURL()

void testTaintURL ( )

Test for function TaintURL()

Test:
  1. Create URLs with unwanted characters
  2. Call TaintURL()
  3. Check if result is 1

Definition at line 93 of file testUtilities.c.

Variable Documentation

◆ testcases_Utiliies

CU_TestInfo testcases_Utiliies[]
Initial value:
=
{
{"Utiliies:IsFile_file", testIsFileNormal_RegulerFile},
{"Utiliies:IsFile_link", testIsFileNormal_SymLink},
{"Utiliies:GetPosition_normal", testGetPositionNormal},
{"Utiliies:TaintURL_normal", testTaintURL},
{"Utiliies:PathCheck", test_PathCheck},
{"Utiliies:Archivefs_dir", test_Archivefs_dir},
{"Utiliies:Archivefs_file", test_Archivefs_file},
CU_TEST_INFO_NULL
}
void test_Archivefs_dir()
Test for function Archivefs(), dir.
void test_Archivefs_file()
Test for function Archivefs(), reguler file.
void testIsFileNormal_SymLink()
Test for function IsFile() a symlink.
Definition: testUtilities.c:45
void testIsFileNormal_RegulerFile()
Test for function IsFile()
Definition: testUtilities.c:26
void testGetPositionNormal()
Test for function GetPosition()
Definition: testUtilities.c:70
void test_PathCheck()
Test for function PathCheck()
void testTaintURL()
Test for function TaintURL()
Definition: testUtilities.c:93

testcases for function SetEnv

Definition at line 187 of file testUtilities.c.