diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-10-22 01:05:56 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-10-22 01:05:56 +0200 |
| commit | eed8a2a57cad65e45a971122ae5ef23a319f2d54 (patch) | |
| tree | 853677c97f246f2d1d5fa9ace7309cc747b39aa3 /src | |
| parent | 49237a771b19caa79f351346f72efb78fb89c23f (diff) | |
add basic utf8 unit test
Diffstat (limited to 'src')
| -rw-r--r-- | src/unit_tests.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/unit_tests.cc b/src/unit_tests.cc index 22650edb..c5dec5c5 100644 --- a/src/unit_tests.cc +++ b/src/unit_tests.cc @@ -70,6 +70,14 @@ void test_incremental_inserter() } assert(not editor.is_editing()); } + +void test_utf8() +{ + String str = "maïs mélange bientôt"; + assert(utf8::distance(str.begin(), str.end()) == 20); + assert(utf8::codepoint(str.begin() + 2) == 0x00EF); +} + void test_string() { assert(int_to_str(124) == "124"); @@ -87,6 +95,7 @@ void test_string() void run_unit_tests() { + test_utf8(); test_string(); test_buffer(); test_editor(); |
