void test_tolower() { uint32_t u; const char *map = 0; map = nu_tolower(0x0041); /* A */ assert(map != 0); nu_casemap_read(map, &u); assert(u == 0x0061); /* a */ map = nu_tolower(0x0401); /* Ё */ assert(map != 0); nu_casemap_read(map, &u); assert(u == 0x0451); /* ё */ map = nu_tolower(0x00D4); /* Ô */ assert(map != 0); nu_casemap_read(map, &u); assert(u == 0x00F4); /* ô */ map = nu_tolower(0x00C6); /* Æ */ assert(map != 0); nu_casemap_read(map, &u); assert(u == 0x00E6); /* æ */ assert(nu_tolower(0x00A0) == 0); assert(nu_tolower(0x0061) == 0); }
const char* _nu_tolower(const char *encoded, const char *limit, nu_read_iterator_t read, uint32_t *u, const char **transform, void *context) { (void)(context); uint32_t _u = 0; const char *np = read(encoded, &_u); if (u != 0) { *u = _u; } /* handling of 0x03A3 ('Σ') * * this is the only language-independent exception described in * SpecialCasing.txt (Unicode 7.0) */ assert(nu_casemap_read == nu_utf8_read); if (_u == 0x03A3) { if (np >= limit) { *transform = __nu_final_sigma; return np; } uint32_t nu = 0; read(np, &nu); if (nu == 0) { *transform = __nu_final_sigma; return np; } } *transform = nu_tolower(_u); return np; }