rn-leveldb 3.11.0

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 (595) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +92 -0
  3. package/android/.project +34 -0
  4. package/android/.settings/org.eclipse.buildship.core.prefs +13 -0
  5. package/android/CMakeLists.txt +69 -0
  6. package/android/build.gradle +125 -0
  7. package/android/cpp-adapter.cpp +19 -0
  8. package/android/gradle.properties +6 -0
  9. package/android/src/main/AndroidManifest.xml +4 -0
  10. package/android/src/main/java/com/reactnativeleveldb/LeveldbModule.java +57 -0
  11. package/android/src/main/java/com/reactnativeleveldb/LeveldbPackage.java +28 -0
  12. package/cpp/leveldb/.appveyor.yml +36 -0
  13. package/cpp/leveldb/.clang-format +18 -0
  14. package/cpp/leveldb/.travis.yml +88 -0
  15. package/cpp/leveldb/AUTHORS +12 -0
  16. package/cpp/leveldb/CMakeLists.txt +495 -0
  17. package/cpp/leveldb/CONTRIBUTING.md +36 -0
  18. package/cpp/leveldb/LICENSE +27 -0
  19. package/cpp/leveldb/NEWS +17 -0
  20. package/cpp/leveldb/README.md +231 -0
  21. package/cpp/leveldb/TODO +14 -0
  22. package/cpp/leveldb/benchmarks/db_bench.cc +990 -0
  23. package/cpp/leveldb/benchmarks/db_bench_sqlite3.cc +726 -0
  24. package/cpp/leveldb/benchmarks/db_bench_tree_db.cc +531 -0
  25. package/cpp/leveldb/cmake/leveldbConfig.cmake.in +9 -0
  26. package/cpp/leveldb/db/autocompact_test.cc +115 -0
  27. package/cpp/leveldb/db/builder.cc +82 -0
  28. package/cpp/leveldb/db/builder.h +30 -0
  29. package/cpp/leveldb/db/c.cc +562 -0
  30. package/cpp/leveldb/db/c_test.c +384 -0
  31. package/cpp/leveldb/db/corruption_test.cc +367 -0
  32. package/cpp/leveldb/db/db_impl.cc +1554 -0
  33. package/cpp/leveldb/db/db_impl.h +217 -0
  34. package/cpp/leveldb/db/db_iter.cc +318 -0
  35. package/cpp/leveldb/db/db_iter.h +26 -0
  36. package/cpp/leveldb/db/db_test.cc +2305 -0
  37. package/cpp/leveldb/db/dbformat.cc +136 -0
  38. package/cpp/leveldb/db/dbformat.h +224 -0
  39. package/cpp/leveldb/db/dbformat_test.cc +133 -0
  40. package/cpp/leveldb/db/dumpfile.cc +232 -0
  41. package/cpp/leveldb/db/fault_injection_test.cc +555 -0
  42. package/cpp/leveldb/db/filename.cc +141 -0
  43. package/cpp/leveldb/db/filename.h +83 -0
  44. package/cpp/leveldb/db/filename_test.cc +132 -0
  45. package/cpp/leveldb/db/leveldbutil.cc +64 -0
  46. package/cpp/leveldb/db/log_format.h +35 -0
  47. package/cpp/leveldb/db/log_reader.cc +274 -0
  48. package/cpp/leveldb/db/log_reader.h +112 -0
  49. package/cpp/leveldb/db/log_test.cc +563 -0
  50. package/cpp/leveldb/db/log_writer.cc +111 -0
  51. package/cpp/leveldb/db/log_writer.h +54 -0
  52. package/cpp/leveldb/db/memtable.cc +137 -0
  53. package/cpp/leveldb/db/memtable.h +87 -0
  54. package/cpp/leveldb/db/recovery_test.cc +339 -0
  55. package/cpp/leveldb/db/repair.cc +451 -0
  56. package/cpp/leveldb/db/skiplist.h +382 -0
  57. package/cpp/leveldb/db/skiplist_test.cc +373 -0
  58. package/cpp/leveldb/db/snapshot.h +95 -0
  59. package/cpp/leveldb/db/table_cache.cc +120 -0
  60. package/cpp/leveldb/db/table_cache.h +57 -0
  61. package/cpp/leveldb/db/version_edit.cc +257 -0
  62. package/cpp/leveldb/db/version_edit.h +106 -0
  63. package/cpp/leveldb/db/version_edit_test.cc +46 -0
  64. package/cpp/leveldb/db/version_set.cc +1562 -0
  65. package/cpp/leveldb/db/version_set.h +393 -0
  66. package/cpp/leveldb/db/version_set_test.cc +336 -0
  67. package/cpp/leveldb/db/write_batch.cc +150 -0
  68. package/cpp/leveldb/db/write_batch_internal.h +45 -0
  69. package/cpp/leveldb/db/write_batch_test.cc +137 -0
  70. package/cpp/leveldb/doc/benchmark.html +459 -0
  71. package/cpp/leveldb/doc/impl.md +172 -0
  72. package/cpp/leveldb/doc/index.md +523 -0
  73. package/cpp/leveldb/doc/log_format.md +75 -0
  74. package/cpp/leveldb/doc/table_format.md +107 -0
  75. package/cpp/leveldb/helpers/memenv/memenv.cc +390 -0
  76. package/cpp/leveldb/helpers/memenv/memenv.h +22 -0
  77. package/cpp/leveldb/helpers/memenv/memenv_test.cc +264 -0
  78. package/cpp/leveldb/include/leveldb/c.h +270 -0
  79. package/cpp/leveldb/include/leveldb/cache.h +111 -0
  80. package/cpp/leveldb/include/leveldb/comparator.h +64 -0
  81. package/cpp/leveldb/include/leveldb/db.h +167 -0
  82. package/cpp/leveldb/include/leveldb/dumpfile.h +28 -0
  83. package/cpp/leveldb/include/leveldb/env.h +417 -0
  84. package/cpp/leveldb/include/leveldb/export.h +33 -0
  85. package/cpp/leveldb/include/leveldb/filter_policy.h +72 -0
  86. package/cpp/leveldb/include/leveldb/iterator.h +112 -0
  87. package/cpp/leveldb/include/leveldb/options.h +187 -0
  88. package/cpp/leveldb/include/leveldb/slice.h +114 -0
  89. package/cpp/leveldb/include/leveldb/status.h +122 -0
  90. package/cpp/leveldb/include/leveldb/table.h +84 -0
  91. package/cpp/leveldb/include/leveldb/table_builder.h +93 -0
  92. package/cpp/leveldb/include/leveldb/write_batch.h +83 -0
  93. package/cpp/leveldb/issues/issue178_test.cc +90 -0
  94. package/cpp/leveldb/issues/issue200_test.cc +59 -0
  95. package/cpp/leveldb/issues/issue320_test.cc +131 -0
  96. package/cpp/leveldb/port/README.md +10 -0
  97. package/cpp/leveldb/port/port.h +19 -0
  98. package/cpp/leveldb/port/port_config.h.in +33 -0
  99. package/cpp/leveldb/port/port_example.h +100 -0
  100. package/cpp/leveldb/port/port_stdcxx.h +151 -0
  101. package/cpp/leveldb/port/thread_annotations.h +108 -0
  102. package/cpp/leveldb/table/block.cc +267 -0
  103. package/cpp/leveldb/table/block.h +44 -0
  104. package/cpp/leveldb/table/block_builder.cc +107 -0
  105. package/cpp/leveldb/table/block_builder.h +54 -0
  106. package/cpp/leveldb/table/filter_block.cc +106 -0
  107. package/cpp/leveldb/table/filter_block.h +68 -0
  108. package/cpp/leveldb/table/filter_block_test.cc +127 -0
  109. package/cpp/leveldb/table/format.cc +141 -0
  110. package/cpp/leveldb/table/format.h +99 -0
  111. package/cpp/leveldb/table/iterator.cc +76 -0
  112. package/cpp/leveldb/table/iterator_wrapper.h +92 -0
  113. package/cpp/leveldb/table/merger.cc +191 -0
  114. package/cpp/leveldb/table/merger.h +26 -0
  115. package/cpp/leveldb/table/table.cc +271 -0
  116. package/cpp/leveldb/table/table_builder.cc +265 -0
  117. package/cpp/leveldb/table/table_test.cc +834 -0
  118. package/cpp/leveldb/table/two_level_iterator.cc +171 -0
  119. package/cpp/leveldb/table/two_level_iterator.h +31 -0
  120. package/cpp/leveldb/third_party/benchmark/.clang-format +5 -0
  121. package/cpp/leveldb/third_party/benchmark/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
  122. package/cpp/leveldb/third_party/benchmark/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  123. package/cpp/leveldb/third_party/benchmark/.github/workflows/build-and-test.yml +38 -0
  124. package/cpp/leveldb/third_party/benchmark/.github/workflows/pylint.yml +26 -0
  125. package/cpp/leveldb/third_party/benchmark/.github/workflows/test_bindings.yml +24 -0
  126. package/cpp/leveldb/third_party/benchmark/.travis-libcxx-setup.sh +28 -0
  127. package/cpp/leveldb/third_party/benchmark/.travis.yml +231 -0
  128. package/cpp/leveldb/third_party/benchmark/.ycm_extra_conf.py +115 -0
  129. package/cpp/leveldb/third_party/benchmark/AUTHORS +58 -0
  130. package/cpp/leveldb/third_party/benchmark/BUILD.bazel +44 -0
  131. package/cpp/leveldb/third_party/benchmark/CMakeLists.txt +287 -0
  132. package/cpp/leveldb/third_party/benchmark/CONTRIBUTING.md +58 -0
  133. package/cpp/leveldb/third_party/benchmark/CONTRIBUTORS +83 -0
  134. package/cpp/leveldb/third_party/benchmark/LICENSE +202 -0
  135. package/cpp/leveldb/third_party/benchmark/README.md +1323 -0
  136. package/cpp/leveldb/third_party/benchmark/WORKSPACE +51 -0
  137. package/cpp/leveldb/third_party/benchmark/_config.yml +1 -0
  138. package/cpp/leveldb/third_party/benchmark/appveyor.yml +50 -0
  139. package/cpp/leveldb/third_party/benchmark/bindings/python/BUILD +3 -0
  140. package/cpp/leveldb/third_party/benchmark/bindings/python/build_defs.bzl +25 -0
  141. package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/BUILD +38 -0
  142. package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/__init__.py +156 -0
  143. package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/benchmark.cc +180 -0
  144. package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/example.py +136 -0
  145. package/cpp/leveldb/third_party/benchmark/bindings/python/pybind11.BUILD +20 -0
  146. package/cpp/leveldb/third_party/benchmark/bindings/python/python_headers.BUILD +6 -0
  147. package/cpp/leveldb/third_party/benchmark/bindings/python/requirements.txt +2 -0
  148. package/cpp/leveldb/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake +74 -0
  149. package/cpp/leveldb/third_party/benchmark/cmake/CXXFeatureCheck.cmake +69 -0
  150. package/cpp/leveldb/third_party/benchmark/cmake/Config.cmake.in +1 -0
  151. package/cpp/leveldb/third_party/benchmark/cmake/GetGitVersion.cmake +54 -0
  152. package/cpp/leveldb/third_party/benchmark/cmake/GoogleTest.cmake +41 -0
  153. package/cpp/leveldb/third_party/benchmark/cmake/GoogleTest.cmake.in +58 -0
  154. package/cpp/leveldb/third_party/benchmark/cmake/benchmark.pc.in +12 -0
  155. package/cpp/leveldb/third_party/benchmark/cmake/gnu_posix_regex.cpp +12 -0
  156. package/cpp/leveldb/third_party/benchmark/cmake/llvm-toolchain.cmake +8 -0
  157. package/cpp/leveldb/third_party/benchmark/cmake/posix_regex.cpp +14 -0
  158. package/cpp/leveldb/third_party/benchmark/cmake/split_list.cmake +3 -0
  159. package/cpp/leveldb/third_party/benchmark/cmake/std_regex.cpp +10 -0
  160. package/cpp/leveldb/third_party/benchmark/cmake/steady_clock.cpp +7 -0
  161. package/cpp/leveldb/third_party/benchmark/cmake/thread_safety_attributes.cpp +4 -0
  162. package/cpp/leveldb/third_party/benchmark/conan/CMakeLists.txt +7 -0
  163. package/cpp/leveldb/third_party/benchmark/conan/test_package/CMakeLists.txt +10 -0
  164. package/cpp/leveldb/third_party/benchmark/conan/test_package/conanfile.py +19 -0
  165. package/cpp/leveldb/third_party/benchmark/conan/test_package/test_package.cpp +18 -0
  166. package/cpp/leveldb/third_party/benchmark/conanfile.py +79 -0
  167. package/cpp/leveldb/third_party/benchmark/dependencies.md +18 -0
  168. package/cpp/leveldb/third_party/benchmark/docs/AssemblyTests.md +147 -0
  169. package/cpp/leveldb/third_party/benchmark/docs/_config.yml +1 -0
  170. package/cpp/leveldb/third_party/benchmark/docs/releasing.md +16 -0
  171. package/cpp/leveldb/third_party/benchmark/docs/tools.md +203 -0
  172. package/cpp/leveldb/third_party/benchmark/include/benchmark/benchmark.h +1604 -0
  173. package/cpp/leveldb/third_party/benchmark/requirements.txt +2 -0
  174. package/cpp/leveldb/third_party/benchmark/setup.py +140 -0
  175. package/cpp/leveldb/third_party/benchmark/src/CMakeLists.txt +114 -0
  176. package/cpp/leveldb/third_party/benchmark/src/arraysize.h +33 -0
  177. package/cpp/leveldb/third_party/benchmark/src/benchmark.cc +499 -0
  178. package/cpp/leveldb/third_party/benchmark/src/benchmark_api_internal.cc +15 -0
  179. package/cpp/leveldb/third_party/benchmark/src/benchmark_api_internal.h +53 -0
  180. package/cpp/leveldb/third_party/benchmark/src/benchmark_main.cc +17 -0
  181. package/cpp/leveldb/third_party/benchmark/src/benchmark_name.cc +58 -0
  182. package/cpp/leveldb/third_party/benchmark/src/benchmark_register.cc +515 -0
  183. package/cpp/leveldb/third_party/benchmark/src/benchmark_register.h +108 -0
  184. package/cpp/leveldb/third_party/benchmark/src/benchmark_runner.cc +362 -0
  185. package/cpp/leveldb/third_party/benchmark/src/benchmark_runner.h +51 -0
  186. package/cpp/leveldb/third_party/benchmark/src/check.h +82 -0
  187. package/cpp/leveldb/third_party/benchmark/src/colorprint.cc +188 -0
  188. package/cpp/leveldb/third_party/benchmark/src/colorprint.h +33 -0
  189. package/cpp/leveldb/third_party/benchmark/src/commandlineflags.cc +228 -0
  190. package/cpp/leveldb/third_party/benchmark/src/commandlineflags.h +103 -0
  191. package/cpp/leveldb/third_party/benchmark/src/complexity.cc +238 -0
  192. package/cpp/leveldb/third_party/benchmark/src/complexity.h +55 -0
  193. package/cpp/leveldb/third_party/benchmark/src/console_reporter.cc +177 -0
  194. package/cpp/leveldb/third_party/benchmark/src/counter.cc +80 -0
  195. package/cpp/leveldb/third_party/benchmark/src/counter.h +32 -0
  196. package/cpp/leveldb/third_party/benchmark/src/csv_reporter.cc +154 -0
  197. package/cpp/leveldb/third_party/benchmark/src/cycleclock.h +211 -0
  198. package/cpp/leveldb/third_party/benchmark/src/internal_macros.h +102 -0
  199. package/cpp/leveldb/third_party/benchmark/src/json_reporter.cc +255 -0
  200. package/cpp/leveldb/third_party/benchmark/src/log.h +74 -0
  201. package/cpp/leveldb/third_party/benchmark/src/mutex.h +155 -0
  202. package/cpp/leveldb/third_party/benchmark/src/re.h +158 -0
  203. package/cpp/leveldb/third_party/benchmark/src/reporter.cc +105 -0
  204. package/cpp/leveldb/third_party/benchmark/src/sleep.cc +67 -0
  205. package/cpp/leveldb/third_party/benchmark/src/sleep.h +15 -0
  206. package/cpp/leveldb/third_party/benchmark/src/statistics.cc +193 -0
  207. package/cpp/leveldb/third_party/benchmark/src/statistics.h +37 -0
  208. package/cpp/leveldb/third_party/benchmark/src/string_util.cc +255 -0
  209. package/cpp/leveldb/third_party/benchmark/src/string_util.h +59 -0
  210. package/cpp/leveldb/third_party/benchmark/src/sysinfo.cc +716 -0
  211. package/cpp/leveldb/third_party/benchmark/src/thread_manager.h +64 -0
  212. package/cpp/leveldb/third_party/benchmark/src/thread_timer.h +86 -0
  213. package/cpp/leveldb/third_party/benchmark/src/timers.cc +245 -0
  214. package/cpp/leveldb/third_party/benchmark/src/timers.h +48 -0
  215. package/cpp/leveldb/third_party/benchmark/test/AssemblyTests.cmake +46 -0
  216. package/cpp/leveldb/third_party/benchmark/test/BUILD +73 -0
  217. package/cpp/leveldb/third_party/benchmark/test/CMakeLists.txt +263 -0
  218. package/cpp/leveldb/third_party/benchmark/test/args_product_test.cc +77 -0
  219. package/cpp/leveldb/third_party/benchmark/test/basic_test.cc +136 -0
  220. package/cpp/leveldb/third_party/benchmark/test/benchmark_gtest.cc +134 -0
  221. package/cpp/leveldb/third_party/benchmark/test/benchmark_name_gtest.cc +74 -0
  222. package/cpp/leveldb/third_party/benchmark/test/benchmark_test.cc +245 -0
  223. package/cpp/leveldb/third_party/benchmark/test/clobber_memory_assembly_test.cc +64 -0
  224. package/cpp/leveldb/third_party/benchmark/test/commandlineflags_gtest.cc +201 -0
  225. package/cpp/leveldb/third_party/benchmark/test/complexity_test.cc +213 -0
  226. package/cpp/leveldb/third_party/benchmark/test/cxx03_test.cc +63 -0
  227. package/cpp/leveldb/third_party/benchmark/test/diagnostics_test.cc +80 -0
  228. package/cpp/leveldb/third_party/benchmark/test/display_aggregates_only_test.cc +43 -0
  229. package/cpp/leveldb/third_party/benchmark/test/donotoptimize_assembly_test.cc +163 -0
  230. package/cpp/leveldb/third_party/benchmark/test/donotoptimize_test.cc +52 -0
  231. package/cpp/leveldb/third_party/benchmark/test/filter_test.cc +104 -0
  232. package/cpp/leveldb/third_party/benchmark/test/fixture_test.cc +51 -0
  233. package/cpp/leveldb/third_party/benchmark/test/internal_threading_test.cc +184 -0
  234. package/cpp/leveldb/third_party/benchmark/test/link_main_test.cc +8 -0
  235. package/cpp/leveldb/third_party/benchmark/test/map_test.cc +57 -0
  236. package/cpp/leveldb/third_party/benchmark/test/memory_manager_test.cc +44 -0
  237. package/cpp/leveldb/third_party/benchmark/test/multiple_ranges_test.cc +96 -0
  238. package/cpp/leveldb/third_party/benchmark/test/options_test.cc +75 -0
  239. package/cpp/leveldb/third_party/benchmark/test/output_test.h +213 -0
  240. package/cpp/leveldb/third_party/benchmark/test/output_test_helper.cc +515 -0
  241. package/cpp/leveldb/third_party/benchmark/test/register_benchmark_test.cc +184 -0
  242. package/cpp/leveldb/third_party/benchmark/test/report_aggregates_only_test.cc +39 -0
  243. package/cpp/leveldb/third_party/benchmark/test/reporter_output_test.cc +747 -0
  244. package/cpp/leveldb/third_party/benchmark/test/skip_with_error_test.cc +195 -0
  245. package/cpp/leveldb/third_party/benchmark/test/state_assembly_test.cc +68 -0
  246. package/cpp/leveldb/third_party/benchmark/test/statistics_gtest.cc +28 -0
  247. package/cpp/leveldb/third_party/benchmark/test/string_util_gtest.cc +153 -0
  248. package/cpp/leveldb/third_party/benchmark/test/templated_fixture_test.cc +28 -0
  249. package/cpp/leveldb/third_party/benchmark/test/user_counters_tabular_test.cc +285 -0
  250. package/cpp/leveldb/third_party/benchmark/test/user_counters_test.cc +531 -0
  251. package/cpp/leveldb/third_party/benchmark/test/user_counters_thousands_test.cc +173 -0
  252. package/cpp/leveldb/third_party/benchmark/tools/BUILD.bazel +19 -0
  253. package/cpp/leveldb/third_party/benchmark/tools/compare.py +429 -0
  254. package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test1_run1.json +119 -0
  255. package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test1_run2.json +119 -0
  256. package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test2_run.json +81 -0
  257. package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test3_run0.json +65 -0
  258. package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test3_run1.json +65 -0
  259. package/cpp/leveldb/third_party/benchmark/tools/gbench/__init__.py +8 -0
  260. package/cpp/leveldb/third_party/benchmark/tools/gbench/report.py +903 -0
  261. package/cpp/leveldb/third_party/benchmark/tools/gbench/util.py +163 -0
  262. package/cpp/leveldb/third_party/benchmark/tools/requirements.txt +1 -0
  263. package/cpp/leveldb/third_party/benchmark/tools/strip_asm.py +151 -0
  264. package/cpp/leveldb/third_party/googletest/.clang-format +4 -0
  265. package/cpp/leveldb/third_party/googletest/.travis.yml +73 -0
  266. package/cpp/leveldb/third_party/googletest/BUILD.bazel +179 -0
  267. package/cpp/leveldb/third_party/googletest/CMakeLists.txt +36 -0
  268. package/cpp/leveldb/third_party/googletest/CONTRIBUTING.md +142 -0
  269. package/cpp/leveldb/third_party/googletest/LICENSE +28 -0
  270. package/cpp/leveldb/third_party/googletest/README.md +132 -0
  271. package/cpp/leveldb/third_party/googletest/WORKSPACE +23 -0
  272. package/cpp/leveldb/third_party/googletest/appveyor.yml +154 -0
  273. package/cpp/leveldb/third_party/googletest/ci/build-linux-bazel.sh +37 -0
  274. package/cpp/leveldb/third_party/googletest/ci/build-platformio.sh +2 -0
  275. package/cpp/leveldb/third_party/googletest/ci/env-linux.sh +41 -0
  276. package/cpp/leveldb/third_party/googletest/ci/env-osx.sh +47 -0
  277. package/cpp/leveldb/third_party/googletest/ci/get-nprocessors.sh +48 -0
  278. package/cpp/leveldb/third_party/googletest/ci/install-linux.sh +49 -0
  279. package/cpp/leveldb/third_party/googletest/ci/install-osx.sh +40 -0
  280. package/cpp/leveldb/third_party/googletest/ci/install-platformio.sh +5 -0
  281. package/cpp/leveldb/third_party/googletest/ci/log-config.sh +51 -0
  282. package/cpp/leveldb/third_party/googletest/ci/travis.sh +44 -0
  283. package/cpp/leveldb/third_party/googletest/googlemock/CMakeLists.txt +233 -0
  284. package/cpp/leveldb/third_party/googletest/googlemock/CONTRIBUTORS +40 -0
  285. package/cpp/leveldb/third_party/googletest/googlemock/LICENSE +28 -0
  286. package/cpp/leveldb/third_party/googletest/googlemock/README.md +44 -0
  287. package/cpp/leveldb/third_party/googletest/googlemock/cmake/gmock.pc.in +10 -0
  288. package/cpp/leveldb/third_party/googletest/googlemock/cmake/gmock_main.pc.in +10 -0
  289. package/cpp/leveldb/third_party/googletest/googlemock/docs/cheat_sheet.md +770 -0
  290. package/cpp/leveldb/third_party/googletest/googlemock/docs/cook_book.md +4270 -0
  291. package/cpp/leveldb/third_party/googletest/googlemock/docs/for_dummies.md +700 -0
  292. package/cpp/leveldb/third_party/googletest/googlemock/docs/gmock_faq.md +396 -0
  293. package/cpp/leveldb/third_party/googletest/googlemock/docs/pump_manual.md +187 -0
  294. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-actions.h +1193 -0
  295. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-cardinalities.h +157 -0
  296. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-function-mocker.h +276 -0
  297. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-actions.h +1884 -0
  298. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-actions.h.pump +627 -0
  299. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h +752 -0
  300. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +227 -0
  301. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-matchers.h +1097 -0
  302. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-matchers.h.pump +346 -0
  303. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-matchers.h +4591 -0
  304. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-more-actions.h +162 -0
  305. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-more-matchers.h +92 -0
  306. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-nice-strict.h +215 -0
  307. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-spec-builders.h +1985 -0
  308. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock.h +101 -0
  309. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/README.md +16 -0
  310. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +10 -0
  311. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +12 -0
  312. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h +36 -0
  313. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-port.h +39 -0
  314. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h +472 -0
  315. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/gmock-port.h +87 -0
  316. package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/gmock-pp.h +271 -0
  317. package/cpp/leveldb/third_party/googletest/googlemock/scripts/README.md +5 -0
  318. package/cpp/leveldb/third_party/googletest/googlemock/scripts/fuse_gmock_files.py +240 -0
  319. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/LICENSE +203 -0
  320. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/README +34 -0
  321. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/README.cppclean +115 -0
  322. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/__init__.py +0 -0
  323. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/ast.py +1761 -0
  324. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/gmock_class.py +248 -0
  325. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/gmock_class_test.py +540 -0
  326. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/keywords.py +56 -0
  327. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/tokenize.py +284 -0
  328. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/utils.py +37 -0
  329. package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/gmock_gen.py +30 -0
  330. package/cpp/leveldb/third_party/googletest/googlemock/scripts/pump.py +856 -0
  331. package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-all.cc +46 -0
  332. package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-cardinalities.cc +155 -0
  333. package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-internal-utils.cc +200 -0
  334. package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-matchers.cc +462 -0
  335. package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-spec-builders.cc +892 -0
  336. package/cpp/leveldb/third_party/googletest/googlemock/src/gmock.cc +213 -0
  337. package/cpp/leveldb/third_party/googletest/googlemock/src/gmock_main.cc +72 -0
  338. package/cpp/leveldb/third_party/googletest/googlemock/test/BUILD.bazel +110 -0
  339. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-actions_test.cc +1507 -0
  340. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-cardinalities_test.cc +429 -0
  341. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-function-mocker_nc.cc +16 -0
  342. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-function-mocker_nc_test.py +43 -0
  343. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-function-mocker_test.cc +696 -0
  344. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-generated-actions_test.cc +1064 -0
  345. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-generated-function-mockers_test.cc +659 -0
  346. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-generated-matchers_test.cc +1323 -0
  347. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-internal-utils_test.cc +732 -0
  348. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-matchers_test.cc +6913 -0
  349. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-more-actions_test.cc +698 -0
  350. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-nice-strict_test.cc +500 -0
  351. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-port_test.cc +42 -0
  352. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-pp-string_test.cc +206 -0
  353. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-pp_test.cc +83 -0
  354. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-spec-builders_test.cc +2775 -0
  355. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_all_test.cc +49 -0
  356. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_ex_test.cc +80 -0
  357. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_leak_test.py +104 -0
  358. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_leak_test_.cc +99 -0
  359. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_link2_test.cc +39 -0
  360. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_link_test.cc +39 -0
  361. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_link_test.h +690 -0
  362. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_output_test.py +183 -0
  363. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_output_test_.cc +309 -0
  364. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_output_test_golden.txt +317 -0
  365. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_stress_test.cc +240 -0
  366. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_test.cc +181 -0
  367. package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_test_utils.py +108 -0
  368. package/cpp/leveldb/third_party/googletest/googlemock/test/pump_test.py +182 -0
  369. package/cpp/leveldb/third_party/googletest/googletest/CMakeLists.txt +329 -0
  370. package/cpp/leveldb/third_party/googletest/googletest/CONTRIBUTORS +38 -0
  371. package/cpp/leveldb/third_party/googletest/googletest/LICENSE +28 -0
  372. package/cpp/leveldb/third_party/googletest/googletest/README.md +244 -0
  373. package/cpp/leveldb/third_party/googletest/googletest/cmake/Config.cmake.in +9 -0
  374. package/cpp/leveldb/third_party/googletest/googletest/cmake/gtest.pc.in +9 -0
  375. package/cpp/leveldb/third_party/googletest/googletest/cmake/gtest_main.pc.in +10 -0
  376. package/cpp/leveldb/third_party/googletest/googletest/cmake/internal_utils.cmake +358 -0
  377. package/cpp/leveldb/third_party/googletest/googletest/cmake/libgtest.la.in +21 -0
  378. package/cpp/leveldb/third_party/googletest/googletest/docs/advanced.md +2567 -0
  379. package/cpp/leveldb/third_party/googletest/googletest/docs/faq.md +753 -0
  380. package/cpp/leveldb/third_party/googletest/googletest/docs/pkgconfig.md +219 -0
  381. package/cpp/leveldb/third_party/googletest/googletest/docs/primer.md +579 -0
  382. package/cpp/leveldb/third_party/googletest/googletest/docs/samples.md +22 -0
  383. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-death-test.h +343 -0
  384. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-matchers.h +750 -0
  385. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-message.h +219 -0
  386. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-param-test.h +514 -0
  387. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-printers.h +928 -0
  388. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-spi.h +238 -0
  389. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-test-part.h +184 -0
  390. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-typed-test.h +337 -0
  391. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest.h +2477 -0
  392. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest_pred_impl.h +359 -0
  393. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest_prod.h +61 -0
  394. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/README.md +56 -0
  395. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/gtest-port.h +37 -0
  396. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/gtest-printers.h +42 -0
  397. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/gtest.h +37 -0
  398. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h +304 -0
  399. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-filepath.h +211 -0
  400. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-internal.h +1411 -0
  401. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-param-util.h +880 -0
  402. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-port-arch.h +111 -0
  403. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-port.h +2227 -0
  404. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-string.h +171 -0
  405. package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-type-util.h +183 -0
  406. package/cpp/leveldb/third_party/googletest/googletest/samples/prime_tables.h +126 -0
  407. package/cpp/leveldb/third_party/googletest/googletest/samples/sample1.cc +66 -0
  408. package/cpp/leveldb/third_party/googletest/googletest/samples/sample1.h +41 -0
  409. package/cpp/leveldb/third_party/googletest/googletest/samples/sample10_unittest.cc +139 -0
  410. package/cpp/leveldb/third_party/googletest/googletest/samples/sample1_unittest.cc +151 -0
  411. package/cpp/leveldb/third_party/googletest/googletest/samples/sample2.cc +54 -0
  412. package/cpp/leveldb/third_party/googletest/googletest/samples/sample2.h +81 -0
  413. package/cpp/leveldb/third_party/googletest/googletest/samples/sample2_unittest.cc +107 -0
  414. package/cpp/leveldb/third_party/googletest/googletest/samples/sample3-inl.h +172 -0
  415. package/cpp/leveldb/third_party/googletest/googletest/samples/sample3_unittest.cc +149 -0
  416. package/cpp/leveldb/third_party/googletest/googletest/samples/sample4.cc +54 -0
  417. package/cpp/leveldb/third_party/googletest/googletest/samples/sample4.h +53 -0
  418. package/cpp/leveldb/third_party/googletest/googletest/samples/sample4_unittest.cc +53 -0
  419. package/cpp/leveldb/third_party/googletest/googletest/samples/sample5_unittest.cc +196 -0
  420. package/cpp/leveldb/third_party/googletest/googletest/samples/sample6_unittest.cc +224 -0
  421. package/cpp/leveldb/third_party/googletest/googletest/samples/sample7_unittest.cc +117 -0
  422. package/cpp/leveldb/third_party/googletest/googletest/samples/sample8_unittest.cc +154 -0
  423. package/cpp/leveldb/third_party/googletest/googletest/samples/sample9_unittest.cc +156 -0
  424. package/cpp/leveldb/third_party/googletest/googletest/scripts/README.md +5 -0
  425. package/cpp/leveldb/third_party/googletest/googletest/scripts/common.py +83 -0
  426. package/cpp/leveldb/third_party/googletest/googletest/scripts/fuse_gtest_files.py +253 -0
  427. package/cpp/leveldb/third_party/googletest/googletest/scripts/gen_gtest_pred_impl.py +734 -0
  428. package/cpp/leveldb/third_party/googletest/googletest/scripts/gtest-config.in +274 -0
  429. package/cpp/leveldb/third_party/googletest/googletest/scripts/release_docs.py +158 -0
  430. package/cpp/leveldb/third_party/googletest/googletest/scripts/run_with_path.py +32 -0
  431. package/cpp/leveldb/third_party/googletest/googletest/scripts/upload.py +1402 -0
  432. package/cpp/leveldb/third_party/googletest/googletest/scripts/upload_gtest.py +78 -0
  433. package/cpp/leveldb/third_party/googletest/googletest/src/gtest-all.cc +48 -0
  434. package/cpp/leveldb/third_party/googletest/googletest/src/gtest-death-test.cc +1653 -0
  435. package/cpp/leveldb/third_party/googletest/googletest/src/gtest-filepath.cc +382 -0
  436. package/cpp/leveldb/third_party/googletest/googletest/src/gtest-internal-inl.h +1211 -0
  437. package/cpp/leveldb/third_party/googletest/googletest/src/gtest-matchers.cc +97 -0
  438. package/cpp/leveldb/third_party/googletest/googletest/src/gtest-port.cc +1399 -0
  439. package/cpp/leveldb/third_party/googletest/googletest/src/gtest-printers.cc +442 -0
  440. package/cpp/leveldb/third_party/googletest/googletest/src/gtest-test-part.cc +108 -0
  441. package/cpp/leveldb/third_party/googletest/googletest/src/gtest-typed-test.cc +118 -0
  442. package/cpp/leveldb/third_party/googletest/googletest/src/gtest.cc +6180 -0
  443. package/cpp/leveldb/third_party/googletest/googletest/src/gtest_main.cc +54 -0
  444. package/cpp/leveldb/third_party/googletest/googletest/test/BUILD.bazel +529 -0
  445. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-break-on-failure-unittest.py +208 -0
  446. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-break-on-failure-unittest_.cc +86 -0
  447. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-catch-exceptions-test.py +236 -0
  448. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-catch-exceptions-test_.cc +293 -0
  449. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-color-test.py +127 -0
  450. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-color-test_.cc +62 -0
  451. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-death-test-test.cc +1516 -0
  452. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-death-test_ex_test.cc +92 -0
  453. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-env-var-test.py +117 -0
  454. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-env-var-test_.cc +122 -0
  455. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-filepath-test.cc +649 -0
  456. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-filter-unittest.py +639 -0
  457. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-filter-unittest_.cc +137 -0
  458. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-json-outfiles-test.py +191 -0
  459. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-json-output-unittest.py +778 -0
  460. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-list-tests-unittest.py +205 -0
  461. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-list-tests-unittest_.cc +156 -0
  462. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-listener-test.cc +518 -0
  463. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-message-test.cc +158 -0
  464. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-options-test.cc +216 -0
  465. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-output-test-golden-lin.txt +1137 -0
  466. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-output-test.py +346 -0
  467. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-output-test_.cc +1149 -0
  468. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name1-test.py +63 -0
  469. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name1-test_.cc +50 -0
  470. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name2-test.py +62 -0
  471. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name2-test_.cc +55 -0
  472. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-test.cc +1086 -0
  473. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-test.h +51 -0
  474. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test2-test.cc +61 -0
  475. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-port-test.cc +1272 -0
  476. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-printers-test.cc +1619 -0
  477. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-shuffle-test.py +323 -0
  478. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-shuffle-test_.cc +101 -0
  479. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-test-part-test.cc +230 -0
  480. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-test2_test.cc +61 -0
  481. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-throw-on-failure-test.py +168 -0
  482. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-throw-on-failure-test_.cc +71 -0
  483. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-uninitialized-test.py +67 -0
  484. package/cpp/leveldb/third_party/googletest/googletest/test/googletest-uninitialized-test_.cc +42 -0
  485. package/cpp/leveldb/third_party/googletest/googletest/test/gtest-typed-test2_test.cc +44 -0
  486. package/cpp/leveldb/third_party/googletest/googletest/test/gtest-typed-test_test.cc +462 -0
  487. package/cpp/leveldb/third_party/googletest/googletest/test/gtest-typed-test_test.h +65 -0
  488. package/cpp/leveldb/third_party/googletest/googletest/test/gtest-unittest-api_test.cc +341 -0
  489. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_all_test.cc +46 -0
  490. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_assert_by_exception_test.cc +116 -0
  491. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_environment_test.cc +188 -0
  492. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_help_test.py +170 -0
  493. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_help_test_.cc +45 -0
  494. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_json_test_utils.py +60 -0
  495. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_list_output_unittest.py +141 -0
  496. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_list_output_unittest_.cc +51 -0
  497. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_main_unittest.cc +44 -0
  498. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_no_test_unittest.cc +54 -0
  499. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_pred_impl_unittest.cc +2427 -0
  500. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_premature_exit_test.cc +126 -0
  501. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_prod_test.cc +56 -0
  502. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_repeat_test.cc +233 -0
  503. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_check_output_test.py +59 -0
  504. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_environment_check_output_test.py +54 -0
  505. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc +49 -0
  506. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_test.cc +55 -0
  507. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_sole_header_test.cc +56 -0
  508. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_stress_test.cc +248 -0
  509. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_test_macro_stack_footprint_test.cc +89 -0
  510. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_test_utils.py +314 -0
  511. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_testbridge_test.py +63 -0
  512. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_testbridge_test_.cc +43 -0
  513. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_throw_on_failure_ex_test.cc +90 -0
  514. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_unittest.cc +7496 -0
  515. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_outfile1_test_.cc +43 -0
  516. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_outfile2_test_.cc +43 -0
  517. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_outfiles_test.py +135 -0
  518. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_output_unittest.py +389 -0
  519. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_output_unittest_.cc +188 -0
  520. package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_test_utils.py +196 -0
  521. package/cpp/leveldb/third_party/googletest/googletest/test/production.cc +35 -0
  522. package/cpp/leveldb/third_party/googletest/googletest/test/production.h +54 -0
  523. package/cpp/leveldb/third_party/googletest/library.json +66 -0
  524. package/cpp/leveldb/third_party/googletest/platformio.ini +47 -0
  525. package/cpp/leveldb/util/arena.cc +66 -0
  526. package/cpp/leveldb/util/arena.h +71 -0
  527. package/cpp/leveldb/util/arena_test.cc +66 -0
  528. package/cpp/leveldb/util/bloom.cc +92 -0
  529. package/cpp/leveldb/util/bloom_test.cc +159 -0
  530. package/cpp/leveldb/util/cache.cc +401 -0
  531. package/cpp/leveldb/util/cache_test.cc +229 -0
  532. package/cpp/leveldb/util/coding.cc +166 -0
  533. package/cpp/leveldb/util/coding.h +122 -0
  534. package/cpp/leveldb/util/coding_test.cc +198 -0
  535. package/cpp/leveldb/util/comparator.cc +75 -0
  536. package/cpp/leveldb/util/crc32c.cc +380 -0
  537. package/cpp/leveldb/util/crc32c.h +43 -0
  538. package/cpp/leveldb/util/crc32c_test.cc +61 -0
  539. package/cpp/leveldb/util/env.cc +108 -0
  540. package/cpp/leveldb/util/env_posix.cc +893 -0
  541. package/cpp/leveldb/util/env_posix_test.cc +353 -0
  542. package/cpp/leveldb/util/env_posix_test_helper.h +28 -0
  543. package/cpp/leveldb/util/env_test.cc +240 -0
  544. package/cpp/leveldb/util/env_windows.cc +796 -0
  545. package/cpp/leveldb/util/env_windows_test.cc +65 -0
  546. package/cpp/leveldb/util/env_windows_test_helper.h +25 -0
  547. package/cpp/leveldb/util/filter_policy.cc +11 -0
  548. package/cpp/leveldb/util/hash.cc +55 -0
  549. package/cpp/leveldb/util/hash.h +19 -0
  550. package/cpp/leveldb/util/hash_test.cc +46 -0
  551. package/cpp/leveldb/util/histogram.cc +272 -0
  552. package/cpp/leveldb/util/histogram.h +44 -0
  553. package/cpp/leveldb/util/logging.cc +82 -0
  554. package/cpp/leveldb/util/logging.h +44 -0
  555. package/cpp/leveldb/util/logging_test.cc +145 -0
  556. package/cpp/leveldb/util/mutexlock.h +39 -0
  557. package/cpp/leveldb/util/no_destructor.h +46 -0
  558. package/cpp/leveldb/util/no_destructor_test.cc +49 -0
  559. package/cpp/leveldb/util/options.cc +14 -0
  560. package/cpp/leveldb/util/posix_logger.h +130 -0
  561. package/cpp/leveldb/util/random.h +63 -0
  562. package/cpp/leveldb/util/status.cc +77 -0
  563. package/cpp/leveldb/util/status_test.cc +44 -0
  564. package/cpp/leveldb/util/testutil.cc +51 -0
  565. package/cpp/leveldb/util/testutil.h +82 -0
  566. package/cpp/leveldb/util/windows_logger.h +124 -0
  567. package/cpp/react-native-leveldb.cpp +694 -0
  568. package/cpp/react-native-leveldb.h +4 -0
  569. package/ios/Leveldb.h +9 -0
  570. package/ios/Leveldb.mm +35 -0
  571. package/ios/Leveldb.xcodeproj/project.pbxproj +288 -0
  572. package/lib/commonjs/fake.js +181 -0
  573. package/lib/commonjs/fake.js.map +1 -0
  574. package/lib/commonjs/fake.test.js +30 -0
  575. package/lib/commonjs/fake.test.js.map +1 -0
  576. package/lib/commonjs/index.js +172 -0
  577. package/lib/commonjs/index.js.map +1 -0
  578. package/lib/commonjs/package.json +1 -0
  579. package/lib/module/fake.js +171 -0
  580. package/lib/module/fake.js.map +1 -0
  581. package/lib/module/fake.test.js +30 -0
  582. package/lib/module/fake.test.js.map +1 -0
  583. package/lib/module/index.js +165 -0
  584. package/lib/module/index.js.map +1 -0
  585. package/lib/typescript/fake.d.ts +34 -0
  586. package/lib/typescript/fake.d.ts.map +1 -0
  587. package/lib/typescript/fake.test.d.ts +2 -0
  588. package/lib/typescript/fake.test.d.ts.map +1 -0
  589. package/lib/typescript/index.d.ts +72 -0
  590. package/lib/typescript/index.d.ts.map +1 -0
  591. package/package.json +157 -0
  592. package/rn-leveldb.podspec +30 -0
  593. package/src/fake.test.ts +37 -0
  594. package/src/fake.ts +203 -0
  595. package/src/index.ts +291 -0
@@ -0,0 +1,1211 @@
1
+ // Copyright 2005, 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
+ // Utility functions and classes used by the Google C++ testing framework.//
31
+ // This file contains purely Google Test's internal implementation. Please
32
+ // DO NOT #INCLUDE IT IN A USER PROGRAM.
33
+
34
+ #ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
35
+ #define GTEST_SRC_GTEST_INTERNAL_INL_H_
36
+
37
+ #ifndef _WIN32_WCE
38
+ # include <errno.h>
39
+ #endif // !_WIN32_WCE
40
+ #include <stddef.h>
41
+ #include <stdlib.h> // For strtoll/_strtoul64/malloc/free.
42
+ #include <string.h> // For memmove.
43
+
44
+ #include <algorithm>
45
+ #include <memory>
46
+ #include <string>
47
+ #include <vector>
48
+
49
+ #include "gtest/internal/gtest-port.h"
50
+
51
+ #if GTEST_CAN_STREAM_RESULTS_
52
+ # include <arpa/inet.h> // NOLINT
53
+ # include <netdb.h> // NOLINT
54
+ #endif
55
+
56
+ #if GTEST_OS_WINDOWS
57
+ # include <windows.h> // NOLINT
58
+ #endif // GTEST_OS_WINDOWS
59
+
60
+ #include "gtest/gtest.h"
61
+ #include "gtest/gtest-spi.h"
62
+
63
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
64
+ /* class A needs to have dll-interface to be used by clients of class B */)
65
+
66
+ namespace testing {
67
+
68
+ // Declares the flags.
69
+ //
70
+ // We don't want the users to modify this flag in the code, but want
71
+ // Google Test's own unit tests to be able to access it. Therefore we
72
+ // declare it here as opposed to in gtest.h.
73
+ GTEST_DECLARE_bool_(death_test_use_fork);
74
+
75
+ namespace internal {
76
+
77
+ // The value of GetTestTypeId() as seen from within the Google Test
78
+ // library. This is solely for testing GetTestTypeId().
79
+ GTEST_API_ extern const TypeId kTestTypeIdInGoogleTest;
80
+
81
+ // Names of the flags (needed for parsing Google Test flags).
82
+ const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
83
+ const char kBreakOnFailureFlag[] = "break_on_failure";
84
+ const char kCatchExceptionsFlag[] = "catch_exceptions";
85
+ const char kColorFlag[] = "color";
86
+ const char kFilterFlag[] = "filter";
87
+ const char kListTestsFlag[] = "list_tests";
88
+ const char kOutputFlag[] = "output";
89
+ const char kPrintTimeFlag[] = "print_time";
90
+ const char kPrintUTF8Flag[] = "print_utf8";
91
+ const char kRandomSeedFlag[] = "random_seed";
92
+ const char kRepeatFlag[] = "repeat";
93
+ const char kShuffleFlag[] = "shuffle";
94
+ const char kStackTraceDepthFlag[] = "stack_trace_depth";
95
+ const char kStreamResultToFlag[] = "stream_result_to";
96
+ const char kThrowOnFailureFlag[] = "throw_on_failure";
97
+ const char kFlagfileFlag[] = "flagfile";
98
+
99
+ // A valid random seed must be in [1, kMaxRandomSeed].
100
+ const int kMaxRandomSeed = 99999;
101
+
102
+ // g_help_flag is true if and only if the --help flag or an equivalent form
103
+ // is specified on the command line.
104
+ GTEST_API_ extern bool g_help_flag;
105
+
106
+ // Returns the current time in milliseconds.
107
+ GTEST_API_ TimeInMillis GetTimeInMillis();
108
+
109
+ // Returns true if and only if Google Test should use colors in the output.
110
+ GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
111
+
112
+ // Formats the given time in milliseconds as seconds.
113
+ GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);
114
+
115
+ // Converts the given time in milliseconds to a date string in the ISO 8601
116
+ // format, without the timezone information. N.B.: due to the use the
117
+ // non-reentrant localtime() function, this function is not thread safe. Do
118
+ // not use it in any code that can be called from multiple threads.
119
+ GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms);
120
+
121
+ // Parses a string for an Int32 flag, in the form of "--flag=value".
122
+ //
123
+ // On success, stores the value of the flag in *value, and returns
124
+ // true. On failure, returns false without changing *value.
125
+ GTEST_API_ bool ParseInt32Flag(
126
+ const char* str, const char* flag, Int32* value);
127
+
128
+ // Returns a random seed in range [1, kMaxRandomSeed] based on the
129
+ // given --gtest_random_seed flag value.
130
+ inline int GetRandomSeedFromFlag(Int32 random_seed_flag) {
131
+ const unsigned int raw_seed = (random_seed_flag == 0) ?
132
+ static_cast<unsigned int>(GetTimeInMillis()) :
133
+ static_cast<unsigned int>(random_seed_flag);
134
+
135
+ // Normalizes the actual seed to range [1, kMaxRandomSeed] such that
136
+ // it's easy to type.
137
+ const int normalized_seed =
138
+ static_cast<int>((raw_seed - 1U) %
139
+ static_cast<unsigned int>(kMaxRandomSeed)) + 1;
140
+ return normalized_seed;
141
+ }
142
+
143
+ // Returns the first valid random seed after 'seed'. The behavior is
144
+ // undefined if 'seed' is invalid. The seed after kMaxRandomSeed is
145
+ // considered to be 1.
146
+ inline int GetNextRandomSeed(int seed) {
147
+ GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed)
148
+ << "Invalid random seed " << seed << " - must be in [1, "
149
+ << kMaxRandomSeed << "].";
150
+ const int next_seed = seed + 1;
151
+ return (next_seed > kMaxRandomSeed) ? 1 : next_seed;
152
+ }
153
+
154
+ // This class saves the values of all Google Test flags in its c'tor, and
155
+ // restores them in its d'tor.
156
+ class GTestFlagSaver {
157
+ public:
158
+ // The c'tor.
159
+ GTestFlagSaver() {
160
+ also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
161
+ break_on_failure_ = GTEST_FLAG(break_on_failure);
162
+ catch_exceptions_ = GTEST_FLAG(catch_exceptions);
163
+ color_ = GTEST_FLAG(color);
164
+ death_test_style_ = GTEST_FLAG(death_test_style);
165
+ death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
166
+ filter_ = GTEST_FLAG(filter);
167
+ internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
168
+ list_tests_ = GTEST_FLAG(list_tests);
169
+ output_ = GTEST_FLAG(output);
170
+ print_time_ = GTEST_FLAG(print_time);
171
+ print_utf8_ = GTEST_FLAG(print_utf8);
172
+ random_seed_ = GTEST_FLAG(random_seed);
173
+ repeat_ = GTEST_FLAG(repeat);
174
+ shuffle_ = GTEST_FLAG(shuffle);
175
+ stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);
176
+ stream_result_to_ = GTEST_FLAG(stream_result_to);
177
+ throw_on_failure_ = GTEST_FLAG(throw_on_failure);
178
+ }
179
+
180
+ // The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS.
181
+ ~GTestFlagSaver() {
182
+ GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
183
+ GTEST_FLAG(break_on_failure) = break_on_failure_;
184
+ GTEST_FLAG(catch_exceptions) = catch_exceptions_;
185
+ GTEST_FLAG(color) = color_;
186
+ GTEST_FLAG(death_test_style) = death_test_style_;
187
+ GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
188
+ GTEST_FLAG(filter) = filter_;
189
+ GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
190
+ GTEST_FLAG(list_tests) = list_tests_;
191
+ GTEST_FLAG(output) = output_;
192
+ GTEST_FLAG(print_time) = print_time_;
193
+ GTEST_FLAG(print_utf8) = print_utf8_;
194
+ GTEST_FLAG(random_seed) = random_seed_;
195
+ GTEST_FLAG(repeat) = repeat_;
196
+ GTEST_FLAG(shuffle) = shuffle_;
197
+ GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;
198
+ GTEST_FLAG(stream_result_to) = stream_result_to_;
199
+ GTEST_FLAG(throw_on_failure) = throw_on_failure_;
200
+ }
201
+
202
+ private:
203
+ // Fields for saving the original values of flags.
204
+ bool also_run_disabled_tests_;
205
+ bool break_on_failure_;
206
+ bool catch_exceptions_;
207
+ std::string color_;
208
+ std::string death_test_style_;
209
+ bool death_test_use_fork_;
210
+ std::string filter_;
211
+ std::string internal_run_death_test_;
212
+ bool list_tests_;
213
+ std::string output_;
214
+ bool print_time_;
215
+ bool print_utf8_;
216
+ internal::Int32 random_seed_;
217
+ internal::Int32 repeat_;
218
+ bool shuffle_;
219
+ internal::Int32 stack_trace_depth_;
220
+ std::string stream_result_to_;
221
+ bool throw_on_failure_;
222
+ } GTEST_ATTRIBUTE_UNUSED_;
223
+
224
+ // Converts a Unicode code point to a narrow string in UTF-8 encoding.
225
+ // code_point parameter is of type UInt32 because wchar_t may not be
226
+ // wide enough to contain a code point.
227
+ // If the code_point is not a valid Unicode code point
228
+ // (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted
229
+ // to "(Invalid Unicode 0xXXXXXXXX)".
230
+ GTEST_API_ std::string CodePointToUtf8(UInt32 code_point);
231
+
232
+ // Converts a wide string to a narrow string in UTF-8 encoding.
233
+ // The wide string is assumed to have the following encoding:
234
+ // UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin)
235
+ // UTF-32 if sizeof(wchar_t) == 4 (on Linux)
236
+ // Parameter str points to a null-terminated wide string.
237
+ // Parameter num_chars may additionally limit the number
238
+ // of wchar_t characters processed. -1 is used when the entire string
239
+ // should be processed.
240
+ // If the string contains code points that are not valid Unicode code points
241
+ // (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
242
+ // as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
243
+ // and contains invalid UTF-16 surrogate pairs, values in those pairs
244
+ // will be encoded as individual Unicode characters from Basic Normal Plane.
245
+ GTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars);
246
+
247
+ // Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
248
+ // if the variable is present. If a file already exists at this location, this
249
+ // function will write over it. If the variable is present, but the file cannot
250
+ // be created, prints an error and exits.
251
+ void WriteToShardStatusFileIfNeeded();
252
+
253
+ // Checks whether sharding is enabled by examining the relevant
254
+ // environment variable values. If the variables are present,
255
+ // but inconsistent (e.g., shard_index >= total_shards), prints
256
+ // an error and exits. If in_subprocess_for_death_test, sharding is
257
+ // disabled because it must only be applied to the original test
258
+ // process. Otherwise, we could filter out death tests we intended to execute.
259
+ GTEST_API_ bool ShouldShard(const char* total_shards_str,
260
+ const char* shard_index_str,
261
+ bool in_subprocess_for_death_test);
262
+
263
+ // Parses the environment variable var as an Int32. If it is unset,
264
+ // returns default_val. If it is not an Int32, prints an error and
265
+ // and aborts.
266
+ GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
267
+
268
+ // Given the total number of shards, the shard index, and the test id,
269
+ // returns true if and only if the test should be run on this shard. The test id
270
+ // is some arbitrary but unique non-negative integer assigned to each test
271
+ // method. Assumes that 0 <= shard_index < total_shards.
272
+ GTEST_API_ bool ShouldRunTestOnShard(
273
+ int total_shards, int shard_index, int test_id);
274
+
275
+ // STL container utilities.
276
+
277
+ // Returns the number of elements in the given container that satisfy
278
+ // the given predicate.
279
+ template <class Container, typename Predicate>
280
+ inline int CountIf(const Container& c, Predicate predicate) {
281
+ // Implemented as an explicit loop since std::count_if() in libCstd on
282
+ // Solaris has a non-standard signature.
283
+ int count = 0;
284
+ for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) {
285
+ if (predicate(*it))
286
+ ++count;
287
+ }
288
+ return count;
289
+ }
290
+
291
+ // Applies a function/functor to each element in the container.
292
+ template <class Container, typename Functor>
293
+ void ForEach(const Container& c, Functor functor) {
294
+ std::for_each(c.begin(), c.end(), functor);
295
+ }
296
+
297
+ // Returns the i-th element of the vector, or default_value if i is not
298
+ // in range [0, v.size()).
299
+ template <typename E>
300
+ inline E GetElementOr(const std::vector<E>& v, int i, E default_value) {
301
+ return (i < 0 || i >= static_cast<int>(v.size())) ? default_value
302
+ : v[static_cast<size_t>(i)];
303
+ }
304
+
305
+ // Performs an in-place shuffle of a range of the vector's elements.
306
+ // 'begin' and 'end' are element indices as an STL-style range;
307
+ // i.e. [begin, end) are shuffled, where 'end' == size() means to
308
+ // shuffle to the end of the vector.
309
+ template <typename E>
310
+ void ShuffleRange(internal::Random* random, int begin, int end,
311
+ std::vector<E>* v) {
312
+ const int size = static_cast<int>(v->size());
313
+ GTEST_CHECK_(0 <= begin && begin <= size)
314
+ << "Invalid shuffle range start " << begin << ": must be in range [0, "
315
+ << size << "].";
316
+ GTEST_CHECK_(begin <= end && end <= size)
317
+ << "Invalid shuffle range finish " << end << ": must be in range ["
318
+ << begin << ", " << size << "].";
319
+
320
+ // Fisher-Yates shuffle, from
321
+ // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
322
+ for (int range_width = end - begin; range_width >= 2; range_width--) {
323
+ const int last_in_range = begin + range_width - 1;
324
+ const int selected =
325
+ begin +
326
+ static_cast<int>(random->Generate(static_cast<UInt32>(range_width)));
327
+ std::swap((*v)[static_cast<size_t>(selected)],
328
+ (*v)[static_cast<size_t>(last_in_range)]);
329
+ }
330
+ }
331
+
332
+ // Performs an in-place shuffle of the vector's elements.
333
+ template <typename E>
334
+ inline void Shuffle(internal::Random* random, std::vector<E>* v) {
335
+ ShuffleRange(random, 0, static_cast<int>(v->size()), v);
336
+ }
337
+
338
+ // A function for deleting an object. Handy for being used as a
339
+ // functor.
340
+ template <typename T>
341
+ static void Delete(T* x) {
342
+ delete x;
343
+ }
344
+
345
+ // A predicate that checks the key of a TestProperty against a known key.
346
+ //
347
+ // TestPropertyKeyIs is copyable.
348
+ class TestPropertyKeyIs {
349
+ public:
350
+ // Constructor.
351
+ //
352
+ // TestPropertyKeyIs has NO default constructor.
353
+ explicit TestPropertyKeyIs(const std::string& key) : key_(key) {}
354
+
355
+ // Returns true if and only if the test name of test property matches on key_.
356
+ bool operator()(const TestProperty& test_property) const {
357
+ return test_property.key() == key_;
358
+ }
359
+
360
+ private:
361
+ std::string key_;
362
+ };
363
+
364
+ // Class UnitTestOptions.
365
+ //
366
+ // This class contains functions for processing options the user
367
+ // specifies when running the tests. It has only static members.
368
+ //
369
+ // In most cases, the user can specify an option using either an
370
+ // environment variable or a command line flag. E.g. you can set the
371
+ // test filter using either GTEST_FILTER or --gtest_filter. If both
372
+ // the variable and the flag are present, the latter overrides the
373
+ // former.
374
+ class GTEST_API_ UnitTestOptions {
375
+ public:
376
+ // Functions for processing the gtest_output flag.
377
+
378
+ // Returns the output format, or "" for normal printed output.
379
+ static std::string GetOutputFormat();
380
+
381
+ // Returns the absolute path of the requested output file, or the
382
+ // default (test_detail.xml in the original working directory) if
383
+ // none was explicitly specified.
384
+ static std::string GetAbsolutePathToOutputFile();
385
+
386
+ // Functions for processing the gtest_filter flag.
387
+
388
+ // Returns true if and only if the wildcard pattern matches the string.
389
+ // The first ':' or '\0' character in pattern marks the end of it.
390
+ //
391
+ // This recursive algorithm isn't very efficient, but is clear and
392
+ // works well enough for matching test names, which are short.
393
+ static bool PatternMatchesString(const char *pattern, const char *str);
394
+
395
+ // Returns true if and only if the user-specified filter matches the test
396
+ // suite name and the test name.
397
+ static bool FilterMatchesTest(const std::string& test_suite_name,
398
+ const std::string& test_name);
399
+
400
+ #if GTEST_OS_WINDOWS
401
+ // Function for supporting the gtest_catch_exception flag.
402
+
403
+ // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
404
+ // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
405
+ // This function is useful as an __except condition.
406
+ static int GTestShouldProcessSEH(DWORD exception_code);
407
+ #endif // GTEST_OS_WINDOWS
408
+
409
+ // Returns true if "name" matches the ':' separated list of glob-style
410
+ // filters in "filter".
411
+ static bool MatchesFilter(const std::string& name, const char* filter);
412
+ };
413
+
414
+ // Returns the current application's name, removing directory path if that
415
+ // is present. Used by UnitTestOptions::GetOutputFile.
416
+ GTEST_API_ FilePath GetCurrentExecutableName();
417
+
418
+ // The role interface for getting the OS stack trace as a string.
419
+ class OsStackTraceGetterInterface {
420
+ public:
421
+ OsStackTraceGetterInterface() {}
422
+ virtual ~OsStackTraceGetterInterface() {}
423
+
424
+ // Returns the current OS stack trace as an std::string. Parameters:
425
+ //
426
+ // max_depth - the maximum number of stack frames to be included
427
+ // in the trace.
428
+ // skip_count - the number of top frames to be skipped; doesn't count
429
+ // against max_depth.
430
+ virtual std::string CurrentStackTrace(int max_depth, int skip_count) = 0;
431
+
432
+ // UponLeavingGTest() should be called immediately before Google Test calls
433
+ // user code. It saves some information about the current stack that
434
+ // CurrentStackTrace() will use to find and hide Google Test stack frames.
435
+ virtual void UponLeavingGTest() = 0;
436
+
437
+ // This string is inserted in place of stack frames that are part of
438
+ // Google Test's implementation.
439
+ static const char* const kElidedFramesMarker;
440
+
441
+ private:
442
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);
443
+ };
444
+
445
+ // A working implementation of the OsStackTraceGetterInterface interface.
446
+ class OsStackTraceGetter : public OsStackTraceGetterInterface {
447
+ public:
448
+ OsStackTraceGetter() {}
449
+
450
+ std::string CurrentStackTrace(int max_depth, int skip_count) override;
451
+ void UponLeavingGTest() override;
452
+
453
+ private:
454
+ #if GTEST_HAS_ABSL
455
+ Mutex mutex_; // Protects all internal state.
456
+
457
+ // We save the stack frame below the frame that calls user code.
458
+ // We do this because the address of the frame immediately below
459
+ // the user code changes between the call to UponLeavingGTest()
460
+ // and any calls to the stack trace code from within the user code.
461
+ void* caller_frame_ = nullptr;
462
+ #endif // GTEST_HAS_ABSL
463
+
464
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
465
+ };
466
+
467
+ // Information about a Google Test trace point.
468
+ struct TraceInfo {
469
+ const char* file;
470
+ int line;
471
+ std::string message;
472
+ };
473
+
474
+ // This is the default global test part result reporter used in UnitTestImpl.
475
+ // This class should only be used by UnitTestImpl.
476
+ class DefaultGlobalTestPartResultReporter
477
+ : public TestPartResultReporterInterface {
478
+ public:
479
+ explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
480
+ // Implements the TestPartResultReporterInterface. Reports the test part
481
+ // result in the current test.
482
+ void ReportTestPartResult(const TestPartResult& result) override;
483
+
484
+ private:
485
+ UnitTestImpl* const unit_test_;
486
+
487
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
488
+ };
489
+
490
+ // This is the default per thread test part result reporter used in
491
+ // UnitTestImpl. This class should only be used by UnitTestImpl.
492
+ class DefaultPerThreadTestPartResultReporter
493
+ : public TestPartResultReporterInterface {
494
+ public:
495
+ explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
496
+ // Implements the TestPartResultReporterInterface. The implementation just
497
+ // delegates to the current global test part result reporter of *unit_test_.
498
+ void ReportTestPartResult(const TestPartResult& result) override;
499
+
500
+ private:
501
+ UnitTestImpl* const unit_test_;
502
+
503
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
504
+ };
505
+
506
+ // The private implementation of the UnitTest class. We don't protect
507
+ // the methods under a mutex, as this class is not accessible by a
508
+ // user and the UnitTest class that delegates work to this class does
509
+ // proper locking.
510
+ class GTEST_API_ UnitTestImpl {
511
+ public:
512
+ explicit UnitTestImpl(UnitTest* parent);
513
+ virtual ~UnitTestImpl();
514
+
515
+ // There are two different ways to register your own TestPartResultReporter.
516
+ // You can register your own repoter to listen either only for test results
517
+ // from the current thread or for results from all threads.
518
+ // By default, each per-thread test result repoter just passes a new
519
+ // TestPartResult to the global test result reporter, which registers the
520
+ // test part result for the currently running test.
521
+
522
+ // Returns the global test part result reporter.
523
+ TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
524
+
525
+ // Sets the global test part result reporter.
526
+ void SetGlobalTestPartResultReporter(
527
+ TestPartResultReporterInterface* reporter);
528
+
529
+ // Returns the test part result reporter for the current thread.
530
+ TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
531
+
532
+ // Sets the test part result reporter for the current thread.
533
+ void SetTestPartResultReporterForCurrentThread(
534
+ TestPartResultReporterInterface* reporter);
535
+
536
+ // Gets the number of successful test suites.
537
+ int successful_test_suite_count() const;
538
+
539
+ // Gets the number of failed test suites.
540
+ int failed_test_suite_count() const;
541
+
542
+ // Gets the number of all test suites.
543
+ int total_test_suite_count() const;
544
+
545
+ // Gets the number of all test suites that contain at least one test
546
+ // that should run.
547
+ int test_suite_to_run_count() const;
548
+
549
+ // Gets the number of successful tests.
550
+ int successful_test_count() const;
551
+
552
+ // Gets the number of skipped tests.
553
+ int skipped_test_count() const;
554
+
555
+ // Gets the number of failed tests.
556
+ int failed_test_count() const;
557
+
558
+ // Gets the number of disabled tests that will be reported in the XML report.
559
+ int reportable_disabled_test_count() const;
560
+
561
+ // Gets the number of disabled tests.
562
+ int disabled_test_count() const;
563
+
564
+ // Gets the number of tests to be printed in the XML report.
565
+ int reportable_test_count() const;
566
+
567
+ // Gets the number of all tests.
568
+ int total_test_count() const;
569
+
570
+ // Gets the number of tests that should run.
571
+ int test_to_run_count() const;
572
+
573
+ // Gets the time of the test program start, in ms from the start of the
574
+ // UNIX epoch.
575
+ TimeInMillis start_timestamp() const { return start_timestamp_; }
576
+
577
+ // Gets the elapsed time, in milliseconds.
578
+ TimeInMillis elapsed_time() const { return elapsed_time_; }
579
+
580
+ // Returns true if and only if the unit test passed (i.e. all test suites
581
+ // passed).
582
+ bool Passed() const { return !Failed(); }
583
+
584
+ // Returns true if and only if the unit test failed (i.e. some test suite
585
+ // failed or something outside of all tests failed).
586
+ bool Failed() const {
587
+ return failed_test_suite_count() > 0 || ad_hoc_test_result()->Failed();
588
+ }
589
+
590
+ // Gets the i-th test suite among all the test suites. i can range from 0 to
591
+ // total_test_suite_count() - 1. If i is not in that range, returns NULL.
592
+ const TestSuite* GetTestSuite(int i) const {
593
+ const int index = GetElementOr(test_suite_indices_, i, -1);
594
+ return index < 0 ? nullptr : test_suites_[static_cast<size_t>(i)];
595
+ }
596
+
597
+ // Legacy API is deprecated but still available
598
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
599
+ const TestCase* GetTestCase(int i) const { return GetTestSuite(i); }
600
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
601
+
602
+ // Gets the i-th test suite among all the test suites. i can range from 0 to
603
+ // total_test_suite_count() - 1. If i is not in that range, returns NULL.
604
+ TestSuite* GetMutableSuiteCase(int i) {
605
+ const int index = GetElementOr(test_suite_indices_, i, -1);
606
+ return index < 0 ? nullptr : test_suites_[static_cast<size_t>(index)];
607
+ }
608
+
609
+ // Provides access to the event listener list.
610
+ TestEventListeners* listeners() { return &listeners_; }
611
+
612
+ // Returns the TestResult for the test that's currently running, or
613
+ // the TestResult for the ad hoc test if no test is running.
614
+ TestResult* current_test_result();
615
+
616
+ // Returns the TestResult for the ad hoc test.
617
+ const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }
618
+
619
+ // Sets the OS stack trace getter.
620
+ //
621
+ // Does nothing if the input and the current OS stack trace getter
622
+ // are the same; otherwise, deletes the old getter and makes the
623
+ // input the current getter.
624
+ void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter);
625
+
626
+ // Returns the current OS stack trace getter if it is not NULL;
627
+ // otherwise, creates an OsStackTraceGetter, makes it the current
628
+ // getter, and returns it.
629
+ OsStackTraceGetterInterface* os_stack_trace_getter();
630
+
631
+ // Returns the current OS stack trace as an std::string.
632
+ //
633
+ // The maximum number of stack frames to be included is specified by
634
+ // the gtest_stack_trace_depth flag. The skip_count parameter
635
+ // specifies the number of top frames to be skipped, which doesn't
636
+ // count against the number of frames to be included.
637
+ //
638
+ // For example, if Foo() calls Bar(), which in turn calls
639
+ // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
640
+ // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
641
+ std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_;
642
+
643
+ // Finds and returns a TestSuite with the given name. If one doesn't
644
+ // exist, creates one and returns it.
645
+ //
646
+ // Arguments:
647
+ //
648
+ // test_suite_name: name of the test suite
649
+ // type_param: the name of the test's type parameter, or NULL if
650
+ // this is not a typed or a type-parameterized test.
651
+ // set_up_tc: pointer to the function that sets up the test suite
652
+ // tear_down_tc: pointer to the function that tears down the test suite
653
+ TestSuite* GetTestSuite(const char* test_suite_name, const char* type_param,
654
+ internal::SetUpTestSuiteFunc set_up_tc,
655
+ internal::TearDownTestSuiteFunc tear_down_tc);
656
+
657
+ // Legacy API is deprecated but still available
658
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
659
+ TestCase* GetTestCase(const char* test_case_name, const char* type_param,
660
+ internal::SetUpTestSuiteFunc set_up_tc,
661
+ internal::TearDownTestSuiteFunc tear_down_tc) {
662
+ return GetTestSuite(test_case_name, type_param, set_up_tc, tear_down_tc);
663
+ }
664
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
665
+
666
+ // Adds a TestInfo to the unit test.
667
+ //
668
+ // Arguments:
669
+ //
670
+ // set_up_tc: pointer to the function that sets up the test suite
671
+ // tear_down_tc: pointer to the function that tears down the test suite
672
+ // test_info: the TestInfo object
673
+ void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc,
674
+ internal::TearDownTestSuiteFunc tear_down_tc,
675
+ TestInfo* test_info) {
676
+ // In order to support thread-safe death tests, we need to
677
+ // remember the original working directory when the test program
678
+ // was first invoked. We cannot do this in RUN_ALL_TESTS(), as
679
+ // the user may have changed the current directory before calling
680
+ // RUN_ALL_TESTS(). Therefore we capture the current directory in
681
+ // AddTestInfo(), which is called to register a TEST or TEST_F
682
+ // before main() is reached.
683
+ if (original_working_dir_.IsEmpty()) {
684
+ original_working_dir_.Set(FilePath::GetCurrentDir());
685
+ GTEST_CHECK_(!original_working_dir_.IsEmpty())
686
+ << "Failed to get the current working directory.";
687
+ }
688
+
689
+ GetTestSuite(test_info->test_suite_name(), test_info->type_param(),
690
+ set_up_tc, tear_down_tc)
691
+ ->AddTestInfo(test_info);
692
+ }
693
+
694
+ // Returns ParameterizedTestSuiteRegistry object used to keep track of
695
+ // value-parameterized tests and instantiate and register them.
696
+ internal::ParameterizedTestSuiteRegistry& parameterized_test_registry() {
697
+ return parameterized_test_registry_;
698
+ }
699
+
700
+ // Sets the TestSuite object for the test that's currently running.
701
+ void set_current_test_suite(TestSuite* a_current_test_suite) {
702
+ current_test_suite_ = a_current_test_suite;
703
+ }
704
+
705
+ // Sets the TestInfo object for the test that's currently running. If
706
+ // current_test_info is NULL, the assertion results will be stored in
707
+ // ad_hoc_test_result_.
708
+ void set_current_test_info(TestInfo* a_current_test_info) {
709
+ current_test_info_ = a_current_test_info;
710
+ }
711
+
712
+ // Registers all parameterized tests defined using TEST_P and
713
+ // INSTANTIATE_TEST_SUITE_P, creating regular tests for each test/parameter
714
+ // combination. This method can be called more then once; it has guards
715
+ // protecting from registering the tests more then once. If
716
+ // value-parameterized tests are disabled, RegisterParameterizedTests is
717
+ // present but does nothing.
718
+ void RegisterParameterizedTests();
719
+
720
+ // Runs all tests in this UnitTest object, prints the result, and
721
+ // returns true if all tests are successful. If any exception is
722
+ // thrown during a test, this test is considered to be failed, but
723
+ // the rest of the tests will still be run.
724
+ bool RunAllTests();
725
+
726
+ // Clears the results of all tests, except the ad hoc tests.
727
+ void ClearNonAdHocTestResult() {
728
+ ForEach(test_suites_, TestSuite::ClearTestSuiteResult);
729
+ }
730
+
731
+ // Clears the results of ad-hoc test assertions.
732
+ void ClearAdHocTestResult() {
733
+ ad_hoc_test_result_.Clear();
734
+ }
735
+
736
+ // Adds a TestProperty to the current TestResult object when invoked in a
737
+ // context of a test or a test suite, or to the global property set. If the
738
+ // result already contains a property with the same key, the value will be
739
+ // updated.
740
+ void RecordProperty(const TestProperty& test_property);
741
+
742
+ enum ReactionToSharding {
743
+ HONOR_SHARDING_PROTOCOL,
744
+ IGNORE_SHARDING_PROTOCOL
745
+ };
746
+
747
+ // Matches the full name of each test against the user-specified
748
+ // filter to decide whether the test should run, then records the
749
+ // result in each TestSuite and TestInfo object.
750
+ // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests
751
+ // based on sharding variables in the environment.
752
+ // Returns the number of tests that should run.
753
+ int FilterTests(ReactionToSharding shard_tests);
754
+
755
+ // Prints the names of the tests matching the user-specified filter flag.
756
+ void ListTestsMatchingFilter();
757
+
758
+ const TestSuite* current_test_suite() const { return current_test_suite_; }
759
+ TestInfo* current_test_info() { return current_test_info_; }
760
+ const TestInfo* current_test_info() const { return current_test_info_; }
761
+
762
+ // Returns the vector of environments that need to be set-up/torn-down
763
+ // before/after the tests are run.
764
+ std::vector<Environment*>& environments() { return environments_; }
765
+
766
+ // Getters for the per-thread Google Test trace stack.
767
+ std::vector<TraceInfo>& gtest_trace_stack() {
768
+ return *(gtest_trace_stack_.pointer());
769
+ }
770
+ const std::vector<TraceInfo>& gtest_trace_stack() const {
771
+ return gtest_trace_stack_.get();
772
+ }
773
+
774
+ #if GTEST_HAS_DEATH_TEST
775
+ void InitDeathTestSubprocessControlInfo() {
776
+ internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
777
+ }
778
+ // Returns a pointer to the parsed --gtest_internal_run_death_test
779
+ // flag, or NULL if that flag was not specified.
780
+ // This information is useful only in a death test child process.
781
+ // Must not be called before a call to InitGoogleTest.
782
+ const InternalRunDeathTestFlag* internal_run_death_test_flag() const {
783
+ return internal_run_death_test_flag_.get();
784
+ }
785
+
786
+ // Returns a pointer to the current death test factory.
787
+ internal::DeathTestFactory* death_test_factory() {
788
+ return death_test_factory_.get();
789
+ }
790
+
791
+ void SuppressTestEventsIfInSubprocess();
792
+
793
+ friend class ReplaceDeathTestFactory;
794
+ #endif // GTEST_HAS_DEATH_TEST
795
+
796
+ // Initializes the event listener performing XML output as specified by
797
+ // UnitTestOptions. Must not be called before InitGoogleTest.
798
+ void ConfigureXmlOutput();
799
+
800
+ #if GTEST_CAN_STREAM_RESULTS_
801
+ // Initializes the event listener for streaming test results to a socket.
802
+ // Must not be called before InitGoogleTest.
803
+ void ConfigureStreamingOutput();
804
+ #endif
805
+
806
+ // Performs initialization dependent upon flag values obtained in
807
+ // ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to
808
+ // ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest
809
+ // this function is also called from RunAllTests. Since this function can be
810
+ // called more than once, it has to be idempotent.
811
+ void PostFlagParsingInit();
812
+
813
+ // Gets the random seed used at the start of the current test iteration.
814
+ int random_seed() const { return random_seed_; }
815
+
816
+ // Gets the random number generator.
817
+ internal::Random* random() { return &random_; }
818
+
819
+ // Shuffles all test suites, and the tests within each test suite,
820
+ // making sure that death tests are still run first.
821
+ void ShuffleTests();
822
+
823
+ // Restores the test suites and tests to their order before the first shuffle.
824
+ void UnshuffleTests();
825
+
826
+ // Returns the value of GTEST_FLAG(catch_exceptions) at the moment
827
+ // UnitTest::Run() starts.
828
+ bool catch_exceptions() const { return catch_exceptions_; }
829
+
830
+ private:
831
+ friend class ::testing::UnitTest;
832
+
833
+ // Used by UnitTest::Run() to capture the state of
834
+ // GTEST_FLAG(catch_exceptions) at the moment it starts.
835
+ void set_catch_exceptions(bool value) { catch_exceptions_ = value; }
836
+
837
+ // The UnitTest object that owns this implementation object.
838
+ UnitTest* const parent_;
839
+
840
+ // The working directory when the first TEST() or TEST_F() was
841
+ // executed.
842
+ internal::FilePath original_working_dir_;
843
+
844
+ // The default test part result reporters.
845
+ DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;
846
+ DefaultPerThreadTestPartResultReporter
847
+ default_per_thread_test_part_result_reporter_;
848
+
849
+ // Points to (but doesn't own) the global test part result reporter.
850
+ TestPartResultReporterInterface* global_test_part_result_repoter_;
851
+
852
+ // Protects read and write access to global_test_part_result_reporter_.
853
+ internal::Mutex global_test_part_result_reporter_mutex_;
854
+
855
+ // Points to (but doesn't own) the per-thread test part result reporter.
856
+ internal::ThreadLocal<TestPartResultReporterInterface*>
857
+ per_thread_test_part_result_reporter_;
858
+
859
+ // The vector of environments that need to be set-up/torn-down
860
+ // before/after the tests are run.
861
+ std::vector<Environment*> environments_;
862
+
863
+ // The vector of TestSuites in their original order. It owns the
864
+ // elements in the vector.
865
+ std::vector<TestSuite*> test_suites_;
866
+
867
+ // Provides a level of indirection for the test suite list to allow
868
+ // easy shuffling and restoring the test suite order. The i-th
869
+ // element of this vector is the index of the i-th test suite in the
870
+ // shuffled order.
871
+ std::vector<int> test_suite_indices_;
872
+
873
+ // ParameterizedTestRegistry object used to register value-parameterized
874
+ // tests.
875
+ internal::ParameterizedTestSuiteRegistry parameterized_test_registry_;
876
+
877
+ // Indicates whether RegisterParameterizedTests() has been called already.
878
+ bool parameterized_tests_registered_;
879
+
880
+ // Index of the last death test suite registered. Initially -1.
881
+ int last_death_test_suite_;
882
+
883
+ // This points to the TestSuite for the currently running test. It
884
+ // changes as Google Test goes through one test suite after another.
885
+ // When no test is running, this is set to NULL and Google Test
886
+ // stores assertion results in ad_hoc_test_result_. Initially NULL.
887
+ TestSuite* current_test_suite_;
888
+
889
+ // This points to the TestInfo for the currently running test. It
890
+ // changes as Google Test goes through one test after another. When
891
+ // no test is running, this is set to NULL and Google Test stores
892
+ // assertion results in ad_hoc_test_result_. Initially NULL.
893
+ TestInfo* current_test_info_;
894
+
895
+ // Normally, a user only writes assertions inside a TEST or TEST_F,
896
+ // or inside a function called by a TEST or TEST_F. Since Google
897
+ // Test keeps track of which test is current running, it can
898
+ // associate such an assertion with the test it belongs to.
899
+ //
900
+ // If an assertion is encountered when no TEST or TEST_F is running,
901
+ // Google Test attributes the assertion result to an imaginary "ad hoc"
902
+ // test, and records the result in ad_hoc_test_result_.
903
+ TestResult ad_hoc_test_result_;
904
+
905
+ // The list of event listeners that can be used to track events inside
906
+ // Google Test.
907
+ TestEventListeners listeners_;
908
+
909
+ // The OS stack trace getter. Will be deleted when the UnitTest
910
+ // object is destructed. By default, an OsStackTraceGetter is used,
911
+ // but the user can set this field to use a custom getter if that is
912
+ // desired.
913
+ OsStackTraceGetterInterface* os_stack_trace_getter_;
914
+
915
+ // True if and only if PostFlagParsingInit() has been called.
916
+ bool post_flag_parse_init_performed_;
917
+
918
+ // The random number seed used at the beginning of the test run.
919
+ int random_seed_;
920
+
921
+ // Our random number generator.
922
+ internal::Random random_;
923
+
924
+ // The time of the test program start, in ms from the start of the
925
+ // UNIX epoch.
926
+ TimeInMillis start_timestamp_;
927
+
928
+ // How long the test took to run, in milliseconds.
929
+ TimeInMillis elapsed_time_;
930
+
931
+ #if GTEST_HAS_DEATH_TEST
932
+ // The decomposed components of the gtest_internal_run_death_test flag,
933
+ // parsed when RUN_ALL_TESTS is called.
934
+ std::unique_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
935
+ std::unique_ptr<internal::DeathTestFactory> death_test_factory_;
936
+ #endif // GTEST_HAS_DEATH_TEST
937
+
938
+ // A per-thread stack of traces created by the SCOPED_TRACE() macro.
939
+ internal::ThreadLocal<std::vector<TraceInfo> > gtest_trace_stack_;
940
+
941
+ // The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests()
942
+ // starts.
943
+ bool catch_exceptions_;
944
+
945
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);
946
+ }; // class UnitTestImpl
947
+
948
+ // Convenience function for accessing the global UnitTest
949
+ // implementation object.
950
+ inline UnitTestImpl* GetUnitTestImpl() {
951
+ return UnitTest::GetInstance()->impl();
952
+ }
953
+
954
+ #if GTEST_USES_SIMPLE_RE
955
+
956
+ // Internal helper functions for implementing the simple regular
957
+ // expression matcher.
958
+ GTEST_API_ bool IsInSet(char ch, const char* str);
959
+ GTEST_API_ bool IsAsciiDigit(char ch);
960
+ GTEST_API_ bool IsAsciiPunct(char ch);
961
+ GTEST_API_ bool IsRepeat(char ch);
962
+ GTEST_API_ bool IsAsciiWhiteSpace(char ch);
963
+ GTEST_API_ bool IsAsciiWordChar(char ch);
964
+ GTEST_API_ bool IsValidEscape(char ch);
965
+ GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);
966
+ GTEST_API_ bool ValidateRegex(const char* regex);
967
+ GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);
968
+ GTEST_API_ bool MatchRepetitionAndRegexAtHead(
969
+ bool escaped, char ch, char repeat, const char* regex, const char* str);
970
+ GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);
971
+
972
+ #endif // GTEST_USES_SIMPLE_RE
973
+
974
+ // Parses the command line for Google Test flags, without initializing
975
+ // other parts of Google Test.
976
+ GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);
977
+ GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
978
+
979
+ #if GTEST_HAS_DEATH_TEST
980
+
981
+ // Returns the message describing the last system error, regardless of the
982
+ // platform.
983
+ GTEST_API_ std::string GetLastErrnoDescription();
984
+
985
+ // Attempts to parse a string into a positive integer pointed to by the
986
+ // number parameter. Returns true if that is possible.
987
+ // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use
988
+ // it here.
989
+ template <typename Integer>
990
+ bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
991
+ // Fail fast if the given string does not begin with a digit;
992
+ // this bypasses strtoXXX's "optional leading whitespace and plus
993
+ // or minus sign" semantics, which are undesirable here.
994
+ if (str.empty() || !IsDigit(str[0])) {
995
+ return false;
996
+ }
997
+ errno = 0;
998
+
999
+ char* end;
1000
+ // BiggestConvertible is the largest integer type that system-provided
1001
+ // string-to-number conversion routines can return.
1002
+
1003
+ # if GTEST_OS_WINDOWS && !defined(__GNUC__)
1004
+
1005
+ // MSVC and C++ Builder define __int64 instead of the standard long long.
1006
+ typedef unsigned __int64 BiggestConvertible;
1007
+ const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
1008
+
1009
+ # else
1010
+
1011
+ typedef unsigned long long BiggestConvertible; // NOLINT
1012
+ const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
1013
+
1014
+ # endif // GTEST_OS_WINDOWS && !defined(__GNUC__)
1015
+
1016
+ const bool parse_success = *end == '\0' && errno == 0;
1017
+
1018
+ GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));
1019
+
1020
+ const Integer result = static_cast<Integer>(parsed);
1021
+ if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {
1022
+ *number = result;
1023
+ return true;
1024
+ }
1025
+ return false;
1026
+ }
1027
+ #endif // GTEST_HAS_DEATH_TEST
1028
+
1029
+ // TestResult contains some private methods that should be hidden from
1030
+ // Google Test user but are required for testing. This class allow our tests
1031
+ // to access them.
1032
+ //
1033
+ // This class is supplied only for the purpose of testing Google Test's own
1034
+ // constructs. Do not use it in user tests, either directly or indirectly.
1035
+ class TestResultAccessor {
1036
+ public:
1037
+ static void RecordProperty(TestResult* test_result,
1038
+ const std::string& xml_element,
1039
+ const TestProperty& property) {
1040
+ test_result->RecordProperty(xml_element, property);
1041
+ }
1042
+
1043
+ static void ClearTestPartResults(TestResult* test_result) {
1044
+ test_result->ClearTestPartResults();
1045
+ }
1046
+
1047
+ static const std::vector<testing::TestPartResult>& test_part_results(
1048
+ const TestResult& test_result) {
1049
+ return test_result.test_part_results();
1050
+ }
1051
+ };
1052
+
1053
+ #if GTEST_CAN_STREAM_RESULTS_
1054
+
1055
+ // Streams test results to the given port on the given host machine.
1056
+ class StreamingListener : public EmptyTestEventListener {
1057
+ public:
1058
+ // Abstract base class for writing strings to a socket.
1059
+ class AbstractSocketWriter {
1060
+ public:
1061
+ virtual ~AbstractSocketWriter() {}
1062
+
1063
+ // Sends a string to the socket.
1064
+ virtual void Send(const std::string& message) = 0;
1065
+
1066
+ // Closes the socket.
1067
+ virtual void CloseConnection() {}
1068
+
1069
+ // Sends a string and a newline to the socket.
1070
+ void SendLn(const std::string& message) { Send(message + "\n"); }
1071
+ };
1072
+
1073
+ // Concrete class for actually writing strings to a socket.
1074
+ class SocketWriter : public AbstractSocketWriter {
1075
+ public:
1076
+ SocketWriter(const std::string& host, const std::string& port)
1077
+ : sockfd_(-1), host_name_(host), port_num_(port) {
1078
+ MakeConnection();
1079
+ }
1080
+
1081
+ ~SocketWriter() override {
1082
+ if (sockfd_ != -1)
1083
+ CloseConnection();
1084
+ }
1085
+
1086
+ // Sends a string to the socket.
1087
+ void Send(const std::string& message) override {
1088
+ GTEST_CHECK_(sockfd_ != -1)
1089
+ << "Send() can be called only when there is a connection.";
1090
+
1091
+ const auto len = static_cast<size_t>(message.length());
1092
+ if (write(sockfd_, message.c_str(), len) != static_cast<ssize_t>(len)) {
1093
+ GTEST_LOG_(WARNING)
1094
+ << "stream_result_to: failed to stream to "
1095
+ << host_name_ << ":" << port_num_;
1096
+ }
1097
+ }
1098
+
1099
+ private:
1100
+ // Creates a client socket and connects to the server.
1101
+ void MakeConnection();
1102
+
1103
+ // Closes the socket.
1104
+ void CloseConnection() override {
1105
+ GTEST_CHECK_(sockfd_ != -1)
1106
+ << "CloseConnection() can be called only when there is a connection.";
1107
+
1108
+ close(sockfd_);
1109
+ sockfd_ = -1;
1110
+ }
1111
+
1112
+ int sockfd_; // socket file descriptor
1113
+ const std::string host_name_;
1114
+ const std::string port_num_;
1115
+
1116
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter);
1117
+ }; // class SocketWriter
1118
+
1119
+ // Escapes '=', '&', '%', and '\n' characters in str as "%xx".
1120
+ static std::string UrlEncode(const char* str);
1121
+
1122
+ StreamingListener(const std::string& host, const std::string& port)
1123
+ : socket_writer_(new SocketWriter(host, port)) {
1124
+ Start();
1125
+ }
1126
+
1127
+ explicit StreamingListener(AbstractSocketWriter* socket_writer)
1128
+ : socket_writer_(socket_writer) { Start(); }
1129
+
1130
+ void OnTestProgramStart(const UnitTest& /* unit_test */) override {
1131
+ SendLn("event=TestProgramStart");
1132
+ }
1133
+
1134
+ void OnTestProgramEnd(const UnitTest& unit_test) override {
1135
+ // Note that Google Test current only report elapsed time for each
1136
+ // test iteration, not for the entire test program.
1137
+ SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed()));
1138
+
1139
+ // Notify the streaming server to stop.
1140
+ socket_writer_->CloseConnection();
1141
+ }
1142
+
1143
+ void OnTestIterationStart(const UnitTest& /* unit_test */,
1144
+ int iteration) override {
1145
+ SendLn("event=TestIterationStart&iteration=" +
1146
+ StreamableToString(iteration));
1147
+ }
1148
+
1149
+ void OnTestIterationEnd(const UnitTest& unit_test,
1150
+ int /* iteration */) override {
1151
+ SendLn("event=TestIterationEnd&passed=" +
1152
+ FormatBool(unit_test.Passed()) + "&elapsed_time=" +
1153
+ StreamableToString(unit_test.elapsed_time()) + "ms");
1154
+ }
1155
+
1156
+ // Note that "event=TestCaseStart" is a wire format and has to remain
1157
+ // "case" for compatibilty
1158
+ void OnTestCaseStart(const TestCase& test_case) override {
1159
+ SendLn(std::string("event=TestCaseStart&name=") + test_case.name());
1160
+ }
1161
+
1162
+ // Note that "event=TestCaseEnd" is a wire format and has to remain
1163
+ // "case" for compatibilty
1164
+ void OnTestCaseEnd(const TestCase& test_case) override {
1165
+ SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed()) +
1166
+ "&elapsed_time=" + StreamableToString(test_case.elapsed_time()) +
1167
+ "ms");
1168
+ }
1169
+
1170
+ void OnTestStart(const TestInfo& test_info) override {
1171
+ SendLn(std::string("event=TestStart&name=") + test_info.name());
1172
+ }
1173
+
1174
+ void OnTestEnd(const TestInfo& test_info) override {
1175
+ SendLn("event=TestEnd&passed=" +
1176
+ FormatBool((test_info.result())->Passed()) +
1177
+ "&elapsed_time=" +
1178
+ StreamableToString((test_info.result())->elapsed_time()) + "ms");
1179
+ }
1180
+
1181
+ void OnTestPartResult(const TestPartResult& test_part_result) override {
1182
+ const char* file_name = test_part_result.file_name();
1183
+ if (file_name == nullptr) file_name = "";
1184
+ SendLn("event=TestPartResult&file=" + UrlEncode(file_name) +
1185
+ "&line=" + StreamableToString(test_part_result.line_number()) +
1186
+ "&message=" + UrlEncode(test_part_result.message()));
1187
+ }
1188
+
1189
+ private:
1190
+ // Sends the given message and a newline to the socket.
1191
+ void SendLn(const std::string& message) { socket_writer_->SendLn(message); }
1192
+
1193
+ // Called at the start of streaming to notify the receiver what
1194
+ // protocol we are using.
1195
+ void Start() { SendLn("gtest_streaming_protocol_version=1.0"); }
1196
+
1197
+ std::string FormatBool(bool value) { return value ? "1" : "0"; }
1198
+
1199
+ const std::unique_ptr<AbstractSocketWriter> socket_writer_;
1200
+
1201
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener);
1202
+ }; // class StreamingListener
1203
+
1204
+ #endif // GTEST_CAN_STREAM_RESULTS_
1205
+
1206
+ } // namespace internal
1207
+ } // namespace testing
1208
+
1209
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
1210
+
1211
+ #endif // GTEST_SRC_GTEST_INTERNAL_INL_H_