util.h - libgrapheme - unicode string library | |
git clone git://git.suckless.org/libgrapheme | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
util.h (1612B) | |
--- | |
1 /* See LICENSE file for copyright and license details. */ | |
2 #ifndef UTIL_H | |
3 #define UTIL_H | |
4 | |
5 #include "../gen/types.h" | |
6 #include "../grapheme.h" | |
7 | |
8 #undef MIN | |
9 #define MIN(x, y) ((x) < (y) ? (x) : (y)) | |
10 #undef LEN | |
11 #define LEN(x) (sizeof(x) / sizeof(*(x))) | |
12 | |
13 struct unit_test_next_break { | |
14 const char *description; | |
15 | |
16 struct { | |
17 const uint_least32_t *src; | |
18 size_t srclen; | |
19 } input; | |
20 | |
21 struct { | |
22 size_t ret; | |
23 } output; | |
24 }; | |
25 | |
26 struct unit_test_next_break_utf8 { | |
27 const char *description; | |
28 | |
29 struct { | |
30 const char *src; | |
31 size_t srclen; | |
32 } input; | |
33 | |
34 struct { | |
35 size_t ret; | |
36 } output; | |
37 }; | |
38 | |
39 int run_break_tests(size_t (*next_break)(const uint_least32_t *, size_t), | |
40 const struct break_test *test, size_t testlen, | |
41 const char *); | |
42 int run_unit_tests(int (*unit_test_callback)(const void *, size_t, const… | |
43 const char *), | |
44 const void *, size_t, const char *, const char *); | |
45 | |
46 int unit_test_callback_next_break(const struct unit_test_next_break *, s… | |
47 size_t (*next_break)(const uint_least3… | |
48 size_t), | |
49 const char *, const char *); | |
50 int unit_test_callback_next_break_utf8(const struct unit_test_next_break… | |
51 size_t, | |
52 size_t (*next_break_utf8)(const c… | |
53 size_t), | |
54 const char *, const char *); | |
55 | |
56 #endif /* UTIL_H */ |