summaryrefslogtreecommitdiff
path: root/source/tests/input_stream.test.c
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-02 20:59:29 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-02 20:59:29 +0200
commit835e1fcd131c63ee2b3b647e327b33a3bfb369e3 (patch)
tree9d6fb42d6296a7bbec4a6ea58358c0fdb5de7e05 /source/tests/input_stream.test.c
parent34ba87d8c8cfef5ed249b34bd2d2b7e41a34d2f7 (diff)
downloadkit-835e1fcd131c63ee2b3b647e327b33a3bfb369e3.zip
[Linux] Change build system; Remove CMake
Diffstat (limited to 'source/tests/input_stream.test.c')
-rw-r--r--source/tests/input_stream.test.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/tests/input_stream.test.c b/source/tests/input_stream.test.c
new file mode 100644
index 0000000..61c2254
--- /dev/null
+++ b/source/tests/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";
+
+ str_t foo_ref = { .size = sizeof(foo) - 1, .values = foo };
+ str_t bar_ref = { .size = sizeof(bar) - 1, .values = bar };
+
+ is_handle_t in = IS_WRAP_STRING(foo_ref);
+
+ char buf[4];
+ out_str_t 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);
+}