LTP GCOV extension - code coverage report
Current view: directory - src/test_libraries - tcCases.c
Test: min.info
Date: 2009-06-18 Instrumented lines: 37
Code covered: 73.0 % Executed lines: 27

       1                 : /*
       2                 :  * This file is part of MIN Test Framework. Copyright © 2008 Nokia Corporation
       3                 :  * and/or its subsidiary(-ies).
       4                 :  * Contact: Konrad Marek Zapalowicz
       5                 :  * Contact e-mail: DG.MIN-Support@nokia.com
       6                 :  * 
       7                 :  * This program is free software: you can redistribute it and/or modify it 
       8                 :  * under the terms of the GNU General Public License as published by the Free 
       9                 :  * Software Foundation, version 2 of the License. 
      10                 :  * 
      11                 :  * This program is distributed in the hope that it will be useful, but WITHOUT 
      12                 :  * ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or 
      13                 :  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General  Public License for
      14                 :  * more details. You should have received a copy of the GNU General Public 
      15                 :  * License along with this program. If not,  see 
      16                 :  * <http://www.gnu.org/licenses/>.
      17                 :  */
      18                 : 
      19                 : 
      20                 : /**
      21                 :  *  @file       tcCases.c
      22                 :  *  @version    0.1
      23                 :  *  @brief      This file contains implementation of tc
      24                 :  *              test module test functions.
      25                 :  */
      26                 : 
      27                 : /* ------------------------------------------------------------------------- */
      28                 : /* INCLUDE FILES */
      29                 : #include "tc.h"
      30                 : 
      31                 : /* ------------------------------------------------------------------------- */
      32                 : /* EXTERNAL DATA STRUCTURES */
      33                 : /* None */
      34                 : 
      35                 : /* ------------------------------------------------------------------------- */
      36                 : /* EXTERNAL GLOBAL VARIABLES */
      37                 : char *module_date = __DATE__;
      38                 : char *module_time = __TIME__;
      39                 : /* ------------------------------------------------------------------------- */
      40                 : /* EXTERNAL FUNCTION PROTOTYPES */
      41                 : /* None */
      42                 : 
      43                 : /* ------------------------------------------------------------------------- */
      44                 : /* GLOBAL VARIABLES */
      45                 : /* None */
      46                 : 
      47                 : /* ------------------------------------------------------------------------- */
      48                 : /* CONSTANTS */
      49                 : /* None */
      50                 : 
      51                 : /* ------------------------------------------------------------------------- */
      52                 : /* MACROS */
      53                 : /* None */
      54                 : 
      55                 : /* ------------------------------------------------------------------------- */
      56                 : /* LOCAL GLOBAL VARIABLES */
      57                 : /* None */
      58                 : 
      59                 : /* ------------------------------------------------------------------------- */
      60                 : /* LOCAL CONSTANTS AND MACROS */
      61                 : /* None */
      62                 : 
      63                 : /* ------------------------------------------------------------------------- */
      64                 : /* MODULE DATA STRUCTURES */
      65                 : /* None */
      66                 : 
      67                 : /* ------------------------------------------------------------------------- */
      68                 : /* LOCAL FUNCTION PROTOTYPES */
      69                 : /* None */
      70                 : 
      71                 : /* ------------------------------------------------------------------------- */
      72                 : /* FORWARD DECLARATIONS */
      73                 : /* ------------------------------------------------------------------------- */
      74                 : LOCAL int       ExampleTest (MinItemParser * item);
      75                 : LOCAL int       One (MinItemParser * item);
      76                 : LOCAL int       Two (MinItemParser * item);
      77                 : LOCAL int       Three (MinItemParser * item);
      78                 : /* ------------------------------------------------------------------------- */
      79                 : /* ==================== LOCAL FUNCTIONS ==================================== */
      80                 : /* ------------------------------------------------------------------------- */
      81                 : LOCAL int ExampleTest (MinItemParser * item)
      82               1 : {
      83               1 :         char           *string = INITPTR;
      84               1 :         int             i = 0;
      85                 : 
      86               8 :         while (mip_get_next_string (item, &string) == ENOERR) {
      87                 : 
      88               6 :                 tm_printf (i, "tc", "Param[%d]: %s", i,
      89                 :                            string);
      90               6 :                 i++;
      91                 : 
      92               6 :                 DELETE (string);
      93                 :         }
      94                 : 
      95               1 :         return ENOERR;
      96                 : }
      97                 : 
      98                 : LOCAL int One (MinItemParser * item)
      99              12 : {
     100                 : 
     101                 : 
     102              12 :         return ENOERR;
     103                 : }
     104                 : 
     105                 : LOCAL int Two (MinItemParser * item)
     106               2 : {
     107                 : 
     108                 : 
     109               2 :         return ENOERR;
     110                 : }
     111                 : 
     112                 : LOCAL int Three (MinItemParser * item)
     113               2 : {
     114                 : 
     115                 : 
     116               2 :         return ENOERR;
     117                 : }
     118                 : 
     119                 : LOCAL int FailingOne (MinItemParser * item)
     120               0 : {
     121                 : 
     122                 : 
     123               0 :         return -1;
     124                 : }
     125                 : 
     126                 : LOCAL int CheckThreshold (MinItemParser * item)
     127              10 : {
     128                 :         int threshold;
     129                 :         long failcount;
     130                 : 
     131              10 :         if (mip_get_next_int (item, &threshold) != ENOERR) {
     132               0 :                 tm_printf (0, "", "Threshold parameter missing");
     133               0 :                 return -1;
     134                 :         }
     135              10 :         if (GetLocalValueInt ("FAIL_COUNT", &failcount) != 0) {
     136               0 :                 tm_printf (0, "", "Failed to get FAIL_COUNT");
     137               0 :                 return -1;
     138                 :         } 
     139              10 :         if (failcount >= threshold) {
     140               0 :                 tm_printf (0, "", "Fail count %d exceed threshold %d, setting "
     141                 :                            "variable bailout", failcount, threshold);
     142               0 :                 if (SetLocalValue ("bailout", "true") != 0) {
     143               0 :                         tm_printf (0, "", "Failed to set var bailout");
     144               0 :                         return -1;
     145                 :                 }
     146                 :         } 
     147                 :         
     148              10 :         return ENOERR;
     149                 : }
     150                 : 
     151                 : /* ------------------------------------------------------------------------- */
     152                 : /* ======================== FUNCTIONS ====================================== */
     153                 : /* ------------------------------------------------------------------------- */
     154                 : int ts_get_test_cases (DLList ** list)
     155             255 : {
     156                 :         /*
     157                 :          * Copy this line for every implemented function.
     158                 :          * * First string is the function name used in TestScripter file.
     159                 :          * * Second is the actual implementation function. 
     160                 :          */
     161             255 :         ENTRYTC (*list, "Example", ExampleTest);
     162             255 :         ENTRYTC (*list, "One", One);
     163             255 :         ENTRYTC (*list, "Two", Two);
     164             255 :         ENTRYTC (*list, "Three", Three);
     165             255 :         ENTRYTC (*list, "FailingOne", FailingOne);
     166             255 :         ENTRYTC (*list, "CheckThreshold", CheckThreshold);
     167                 : 
     168                 :         /*
     169                 :          * ADD NEW ENTRY HERE 
     170                 :          */
     171             255 :         return 0;
     172                 : }
     173                 : 
     174                 : /* ------------------------------------------------------------------------- */
     175                 : /* ================= OTHER EXPORTED FUNCTIONS ============================== */
     176                 : /* None */
     177                 : 
     178                 : /* ------------------------------------------------------------------------- */
     179                 : /* End of file */

Generated by: LTP GCOV extension version 1.6