utf8rewind  1.2.1
Cross-platform library for UTF-8 encoded text
helpers-seeking.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_SEEKEQ(_input, _expectedOffset, _currentOffset, _startOffset, _offset, _direction) { \
15  ::helpers::SeekingParameters e; \
16  e.text = _input + _expectedOffset; \
17  e.offset = _expectedOffset; \
18  e.expression = ""; \
19  ::helpers::SeekingParameters a; \
20  a.text = utf8seek(_input + _currentOffset, _input + _startOffset, _offset, _direction); \
21  a.offset = a.text - _input; \
22  a.expression = "utf8seek(" #_input " + " #_currentOffset ", " #_input " + " #_startOffset ", " #_offset ", " #_direction ")"; \
23  EXPECT_PRED_FORMAT2(::helpers::CompareSeeking, e, a); \
24 }
25 
26 namespace helpers {
27 
28  struct SeekingParameters
29  {
30  const char* text;
31  size_t offset;
32  const char* expression;
33  };
34 
35  ::testing::AssertionResult CompareSeeking(
36  const char* expressionExpected, const char* expressionActual,
37  const SeekingParameters& paramsExpected, const SeekingParameters& paramsActual);
38 
39 };
40 
Base includes for tests.
Public interface for UTF-8 functions.