* Tests for utf8_strwidth (simpler version without length limit) */
| 45 | * Tests for utf8_strwidth (simpler version without length limit) |
| 46 | */ |
| 47 | void test_utf8_width__strwidth_chinese(void) |
| 48 | { |
| 49 | /* Test basic ASCII */ |
| 50 | cl_assert_equal_i(5, utf8_strwidth("Hello")); |
| 51 | |
| 52 | /* Test Chinese characters */ |
| 53 | /* 2 Chinese chars = 4 display columns */ |
| 54 | cl_assert_equal_i(4, utf8_strwidth("你好")); |
| 55 | |
| 56 | /* Test longer Chinese string */ |
| 57 | /* 5 Chinese chars = 10 display columns */ |
| 58 | cl_assert_equal_i(10, utf8_strwidth("你好世界!")); |
| 59 | |
| 60 | /* Test mixed ASCII and Chinese */ |
| 61 | /* 5 ASCII (5 cols) + 2 Chinese (4 cols) = 9 */ |
| 62 | cl_assert_equal_i(9, utf8_strwidth("Hello世界")); |
| 63 | /* 2 ASCII (2 cols) + 2 Chinese (4 cols) + 1 ASCII (1 col) = 7 */ |
| 64 | cl_assert_equal_i(7, utf8_strwidth("Hi世界!")); |
| 65 | } |
| 66 | |
| 67 | /* |
| 68 | * Additional tests with other East Asian characters |
nothing calls this directly
no test coverage detected