Jim Cownie | 18d8473 | 2014-05-10 17:02:09 +0000 | [diff] [blame] | 1 | int main() |
| 2 | { |
| 3 | int i; /* Loop index */ |
| 4 | int result; /* return value of the program */ |
| 5 | int failed=0; /* Number of failed tests */ |
| 6 | int success=0; /* number of succeeded tests */ |
| 7 | static FILE * logFile; /* pointer onto the logfile */ |
Andrey Churbanov | a951e21 | 2015-04-29 14:36:38 +0000 | [diff] [blame] | 8 | static const char * logFileName = "<testfunctionname></testfunctionname>.log"; /* name of the logfile */ |
Jim Cownie | 18d8473 | 2014-05-10 17:02:09 +0000 | [diff] [blame] | 9 | |
| 10 | |
| 11 | /* Open a new Logfile or overwrite the existing one. */ |
| 12 | logFile = fopen(logFileName,"w+"); |
| 13 | |
| 14 | printf("######## OpenMP Validation Suite V %s ######\n", OMPTS_VERSION ); |
| 15 | printf("## Repetitions: %3d ####\n",REPETITIONS); |
| 16 | printf("## Loop Count : %6d ####\n",LOOPCOUNT); |
| 17 | printf("##############################################\n"); |
| 18 | printf("Testing <directive></directive>\n\n"); |
| 19 | |
| 20 | fprintf(logFile,"######## OpenMP Validation Suite V %s ######\n", OMPTS_VERSION ); |
| 21 | fprintf(logFile,"## Repetitions: %3d ####\n",REPETITIONS); |
| 22 | fprintf(logFile,"## Loop Count : %6d ####\n",LOOPCOUNT); |
| 23 | fprintf(logFile,"##############################################\n"); |
| 24 | fprintf(logFile,"Testing <directive></directive>\n\n"); |
| 25 | |
| 26 | for ( i = 0; i < REPETITIONS; i++ ) { |
| 27 | fprintf (logFile, "\n\n%d. run of <testfunctionname></testfunctionname> out of %d\n\n",i+1,REPETITIONS); |
| 28 | if(<testfunctionname></testfunctionname>(logFile)){ |
| 29 | fprintf(logFile,"Test successful.\n"); |
| 30 | success++; |
| 31 | } |
| 32 | else { |
| 33 | fprintf(logFile,"Error: Test failed.\n"); |
| 34 | printf("Error: Test failed.\n"); |
| 35 | failed++; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | if(failed==0){ |
| 40 | fprintf(logFile,"\nDirective worked without errors.\n"); |
| 41 | printf("Directive worked without errors.\n"); |
| 42 | result=0; |
| 43 | } |
| 44 | else{ |
| 45 | fprintf(logFile,"\nDirective failed the test %i times out of %i. %i were successful\n",failed,REPETITIONS,success); |
| 46 | printf("Directive failed the test %i times out of %i.\n%i test(s) were successful\n",failed,REPETITIONS,success); |
| 47 | result = (int) (((double) failed / (double) REPETITIONS ) * 100 ); |
| 48 | } |
| 49 | printf ("Result: %i\n", result); |
| 50 | return result; |
| 51 | } |