test: adjust names of Unicode test functions

In test/py/conftest.py the assumption is made that for if a test is called
with `ut unicode` the test function name starts with 'unicode_test_'. As
the Unicode tests did not follow this naming scheme they were not executed
by `make tests`.

Rename the Unicode test functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Heinrich Schuchardt 2019-02-15 23:12:50 +01:00
parent 60c4454ddb
commit bc19681acf

View File

@ -50,7 +50,7 @@ static const char j1[] = {0x6a, 0x31, 0xa1, 0x6c, 0x00};
static const char j2[] = {0x6a, 0x32, 0xc3, 0xc3, 0x6c, 0x00};
static const char j3[] = {0x6a, 0x33, 0xf0, 0x90, 0xf0, 0x00};
static int ut_u16_strdup(struct unit_test_state *uts)
static int unicode_test_u16_strdup(struct unit_test_state *uts)
{
u16 *copy = u16_strdup(c4);
@ -59,9 +59,9 @@ static int ut_u16_strdup(struct unit_test_state *uts)
free(copy);
return 0;
}
UNICODE_TEST(ut_u16_strdup);
UNICODE_TEST(unicode_test_u16_strdup);
static int ut_u16_strcpy(struct unit_test_state *uts)
static int unicode_test_u16_strcpy(struct unit_test_state *uts)
{
u16 *r;
u16 copy[10];
@ -71,11 +71,11 @@ static int ut_u16_strcpy(struct unit_test_state *uts)
ut_assert(!memcmp(copy, c1, sizeof(c1)));
return 0;
}
UNICODE_TEST(ut_u16_strcpy);
UNICODE_TEST(unicode_test_u16_strcpy);
/* U-Boot uses UTF-16 strings in the EFI context only. */
#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
static int ut_string16(struct unit_test_state *uts)
static int unicode_test_string16(struct unit_test_state *uts)
{
char buf[20];
@ -113,10 +113,10 @@ static int ut_string16(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_string16);
UNICODE_TEST(unicode_test_string16);
#endif
static int ut_utf8_get(struct unit_test_state *uts)
static int unicode_test_utf8_get(struct unit_test_state *uts)
{
const char *s;
s32 code;
@ -152,9 +152,9 @@ static int ut_utf8_get(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_utf8_get);
UNICODE_TEST(unicode_test_utf8_get);
static int ut_utf8_put(struct unit_test_state *uts)
static int unicode_test_utf8_put(struct unit_test_state *uts)
{
char buffer[8] = { 0, };
char *pos;
@ -190,9 +190,9 @@ static int ut_utf8_put(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_utf8_put);
UNICODE_TEST(unicode_test_utf8_put);
static int ut_utf8_utf16_strlen(struct unit_test_state *uts)
static int unicode_test_utf8_utf16_strlen(struct unit_test_state *uts)
{
ut_asserteq(6, utf8_utf16_strlen(d1));
ut_asserteq(8, utf8_utf16_strlen(d2));
@ -206,9 +206,9 @@ static int ut_utf8_utf16_strlen(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_utf8_utf16_strlen);
UNICODE_TEST(unicode_test_utf8_utf16_strlen);
static int ut_utf8_utf16_strnlen(struct unit_test_state *uts)
static int unicode_test_utf8_utf16_strnlen(struct unit_test_state *uts)
{
ut_asserteq(3, utf8_utf16_strnlen(d1, 3));
ut_asserteq(6, utf8_utf16_strnlen(d1, 13));
@ -224,7 +224,7 @@ static int ut_utf8_utf16_strnlen(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_utf8_utf16_strnlen);
UNICODE_TEST(unicode_test_utf8_utf16_strnlen);
/**
* ut_u16_strcmp() - Compare to u16 strings.
@ -234,7 +234,7 @@ UNICODE_TEST(ut_utf8_utf16_strnlen);
* @count: number of u16 to compare
* Return: -1 if a1 < a2, 0 if a1 == a2, 1 if a1 > a2
*/
static int ut_u16_strcmp(const u16 *a1, const u16 *a2, size_t count)
static int unicode_test_u16_strcmp(const u16 *a1, const u16 *a2, size_t count)
{
for (; (*a1 || *a2) && count; ++a1, ++a2, --count) {
if (*a1 < *a2)
@ -245,7 +245,7 @@ static int ut_u16_strcmp(const u16 *a1, const u16 *a2, size_t count)
return 0;
}
static int ut_utf8_utf16_strcpy(struct unit_test_state *uts)
static int unicode_test_utf8_utf16_strcpy(struct unit_test_state *uts)
{
u16 buf[16];
u16 *pos;
@ -253,44 +253,44 @@ static int ut_utf8_utf16_strcpy(struct unit_test_state *uts)
pos = buf;
utf8_utf16_strcpy(&pos, d1);
ut_asserteq(6, pos - buf);
ut_assert(!ut_u16_strcmp(buf, c1, SIZE_MAX));
ut_assert(!unicode_test_u16_strcmp(buf, c1, SIZE_MAX));
pos = buf;
utf8_utf16_strcpy(&pos, d2);
ut_asserteq(8, pos - buf);
ut_assert(!ut_u16_strcmp(buf, c2, SIZE_MAX));
ut_assert(!unicode_test_u16_strcmp(buf, c2, SIZE_MAX));
pos = buf;
utf8_utf16_strcpy(&pos, d3);
ut_asserteq(3, pos - buf);
ut_assert(!ut_u16_strcmp(buf, c3, SIZE_MAX));
ut_assert(!unicode_test_u16_strcmp(buf, c3, SIZE_MAX));
pos = buf;
utf8_utf16_strcpy(&pos, d4);
ut_asserteq(6, pos - buf);
ut_assert(!ut_u16_strcmp(buf, c4, SIZE_MAX));
ut_assert(!unicode_test_u16_strcmp(buf, c4, SIZE_MAX));
/* Illegal utf-8 strings */
pos = buf;
utf8_utf16_strcpy(&pos, j1);
ut_asserteq(4, pos - buf);
ut_assert(!ut_u16_strcmp(buf, L"j1?l", SIZE_MAX));
ut_assert(!unicode_test_u16_strcmp(buf, L"j1?l", SIZE_MAX));
pos = buf;
utf8_utf16_strcpy(&pos, j2);
ut_asserteq(4, pos - buf);
ut_assert(!ut_u16_strcmp(buf, L"j2?l", SIZE_MAX));
ut_assert(!unicode_test_u16_strcmp(buf, L"j2?l", SIZE_MAX));
pos = buf;
utf8_utf16_strcpy(&pos, j3);
ut_asserteq(3, pos - buf);
ut_assert(!ut_u16_strcmp(buf, L"j3?", SIZE_MAX));
ut_assert(!unicode_test_u16_strcmp(buf, L"j3?", SIZE_MAX));
return 0;
}
UNICODE_TEST(ut_utf8_utf16_strcpy);
UNICODE_TEST(unicode_test_utf8_utf16_strcpy);
int ut_utf8_utf16_strncpy(struct unit_test_state *uts)
static int unicode_test_utf8_utf16_strncpy(struct unit_test_state *uts)
{
u16 buf[16];
u16 *pos;
@ -300,41 +300,41 @@ int ut_utf8_utf16_strncpy(struct unit_test_state *uts)
utf8_utf16_strncpy(&pos, d1, 4);
ut_asserteq(4, pos - buf);
ut_assert(!buf[4]);
ut_assert(!ut_u16_strcmp(buf, c1, 4));
ut_assert(!unicode_test_u16_strcmp(buf, c1, 4));
pos = buf;
memset(buf, 0, sizeof(buf));
utf8_utf16_strncpy(&pos, d2, 10);
ut_asserteq(8, pos - buf);
ut_assert(buf[4]);
ut_assert(!ut_u16_strcmp(buf, c2, SIZE_MAX));
ut_assert(!unicode_test_u16_strcmp(buf, c2, SIZE_MAX));
pos = buf;
memset(buf, 0, sizeof(buf));
utf8_utf16_strncpy(&pos, d3, 2);
ut_asserteq(2, pos - buf);
ut_assert(!buf[2]);
ut_assert(!ut_u16_strcmp(buf, c3, 2));
ut_assert(!unicode_test_u16_strcmp(buf, c3, 2));
pos = buf;
memset(buf, 0, sizeof(buf));
utf8_utf16_strncpy(&pos, d4, 2);
ut_asserteq(4, pos - buf);
ut_assert(!buf[4]);
ut_assert(!ut_u16_strcmp(buf, c4, 4));
ut_assert(!unicode_test_u16_strcmp(buf, c4, 4));
pos = buf;
memset(buf, 0, sizeof(buf));
utf8_utf16_strncpy(&pos, d4, 10);
ut_asserteq(6, pos - buf);
ut_assert(buf[5]);
ut_assert(!ut_u16_strcmp(buf, c4, SIZE_MAX));
ut_assert(!unicode_test_u16_strcmp(buf, c4, SIZE_MAX));
return 0;
}
UNICODE_TEST(ut_utf8_utf16_strncpy);
UNICODE_TEST(unicode_test_utf8_utf16_strncpy);
static int ut_utf16_get(struct unit_test_state *uts)
static int unicode_test_utf16_get(struct unit_test_state *uts)
{
const u16 *s;
s32 code;
@ -358,9 +358,9 @@ static int ut_utf16_get(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_utf16_get);
UNICODE_TEST(unicode_test_utf16_get);
static int ut_utf16_put(struct unit_test_state *uts)
static int unicode_test_utf16_put(struct unit_test_state *uts)
{
u16 buffer[4] = { 0, };
u16 *pos;
@ -386,9 +386,9 @@ static int ut_utf16_put(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_utf16_put);
UNICODE_TEST(unicode_test_utf16_put);
int ut_utf16_strnlen(struct unit_test_state *uts)
static int unicode_test_utf16_strnlen(struct unit_test_state *uts)
{
ut_asserteq(3, utf16_strnlen(c1, 3));
ut_asserteq(6, utf16_strnlen(c1, 13));
@ -404,9 +404,9 @@ int ut_utf16_strnlen(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_utf16_strnlen);
UNICODE_TEST(unicode_test_utf16_strnlen);
int ut_utf16_utf8_strlen(struct unit_test_state *uts)
static int unicode_test_utf16_utf8_strlen(struct unit_test_state *uts)
{
ut_asserteq(6, utf16_utf8_strlen(c1));
ut_asserteq(9, utf16_utf8_strlen(c2));
@ -420,9 +420,9 @@ int ut_utf16_utf8_strlen(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_utf16_utf8_strlen);
UNICODE_TEST(unicode_test_utf16_utf8_strlen);
int ut_utf16_utf8_strnlen(struct unit_test_state *uts)
static int unicode_test_utf16_utf8_strnlen(struct unit_test_state *uts)
{
ut_asserteq(3, utf16_utf8_strnlen(c1, 3));
ut_asserteq(6, utf16_utf8_strnlen(c1, 13));
@ -432,9 +432,9 @@ int ut_utf16_utf8_strnlen(struct unit_test_state *uts)
ut_asserteq(12, utf16_utf8_strnlen(c4, 3));
return 0;
}
UNICODE_TEST(ut_utf16_utf8_strnlen);
UNICODE_TEST(unicode_test_utf16_utf8_strnlen);
int ut_utf16_utf8_strcpy(struct unit_test_state *uts)
static int unicode_test_utf16_utf8_strcpy(struct unit_test_state *uts)
{
char buf[16];
char *pos;
@ -477,9 +477,9 @@ int ut_utf16_utf8_strcpy(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_utf16_utf8_strcpy);
UNICODE_TEST(unicode_test_utf16_utf8_strcpy);
int ut_utf16_utf8_strncpy(struct unit_test_state *uts)
static int unicode_test_utf16_utf8_strncpy(struct unit_test_state *uts)
{
char buf[16];
char *pos;
@ -521,9 +521,9 @@ int ut_utf16_utf8_strncpy(struct unit_test_state *uts)
return 0;
}
UNICODE_TEST(ut_utf16_utf8_strncpy);
UNICODE_TEST(unicode_test_utf16_utf8_strncpy);
int ut_utf_to_lower(struct unit_test_state *uts)
static int unicode_test_utf_to_lower(struct unit_test_state *uts)
{
ut_asserteq('@', utf_to_lower('@'));
ut_asserteq('a', utf_to_lower('A'));
@ -538,9 +538,9 @@ int ut_utf_to_lower(struct unit_test_state *uts)
#endif
return 0;
}
UNICODE_TEST(ut_utf_to_lower);
UNICODE_TEST(unicode_test_utf_to_lower);
int ut_utf_to_upper(struct unit_test_state *uts)
static int unicode_test_utf_to_upper(struct unit_test_state *uts)
{
ut_asserteq('`', utf_to_upper('`'));
ut_asserteq('A', utf_to_upper('a'));
@ -555,7 +555,7 @@ int ut_utf_to_upper(struct unit_test_state *uts)
#endif
return 0;
}
UNICODE_TEST(ut_utf_to_upper);
UNICODE_TEST(unicode_test_utf_to_upper);
int do_ut_unicode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{