diff options
author | mitchell <unknown> | 2018-05-05 12:08:22 -0400 |
---|---|---|
committer | mitchell <unknown> | 2018-05-05 12:08:22 -0400 |
commit | ad5951840a7e9d19c3652151e57466fa2c94e6a7 (patch) | |
tree | a77144132bd8fe505c8e0340e1e4e7d66d44bf07 /test/unit/testUniConversion.cxx | |
parent | 93462d87c3c8f398d5900be84349f29cb088d849 (diff) | |
download | scintilla-mirror-ad5951840a7e9d19c3652151e57466fa2c94e6a7.tar.gz |
Backport: Feature [feature-requests:#1212]. Move Unicode conversions into UniConversion.
Move Unicode conversion functions UnicodeFromUTF8 and UTF8FromUTF32Character into UniConversion.
Backport of changeset 6645:463fa6965d9a.
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") { |