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

Unit test for host operations. More...

#include <testRun.h>
#include <host.h>
Include dependency graph for testHost.c:

Go to the source code of this file.

Functions

void test_host_init ()
 Test for host_init() More...
 
void test_host_insert ()
 Test for host_insert() More...
 
void test_host_increase_load ()
 Test for host_increase_load() More...
 
void test_host_decrease_load ()
 Test for host_decrease_load() More...
 
void test_get_host ()
 Test for get_host() More...
 

Variables

CU_TestInfo tests_host []
 

Detailed Description

Unit test for host operations.

Definition in file testHost.c.

Function Documentation

◆ test_get_host()

void test_get_host ( )

Test for get_host()

Test:
  1. Initialize the scheduler using scheduler_init()
  2. Add hosts to the scheduler with different capacity using host_insert()
  3. Get the hosts from scheduler using get_host.
  4. Check the name of the host for a given capacity

Definition at line 140 of file testHost.c.

◆ test_host_decrease_load()

void test_host_decrease_load ( )

Test for host_decrease_load()

Test:
  1. Initialize host using host_init()
  2. Set the host load to 2
  3. Call host_decrease_load() on the host
  4. Check if the running agents on host are decreasing

Definition at line 118 of file testHost.c.

◆ test_host_increase_load()

void test_host_increase_load ( )

Test for host_increase_load()

Test:
  1. Initialize host using host_init()
  2. Check the running agents on host are 0
  3. Call host_increase_load() on the host
  4. Check if the running agents on host are increasing

Definition at line 97 of file testHost.c.

◆ test_host_init()

void test_host_init ( )

Test for host_init()

Test:
  1. Create a host using host_init()
  2. Check if the host returned is not NULL
  3. Check if the host gets name, address, agent_dir and max properly
  4. Check if the host has no running agents
  5. Destroy the host

Definition at line 28 of file testHost.c.

◆ test_host_insert()

void test_host_insert ( )

Test for host_insert()

Test:
  1. Initialize scheduler using scheduler_init()
  2. Create a host using host_init()
  3. Insert the host to the scheduler using host_insert()
  4. Check if scheduler's host list and queue size increases
  5. Verify if the hosts are added in the given order to the scheduler's host queue

Definition at line 53 of file testHost.c.

Variable Documentation

◆ tests_host

CU_TestInfo tests_host[]
Initial value:
=
{
{"Test host_init", test_host_init },
{"Test host_insert", test_host_insert },
{"Test host_increase_load", test_host_increase_load },
{"Test host_decrease_load", test_host_decrease_load },
{"Test host_get_host", test_get_host },
CU_TEST_INFO_NULL
}
void test_host_increase_load()
Test for host_increase_load()
Definition: testHost.c:97
void test_host_init()
Test for host_init()
Definition: testHost.c:28
void test_host_insert()
Test for host_insert()
Definition: testHost.c:53
void test_host_decrease_load()
Test for host_decrease_load()
Definition: testHost.c:118
void test_get_host()
Test for get_host()
Definition: testHost.c:140

Definition at line 185 of file testHost.c.