LCOV - code coverage report
Current view: top level - test - reactor_src.c (source / functions) Hit Total Coverage
Test: all.info Lines: 43 43 100.0 %
Date: 2012-09-24 Functions: 1 1 100.0 %
Branches: 12 24 50.0 %

           Branch data     Line data    Source code
       1                 :            : 
       2                 :            : #include "gwrl/event.h"
       3                 :            : 
       4                 :          6 : int main(int argc, char ** argv) {
       5                 :          6 :         gwrl * rl = NULL;
       6                 :          6 :         gwrlsrc * src = NULL;
       7                 :          6 :         gwrlsrc * src2 = NULL;
       8                 :          6 :         gwrlsrc * src3 = NULL;
       9                 :            :         
      10                 :          6 :         rl = gwrl_create();
      11                 :            :         
      12                 :            :         //clear sources
      13                 :          6 :         rl->sources[GWRL_SRC_TYPE_FILE] = NULL;
      14                 :          6 :         src = gwrl_src_file_create(0,0,NULL,NULL);
      15                 :          6 :         gwrl_src_add(rl,src);
      16                 :          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE] != NULL);
      17                 :          6 :         gwrl_src_remove(rl,src);
      18         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE] == NULL);
      19                 :          6 :         gwrl_src_add(rl,src);
      20         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE] != NULL);
      21                 :          6 :         gwrl_src_del(rl,src,NULL,true);
      22         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE] == NULL);
      23                 :          6 :         src = NULL;
      24                 :            :         
      25                 :            :         //clear sources
      26                 :          6 :         rl->sources[GWRL_SRC_TYPE_FILE] = NULL;
      27                 :          6 :         src = gwrl_src_file_create(0,0,NULL,NULL);
      28                 :          6 :         src2 = gwrl_src_file_create(0,0,NULL,NULL);
      29                 :          6 :         gwrl_src_add(rl,src);
      30                 :          6 :         gwrl_src_add(rl,src2);
      31         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE] != NULL);
      32         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE] == src2);
      33         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE]->next == src);
      34                 :          6 :         gwrl_src_remove(rl,src);
      35         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE] == src2);
      36                 :          6 :         gwrl_src_add(rl,src);
      37         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE]->next == src2);
      38                 :          6 :         gwrl_src_remove(rl,src2);
      39         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE] == src);
      40                 :            :         
      41                 :          6 :         rl->sources[GWRL_SRC_TYPE_FILE] = NULL;
      42                 :          6 :         src = gwrl_src_file_create(0,0,NULL,NULL);
      43                 :          6 :         src2 = gwrl_src_file_create(0,0,NULL,NULL);
      44                 :          6 :         src3 = gwrl_src_file_create(0,0,NULL,NULL);
      45                 :          6 :         gwrl_src_add(rl,src);
      46                 :          6 :         gwrl_src_add(rl,src2);
      47                 :          6 :         gwrl_src_add(rl,src3);
      48                 :          6 :         gwrl_src_remove(rl,src2);
      49         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE] == src3);
      50         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE]->next == src);
      51         [ -  + ]:          6 :         assert(rl->sources[GWRL_SRC_TYPE_FILE]->next->next == NULL);
      52                 :            :         
      53                 :          6 :         return 0;
      54                 :            : }

Generated by: LCOV version 1.9