LCOV - code coverage report
Current view: top level - tests - hook-list-test.c (source / functions) Hit Total Coverage
Test: lcov.out Lines: 15 15 100.0 %
Date: 2012-07-17 Functions: 3 3 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : #ifdef HAVE_CONFIG_H
       2                 :            : #include <config.h>
       3                 :            : #endif
       4                 :            : 
       5                 :            : #include <pulsecore/hook-list.h>
       6                 :            : #include <pulsecore/log.h>
       7                 :            : 
       8                 :          4 : static pa_hook_result_t func1(const char *hook_data, const char *call_data, const char *slot_data) {
       9                 :          4 :     pa_log("(func1) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
      10                 :          4 :     return PA_HOOK_OK;
      11                 :            : }
      12                 :            : 
      13                 :          1 : static pa_hook_result_t func2(const char *hook_data, const char *call_data, const char *slot_data) {
      14                 :          1 :     pa_log("(func2) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
      15                 :          1 :     return PA_HOOK_OK;
      16                 :            : }
      17                 :            : 
      18                 :          1 : int main(int argc, char *argv[]) {
      19                 :            :     pa_hook hook;
      20                 :            :     pa_hook_slot *slot;
      21                 :            : 
      22                 :          1 :     pa_hook_init(&hook, (void*) "hook");
      23                 :            : 
      24                 :          1 :     pa_hook_connect(&hook, PA_HOOK_LATE, (pa_hook_cb_t) func1, (void*) "slot1");
      25                 :          1 :     slot = pa_hook_connect(&hook, PA_HOOK_NORMAL, (pa_hook_cb_t) func2, (void*) "slot2");
      26                 :          1 :     pa_hook_connect(&hook, PA_HOOK_NORMAL, (pa_hook_cb_t) func1, (void*) "slot3");
      27                 :            : 
      28                 :          1 :     pa_hook_fire(&hook, (void*) "call1");
      29                 :            : 
      30                 :          1 :     pa_hook_slot_free(slot);
      31                 :            : 
      32                 :          1 :     pa_hook_fire(&hook, (void*) "call2");
      33                 :            : 
      34                 :          1 :     pa_hook_done(&hook);
      35                 :            : 
      36                 :            :     return 0;
      37                 :            : }

Generated by: LCOV version 1.9