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