diff options
author | Zufu Liu <unknown> | 2018-03-24 13:53:22 +1100 |
---|---|---|
committer | Zufu Liu <unknown> | 2018-03-24 13:53:22 +1100 |
commit | 0bb4d5456748c8794a943b4716ee089d0590519c (patch) | |
tree | d3a1f8654824ca8f6e9892cb0ae9b8ce172efed4 /test/unit/testUniConversion.cxx | |
parent | f3830c19917c254dcddfd272518a7b749fe89129 (diff) | |
download | scintilla-mirror-0bb4d5456748c8794a943b4716ee089d0590519c.tar.gz |
Feature [feature-requests:#1212]. Move Unicode conversions into UniConversion.
Move Unicode conversion functions UnicodeFromUTF8 and UTF8FromUTF32Character
into UniConversion.
Diffstat (limited to 'test/unit/testUniConversion.cxx')
-rw-r--r-- | test/unit/testUniConversion.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/unit/testUniConversion.cxx b/test/unit/testUniConversion.cxx index 4d34abd60..4bb7d361a 100644 --- a/test/unit/testUniConversion.cxx +++ b/test/unit/testUniConversion.cxx @@ -75,6 +75,33 @@ TEST_CASE("UTF16Length") { TEST_CASE("UniConversion") { + // UnicodeFromUTF8 + + SECTION("UnicodeFromUTF8 ASCII") { + const unsigned char s[]={'a', 0}; + REQUIRE(UnicodeFromUTF8(s) == 'a'); + } + + SECTION("UnicodeFromUTF8 Example1") { + const unsigned char s[]={0x24, 0}; + REQUIRE(UnicodeFromUTF8(s) == 0x24); + } + + SECTION("UnicodeFromUTF8 Example2") { + const unsigned char s[]={0xC2, 0xA2, 0}; + REQUIRE(UnicodeFromUTF8(s) == 0xA2); + } + + SECTION("UnicodeFromUTF8 Example3") { + const unsigned char s[]={0xE2, 0x82, 0xAC, 0}; + REQUIRE(UnicodeFromUTF8(s) == 0x20AC); + } + + SECTION("UnicodeFromUTF8 Example4") { + const unsigned char s[]={0xF0, 0x90, 0x8D, 0x88, 0}; + REQUIRE(UnicodeFromUTF8(s) == 0x10348); + } + // UTF16FromUTF8 SECTION("UTF16FromUTF8 ASCII") { |