utf8rewind  1.3.0
System library for processing UTF-8 encoded text
helpers-streams.hpp
Go to the documentation of this file.
1 #pragma once
2 
10 #include "helpers-base.hpp"
11 
12 extern "C" {
13  #include "../internal/database.h"
14  #include "../internal/streaming.h"
15 }
16 
17 #define CHECK_STREAM_ENTRY(_stream, _index, _codepoint, _qc, _ccc) { \
18  ::helpers::StreamEntry e; \
19  e.codepoint = _codepoint; \
20  e.quick_check = QuickCheckResult_ ## _qc; \
21  e.canonical_combining_class = _ccc; \
22  ::helpers::StreamEntry a; \
23  a.index = _index; \
24  a.codepoint = (_stream).codepoint[_index]; \
25  a.quick_check = (_stream).quick_check[_index]; \
26  a.canonical_combining_class = (_stream).canonical_combining_class[_index]; \
27  EXPECT_PRED_FORMAT2(::helpers::CompareStream, e, a); \
28 }
29 
30 namespace helpers {
31 
32  StreamState createStream(const std::string& text);
33 
34  std::string quickCheckToString(uint8_t quickCheck);
35 
36  struct StreamEntry
37  {
38  uint8_t index;
39  unicode_t codepoint;
40  uint8_t quick_check;
41  uint8_t canonical_combining_class;
42  };
43 
44  ::testing::AssertionResult CompareStream(
45  const char* expressionExpected, const char* expressionActual,
46  const StreamEntry& entryExpected, const StreamEntry& entryActual);
47 
48 };
49 
uint32_t unicode_t
UTF-32 encoded code point.
Definition: utf8rewind.h:235
Base includes for helper methods.