utf8rewind  1.2.0
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_MEMEQ(_expected, _actual, _size) EXPECT_PRED_FORMAT3(::helpers::CompareMemory, _expected, _actual, _size)
16 #define EXPECT_CPEQ(_expected, _actual) EXPECT_PRED_FORMAT2(::helpers::CompareCodepoints, _expected, _actual)
17 
18 namespace helpers {
19 
20  std::string identifiable(unicode_t codepoint);
21  std::string identifiable(unicode_t* codepoint, size_t codepointsSize);
22  std::string identifiable(const std::string& text);
23 
24  std::string utf8(unicode_t codepoint);
25  std::string utf8(unicode_t* codepoints, size_t codepointsSize);
26  std::string utf8(const std::vector<unicode_t>& codepoints);
27 
28  std::vector<unicode_t> utf32(const std::string& text);
29 
30  std::string printable(unicode_t codepoint);
31  std::string printable(unicode_t* codepoints, size_t codepointsSize);
32  std::string printable(const std::string& text);
33 
34  std::string sequence(unicode_t codepoint, uint8_t type);
35  std::string sequence(unicode_t* codepoint, size_t codepointsSize, uint8_t type);
36  std::string sequence(const std::string& text, uint8_t type);
37 
38  std::string canonicalCombiningClass(unicode_t codepoint);
39  std::string canonicalCombiningClass(unicode_t* codepoint, size_t codepointsSize);
40  std::string canonicalCombiningClass(const std::string& text);
41 
42  std::string quickCheck(unicode_t codepoint, uint8_t type);
43  std::string quickCheck(unicode_t* codepoint, size_t codepointsSize, uint8_t type);
44  std::string quickCheck(const std::string& text, uint8_t type);
45 
46  ::testing::AssertionResult CompareUtf8Strings(
47  const char* expressionExpected, const char* expressionActual,
48  const char* textExpected, const char* textActual);
49 
50  ::testing::AssertionResult CompareMemory(
51  const char* expressionExpected, const char* expressionActual, const char* expressionCount,
52  const char* memoryExpected, const char* memoryActual, size_t memorySize);
53 
54  ::testing::AssertionResult CompareCodepoints(
55  const char* expressionExpected, const char* expressionActual,
56  unicode_t codepointExpected, unicode_t codepointActual);
57 
58 };
59 
uint32_t unicode_t
Unicode codepoint.
Definition: utf8rewind.h:178
Base includes for tests.
Public interface for UTF-8 functions.