QuickIO  0.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
test.h
Go to the documentation of this file.
1 
12 #include <check.h>
13 #include "quickio.h"
14 #include "check_compat.h"
15 
26 void test_new(
27  const gchar *suite_name,
28  SRunner **sr,
29  Suite **s);
30 
37 gboolean test_do(SRunner *sr);
38 
42 void test_config();
43 
47 void test_config_rm();
48 
53 void test_setup();
54 
58 void test_setup_with_config(gchar *config);
59 
63 void test_teardown();
64 
69 
74 
83 void test_send(
84  qev_fd_t tc,
85  const gchar *data);
86 
97 void test_send_len(
98  qev_fd_t tc,
99  const gchar *data,
100  const guint64 len);
101 
115 guint64 test_recv(
116  qev_fd_t tc,
117  gchar *data,
118  const guint64 len);
119 
123 void test_msg(qev_fd_t tc, const gchar *data);
124 
128 void test_cb(qev_fd_t tc, const gchar *msg, const gchar *data);
129 
133 void test_ping(qev_fd_t tc);
134 
142 void test_wait_for_buff(const guint len);
143 
147 struct client* test_get_client();
148 
153 struct client* test_get_client_raw();
154 
158 void test_heartbeat();
159 
163 void test_client_dead(qev_fd_t tc);
164 
168 void test_close(qev_fd_t tc);
qev_fd_t test_socket()
Get a new socket connected to localhost on the test's port.
void test_setup_with_config(gchar *config)
Setup the server including the given config path.
gboolean test_do(SRunner *sr)
Runs a test and returns if everything passed.
qev_fd_t test_client()
Get a client connected to QIO.
void test_setup()
A checked fixture: starts up QIO and gets everything ready for a test.
void test_teardown()
A checked teardown: tears down QIO and frees up all memory used.
void test_send_len(qev_fd_t tc, const gchar *data, const guint64 len)
Send a message from the client to the server.
void test_close(qev_fd_t tc)
Close and free up any resources the client was using.
void test_ping(qev_fd_t tc)
Tests that the client is alive by pinging the server.
void test_config_rm()
Remove the created configuration file.
void test_heartbeat()
Force send out heartbeats.
Everything that a client needs to function.
Definition: client.h:100
void test_client_dead(qev_fd_t tc)
Tests that the client was closed by the server.
guint64 test_recv(qev_fd_t tc, gchar *data, const guint64 len)
Receive a message from the server to the client.
void test_msg(qev_fd_t tc, const gchar *data)
Tests that the received message is what is given.
void test_send(qev_fd_t tc, const gchar *data)
Send a message from the client to the server.
Every header, definition, and whatnot QuickIO needs to run.
struct client * test_get_client_raw()
Get the last client in the clients list, not waiting for it to be handshaked or anything.
int qev_fd_t
Sockets are just ints.
Definition: qev.h:170
void test_cb(qev_fd_t tc, const gchar *msg, const gchar *data)
Tests that the given callback is recieved in response to the message.
Older versions of check don't support the new macros; this file just monkeys them onto it...
void test_config()
Create the default test config file.
void test_wait_for_buff(const guint len)
Waits for all of the connected clients to have userspace buffers.
void test_new(const gchar *suite_name, SRunner **sr, Suite **s)
Create a new test suite, ready for running.
struct client * test_get_client()
Get the last client in the clients list.