]> jfr.im git - solanum.git/blame - tests/client_util.h
tests: add client util make_local_person_oper()
[solanum.git] / tests / client_util.h
CommitLineData
d2b5f411
SA
1/*
2 * client_util.c: Utility functions for making test clients
3 * Copyright 2017 Simon Arlott
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18 * USA
19 */
20#include <stdio.h>
21#include <string.h>
22#include <stdlib.h>
23#include <unistd.h>
24
25#include "stdinc.h"
26#include "ircd_defs.h"
27#include "msg.h"
28#include "client.h"
29
30#define TEST_NICK "test"
31#define TEST_USERNAME "username"
32#define TEST_HOSTNAME "example.test"
33#define TEST_IP "2001:db8::1:5ee:bad:c0de"
34#define TEST_REALNAME "Test user"
35
36#define CRLF "\r\n"
37
38void client_util_init(void);
39void client_util_free(void);
40
41struct Client *make_local_person(void);
42struct Client *make_local_person_nick(const char *nick);
43struct Client *make_local_person_full(const char *nick, const char *username, const char *hostname, const char *ip, const char *realname);
6af47466 44void make_local_person_oper(struct Client *client);
d2b5f411
SA
45void remove_local_person(struct Client *client);
46
47char *get_client_sendq(const struct Client *client);
48
49#define is_client_sendq_empty(client, message, ...) do { \
50 is_string("", get_client_sendq(client), message, ##__VA_ARGS__); \
51 } while (0)
52
53#define is_client_sendq(queue, client, message, ...) do { \
54 is_string(queue, get_client_sendq(client), message, ##__VA_ARGS__); \
55 is_client_sendq_empty(client, message, ##__VA_ARGS__); \
56 } while (0)