11
11
12
12
#include <i18n.h>
13
13
#include <ctest.h>
14
- #include <locale.h>
15
14
16
15
void test_i18n (void )
17
16
{
@@ -25,39 +24,45 @@ void test_i18n(void)
25
24
i18n_load_language (L"zh-CN" , "locales/zh-CN.yml" ), true);
26
25
27
26
ctest_equal_bool ("i18n_load_language(L\"en\", \"locales/en.yml\")" ,
28
- i18n_load_language (L"en" , "locales/en.yml" ), true);
27
+ i18n_load_language (L"en" , "locales/en.yml" ),
28
+ true);
29
29
30
30
ctest_equal_bool (
31
31
"i18n_load_language(L\"notfound\", \"locales/notfound.yml\")" ,
32
32
i18n_load_language (L"notfound" , "locales/notfound.yml" ), false);
33
33
34
- i18n_change_language (L"en" );
34
+ i18n_change_language (L"en" );
35
35
36
- ctest_equal_wcs ("en: i18n_translate(L\"name\") == L\"English\")" ,
37
- i18n_translate (L"name" ), L"English" );
36
+ ctest_equal_bool ("en: i18n_translate(L\"name\") == L\"English\")" ,
37
+ wcscmp (i18n_translate (L"name" ), L"English" ) == 0 ,
38
+ true);
38
39
39
- ctest_equal_wcs ("en: i18n_translate(L\"button.ok\") == L\"Ok\")" ,
40
- i18n_translate (L"button.ok" ), L"Ok" );
40
+ ctest_equal_bool ("en: i18n_translate(L\"button.ok\") == L\"Ok\")" ,
41
+ wcscmp (i18n_translate (L"button.ok" ), L"Ok" ) == 0 ,
42
+ true);
41
43
42
44
ctest_equal_bool ("en: i18n_translate(L\"button.notfound\") == NULL)" ,
43
- i18n_translate (L"button.notfound" ) == NULL , true);
45
+ i18n_translate (L"button.notfound" )== NULL ,
46
+ true);
44
47
45
- i18n_change_language (L"zh-CN" );
48
+ i18n_change_language (L"zh-CN" );
46
49
47
- ctest_equal_wcs ("zh-CN: i18n_translate(L\"name\")" ,
48
- i18n_translate (L"name" ), L"\u4E2D\u6587" );
50
+ ctest_equal_bool ("zh-CN: i18n_translate(L\"name\")" ,
51
+ wcscmp (i18n_translate (L"name" ), L"\u4E2D\u6587" ) == 0 ,
52
+ true);
49
53
50
- ctest_equal_wcs ("zh-CN: i18n_translate(L\"button.ok\")" ,
51
- i18n_translate (L"button.ok" ), L"\u786E\u5B9A" );
54
+ ctest_equal_bool ("zh-CN: i18n_translate(L\"button.ok\")" ,
55
+ wcscmp (i18n_translate (L"button.ok" ), L"\u786E\u5B9A" ) == 0 ,
56
+ true);
52
57
53
58
ctest_equal_bool ("zh-CN: i18n_translate(L\"button.notfound\") == NULL" ,
54
- i18n_translate (L"button.notfound" ) == NULL , true);
55
- i18n_clear ();
59
+ i18n_translate (L"button.notfound" )== NULL ,
60
+ true);
61
+ i18n_clear ();
56
62
}
57
63
58
64
int main (void )
59
65
{
60
- setlocale (LC_CTYPE , "" );
61
66
logger_set_level (LOGGER_LEVEL_OFF );
62
67
ctest_describe ("i18n" , test_i18n );
63
68
return ctest_finish ();
0 commit comments