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); \
56 std::string utf8(
unicode_t* codepoints,
size_t codepointsSize);
57 std::string utf8(
const std::vector<unicode_t>& codepoints);
58 std::string utf8(
const std::wstring& text);
60 std::vector<utf16_t> utf16(
const std::string& text);
62 std::vector<unicode_t> utf32(
unicode_t codepoint);
63 std::vector<unicode_t> utf32(
const std::string& text);
65 std::wstring wide(
const std::string& text);
67 std::string identifiable(
const std::vector<unicode_t>& codepoints);
69 std::string hex(
const std::string& text);
70 std::string hex(
const std::wstring& text);
72 std::string printable(
const std::string& text);
73 std::string printable(
const std::wstring& text);
75 std::string canonicalCombiningClass(
const std::vector<unicode_t>& codepoints);
76 std::string canonicalCombiningClassToString(uint8_t value);
87 std::string quickCheck(
const std::vector<unicode_t>& codepoints, QuickCheck type);
88 std::string quickCheckToString(uint8_t value);
90 #if UTF8_VERSION_GUARD(1, 4, 0)
91 std::string generalCategory(
size_t flags);
94 ::testing::AssertionResult CompareUtf8Strings(
95 const char* expressionExpected,
const char* expressionActual,
96 const char* textExpected,
const char* textActual);
98 ::testing::AssertionResult CompareUtf8LengthStrings(
99 const char* expressionExpected,
const char* expressionActual,
const char* expressionLength,
100 const char* textExpected,
const char* textActual,
size_t length);
102 ::testing::AssertionResult CompareOffsets(
103 const char* expressionExpected,
const char* expressionActual,
const char* expressionCount,
104 const char* offsetExpected,
const char* offsetActual,
const char* offsetStart);
106 ::testing::AssertionResult CompareMemory(
107 const char* expressionExpected,
const char* expressionActual,
const char* expressionCount,
108 const char* memoryExpected,
const char* memoryActual,
size_t memorySize);
110 ::testing::AssertionResult CompareCodepoints(
111 const char* expressionExpected,
const char* expressionActual,
114 #if UTF8_VERSION_GUARD(1, 4, 0)
115 struct GeneralCategoryEntry
122 std::string standardName;
125 ::testing::AssertionResult CompareGeneralCategory(
126 const char* expressionExpected,
const char* expressionActual,
127 const GeneralCategoryEntry& entryExpected,
const GeneralCategoryEntry& entryActual);
uint32_t unicode_t
UTF-32 encoded code point.
Definition: utf8rewind.h:203
Base includes for helper methods.