summaryrefslogtreecommitdiff
path: root/source/test/unittests/input_stream.test.c
diff options
context:
space:
mode:
authorMitya Selivanov <0x7fffff@guattari.ru>2022-08-06 16:32:59 +0400
committerMitya Selivanov <0x7fffff@guattari.ru>2022-08-06 16:32:59 +0400
commitf2fb8311d373cfd498dfbebc539982b8ad174615 (patch)
tree21cbc87cc5fb9ca3e75582ff2920aa83213617e4 /source/test/unittests/input_stream.test.c
parent1bf74ae58678cd91b95ccda6087be7ca0a452eee (diff)
downloadkit-f2fb8311d373cfd498dfbebc539982b8ad174615.zip
input buffer, dynamic array
Diffstat (limited to 'source/test/unittests/input_stream.test.c')
-rw-r--r--source/test/unittests/input_stream.test.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/test/unittests/input_stream.test.c b/source/test/unittests/input_stream.test.c
new file mode 100644
index 0000000..9fef47a
--- /dev/null
+++ b/source/test/unittests/input_stream.test.c
@@ -0,0 +1,23 @@
+#include "../../kit/input_stream.h"
+
+#define KIT_TEST_FILE input_stream
+#include "../../kit_test/test.h"
+
+TEST("input stream wrap string") {
+ char foo[] = "test";
+ char bar[] = "test";
+
+ cstr foo_ref = { .size = sizeof(foo) - 1, .values = foo };
+ cstr bar_ref = { .size = sizeof(bar) - 1, .values = bar };
+
+ struct is_handle in = IS_WRAP_STRING(foo_ref);
+
+ char buf[4];
+ out_str buf_ref = { .size = sizeof(buf), .values = buf };
+
+ REQUIRE(IS_READ(in, buf_ref) == buf_ref.size);
+ REQUIRE(AR_EQUAL(foo_ref, bar_ref));
+ REQUIRE(AR_EQUAL(buf_ref, bar_ref));
+
+ is_destroy(in);
+}