summaryrefslogtreecommitdiff
path: root/source/tests/string_ref.test.c
blob: 8ce936884e5f0c3711b6b6acef9dc980de4a8ae7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "../kit/string_ref.h"

#define KIT_TEST_FILE string_ref
#include "../kit/test.h"

TEST("static string wrap") {
  str_t ref = SZ("foo bar");

  REQUIRE(ref.size == 7);
  REQUIRE(ref.values[0] == 'f');
  REQUIRE(ref.values[1] == 'o');
  REQUIRE(ref.values[2] == 'o');
  REQUIRE(ref.values[3] == ' ');
  REQUIRE(ref.values[4] == 'b');
  REQUIRE(ref.values[5] == 'a');
  REQUIRE(ref.values[6] == 'r');
}

TEST("string literal") {
  str_t foo = SZ("foo");
  str_t bar = foo;
  (void) bar;
}

#undef KIT_TEST_FILE