LTP GCOV extension - code coverage report
Current view: directory - src/services/event_system - min_test_event_if.tests
Test: min.info
Date: 2009-06-18 Instrumented lines: 48
Code covered: 100.0 % Executed lines: 48

       1                 : /*
       2                 :  * This file is part of MIN Test Framework. Copyright © 2008 Nokia Corporation
       3                 :  * and/or its subsidiary(-ies).
       4                 :  * Contact: Sampo Saaristo
       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       min_test_event_if.tests
      22                 :  *  @version    0.1
      23                 :  *  @brief      This file contains unit tests for MIN test event interface.
      24                 :  */
      25                 : 
      26                 : /* ------------------------------------------------------------------------- */
      27                 : /* INCLUDE FILES */
      28                 : #include <check.h>
      29                 : /* ------------------------------------------------------------------------- */
      30                 : /* EXTERNAL DATA STRUCTURES */
      31                 : /* None */
      32                 : 
      33                 : /* ------------------------------------------------------------------------- */
      34                 : /* EXTERNAL FUNCTION PROTOTYPES */
      35                 : 
      36                 : /* ------------------------------------------------------------------------- */
      37                 : /* CONSTANTS */
      38                 : /* None */
      39                 : 
      40                 : /* ------------------------------------------------------------------------- */
      41                 : /* MACROS */
      42                 : 
      43                 : /* ------------------------------------------------------------------------- */
      44                 : /* LOCAL CONSTANTS AND MACROS */
      45                 : /* None */
      46                 : 
      47                 : /* ------------------------------------------------------------------------- */
      48                 : /* MODULE DATA STRUCTURES */
      49                 : minEventIf *event;
      50                 : /* ------------------------------------------------------------------------- */
      51                 : /* LOCAL FUNCTION PROTOTYPES */
      52                 : /* None */
      53                 : 
      54                 : /* ------------------------------------------------------------------------- */
      55                 : /* FORWARD DECLARATIONS */
      56                 : /* None */
      57                 : 
      58                 : /* ==================== LOCAL FUNCTIONS ==================================== */
      59                 : void setup()
      60               4 : {
      61               4 :         event = min_event_create (NULL, 0);
      62               4 : }
      63                 : 
      64                 : void teardown()
      65               4 : {
      66               4 :         min_event_destroy (event);
      67               4 : }
      68                 : 
      69               1 : START_TEST (test_event_req_type)
      70                 : {
      71                 :         TEventReq_t reqtype;
      72                 :         
      73               1 :         reqtype = ERelEvent;
      74               1 :         event->SetType (event, reqtype);
      75                 : 
      76               1 :         fail_unless (event->Type(event) == reqtype);
      77                 : }
      78               1 : END_TEST
      79                 : 
      80                 : 
      81               1 : START_TEST (test_event_type)
      82                 : {
      83               1 :         TEventType_t type = EState;
      84                 :         
      85               1 :         event->SetEventType (event, type);
      86                 : 
      87               1 :         fail_unless (event->EventType(event) == type); 
      88                 : }
      89               1 : END_TEST
      90                 : 
      91               1 : START_TEST (test_event_name)
      92                 : {
      93               1 :         TEventName_t name = "mintest";
      94                 :         
      95               1 :         event->SetName (event, name);
      96               1 :         fail_if (strcmp(name, event->Name(event)));
      97                 : 
      98                 : }
      99               1 : END_TEST
     100                 : 
     101               1 : START_TEST (test_event_validate)
     102                 : {
     103                 :         int ret;
     104               1 :         TEventName_t name = "mintest1";
     105                 :                 
     106               1 :         ret = validate_event(event);
     107                 :         
     108               1 :         fail_unless (ret == 1);
     109                 : 
     110               1 :         set_event_stuff (event, EReqEvent, "mintest1", EIndication);
     111                 :         
     112               1 :         ret = validate_event(event);
     113                 :         
     114               1 :         fail_unless (ret == 0);
     115                 : 
     116                 : }
     117               1 : END_TEST
     118                 : 
     119                 : 
     120                 : Suite *mintesteventif_suite (void)
     121               1 :      {
     122               1 :        Suite *s = suite_create ("mintesteventif");
     123                 : 
     124                 :        /* Core test case */
     125               1 :        TCase *tc_core = tcase_create ("Core");
     126               1 :        tcase_add_checked_fixture (tc_core, setup, teardown);
     127                 :        
     128               1 :        tcase_add_test (tc_core, test_event_req_type);
     129               1 :        tcase_add_test (tc_core, test_event_type);
     130               1 :        tcase_add_test (tc_core, test_event_name);
     131               1 :        tcase_add_test (tc_core, test_event_validate);
     132                 : 
     133               1 :        suite_add_tcase (s, tc_core);
     134                 : 
     135               1 :        return s;
     136                 :      }
     137                 : 
     138                 : 
     139                 : /* ======================== FUNCTIONS ====================================== */
     140                 : /* ------------------------------------------------------------------------- */
     141                 : 
     142                 : int mintesteventif_tests()
     143               1 : {
     144               1 :         int number_failed = 0;
     145               1 :         Suite   * s  = mintesteventif_suite ();
     146               1 :         SRunner * sr = srunner_create (s);
     147               1 :         srunner_set_fork_status (sr, CK_NOFORK);        
     148               1 :         srunner_run_all(sr, CK_NORMAL);
     149               1 :         number_failed = srunner_ntests_failed(sr);
     150               1 :         srunner_free(sr);
     151               1 :         return number_failed;
     152                 : }
     153                 : 
     154                 : 
     155                 : 
     156                 : /* ------------------------------------------------------------------------- */
     157                 : 
     158                 : /* ------------------------------------------------------------------------- */
     159                 : 
     160                 : 
     161                 : /* ================= OTHER EXPORTED FUNCTIONS ============================== */
     162                 : /* None */
     163                 : /* End of file */

Generated by: LTP GCOV extension version 1.6