summaryrefslogtreecommitdiff
path: root/source/test/unittests/input_buffer.test.c
blob: 23499ee55ffa5caddbb47a54e83a656d934554cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "../../kit/input_buffer.h"

#define KIT_TEST_FILE input_buffer
#include "../../kit_test/test.h"

TEST("input buffer") {
  cstr_t      text  = { .size = 3, .values = "foo" };
  is_handle_t in    = IS_WRAP_STRING(text);
  ib_handle_t first = IB_WRAP(in);

  ib_handle_t 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);
}