clickhouse-native 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. checksums.yaml +7 -0
  2. data/ext/clickhouse_native/client.cpp +847 -0
  3. data/ext/clickhouse_native/extconf.rb +101 -0
  4. data/ext/clickhouse_native/vendor/clickhouse-cpp/.clang-format +11 -0
  5. data/ext/clickhouse_native/vendor/clickhouse-cpp/.git +1 -0
  6. data/ext/clickhouse_native/vendor/clickhouse-cpp/.gitattributes +63 -0
  7. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/CODEOWNERS +1 -0
  8. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/linux.yml +139 -0
  9. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/macos.yml +87 -0
  10. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/windows_mingw.yml +102 -0
  11. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/windows_msvc.yml +74 -0
  12. data/ext/clickhouse_native/vendor/clickhouse-cpp/.gitignore +280 -0
  13. data/ext/clickhouse_native/vendor/clickhouse-cpp/.travis.yml +62 -0
  14. data/ext/clickhouse_native/vendor/clickhouse-cpp/CMakeLists.txt +157 -0
  15. data/ext/clickhouse_native/vendor/clickhouse-cpp/LICENSE +206 -0
  16. data/ext/clickhouse_native/vendor/clickhouse-cpp/README.md +260 -0
  17. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/CMakeLists.txt +246 -0
  18. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/buffer.h +10 -0
  19. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/compressed.cpp +258 -0
  20. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/compressed.h +48 -0
  21. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/endpoints_iterator.cpp +20 -0
  22. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/endpoints_iterator.h +34 -0
  23. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/input.cpp +96 -0
  24. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/input.h +103 -0
  25. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/open_telemetry.h +23 -0
  26. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/output.cpp +119 -0
  27. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/output.h +142 -0
  28. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/platform.cpp +1 -0
  29. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/platform.h +33 -0
  30. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/projected_iterator.h +55 -0
  31. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/singleton.h +11 -0
  32. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/socket.cpp +489 -0
  33. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/socket.h +177 -0
  34. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/sslsocket.cpp +307 -0
  35. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/sslsocket.h +111 -0
  36. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/string_utils.h +28 -0
  37. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/string_view.h +142 -0
  38. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/uuid.h +10 -0
  39. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/wire_format.cpp +177 -0
  40. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/wire_format.h +79 -0
  41. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/block.cpp +134 -0
  42. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/block.h +114 -0
  43. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/client.cpp +1269 -0
  44. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/client.h +320 -0
  45. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/array.cpp +175 -0
  46. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/array.h +321 -0
  47. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/column.cpp +24 -0
  48. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/column.h +107 -0
  49. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/date.cpp +365 -0
  50. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/date.h +245 -0
  51. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/decimal.cpp +255 -0
  52. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/decimal.h +50 -0
  53. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/enum.cpp +123 -0
  54. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/enum.h +65 -0
  55. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/factory.cpp +285 -0
  56. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/factory.h +14 -0
  57. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/geo.cpp +108 -0
  58. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/geo.h +79 -0
  59. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip4.cpp +117 -0
  60. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip4.h +71 -0
  61. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip6.cpp +108 -0
  62. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip6.h +66 -0
  63. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/itemview.cpp +101 -0
  64. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/itemview.h +86 -0
  65. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinality.cpp +527 -0
  66. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinality.h +221 -0
  67. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinalityadaptor.h +63 -0
  68. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/map.cpp +87 -0
  69. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/map.h +257 -0
  70. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nothing.h +87 -0
  71. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nullable.cpp +109 -0
  72. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nullable.h +153 -0
  73. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/numeric.cpp +126 -0
  74. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/numeric.h +88 -0
  75. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/string.cpp +333 -0
  76. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/string.h +145 -0
  77. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/time.cpp +155 -0
  78. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/time.h +118 -0
  79. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/tuple.cpp +106 -0
  80. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/tuple.h +178 -0
  81. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/utils.h +41 -0
  82. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/uuid.cpp +80 -0
  83. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/uuid.h +58 -0
  84. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/error_codes.h +595 -0
  85. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/exceptions.h +66 -0
  86. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/protocol.h +54 -0
  87. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/query.cpp +25 -0
  88. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/query.h +246 -0
  89. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/server_exception.h +16 -0
  90. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/type_parser.cpp +314 -0
  91. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/type_parser.h +89 -0
  92. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/types.cpp +484 -0
  93. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/types.h +397 -0
  94. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/version.h +14 -0
  95. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findcityhash.cmake +26 -0
  96. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findlz4.cmake +39 -0
  97. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findzstd.cmake +39 -0
  98. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/cpp17.cmake +8 -0
  99. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/openssl.cmake +8 -0
  100. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/subdirs.cmake +5 -0
  101. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/version.cmake +87 -0
  102. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/CMakeLists.txt +9 -0
  103. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/attributes.h +682 -0
  104. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/config.h +714 -0
  105. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/internal/bits.h +219 -0
  106. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/macros.h +147 -0
  107. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/optimization.h +241 -0
  108. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/options.h +238 -0
  109. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/policy_checks.h +111 -0
  110. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/port.h +26 -0
  111. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128.cc +390 -0
  112. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128.h +1092 -0
  113. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128_have_intrinsic.inc +302 -0
  114. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128_no_intrinsic.inc +308 -0
  115. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/BUCK +13 -0
  116. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/CMakeLists.txt +7 -0
  117. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/COPYING +19 -0
  118. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/city.cc +469 -0
  119. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/city.h +90 -0
  120. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/citycrc.h +43 -0
  121. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/config.h +118 -0
  122. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/BUCK +14 -0
  123. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/CMakeLists.txt +4 -0
  124. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/LICENSE +28 -0
  125. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/README.md +1 -0
  126. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-death-test.h +346 -0
  127. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-matchers.h +930 -0
  128. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-message.h +219 -0
  129. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-param-test.h +507 -0
  130. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-printers.h +1029 -0
  131. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-spi.h +238 -0
  132. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-test-part.h +184 -0
  133. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-typed-test.h +329 -0
  134. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest.h +2495 -0
  135. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest_pred_impl.h +359 -0
  136. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest_prod.h +61 -0
  137. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/README.md +56 -0
  138. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest-port.h +37 -0
  139. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest-printers.h +42 -0
  140. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest.h +37 -0
  141. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-death-test-internal.h +304 -0
  142. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-filepath.h +211 -0
  143. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-internal.h +1560 -0
  144. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-param-util.h +947 -0
  145. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-port-arch.h +114 -0
  146. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-port.h +2389 -0
  147. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-string.h +175 -0
  148. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-type-util.h +183 -0
  149. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-all.cc +48 -0
  150. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-death-test.cc +1644 -0
  151. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-filepath.cc +369 -0
  152. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-internal-inl.h +1221 -0
  153. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-matchers.cc +97 -0
  154. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-port.cc +1433 -0
  155. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-printers.cc +533 -0
  156. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-test-part.cc +108 -0
  157. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-typed-test.cc +107 -0
  158. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest.cc +6746 -0
  159. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest_main.cc +54 -0
  160. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/BUCK +13 -0
  161. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/CMakeLists.txt +8 -0
  162. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/LICENSE +24 -0
  163. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4.c +2402 -0
  164. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4.h +764 -0
  165. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4hc.c +1554 -0
  166. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4hc.h +438 -0
  167. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/BUCK +232 -0
  168. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/CMakeLists.txt +115 -0
  169. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/LICENSE +30 -0
  170. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/allocations.h +55 -0
  171. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/bits.h +200 -0
  172. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/bitstream.h +437 -0
  173. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/compiler.h +358 -0
  174. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/cpu.h +213 -0
  175. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/debug.c +24 -0
  176. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/debug.h +107 -0
  177. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/entropy_common.c +340 -0
  178. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/error_private.c +63 -0
  179. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/error_private.h +159 -0
  180. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/fse.h +639 -0
  181. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/fse_decompress.c +311 -0
  182. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/huf.h +273 -0
  183. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/mem.h +435 -0
  184. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/pool.c +371 -0
  185. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/pool.h +90 -0
  186. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/portability_macros.h +156 -0
  187. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/threading.c +176 -0
  188. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/threading.h +150 -0
  189. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/xxhash.c +24 -0
  190. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/xxhash.h +5686 -0
  191. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_common.c +48 -0
  192. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_deps.h +111 -0
  193. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_internal.h +392 -0
  194. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_trace.h +163 -0
  195. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/clevels.h +134 -0
  196. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/fse_compress.c +624 -0
  197. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/hist.c +181 -0
  198. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/hist.h +75 -0
  199. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/huf_compress.c +1435 -0
  200. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress.c +7032 -0
  201. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_internal.h +1532 -0
  202. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_literals.c +235 -0
  203. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_literals.h +39 -0
  204. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_sequences.c +442 -0
  205. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_sequences.h +54 -0
  206. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_superblock.c +577 -0
  207. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_superblock.h +32 -0
  208. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_cwksp.h +742 -0
  209. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_double_fast.c +758 -0
  210. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_double_fast.h +39 -0
  211. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_fast.c +960 -0
  212. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_fast.h +38 -0
  213. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_lazy.c +2157 -0
  214. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_lazy.h +127 -0
  215. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm.c +724 -0
  216. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm.h +117 -0
  217. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm_geartab.h +106 -0
  218. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_opt.c +1472 -0
  219. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_opt.h +56 -0
  220. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstdmt_compress.c +1867 -0
  221. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstdmt_compress.h +113 -0
  222. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/huf_decompress.c +1882 -0
  223. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/huf_decompress_amd64.S +576 -0
  224. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_ddict.c +244 -0
  225. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_ddict.h +44 -0
  226. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress.c +2355 -0
  227. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_block.c +2192 -0
  228. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_block.h +73 -0
  229. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_internal.h +238 -0
  230. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/cover.c +1257 -0
  231. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/cover.h +158 -0
  232. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/divsufsort.c +1913 -0
  233. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/divsufsort.h +67 -0
  234. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/fastcover.c +766 -0
  235. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/zdict.c +1127 -0
  236. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_legacy.h +422 -0
  237. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v01.c +2125 -0
  238. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v01.h +94 -0
  239. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v02.c +3477 -0
  240. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v02.h +93 -0
  241. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v03.c +3117 -0
  242. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v03.h +93 -0
  243. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v04.c +3605 -0
  244. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v04.h +142 -0
  245. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v05.c +4004 -0
  246. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v05.h +162 -0
  247. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v06.c +4113 -0
  248. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v06.h +172 -0
  249. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v07.c +4498 -0
  250. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v07.h +187 -0
  251. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zdict.h +474 -0
  252. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zstd.h +3020 -0
  253. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zstd_errors.h +114 -0
  254. data/lib/clickhouse_native/clickhouse_native.bundle +0 -0
  255. data/lib/clickhouse_native/client.rb +50 -0
  256. data/lib/clickhouse_native/errors.rb +23 -0
  257. data/lib/clickhouse_native/pool.rb +49 -0
  258. data/lib/clickhouse_native/version.rb +3 -0
  259. data/lib/clickhouse_native.rb +8 -0
  260. metadata +369 -0
@@ -0,0 +1,930 @@
1
+ // Copyright 2007, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ // The Google C++ Testing and Mocking Framework (Google Test)
31
+ //
32
+ // This file implements just enough of the matcher interface to allow
33
+ // EXPECT_DEATH and friends to accept a matcher argument.
34
+
35
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
36
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
37
+
38
+ #include <atomic>
39
+ #include <memory>
40
+ #include <ostream>
41
+ #include <string>
42
+ #include <type_traits>
43
+
44
+ #include "gtest/gtest-printers.h"
45
+ #include "gtest/internal/gtest-internal.h"
46
+ #include "gtest/internal/gtest-port.h"
47
+
48
+ // MSVC warning C5046 is new as of VS2017 version 15.8.
49
+ #if defined(_MSC_VER) && _MSC_VER >= 1915
50
+ #define GTEST_MAYBE_5046_ 5046
51
+ #else
52
+ #define GTEST_MAYBE_5046_
53
+ #endif
54
+
55
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(
56
+ 4251 GTEST_MAYBE_5046_ /* class A needs to have dll-interface to be used by
57
+ clients of class B */
58
+ /* Symbol involving type with internal linkage not defined */)
59
+
60
+ namespace testing {
61
+
62
+ // To implement a matcher Foo for type T, define:
63
+ // 1. a class FooMatcherMatcher that implements the matcher interface:
64
+ // using is_gtest_matcher = void;
65
+ // bool MatchAndExplain(const T&, std::ostream*);
66
+ // (MatchResultListener* can also be used instead of std::ostream*)
67
+ // void DescribeTo(std::ostream*);
68
+ // void DescribeNegationTo(std::ostream*);
69
+ //
70
+ // 2. a factory function that creates a Matcher<T> object from a
71
+ // FooMatcherMatcher.
72
+
73
+ class MatchResultListener {
74
+ public:
75
+ // Creates a listener object with the given underlying ostream. The
76
+ // listener does not own the ostream, and does not dereference it
77
+ // in the constructor or destructor.
78
+ explicit MatchResultListener(::std::ostream* os) : stream_(os) {}
79
+ virtual ~MatchResultListener() = 0; // Makes this class abstract.
80
+
81
+ // Streams x to the underlying ostream; does nothing if the ostream
82
+ // is NULL.
83
+ template <typename T>
84
+ MatchResultListener& operator<<(const T& x) {
85
+ if (stream_ != nullptr) *stream_ << x;
86
+ return *this;
87
+ }
88
+
89
+ // Returns the underlying ostream.
90
+ ::std::ostream* stream() { return stream_; }
91
+
92
+ // Returns true if and only if the listener is interested in an explanation
93
+ // of the match result. A matcher's MatchAndExplain() method can use
94
+ // this information to avoid generating the explanation when no one
95
+ // intends to hear it.
96
+ bool IsInterested() const { return stream_ != nullptr; }
97
+
98
+ private:
99
+ ::std::ostream* const stream_;
100
+
101
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener);
102
+ };
103
+
104
+ inline MatchResultListener::~MatchResultListener() {
105
+ }
106
+
107
+ // An instance of a subclass of this knows how to describe itself as a
108
+ // matcher.
109
+ class GTEST_API_ MatcherDescriberInterface {
110
+ public:
111
+ virtual ~MatcherDescriberInterface() {}
112
+
113
+ // Describes this matcher to an ostream. The function should print
114
+ // a verb phrase that describes the property a value matching this
115
+ // matcher should have. The subject of the verb phrase is the value
116
+ // being matched. For example, the DescribeTo() method of the Gt(7)
117
+ // matcher prints "is greater than 7".
118
+ virtual void DescribeTo(::std::ostream* os) const = 0;
119
+
120
+ // Describes the negation of this matcher to an ostream. For
121
+ // example, if the description of this matcher is "is greater than
122
+ // 7", the negated description could be "is not greater than 7".
123
+ // You are not required to override this when implementing
124
+ // MatcherInterface, but it is highly advised so that your matcher
125
+ // can produce good error messages.
126
+ virtual void DescribeNegationTo(::std::ostream* os) const {
127
+ *os << "not (";
128
+ DescribeTo(os);
129
+ *os << ")";
130
+ }
131
+ };
132
+
133
+ // The implementation of a matcher.
134
+ template <typename T>
135
+ class MatcherInterface : public MatcherDescriberInterface {
136
+ public:
137
+ // Returns true if and only if the matcher matches x; also explains the
138
+ // match result to 'listener' if necessary (see the next paragraph), in
139
+ // the form of a non-restrictive relative clause ("which ...",
140
+ // "whose ...", etc) that describes x. For example, the
141
+ // MatchAndExplain() method of the Pointee(...) matcher should
142
+ // generate an explanation like "which points to ...".
143
+ //
144
+ // Implementations of MatchAndExplain() should add an explanation of
145
+ // the match result *if and only if* they can provide additional
146
+ // information that's not already present (or not obvious) in the
147
+ // print-out of x and the matcher's description. Whether the match
148
+ // succeeds is not a factor in deciding whether an explanation is
149
+ // needed, as sometimes the caller needs to print a failure message
150
+ // when the match succeeds (e.g. when the matcher is used inside
151
+ // Not()).
152
+ //
153
+ // For example, a "has at least 10 elements" matcher should explain
154
+ // what the actual element count is, regardless of the match result,
155
+ // as it is useful information to the reader; on the other hand, an
156
+ // "is empty" matcher probably only needs to explain what the actual
157
+ // size is when the match fails, as it's redundant to say that the
158
+ // size is 0 when the value is already known to be empty.
159
+ //
160
+ // You should override this method when defining a new matcher.
161
+ //
162
+ // It's the responsibility of the caller (Google Test) to guarantee
163
+ // that 'listener' is not NULL. This helps to simplify a matcher's
164
+ // implementation when it doesn't care about the performance, as it
165
+ // can talk to 'listener' without checking its validity first.
166
+ // However, in order to implement dummy listeners efficiently,
167
+ // listener->stream() may be NULL.
168
+ virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0;
169
+
170
+ // Inherits these methods from MatcherDescriberInterface:
171
+ // virtual void DescribeTo(::std::ostream* os) const = 0;
172
+ // virtual void DescribeNegationTo(::std::ostream* os) const;
173
+ };
174
+
175
+ namespace internal {
176
+
177
+ struct AnyEq {
178
+ template <typename A, typename B>
179
+ bool operator()(const A& a, const B& b) const { return a == b; }
180
+ };
181
+ struct AnyNe {
182
+ template <typename A, typename B>
183
+ bool operator()(const A& a, const B& b) const { return a != b; }
184
+ };
185
+ struct AnyLt {
186
+ template <typename A, typename B>
187
+ bool operator()(const A& a, const B& b) const { return a < b; }
188
+ };
189
+ struct AnyGt {
190
+ template <typename A, typename B>
191
+ bool operator()(const A& a, const B& b) const { return a > b; }
192
+ };
193
+ struct AnyLe {
194
+ template <typename A, typename B>
195
+ bool operator()(const A& a, const B& b) const { return a <= b; }
196
+ };
197
+ struct AnyGe {
198
+ template <typename A, typename B>
199
+ bool operator()(const A& a, const B& b) const { return a >= b; }
200
+ };
201
+
202
+ // A match result listener that ignores the explanation.
203
+ class DummyMatchResultListener : public MatchResultListener {
204
+ public:
205
+ DummyMatchResultListener() : MatchResultListener(nullptr) {}
206
+
207
+ private:
208
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener);
209
+ };
210
+
211
+ // A match result listener that forwards the explanation to a given
212
+ // ostream. The difference between this and MatchResultListener is
213
+ // that the former is concrete.
214
+ class StreamMatchResultListener : public MatchResultListener {
215
+ public:
216
+ explicit StreamMatchResultListener(::std::ostream* os)
217
+ : MatchResultListener(os) {}
218
+
219
+ private:
220
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener);
221
+ };
222
+
223
+ struct SharedPayloadBase {
224
+ std::atomic<int> ref{1};
225
+ void Ref() { ref.fetch_add(1, std::memory_order_relaxed); }
226
+ bool Unref() { return ref.fetch_sub(1, std::memory_order_acq_rel) == 1; }
227
+ };
228
+
229
+ template <typename T>
230
+ struct SharedPayload : SharedPayloadBase {
231
+ explicit SharedPayload(const T& v) : value(v) {}
232
+ explicit SharedPayload(T&& v) : value(std::move(v)) {}
233
+
234
+ static void Destroy(SharedPayloadBase* shared) {
235
+ delete static_cast<SharedPayload*>(shared);
236
+ }
237
+
238
+ T value;
239
+ };
240
+
241
+ // An internal class for implementing Matcher<T>, which will derive
242
+ // from it. We put functionalities common to all Matcher<T>
243
+ // specializations here to avoid code duplication.
244
+ template <typename T>
245
+ class MatcherBase : private MatcherDescriberInterface {
246
+ public:
247
+ // Returns true if and only if the matcher matches x; also explains the
248
+ // match result to 'listener'.
249
+ bool MatchAndExplain(const T& x, MatchResultListener* listener) const {
250
+ GTEST_CHECK_(vtable_ != nullptr);
251
+ return vtable_->match_and_explain(*this, x, listener);
252
+ }
253
+
254
+ // Returns true if and only if this matcher matches x.
255
+ bool Matches(const T& x) const {
256
+ DummyMatchResultListener dummy;
257
+ return MatchAndExplain(x, &dummy);
258
+ }
259
+
260
+ // Describes this matcher to an ostream.
261
+ void DescribeTo(::std::ostream* os) const final {
262
+ GTEST_CHECK_(vtable_ != nullptr);
263
+ vtable_->describe(*this, os, false);
264
+ }
265
+
266
+ // Describes the negation of this matcher to an ostream.
267
+ void DescribeNegationTo(::std::ostream* os) const final {
268
+ GTEST_CHECK_(vtable_ != nullptr);
269
+ vtable_->describe(*this, os, true);
270
+ }
271
+
272
+ // Explains why x matches, or doesn't match, the matcher.
273
+ void ExplainMatchResultTo(const T& x, ::std::ostream* os) const {
274
+ StreamMatchResultListener listener(os);
275
+ MatchAndExplain(x, &listener);
276
+ }
277
+
278
+ // Returns the describer for this matcher object; retains ownership
279
+ // of the describer, which is only guaranteed to be alive when
280
+ // this matcher object is alive.
281
+ const MatcherDescriberInterface* GetDescriber() const {
282
+ if (vtable_ == nullptr) return nullptr;
283
+ return vtable_->get_describer(*this);
284
+ }
285
+
286
+ protected:
287
+ MatcherBase() : vtable_(nullptr) {}
288
+
289
+ // Constructs a matcher from its implementation.
290
+ template <typename U>
291
+ explicit MatcherBase(const MatcherInterface<U>* impl) {
292
+ Init(impl);
293
+ }
294
+
295
+ template <typename M, typename = typename std::remove_reference<
296
+ M>::type::is_gtest_matcher>
297
+ MatcherBase(M&& m) { // NOLINT
298
+ Init(std::forward<M>(m));
299
+ }
300
+
301
+ MatcherBase(const MatcherBase& other)
302
+ : vtable_(other.vtable_), buffer_(other.buffer_) {
303
+ if (IsShared()) buffer_.shared->Ref();
304
+ }
305
+
306
+ MatcherBase& operator=(const MatcherBase& other) {
307
+ if (this == &other) return *this;
308
+ Destroy();
309
+ vtable_ = other.vtable_;
310
+ buffer_ = other.buffer_;
311
+ if (IsShared()) buffer_.shared->Ref();
312
+ return *this;
313
+ }
314
+
315
+ MatcherBase(MatcherBase&& other)
316
+ : vtable_(other.vtable_), buffer_(other.buffer_) {
317
+ other.vtable_ = nullptr;
318
+ }
319
+
320
+ MatcherBase& operator=(MatcherBase&& other) {
321
+ if (this == &other) return *this;
322
+ Destroy();
323
+ vtable_ = other.vtable_;
324
+ buffer_ = other.buffer_;
325
+ other.vtable_ = nullptr;
326
+ return *this;
327
+ }
328
+
329
+ ~MatcherBase() override { Destroy(); }
330
+
331
+ private:
332
+ struct VTable {
333
+ bool (*match_and_explain)(const MatcherBase&, const T&,
334
+ MatchResultListener*);
335
+ void (*describe)(const MatcherBase&, std::ostream*, bool negation);
336
+ // Returns the captured object if it implements the interface, otherwise
337
+ // returns the MatcherBase itself.
338
+ const MatcherDescriberInterface* (*get_describer)(const MatcherBase&);
339
+ // Called on shared instances when the reference count reaches 0.
340
+ void (*shared_destroy)(SharedPayloadBase*);
341
+ };
342
+
343
+ bool IsShared() const {
344
+ return vtable_ != nullptr && vtable_->shared_destroy != nullptr;
345
+ }
346
+
347
+ // If the implementation uses a listener, call that.
348
+ template <typename P>
349
+ static auto MatchAndExplainImpl(const MatcherBase& m, const T& value,
350
+ MatchResultListener* listener)
351
+ -> decltype(P::Get(m).MatchAndExplain(value, listener->stream())) {
352
+ return P::Get(m).MatchAndExplain(value, listener->stream());
353
+ }
354
+
355
+ template <typename P>
356
+ static auto MatchAndExplainImpl(const MatcherBase& m, const T& value,
357
+ MatchResultListener* listener)
358
+ -> decltype(P::Get(m).MatchAndExplain(value, listener)) {
359
+ return P::Get(m).MatchAndExplain(value, listener);
360
+ }
361
+
362
+ template <typename P>
363
+ static void DescribeImpl(const MatcherBase& m, std::ostream* os,
364
+ bool negation) {
365
+ if (negation) {
366
+ P::Get(m).DescribeNegationTo(os);
367
+ } else {
368
+ P::Get(m).DescribeTo(os);
369
+ }
370
+ }
371
+
372
+ template <typename P>
373
+ static const MatcherDescriberInterface* GetDescriberImpl(
374
+ const MatcherBase& m) {
375
+ // If the impl is a MatcherDescriberInterface, then return it.
376
+ // Otherwise use MatcherBase itself.
377
+ // This allows us to implement the GetDescriber() function without support
378
+ // from the impl, but some users really want to get their impl back when
379
+ // they call GetDescriber().
380
+ // We use std::get on a tuple as a workaround of not having `if constexpr`.
381
+ return std::get<(
382
+ std::is_convertible<decltype(&P::Get(m)),
383
+ const MatcherDescriberInterface*>::value
384
+ ? 1
385
+ : 0)>(std::make_tuple(&m, &P::Get(m)));
386
+ }
387
+
388
+ template <typename P>
389
+ const VTable* GetVTable() {
390
+ static constexpr VTable kVTable = {&MatchAndExplainImpl<P>,
391
+ &DescribeImpl<P>, &GetDescriberImpl<P>,
392
+ P::shared_destroy};
393
+ return &kVTable;
394
+ }
395
+
396
+ union Buffer {
397
+ // Add some types to give Buffer some common alignment/size use cases.
398
+ void* ptr;
399
+ double d;
400
+ int64_t i;
401
+ // And add one for the out-of-line cases.
402
+ SharedPayloadBase* shared;
403
+ };
404
+
405
+ void Destroy() {
406
+ if (IsShared() && buffer_.shared->Unref()) {
407
+ vtable_->shared_destroy(buffer_.shared);
408
+ }
409
+ }
410
+
411
+ template <typename M>
412
+ static constexpr bool IsInlined() {
413
+ return sizeof(M) <= sizeof(Buffer) && alignof(M) <= alignof(Buffer) &&
414
+ std::is_trivially_copy_constructible<M>::value &&
415
+ std::is_trivially_destructible<M>::value;
416
+ }
417
+
418
+ template <typename M, bool = MatcherBase::IsInlined<M>()>
419
+ struct ValuePolicy {
420
+ static const M& Get(const MatcherBase& m) {
421
+ // When inlined along with Init, need to be explicit to avoid violating
422
+ // strict aliasing rules.
423
+ const M *ptr = static_cast<const M*>(
424
+ static_cast<const void*>(&m.buffer_));
425
+ return *ptr;
426
+ }
427
+ static void Init(MatcherBase& m, M impl) {
428
+ ::new (static_cast<void*>(&m.buffer_)) M(impl);
429
+ }
430
+ static constexpr auto shared_destroy = nullptr;
431
+ };
432
+
433
+ template <typename M>
434
+ struct ValuePolicy<M, false> {
435
+ using Shared = SharedPayload<M>;
436
+ static const M& Get(const MatcherBase& m) {
437
+ return static_cast<Shared*>(m.buffer_.shared)->value;
438
+ }
439
+ template <typename Arg>
440
+ static void Init(MatcherBase& m, Arg&& arg) {
441
+ m.buffer_.shared = new Shared(std::forward<Arg>(arg));
442
+ }
443
+ static constexpr auto shared_destroy = &Shared::Destroy;
444
+ };
445
+
446
+ template <typename U, bool B>
447
+ struct ValuePolicy<const MatcherInterface<U>*, B> {
448
+ using M = const MatcherInterface<U>;
449
+ using Shared = SharedPayload<std::unique_ptr<M>>;
450
+ static const M& Get(const MatcherBase& m) {
451
+ return *static_cast<Shared*>(m.buffer_.shared)->value;
452
+ }
453
+ static void Init(MatcherBase& m, M* impl) {
454
+ m.buffer_.shared = new Shared(std::unique_ptr<M>(impl));
455
+ }
456
+
457
+ static constexpr auto shared_destroy = &Shared::Destroy;
458
+ };
459
+
460
+ template <typename M>
461
+ void Init(M&& m) {
462
+ using MM = typename std::decay<M>::type;
463
+ using Policy = ValuePolicy<MM>;
464
+ vtable_ = GetVTable<Policy>();
465
+ Policy::Init(*this, std::forward<M>(m));
466
+ }
467
+
468
+ const VTable* vtable_;
469
+ Buffer buffer_;
470
+ };
471
+
472
+ } // namespace internal
473
+
474
+ // A Matcher<T> is a copyable and IMMUTABLE (except by assignment)
475
+ // object that can check whether a value of type T matches. The
476
+ // implementation of Matcher<T> is just a std::shared_ptr to const
477
+ // MatcherInterface<T>. Don't inherit from Matcher!
478
+ template <typename T>
479
+ class Matcher : public internal::MatcherBase<T> {
480
+ public:
481
+ // Constructs a null matcher. Needed for storing Matcher objects in STL
482
+ // containers. A default-constructed matcher is not yet initialized. You
483
+ // cannot use it until a valid value has been assigned to it.
484
+ explicit Matcher() {} // NOLINT
485
+
486
+ // Constructs a matcher from its implementation.
487
+ explicit Matcher(const MatcherInterface<const T&>* impl)
488
+ : internal::MatcherBase<T>(impl) {}
489
+
490
+ template <typename U>
491
+ explicit Matcher(
492
+ const MatcherInterface<U>* impl,
493
+ typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
494
+ nullptr)
495
+ : internal::MatcherBase<T>(impl) {}
496
+
497
+ template <typename M, typename = typename std::remove_reference<
498
+ M>::type::is_gtest_matcher>
499
+ Matcher(M&& m) : internal::MatcherBase<T>(std::forward<M>(m)) {} // NOLINT
500
+
501
+ // Implicit constructor here allows people to write
502
+ // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes
503
+ Matcher(T value); // NOLINT
504
+ };
505
+
506
+ // The following two specializations allow the user to write str
507
+ // instead of Eq(str) and "foo" instead of Eq("foo") when a std::string
508
+ // matcher is expected.
509
+ template <>
510
+ class GTEST_API_ Matcher<const std::string&>
511
+ : public internal::MatcherBase<const std::string&> {
512
+ public:
513
+ Matcher() {}
514
+
515
+ explicit Matcher(const MatcherInterface<const std::string&>* impl)
516
+ : internal::MatcherBase<const std::string&>(impl) {}
517
+
518
+ template <typename M, typename = typename std::remove_reference<
519
+ M>::type::is_gtest_matcher>
520
+ Matcher(M&& m) // NOLINT
521
+ : internal::MatcherBase<const std::string&>(std::forward<M>(m)) {}
522
+
523
+ // Allows the user to write str instead of Eq(str) sometimes, where
524
+ // str is a std::string object.
525
+ Matcher(const std::string& s); // NOLINT
526
+
527
+ // Allows the user to write "foo" instead of Eq("foo") sometimes.
528
+ Matcher(const char* s); // NOLINT
529
+ };
530
+
531
+ template <>
532
+ class GTEST_API_ Matcher<std::string>
533
+ : public internal::MatcherBase<std::string> {
534
+ public:
535
+ Matcher() {}
536
+
537
+ explicit Matcher(const MatcherInterface<const std::string&>* impl)
538
+ : internal::MatcherBase<std::string>(impl) {}
539
+ explicit Matcher(const MatcherInterface<std::string>* impl)
540
+ : internal::MatcherBase<std::string>(impl) {}
541
+
542
+ template <typename M, typename = typename std::remove_reference<
543
+ M>::type::is_gtest_matcher>
544
+ Matcher(M&& m) // NOLINT
545
+ : internal::MatcherBase<std::string>(std::forward<M>(m)) {}
546
+
547
+ // Allows the user to write str instead of Eq(str) sometimes, where
548
+ // str is a string object.
549
+ Matcher(const std::string& s); // NOLINT
550
+
551
+ // Allows the user to write "foo" instead of Eq("foo") sometimes.
552
+ Matcher(const char* s); // NOLINT
553
+ };
554
+
555
+ #if GTEST_INTERNAL_HAS_STRING_VIEW
556
+ // The following two specializations allow the user to write str
557
+ // instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
558
+ // matcher is expected.
559
+ template <>
560
+ class GTEST_API_ Matcher<const internal::StringView&>
561
+ : public internal::MatcherBase<const internal::StringView&> {
562
+ public:
563
+ Matcher() {}
564
+
565
+ explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
566
+ : internal::MatcherBase<const internal::StringView&>(impl) {}
567
+
568
+ template <typename M, typename = typename std::remove_reference<
569
+ M>::type::is_gtest_matcher>
570
+ Matcher(M&& m) // NOLINT
571
+ : internal::MatcherBase<const internal::StringView&>(std::forward<M>(m)) {
572
+ }
573
+
574
+ // Allows the user to write str instead of Eq(str) sometimes, where
575
+ // str is a std::string object.
576
+ Matcher(const std::string& s); // NOLINT
577
+
578
+ // Allows the user to write "foo" instead of Eq("foo") sometimes.
579
+ Matcher(const char* s); // NOLINT
580
+
581
+ // Allows the user to pass absl::string_views or std::string_views directly.
582
+ Matcher(internal::StringView s); // NOLINT
583
+ };
584
+
585
+ template <>
586
+ class GTEST_API_ Matcher<internal::StringView>
587
+ : public internal::MatcherBase<internal::StringView> {
588
+ public:
589
+ Matcher() {}
590
+
591
+ explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
592
+ : internal::MatcherBase<internal::StringView>(impl) {}
593
+ explicit Matcher(const MatcherInterface<internal::StringView>* impl)
594
+ : internal::MatcherBase<internal::StringView>(impl) {}
595
+
596
+ template <typename M, typename = typename std::remove_reference<
597
+ M>::type::is_gtest_matcher>
598
+ Matcher(M&& m) // NOLINT
599
+ : internal::MatcherBase<internal::StringView>(std::forward<M>(m)) {}
600
+
601
+ // Allows the user to write str instead of Eq(str) sometimes, where
602
+ // str is a std::string object.
603
+ Matcher(const std::string& s); // NOLINT
604
+
605
+ // Allows the user to write "foo" instead of Eq("foo") sometimes.
606
+ Matcher(const char* s); // NOLINT
607
+
608
+ // Allows the user to pass absl::string_views or std::string_views directly.
609
+ Matcher(internal::StringView s); // NOLINT
610
+ };
611
+ #endif // GTEST_INTERNAL_HAS_STRING_VIEW
612
+
613
+ // Prints a matcher in a human-readable format.
614
+ template <typename T>
615
+ std::ostream& operator<<(std::ostream& os, const Matcher<T>& matcher) {
616
+ matcher.DescribeTo(&os);
617
+ return os;
618
+ }
619
+
620
+ // The PolymorphicMatcher class template makes it easy to implement a
621
+ // polymorphic matcher (i.e. a matcher that can match values of more
622
+ // than one type, e.g. Eq(n) and NotNull()).
623
+ //
624
+ // To define a polymorphic matcher, a user should provide an Impl
625
+ // class that has a DescribeTo() method and a DescribeNegationTo()
626
+ // method, and define a member function (or member function template)
627
+ //
628
+ // bool MatchAndExplain(const Value& value,
629
+ // MatchResultListener* listener) const;
630
+ //
631
+ // See the definition of NotNull() for a complete example.
632
+ template <class Impl>
633
+ class PolymorphicMatcher {
634
+ public:
635
+ explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {}
636
+
637
+ // Returns a mutable reference to the underlying matcher
638
+ // implementation object.
639
+ Impl& mutable_impl() { return impl_; }
640
+
641
+ // Returns an immutable reference to the underlying matcher
642
+ // implementation object.
643
+ const Impl& impl() const { return impl_; }
644
+
645
+ template <typename T>
646
+ operator Matcher<T>() const {
647
+ return Matcher<T>(new MonomorphicImpl<const T&>(impl_));
648
+ }
649
+
650
+ private:
651
+ template <typename T>
652
+ class MonomorphicImpl : public MatcherInterface<T> {
653
+ public:
654
+ explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
655
+
656
+ void DescribeTo(::std::ostream* os) const override { impl_.DescribeTo(os); }
657
+
658
+ void DescribeNegationTo(::std::ostream* os) const override {
659
+ impl_.DescribeNegationTo(os);
660
+ }
661
+
662
+ bool MatchAndExplain(T x, MatchResultListener* listener) const override {
663
+ return impl_.MatchAndExplain(x, listener);
664
+ }
665
+
666
+ private:
667
+ const Impl impl_;
668
+ };
669
+
670
+ Impl impl_;
671
+ };
672
+
673
+ // Creates a matcher from its implementation.
674
+ // DEPRECATED: Especially in the generic code, prefer:
675
+ // Matcher<T>(new MyMatcherImpl<const T&>(...));
676
+ //
677
+ // MakeMatcher may create a Matcher that accepts its argument by value, which
678
+ // leads to unnecessary copies & lack of support for non-copyable types.
679
+ template <typename T>
680
+ inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
681
+ return Matcher<T>(impl);
682
+ }
683
+
684
+ // Creates a polymorphic matcher from its implementation. This is
685
+ // easier to use than the PolymorphicMatcher<Impl> constructor as it
686
+ // doesn't require you to explicitly write the template argument, e.g.
687
+ //
688
+ // MakePolymorphicMatcher(foo);
689
+ // vs
690
+ // PolymorphicMatcher<TypeOfFoo>(foo);
691
+ template <class Impl>
692
+ inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
693
+ return PolymorphicMatcher<Impl>(impl);
694
+ }
695
+
696
+ namespace internal {
697
+ // Implements a matcher that compares a given value with a
698
+ // pre-supplied value using one of the ==, <=, <, etc, operators. The
699
+ // two values being compared don't have to have the same type.
700
+ //
701
+ // The matcher defined here is polymorphic (for example, Eq(5) can be
702
+ // used to match an int, a short, a double, etc). Therefore we use
703
+ // a template type conversion operator in the implementation.
704
+ //
705
+ // The following template definition assumes that the Rhs parameter is
706
+ // a "bare" type (i.e. neither 'const T' nor 'T&').
707
+ template <typename D, typename Rhs, typename Op>
708
+ class ComparisonBase {
709
+ public:
710
+ explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {}
711
+
712
+ using is_gtest_matcher = void;
713
+
714
+ template <typename Lhs>
715
+ bool MatchAndExplain(const Lhs& lhs, std::ostream*) const {
716
+ return Op()(lhs, Unwrap(rhs_));
717
+ }
718
+ void DescribeTo(std::ostream* os) const {
719
+ *os << D::Desc() << " ";
720
+ UniversalPrint(Unwrap(rhs_), os);
721
+ }
722
+ void DescribeNegationTo(std::ostream* os) const {
723
+ *os << D::NegatedDesc() << " ";
724
+ UniversalPrint(Unwrap(rhs_), os);
725
+ }
726
+
727
+ private:
728
+ template <typename T>
729
+ static const T& Unwrap(const T& v) {
730
+ return v;
731
+ }
732
+ template <typename T>
733
+ static const T& Unwrap(std::reference_wrapper<T> v) {
734
+ return v;
735
+ }
736
+
737
+ Rhs rhs_;
738
+ };
739
+
740
+ template <typename Rhs>
741
+ class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> {
742
+ public:
743
+ explicit EqMatcher(const Rhs& rhs)
744
+ : ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) { }
745
+ static const char* Desc() { return "is equal to"; }
746
+ static const char* NegatedDesc() { return "isn't equal to"; }
747
+ };
748
+ template <typename Rhs>
749
+ class NeMatcher : public ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe> {
750
+ public:
751
+ explicit NeMatcher(const Rhs& rhs)
752
+ : ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) { }
753
+ static const char* Desc() { return "isn't equal to"; }
754
+ static const char* NegatedDesc() { return "is equal to"; }
755
+ };
756
+ template <typename Rhs>
757
+ class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt> {
758
+ public:
759
+ explicit LtMatcher(const Rhs& rhs)
760
+ : ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) { }
761
+ static const char* Desc() { return "is <"; }
762
+ static const char* NegatedDesc() { return "isn't <"; }
763
+ };
764
+ template <typename Rhs>
765
+ class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt> {
766
+ public:
767
+ explicit GtMatcher(const Rhs& rhs)
768
+ : ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) { }
769
+ static const char* Desc() { return "is >"; }
770
+ static const char* NegatedDesc() { return "isn't >"; }
771
+ };
772
+ template <typename Rhs>
773
+ class LeMatcher : public ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe> {
774
+ public:
775
+ explicit LeMatcher(const Rhs& rhs)
776
+ : ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) { }
777
+ static const char* Desc() { return "is <="; }
778
+ static const char* NegatedDesc() { return "isn't <="; }
779
+ };
780
+ template <typename Rhs>
781
+ class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> {
782
+ public:
783
+ explicit GeMatcher(const Rhs& rhs)
784
+ : ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe>(rhs) { }
785
+ static const char* Desc() { return "is >="; }
786
+ static const char* NegatedDesc() { return "isn't >="; }
787
+ };
788
+
789
+ template <typename T, typename = typename std::enable_if<
790
+ std::is_constructible<std::string, T>::value>::type>
791
+ using StringLike = T;
792
+
793
+ // Implements polymorphic matchers MatchesRegex(regex) and
794
+ // ContainsRegex(regex), which can be used as a Matcher<T> as long as
795
+ // T can be converted to a string.
796
+ class MatchesRegexMatcher {
797
+ public:
798
+ MatchesRegexMatcher(const RE* regex, bool full_match)
799
+ : regex_(regex), full_match_(full_match) {}
800
+
801
+ #if GTEST_INTERNAL_HAS_STRING_VIEW
802
+ bool MatchAndExplain(const internal::StringView& s,
803
+ MatchResultListener* listener) const {
804
+ return MatchAndExplain(std::string(s), listener);
805
+ }
806
+ #endif // GTEST_INTERNAL_HAS_STRING_VIEW
807
+
808
+ // Accepts pointer types, particularly:
809
+ // const char*
810
+ // char*
811
+ // const wchar_t*
812
+ // wchar_t*
813
+ template <typename CharType>
814
+ bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
815
+ return s != nullptr && MatchAndExplain(std::string(s), listener);
816
+ }
817
+
818
+ // Matches anything that can convert to std::string.
819
+ //
820
+ // This is a template, not just a plain function with const std::string&,
821
+ // because absl::string_view has some interfering non-explicit constructors.
822
+ template <class MatcheeStringType>
823
+ bool MatchAndExplain(const MatcheeStringType& s,
824
+ MatchResultListener* /* listener */) const {
825
+ const std::string& s2(s);
826
+ return full_match_ ? RE::FullMatch(s2, *regex_)
827
+ : RE::PartialMatch(s2, *regex_);
828
+ }
829
+
830
+ void DescribeTo(::std::ostream* os) const {
831
+ *os << (full_match_ ? "matches" : "contains") << " regular expression ";
832
+ UniversalPrinter<std::string>::Print(regex_->pattern(), os);
833
+ }
834
+
835
+ void DescribeNegationTo(::std::ostream* os) const {
836
+ *os << "doesn't " << (full_match_ ? "match" : "contain")
837
+ << " regular expression ";
838
+ UniversalPrinter<std::string>::Print(regex_->pattern(), os);
839
+ }
840
+
841
+ private:
842
+ const std::shared_ptr<const RE> regex_;
843
+ const bool full_match_;
844
+ };
845
+ } // namespace internal
846
+
847
+ // Matches a string that fully matches regular expression 'regex'.
848
+ // The matcher takes ownership of 'regex'.
849
+ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
850
+ const internal::RE* regex) {
851
+ return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
852
+ }
853
+ template <typename T = std::string>
854
+ PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
855
+ const internal::StringLike<T>& regex) {
856
+ return MatchesRegex(new internal::RE(std::string(regex)));
857
+ }
858
+
859
+ // Matches a string that contains regular expression 'regex'.
860
+ // The matcher takes ownership of 'regex'.
861
+ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
862
+ const internal::RE* regex) {
863
+ return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
864
+ }
865
+ template <typename T = std::string>
866
+ PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
867
+ const internal::StringLike<T>& regex) {
868
+ return ContainsRegex(new internal::RE(std::string(regex)));
869
+ }
870
+
871
+ // Creates a polymorphic matcher that matches anything equal to x.
872
+ // Note: if the parameter of Eq() were declared as const T&, Eq("foo")
873
+ // wouldn't compile.
874
+ template <typename T>
875
+ inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); }
876
+
877
+ // Constructs a Matcher<T> from a 'value' of type T. The constructed
878
+ // matcher matches any value that's equal to 'value'.
879
+ template <typename T>
880
+ Matcher<T>::Matcher(T value) { *this = Eq(value); }
881
+
882
+ // Creates a monomorphic matcher that matches anything with type Lhs
883
+ // and equal to rhs. A user may need to use this instead of Eq(...)
884
+ // in order to resolve an overloading ambiguity.
885
+ //
886
+ // TypedEq<T>(x) is just a convenient short-hand for Matcher<T>(Eq(x))
887
+ // or Matcher<T>(x), but more readable than the latter.
888
+ //
889
+ // We could define similar monomorphic matchers for other comparison
890
+ // operations (e.g. TypedLt, TypedGe, and etc), but decided not to do
891
+ // it yet as those are used much less than Eq() in practice. A user
892
+ // can always write Matcher<T>(Lt(5)) to be explicit about the type,
893
+ // for example.
894
+ template <typename Lhs, typename Rhs>
895
+ inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
896
+
897
+ // Creates a polymorphic matcher that matches anything >= x.
898
+ template <typename Rhs>
899
+ inline internal::GeMatcher<Rhs> Ge(Rhs x) {
900
+ return internal::GeMatcher<Rhs>(x);
901
+ }
902
+
903
+ // Creates a polymorphic matcher that matches anything > x.
904
+ template <typename Rhs>
905
+ inline internal::GtMatcher<Rhs> Gt(Rhs x) {
906
+ return internal::GtMatcher<Rhs>(x);
907
+ }
908
+
909
+ // Creates a polymorphic matcher that matches anything <= x.
910
+ template <typename Rhs>
911
+ inline internal::LeMatcher<Rhs> Le(Rhs x) {
912
+ return internal::LeMatcher<Rhs>(x);
913
+ }
914
+
915
+ // Creates a polymorphic matcher that matches anything < x.
916
+ template <typename Rhs>
917
+ inline internal::LtMatcher<Rhs> Lt(Rhs x) {
918
+ return internal::LtMatcher<Rhs>(x);
919
+ }
920
+
921
+ // Creates a polymorphic matcher that matches anything != x.
922
+ template <typename Rhs>
923
+ inline internal::NeMatcher<Rhs> Ne(Rhs x) {
924
+ return internal::NeMatcher<Rhs>(x);
925
+ }
926
+ } // namespace testing
927
+
928
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 5046
929
+
930
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_