13 #include "../internal/codepoint.h"
16 #define EXPECT_UTF8EQ(_expected, _actual) EXPECT_PRED_FORMAT2(::helpers::CompareUtf8Strings, _expected, _actual)
17 #define EXPECT_UTF8LENGTHEQ(_expected, _actual, _length) EXPECT_PRED_FORMAT3(::helpers::CompareUtf8LengthStrings, _expected, _actual, _length)
18 #define EXPECT_OFFSETEQ(_expected, _actual, _start) EXPECT_PRED_FORMAT3(::helpers::CompareOffsets, _expected, _actual, _start)
19 #define EXPECT_MEMEQ(_expected, _actual, _size) EXPECT_PRED_FORMAT3(::helpers::CompareMemory, _expected, _actual, _size)
20 #define EXPECT_CPEQ(_expected, _actual) EXPECT_PRED_FORMAT2(::helpers::CompareCodepoints, _expected, _actual)
22 #if UTF8_VERSION_GUARD(1, 4, 0)
23 #define EXPECT_GCEQ(_expectedOffset, _input, _inputSize, _flags) { \
24 ::helpers::GeneralCategoryEntry e; \
26 e.offset = _expectedOffset; \
28 ::helpers::GeneralCategoryEntry a; \
30 a.inputSize = _inputSize; \
32 a.offset = utf8iscategory(_input, _inputSize, _flags); \
33 EXPECT_PRED_FORMAT2(::helpers::CompareGeneralCategory, e, a); \
36 #define EXPECT_GC_INTEGRATION_EQ(_expectedOffset, _input, _inputSize, _flags, _function) { \
37 ::helpers::GeneralCategoryEntry e; \
39 e.offset = _expectedOffset; \
40 unicode_t code_point; \
41 codepoint_read(_input, _inputSize, &code_point); \
42 e.standard = _function((int)code_point); \
43 e.standardName = # _function; \
44 ::helpers::GeneralCategoryEntry a; \
46 a.inputSize = _inputSize; \
48 a.offset = utf8iscategory(_input, _inputSize, _flags); \
49 EXPECT_PRED_FORMAT2(::helpers::CompareGeneralCategory, e, a); \
55 std::string identifiable(
unicode_t codepoint);
56 std::string identifiable(
unicode_t* codepoint,
size_t codepointsSize);
57 std::string identifiable(
const std::string& text);
60 std::string utf8(
unicode_t* codepoints,
size_t codepointsSize);
61 std::string utf8(
const std::vector<unicode_t>& codepoints);
62 std::string utf8(
const std::wstring& text);
64 std::vector<utf16_t> utf16(
const std::string& text);
66 std::vector<unicode_t> utf32(
const std::string& text);
68 std::wstring wide(
const std::string& text);
71 std::string hex(
unicode_t* codepoints,
size_t codepointsSize);
72 std::string hex(
const std::string& text);
74 std::string printable(
unicode_t codepoint);
75 std::string printable(
unicode_t* codepoints,
size_t codepointsSize);
76 std::string printable(
const std::string& text);
78 std::string canonicalCombiningClass(
unicode_t codepoint);
79 std::string canonicalCombiningClass(
unicode_t* codepoint,
size_t codepointsSize);
80 std::string canonicalCombiningClass(
const std::string& text);
91 std::string quickCheck(
unicode_t codepoint, QuickCheck type);
92 std::string quickCheck(
unicode_t* codepoint,
size_t codepointsSize, QuickCheck type);
93 std::string quickCheck(
const std::string& text, QuickCheck type);
95 #if UTF8_VERSION_GUARD(1, 4, 0)
96 std::string generalCategory(
size_t flags);
99 ::testing::AssertionResult CompareUtf8Strings(
100 const char* expressionExpected,
const char* expressionActual,
101 const char* textExpected,
const char* textActual);
103 ::testing::AssertionResult CompareUtf8LengthStrings(
104 const char* expressionExpected,
const char* expressionActual,
const char* expressionLength,
105 const char* textExpected,
const char* textActual,
size_t length);
107 ::testing::AssertionResult CompareOffsets(
108 const char* expressionExpected,
const char* expressionActual,
const char* expressionCount,
109 const char* offsetExpected,
const char* offsetActual,
const char* offsetStart);
111 ::testing::AssertionResult CompareMemory(
112 const char* expressionExpected,
const char* expressionActual,
const char* expressionCount,
113 const char* memoryExpected,
const char* memoryActual,
size_t memorySize);
115 ::testing::AssertionResult CompareCodepoints(
116 const char* expressionExpected,
const char* expressionActual,
119 #if UTF8_VERSION_GUARD(1, 4, 0)
120 struct GeneralCategoryEntry
127 std::string standardName;
130 ::testing::AssertionResult CompareGeneralCategory(
131 const char* expressionExpected,
const char* expressionActual,
132 const GeneralCategoryEntry& entryExpected,
const GeneralCategoryEntry& entryActual);
uint32_t unicode_t
UTF-32 encoded code point.
Definition: utf8rewind.h:203
Base includes for helper methods.