author | Tero Marttila <terom@fixme.fi> |
Wed, 27 May 2009 23:57:48 +0300 | |
branch | new-lib-errors |
changeset 217 | 7728d6ec3abf |
parent 196 | 873796250c60 |
permissions | -rw-r--r-- |
168 | 1 |
#ifndef TEST_TRANSPORT_H |
2 |
#define TEST_TRANSPORT_H |
|
3 |
||
4 |
/** |
|
5 |
* @file |
|
6 |
* |
|
7 |
* Functions for interacting with transports |
|
8 |
*/ |
|
9 |
#include "../transport_test.h" |
|
10 |
||
11 |
/** |
|
12 |
* Read strlen(str) bytes from the given transport, and assert that they match the given string. |
|
13 |
* |
|
14 |
* Note that this only performs one transport_read. |
|
15 |
*/ |
|
16 |
void assert_transport_read (transport_t *transport, const char *str); |
|
17 |
||
18 |
/** |
|
19 |
* Write strlen(str) bytes to the given transport, and assert that they all get written. |
|
20 |
* |
|
21 |
* Note that this only performs one transport_write. |
|
22 |
*/ |
|
23 |
void assert_transport_write (transport_t *transport, const char *str); |
|
24 |
||
25 |
/** |
|
26 |
* Attempt to read a single byte from the given transport, and assert that the attempt returns ERR_EOF. |
|
27 |
*/ |
|
28 |
void assert_transport_eof (transport_t *transport); |
|
29 |
||
30 |
/** |
|
196
873796250c60
implement msg_proto and associated test, fix misc. other bugs (including changing error_info::code to a signed int\!)
Tero Marttila <terom@fixme.fi>
parents:
168
diff
changeset
|
31 |
* Compare the written data stored in the given transport_test with the given buffer. |
168 | 32 |
* |
33 |
* This will pull /all/ of the data in the transport. |
|
34 |
*/ |
|
196
873796250c60
implement msg_proto and associated test, fix misc. other bugs (including changing error_info::code to a signed int\!)
Tero Marttila <terom@fixme.fi>
parents:
168
diff
changeset
|
35 |
void assert_transport_data_buf (struct transport_test *tp, const char *data, size_t len); |
873796250c60
implement msg_proto and associated test, fix misc. other bugs (including changing error_info::code to a signed int\!)
Tero Marttila <terom@fixme.fi>
parents:
168
diff
changeset
|
36 |
|
873796250c60
implement msg_proto and associated test, fix misc. other bugs (including changing error_info::code to a signed int\!)
Tero Marttila <terom@fixme.fi>
parents:
168
diff
changeset
|
37 |
/** |
873796250c60
implement msg_proto and associated test, fix misc. other bugs (including changing error_info::code to a signed int\!)
Tero Marttila <terom@fixme.fi>
parents:
168
diff
changeset
|
38 |
* Use assert_transport_data_buf() with the given formatted string. |
873796250c60
implement msg_proto and associated test, fix misc. other bugs (including changing error_info::code to a signed int\!)
Tero Marttila <terom@fixme.fi>
parents:
168
diff
changeset
|
39 |
*/ |
168 | 40 |
void assert_transport_data (struct transport_test *tp, const char *fmt, ...); |
41 |
||
42 |
/** |
|
43 |
* Create an empty transport_test, with NULL callbacks. |
|
44 |
* |
|
45 |
* You must bind a new set of callbacks to the transport before pushing any data to it. |
|
46 |
*/ |
|
47 |
struct transport_test* setup_transport_test (void); |
|
48 |
||
49 |
#endif |