From f2fb8311d373cfd498dfbebc539982b8ad174615 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov <0x7fffff@guattari.ru> Date: Sat, 6 Aug 2022 16:32:59 +0400 Subject: input buffer, dynamic array --- source/test/unittests/input_stream.test.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 source/test/unittests/input_stream.test.c (limited to 'source/test/unittests/input_stream.test.c') 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); +} -- cgit v1.2.3