forked from github/server
basic test for tolower function.
This commit is contained in:
parent
f4f9e74e90
commit
eb1d73e2c2
|
@ -35,6 +35,7 @@ int RunAllTests(void)
|
||||||
ADD_TESTS(suite, bsdstring);
|
ADD_TESTS(suite, bsdstring);
|
||||||
ADD_TESTS(suite, functions);
|
ADD_TESTS(suite, functions);
|
||||||
ADD_TESTS(suite, umlaut);
|
ADD_TESTS(suite, umlaut);
|
||||||
|
ADD_TESTS(suite, unicode);
|
||||||
ADD_TESTS(suite, strings);
|
ADD_TESTS(suite, strings);
|
||||||
/* kernel */
|
/* kernel */
|
||||||
ADD_TESTS(suite, unit);
|
ADD_TESTS(suite, unit);
|
||||||
|
|
|
@ -7,6 +7,7 @@ strings.test.c
|
||||||
bsdstring.test.c
|
bsdstring.test.c
|
||||||
functions.test.c
|
functions.test.c
|
||||||
umlaut.test.c
|
umlaut.test.c
|
||||||
|
unicode.test.c
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(_FILES
|
SET(_FILES
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#include <CuTest.h>
|
||||||
|
#include "unicode.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
static void test_unicode_tolower(CuTest * tc)
|
||||||
|
{
|
||||||
|
char buffer[32];
|
||||||
|
CuAssertIntEquals(tc, 0, unicode_utf8_tolower(buffer, sizeof(buffer), "HeLlO W0Rld"));
|
||||||
|
CuAssertStrEquals(tc, "hello w0rld", buffer);
|
||||||
|
memset(buffer, 0, sizeof(buffer));
|
||||||
|
buffer[5]='X';
|
||||||
|
CuAssertIntEquals(tc, ENOMEM, unicode_utf8_tolower(buffer, 5, "HeLlO W0Rld"));
|
||||||
|
CuAssertStrEquals(tc, "helloX", buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
CuSuite *get_unicode_suite(void)
|
||||||
|
{
|
||||||
|
CuSuite *suite = CuSuiteNew();
|
||||||
|
SUITE_ADD_TEST(suite, test_unicode_tolower);
|
||||||
|
return suite;
|
||||||
|
}
|
Loading…
Reference in New Issue