################################################################################ # TEST: EMOS_FRM_result_lib ################################################################################ # Copyright (C) 2000 EMOS Computer Consulting GmbH # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # For further information please contact: # # Dean Rajovic # EMOS Computer Consulting GmbH # Oskar-Messter-Straße 25 # 85737 Ismaning # Germany # tel.: +49 89 608 765-0 # mailto:drajovic@emos.de # http://www.emos.de ################################################################################ # $Revision: 1.3 $ # $Author: drajovic $ # $Date: 2005/01/28 11:18:43 $ # $Source: C:/Archive/FRAMEWORK/EMOS_GPL/FRM/emos_frm_result_lib/script,v $ # $NoKeywords: $ ################################################################################ #/*** #* Simple routines for calculating test statistics. #*/ #/** #* array containing test statistics #*/ static test_statistics_arr[]; #/** #* Initialises the array with test statistics (by cleaning it up). #*/ public function FRM_RES_init_test_statistics ( ) { auto i; for( i in test_statistics_arr ) delete test_statistics_arr[i]; } #/** #* Returns the array containig test statistics. #* The format of the array is not defined. #* It will usually contain only one dimension in form of #* <code>array["category"]</code> where "category" is #* defined via FRM_RES_add_test_statistics( in category ). #* @return array of test statistics. #*/ public function FRM_RES_get_test_statistics ( out arr[] ) { auto i; for( i in arr ) delete arr[i]; for( i in test_statistics_arr ) arr[i] = test_statistics_arr[i]; } #/** #* Increases the test statistics for the specified category by one. #* @param category (in) name of the category #*/ public function FRM_RES_add_test_statistics( in category ) { test_statistics_arr[category]++; } #/** #* Produces the most simple report on test statistics using "report_msg()". #* This function cummulates the total over all categories and reports #* the percentage for each category (i.e. it assumes the categories are #* non-overlapping). #* Overload this function with your own one to produce better report. #*/ public function FRM_RES_report_test_statistics( ) { auto category, msg, total, test_stats[]; FRM_RES_get_test_statistics( test_stats ); # accumulate totals total = 0; for( category in test_stats ) { total+=test_stats[category]; } # produce report report_msg( "=================" ); for(category in test_stats ) { msg = sprintf( "%s:\t %d of %d = %.2f%", category, test_stats[category], total, test_stats[category]/total*100 ); report_msg( msg ); } report_msg( "-----------------" ); report_msg( "Total:\t " & total ); report_msg( "=================" ); }