aboutsummaryrefslogtreecommitdiff
path: root/test_string.c
blob: 59da73941383ef861a3464bd578c8368d046537f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

#include "string.h"
#include "testing.h"

int test_string_literal_equality() {
  t_assert(Str_equals(S("Bonjour"), S("Bonjour")));
  return 0;
}

int test_string_copy() {
  Arena perm = Arena_new(128e3);
  Str src = S("Hello");

  Str *cpy = Str_copy(&perm, src.data, src.len);

  t_assert(Str_equals(src, *cpy));
  t_assert_equal(Arena_get_used(perm), 21);

  return 0;
}