aboutsummaryrefslogtreecommitdiff
path: root/libk/string/test.cc
blob: 4d7d340e7e627f20885ad413e61a6466ffa64e9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string.h>

// strlen
static_assert(strlen("") == 0);
static_assert(strlen("0") == 1);
static_assert(strlen("hello") == 5);
static_assert(strlen("world") == 5);

// reverse
static_assert([]() {
  char s[] = "xyz";
  reverse(s, strlen(s));
  return s[0] == 'z' && s[1] == 'y' && s[2] == 'x' && s[3] == '\0';
}());