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,533 @@
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
+
31
+ // Google Test - The Google C++ Testing and Mocking Framework
32
+ //
33
+ // This file implements a universal value printer that can print a
34
+ // value of any type T:
35
+ //
36
+ // void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
37
+ //
38
+ // It uses the << operator when possible, and prints the bytes in the
39
+ // object otherwise. A user can override its behavior for a class
40
+ // type Foo by defining either operator<<(::std::ostream&, const Foo&)
41
+ // or void PrintTo(const Foo&, ::std::ostream*) in the namespace that
42
+ // defines Foo.
43
+
44
+ #include "gtest/gtest-printers.h"
45
+
46
+ #include <stdio.h>
47
+
48
+ #include <cctype>
49
+ #include <cstdint>
50
+ #include <cwchar>
51
+ #include <ostream> // NOLINT
52
+ #include <string>
53
+ #include <type_traits>
54
+
55
+ #include "gtest/internal/gtest-port.h"
56
+ #include "src/gtest-internal-inl.h"
57
+
58
+ namespace testing {
59
+
60
+ namespace {
61
+
62
+ using ::std::ostream;
63
+
64
+ // Prints a segment of bytes in the given object.
65
+ GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
66
+ GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
67
+ GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
68
+ GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
69
+ void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
70
+ size_t count, ostream* os) {
71
+ char text[5] = "";
72
+ for (size_t i = 0; i != count; i++) {
73
+ const size_t j = start + i;
74
+ if (i != 0) {
75
+ // Organizes the bytes into groups of 2 for easy parsing by
76
+ // human.
77
+ if ((j % 2) == 0)
78
+ *os << ' ';
79
+ else
80
+ *os << '-';
81
+ }
82
+ GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]);
83
+ *os << text;
84
+ }
85
+ }
86
+
87
+ // Prints the bytes in the given value to the given ostream.
88
+ void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count,
89
+ ostream* os) {
90
+ // Tells the user how big the object is.
91
+ *os << count << "-byte object <";
92
+
93
+ const size_t kThreshold = 132;
94
+ const size_t kChunkSize = 64;
95
+ // If the object size is bigger than kThreshold, we'll have to omit
96
+ // some details by printing only the first and the last kChunkSize
97
+ // bytes.
98
+ if (count < kThreshold) {
99
+ PrintByteSegmentInObjectTo(obj_bytes, 0, count, os);
100
+ } else {
101
+ PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os);
102
+ *os << " ... ";
103
+ // Rounds up to 2-byte boundary.
104
+ const size_t resume_pos = (count - kChunkSize + 1)/2*2;
105
+ PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os);
106
+ }
107
+ *os << ">";
108
+ }
109
+
110
+ // Helpers for widening a character to char32_t. Since the standard does not
111
+ // specify if char / wchar_t is signed or unsigned, it is important to first
112
+ // convert it to the unsigned type of the same width before widening it to
113
+ // char32_t.
114
+ template <typename CharType>
115
+ char32_t ToChar32(CharType in) {
116
+ return static_cast<char32_t>(
117
+ static_cast<typename std::make_unsigned<CharType>::type>(in));
118
+ }
119
+
120
+ } // namespace
121
+
122
+ namespace internal {
123
+
124
+ // Delegates to PrintBytesInObjectToImpl() to print the bytes in the
125
+ // given object. The delegation simplifies the implementation, which
126
+ // uses the << operator and thus is easier done outside of the
127
+ // ::testing::internal namespace, which contains a << operator that
128
+ // sometimes conflicts with the one in STL.
129
+ void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count,
130
+ ostream* os) {
131
+ PrintBytesInObjectToImpl(obj_bytes, count, os);
132
+ }
133
+
134
+ // Depending on the value of a char (or wchar_t), we print it in one
135
+ // of three formats:
136
+ // - as is if it's a printable ASCII (e.g. 'a', '2', ' '),
137
+ // - as a hexadecimal escape sequence (e.g. '\x7F'), or
138
+ // - as a special escape sequence (e.g. '\r', '\n').
139
+ enum CharFormat {
140
+ kAsIs,
141
+ kHexEscape,
142
+ kSpecialEscape
143
+ };
144
+
145
+ // Returns true if c is a printable ASCII character. We test the
146
+ // value of c directly instead of calling isprint(), which is buggy on
147
+ // Windows Mobile.
148
+ inline bool IsPrintableAscii(char32_t c) { return 0x20 <= c && c <= 0x7E; }
149
+
150
+ // Prints c (of type char, char8_t, char16_t, char32_t, or wchar_t) as a
151
+ // character literal without the quotes, escaping it when necessary; returns how
152
+ // c was formatted.
153
+ template <typename Char>
154
+ static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
155
+ const char32_t u_c = ToChar32(c);
156
+ switch (u_c) {
157
+ case L'\0':
158
+ *os << "\\0";
159
+ break;
160
+ case L'\'':
161
+ *os << "\\'";
162
+ break;
163
+ case L'\\':
164
+ *os << "\\\\";
165
+ break;
166
+ case L'\a':
167
+ *os << "\\a";
168
+ break;
169
+ case L'\b':
170
+ *os << "\\b";
171
+ break;
172
+ case L'\f':
173
+ *os << "\\f";
174
+ break;
175
+ case L'\n':
176
+ *os << "\\n";
177
+ break;
178
+ case L'\r':
179
+ *os << "\\r";
180
+ break;
181
+ case L'\t':
182
+ *os << "\\t";
183
+ break;
184
+ case L'\v':
185
+ *os << "\\v";
186
+ break;
187
+ default:
188
+ if (IsPrintableAscii(u_c)) {
189
+ *os << static_cast<char>(c);
190
+ return kAsIs;
191
+ } else {
192
+ ostream::fmtflags flags = os->flags();
193
+ *os << "\\x" << std::hex << std::uppercase << static_cast<int>(u_c);
194
+ os->flags(flags);
195
+ return kHexEscape;
196
+ }
197
+ }
198
+ return kSpecialEscape;
199
+ }
200
+
201
+ // Prints a char32_t c as if it's part of a string literal, escaping it when
202
+ // necessary; returns how c was formatted.
203
+ static CharFormat PrintAsStringLiteralTo(char32_t c, ostream* os) {
204
+ switch (c) {
205
+ case L'\'':
206
+ *os << "'";
207
+ return kAsIs;
208
+ case L'"':
209
+ *os << "\\\"";
210
+ return kSpecialEscape;
211
+ default:
212
+ return PrintAsCharLiteralTo(c, os);
213
+ }
214
+ }
215
+
216
+ static const char* GetCharWidthPrefix(char) {
217
+ return "";
218
+ }
219
+
220
+ static const char* GetCharWidthPrefix(signed char) {
221
+ return "";
222
+ }
223
+
224
+ static const char* GetCharWidthPrefix(unsigned char) {
225
+ return "";
226
+ }
227
+
228
+ #ifdef __cpp_char8_t
229
+ static const char* GetCharWidthPrefix(char8_t) {
230
+ return "u8";
231
+ }
232
+ #endif
233
+
234
+ static const char* GetCharWidthPrefix(char16_t) {
235
+ return "u";
236
+ }
237
+
238
+ static const char* GetCharWidthPrefix(char32_t) {
239
+ return "U";
240
+ }
241
+
242
+ static const char* GetCharWidthPrefix(wchar_t) {
243
+ return "L";
244
+ }
245
+
246
+ // Prints a char c as if it's part of a string literal, escaping it when
247
+ // necessary; returns how c was formatted.
248
+ static CharFormat PrintAsStringLiteralTo(char c, ostream* os) {
249
+ return PrintAsStringLiteralTo(ToChar32(c), os);
250
+ }
251
+
252
+ #ifdef __cpp_char8_t
253
+ static CharFormat PrintAsStringLiteralTo(char8_t c, ostream* os) {
254
+ return PrintAsStringLiteralTo(ToChar32(c), os);
255
+ }
256
+ #endif
257
+
258
+ static CharFormat PrintAsStringLiteralTo(char16_t c, ostream* os) {
259
+ return PrintAsStringLiteralTo(ToChar32(c), os);
260
+ }
261
+
262
+ static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) {
263
+ return PrintAsStringLiteralTo(ToChar32(c), os);
264
+ }
265
+
266
+ // Prints a character c (of type char, char8_t, char16_t, char32_t, or wchar_t)
267
+ // and its code. '\0' is printed as "'\\0'", other unprintable characters are
268
+ // also properly escaped using the standard C++ escape sequence.
269
+ template <typename Char>
270
+ void PrintCharAndCodeTo(Char c, ostream* os) {
271
+ // First, print c as a literal in the most readable form we can find.
272
+ *os << GetCharWidthPrefix(c) << "'";
273
+ const CharFormat format = PrintAsCharLiteralTo(c, os);
274
+ *os << "'";
275
+
276
+ // To aid user debugging, we also print c's code in decimal, unless
277
+ // it's 0 (in which case c was printed as '\\0', making the code
278
+ // obvious).
279
+ if (c == 0)
280
+ return;
281
+ *os << " (" << static_cast<int>(c);
282
+
283
+ // For more convenience, we print c's code again in hexadecimal,
284
+ // unless c was already printed in the form '\x##' or the code is in
285
+ // [1, 9].
286
+ if (format == kHexEscape || (1 <= c && c <= 9)) {
287
+ // Do nothing.
288
+ } else {
289
+ *os << ", 0x" << String::FormatHexInt(static_cast<int>(c));
290
+ }
291
+ *os << ")";
292
+ }
293
+
294
+ void PrintTo(unsigned char c, ::std::ostream* os) { PrintCharAndCodeTo(c, os); }
295
+ void PrintTo(signed char c, ::std::ostream* os) { PrintCharAndCodeTo(c, os); }
296
+
297
+ // Prints a wchar_t as a symbol if it is printable or as its internal
298
+ // code otherwise and also as its code. L'\0' is printed as "L'\\0'".
299
+ void PrintTo(wchar_t wc, ostream* os) { PrintCharAndCodeTo(wc, os); }
300
+
301
+ // TODO(dcheng): Consider making this delegate to PrintCharAndCodeTo() as well.
302
+ void PrintTo(char32_t c, ::std::ostream* os) {
303
+ *os << std::hex << "U+" << std::uppercase << std::setfill('0') << std::setw(4)
304
+ << static_cast<uint32_t>(c);
305
+ }
306
+
307
+ // Prints the given array of characters to the ostream. CharType must be either
308
+ // char, char8_t, char16_t, char32_t, or wchar_t.
309
+ // The array starts at begin, the length is len, it may include '\0' characters
310
+ // and may not be NUL-terminated.
311
+ template <typename CharType>
312
+ GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
313
+ GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
314
+ GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
315
+ GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
316
+ static CharFormat PrintCharsAsStringTo(
317
+ const CharType* begin, size_t len, ostream* os) {
318
+ const char* const quote_prefix = GetCharWidthPrefix(*begin);
319
+ *os << quote_prefix << "\"";
320
+ bool is_previous_hex = false;
321
+ CharFormat print_format = kAsIs;
322
+ for (size_t index = 0; index < len; ++index) {
323
+ const CharType cur = begin[index];
324
+ if (is_previous_hex && IsXDigit(cur)) {
325
+ // Previous character is of '\x..' form and this character can be
326
+ // interpreted as another hexadecimal digit in its number. Break string to
327
+ // disambiguate.
328
+ *os << "\" " << quote_prefix << "\"";
329
+ }
330
+ is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape;
331
+ // Remember if any characters required hex escaping.
332
+ if (is_previous_hex) {
333
+ print_format = kHexEscape;
334
+ }
335
+ }
336
+ *os << "\"";
337
+ return print_format;
338
+ }
339
+
340
+ // Prints a (const) char/wchar_t array of 'len' elements, starting at address
341
+ // 'begin'. CharType must be either char or wchar_t.
342
+ template <typename CharType>
343
+ GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
344
+ GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
345
+ GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
346
+ GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
347
+ static void UniversalPrintCharArray(
348
+ const CharType* begin, size_t len, ostream* os) {
349
+ // The code
350
+ // const char kFoo[] = "foo";
351
+ // generates an array of 4, not 3, elements, with the last one being '\0'.
352
+ //
353
+ // Therefore when printing a char array, we don't print the last element if
354
+ // it's '\0', such that the output matches the string literal as it's
355
+ // written in the source code.
356
+ if (len > 0 && begin[len - 1] == '\0') {
357
+ PrintCharsAsStringTo(begin, len - 1, os);
358
+ return;
359
+ }
360
+
361
+ // If, however, the last element in the array is not '\0', e.g.
362
+ // const char kFoo[] = { 'f', 'o', 'o' };
363
+ // we must print the entire array. We also print a message to indicate
364
+ // that the array is not NUL-terminated.
365
+ PrintCharsAsStringTo(begin, len, os);
366
+ *os << " (no terminating NUL)";
367
+ }
368
+
369
+ // Prints a (const) char array of 'len' elements, starting at address 'begin'.
370
+ void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
371
+ UniversalPrintCharArray(begin, len, os);
372
+ }
373
+
374
+ #ifdef __cpp_char8_t
375
+ // Prints a (const) char8_t array of 'len' elements, starting at address
376
+ // 'begin'.
377
+ void UniversalPrintArray(const char8_t* begin, size_t len, ostream* os) {
378
+ UniversalPrintCharArray(begin, len, os);
379
+ }
380
+ #endif
381
+
382
+ // Prints a (const) char16_t array of 'len' elements, starting at address
383
+ // 'begin'.
384
+ void UniversalPrintArray(const char16_t* begin, size_t len, ostream* os) {
385
+ UniversalPrintCharArray(begin, len, os);
386
+ }
387
+
388
+ // Prints a (const) char32_t array of 'len' elements, starting at address
389
+ // 'begin'.
390
+ void UniversalPrintArray(const char32_t* begin, size_t len, ostream* os) {
391
+ UniversalPrintCharArray(begin, len, os);
392
+ }
393
+
394
+ // Prints a (const) wchar_t array of 'len' elements, starting at address
395
+ // 'begin'.
396
+ void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) {
397
+ UniversalPrintCharArray(begin, len, os);
398
+ }
399
+
400
+ namespace {
401
+
402
+ // Prints a null-terminated C-style string to the ostream.
403
+ template <typename Char>
404
+ void PrintCStringTo(const Char* s, ostream* os) {
405
+ if (s == nullptr) {
406
+ *os << "NULL";
407
+ } else {
408
+ *os << ImplicitCast_<const void*>(s) << " pointing to ";
409
+ PrintCharsAsStringTo(s, std::char_traits<Char>::length(s), os);
410
+ }
411
+ }
412
+
413
+ } // anonymous namespace
414
+
415
+ void PrintTo(const char* s, ostream* os) { PrintCStringTo(s, os); }
416
+
417
+ #ifdef __cpp_char8_t
418
+ void PrintTo(const char8_t* s, ostream* os) { PrintCStringTo(s, os); }
419
+ #endif
420
+
421
+ void PrintTo(const char16_t* s, ostream* os) { PrintCStringTo(s, os); }
422
+
423
+ void PrintTo(const char32_t* s, ostream* os) { PrintCStringTo(s, os); }
424
+
425
+ // MSVC compiler can be configured to define whar_t as a typedef
426
+ // of unsigned short. Defining an overload for const wchar_t* in that case
427
+ // would cause pointers to unsigned shorts be printed as wide strings,
428
+ // possibly accessing more memory than intended and causing invalid
429
+ // memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when
430
+ // wchar_t is implemented as a native type.
431
+ #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
432
+ // Prints the given wide C string to the ostream.
433
+ void PrintTo(const wchar_t* s, ostream* os) { PrintCStringTo(s, os); }
434
+ #endif // wchar_t is native
435
+
436
+ namespace {
437
+
438
+ bool ContainsUnprintableControlCodes(const char* str, size_t length) {
439
+ const unsigned char *s = reinterpret_cast<const unsigned char *>(str);
440
+
441
+ for (size_t i = 0; i < length; i++) {
442
+ unsigned char ch = *s++;
443
+ if (std::iscntrl(ch)) {
444
+ switch (ch) {
445
+ case '\t':
446
+ case '\n':
447
+ case '\r':
448
+ break;
449
+ default:
450
+ return true;
451
+ }
452
+ }
453
+ }
454
+ return false;
455
+ }
456
+
457
+ bool IsUTF8TrailByte(unsigned char t) { return 0x80 <= t && t<= 0xbf; }
458
+
459
+ bool IsValidUTF8(const char* str, size_t length) {
460
+ const unsigned char *s = reinterpret_cast<const unsigned char *>(str);
461
+
462
+ for (size_t i = 0; i < length;) {
463
+ unsigned char lead = s[i++];
464
+
465
+ if (lead <= 0x7f) {
466
+ continue; // single-byte character (ASCII) 0..7F
467
+ }
468
+ if (lead < 0xc2) {
469
+ return false; // trail byte or non-shortest form
470
+ } else if (lead <= 0xdf && (i + 1) <= length && IsUTF8TrailByte(s[i])) {
471
+ ++i; // 2-byte character
472
+ } else if (0xe0 <= lead && lead <= 0xef && (i + 2) <= length &&
473
+ IsUTF8TrailByte(s[i]) &&
474
+ IsUTF8TrailByte(s[i + 1]) &&
475
+ // check for non-shortest form and surrogate
476
+ (lead != 0xe0 || s[i] >= 0xa0) &&
477
+ (lead != 0xed || s[i] < 0xa0)) {
478
+ i += 2; // 3-byte character
479
+ } else if (0xf0 <= lead && lead <= 0xf4 && (i + 3) <= length &&
480
+ IsUTF8TrailByte(s[i]) &&
481
+ IsUTF8TrailByte(s[i + 1]) &&
482
+ IsUTF8TrailByte(s[i + 2]) &&
483
+ // check for non-shortest form
484
+ (lead != 0xf0 || s[i] >= 0x90) &&
485
+ (lead != 0xf4 || s[i] < 0x90)) {
486
+ i += 3; // 4-byte character
487
+ } else {
488
+ return false;
489
+ }
490
+ }
491
+ return true;
492
+ }
493
+
494
+ void ConditionalPrintAsText(const char* str, size_t length, ostream* os) {
495
+ if (!ContainsUnprintableControlCodes(str, length) &&
496
+ IsValidUTF8(str, length)) {
497
+ *os << "\n As Text: \"" << str << "\"";
498
+ }
499
+ }
500
+
501
+ } // anonymous namespace
502
+
503
+ void PrintStringTo(const ::std::string& s, ostream* os) {
504
+ if (PrintCharsAsStringTo(s.data(), s.size(), os) == kHexEscape) {
505
+ if (GTEST_FLAG(print_utf8)) {
506
+ ConditionalPrintAsText(s.data(), s.size(), os);
507
+ }
508
+ }
509
+ }
510
+
511
+ #ifdef __cpp_char8_t
512
+ void PrintU8StringTo(const ::std::u8string& s, ostream* os) {
513
+ PrintCharsAsStringTo(s.data(), s.size(), os);
514
+ }
515
+ #endif
516
+
517
+ void PrintU16StringTo(const ::std::u16string& s, ostream* os) {
518
+ PrintCharsAsStringTo(s.data(), s.size(), os);
519
+ }
520
+
521
+ void PrintU32StringTo(const ::std::u32string& s, ostream* os) {
522
+ PrintCharsAsStringTo(s.data(), s.size(), os);
523
+ }
524
+
525
+ #if GTEST_HAS_STD_WSTRING
526
+ void PrintWideStringTo(const ::std::wstring& s, ostream* os) {
527
+ PrintCharsAsStringTo(s.data(), s.size(), os);
528
+ }
529
+ #endif // GTEST_HAS_STD_WSTRING
530
+
531
+ } // namespace internal
532
+
533
+ } // namespace testing
@@ -0,0 +1,108 @@
1
+ // Copyright 2008, 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
+ //
31
+ // The Google C++ Testing and Mocking Framework (Google Test)
32
+
33
+ #include "gtest/gtest-test-part.h"
34
+
35
+ #include "gtest/internal/gtest-port.h"
36
+ #include "src/gtest-internal-inl.h"
37
+
38
+ namespace testing {
39
+
40
+ using internal::GetUnitTestImpl;
41
+
42
+ // Gets the summary of the failure message by omitting the stack trace
43
+ // in it.
44
+ std::string TestPartResult::ExtractSummary(const char* message) {
45
+ const char* const stack_trace = strstr(message, internal::kStackTraceMarker);
46
+ return stack_trace == nullptr ? message : std::string(message, stack_trace);
47
+ }
48
+
49
+ // Prints a TestPartResult object.
50
+ std::ostream& operator<<(std::ostream& os, const TestPartResult& result) {
51
+ return os << internal::FormatFileLocation(result.file_name(),
52
+ result.line_number())
53
+ << " "
54
+ << (result.type() == TestPartResult::kSuccess
55
+ ? "Success"
56
+ : result.type() == TestPartResult::kSkip
57
+ ? "Skipped"
58
+ : result.type() == TestPartResult::kFatalFailure
59
+ ? "Fatal failure"
60
+ : "Non-fatal failure")
61
+ << ":\n"
62
+ << result.message() << std::endl;
63
+ }
64
+
65
+ // Appends a TestPartResult to the array.
66
+ void TestPartResultArray::Append(const TestPartResult& result) {
67
+ array_.push_back(result);
68
+ }
69
+
70
+ // Returns the TestPartResult at the given index (0-based).
71
+ const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {
72
+ if (index < 0 || index >= size()) {
73
+ printf("\nInvalid index (%d) into TestPartResultArray.\n", index);
74
+ internal::posix::Abort();
75
+ }
76
+
77
+ return array_[static_cast<size_t>(index)];
78
+ }
79
+
80
+ // Returns the number of TestPartResult objects in the array.
81
+ int TestPartResultArray::size() const {
82
+ return static_cast<int>(array_.size());
83
+ }
84
+
85
+ namespace internal {
86
+
87
+ HasNewFatalFailureHelper::HasNewFatalFailureHelper()
88
+ : has_new_fatal_failure_(false),
89
+ original_reporter_(GetUnitTestImpl()->
90
+ GetTestPartResultReporterForCurrentThread()) {
91
+ GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this);
92
+ }
93
+
94
+ HasNewFatalFailureHelper::~HasNewFatalFailureHelper() {
95
+ GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(
96
+ original_reporter_);
97
+ }
98
+
99
+ void HasNewFatalFailureHelper::ReportTestPartResult(
100
+ const TestPartResult& result) {
101
+ if (result.fatally_failed())
102
+ has_new_fatal_failure_ = true;
103
+ original_reporter_->ReportTestPartResult(result);
104
+ }
105
+
106
+ } // namespace internal
107
+
108
+ } // namespace testing