18 #include <initializer_list> 26 void testValid(std::initializer_list<unsigned char>
data, char32_t expected) {
28 const unsigned char* p = data.begin();
29 const unsigned char* e = data.end();
32 (
const char*)data.begin(), (
const char*)data.end());
35 const unsigned char* p = data.
begin();
36 const unsigned char* e = data.end();
39 (
const char*)data.begin(), (
const char*)data.end());
45 const unsigned char* p = data.begin();
46 const unsigned char* e = data.end();
50 (
const char*)data.begin(), (
const char*)data.end());
53 const unsigned char* p = data.
begin();
54 const unsigned char* e = data.end();
57 (
const char*)data.begin(), (
const char*)data.end());
61 TEST(InvalidUtf8ToCodePoint, rfc3629Overlong) {
71 TEST(InvalidUtf8ToCodePoint, rfc3629SurrogatePair) {
81 TEST(InvalidUtf8ToCodePoint, MarkusKuhnSingleUTF16Surrogates) {
99 TEST(InvalidUtf8ToCodePoint, MarkusKuhnPairedUTF16Surrogates) {
119 TEST(ValidUtf8ToCodePoint, FourCloverLeaf) {
120 testValid({0xF0, 0x9F, 0x8D, 0x80}, 0x1F340);
123 TEST(InvalidUtf8ToCodePoint, FourCloverLeafAsSurrogates) {
127 TEST(ValidUtf8ToCodePoint, LastCodePoint) {
128 testValid({0xF4, 0x8F, 0xBF, 0xBF}, 0x10FFFF);
#define EXPECT_THROW(statement, expected_exception)
void testValid(std::initializer_list< unsigned char > data, char32_t expected)
#define EXPECT_EQ(val1, val2)
char32_t utf8ToCodePoint(const unsigned char *&p, const unsigned char *const e, bool skipOnError)
constexpr Iter begin() const
TEST(InvalidUtf8ToCodePoint, rfc3629Overlong)
Range< const char * > StringPiece
void testInvalid(std::initializer_list< unsigned char > data)
static constexpr uint64_t data[1]