From 87fc4012f47f353bc38f96bca8299e8178bf84a6 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Tue, 31 Jan 2017 14:27:23 +0900 Subject: [PATCH] Add some test cases for invalid UTF-8 sequences. --- tests/test_string.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_string.cpp b/tests/test_string.cpp index abfbd8d2..6f00b62d 100644 --- a/tests/test_string.cpp +++ b/tests/test_string.cpp @@ -354,6 +354,12 @@ public: CPPUNIT_ASSERT(String(ByteVector("\xF8\x80\x80\x80\x80"), String::UTF8).isEmpty()); CPPUNIT_ASSERT(String(ByteVector("\xFC\x80\x80\x80\x80\x80"), String::UTF8).isEmpty()); + CPPUNIT_ASSERT(String(ByteVector("\xC2"), String::UTF8).isEmpty()); + CPPUNIT_ASSERT(String(ByteVector("\xE0\x80"), String::UTF8).isEmpty()); + CPPUNIT_ASSERT(String(ByteVector("\xF0\x80\x80"), String::UTF8).isEmpty()); + CPPUNIT_ASSERT(String(ByteVector("\xF8\x80\x80\x80"), String::UTF8).isEmpty()); + CPPUNIT_ASSERT(String(ByteVector("\xFC\x80\x80\x80\x80"), String::UTF8).isEmpty()); + CPPUNIT_ASSERT(String('\x80', String::UTF8).isEmpty()); CPPUNIT_ASSERT(String(ByteVector("\xED\xA0\x80\xED\xB0\x80"), String::UTF8).isEmpty());