utf8rewind  1.2.0
Cross-platform library for UTF-8 encoded text
helpers-casemapping.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 CHECK_CASEMAPPING(_codepoint, _uppercase, _lowercase, _titlecase, _name) { \
15  ::helpers::CaseMappingEntry e; \
16  e.codepoint = _codepoint; \
17  e.uppercase = _uppercase; \
18  e.lowercase = _lowercase; \
19  e.titlecase = _titlecase; \
20  e.name = _name; \
21  ::helpers::CaseMappingEntry a; \
22  a.uppercase = ::helpers::uppercase(_codepoint); \
23  a.lowercase = ::helpers::lowercase(_codepoint); \
24  a.titlecase = ::helpers::titlecase(_codepoint); \
25  EXPECT_PRED_FORMAT2(::helpers::CompareCasemapping, e, a); \
26 }
27 
28 namespace helpers {
29 
30  std::string uppercase(unicode_t codepoint);
31  std::string uppercase(const std::string& text);
32 
33  std::string lowercase(unicode_t codepoint);
34  std::string lowercase(const std::string& text);
35 
36  std::string titlecase(unicode_t codepoint);
37  std::string titlecase(const std::string& text);
38 
39  struct CaseMappingEntry
40  {
41  CaseMappingEntry()
42  : codepoint(0)
43  {
44  }
45 
46  unicode_t codepoint;
47  std::string uppercase;
48  std::string lowercase;
49  std::string titlecase;
50  std::string name;
51  };
52 
53  ::testing::AssertionResult CompareCasemapping(
54  const char* expressionExpected, const char* expressionActual,
55  const CaseMappingEntry& entryExpected, const CaseMappingEntry& entryActual);
56 
57 };
58 
uint32_t unicode_t
Unicode codepoint.
Definition: utf8rewind.h:178
Base includes for tests.
Public interface for UTF-8 functions.