utf8rewind  1.2.1
Cross-platform library for UTF-8 encoded text
helpers-strings.hpp
Go to the documentation of this file.
1 #pragma once
2 
10 #include "tests-base.hpp"
11 
12 #include "utf8rewind.h"
13 
14 #define EXPECT_UTF8EQ(_expected, _actual) EXPECT_PRED_FORMAT2(::helpers::CompareUtf8Strings, _expected, _actual)
15 #define EXPECT_OFFSETEQ(_expected, _actual, _start) EXPECT_PRED_FORMAT3(::helpers::CompareOffsets, _expected, _actual, _start)
16 #define EXPECT_MEMEQ(_expected, _actual, _size) EXPECT_PRED_FORMAT3(::helpers::CompareMemory, _expected, _actual, _size)
17 #define EXPECT_CPEQ(_expected, _actual) EXPECT_PRED_FORMAT2(::helpers::CompareCodepoints, _expected, _actual)
18 
19 namespace helpers {
20 
21  std::string identifiable(unicode_t codepoint);
22  std::string identifiable(unicode_t* codepoint, size_t codepointsSize);
23  std::string identifiable(const std::string& text);
24 
25  std::string utf8(unicode_t codepoint);
26  std::string utf8(unicode_t* codepoints, size_t codepointsSize);
27  std::string utf8(const std::vector<unicode_t>& codepoints);
28 
29  std::vector<unicode_t> utf32(const std::string& text);
30 
31  std::string hex(unicode_t codepoint);
32  std::string hex(unicode_t* codepoints, size_t codepointsSize);
33  std::string hex(const std::string& text);
34 
35  std::string printable(unicode_t codepoint);
36  std::string printable(unicode_t* codepoints, size_t codepointsSize);
37  std::string printable(const std::string& text);
38 
39  std::string sequence(unicode_t codepoint, uint8_t type);
40  std::string sequence(unicode_t* codepoint, size_t codepointsSize, uint8_t type);
41  std::string sequence(const std::string& text, uint8_t type);
42 
43  std::string canonicalCombiningClass(unicode_t codepoint);
44  std::string canonicalCombiningClass(unicode_t* codepoint, size_t codepointsSize);
45  std::string canonicalCombiningClass(const std::string& text);
46 
47  std::string quickCheck(unicode_t codepoint, uint8_t type);
48  std::string quickCheck(unicode_t* codepoint, size_t codepointsSize, uint8_t type);
49  std::string quickCheck(const std::string& text, uint8_t type);
50 
51  ::testing::AssertionResult CompareUtf8Strings(
52  const char* expressionExpected, const char* expressionActual,
53  const char* textExpected, const char* textActual);
54 
55  ::testing::AssertionResult CompareOffsets(
56  const char* expressionExpected, const char* expressionActual, const char* expressionCount,
57  const char* offsetExpected, const char* offsetActual, const char* offsetStart);
58 
59  ::testing::AssertionResult CompareMemory(
60  const char* expressionExpected, const char* expressionActual, const char* expressionCount,
61  const char* memoryExpected, const char* memoryActual, size_t memorySize);
62 
63  ::testing::AssertionResult CompareCodepoints(
64  const char* expressionExpected, const char* expressionActual,
65  unicode_t codepointExpected, unicode_t codepointActual);
66 
67 };
68 
uint32_t unicode_t
Unicode codepoint.
Definition: utf8rewind.h:178
Base includes for tests.
Public interface for UTF-8 functions.