vt: unittest: verify emoji_vs list is sorted

This commit is contained in:
Daniel Eklöf 2024-06-25 08:23:40 +02:00
parent ecb1ca61af
commit 7378ecf9a7
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

14
vt.c
View file

@ -672,6 +672,20 @@ emoji_vs_compare(const void *_key, const void *_entry)
else
return 0;
}
UNITTEST
{
/* Verify the emoji_vs list is sorted */
int64_t last_end = -1;
for (size_t i = 0; i < sizeof(emoji_vs) / sizeof(emoji_vs[0]); i++) {
const struct emoji_vs *vs = &emoji_vs[i];
xassert(vs->start <= vs->end);
xassert(vs->start > last_end);
xassert(vs->vs15 || vs->vs16);
last_end = vs->end;
}
}
#endif
static void