def gen_function_wrapper(name, local_vars, args_dispatch):
    """
    Creates test function wrapper code. A wrapper has the code to
    unpack parameters from parameters[] array.

    :param name: Test function name
    :param local_vars: Local variables declaration code
    :param args_dispatch: List of dispatch arguments.
           Ex: ['(char *)params[0]', '*((int *)params[1])']
    :return: Test function wrapper.
    """
    # Then create the wrapper
    wrapper = '''
void {name}_wrapper( void ** params )
{{
{unused_params}{locals}
    {name}( {args} );
}}
'''.format(name=name,
           unused_params='' if args_dispatch else '    (void)params;\n',
           args=', '.join(args_dispatch),
           locals=local_vars)
    return wrapper