summaryrefslogtreecommitdiff
path: root/source/test/unittests/input_buffer.test.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/test/unittests/input_buffer.test.c')
-rw-r--r--source/test/unittests/input_buffer.test.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/test/unittests/input_buffer.test.c b/source/test/unittests/input_buffer.test.c
new file mode 100644
index 0000000..c7edb8f
--- /dev/null
+++ b/source/test/unittests/input_buffer.test.c
@@ -0,0 +1,20 @@
+#include "../../kit/input_buffer.h"
+
+#define KIT_TEST_FILE input_buffer
+#include "../../kit_test/test.h"
+
+TEST("input buffer") {
+ cstr text = { .size = 3, .values = "foo" };
+ struct is_handle in = IS_WRAP_STRING(text);
+ struct ib_handle first = IB_WRAP(in);
+
+ struct ib_handle second = ib_read(first, 3);
+
+ REQUIRE(!second.error);
+ REQUIRE(second.data.size == 3);
+ REQUIRE(AR_EQUAL(text, second.data));
+
+ ib_destroy(second);
+ ib_destroy(first);
+ is_destroy(in);
+}