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.
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/android/.project +34 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +13 -0
- package/android/CMakeLists.txt +69 -0
- package/android/build.gradle +125 -0
- package/android/cpp-adapter.cpp +19 -0
- package/android/gradle.properties +6 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/reactnativeleveldb/LeveldbModule.java +57 -0
- package/android/src/main/java/com/reactnativeleveldb/LeveldbPackage.java +28 -0
- package/cpp/leveldb/.appveyor.yml +36 -0
- package/cpp/leveldb/.clang-format +18 -0
- package/cpp/leveldb/.travis.yml +88 -0
- package/cpp/leveldb/AUTHORS +12 -0
- package/cpp/leveldb/CMakeLists.txt +495 -0
- package/cpp/leveldb/CONTRIBUTING.md +36 -0
- package/cpp/leveldb/LICENSE +27 -0
- package/cpp/leveldb/NEWS +17 -0
- package/cpp/leveldb/README.md +231 -0
- package/cpp/leveldb/TODO +14 -0
- package/cpp/leveldb/benchmarks/db_bench.cc +990 -0
- package/cpp/leveldb/benchmarks/db_bench_sqlite3.cc +726 -0
- package/cpp/leveldb/benchmarks/db_bench_tree_db.cc +531 -0
- package/cpp/leveldb/cmake/leveldbConfig.cmake.in +9 -0
- package/cpp/leveldb/db/autocompact_test.cc +115 -0
- package/cpp/leveldb/db/builder.cc +82 -0
- package/cpp/leveldb/db/builder.h +30 -0
- package/cpp/leveldb/db/c.cc +562 -0
- package/cpp/leveldb/db/c_test.c +384 -0
- package/cpp/leveldb/db/corruption_test.cc +367 -0
- package/cpp/leveldb/db/db_impl.cc +1554 -0
- package/cpp/leveldb/db/db_impl.h +217 -0
- package/cpp/leveldb/db/db_iter.cc +318 -0
- package/cpp/leveldb/db/db_iter.h +26 -0
- package/cpp/leveldb/db/db_test.cc +2305 -0
- package/cpp/leveldb/db/dbformat.cc +136 -0
- package/cpp/leveldb/db/dbformat.h +224 -0
- package/cpp/leveldb/db/dbformat_test.cc +133 -0
- package/cpp/leveldb/db/dumpfile.cc +232 -0
- package/cpp/leveldb/db/fault_injection_test.cc +555 -0
- package/cpp/leveldb/db/filename.cc +141 -0
- package/cpp/leveldb/db/filename.h +83 -0
- package/cpp/leveldb/db/filename_test.cc +132 -0
- package/cpp/leveldb/db/leveldbutil.cc +64 -0
- package/cpp/leveldb/db/log_format.h +35 -0
- package/cpp/leveldb/db/log_reader.cc +274 -0
- package/cpp/leveldb/db/log_reader.h +112 -0
- package/cpp/leveldb/db/log_test.cc +563 -0
- package/cpp/leveldb/db/log_writer.cc +111 -0
- package/cpp/leveldb/db/log_writer.h +54 -0
- package/cpp/leveldb/db/memtable.cc +137 -0
- package/cpp/leveldb/db/memtable.h +87 -0
- package/cpp/leveldb/db/recovery_test.cc +339 -0
- package/cpp/leveldb/db/repair.cc +451 -0
- package/cpp/leveldb/db/skiplist.h +382 -0
- package/cpp/leveldb/db/skiplist_test.cc +373 -0
- package/cpp/leveldb/db/snapshot.h +95 -0
- package/cpp/leveldb/db/table_cache.cc +120 -0
- package/cpp/leveldb/db/table_cache.h +57 -0
- package/cpp/leveldb/db/version_edit.cc +257 -0
- package/cpp/leveldb/db/version_edit.h +106 -0
- package/cpp/leveldb/db/version_edit_test.cc +46 -0
- package/cpp/leveldb/db/version_set.cc +1562 -0
- package/cpp/leveldb/db/version_set.h +393 -0
- package/cpp/leveldb/db/version_set_test.cc +336 -0
- package/cpp/leveldb/db/write_batch.cc +150 -0
- package/cpp/leveldb/db/write_batch_internal.h +45 -0
- package/cpp/leveldb/db/write_batch_test.cc +137 -0
- package/cpp/leveldb/doc/benchmark.html +459 -0
- package/cpp/leveldb/doc/impl.md +172 -0
- package/cpp/leveldb/doc/index.md +523 -0
- package/cpp/leveldb/doc/log_format.md +75 -0
- package/cpp/leveldb/doc/table_format.md +107 -0
- package/cpp/leveldb/helpers/memenv/memenv.cc +390 -0
- package/cpp/leveldb/helpers/memenv/memenv.h +22 -0
- package/cpp/leveldb/helpers/memenv/memenv_test.cc +264 -0
- package/cpp/leveldb/include/leveldb/c.h +270 -0
- package/cpp/leveldb/include/leveldb/cache.h +111 -0
- package/cpp/leveldb/include/leveldb/comparator.h +64 -0
- package/cpp/leveldb/include/leveldb/db.h +167 -0
- package/cpp/leveldb/include/leveldb/dumpfile.h +28 -0
- package/cpp/leveldb/include/leveldb/env.h +417 -0
- package/cpp/leveldb/include/leveldb/export.h +33 -0
- package/cpp/leveldb/include/leveldb/filter_policy.h +72 -0
- package/cpp/leveldb/include/leveldb/iterator.h +112 -0
- package/cpp/leveldb/include/leveldb/options.h +187 -0
- package/cpp/leveldb/include/leveldb/slice.h +114 -0
- package/cpp/leveldb/include/leveldb/status.h +122 -0
- package/cpp/leveldb/include/leveldb/table.h +84 -0
- package/cpp/leveldb/include/leveldb/table_builder.h +93 -0
- package/cpp/leveldb/include/leveldb/write_batch.h +83 -0
- package/cpp/leveldb/issues/issue178_test.cc +90 -0
- package/cpp/leveldb/issues/issue200_test.cc +59 -0
- package/cpp/leveldb/issues/issue320_test.cc +131 -0
- package/cpp/leveldb/port/README.md +10 -0
- package/cpp/leveldb/port/port.h +19 -0
- package/cpp/leveldb/port/port_config.h.in +33 -0
- package/cpp/leveldb/port/port_example.h +100 -0
- package/cpp/leveldb/port/port_stdcxx.h +151 -0
- package/cpp/leveldb/port/thread_annotations.h +108 -0
- package/cpp/leveldb/table/block.cc +267 -0
- package/cpp/leveldb/table/block.h +44 -0
- package/cpp/leveldb/table/block_builder.cc +107 -0
- package/cpp/leveldb/table/block_builder.h +54 -0
- package/cpp/leveldb/table/filter_block.cc +106 -0
- package/cpp/leveldb/table/filter_block.h +68 -0
- package/cpp/leveldb/table/filter_block_test.cc +127 -0
- package/cpp/leveldb/table/format.cc +141 -0
- package/cpp/leveldb/table/format.h +99 -0
- package/cpp/leveldb/table/iterator.cc +76 -0
- package/cpp/leveldb/table/iterator_wrapper.h +92 -0
- package/cpp/leveldb/table/merger.cc +191 -0
- package/cpp/leveldb/table/merger.h +26 -0
- package/cpp/leveldb/table/table.cc +271 -0
- package/cpp/leveldb/table/table_builder.cc +265 -0
- package/cpp/leveldb/table/table_test.cc +834 -0
- package/cpp/leveldb/table/two_level_iterator.cc +171 -0
- package/cpp/leveldb/table/two_level_iterator.h +31 -0
- package/cpp/leveldb/third_party/benchmark/.clang-format +5 -0
- package/cpp/leveldb/third_party/benchmark/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
- package/cpp/leveldb/third_party/benchmark/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/cpp/leveldb/third_party/benchmark/.github/workflows/build-and-test.yml +38 -0
- package/cpp/leveldb/third_party/benchmark/.github/workflows/pylint.yml +26 -0
- package/cpp/leveldb/third_party/benchmark/.github/workflows/test_bindings.yml +24 -0
- package/cpp/leveldb/third_party/benchmark/.travis-libcxx-setup.sh +28 -0
- package/cpp/leveldb/third_party/benchmark/.travis.yml +231 -0
- package/cpp/leveldb/third_party/benchmark/.ycm_extra_conf.py +115 -0
- package/cpp/leveldb/third_party/benchmark/AUTHORS +58 -0
- package/cpp/leveldb/third_party/benchmark/BUILD.bazel +44 -0
- package/cpp/leveldb/third_party/benchmark/CMakeLists.txt +287 -0
- package/cpp/leveldb/third_party/benchmark/CONTRIBUTING.md +58 -0
- package/cpp/leveldb/third_party/benchmark/CONTRIBUTORS +83 -0
- package/cpp/leveldb/third_party/benchmark/LICENSE +202 -0
- package/cpp/leveldb/third_party/benchmark/README.md +1323 -0
- package/cpp/leveldb/third_party/benchmark/WORKSPACE +51 -0
- package/cpp/leveldb/third_party/benchmark/_config.yml +1 -0
- package/cpp/leveldb/third_party/benchmark/appveyor.yml +50 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/BUILD +3 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/build_defs.bzl +25 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/BUILD +38 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/__init__.py +156 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/benchmark.cc +180 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/example.py +136 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/pybind11.BUILD +20 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/python_headers.BUILD +6 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/requirements.txt +2 -0
- package/cpp/leveldb/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake +74 -0
- package/cpp/leveldb/third_party/benchmark/cmake/CXXFeatureCheck.cmake +69 -0
- package/cpp/leveldb/third_party/benchmark/cmake/Config.cmake.in +1 -0
- package/cpp/leveldb/third_party/benchmark/cmake/GetGitVersion.cmake +54 -0
- package/cpp/leveldb/third_party/benchmark/cmake/GoogleTest.cmake +41 -0
- package/cpp/leveldb/third_party/benchmark/cmake/GoogleTest.cmake.in +58 -0
- package/cpp/leveldb/third_party/benchmark/cmake/benchmark.pc.in +12 -0
- package/cpp/leveldb/third_party/benchmark/cmake/gnu_posix_regex.cpp +12 -0
- package/cpp/leveldb/third_party/benchmark/cmake/llvm-toolchain.cmake +8 -0
- package/cpp/leveldb/third_party/benchmark/cmake/posix_regex.cpp +14 -0
- package/cpp/leveldb/third_party/benchmark/cmake/split_list.cmake +3 -0
- package/cpp/leveldb/third_party/benchmark/cmake/std_regex.cpp +10 -0
- package/cpp/leveldb/third_party/benchmark/cmake/steady_clock.cpp +7 -0
- package/cpp/leveldb/third_party/benchmark/cmake/thread_safety_attributes.cpp +4 -0
- package/cpp/leveldb/third_party/benchmark/conan/CMakeLists.txt +7 -0
- package/cpp/leveldb/third_party/benchmark/conan/test_package/CMakeLists.txt +10 -0
- package/cpp/leveldb/third_party/benchmark/conan/test_package/conanfile.py +19 -0
- package/cpp/leveldb/third_party/benchmark/conan/test_package/test_package.cpp +18 -0
- package/cpp/leveldb/third_party/benchmark/conanfile.py +79 -0
- package/cpp/leveldb/third_party/benchmark/dependencies.md +18 -0
- package/cpp/leveldb/third_party/benchmark/docs/AssemblyTests.md +147 -0
- package/cpp/leveldb/third_party/benchmark/docs/_config.yml +1 -0
- package/cpp/leveldb/third_party/benchmark/docs/releasing.md +16 -0
- package/cpp/leveldb/third_party/benchmark/docs/tools.md +203 -0
- package/cpp/leveldb/third_party/benchmark/include/benchmark/benchmark.h +1604 -0
- package/cpp/leveldb/third_party/benchmark/requirements.txt +2 -0
- package/cpp/leveldb/third_party/benchmark/setup.py +140 -0
- package/cpp/leveldb/third_party/benchmark/src/CMakeLists.txt +114 -0
- package/cpp/leveldb/third_party/benchmark/src/arraysize.h +33 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark.cc +499 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_api_internal.cc +15 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_api_internal.h +53 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_main.cc +17 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_name.cc +58 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_register.cc +515 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_register.h +108 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_runner.cc +362 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_runner.h +51 -0
- package/cpp/leveldb/third_party/benchmark/src/check.h +82 -0
- package/cpp/leveldb/third_party/benchmark/src/colorprint.cc +188 -0
- package/cpp/leveldb/third_party/benchmark/src/colorprint.h +33 -0
- package/cpp/leveldb/third_party/benchmark/src/commandlineflags.cc +228 -0
- package/cpp/leveldb/third_party/benchmark/src/commandlineflags.h +103 -0
- package/cpp/leveldb/third_party/benchmark/src/complexity.cc +238 -0
- package/cpp/leveldb/third_party/benchmark/src/complexity.h +55 -0
- package/cpp/leveldb/third_party/benchmark/src/console_reporter.cc +177 -0
- package/cpp/leveldb/third_party/benchmark/src/counter.cc +80 -0
- package/cpp/leveldb/third_party/benchmark/src/counter.h +32 -0
- package/cpp/leveldb/third_party/benchmark/src/csv_reporter.cc +154 -0
- package/cpp/leveldb/third_party/benchmark/src/cycleclock.h +211 -0
- package/cpp/leveldb/third_party/benchmark/src/internal_macros.h +102 -0
- package/cpp/leveldb/third_party/benchmark/src/json_reporter.cc +255 -0
- package/cpp/leveldb/third_party/benchmark/src/log.h +74 -0
- package/cpp/leveldb/third_party/benchmark/src/mutex.h +155 -0
- package/cpp/leveldb/third_party/benchmark/src/re.h +158 -0
- package/cpp/leveldb/third_party/benchmark/src/reporter.cc +105 -0
- package/cpp/leveldb/third_party/benchmark/src/sleep.cc +67 -0
- package/cpp/leveldb/third_party/benchmark/src/sleep.h +15 -0
- package/cpp/leveldb/third_party/benchmark/src/statistics.cc +193 -0
- package/cpp/leveldb/third_party/benchmark/src/statistics.h +37 -0
- package/cpp/leveldb/third_party/benchmark/src/string_util.cc +255 -0
- package/cpp/leveldb/third_party/benchmark/src/string_util.h +59 -0
- package/cpp/leveldb/third_party/benchmark/src/sysinfo.cc +716 -0
- package/cpp/leveldb/third_party/benchmark/src/thread_manager.h +64 -0
- package/cpp/leveldb/third_party/benchmark/src/thread_timer.h +86 -0
- package/cpp/leveldb/third_party/benchmark/src/timers.cc +245 -0
- package/cpp/leveldb/third_party/benchmark/src/timers.h +48 -0
- package/cpp/leveldb/third_party/benchmark/test/AssemblyTests.cmake +46 -0
- package/cpp/leveldb/third_party/benchmark/test/BUILD +73 -0
- package/cpp/leveldb/third_party/benchmark/test/CMakeLists.txt +263 -0
- package/cpp/leveldb/third_party/benchmark/test/args_product_test.cc +77 -0
- package/cpp/leveldb/third_party/benchmark/test/basic_test.cc +136 -0
- package/cpp/leveldb/third_party/benchmark/test/benchmark_gtest.cc +134 -0
- package/cpp/leveldb/third_party/benchmark/test/benchmark_name_gtest.cc +74 -0
- package/cpp/leveldb/third_party/benchmark/test/benchmark_test.cc +245 -0
- package/cpp/leveldb/third_party/benchmark/test/clobber_memory_assembly_test.cc +64 -0
- package/cpp/leveldb/third_party/benchmark/test/commandlineflags_gtest.cc +201 -0
- package/cpp/leveldb/third_party/benchmark/test/complexity_test.cc +213 -0
- package/cpp/leveldb/third_party/benchmark/test/cxx03_test.cc +63 -0
- package/cpp/leveldb/third_party/benchmark/test/diagnostics_test.cc +80 -0
- package/cpp/leveldb/third_party/benchmark/test/display_aggregates_only_test.cc +43 -0
- package/cpp/leveldb/third_party/benchmark/test/donotoptimize_assembly_test.cc +163 -0
- package/cpp/leveldb/third_party/benchmark/test/donotoptimize_test.cc +52 -0
- package/cpp/leveldb/third_party/benchmark/test/filter_test.cc +104 -0
- package/cpp/leveldb/third_party/benchmark/test/fixture_test.cc +51 -0
- package/cpp/leveldb/third_party/benchmark/test/internal_threading_test.cc +184 -0
- package/cpp/leveldb/third_party/benchmark/test/link_main_test.cc +8 -0
- package/cpp/leveldb/third_party/benchmark/test/map_test.cc +57 -0
- package/cpp/leveldb/third_party/benchmark/test/memory_manager_test.cc +44 -0
- package/cpp/leveldb/third_party/benchmark/test/multiple_ranges_test.cc +96 -0
- package/cpp/leveldb/third_party/benchmark/test/options_test.cc +75 -0
- package/cpp/leveldb/third_party/benchmark/test/output_test.h +213 -0
- package/cpp/leveldb/third_party/benchmark/test/output_test_helper.cc +515 -0
- package/cpp/leveldb/third_party/benchmark/test/register_benchmark_test.cc +184 -0
- package/cpp/leveldb/third_party/benchmark/test/report_aggregates_only_test.cc +39 -0
- package/cpp/leveldb/third_party/benchmark/test/reporter_output_test.cc +747 -0
- package/cpp/leveldb/third_party/benchmark/test/skip_with_error_test.cc +195 -0
- package/cpp/leveldb/third_party/benchmark/test/state_assembly_test.cc +68 -0
- package/cpp/leveldb/third_party/benchmark/test/statistics_gtest.cc +28 -0
- package/cpp/leveldb/third_party/benchmark/test/string_util_gtest.cc +153 -0
- package/cpp/leveldb/third_party/benchmark/test/templated_fixture_test.cc +28 -0
- package/cpp/leveldb/third_party/benchmark/test/user_counters_tabular_test.cc +285 -0
- package/cpp/leveldb/third_party/benchmark/test/user_counters_test.cc +531 -0
- package/cpp/leveldb/third_party/benchmark/test/user_counters_thousands_test.cc +173 -0
- package/cpp/leveldb/third_party/benchmark/tools/BUILD.bazel +19 -0
- package/cpp/leveldb/third_party/benchmark/tools/compare.py +429 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test1_run1.json +119 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test1_run2.json +119 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test2_run.json +81 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test3_run0.json +65 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test3_run1.json +65 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/__init__.py +8 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/report.py +903 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/util.py +163 -0
- package/cpp/leveldb/third_party/benchmark/tools/requirements.txt +1 -0
- package/cpp/leveldb/third_party/benchmark/tools/strip_asm.py +151 -0
- package/cpp/leveldb/third_party/googletest/.clang-format +4 -0
- package/cpp/leveldb/third_party/googletest/.travis.yml +73 -0
- package/cpp/leveldb/third_party/googletest/BUILD.bazel +179 -0
- package/cpp/leveldb/third_party/googletest/CMakeLists.txt +36 -0
- package/cpp/leveldb/third_party/googletest/CONTRIBUTING.md +142 -0
- package/cpp/leveldb/third_party/googletest/LICENSE +28 -0
- package/cpp/leveldb/third_party/googletest/README.md +132 -0
- package/cpp/leveldb/third_party/googletest/WORKSPACE +23 -0
- package/cpp/leveldb/third_party/googletest/appveyor.yml +154 -0
- package/cpp/leveldb/third_party/googletest/ci/build-linux-bazel.sh +37 -0
- package/cpp/leveldb/third_party/googletest/ci/build-platformio.sh +2 -0
- package/cpp/leveldb/third_party/googletest/ci/env-linux.sh +41 -0
- package/cpp/leveldb/third_party/googletest/ci/env-osx.sh +47 -0
- package/cpp/leveldb/third_party/googletest/ci/get-nprocessors.sh +48 -0
- package/cpp/leveldb/third_party/googletest/ci/install-linux.sh +49 -0
- package/cpp/leveldb/third_party/googletest/ci/install-osx.sh +40 -0
- package/cpp/leveldb/third_party/googletest/ci/install-platformio.sh +5 -0
- package/cpp/leveldb/third_party/googletest/ci/log-config.sh +51 -0
- package/cpp/leveldb/third_party/googletest/ci/travis.sh +44 -0
- package/cpp/leveldb/third_party/googletest/googlemock/CMakeLists.txt +233 -0
- package/cpp/leveldb/third_party/googletest/googlemock/CONTRIBUTORS +40 -0
- package/cpp/leveldb/third_party/googletest/googlemock/LICENSE +28 -0
- package/cpp/leveldb/third_party/googletest/googlemock/README.md +44 -0
- package/cpp/leveldb/third_party/googletest/googlemock/cmake/gmock.pc.in +10 -0
- package/cpp/leveldb/third_party/googletest/googlemock/cmake/gmock_main.pc.in +10 -0
- package/cpp/leveldb/third_party/googletest/googlemock/docs/cheat_sheet.md +770 -0
- package/cpp/leveldb/third_party/googletest/googlemock/docs/cook_book.md +4270 -0
- package/cpp/leveldb/third_party/googletest/googlemock/docs/for_dummies.md +700 -0
- package/cpp/leveldb/third_party/googletest/googlemock/docs/gmock_faq.md +396 -0
- package/cpp/leveldb/third_party/googletest/googlemock/docs/pump_manual.md +187 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-actions.h +1193 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-cardinalities.h +157 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-function-mocker.h +276 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-actions.h +1884 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-actions.h.pump +627 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h +752 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +227 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-matchers.h +1097 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-matchers.h.pump +346 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-matchers.h +4591 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-more-actions.h +162 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-more-matchers.h +92 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-nice-strict.h +215 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-spec-builders.h +1985 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock.h +101 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/README.md +16 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +10 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +12 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h +36 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-port.h +39 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h +472 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/gmock-port.h +87 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/gmock-pp.h +271 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/README.md +5 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/fuse_gmock_files.py +240 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/LICENSE +203 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/README +34 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/README.cppclean +115 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/__init__.py +0 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/ast.py +1761 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/gmock_class.py +248 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/gmock_class_test.py +540 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/keywords.py +56 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/tokenize.py +284 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/utils.py +37 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/gmock_gen.py +30 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/pump.py +856 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-all.cc +46 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-cardinalities.cc +155 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-internal-utils.cc +200 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-matchers.cc +462 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-spec-builders.cc +892 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock.cc +213 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock_main.cc +72 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/BUILD.bazel +110 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-actions_test.cc +1507 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-cardinalities_test.cc +429 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-function-mocker_nc.cc +16 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-function-mocker_nc_test.py +43 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-function-mocker_test.cc +696 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-generated-actions_test.cc +1064 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-generated-function-mockers_test.cc +659 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-generated-matchers_test.cc +1323 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-internal-utils_test.cc +732 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-matchers_test.cc +6913 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-more-actions_test.cc +698 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-nice-strict_test.cc +500 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-port_test.cc +42 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-pp-string_test.cc +206 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-pp_test.cc +83 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-spec-builders_test.cc +2775 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_all_test.cc +49 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_ex_test.cc +80 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_leak_test.py +104 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_leak_test_.cc +99 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_link2_test.cc +39 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_link_test.cc +39 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_link_test.h +690 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_output_test.py +183 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_output_test_.cc +309 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_output_test_golden.txt +317 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_stress_test.cc +240 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_test.cc +181 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_test_utils.py +108 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/pump_test.py +182 -0
- package/cpp/leveldb/third_party/googletest/googletest/CMakeLists.txt +329 -0
- package/cpp/leveldb/third_party/googletest/googletest/CONTRIBUTORS +38 -0
- package/cpp/leveldb/third_party/googletest/googletest/LICENSE +28 -0
- package/cpp/leveldb/third_party/googletest/googletest/README.md +244 -0
- package/cpp/leveldb/third_party/googletest/googletest/cmake/Config.cmake.in +9 -0
- package/cpp/leveldb/third_party/googletest/googletest/cmake/gtest.pc.in +9 -0
- package/cpp/leveldb/third_party/googletest/googletest/cmake/gtest_main.pc.in +10 -0
- package/cpp/leveldb/third_party/googletest/googletest/cmake/internal_utils.cmake +358 -0
- package/cpp/leveldb/third_party/googletest/googletest/cmake/libgtest.la.in +21 -0
- package/cpp/leveldb/third_party/googletest/googletest/docs/advanced.md +2567 -0
- package/cpp/leveldb/third_party/googletest/googletest/docs/faq.md +753 -0
- package/cpp/leveldb/third_party/googletest/googletest/docs/pkgconfig.md +219 -0
- package/cpp/leveldb/third_party/googletest/googletest/docs/primer.md +579 -0
- package/cpp/leveldb/third_party/googletest/googletest/docs/samples.md +22 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-death-test.h +343 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-matchers.h +750 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-message.h +219 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-param-test.h +514 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-printers.h +928 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-spi.h +238 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-test-part.h +184 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-typed-test.h +337 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest.h +2477 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest_pred_impl.h +359 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest_prod.h +61 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/README.md +56 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/gtest-port.h +37 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/gtest-printers.h +42 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/gtest.h +37 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h +304 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-filepath.h +211 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-internal.h +1411 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-param-util.h +880 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-port-arch.h +111 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-port.h +2227 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-string.h +171 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-type-util.h +183 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/prime_tables.h +126 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample1.cc +66 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample1.h +41 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample10_unittest.cc +139 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample1_unittest.cc +151 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample2.cc +54 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample2.h +81 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample2_unittest.cc +107 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample3-inl.h +172 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample3_unittest.cc +149 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample4.cc +54 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample4.h +53 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample4_unittest.cc +53 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample5_unittest.cc +196 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample6_unittest.cc +224 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample7_unittest.cc +117 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample8_unittest.cc +154 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample9_unittest.cc +156 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/README.md +5 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/common.py +83 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/fuse_gtest_files.py +253 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/gen_gtest_pred_impl.py +734 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/gtest-config.in +274 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/release_docs.py +158 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/run_with_path.py +32 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/upload.py +1402 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/upload_gtest.py +78 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-all.cc +48 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-death-test.cc +1653 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-filepath.cc +382 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-internal-inl.h +1211 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-matchers.cc +97 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-port.cc +1399 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-printers.cc +442 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-test-part.cc +108 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-typed-test.cc +118 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest.cc +6180 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest_main.cc +54 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/BUILD.bazel +529 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-break-on-failure-unittest.py +208 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-break-on-failure-unittest_.cc +86 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-catch-exceptions-test.py +236 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-catch-exceptions-test_.cc +293 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-color-test.py +127 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-color-test_.cc +62 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-death-test-test.cc +1516 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-death-test_ex_test.cc +92 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-env-var-test.py +117 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-env-var-test_.cc +122 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-filepath-test.cc +649 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-filter-unittest.py +639 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-filter-unittest_.cc +137 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-json-outfiles-test.py +191 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-json-output-unittest.py +778 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-list-tests-unittest.py +205 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-list-tests-unittest_.cc +156 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-listener-test.cc +518 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-message-test.cc +158 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-options-test.cc +216 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-output-test-golden-lin.txt +1137 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-output-test.py +346 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-output-test_.cc +1149 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name1-test.py +63 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name1-test_.cc +50 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name2-test.py +62 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name2-test_.cc +55 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-test.cc +1086 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-test.h +51 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test2-test.cc +61 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-port-test.cc +1272 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-printers-test.cc +1619 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-shuffle-test.py +323 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-shuffle-test_.cc +101 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-test-part-test.cc +230 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-test2_test.cc +61 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-throw-on-failure-test.py +168 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-throw-on-failure-test_.cc +71 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-uninitialized-test.py +67 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-uninitialized-test_.cc +42 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest-typed-test2_test.cc +44 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest-typed-test_test.cc +462 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest-typed-test_test.h +65 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest-unittest-api_test.cc +341 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_all_test.cc +46 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_assert_by_exception_test.cc +116 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_environment_test.cc +188 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_help_test.py +170 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_help_test_.cc +45 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_json_test_utils.py +60 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_list_output_unittest.py +141 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_list_output_unittest_.cc +51 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_main_unittest.cc +44 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_no_test_unittest.cc +54 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_pred_impl_unittest.cc +2427 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_premature_exit_test.cc +126 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_prod_test.cc +56 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_repeat_test.cc +233 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_check_output_test.py +59 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_environment_check_output_test.py +54 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc +49 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_test.cc +55 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_sole_header_test.cc +56 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_stress_test.cc +248 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_test_macro_stack_footprint_test.cc +89 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_test_utils.py +314 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_testbridge_test.py +63 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_testbridge_test_.cc +43 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_throw_on_failure_ex_test.cc +90 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_unittest.cc +7496 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_outfile1_test_.cc +43 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_outfile2_test_.cc +43 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_outfiles_test.py +135 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_output_unittest.py +389 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_output_unittest_.cc +188 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_test_utils.py +196 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/production.cc +35 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/production.h +54 -0
- package/cpp/leveldb/third_party/googletest/library.json +66 -0
- package/cpp/leveldb/third_party/googletest/platformio.ini +47 -0
- package/cpp/leveldb/util/arena.cc +66 -0
- package/cpp/leveldb/util/arena.h +71 -0
- package/cpp/leveldb/util/arena_test.cc +66 -0
- package/cpp/leveldb/util/bloom.cc +92 -0
- package/cpp/leveldb/util/bloom_test.cc +159 -0
- package/cpp/leveldb/util/cache.cc +401 -0
- package/cpp/leveldb/util/cache_test.cc +229 -0
- package/cpp/leveldb/util/coding.cc +166 -0
- package/cpp/leveldb/util/coding.h +122 -0
- package/cpp/leveldb/util/coding_test.cc +198 -0
- package/cpp/leveldb/util/comparator.cc +75 -0
- package/cpp/leveldb/util/crc32c.cc +380 -0
- package/cpp/leveldb/util/crc32c.h +43 -0
- package/cpp/leveldb/util/crc32c_test.cc +61 -0
- package/cpp/leveldb/util/env.cc +108 -0
- package/cpp/leveldb/util/env_posix.cc +893 -0
- package/cpp/leveldb/util/env_posix_test.cc +353 -0
- package/cpp/leveldb/util/env_posix_test_helper.h +28 -0
- package/cpp/leveldb/util/env_test.cc +240 -0
- package/cpp/leveldb/util/env_windows.cc +796 -0
- package/cpp/leveldb/util/env_windows_test.cc +65 -0
- package/cpp/leveldb/util/env_windows_test_helper.h +25 -0
- package/cpp/leveldb/util/filter_policy.cc +11 -0
- package/cpp/leveldb/util/hash.cc +55 -0
- package/cpp/leveldb/util/hash.h +19 -0
- package/cpp/leveldb/util/hash_test.cc +46 -0
- package/cpp/leveldb/util/histogram.cc +272 -0
- package/cpp/leveldb/util/histogram.h +44 -0
- package/cpp/leveldb/util/logging.cc +82 -0
- package/cpp/leveldb/util/logging.h +44 -0
- package/cpp/leveldb/util/logging_test.cc +145 -0
- package/cpp/leveldb/util/mutexlock.h +39 -0
- package/cpp/leveldb/util/no_destructor.h +46 -0
- package/cpp/leveldb/util/no_destructor_test.cc +49 -0
- package/cpp/leveldb/util/options.cc +14 -0
- package/cpp/leveldb/util/posix_logger.h +130 -0
- package/cpp/leveldb/util/random.h +63 -0
- package/cpp/leveldb/util/status.cc +77 -0
- package/cpp/leveldb/util/status_test.cc +44 -0
- package/cpp/leveldb/util/testutil.cc +51 -0
- package/cpp/leveldb/util/testutil.h +82 -0
- package/cpp/leveldb/util/windows_logger.h +124 -0
- package/cpp/react-native-leveldb.cpp +694 -0
- package/cpp/react-native-leveldb.h +4 -0
- package/ios/Leveldb.h +9 -0
- package/ios/Leveldb.mm +35 -0
- package/ios/Leveldb.xcodeproj/project.pbxproj +288 -0
- package/lib/commonjs/fake.js +181 -0
- package/lib/commonjs/fake.js.map +1 -0
- package/lib/commonjs/fake.test.js +30 -0
- package/lib/commonjs/fake.test.js.map +1 -0
- package/lib/commonjs/index.js +172 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/fake.js +171 -0
- package/lib/module/fake.js.map +1 -0
- package/lib/module/fake.test.js +30 -0
- package/lib/module/fake.test.js.map +1 -0
- package/lib/module/index.js +165 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/fake.d.ts +34 -0
- package/lib/typescript/fake.d.ts.map +1 -0
- package/lib/typescript/fake.test.d.ts +2 -0
- package/lib/typescript/fake.test.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +72 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +157 -0
- package/rn-leveldb.podspec +30 -0
- package/src/fake.test.ts +37 -0
- package/src/fake.ts +203 -0
- package/src/index.ts +291 -0
|
@@ -0,0 +1,1411 @@
|
|
|
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
|
+
// The Google C++ Testing and Mocking Framework (Google Test)
|
|
31
|
+
//
|
|
32
|
+
// This header file declares functions and macros used internally by
|
|
33
|
+
// Google Test. They are subject to change without notice.
|
|
34
|
+
|
|
35
|
+
// GOOGLETEST_CM0001 DO NOT DELETE
|
|
36
|
+
|
|
37
|
+
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
|
|
38
|
+
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
|
|
39
|
+
|
|
40
|
+
#include "gtest/internal/gtest-port.h"
|
|
41
|
+
|
|
42
|
+
#if GTEST_OS_LINUX
|
|
43
|
+
# include <stdlib.h>
|
|
44
|
+
# include <sys/types.h>
|
|
45
|
+
# include <sys/wait.h>
|
|
46
|
+
# include <unistd.h>
|
|
47
|
+
#endif // GTEST_OS_LINUX
|
|
48
|
+
|
|
49
|
+
#if GTEST_HAS_EXCEPTIONS
|
|
50
|
+
# include <stdexcept>
|
|
51
|
+
#endif
|
|
52
|
+
|
|
53
|
+
#include <ctype.h>
|
|
54
|
+
#include <float.h>
|
|
55
|
+
#include <string.h>
|
|
56
|
+
#include <iomanip>
|
|
57
|
+
#include <limits>
|
|
58
|
+
#include <map>
|
|
59
|
+
#include <set>
|
|
60
|
+
#include <string>
|
|
61
|
+
#include <type_traits>
|
|
62
|
+
#include <vector>
|
|
63
|
+
|
|
64
|
+
#include "gtest/gtest-message.h"
|
|
65
|
+
#include "gtest/internal/gtest-filepath.h"
|
|
66
|
+
#include "gtest/internal/gtest-string.h"
|
|
67
|
+
#include "gtest/internal/gtest-type-util.h"
|
|
68
|
+
|
|
69
|
+
// Due to C++ preprocessor weirdness, we need double indirection to
|
|
70
|
+
// concatenate two tokens when one of them is __LINE__. Writing
|
|
71
|
+
//
|
|
72
|
+
// foo ## __LINE__
|
|
73
|
+
//
|
|
74
|
+
// will result in the token foo__LINE__, instead of foo followed by
|
|
75
|
+
// the current line number. For more details, see
|
|
76
|
+
// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
|
|
77
|
+
#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
|
|
78
|
+
#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
|
|
79
|
+
|
|
80
|
+
// Stringifies its argument.
|
|
81
|
+
#define GTEST_STRINGIFY_(name) #name
|
|
82
|
+
|
|
83
|
+
namespace proto2 { class Message; }
|
|
84
|
+
|
|
85
|
+
namespace testing {
|
|
86
|
+
|
|
87
|
+
// Forward declarations.
|
|
88
|
+
|
|
89
|
+
class AssertionResult; // Result of an assertion.
|
|
90
|
+
class Message; // Represents a failure message.
|
|
91
|
+
class Test; // Represents a test.
|
|
92
|
+
class TestInfo; // Information about a test.
|
|
93
|
+
class TestPartResult; // Result of a test part.
|
|
94
|
+
class UnitTest; // A collection of test suites.
|
|
95
|
+
|
|
96
|
+
template <typename T>
|
|
97
|
+
::std::string PrintToString(const T& value);
|
|
98
|
+
|
|
99
|
+
namespace internal {
|
|
100
|
+
|
|
101
|
+
struct TraceInfo; // Information about a trace point.
|
|
102
|
+
class TestInfoImpl; // Opaque implementation of TestInfo
|
|
103
|
+
class UnitTestImpl; // Opaque implementation of UnitTest
|
|
104
|
+
|
|
105
|
+
// The text used in failure messages to indicate the start of the
|
|
106
|
+
// stack trace.
|
|
107
|
+
GTEST_API_ extern const char kStackTraceMarker[];
|
|
108
|
+
|
|
109
|
+
// An IgnoredValue object can be implicitly constructed from ANY value.
|
|
110
|
+
class IgnoredValue {
|
|
111
|
+
struct Sink {};
|
|
112
|
+
public:
|
|
113
|
+
// This constructor template allows any value to be implicitly
|
|
114
|
+
// converted to IgnoredValue. The object has no data member and
|
|
115
|
+
// doesn't try to remember anything about the argument. We
|
|
116
|
+
// deliberately omit the 'explicit' keyword in order to allow the
|
|
117
|
+
// conversion to be implicit.
|
|
118
|
+
// Disable the conversion if T already has a magical conversion operator.
|
|
119
|
+
// Otherwise we get ambiguity.
|
|
120
|
+
template <typename T,
|
|
121
|
+
typename std::enable_if<!std::is_convertible<T, Sink>::value,
|
|
122
|
+
int>::type = 0>
|
|
123
|
+
IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Appends the user-supplied message to the Google-Test-generated message.
|
|
127
|
+
GTEST_API_ std::string AppendUserMessage(
|
|
128
|
+
const std::string& gtest_msg, const Message& user_msg);
|
|
129
|
+
|
|
130
|
+
#if GTEST_HAS_EXCEPTIONS
|
|
131
|
+
|
|
132
|
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4275 \
|
|
133
|
+
/* an exported class was derived from a class that was not exported */)
|
|
134
|
+
|
|
135
|
+
// This exception is thrown by (and only by) a failed Google Test
|
|
136
|
+
// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
|
|
137
|
+
// are enabled). We derive it from std::runtime_error, which is for
|
|
138
|
+
// errors presumably detectable only at run time. Since
|
|
139
|
+
// std::runtime_error inherits from std::exception, many testing
|
|
140
|
+
// frameworks know how to extract and print the message inside it.
|
|
141
|
+
class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
|
|
142
|
+
public:
|
|
143
|
+
explicit GoogleTestFailureException(const TestPartResult& failure);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4275
|
|
147
|
+
|
|
148
|
+
#endif // GTEST_HAS_EXCEPTIONS
|
|
149
|
+
|
|
150
|
+
namespace edit_distance {
|
|
151
|
+
// Returns the optimal edits to go from 'left' to 'right'.
|
|
152
|
+
// All edits cost the same, with replace having lower priority than
|
|
153
|
+
// add/remove.
|
|
154
|
+
// Simple implementation of the Wagner-Fischer algorithm.
|
|
155
|
+
// See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
|
|
156
|
+
enum EditType { kMatch, kAdd, kRemove, kReplace };
|
|
157
|
+
GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
|
|
158
|
+
const std::vector<size_t>& left, const std::vector<size_t>& right);
|
|
159
|
+
|
|
160
|
+
// Same as above, but the input is represented as strings.
|
|
161
|
+
GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
|
|
162
|
+
const std::vector<std::string>& left,
|
|
163
|
+
const std::vector<std::string>& right);
|
|
164
|
+
|
|
165
|
+
// Create a diff of the input strings in Unified diff format.
|
|
166
|
+
GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left,
|
|
167
|
+
const std::vector<std::string>& right,
|
|
168
|
+
size_t context = 2);
|
|
169
|
+
|
|
170
|
+
} // namespace edit_distance
|
|
171
|
+
|
|
172
|
+
// Calculate the diff between 'left' and 'right' and return it in unified diff
|
|
173
|
+
// format.
|
|
174
|
+
// If not null, stores in 'total_line_count' the total number of lines found
|
|
175
|
+
// in left + right.
|
|
176
|
+
GTEST_API_ std::string DiffStrings(const std::string& left,
|
|
177
|
+
const std::string& right,
|
|
178
|
+
size_t* total_line_count);
|
|
179
|
+
|
|
180
|
+
// Constructs and returns the message for an equality assertion
|
|
181
|
+
// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
|
|
182
|
+
//
|
|
183
|
+
// The first four parameters are the expressions used in the assertion
|
|
184
|
+
// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
|
|
185
|
+
// where foo is 5 and bar is 6, we have:
|
|
186
|
+
//
|
|
187
|
+
// expected_expression: "foo"
|
|
188
|
+
// actual_expression: "bar"
|
|
189
|
+
// expected_value: "5"
|
|
190
|
+
// actual_value: "6"
|
|
191
|
+
//
|
|
192
|
+
// The ignoring_case parameter is true if and only if the assertion is a
|
|
193
|
+
// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
|
|
194
|
+
// be inserted into the message.
|
|
195
|
+
GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
|
|
196
|
+
const char* actual_expression,
|
|
197
|
+
const std::string& expected_value,
|
|
198
|
+
const std::string& actual_value,
|
|
199
|
+
bool ignoring_case);
|
|
200
|
+
|
|
201
|
+
// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
|
|
202
|
+
GTEST_API_ std::string GetBoolAssertionFailureMessage(
|
|
203
|
+
const AssertionResult& assertion_result,
|
|
204
|
+
const char* expression_text,
|
|
205
|
+
const char* actual_predicate_value,
|
|
206
|
+
const char* expected_predicate_value);
|
|
207
|
+
|
|
208
|
+
// This template class represents an IEEE floating-point number
|
|
209
|
+
// (either single-precision or double-precision, depending on the
|
|
210
|
+
// template parameters).
|
|
211
|
+
//
|
|
212
|
+
// The purpose of this class is to do more sophisticated number
|
|
213
|
+
// comparison. (Due to round-off error, etc, it's very unlikely that
|
|
214
|
+
// two floating-points will be equal exactly. Hence a naive
|
|
215
|
+
// comparison by the == operation often doesn't work.)
|
|
216
|
+
//
|
|
217
|
+
// Format of IEEE floating-point:
|
|
218
|
+
//
|
|
219
|
+
// The most-significant bit being the leftmost, an IEEE
|
|
220
|
+
// floating-point looks like
|
|
221
|
+
//
|
|
222
|
+
// sign_bit exponent_bits fraction_bits
|
|
223
|
+
//
|
|
224
|
+
// Here, sign_bit is a single bit that designates the sign of the
|
|
225
|
+
// number.
|
|
226
|
+
//
|
|
227
|
+
// For float, there are 8 exponent bits and 23 fraction bits.
|
|
228
|
+
//
|
|
229
|
+
// For double, there are 11 exponent bits and 52 fraction bits.
|
|
230
|
+
//
|
|
231
|
+
// More details can be found at
|
|
232
|
+
// http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
|
|
233
|
+
//
|
|
234
|
+
// Template parameter:
|
|
235
|
+
//
|
|
236
|
+
// RawType: the raw floating-point type (either float or double)
|
|
237
|
+
template <typename RawType>
|
|
238
|
+
class FloatingPoint {
|
|
239
|
+
public:
|
|
240
|
+
// Defines the unsigned integer type that has the same size as the
|
|
241
|
+
// floating point number.
|
|
242
|
+
typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
|
|
243
|
+
|
|
244
|
+
// Constants.
|
|
245
|
+
|
|
246
|
+
// # of bits in a number.
|
|
247
|
+
static const size_t kBitCount = 8*sizeof(RawType);
|
|
248
|
+
|
|
249
|
+
// # of fraction bits in a number.
|
|
250
|
+
static const size_t kFractionBitCount =
|
|
251
|
+
std::numeric_limits<RawType>::digits - 1;
|
|
252
|
+
|
|
253
|
+
// # of exponent bits in a number.
|
|
254
|
+
static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
|
|
255
|
+
|
|
256
|
+
// The mask for the sign bit.
|
|
257
|
+
static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
|
|
258
|
+
|
|
259
|
+
// The mask for the fraction bits.
|
|
260
|
+
static const Bits kFractionBitMask =
|
|
261
|
+
~static_cast<Bits>(0) >> (kExponentBitCount + 1);
|
|
262
|
+
|
|
263
|
+
// The mask for the exponent bits.
|
|
264
|
+
static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
|
|
265
|
+
|
|
266
|
+
// How many ULP's (Units in the Last Place) we want to tolerate when
|
|
267
|
+
// comparing two numbers. The larger the value, the more error we
|
|
268
|
+
// allow. A 0 value means that two numbers must be exactly the same
|
|
269
|
+
// to be considered equal.
|
|
270
|
+
//
|
|
271
|
+
// The maximum error of a single floating-point operation is 0.5
|
|
272
|
+
// units in the last place. On Intel CPU's, all floating-point
|
|
273
|
+
// calculations are done with 80-bit precision, while double has 64
|
|
274
|
+
// bits. Therefore, 4 should be enough for ordinary use.
|
|
275
|
+
//
|
|
276
|
+
// See the following article for more details on ULP:
|
|
277
|
+
// http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
|
|
278
|
+
static const size_t kMaxUlps = 4;
|
|
279
|
+
|
|
280
|
+
// Constructs a FloatingPoint from a raw floating-point number.
|
|
281
|
+
//
|
|
282
|
+
// On an Intel CPU, passing a non-normalized NAN (Not a Number)
|
|
283
|
+
// around may change its bits, although the new value is guaranteed
|
|
284
|
+
// to be also a NAN. Therefore, don't expect this constructor to
|
|
285
|
+
// preserve the bits in x when x is a NAN.
|
|
286
|
+
explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
|
|
287
|
+
|
|
288
|
+
// Static methods
|
|
289
|
+
|
|
290
|
+
// Reinterprets a bit pattern as a floating-point number.
|
|
291
|
+
//
|
|
292
|
+
// This function is needed to test the AlmostEquals() method.
|
|
293
|
+
static RawType ReinterpretBits(const Bits bits) {
|
|
294
|
+
FloatingPoint fp(0);
|
|
295
|
+
fp.u_.bits_ = bits;
|
|
296
|
+
return fp.u_.value_;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Returns the floating-point number that represent positive infinity.
|
|
300
|
+
static RawType Infinity() {
|
|
301
|
+
return ReinterpretBits(kExponentBitMask);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Returns the maximum representable finite floating-point number.
|
|
305
|
+
static RawType Max();
|
|
306
|
+
|
|
307
|
+
// Non-static methods
|
|
308
|
+
|
|
309
|
+
// Returns the bits that represents this number.
|
|
310
|
+
const Bits &bits() const { return u_.bits_; }
|
|
311
|
+
|
|
312
|
+
// Returns the exponent bits of this number.
|
|
313
|
+
Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
|
|
314
|
+
|
|
315
|
+
// Returns the fraction bits of this number.
|
|
316
|
+
Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
|
|
317
|
+
|
|
318
|
+
// Returns the sign bit of this number.
|
|
319
|
+
Bits sign_bit() const { return kSignBitMask & u_.bits_; }
|
|
320
|
+
|
|
321
|
+
// Returns true if and only if this is NAN (not a number).
|
|
322
|
+
bool is_nan() const {
|
|
323
|
+
// It's a NAN if the exponent bits are all ones and the fraction
|
|
324
|
+
// bits are not entirely zeros.
|
|
325
|
+
return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Returns true if and only if this number is at most kMaxUlps ULP's away
|
|
329
|
+
// from rhs. In particular, this function:
|
|
330
|
+
//
|
|
331
|
+
// - returns false if either number is (or both are) NAN.
|
|
332
|
+
// - treats really large numbers as almost equal to infinity.
|
|
333
|
+
// - thinks +0.0 and -0.0 are 0 DLP's apart.
|
|
334
|
+
bool AlmostEquals(const FloatingPoint& rhs) const {
|
|
335
|
+
// The IEEE standard says that any comparison operation involving
|
|
336
|
+
// a NAN must return false.
|
|
337
|
+
if (is_nan() || rhs.is_nan()) return false;
|
|
338
|
+
|
|
339
|
+
return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
|
|
340
|
+
<= kMaxUlps;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
private:
|
|
344
|
+
// The data type used to store the actual floating-point number.
|
|
345
|
+
union FloatingPointUnion {
|
|
346
|
+
RawType value_; // The raw floating-point number.
|
|
347
|
+
Bits bits_; // The bits that represent the number.
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// Converts an integer from the sign-and-magnitude representation to
|
|
351
|
+
// the biased representation. More precisely, let N be 2 to the
|
|
352
|
+
// power of (kBitCount - 1), an integer x is represented by the
|
|
353
|
+
// unsigned number x + N.
|
|
354
|
+
//
|
|
355
|
+
// For instance,
|
|
356
|
+
//
|
|
357
|
+
// -N + 1 (the most negative number representable using
|
|
358
|
+
// sign-and-magnitude) is represented by 1;
|
|
359
|
+
// 0 is represented by N; and
|
|
360
|
+
// N - 1 (the biggest number representable using
|
|
361
|
+
// sign-and-magnitude) is represented by 2N - 1.
|
|
362
|
+
//
|
|
363
|
+
// Read http://en.wikipedia.org/wiki/Signed_number_representations
|
|
364
|
+
// for more details on signed number representations.
|
|
365
|
+
static Bits SignAndMagnitudeToBiased(const Bits &sam) {
|
|
366
|
+
if (kSignBitMask & sam) {
|
|
367
|
+
// sam represents a negative number.
|
|
368
|
+
return ~sam + 1;
|
|
369
|
+
} else {
|
|
370
|
+
// sam represents a positive number.
|
|
371
|
+
return kSignBitMask | sam;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// Given two numbers in the sign-and-magnitude representation,
|
|
376
|
+
// returns the distance between them as an unsigned number.
|
|
377
|
+
static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
|
|
378
|
+
const Bits &sam2) {
|
|
379
|
+
const Bits biased1 = SignAndMagnitudeToBiased(sam1);
|
|
380
|
+
const Bits biased2 = SignAndMagnitudeToBiased(sam2);
|
|
381
|
+
return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
FloatingPointUnion u_;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
// We cannot use std::numeric_limits<T>::max() as it clashes with the max()
|
|
388
|
+
// macro defined by <windows.h>.
|
|
389
|
+
template <>
|
|
390
|
+
inline float FloatingPoint<float>::Max() { return FLT_MAX; }
|
|
391
|
+
template <>
|
|
392
|
+
inline double FloatingPoint<double>::Max() { return DBL_MAX; }
|
|
393
|
+
|
|
394
|
+
// Typedefs the instances of the FloatingPoint template class that we
|
|
395
|
+
// care to use.
|
|
396
|
+
typedef FloatingPoint<float> Float;
|
|
397
|
+
typedef FloatingPoint<double> Double;
|
|
398
|
+
|
|
399
|
+
// In order to catch the mistake of putting tests that use different
|
|
400
|
+
// test fixture classes in the same test suite, we need to assign
|
|
401
|
+
// unique IDs to fixture classes and compare them. The TypeId type is
|
|
402
|
+
// used to hold such IDs. The user should treat TypeId as an opaque
|
|
403
|
+
// type: the only operation allowed on TypeId values is to compare
|
|
404
|
+
// them for equality using the == operator.
|
|
405
|
+
typedef const void* TypeId;
|
|
406
|
+
|
|
407
|
+
template <typename T>
|
|
408
|
+
class TypeIdHelper {
|
|
409
|
+
public:
|
|
410
|
+
// dummy_ must not have a const type. Otherwise an overly eager
|
|
411
|
+
// compiler (e.g. MSVC 7.1 & 8.0) may try to merge
|
|
412
|
+
// TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
|
|
413
|
+
static bool dummy_;
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
template <typename T>
|
|
417
|
+
bool TypeIdHelper<T>::dummy_ = false;
|
|
418
|
+
|
|
419
|
+
// GetTypeId<T>() returns the ID of type T. Different values will be
|
|
420
|
+
// returned for different types. Calling the function twice with the
|
|
421
|
+
// same type argument is guaranteed to return the same ID.
|
|
422
|
+
template <typename T>
|
|
423
|
+
TypeId GetTypeId() {
|
|
424
|
+
// The compiler is required to allocate a different
|
|
425
|
+
// TypeIdHelper<T>::dummy_ variable for each T used to instantiate
|
|
426
|
+
// the template. Therefore, the address of dummy_ is guaranteed to
|
|
427
|
+
// be unique.
|
|
428
|
+
return &(TypeIdHelper<T>::dummy_);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// Returns the type ID of ::testing::Test. Always call this instead
|
|
432
|
+
// of GetTypeId< ::testing::Test>() to get the type ID of
|
|
433
|
+
// ::testing::Test, as the latter may give the wrong result due to a
|
|
434
|
+
// suspected linker bug when compiling Google Test as a Mac OS X
|
|
435
|
+
// framework.
|
|
436
|
+
GTEST_API_ TypeId GetTestTypeId();
|
|
437
|
+
|
|
438
|
+
// Defines the abstract factory interface that creates instances
|
|
439
|
+
// of a Test object.
|
|
440
|
+
class TestFactoryBase {
|
|
441
|
+
public:
|
|
442
|
+
virtual ~TestFactoryBase() {}
|
|
443
|
+
|
|
444
|
+
// Creates a test instance to run. The instance is both created and destroyed
|
|
445
|
+
// within TestInfoImpl::Run()
|
|
446
|
+
virtual Test* CreateTest() = 0;
|
|
447
|
+
|
|
448
|
+
protected:
|
|
449
|
+
TestFactoryBase() {}
|
|
450
|
+
|
|
451
|
+
private:
|
|
452
|
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
// This class provides implementation of TeastFactoryBase interface.
|
|
456
|
+
// It is used in TEST and TEST_F macros.
|
|
457
|
+
template <class TestClass>
|
|
458
|
+
class TestFactoryImpl : public TestFactoryBase {
|
|
459
|
+
public:
|
|
460
|
+
Test* CreateTest() override { return new TestClass; }
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
#if GTEST_OS_WINDOWS
|
|
464
|
+
|
|
465
|
+
// Predicate-formatters for implementing the HRESULT checking macros
|
|
466
|
+
// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
|
|
467
|
+
// We pass a long instead of HRESULT to avoid causing an
|
|
468
|
+
// include dependency for the HRESULT type.
|
|
469
|
+
GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
|
|
470
|
+
long hr); // NOLINT
|
|
471
|
+
GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
|
|
472
|
+
long hr); // NOLINT
|
|
473
|
+
|
|
474
|
+
#endif // GTEST_OS_WINDOWS
|
|
475
|
+
|
|
476
|
+
// Types of SetUpTestSuite() and TearDownTestSuite() functions.
|
|
477
|
+
using SetUpTestSuiteFunc = void (*)();
|
|
478
|
+
using TearDownTestSuiteFunc = void (*)();
|
|
479
|
+
|
|
480
|
+
struct CodeLocation {
|
|
481
|
+
CodeLocation(const std::string& a_file, int a_line)
|
|
482
|
+
: file(a_file), line(a_line) {}
|
|
483
|
+
|
|
484
|
+
std::string file;
|
|
485
|
+
int line;
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
// Helper to identify which setup function for TestCase / TestSuite to call.
|
|
489
|
+
// Only one function is allowed, either TestCase or TestSute but not both.
|
|
490
|
+
|
|
491
|
+
// Utility functions to help SuiteApiResolver
|
|
492
|
+
using SetUpTearDownSuiteFuncType = void (*)();
|
|
493
|
+
|
|
494
|
+
inline SetUpTearDownSuiteFuncType GetNotDefaultOrNull(
|
|
495
|
+
SetUpTearDownSuiteFuncType a, SetUpTearDownSuiteFuncType def) {
|
|
496
|
+
return a == def ? nullptr : a;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
template <typename T>
|
|
500
|
+
// Note that SuiteApiResolver inherits from T because
|
|
501
|
+
// SetUpTestSuite()/TearDownTestSuite() could be protected. Ths way
|
|
502
|
+
// SuiteApiResolver can access them.
|
|
503
|
+
struct SuiteApiResolver : T {
|
|
504
|
+
// testing::Test is only forward declared at this point. So we make it a
|
|
505
|
+
// dependend class for the compiler to be OK with it.
|
|
506
|
+
using Test =
|
|
507
|
+
typename std::conditional<sizeof(T) != 0, ::testing::Test, void>::type;
|
|
508
|
+
|
|
509
|
+
static SetUpTearDownSuiteFuncType GetSetUpCaseOrSuite(const char* filename,
|
|
510
|
+
int line_num) {
|
|
511
|
+
SetUpTearDownSuiteFuncType test_case_fp =
|
|
512
|
+
GetNotDefaultOrNull(&T::SetUpTestCase, &Test::SetUpTestCase);
|
|
513
|
+
SetUpTearDownSuiteFuncType test_suite_fp =
|
|
514
|
+
GetNotDefaultOrNull(&T::SetUpTestSuite, &Test::SetUpTestSuite);
|
|
515
|
+
|
|
516
|
+
GTEST_CHECK_(!test_case_fp || !test_suite_fp)
|
|
517
|
+
<< "Test can not provide both SetUpTestSuite and SetUpTestCase, please "
|
|
518
|
+
"make sure there is only one present at "
|
|
519
|
+
<< filename << ":" << line_num;
|
|
520
|
+
|
|
521
|
+
return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
static SetUpTearDownSuiteFuncType GetTearDownCaseOrSuite(const char* filename,
|
|
525
|
+
int line_num) {
|
|
526
|
+
SetUpTearDownSuiteFuncType test_case_fp =
|
|
527
|
+
GetNotDefaultOrNull(&T::TearDownTestCase, &Test::TearDownTestCase);
|
|
528
|
+
SetUpTearDownSuiteFuncType test_suite_fp =
|
|
529
|
+
GetNotDefaultOrNull(&T::TearDownTestSuite, &Test::TearDownTestSuite);
|
|
530
|
+
|
|
531
|
+
GTEST_CHECK_(!test_case_fp || !test_suite_fp)
|
|
532
|
+
<< "Test can not provide both TearDownTestSuite and TearDownTestCase,"
|
|
533
|
+
" please make sure there is only one present at"
|
|
534
|
+
<< filename << ":" << line_num;
|
|
535
|
+
|
|
536
|
+
return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
// Creates a new TestInfo object and registers it with Google Test;
|
|
541
|
+
// returns the created object.
|
|
542
|
+
//
|
|
543
|
+
// Arguments:
|
|
544
|
+
//
|
|
545
|
+
// test_suite_name: name of the test suite
|
|
546
|
+
// name: name of the test
|
|
547
|
+
// type_param the name of the test's type parameter, or NULL if
|
|
548
|
+
// this is not a typed or a type-parameterized test.
|
|
549
|
+
// value_param text representation of the test's value parameter,
|
|
550
|
+
// or NULL if this is not a type-parameterized test.
|
|
551
|
+
// code_location: code location where the test is defined
|
|
552
|
+
// fixture_class_id: ID of the test fixture class
|
|
553
|
+
// set_up_tc: pointer to the function that sets up the test suite
|
|
554
|
+
// tear_down_tc: pointer to the function that tears down the test suite
|
|
555
|
+
// factory: pointer to the factory that creates a test object.
|
|
556
|
+
// The newly created TestInfo instance will assume
|
|
557
|
+
// ownership of the factory object.
|
|
558
|
+
GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
|
|
559
|
+
const char* test_suite_name, const char* name, const char* type_param,
|
|
560
|
+
const char* value_param, CodeLocation code_location,
|
|
561
|
+
TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc,
|
|
562
|
+
TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory);
|
|
563
|
+
|
|
564
|
+
// If *pstr starts with the given prefix, modifies *pstr to be right
|
|
565
|
+
// past the prefix and returns true; otherwise leaves *pstr unchanged
|
|
566
|
+
// and returns false. None of pstr, *pstr, and prefix can be NULL.
|
|
567
|
+
GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
|
|
568
|
+
|
|
569
|
+
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
|
570
|
+
|
|
571
|
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
|
572
|
+
/* class A needs to have dll-interface to be used by clients of class B */)
|
|
573
|
+
|
|
574
|
+
// State of the definition of a type-parameterized test suite.
|
|
575
|
+
class GTEST_API_ TypedTestSuitePState {
|
|
576
|
+
public:
|
|
577
|
+
TypedTestSuitePState() : registered_(false) {}
|
|
578
|
+
|
|
579
|
+
// Adds the given test name to defined_test_names_ and return true
|
|
580
|
+
// if the test suite hasn't been registered; otherwise aborts the
|
|
581
|
+
// program.
|
|
582
|
+
bool AddTestName(const char* file, int line, const char* case_name,
|
|
583
|
+
const char* test_name) {
|
|
584
|
+
if (registered_) {
|
|
585
|
+
fprintf(stderr,
|
|
586
|
+
"%s Test %s must be defined before "
|
|
587
|
+
"REGISTER_TYPED_TEST_SUITE_P(%s, ...).\n",
|
|
588
|
+
FormatFileLocation(file, line).c_str(), test_name, case_name);
|
|
589
|
+
fflush(stderr);
|
|
590
|
+
posix::Abort();
|
|
591
|
+
}
|
|
592
|
+
registered_tests_.insert(
|
|
593
|
+
::std::make_pair(test_name, CodeLocation(file, line)));
|
|
594
|
+
return true;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
bool TestExists(const std::string& test_name) const {
|
|
598
|
+
return registered_tests_.count(test_name) > 0;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
const CodeLocation& GetCodeLocation(const std::string& test_name) const {
|
|
602
|
+
RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
|
|
603
|
+
GTEST_CHECK_(it != registered_tests_.end());
|
|
604
|
+
return it->second;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// Verifies that registered_tests match the test names in
|
|
608
|
+
// defined_test_names_; returns registered_tests if successful, or
|
|
609
|
+
// aborts the program otherwise.
|
|
610
|
+
const char* VerifyRegisteredTestNames(
|
|
611
|
+
const char* file, int line, const char* registered_tests);
|
|
612
|
+
|
|
613
|
+
private:
|
|
614
|
+
typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
|
|
615
|
+
|
|
616
|
+
bool registered_;
|
|
617
|
+
RegisteredTestsMap registered_tests_;
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
// Legacy API is deprecated but still available
|
|
621
|
+
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
|
622
|
+
using TypedTestCasePState = TypedTestSuitePState;
|
|
623
|
+
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
|
624
|
+
|
|
625
|
+
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
|
626
|
+
|
|
627
|
+
// Skips to the first non-space char after the first comma in 'str';
|
|
628
|
+
// returns NULL if no comma is found in 'str'.
|
|
629
|
+
inline const char* SkipComma(const char* str) {
|
|
630
|
+
const char* comma = strchr(str, ',');
|
|
631
|
+
if (comma == nullptr) {
|
|
632
|
+
return nullptr;
|
|
633
|
+
}
|
|
634
|
+
while (IsSpace(*(++comma))) {}
|
|
635
|
+
return comma;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// Returns the prefix of 'str' before the first comma in it; returns
|
|
639
|
+
// the entire string if it contains no comma.
|
|
640
|
+
inline std::string GetPrefixUntilComma(const char* str) {
|
|
641
|
+
const char* comma = strchr(str, ',');
|
|
642
|
+
return comma == nullptr ? str : std::string(str, comma);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// Splits a given string on a given delimiter, populating a given
|
|
646
|
+
// vector with the fields.
|
|
647
|
+
void SplitString(const ::std::string& str, char delimiter,
|
|
648
|
+
::std::vector< ::std::string>* dest);
|
|
649
|
+
|
|
650
|
+
// The default argument to the template below for the case when the user does
|
|
651
|
+
// not provide a name generator.
|
|
652
|
+
struct DefaultNameGenerator {
|
|
653
|
+
template <typename T>
|
|
654
|
+
static std::string GetName(int i) {
|
|
655
|
+
return StreamableToString(i);
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
template <typename Provided = DefaultNameGenerator>
|
|
660
|
+
struct NameGeneratorSelector {
|
|
661
|
+
typedef Provided type;
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
template <typename NameGenerator>
|
|
665
|
+
void GenerateNamesRecursively(internal::None, std::vector<std::string>*, int) {}
|
|
666
|
+
|
|
667
|
+
template <typename NameGenerator, typename Types>
|
|
668
|
+
void GenerateNamesRecursively(Types, std::vector<std::string>* result, int i) {
|
|
669
|
+
result->push_back(NameGenerator::template GetName<typename Types::Head>(i));
|
|
670
|
+
GenerateNamesRecursively<NameGenerator>(typename Types::Tail(), result,
|
|
671
|
+
i + 1);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
template <typename NameGenerator, typename Types>
|
|
675
|
+
std::vector<std::string> GenerateNames() {
|
|
676
|
+
std::vector<std::string> result;
|
|
677
|
+
GenerateNamesRecursively<NameGenerator>(Types(), &result, 0);
|
|
678
|
+
return result;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
// TypeParameterizedTest<Fixture, TestSel, Types>::Register()
|
|
682
|
+
// registers a list of type-parameterized tests with Google Test. The
|
|
683
|
+
// return value is insignificant - we just need to return something
|
|
684
|
+
// such that we can call this function in a namespace scope.
|
|
685
|
+
//
|
|
686
|
+
// Implementation note: The GTEST_TEMPLATE_ macro declares a template
|
|
687
|
+
// template parameter. It's defined in gtest-type-util.h.
|
|
688
|
+
template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
|
|
689
|
+
class TypeParameterizedTest {
|
|
690
|
+
public:
|
|
691
|
+
// 'index' is the index of the test in the type list 'Types'
|
|
692
|
+
// specified in INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, TestSuite,
|
|
693
|
+
// Types). Valid values for 'index' are [0, N - 1] where N is the
|
|
694
|
+
// length of Types.
|
|
695
|
+
static bool Register(const char* prefix, const CodeLocation& code_location,
|
|
696
|
+
const char* case_name, const char* test_names, int index,
|
|
697
|
+
const std::vector<std::string>& type_names =
|
|
698
|
+
GenerateNames<DefaultNameGenerator, Types>()) {
|
|
699
|
+
typedef typename Types::Head Type;
|
|
700
|
+
typedef Fixture<Type> FixtureClass;
|
|
701
|
+
typedef typename GTEST_BIND_(TestSel, Type) TestClass;
|
|
702
|
+
|
|
703
|
+
// First, registers the first type-parameterized test in the type
|
|
704
|
+
// list.
|
|
705
|
+
MakeAndRegisterTestInfo(
|
|
706
|
+
(std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name +
|
|
707
|
+
"/" + type_names[static_cast<size_t>(index)])
|
|
708
|
+
.c_str(),
|
|
709
|
+
StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(),
|
|
710
|
+
GetTypeName<Type>().c_str(),
|
|
711
|
+
nullptr, // No value parameter.
|
|
712
|
+
code_location, GetTypeId<FixtureClass>(),
|
|
713
|
+
SuiteApiResolver<TestClass>::GetSetUpCaseOrSuite(
|
|
714
|
+
code_location.file.c_str(), code_location.line),
|
|
715
|
+
SuiteApiResolver<TestClass>::GetTearDownCaseOrSuite(
|
|
716
|
+
code_location.file.c_str(), code_location.line),
|
|
717
|
+
new TestFactoryImpl<TestClass>);
|
|
718
|
+
|
|
719
|
+
// Next, recurses (at compile time) with the tail of the type list.
|
|
720
|
+
return TypeParameterizedTest<Fixture, TestSel,
|
|
721
|
+
typename Types::Tail>::Register(prefix,
|
|
722
|
+
code_location,
|
|
723
|
+
case_name,
|
|
724
|
+
test_names,
|
|
725
|
+
index + 1,
|
|
726
|
+
type_names);
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
// The base case for the compile time recursion.
|
|
731
|
+
template <GTEST_TEMPLATE_ Fixture, class TestSel>
|
|
732
|
+
class TypeParameterizedTest<Fixture, TestSel, internal::None> {
|
|
733
|
+
public:
|
|
734
|
+
static bool Register(const char* /*prefix*/, const CodeLocation&,
|
|
735
|
+
const char* /*case_name*/, const char* /*test_names*/,
|
|
736
|
+
int /*index*/,
|
|
737
|
+
const std::vector<std::string>& =
|
|
738
|
+
std::vector<std::string>() /*type_names*/) {
|
|
739
|
+
return true;
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
// TypeParameterizedTestSuite<Fixture, Tests, Types>::Register()
|
|
744
|
+
// registers *all combinations* of 'Tests' and 'Types' with Google
|
|
745
|
+
// Test. The return value is insignificant - we just need to return
|
|
746
|
+
// something such that we can call this function in a namespace scope.
|
|
747
|
+
template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
|
|
748
|
+
class TypeParameterizedTestSuite {
|
|
749
|
+
public:
|
|
750
|
+
static bool Register(const char* prefix, CodeLocation code_location,
|
|
751
|
+
const TypedTestSuitePState* state, const char* case_name,
|
|
752
|
+
const char* test_names,
|
|
753
|
+
const std::vector<std::string>& type_names =
|
|
754
|
+
GenerateNames<DefaultNameGenerator, Types>()) {
|
|
755
|
+
std::string test_name = StripTrailingSpaces(
|
|
756
|
+
GetPrefixUntilComma(test_names));
|
|
757
|
+
if (!state->TestExists(test_name)) {
|
|
758
|
+
fprintf(stderr, "Failed to get code location for test %s.%s at %s.",
|
|
759
|
+
case_name, test_name.c_str(),
|
|
760
|
+
FormatFileLocation(code_location.file.c_str(),
|
|
761
|
+
code_location.line).c_str());
|
|
762
|
+
fflush(stderr);
|
|
763
|
+
posix::Abort();
|
|
764
|
+
}
|
|
765
|
+
const CodeLocation& test_location = state->GetCodeLocation(test_name);
|
|
766
|
+
|
|
767
|
+
typedef typename Tests::Head Head;
|
|
768
|
+
|
|
769
|
+
// First, register the first test in 'Test' for each type in 'Types'.
|
|
770
|
+
TypeParameterizedTest<Fixture, Head, Types>::Register(
|
|
771
|
+
prefix, test_location, case_name, test_names, 0, type_names);
|
|
772
|
+
|
|
773
|
+
// Next, recurses (at compile time) with the tail of the test list.
|
|
774
|
+
return TypeParameterizedTestSuite<Fixture, typename Tests::Tail,
|
|
775
|
+
Types>::Register(prefix, code_location,
|
|
776
|
+
state, case_name,
|
|
777
|
+
SkipComma(test_names),
|
|
778
|
+
type_names);
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
// The base case for the compile time recursion.
|
|
783
|
+
template <GTEST_TEMPLATE_ Fixture, typename Types>
|
|
784
|
+
class TypeParameterizedTestSuite<Fixture, internal::None, Types> {
|
|
785
|
+
public:
|
|
786
|
+
static bool Register(const char* /*prefix*/, const CodeLocation&,
|
|
787
|
+
const TypedTestSuitePState* /*state*/,
|
|
788
|
+
const char* /*case_name*/, const char* /*test_names*/,
|
|
789
|
+
const std::vector<std::string>& =
|
|
790
|
+
std::vector<std::string>() /*type_names*/) {
|
|
791
|
+
return true;
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
|
796
|
+
|
|
797
|
+
// Returns the current OS stack trace as an std::string.
|
|
798
|
+
//
|
|
799
|
+
// The maximum number of stack frames to be included is specified by
|
|
800
|
+
// the gtest_stack_trace_depth flag. The skip_count parameter
|
|
801
|
+
// specifies the number of top frames to be skipped, which doesn't
|
|
802
|
+
// count against the number of frames to be included.
|
|
803
|
+
//
|
|
804
|
+
// For example, if Foo() calls Bar(), which in turn calls
|
|
805
|
+
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
|
|
806
|
+
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
|
|
807
|
+
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
|
|
808
|
+
UnitTest* unit_test, int skip_count);
|
|
809
|
+
|
|
810
|
+
// Helpers for suppressing warnings on unreachable code or constant
|
|
811
|
+
// condition.
|
|
812
|
+
|
|
813
|
+
// Always returns true.
|
|
814
|
+
GTEST_API_ bool AlwaysTrue();
|
|
815
|
+
|
|
816
|
+
// Always returns false.
|
|
817
|
+
inline bool AlwaysFalse() { return !AlwaysTrue(); }
|
|
818
|
+
|
|
819
|
+
// Helper for suppressing false warning from Clang on a const char*
|
|
820
|
+
// variable declared in a conditional expression always being NULL in
|
|
821
|
+
// the else branch.
|
|
822
|
+
struct GTEST_API_ ConstCharPtr {
|
|
823
|
+
ConstCharPtr(const char* str) : value(str) {}
|
|
824
|
+
operator bool() const { return true; }
|
|
825
|
+
const char* value;
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
// Helper for declaring std::string within 'if' statement
|
|
829
|
+
// in pre C++17 build environment.
|
|
830
|
+
struct GTEST_API_ TrueWithString {
|
|
831
|
+
TrueWithString() = default;
|
|
832
|
+
explicit TrueWithString(const char* str) : value(str) {}
|
|
833
|
+
explicit TrueWithString(const std::string& str) : value(str) {}
|
|
834
|
+
explicit operator bool() const { return true; }
|
|
835
|
+
std::string value;
|
|
836
|
+
};
|
|
837
|
+
|
|
838
|
+
// A simple Linear Congruential Generator for generating random
|
|
839
|
+
// numbers with a uniform distribution. Unlike rand() and srand(), it
|
|
840
|
+
// doesn't use global state (and therefore can't interfere with user
|
|
841
|
+
// code). Unlike rand_r(), it's portable. An LCG isn't very random,
|
|
842
|
+
// but it's good enough for our purposes.
|
|
843
|
+
class GTEST_API_ Random {
|
|
844
|
+
public:
|
|
845
|
+
static const UInt32 kMaxRange = 1u << 31;
|
|
846
|
+
|
|
847
|
+
explicit Random(UInt32 seed) : state_(seed) {}
|
|
848
|
+
|
|
849
|
+
void Reseed(UInt32 seed) { state_ = seed; }
|
|
850
|
+
|
|
851
|
+
// Generates a random number from [0, range). Crashes if 'range' is
|
|
852
|
+
// 0 or greater than kMaxRange.
|
|
853
|
+
UInt32 Generate(UInt32 range);
|
|
854
|
+
|
|
855
|
+
private:
|
|
856
|
+
UInt32 state_;
|
|
857
|
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
// Turns const U&, U&, const U, and U all into U.
|
|
861
|
+
#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
|
|
862
|
+
typename std::remove_const<typename std::remove_reference<T>::type>::type
|
|
863
|
+
|
|
864
|
+
// IsAProtocolMessage<T>::value is a compile-time bool constant that's
|
|
865
|
+
// true if and only if T is type proto2::Message or a subclass of it.
|
|
866
|
+
template <typename T>
|
|
867
|
+
struct IsAProtocolMessage
|
|
868
|
+
: public std::is_convertible<const T*, const ::proto2::Message*> {};
|
|
869
|
+
|
|
870
|
+
// When the compiler sees expression IsContainerTest<C>(0), if C is an
|
|
871
|
+
// STL-style container class, the first overload of IsContainerTest
|
|
872
|
+
// will be viable (since both C::iterator* and C::const_iterator* are
|
|
873
|
+
// valid types and NULL can be implicitly converted to them). It will
|
|
874
|
+
// be picked over the second overload as 'int' is a perfect match for
|
|
875
|
+
// the type of argument 0. If C::iterator or C::const_iterator is not
|
|
876
|
+
// a valid type, the first overload is not viable, and the second
|
|
877
|
+
// overload will be picked. Therefore, we can determine whether C is
|
|
878
|
+
// a container class by checking the type of IsContainerTest<C>(0).
|
|
879
|
+
// The value of the expression is insignificant.
|
|
880
|
+
//
|
|
881
|
+
// In C++11 mode we check the existence of a const_iterator and that an
|
|
882
|
+
// iterator is properly implemented for the container.
|
|
883
|
+
//
|
|
884
|
+
// For pre-C++11 that we look for both C::iterator and C::const_iterator.
|
|
885
|
+
// The reason is that C++ injects the name of a class as a member of the
|
|
886
|
+
// class itself (e.g. you can refer to class iterator as either
|
|
887
|
+
// 'iterator' or 'iterator::iterator'). If we look for C::iterator
|
|
888
|
+
// only, for example, we would mistakenly think that a class named
|
|
889
|
+
// iterator is an STL container.
|
|
890
|
+
//
|
|
891
|
+
// Also note that the simpler approach of overloading
|
|
892
|
+
// IsContainerTest(typename C::const_iterator*) and
|
|
893
|
+
// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
|
|
894
|
+
typedef int IsContainer;
|
|
895
|
+
template <class C,
|
|
896
|
+
class Iterator = decltype(::std::declval<const C&>().begin()),
|
|
897
|
+
class = decltype(::std::declval<const C&>().end()),
|
|
898
|
+
class = decltype(++::std::declval<Iterator&>()),
|
|
899
|
+
class = decltype(*::std::declval<Iterator>()),
|
|
900
|
+
class = typename C::const_iterator>
|
|
901
|
+
IsContainer IsContainerTest(int /* dummy */) {
|
|
902
|
+
return 0;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
typedef char IsNotContainer;
|
|
906
|
+
template <class C>
|
|
907
|
+
IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
|
|
908
|
+
|
|
909
|
+
// Trait to detect whether a type T is a hash table.
|
|
910
|
+
// The heuristic used is that the type contains an inner type `hasher` and does
|
|
911
|
+
// not contain an inner type `reverse_iterator`.
|
|
912
|
+
// If the container is iterable in reverse, then order might actually matter.
|
|
913
|
+
template <typename T>
|
|
914
|
+
struct IsHashTable {
|
|
915
|
+
private:
|
|
916
|
+
template <typename U>
|
|
917
|
+
static char test(typename U::hasher*, typename U::reverse_iterator*);
|
|
918
|
+
template <typename U>
|
|
919
|
+
static int test(typename U::hasher*, ...);
|
|
920
|
+
template <typename U>
|
|
921
|
+
static char test(...);
|
|
922
|
+
|
|
923
|
+
public:
|
|
924
|
+
static const bool value = sizeof(test<T>(nullptr, nullptr)) == sizeof(int);
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
template <typename T>
|
|
928
|
+
const bool IsHashTable<T>::value;
|
|
929
|
+
|
|
930
|
+
template <typename C,
|
|
931
|
+
bool = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer)>
|
|
932
|
+
struct IsRecursiveContainerImpl;
|
|
933
|
+
|
|
934
|
+
template <typename C>
|
|
935
|
+
struct IsRecursiveContainerImpl<C, false> : public std::false_type {};
|
|
936
|
+
|
|
937
|
+
// Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to
|
|
938
|
+
// obey the same inconsistencies as the IsContainerTest, namely check if
|
|
939
|
+
// something is a container is relying on only const_iterator in C++11 and
|
|
940
|
+
// is relying on both const_iterator and iterator otherwise
|
|
941
|
+
template <typename C>
|
|
942
|
+
struct IsRecursiveContainerImpl<C, true> {
|
|
943
|
+
using value_type = decltype(*std::declval<typename C::const_iterator>());
|
|
944
|
+
using type =
|
|
945
|
+
std::is_same<typename std::remove_const<
|
|
946
|
+
typename std::remove_reference<value_type>::type>::type,
|
|
947
|
+
C>;
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
// IsRecursiveContainer<Type> is a unary compile-time predicate that
|
|
951
|
+
// evaluates whether C is a recursive container type. A recursive container
|
|
952
|
+
// type is a container type whose value_type is equal to the container type
|
|
953
|
+
// itself. An example for a recursive container type is
|
|
954
|
+
// boost::filesystem::path, whose iterator has a value_type that is equal to
|
|
955
|
+
// boost::filesystem::path.
|
|
956
|
+
template <typename C>
|
|
957
|
+
struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type {};
|
|
958
|
+
|
|
959
|
+
// Utilities for native arrays.
|
|
960
|
+
|
|
961
|
+
// ArrayEq() compares two k-dimensional native arrays using the
|
|
962
|
+
// elements' operator==, where k can be any integer >= 0. When k is
|
|
963
|
+
// 0, ArrayEq() degenerates into comparing a single pair of values.
|
|
964
|
+
|
|
965
|
+
template <typename T, typename U>
|
|
966
|
+
bool ArrayEq(const T* lhs, size_t size, const U* rhs);
|
|
967
|
+
|
|
968
|
+
// This generic version is used when k is 0.
|
|
969
|
+
template <typename T, typename U>
|
|
970
|
+
inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
|
|
971
|
+
|
|
972
|
+
// This overload is used when k >= 1.
|
|
973
|
+
template <typename T, typename U, size_t N>
|
|
974
|
+
inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
|
|
975
|
+
return internal::ArrayEq(lhs, N, rhs);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// This helper reduces code bloat. If we instead put its logic inside
|
|
979
|
+
// the previous ArrayEq() function, arrays with different sizes would
|
|
980
|
+
// lead to different copies of the template code.
|
|
981
|
+
template <typename T, typename U>
|
|
982
|
+
bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
|
|
983
|
+
for (size_t i = 0; i != size; i++) {
|
|
984
|
+
if (!internal::ArrayEq(lhs[i], rhs[i]))
|
|
985
|
+
return false;
|
|
986
|
+
}
|
|
987
|
+
return true;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
// Finds the first element in the iterator range [begin, end) that
|
|
991
|
+
// equals elem. Element may be a native array type itself.
|
|
992
|
+
template <typename Iter, typename Element>
|
|
993
|
+
Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
|
|
994
|
+
for (Iter it = begin; it != end; ++it) {
|
|
995
|
+
if (internal::ArrayEq(*it, elem))
|
|
996
|
+
return it;
|
|
997
|
+
}
|
|
998
|
+
return end;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// CopyArray() copies a k-dimensional native array using the elements'
|
|
1002
|
+
// operator=, where k can be any integer >= 0. When k is 0,
|
|
1003
|
+
// CopyArray() degenerates into copying a single value.
|
|
1004
|
+
|
|
1005
|
+
template <typename T, typename U>
|
|
1006
|
+
void CopyArray(const T* from, size_t size, U* to);
|
|
1007
|
+
|
|
1008
|
+
// This generic version is used when k is 0.
|
|
1009
|
+
template <typename T, typename U>
|
|
1010
|
+
inline void CopyArray(const T& from, U* to) { *to = from; }
|
|
1011
|
+
|
|
1012
|
+
// This overload is used when k >= 1.
|
|
1013
|
+
template <typename T, typename U, size_t N>
|
|
1014
|
+
inline void CopyArray(const T(&from)[N], U(*to)[N]) {
|
|
1015
|
+
internal::CopyArray(from, N, *to);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
// This helper reduces code bloat. If we instead put its logic inside
|
|
1019
|
+
// the previous CopyArray() function, arrays with different sizes
|
|
1020
|
+
// would lead to different copies of the template code.
|
|
1021
|
+
template <typename T, typename U>
|
|
1022
|
+
void CopyArray(const T* from, size_t size, U* to) {
|
|
1023
|
+
for (size_t i = 0; i != size; i++) {
|
|
1024
|
+
internal::CopyArray(from[i], to + i);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
// The relation between an NativeArray object (see below) and the
|
|
1029
|
+
// native array it represents.
|
|
1030
|
+
// We use 2 different structs to allow non-copyable types to be used, as long
|
|
1031
|
+
// as RelationToSourceReference() is passed.
|
|
1032
|
+
struct RelationToSourceReference {};
|
|
1033
|
+
struct RelationToSourceCopy {};
|
|
1034
|
+
|
|
1035
|
+
// Adapts a native array to a read-only STL-style container. Instead
|
|
1036
|
+
// of the complete STL container concept, this adaptor only implements
|
|
1037
|
+
// members useful for Google Mock's container matchers. New members
|
|
1038
|
+
// should be added as needed. To simplify the implementation, we only
|
|
1039
|
+
// support Element being a raw type (i.e. having no top-level const or
|
|
1040
|
+
// reference modifier). It's the client's responsibility to satisfy
|
|
1041
|
+
// this requirement. Element can be an array type itself (hence
|
|
1042
|
+
// multi-dimensional arrays are supported).
|
|
1043
|
+
template <typename Element>
|
|
1044
|
+
class NativeArray {
|
|
1045
|
+
public:
|
|
1046
|
+
// STL-style container typedefs.
|
|
1047
|
+
typedef Element value_type;
|
|
1048
|
+
typedef Element* iterator;
|
|
1049
|
+
typedef const Element* const_iterator;
|
|
1050
|
+
|
|
1051
|
+
// Constructs from a native array. References the source.
|
|
1052
|
+
NativeArray(const Element* array, size_t count, RelationToSourceReference) {
|
|
1053
|
+
InitRef(array, count);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
// Constructs from a native array. Copies the source.
|
|
1057
|
+
NativeArray(const Element* array, size_t count, RelationToSourceCopy) {
|
|
1058
|
+
InitCopy(array, count);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// Copy constructor.
|
|
1062
|
+
NativeArray(const NativeArray& rhs) {
|
|
1063
|
+
(this->*rhs.clone_)(rhs.array_, rhs.size_);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
~NativeArray() {
|
|
1067
|
+
if (clone_ != &NativeArray::InitRef)
|
|
1068
|
+
delete[] array_;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
// STL-style container methods.
|
|
1072
|
+
size_t size() const { return size_; }
|
|
1073
|
+
const_iterator begin() const { return array_; }
|
|
1074
|
+
const_iterator end() const { return array_ + size_; }
|
|
1075
|
+
bool operator==(const NativeArray& rhs) const {
|
|
1076
|
+
return size() == rhs.size() &&
|
|
1077
|
+
ArrayEq(begin(), size(), rhs.begin());
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
private:
|
|
1081
|
+
static_assert(!std::is_const<Element>::value, "Type must not be const");
|
|
1082
|
+
static_assert(!std::is_reference<Element>::value,
|
|
1083
|
+
"Type must not be a reference");
|
|
1084
|
+
|
|
1085
|
+
// Initializes this object with a copy of the input.
|
|
1086
|
+
void InitCopy(const Element* array, size_t a_size) {
|
|
1087
|
+
Element* const copy = new Element[a_size];
|
|
1088
|
+
CopyArray(array, a_size, copy);
|
|
1089
|
+
array_ = copy;
|
|
1090
|
+
size_ = a_size;
|
|
1091
|
+
clone_ = &NativeArray::InitCopy;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// Initializes this object with a reference of the input.
|
|
1095
|
+
void InitRef(const Element* array, size_t a_size) {
|
|
1096
|
+
array_ = array;
|
|
1097
|
+
size_ = a_size;
|
|
1098
|
+
clone_ = &NativeArray::InitRef;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
const Element* array_;
|
|
1102
|
+
size_t size_;
|
|
1103
|
+
void (NativeArray::*clone_)(const Element*, size_t);
|
|
1104
|
+
|
|
1105
|
+
GTEST_DISALLOW_ASSIGN_(NativeArray);
|
|
1106
|
+
};
|
|
1107
|
+
|
|
1108
|
+
// Backport of std::index_sequence.
|
|
1109
|
+
template <size_t... Is>
|
|
1110
|
+
struct IndexSequence {
|
|
1111
|
+
using type = IndexSequence;
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
// Double the IndexSequence, and one if plus_one is true.
|
|
1115
|
+
template <bool plus_one, typename T, size_t sizeofT>
|
|
1116
|
+
struct DoubleSequence;
|
|
1117
|
+
template <size_t... I, size_t sizeofT>
|
|
1118
|
+
struct DoubleSequence<true, IndexSequence<I...>, sizeofT> {
|
|
1119
|
+
using type = IndexSequence<I..., (sizeofT + I)..., 2 * sizeofT>;
|
|
1120
|
+
};
|
|
1121
|
+
template <size_t... I, size_t sizeofT>
|
|
1122
|
+
struct DoubleSequence<false, IndexSequence<I...>, sizeofT> {
|
|
1123
|
+
using type = IndexSequence<I..., (sizeofT + I)...>;
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
// Backport of std::make_index_sequence.
|
|
1127
|
+
// It uses O(ln(N)) instantiation depth.
|
|
1128
|
+
template <size_t N>
|
|
1129
|
+
struct MakeIndexSequence
|
|
1130
|
+
: DoubleSequence<N % 2 == 1, typename MakeIndexSequence<N / 2>::type,
|
|
1131
|
+
N / 2>::type {};
|
|
1132
|
+
|
|
1133
|
+
template <>
|
|
1134
|
+
struct MakeIndexSequence<0> : IndexSequence<> {};
|
|
1135
|
+
|
|
1136
|
+
template <size_t>
|
|
1137
|
+
struct Ignore {
|
|
1138
|
+
Ignore(...); // NOLINT
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1141
|
+
template <typename>
|
|
1142
|
+
struct ElemFromListImpl;
|
|
1143
|
+
template <size_t... I>
|
|
1144
|
+
struct ElemFromListImpl<IndexSequence<I...>> {
|
|
1145
|
+
// We make Ignore a template to solve a problem with MSVC.
|
|
1146
|
+
// A non-template Ignore would work fine with `decltype(Ignore(I))...`, but
|
|
1147
|
+
// MSVC doesn't understand how to deal with that pack expansion.
|
|
1148
|
+
// Use `0 * I` to have a single instantiation of Ignore.
|
|
1149
|
+
template <typename R>
|
|
1150
|
+
static R Apply(Ignore<0 * I>..., R (*)(), ...);
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
template <size_t N, typename... T>
|
|
1154
|
+
struct ElemFromList {
|
|
1155
|
+
using type =
|
|
1156
|
+
decltype(ElemFromListImpl<typename MakeIndexSequence<N>::type>::Apply(
|
|
1157
|
+
static_cast<T (*)()>(nullptr)...));
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1160
|
+
template <typename... T>
|
|
1161
|
+
class FlatTuple;
|
|
1162
|
+
|
|
1163
|
+
template <typename Derived, size_t I>
|
|
1164
|
+
struct FlatTupleElemBase;
|
|
1165
|
+
|
|
1166
|
+
template <typename... T, size_t I>
|
|
1167
|
+
struct FlatTupleElemBase<FlatTuple<T...>, I> {
|
|
1168
|
+
using value_type = typename ElemFromList<I, T...>::type;
|
|
1169
|
+
FlatTupleElemBase() = default;
|
|
1170
|
+
explicit FlatTupleElemBase(value_type t) : value(std::move(t)) {}
|
|
1171
|
+
value_type value;
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
template <typename Derived, typename Idx>
|
|
1175
|
+
struct FlatTupleBase;
|
|
1176
|
+
|
|
1177
|
+
template <size_t... Idx, typename... T>
|
|
1178
|
+
struct FlatTupleBase<FlatTuple<T...>, IndexSequence<Idx...>>
|
|
1179
|
+
: FlatTupleElemBase<FlatTuple<T...>, Idx>... {
|
|
1180
|
+
using Indices = IndexSequence<Idx...>;
|
|
1181
|
+
FlatTupleBase() = default;
|
|
1182
|
+
explicit FlatTupleBase(T... t)
|
|
1183
|
+
: FlatTupleElemBase<FlatTuple<T...>, Idx>(std::move(t))... {}
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1186
|
+
// Analog to std::tuple but with different tradeoffs.
|
|
1187
|
+
// This class minimizes the template instantiation depth, thus allowing more
|
|
1188
|
+
// elements that std::tuple would. std::tuple has been seen to require an
|
|
1189
|
+
// instantiation depth of more than 10x the number of elements in some
|
|
1190
|
+
// implementations.
|
|
1191
|
+
// FlatTuple and ElemFromList are not recursive and have a fixed depth
|
|
1192
|
+
// regardless of T...
|
|
1193
|
+
// MakeIndexSequence, on the other hand, it is recursive but with an
|
|
1194
|
+
// instantiation depth of O(ln(N)).
|
|
1195
|
+
template <typename... T>
|
|
1196
|
+
class FlatTuple
|
|
1197
|
+
: private FlatTupleBase<FlatTuple<T...>,
|
|
1198
|
+
typename MakeIndexSequence<sizeof...(T)>::type> {
|
|
1199
|
+
using Indices = typename FlatTuple::FlatTupleBase::Indices;
|
|
1200
|
+
|
|
1201
|
+
public:
|
|
1202
|
+
FlatTuple() = default;
|
|
1203
|
+
explicit FlatTuple(T... t) : FlatTuple::FlatTupleBase(std::move(t)...) {}
|
|
1204
|
+
|
|
1205
|
+
template <size_t I>
|
|
1206
|
+
const typename ElemFromList<I, T...>::type& Get() const {
|
|
1207
|
+
return static_cast<const FlatTupleElemBase<FlatTuple, I>*>(this)->value;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
template <size_t I>
|
|
1211
|
+
typename ElemFromList<I, T...>::type& Get() {
|
|
1212
|
+
return static_cast<FlatTupleElemBase<FlatTuple, I>*>(this)->value;
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
|
|
1216
|
+
// Utility functions to be called with static_assert to induce deprecation
|
|
1217
|
+
// warnings.
|
|
1218
|
+
GTEST_INTERNAL_DEPRECATED(
|
|
1219
|
+
"INSTANTIATE_TEST_CASE_P is deprecated, please use "
|
|
1220
|
+
"INSTANTIATE_TEST_SUITE_P")
|
|
1221
|
+
constexpr bool InstantiateTestCase_P_IsDeprecated() { return true; }
|
|
1222
|
+
|
|
1223
|
+
GTEST_INTERNAL_DEPRECATED(
|
|
1224
|
+
"TYPED_TEST_CASE_P is deprecated, please use "
|
|
1225
|
+
"TYPED_TEST_SUITE_P")
|
|
1226
|
+
constexpr bool TypedTestCase_P_IsDeprecated() { return true; }
|
|
1227
|
+
|
|
1228
|
+
GTEST_INTERNAL_DEPRECATED(
|
|
1229
|
+
"TYPED_TEST_CASE is deprecated, please use "
|
|
1230
|
+
"TYPED_TEST_SUITE")
|
|
1231
|
+
constexpr bool TypedTestCaseIsDeprecated() { return true; }
|
|
1232
|
+
|
|
1233
|
+
GTEST_INTERNAL_DEPRECATED(
|
|
1234
|
+
"REGISTER_TYPED_TEST_CASE_P is deprecated, please use "
|
|
1235
|
+
"REGISTER_TYPED_TEST_SUITE_P")
|
|
1236
|
+
constexpr bool RegisterTypedTestCase_P_IsDeprecated() { return true; }
|
|
1237
|
+
|
|
1238
|
+
GTEST_INTERNAL_DEPRECATED(
|
|
1239
|
+
"INSTANTIATE_TYPED_TEST_CASE_P is deprecated, please use "
|
|
1240
|
+
"INSTANTIATE_TYPED_TEST_SUITE_P")
|
|
1241
|
+
constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
|
|
1242
|
+
|
|
1243
|
+
} // namespace internal
|
|
1244
|
+
} // namespace testing
|
|
1245
|
+
|
|
1246
|
+
#define GTEST_MESSAGE_AT_(file, line, message, result_type) \
|
|
1247
|
+
::testing::internal::AssertHelper(result_type, file, line, message) \
|
|
1248
|
+
= ::testing::Message()
|
|
1249
|
+
|
|
1250
|
+
#define GTEST_MESSAGE_(message, result_type) \
|
|
1251
|
+
GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
|
|
1252
|
+
|
|
1253
|
+
#define GTEST_FATAL_FAILURE_(message) \
|
|
1254
|
+
return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
|
|
1255
|
+
|
|
1256
|
+
#define GTEST_NONFATAL_FAILURE_(message) \
|
|
1257
|
+
GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
|
|
1258
|
+
|
|
1259
|
+
#define GTEST_SUCCESS_(message) \
|
|
1260
|
+
GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
|
|
1261
|
+
|
|
1262
|
+
#define GTEST_SKIP_(message) \
|
|
1263
|
+
return GTEST_MESSAGE_(message, ::testing::TestPartResult::kSkip)
|
|
1264
|
+
|
|
1265
|
+
// Suppress MSVC warning 4072 (unreachable code) for the code following
|
|
1266
|
+
// statement if it returns or throws (or doesn't return or throw in some
|
|
1267
|
+
// situations).
|
|
1268
|
+
#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
|
|
1269
|
+
if (::testing::internal::AlwaysTrue()) { statement; }
|
|
1270
|
+
|
|
1271
|
+
#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
|
|
1272
|
+
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
|
1273
|
+
if (::testing::internal::ConstCharPtr gtest_msg = "") { \
|
|
1274
|
+
bool gtest_caught_expected = false; \
|
|
1275
|
+
try { \
|
|
1276
|
+
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
|
1277
|
+
} \
|
|
1278
|
+
catch (expected_exception const&) { \
|
|
1279
|
+
gtest_caught_expected = true; \
|
|
1280
|
+
} \
|
|
1281
|
+
catch (...) { \
|
|
1282
|
+
gtest_msg.value = \
|
|
1283
|
+
"Expected: " #statement " throws an exception of type " \
|
|
1284
|
+
#expected_exception ".\n Actual: it throws a different type."; \
|
|
1285
|
+
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
|
|
1286
|
+
} \
|
|
1287
|
+
if (!gtest_caught_expected) { \
|
|
1288
|
+
gtest_msg.value = \
|
|
1289
|
+
"Expected: " #statement " throws an exception of type " \
|
|
1290
|
+
#expected_exception ".\n Actual: it throws nothing."; \
|
|
1291
|
+
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
|
|
1292
|
+
} \
|
|
1293
|
+
} else \
|
|
1294
|
+
GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
|
|
1295
|
+
fail(gtest_msg.value)
|
|
1296
|
+
|
|
1297
|
+
#if GTEST_HAS_EXCEPTIONS
|
|
1298
|
+
|
|
1299
|
+
#define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \
|
|
1300
|
+
catch (std::exception const& e) { \
|
|
1301
|
+
gtest_msg.value = ( \
|
|
1302
|
+
"it throws std::exception-derived exception with description: \"" \
|
|
1303
|
+
); \
|
|
1304
|
+
gtest_msg.value += e.what(); \
|
|
1305
|
+
gtest_msg.value += "\"."; \
|
|
1306
|
+
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
#else // GTEST_HAS_EXCEPTIONS
|
|
1310
|
+
|
|
1311
|
+
#define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_()
|
|
1312
|
+
|
|
1313
|
+
#endif // GTEST_HAS_EXCEPTIONS
|
|
1314
|
+
|
|
1315
|
+
#define GTEST_TEST_NO_THROW_(statement, fail) \
|
|
1316
|
+
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
|
1317
|
+
if (::testing::internal::TrueWithString gtest_msg{}) { \
|
|
1318
|
+
try { \
|
|
1319
|
+
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
|
1320
|
+
} \
|
|
1321
|
+
GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \
|
|
1322
|
+
catch (...) { \
|
|
1323
|
+
gtest_msg.value = "it throws."; \
|
|
1324
|
+
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
|
|
1325
|
+
} \
|
|
1326
|
+
} else \
|
|
1327
|
+
GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
|
|
1328
|
+
fail(("Expected: " #statement " doesn't throw an exception.\n" \
|
|
1329
|
+
" Actual: " + gtest_msg.value).c_str())
|
|
1330
|
+
|
|
1331
|
+
#define GTEST_TEST_ANY_THROW_(statement, fail) \
|
|
1332
|
+
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
|
1333
|
+
if (::testing::internal::AlwaysTrue()) { \
|
|
1334
|
+
bool gtest_caught_any = false; \
|
|
1335
|
+
try { \
|
|
1336
|
+
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
|
1337
|
+
} \
|
|
1338
|
+
catch (...) { \
|
|
1339
|
+
gtest_caught_any = true; \
|
|
1340
|
+
} \
|
|
1341
|
+
if (!gtest_caught_any) { \
|
|
1342
|
+
goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
|
|
1343
|
+
} \
|
|
1344
|
+
} else \
|
|
1345
|
+
GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
|
|
1346
|
+
fail("Expected: " #statement " throws an exception.\n" \
|
|
1347
|
+
" Actual: it doesn't.")
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
|
|
1351
|
+
// either a boolean expression or an AssertionResult. text is a textual
|
|
1352
|
+
// represenation of expression as it was passed into the EXPECT_TRUE.
|
|
1353
|
+
#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
|
|
1354
|
+
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
|
1355
|
+
if (const ::testing::AssertionResult gtest_ar_ = \
|
|
1356
|
+
::testing::AssertionResult(expression)) \
|
|
1357
|
+
; \
|
|
1358
|
+
else \
|
|
1359
|
+
fail(::testing::internal::GetBoolAssertionFailureMessage(\
|
|
1360
|
+
gtest_ar_, text, #actual, #expected).c_str())
|
|
1361
|
+
|
|
1362
|
+
#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
|
|
1363
|
+
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
|
1364
|
+
if (::testing::internal::AlwaysTrue()) { \
|
|
1365
|
+
::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
|
|
1366
|
+
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
|
1367
|
+
if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
|
|
1368
|
+
goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
|
|
1369
|
+
} \
|
|
1370
|
+
} else \
|
|
1371
|
+
GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
|
|
1372
|
+
fail("Expected: " #statement " doesn't generate new fatal " \
|
|
1373
|
+
"failures in the current thread.\n" \
|
|
1374
|
+
" Actual: it does.")
|
|
1375
|
+
|
|
1376
|
+
// Expands to the name of the class that implements the given test.
|
|
1377
|
+
#define GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
|
1378
|
+
test_suite_name##_##test_name##_Test
|
|
1379
|
+
|
|
1380
|
+
// Helper macro for defining tests.
|
|
1381
|
+
#define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \
|
|
1382
|
+
static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \
|
|
1383
|
+
"test_suite_name must not be empty"); \
|
|
1384
|
+
static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \
|
|
1385
|
+
"test_name must not be empty"); \
|
|
1386
|
+
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
|
1387
|
+
: public parent_class { \
|
|
1388
|
+
public: \
|
|
1389
|
+
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
|
|
1390
|
+
\
|
|
1391
|
+
private: \
|
|
1392
|
+
void TestBody() override; \
|
|
1393
|
+
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \
|
|
1394
|
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
|
1395
|
+
test_name)); \
|
|
1396
|
+
}; \
|
|
1397
|
+
\
|
|
1398
|
+
::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
|
1399
|
+
test_name)::test_info_ = \
|
|
1400
|
+
::testing::internal::MakeAndRegisterTestInfo( \
|
|
1401
|
+
#test_suite_name, #test_name, nullptr, nullptr, \
|
|
1402
|
+
::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \
|
|
1403
|
+
::testing::internal::SuiteApiResolver< \
|
|
1404
|
+
parent_class>::GetSetUpCaseOrSuite(__FILE__, __LINE__), \
|
|
1405
|
+
::testing::internal::SuiteApiResolver< \
|
|
1406
|
+
parent_class>::GetTearDownCaseOrSuite(__FILE__, __LINE__), \
|
|
1407
|
+
new ::testing::internal::TestFactoryImpl<GTEST_TEST_CLASS_NAME_( \
|
|
1408
|
+
test_suite_name, test_name)>); \
|
|
1409
|
+
void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
|
|
1410
|
+
|
|
1411
|
+
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
|