summaryrefslogtreecommitdiff
path: root/test/utf8.c
blob: 5b020c3f71df4b59cd7a9d9a7325c725a159b710 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "utf8.h"
#include "assert.h"
#include "test.h"
#include "wchar.h"

void test_nchars_nbytes() {
  ASSERT(utf8_nchars((uint8_t *)"👴", 2) == 1,
         "Expected old man emoji to be 1 char");
  ASSERT(utf8_nbytes((uint8_t *)"👴", 1) == 4,
         "Expected old man emoji to be 4 bytes");
}

void run_utf8_tests() { run_test(test_nchars_nbytes); }