embedded IPsec source code documentation


main.c File Reference


Detailed Description

Main file of structural tests.

Author:
Niklaus Schild <n.schild@gmx.ch>

Christian Scheurer <http://www.christianscheurer.ch>

OUTLINE:

This module contains the main function where the structural test is executed. It basically loops over the test routines which are provided by the tested modules. Each module which needs to be tested must provide a function with the following interface: void (*function)(test_result *). Before a test for an appropriate module is performed, the function needs to be registred in the test_function_set array.

IMPLEMENTATION:

The implementation uses an array of function pointers. The programmer needs to register the new test function statically in the main file of this module. During execution of the test, all functions registered in the test_function_set are executed.

NOTES:

to add a test to this testing procedure you have to perform the following steps:

  1. declare the new test function as extern
  2. add the test function and its name to the test_function_set
  3. recompile and be assure that the tests return 'successful' or with 'not implemented'

This document is part of embedded IPsec
Copyright (c) 2003 Niklaus Schild and Christian Scheurer, HTI Biel/Bienne
All rights reserved.


Definition in file main.c.

#include "testing/structural/structural_test.h"
#include "ipsec/debug.h"
#include "ipsec/util.h"

Go to the source code of this file.

Data Structures

struct  test_set_struct

Defines

#define NR_OF_TESTFUNCTIONS   sizeof(test_function_set)/sizeof(test_set)

Typedefs

typedef test_set_struct test_set

Functions

void serinit (void)
void util_debug_test (test_result *)
void des_test (test_result *)
void md5_test (test_result *)
void sha1_test (test_result *)
void sa_test (test_result *)
void ah_test (test_result *)
void esp_test (test_result *)
void main (void)

Variables

test_set test_function_set []


Define Documentation

#define NR_OF_TESTFUNCTIONS   sizeof(test_function_set)/sizeof(test_set)
 

defines the number of test functions

Definition at line 95 of file main.c.


Typedef Documentation

typedef struct test_set_struct test_set
 


Function Documentation

void ah_test test_result global_results  ) 
 

Main test function for the AH tests. It does nothing but calling the subtests one after the other.

Definition at line 181 of file ah_test.c.

void des_test test_result global_results  ) 
 

Main test function for the DES/3DES CBC tests. It does nothing but calling the subtests one after the other.

Definition at line 219 of file des_test.c.

void esp_test test_result global_results  ) 
 

Main test function for the ESP tests. It does nothing but calling the subtests one after the other.

Definition at line 355 of file esp_test.c.

void main void   ) 
 

Executes the structural testing framework.

Returns:
void

Definition at line 103 of file main.c.

void md5_test test_result global_results  ) 
 

Main testfunction for the MD5 tests. It does nothing but calling the subtests one after the other.

Definition at line 218 of file md5_test.c.

void sa_test test_result global_results  ) 
 

Main test function for the SA tests. It does nothing but calling the subtests one after the other.

Definition at line 887 of file sa_test.c.

void serinit void   ) 
 

void sha1_test test_result global_results  ) 
 

Main test function for the SHA1 tests. It does nothing but calling the subtests one after the other.

Definition at line 268 of file sha1_test.c.

void util_debug_test test_result global_results  ) 
 

Test function for all the log functions (Note: some of these tests are commented out by default to make the log output more uniform)

Definition at line 117 of file util_test.c.


Variable Documentation

test_set test_function_set[]
 

Initial value:

 
{
                        { util_debug_test,      "util_debug_test"       },
                        { des_test,             "des_test"                      },
                        { md5_test,             "md5_test"                      }, 
                        { sha1_test,            "sha1_test"                     },
                        { sa_test,                      "sa_test"                       },
                        { ah_test,                      "ah_test"                       },
                        { esp_test,                     "esp_test"                      }
}

Definition at line 84 of file main.c.


Copyright 2003 by Christian Scheurer and Niklaus Schild