LCOV - code coverage report
Current view: top level - opt/gitlab-ci-multi-runner/builds/00e3338d/0/taskrambler/taskrambler/tests/mock - mock_class.c (source / functions) Hit Total Coverage
Test: taskrambler v0.1.8 Lines: 19 19 100.0 %
Date: 2016-04-13 22:40:30 Functions: 5 5 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /**
       2                 :            :  * \file
       3                 :            :  * mock/class.c: a mock to test my oop stuff
       4                 :            :  * Copyright (C) 2011  Georg Hopp
       5                 :            :  *
       6                 :            :  * This program is free software: you can redistribute it and/or modify
       7                 :            :  * it under the terms of the GNU General Public License as published by
       8                 :            :  * the Free Software Foundation, either version 3 of the License, or
       9                 :            :  * (at your option) any later version.
      10                 :            :  *
      11                 :            :  * This program is distributed in the hope that it will be useful,
      12                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14                 :            :  * GNU General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU General Public License
      17                 :            :  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
      18                 :            :  */
      19                 :            : 
      20                 :            : #include <assert.h>
      21                 :            : #include <stdarg.h>
      22                 :            : 
      23                 :            : #include "class.h"
      24                 :            : #include "mock_class.h"
      25                 :            : 
      26                 :            : char _called;
      27                 :            : 
      28                 :            : void
      29                 :          5 : _reset()
      30                 :            : {
      31                 :          5 :     _called = 0;
      32                 :          5 : }
      33                 :            : 
      34                 :            : static
      35                 :            : inline
      36                 :            : int
      37                 :          4 : mockCtor(void * _this, va_list * params)
      38                 :            : {
      39                 :          4 :     MockClass this = _this;
      40                 :            : 
      41                 :          4 :     _called = 1;
      42                 :          4 :     this->value = va_arg(* params, int);
      43                 :            : 
      44                 :          4 :     if (321 == this->value)
      45                 :          1 :         return -1;
      46                 :            : 
      47                 :          3 :     return 0;
      48                 :            : }
      49                 :            : 
      50                 :            : static
      51                 :            : inline
      52                 :            : void
      53                 :          5 : mockDtor(void * _this)
      54                 :            : {
      55                 :          5 :     _called = 1;
      56                 :          5 : }
      57                 :            : 
      58                 :            : static
      59                 :            : inline
      60                 :            : void
      61                 :          1 : mockClone(void * _this, void * _base)
      62                 :            : {
      63                 :          1 :     MockClass this = _this;
      64                 :          1 :     MockClass base = _base;
      65                 :            : 
      66                 :          1 :     this->value = base->value;
      67                 :          1 : }
      68                 :            : 
      69                 :            : INIT_IFACE(Class, mockCtor, mockDtor, mockClone);
      70                 :          1 : CREATE_CLASS(MockClass, NULL, IFACE(Class));
      71                 :            : 
      72                 :            : // vim: set et ts=4 sw=4:

Generated by: LCOV version 1.11