src/test/transport.h
branchnew-transport
changeset 168 a58ad50911fc
child 196 873796250c60
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/transport.h	Mon May 04 20:55:04 2009 +0300
@@ -0,0 +1,44 @@
+#ifndef TEST_TRANSPORT_H
+#define TEST_TRANSPORT_H
+
+/**
+ * @file
+ *
+ * Functions for interacting with transports
+ */
+#include "../transport_test.h"
+
+/**
+ * Read strlen(str) bytes from the given transport, and assert that they match the given string.
+ *
+ * Note that this only performs one transport_read.
+ */
+void assert_transport_read (transport_t *transport, const char *str);
+
+/**
+ * Write strlen(str) bytes to the given transport, and assert that they all get written.
+ *
+ * Note that this only performs one transport_write.
+ */
+void assert_transport_write (transport_t *transport, const char *str);
+
+/**
+ * Attempt to read a single byte from the given transport, and assert that the attempt returns ERR_EOF.
+ */
+void assert_transport_eof (transport_t *transport);
+
+/**
+ * Compare the written data stored in the given transport_test with the string obtained using the given format and args.
+ *
+ * This will pull /all/ of the data in the transport.
+ */
+void assert_transport_data (struct transport_test *tp, const char *fmt, ...);
+
+/**
+ * Create an empty transport_test, with NULL callbacks.
+ *
+ * You must bind a new set of callbacks to the transport before pushing any data to it.
+ */
+struct transport_test* setup_transport_test (void);
+
+#endif