From eed8a2a57cad65e45a971122ae5ef23a319f2d54 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 22 Oct 2012 01:05:56 +0200 Subject: [PATCH] add basic utf8 unit test --- src/unit_tests.cc | 9 +++++++++ 1 file changed, 9 insertions(+) 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();