00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00063 #include "testing/structural/structural_test.h"
00064 #include "ipsec/debug.h"
00065 #include "ipsec/util.h"
00066
00067 extern void serinit(void) ;
00068
00069
00070 extern void util_debug_test(test_result *);
00071 extern void des_test(test_result *);
00072 extern void md5_test(test_result *);
00073 extern void sha1_test(test_result *);
00074 extern void sa_test(test_result *) ;
00075 extern void ah_test(test_result *) ;
00076 extern void esp_test(test_result *) ;
00077
00078 typedef struct test_set_struct
00079 {
00080 void (*function)(test_result *);
00081 char *name ;
00082 } test_set;
00083
00084 test_set test_function_set[] =
00085 {
00086 { util_debug_test, "util_debug_test" },
00087 { des_test, "des_test" },
00088 { md5_test, "md5_test" },
00089 { sha1_test, "sha1_test" },
00090 { sa_test, "sa_test" },
00091 { ah_test, "ah_test" },
00092 { esp_test, "esp_test" }
00093 } ;
00094
00095 #define NR_OF_TESTFUNCTIONS sizeof(test_function_set)/sizeof(test_set)
00103 void main(void)
00104 {
00105 int i ;
00106 float percents;
00107
00108 test_result global_results = {0, 0, 0, 0};
00109
00110 #ifdef SIMULATOR
00111 serinit();
00112 #endif
00113
00114
00115 IPSEC_LOG_MSG("main", (" ")) ;
00116 IPSEC_LOG_MSG("main", ("structural testing started")) ;
00117 IPSEC_LOG_MSG("main", ("compiled on %s at %s", __DATE__, __TIME__)) ;
00118 IPSEC_LOG_MSG("main", ("CVS ID: $Id: main_8c-source.html,v 1.4 2003/12/12 13:10:33 schec2 Exp $\n")) ;
00119
00120
00121 for (i = 0; i < NR_OF_TESTFUNCTIONS; i++)
00122 {
00123 test_function_set[i].function((test_result *)&global_results);
00124 printf("\n");
00125 }
00126
00127 printf("\n");
00128 IPSEC_LOG_MSG("main", ("structural testing finished:")) ;
00129
00130 percents = 100.00;
00131 if(global_results.tests > 0) {
00132 percents = 100.00*(1.00-((float)global_results.errors/(float)global_results.tests));
00133 }
00134 IPSEC_LOG_MSG("main", (" o %6.2f%% correct (%d of %d tests passed)", percents, (global_results.tests-global_results.errors), global_results.tests));
00135
00136 percents = 100.00;
00137 if(global_results.functions > 0) {
00138 percents = 100.00*(1.00-((float)global_results.notimplemented/(float)global_results.functions));
00139 }
00140 IPSEC_LOG_MSG("main", (" o %6.2f%% complete (%d of %d functions implemented)", percents, (global_results.functions-global_results.notimplemented), global_results.functions));
00141
00142 while(1) ;
00143
00144 return ;
00145 }
00146
00147