about summary refs log tree commit diff stats
path: root/tests/otr/mock_otr.c
blob: 8750feb73297f36da3b65ebb986900454df79521 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>

#include "otr/otr.h"
#include "config/account.h"

static void
_mock_otr_keygen(ProfAccount *account)
{
    check_expected(account);
}

static char *
_mock_otr_libotr_version(void)
{
    return (char *)mock();
}

void
mock_otr_keygen(void)
{
    otr_keygen = _mock_otr_keygen;
}

void
mock_otr_libotr_version(void)
{
    otr_libotr_version = _mock_otr_libotr_version;
}

void
otr_keygen_expect(ProfAccount *account)
{
    expect_memory(_mock_otr_keygen, account, account, sizeof(ProfAccount));
}

void
otr_libotr_version_returns(char *version)
{
    will_return(_mock_otr_libotr_version, version);
}