blob: d67c4090638b0560b7ff5fc3712eb6cd911db97c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include <string.h>
#include <wchar.h>
#include "dged/utf8.h"
#include "assert.h"
#include "test.h"
void test_nchars_nbytes() {
ASSERT(utf8_nchars((uint8_t *)"👴", strlen("👴")) == 1,
"Expected old man emoji to be 1 char");
ASSERT(utf8_nbytes((uint8_t *)"👴", strlen("👴"), 1) == 4,
"Expected old man emoji to be 4 bytes");
}
void run_utf8_tests() { run_test(test_nchars_nbytes); }
|