Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2008-11-04 Atsushi Enomoto <atsushi@ximian.com>
* src/gutf8.c, src/gunicode.c, src/glib.h: implemented g_unichar_type(), g_unichar_toupper(), g_unichar_tolower(), g_unichar_totitle(), g_utf8_strup() and g_utf8_strdown(). Fixed some surrogate pair bugs. * TODO : removed implemented things. * test/unicode.c, test/tests.h, test/utf8.c, test/Makefile.am: added new tests. svn path=/trunk/mono/; revision=117831
- Loading branch information
1 parent
18a7145
commit c1af5e0
Showing
9 changed files
with
406 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ SOURCES = \ | |
pattern.c \ | ||
dir.c \ | ||
markup.c \ | ||
unicode.c \ | ||
utf8.c \ | ||
endian.c \ | ||
module.c \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#include "test.h" | ||
|
||
/* | ||
* g_unichar_type | ||
*/ | ||
RESULT | ||
test_g_unichar_type () | ||
{ | ||
if (g_unichar_type ('A') != G_UNICODE_UPPERCASE_LETTER) | ||
return FAILED ("#1"); | ||
if (g_unichar_type ('a') != G_UNICODE_LOWERCASE_LETTER) | ||
return FAILED ("#2"); | ||
if (g_unichar_type ('1') != G_UNICODE_DECIMAL_NUMBER) | ||
return FAILED ("#3"); | ||
if (g_unichar_type (0xA3) != G_UNICODE_CURRENCY_SYMBOL) | ||
return FAILED ("#4"); | ||
return NULL; | ||
} | ||
|
||
/* | ||
* g_unichar_toupper | ||
*/ | ||
RESULT | ||
test_g_unichar_toupper () | ||
{ | ||
if (g_unichar_toupper (0) != 0) | ||
return FAILED ("#0"); | ||
if (g_unichar_toupper ('a') != 'A') | ||
return FAILED ("#1"); | ||
if (g_unichar_toupper ('1') != '1') | ||
return FAILED ("#2"); | ||
if (g_unichar_toupper (0x1C4) != 0x1C4) | ||
return FAILED ("#3"); | ||
if (g_unichar_toupper (0x1F2) != 0x1F1) | ||
return FAILED ("#4"); | ||
if (g_unichar_toupper (0x1F3) != 0x1F1) | ||
return FAILED ("#5"); | ||
if (g_unichar_toupper (0xFFFF) != 0xFFFF) | ||
return FAILED ("#6"); | ||
if (g_unichar_toupper (0x10428) != 0x10400) | ||
return FAILED ("#7"); | ||
return NULL; | ||
} | ||
|
||
/* | ||
* g_unichar_tolower | ||
*/ | ||
RESULT | ||
test_g_unichar_tolower () | ||
{ | ||
if (g_unichar_tolower (0) != 0) | ||
return FAILED ("#0"); | ||
if (g_unichar_tolower ('A') != 'a') | ||
return FAILED ("#1"); | ||
if (g_unichar_tolower ('1') != '1') | ||
return FAILED ("#2"); | ||
if (g_unichar_tolower (0x1C5) != 0x1C6) | ||
return FAILED ("#3"); | ||
if (g_unichar_tolower (0x1F1) != 0x1F3) | ||
return FAILED ("#4"); | ||
if (g_unichar_tolower (0x1F2) != 0x1F3) | ||
return FAILED ("#5"); | ||
if (g_unichar_tolower (0xFFFF) != 0xFFFF) | ||
return FAILED ("#6"); | ||
return NULL; | ||
} | ||
|
||
/* | ||
* g_unichar_totitle | ||
*/ | ||
RESULT | ||
test_g_unichar_totitle () | ||
{ | ||
if (g_unichar_toupper (0) != 0) | ||
return FAILED ("#0"); | ||
if (g_unichar_totitle ('a') != 'A') | ||
return FAILED ("#1"); | ||
if (g_unichar_totitle ('1') != '1') | ||
return FAILED ("#2"); | ||
if (g_unichar_totitle (0x1C4) != 0x1C5) | ||
return FAILED ("#3"); | ||
if (g_unichar_totitle (0x1F2) != 0x1F2) | ||
return FAILED ("#4"); | ||
if (g_unichar_totitle (0x1F3) != 0x1F2) | ||
return FAILED ("#5"); | ||
if (g_unichar_toupper (0xFFFF) != 0xFFFF) | ||
return FAILED ("#6"); | ||
return NULL; | ||
} | ||
|
||
static Test unicode_tests [] = { | ||
{"g_unichar_type", test_g_unichar_type}, | ||
{"g_unichar_toupper", test_g_unichar_toupper}, | ||
{"g_unichar_tolower", test_g_unichar_tolower}, | ||
{"g_unichar_totitle", test_g_unichar_totitle}, | ||
{NULL, NULL} | ||
}; | ||
|
||
DEFINE_TEST_GROUP_INIT(unicode_tests_init, unicode_tests) |
Oops, something went wrong.