From eab7ef4895d5707700af2a54844596456b165eda Mon Sep 17 00:00:00 2001 From: Alexey Suhov Date: Thu, 21 May 2020 23:00:55 +0300 Subject: [PATCH] add submodules for mkl-dnn, gflags and gtest --- .gitmodules | 12 + inference-engine/samples/thirdparty/gflags | 1 + .../samples/thirdparty/gflags/.gitattributes | 3 - .../samples/thirdparty/gflags/.gitignore | 24 - .../samples/thirdparty/gflags/.travis.yml | 20 - .../samples/thirdparty/gflags/AUTHORS.txt | 2 - .../samples/thirdparty/gflags/BUILD | 12 - .../samples/thirdparty/gflags/CMakeLists.txt | 702 -- .../samples/thirdparty/gflags/COPYING.txt | 28 - .../samples/thirdparty/gflags/ChangeLog.txt | 254 - .../samples/thirdparty/gflags/INSTALL.md | 88 - .../samples/thirdparty/gflags/README.md | 305 - .../samples/thirdparty/gflags/WORKSPACE | 6 - .../samples/thirdparty/gflags/appveyor.yml | 68 - .../thirdparty/gflags/bazel/gflags.bzl | 92 - .../gflags/cmake/README_runtime.txt | 4 - .../thirdparty/gflags/cmake/config.cmake.in | 169 - .../gflags/cmake/execute_test.cmake | 53 - .../thirdparty/gflags/cmake/package.cmake.in | 49 - .../thirdparty/gflags/cmake/package.pc.in | 14 - .../thirdparty/gflags/cmake/utils.cmake | 205 - .../thirdparty/gflags/cmake/version.cmake.in | 21 - .../samples/thirdparty/gflags/doc/.nojekyll | 0 .../thirdparty/gflags/doc/designstyle.css | 115 - .../samples/thirdparty/gflags/doc/index.html | 648 -- .../samples/thirdparty/gflags/src/config.h.in | 114 - .../samples/thirdparty/gflags/src/gflags.cc | 2050 ---- .../samples/thirdparty/gflags/src/gflags.h.in | 605 -- .../gflags/src/gflags_completions.cc | 768 -- .../gflags/src/gflags_completions.h.in | 121 - .../gflags/src/gflags_completions.sh | 117 - .../thirdparty/gflags/src/gflags_declare.h.in | 153 - .../thirdparty/gflags/src/gflags_ns.h.in | 102 - .../thirdparty/gflags/src/gflags_reporting.cc | 442 - .../samples/thirdparty/gflags/src/mutex.h | 348 - .../samples/thirdparty/gflags/src/util.h | 373 - .../thirdparty/gflags/src/windows_port.cc | 73 - .../thirdparty/gflags/src/windows_port.h | 133 - .../thirdparty/gflags/test/CMakeLists.txt | 209 - .../gflags/test/config/CMakeLists.txt | 10 - .../thirdparty/gflags/test/config/main.cc | 20 - .../samples/thirdparty/gflags/test/flagfile.1 | 1 - .../samples/thirdparty/gflags/test/flagfile.2 | 2 - .../samples/thirdparty/gflags/test/flagfile.3 | 1 - .../thirdparty/gflags/test/gflags_build.py.in | 43 - .../gflags/test/gflags_declare_flags.cc | 12 - .../gflags/test/gflags_declare_test.cc | 12 - .../gflags/test/gflags_strip_flags_test.cc | 60 - .../gflags/test/gflags_strip_flags_test.cmake | 7 - .../thirdparty/gflags/test/gflags_unittest.cc | 1572 --- .../gflags/test/gflags_unittest_flagfile | 2 - .../thirdparty/gflags/test/nc/CMakeLists.txt | 16 - .../thirdparty/gflags/test/nc/gflags_nc.cc | 73 - .../ie_test_utils/common_test_utils/gtest | 1 + .../common_test_utils/gtest/.gitignore | 10 - .../common_test_utils/gtest/.travis.yml | 43 - .../common_test_utils/gtest/BUILD.bazel | 147 - .../common_test_utils/gtest/CMakeLists.txt | 33 - .../common_test_utils/gtest/README.md | 148 - .../common_test_utils/gtest/WORKSPACE | 1 - .../common_test_utils/gtest/appveyor.yml | 71 - .../gtest/googlemock/CHANGES | 126 - .../gtest/googlemock/CMakeLists.txt | 223 - .../gtest/googlemock/CONTRIBUTORS | 40 - .../gtest/googlemock/LICENSE | 28 - .../gtest/googlemock/Makefile.am | 224 - .../gtest/googlemock/README.md | 376 - .../gtest/googlemock/build-aux/.keep | 0 .../gtest/googlemock/cmake/gmock.pc.in | 9 - .../gtest/googlemock/cmake/gmock_main.pc.in | 9 - .../gtest/googlemock/configure.ac | 146 - .../gtest/googlemock/docs/CheatSheet.md | 562 - .../gtest/googlemock/docs/CookBook.md | 3679 ------- .../gtest/googlemock/docs/DesignDoc.md | 280 - .../gtest/googlemock/docs/DevGuide.md | 132 - .../gtest/googlemock/docs/Documentation.md | 15 - .../gtest/googlemock/docs/ForDummies.md | 439 - .../docs/FrequentlyAskedQuestions.md | 628 -- .../gtest/googlemock/docs/KnownIssues.md | 19 - .../googlemock/include/gmock/gmock-actions.h | 1205 --- .../include/gmock/gmock-cardinalities.h | 147 - .../include/gmock/gmock-generated-actions.h | 2377 ----- .../gmock/gmock-generated-actions.h.pump | 794 -- .../gmock/gmock-generated-function-mockers.h | 1254 --- .../gmock-generated-function-mockers.h.pump | 339 - .../include/gmock/gmock-generated-matchers.h | 2179 ---- .../gmock/gmock-generated-matchers.h.pump | 672 -- .../gmock/gmock-generated-nice-strict.h | 397 - .../gmock/gmock-generated-nice-strict.h.pump | 161 - .../googlemock/include/gmock/gmock-matchers.h | 4416 -------- .../include/gmock/gmock-more-actions.h | 246 - .../include/gmock/gmock-more-matchers.h | 58 - .../include/gmock/gmock-spec-builders.h | 1849 ---- .../gtest/googlemock/include/gmock/gmock.h | 95 - .../internal/custom/gmock-generated-actions.h | 8 - .../custom/gmock-generated-actions.h.pump | 10 - .../gmock/internal/custom/gmock-matchers.h | 39 - .../gmock/internal/custom/gmock-port.h | 46 - .../internal/gmock-generated-internal-utils.h | 279 - .../gmock-generated-internal-utils.h.pump | 136 - .../gmock/internal/gmock-internal-utils.h | 510 - .../include/gmock/internal/gmock-port.h | 91 - .../gtest/googlemock/make/Makefile | 101 - .../gtest/googlemock/msvc/2005/gmock.sln | 32 - .../gtest/googlemock/msvc/2005/gmock.vcproj | 191 - .../googlemock/msvc/2005/gmock_config.vsprops | 15 - .../googlemock/msvc/2005/gmock_main.vcproj | 187 - .../googlemock/msvc/2005/gmock_test.vcproj | 201 - .../gtest/googlemock/msvc/2010/gmock.sln | 46 - .../gtest/googlemock/msvc/2010/gmock.vcxproj | 145 - .../googlemock/msvc/2010/gmock_config.props | 19 - .../googlemock/msvc/2010/gmock_main.vcxproj | 151 - .../googlemock/msvc/2010/gmock_test.vcxproj | 176 - .../gtest/googlemock/msvc/2015/gmock.sln | 46 - .../gtest/googlemock/msvc/2015/gmock.vcxproj | 145 - .../googlemock/msvc/2015/gmock_config.props | 19 - .../googlemock/msvc/2015/gmock_main.vcxproj | 151 - .../googlemock/msvc/2015/gmock_test.vcxproj | 176 - .../googlemock/scripts/fuse_gmock_files.py | 240 - .../googlemock/scripts/generator/LICENSE | 203 - .../gtest/googlemock/scripts/generator/README | 35 - .../scripts/generator/README.cppclean | 115 - .../scripts/generator/cpp/__init__.py | 0 .../googlemock/scripts/generator/cpp/ast.py | 1733 ---- .../scripts/generator/cpp/gmock_class.py | 227 - .../scripts/generator/cpp/gmock_class_test.py | 448 - .../scripts/generator/cpp/keywords.py | 59 - .../scripts/generator/cpp/tokenize.py | 287 - .../googlemock/scripts/generator/cpp/utils.py | 41 - .../googlemock/scripts/generator/gmock_gen.py | 31 - .../gtest/googlemock/scripts/gmock-config.in | 303 - .../gtest/googlemock/scripts/gmock_doctor.py | 640 -- .../gtest/googlemock/scripts/upload.py | 1387 --- .../gtest/googlemock/scripts/upload_gmock.py | 78 - .../gtest/googlemock/src/gmock-all.cc | 47 - .../googlemock/src/gmock-cardinalities.cc | 156 - .../googlemock/src/gmock-internal-utils.cc | 173 - .../gtest/googlemock/src/gmock-matchers.cc | 497 - .../googlemock/src/gmock-spec-builders.cc | 830 -- .../gtest/googlemock/src/gmock.cc | 205 - .../gtest/googlemock/src/gmock_main.cc | 54 - .../gtest/googlemock/test/BUILD.bazel | 52 - .../googlemock/test/gmock-actions_test.cc | 1411 --- .../test/gmock-cardinalities_test.cc | 428 - .../test/gmock-generated-actions_test.cc | 1228 --- .../gmock-generated-function-mockers_test.cc | 704 -- .../gmock-generated-internal-utils_test.cc | 127 - .../test/gmock-generated-matchers_test.cc | 1286 --- .../test/gmock-internal-utils_test.cc | 698 -- .../googlemock/test/gmock-matchers_test.cc | 5678 ----------- .../test/gmock-more-actions_test.cc | 711 -- .../googlemock/test/gmock-nice-strict_test.cc | 446 - .../gtest/googlemock/test/gmock-port_test.cc | 43 - .../test/gmock-spec-builders_test.cc | 2701 ----- .../gtest/googlemock/test/gmock_all_test.cc | 51 - .../gtest/googlemock/test/gmock_ex_test.cc | 81 - .../gtest/googlemock/test/gmock_leak_test.py | 108 - .../gtest/googlemock/test/gmock_leak_test_.cc | 100 - .../gtest/googlemock/test/gmock_link2_test.cc | 40 - .../gtest/googlemock/test/gmock_link_test.cc | 40 - .../gtest/googlemock/test/gmock_link_test.h | 669 -- .../googlemock/test/gmock_output_test.py | 180 - .../googlemock/test/gmock_output_test_.cc | 291 - .../test/gmock_output_test_golden.txt | 310 - .../googlemock/test/gmock_stress_test.cc | 322 - .../gtest/googlemock/test/gmock_test.cc | 261 - .../gtest/googlemock/test/gmock_test_utils.py | 112 - .../gtest/googletest/.gitignore | 2 - .../gtest/googletest/CHANGES | 157 - .../gtest/googletest/CMakeLists.txt | 312 - .../gtest/googletest/CONTRIBUTORS | 37 - .../gtest/googletest/LICENSE | 28 - .../gtest/googletest/Makefile.am | 310 - .../gtest/googletest/README.md | 383 - .../gtest/googletest/build-aux/.keep | 0 .../gtest/googletest/cmake/gtest.pc.in | 9 - .../gtest/googletest/cmake/gtest_main.pc.in | 10 - .../googletest/cmake/internal_utils.cmake | 258 - .../gtest/googletest/codegear/gtest.cbproj | 138 - .../gtest/googletest/codegear/gtest.groupproj | 54 - .../gtest/googletest/codegear/gtest_all.cc | 38 - .../gtest/googletest/codegear/gtest_link.cc | 40 - .../googletest/codegear/gtest_main.cbproj | 82 - .../googletest/codegear/gtest_unittest.cbproj | 88 - .../gtest/googletest/configure.ac | 68 - .../gtest/googletest/docs/AdvancedGuide.md | 2182 ---- .../gtest/googletest/docs/DevGuide.md | 126 - .../gtest/googletest/docs/Documentation.md | 16 - .../gtest/googletest/docs/FAQ.md | 1092 -- .../gtest/googletest/docs/Pkgconfig.md | 146 - .../gtest/googletest/docs/Primer.md | 536 - .../gtest/googletest/docs/PumpManual.md | 177 - .../gtest/googletest/docs/Samples.md | 14 - .../gtest/googletest/docs/XcodeGuide.md | 93 - .../include/gtest/gtest-death-test.h | 294 - .../googletest/include/gtest/gtest-message.h | 250 - .../include/gtest/gtest-param-test.h | 1444 --- .../include/gtest/gtest-param-test.h.pump | 510 - .../googletest/include/gtest/gtest-printers.h | 1009 -- .../googletest/include/gtest/gtest-spi.h | 231 - .../include/gtest/gtest-test-part.h | 183 - .../include/gtest/gtest-typed-test.h | 264 - .../gtest/googletest/include/gtest/gtest.h | 2268 ----- .../include/gtest/gtest_pred_impl.h | 358 - .../googletest/include/gtest/gtest_prod.h | 58 - .../gtest/internal/custom/gtest-port.h | 72 - .../gtest/internal/custom/gtest-printers.h | 42 - .../include/gtest/internal/custom/gtest.h | 45 - .../internal/gtest-death-test-internal.h | 319 - .../include/gtest/internal/gtest-filepath.h | 206 - .../include/gtest/internal/gtest-internal.h | 1282 --- .../include/gtest/internal/gtest-linked_ptr.h | 243 - .../internal/gtest-param-util-generated.h | 5146 ---------- .../gtest-param-util-generated.h.pump | 286 - .../include/gtest/internal/gtest-param-util.h | 724 -- .../include/gtest/internal/gtest-port-arch.h | 95 - .../include/gtest/internal/gtest-port.h | 2598 ----- .../include/gtest/internal/gtest-string.h | 167 - .../include/gtest/internal/gtest-tuple.h | 1020 -- .../include/gtest/internal/gtest-tuple.h.pump | 347 - .../include/gtest/internal/gtest-type-util.h | 3331 ------ .../gtest/internal/gtest-type-util.h.pump | 297 - .../gtest/googletest/m4/acx_pthread.m4 | 363 - .../gtest/googletest/m4/gtest.m4 | 74 - .../gtest/googletest/make/Makefile | 82 - .../gtest/googletest/msvc/2010/gtest-md.sln | 55 - .../googletest/msvc/2010/gtest-md.vcxproj | 149 - .../msvc/2010/gtest-md.vcxproj.filters | 18 - .../gtest/googletest/msvc/2010/gtest.sln | 55 - .../gtest/googletest/msvc/2010/gtest.vcxproj | 149 - .../msvc/2010/gtest.vcxproj.filters | 18 - .../msvc/2010/gtest_main-md.vcxproj | 154 - .../msvc/2010/gtest_main-md.vcxproj.filters | 18 - .../googletest/msvc/2010/gtest_main.vcxproj | 162 - .../msvc/2010/gtest_main.vcxproj.filters | 18 - .../msvc/2010/gtest_prod_test-md.vcxproj | 199 - .../2010/gtest_prod_test-md.vcxproj.filters | 26 - .../msvc/2010/gtest_prod_test.vcxproj | 191 - .../msvc/2010/gtest_prod_test.vcxproj.filters | 26 - .../msvc/2010/gtest_unittest-md.vcxproj | 188 - .../2010/gtest_unittest-md.vcxproj.filters | 18 - .../msvc/2010/gtest_unittest.vcxproj | 180 - .../msvc/2010/gtest_unittest.vcxproj.filters | 18 - .../gtest/googletest/samples/prime_tables.h | 123 - .../gtest/googletest/samples/sample1.cc | 68 - .../gtest/googletest/samples/sample1.h | 43 - .../googletest/samples/sample10_unittest.cc | 141 - .../googletest/samples/sample1_unittest.cc | 154 - .../gtest/googletest/samples/sample2.cc | 56 - .../gtest/googletest/samples/sample2.h | 85 - .../googletest/samples/sample2_unittest.cc | 110 - .../gtest/googletest/samples/sample3-inl.h | 172 - .../googletest/samples/sample3_unittest.cc | 152 - .../gtest/googletest/samples/sample4.cc | 46 - .../gtest/googletest/samples/sample4.h | 53 - .../googletest/samples/sample4_unittest.cc | 46 - .../googletest/samples/sample5_unittest.cc | 199 - .../googletest/samples/sample6_unittest.cc | 225 - .../googletest/samples/sample7_unittest.cc | 130 - .../googletest/samples/sample8_unittest.cc | 174 - .../googletest/samples/sample9_unittest.cc | 157 - .../gtest/googletest/scripts/common.py | 83 - .../googletest/scripts/fuse_gtest_files.py | 253 - .../googletest/scripts/gen_gtest_pred_impl.py | 730 -- .../gtest/googletest/scripts/gtest-config.in | 274 - .../gtest/googletest/scripts/pump.py | 855 -- .../gtest/googletest/scripts/release_docs.py | 158 - .../gtest/googletest/scripts/test/Makefile | 59 - .../gtest/googletest/scripts/upload.py | 1387 --- .../gtest/googletest/scripts/upload_gtest.py | 78 - .../gtest/googletest/src/gtest-all.cc | 48 - .../gtest/googletest/src/gtest-death-test.cc | 1341 --- .../gtest/googletest/src/gtest-filepath.cc | 387 - .../gtest/googletest/src/gtest-internal-inl.h | 1186 --- .../gtest/googletest/src/gtest-port.cc | 1241 --- .../gtest/googletest/src/gtest-printers.cc | 373 - .../gtest/googletest/src/gtest-test-part.cc | 111 - .../gtest/googletest/src/gtest-typed-test.cc | 118 - .../gtest/googletest/src/gtest.cc | 5509 ---------- .../gtest/googletest/src/gtest_main.cc | 38 - .../gtest/googletest/test/BUILD.bazel | 118 - .../test/gtest-death-test_ex_test.cc | 93 - .../googletest/test/gtest-death-test_test.cc | 1427 --- .../googletest/test/gtest-filepath_test.cc | 662 -- .../googletest/test/gtest-linked_ptr_test.cc | 154 - .../googletest/test/gtest-listener_test.cc | 311 - .../googletest/test/gtest-message_test.cc | 159 - .../googletest/test/gtest-options_test.cc | 215 - .../googletest/test/gtest-param-test2_test.cc | 65 - .../googletest/test/gtest-param-test_test.cc | 1055 -- .../googletest/test/gtest-param-test_test.h | 57 - .../gtest/googletest/test/gtest-port_test.cc | 1311 --- .../googletest/test/gtest-printers_test.cc | 1669 --- .../googletest/test/gtest-test-part_test.cc | 238 - .../gtest/googletest/test/gtest-tuple_test.cc | 320 - .../googletest/test/gtest-typed-test2_test.cc | 45 - .../googletest/test/gtest-typed-test_test.cc | 380 - .../googletest/test/gtest-typed-test_test.h | 66 - .../test/gtest-unittest-api_test.cc | 341 - .../gtest/googletest/test/gtest_all_test.cc | 48 - .../test/gtest_break_on_failure_unittest.py | 212 - .../test/gtest_break_on_failure_unittest_.cc | 88 - .../test/gtest_catch_exceptions_test.py | 237 - .../test/gtest_catch_exceptions_test_.cc | 311 - .../gtest/googletest/test/gtest_color_test.py | 130 - .../googletest/test/gtest_color_test_.cc | 71 - .../googletest/test/gtest_env_var_test.py | 117 - .../googletest/test/gtest_env_var_test_.cc | 126 - .../googletest/test/gtest_environment_test.cc | 192 - .../googletest/test/gtest_filter_unittest.py | 636 -- .../googletest/test/gtest_filter_unittest_.cc | 140 - .../gtest/googletest/test/gtest_help_test.py | 172 - .../gtest/googletest/test/gtest_help_test_.cc | 46 - .../test/gtest_list_tests_unittest.py | 207 - .../test/gtest_list_tests_unittest_.cc | 157 - .../googletest/test/gtest_main_unittest.cc | 45 - .../googletest/test/gtest_no_test_unittest.cc | 56 - .../googletest/test/gtest_output_test.py | 340 - .../googletest/test/gtest_output_test_.cc | 1062 -- .../test/gtest_output_test_golden_lin.txt | 743 -- .../test/gtest_pred_impl_unittest.cc | 2427 ----- .../test/gtest_premature_exit_test.cc | 127 - .../gtest/googletest/test/gtest_prod_test.cc | 57 - .../googletest/test/gtest_repeat_test.cc | 253 - .../googletest/test/gtest_shuffle_test.py | 325 - .../googletest/test/gtest_shuffle_test_.cc | 103 - .../googletest/test/gtest_sole_header_test.cc | 57 - .../googletest/test/gtest_stress_test.cc | 256 - .../gtest/googletest/test/gtest_test_utils.py | 320 - .../test/gtest_throw_on_failure_ex_test.cc | 92 - .../test/gtest_throw_on_failure_test.py | 171 - .../test/gtest_throw_on_failure_test_.cc | 72 - .../test/gtest_uninitialized_test.py | 70 - .../test/gtest_uninitialized_test_.cc | 43 - .../gtest/googletest/test/gtest_unittest.cc | 7705 -------------- .../test/gtest_xml_outfile1_test_.cc | 49 - .../test/gtest_xml_outfile2_test_.cc | 49 - .../test/gtest_xml_outfiles_test.py | 132 - .../test/gtest_xml_output_unittest.py | 308 - .../test/gtest_xml_output_unittest_.cc | 181 - .../googletest/test/gtest_xml_test_utils.py | 194 - .../gtest/googletest/test/production.cc | 36 - .../gtest/googletest/test/production.h | 55 - .../xcode/Config/DebugProject.xcconfig | 30 - .../xcode/Config/FrameworkTarget.xcconfig | 17 - .../googletest/xcode/Config/General.xcconfig | 41 - .../xcode/Config/ReleaseProject.xcconfig | 32 - .../xcode/Config/StaticLibraryTarget.xcconfig | 18 - .../xcode/Config/TestTarget.xcconfig | 8 - .../googletest/xcode/Resources/Info.plist | 30 - .../xcode/Samples/FrameworkSample/Info.plist | 28 - .../WidgetFramework.xcodeproj/project.pbxproj | 457 - .../xcode/Samples/FrameworkSample/runtests.sh | 62 - .../xcode/Samples/FrameworkSample/widget.cc | 63 - .../xcode/Samples/FrameworkSample/widget.h | 59 - .../Samples/FrameworkSample/widget_test.cc | 68 - .../googletest/xcode/Scripts/runtests.sh | 65 - .../xcode/Scripts/versiongenerate.py | 100 - .../xcode/gtest.xcodeproj/project.pbxproj | 1182 --- .../common_test_utils/gtest/travis.sh | 14 - inference-engine/thirdparty/mkl-dnn | 1 + .../mkl-dnn/.github/issue_template.md | 31 - .../thirdparty/mkl-dnn/.gitignore | 3 - .../thirdparty/mkl-dnn/CMakeLists.txt | 98 - inference-engine/thirdparty/mkl-dnn/LICENSE | 215 - inference-engine/thirdparty/mkl-dnn/README.md | 423 - .../thirdparty/mkl-dnn/_clang-format | 97 - .../thirdparty/mkl-dnn/cmake/Doxygen.cmake | 57 - .../thirdparty/mkl-dnn/cmake/MKL.cmake | 300 - .../thirdparty/mkl-dnn/cmake/OpenMP.cmake | 141 - .../thirdparty/mkl-dnn/cmake/SDL.cmake | 60 - .../thirdparty/mkl-dnn/cmake/TBB.cmake | 49 - .../thirdparty/mkl-dnn/cmake/Threading.cmake | 39 - .../thirdparty/mkl-dnn/cmake/config.cmake.in | 6 - .../mkl-dnn/cmake/lnx/TBBConfig.cmake | 128 - .../mkl-dnn/cmake/mac/TBBConfig.cmake | 96 - .../thirdparty/mkl-dnn/cmake/options.cmake | 154 - .../thirdparty/mkl-dnn/cmake/platform.cmake | 163 - .../thirdparty/mkl-dnn/cmake/profiling.cmake | 28 - .../mkl-dnn/cmake/template.vcxproj.user | 7 - .../thirdparty/mkl-dnn/cmake/utils.cmake | 109 - .../thirdparty/mkl-dnn/cmake/version.cmake | 46 - .../mkl-dnn/cmake/win/TBBConfig.cmake | 123 - .../thirdparty/mkl-dnn/doc/Doxyfile.in | 2287 ----- .../thirdparty/mkl-dnn/doc/DoxygenLayout.xml | 194 - .../mkl-dnn/doc/design/mem_fmt_blk.png | Bin 50883 -> 0 bytes .../mkl-dnn/doc/design/mem_fmt_img1.png | Bin 24310 -> 0 bytes .../mkl-dnn/doc/design/mem_fmt_img2.png | Bin 32973 -> 0 bytes .../mkl-dnn/doc/design/mem_fmt_padded_blk.png | Bin 41923 -> 0 bytes .../thirdparty/mkl-dnn/doc/design/strides.png | Bin 22153 -> 0 bytes .../design/understanding_memory_formats.md | 403 - .../mkl-dnn/doc/ex_int8_simplenet.md | 360 - .../thirdparty/mkl-dnn/doc/ex_simplenet.md | 157 - .../thirdparty/mkl-dnn/doc/header.html.in | 55 - .../thirdparty/mkl-dnn/doc/img_diagram.png | Bin 85013 -> 0 bytes .../mkl-dnn/doc/img_multiscalar.png | Bin 80462 -> 0 bytes .../mkl-dnn/doc/img_singlescalar.png | Bin 28699 -> 0 bytes .../mkl-dnn/doc/legal_information.md | 27 - .../thirdparty/mkl-dnn/doc/mainpage.md | 216 - .../thirdparty/mkl-dnn/doc/perf_profile.md | 135 - .../mkl-dnn/doc/winograd_convolution.md | 93 - .../mkl-dnn/examples/CMakeLists.txt | 50 - .../mkl-dnn/examples/CMakeLists.txt.in | 93 - .../thirdparty/mkl-dnn/examples/simple_net.c | 493 - .../mkl-dnn/examples/simple_net.cpp | 820 -- .../mkl-dnn/examples/simple_net_int8.cpp | 203 - .../mkl-dnn/examples/simple_rnn.cpp | 629 -- .../mkl-dnn/examples/simple_rnn_int8.cpp | 706 -- .../mkl-dnn/examples/simple_rnn_training.cpp | 841 -- .../mkl-dnn/examples/simple_training_net.c | 915 -- .../mkl-dnn/examples/simple_training_net.cpp | 461 - .../thirdparty/mkl-dnn/include/mkldnn.h | 2068 ---- .../thirdparty/mkl-dnn/include/mkldnn.hpp | 3987 -------- .../thirdparty/mkl-dnn/include/mkldnn_debug.h | 78 - .../thirdparty/mkl-dnn/include/mkldnn_types.h | 1531 --- .../mkl-dnn/include/mkldnn_version.h.in | 32 - .../mkl-dnn/scripts/generate_mkldnn_debug.py | 211 - .../mkl-dnn/scripts/prepare_mkl.bat | 55 - .../thirdparty/mkl-dnn/scripts/prepare_mkl.sh | 55 - .../thirdparty/mkl-dnn/src/CMakeLists.txt | 156 - .../src/common/batch_normalization.cpp | 107 - .../src/common/batch_normalization_pd.hpp | 197 - .../mkl-dnn/src/common/binary_convolution.cpp | 120 - .../src/common/binary_convolution_pd.hpp | 153 - .../mkl-dnn/src/common/c_types_map.hpp | 500 - .../mkl-dnn/src/common/convolution.cpp | 199 - .../mkl-dnn/src/common/convolution_pd.cpp | 56 - .../mkl-dnn/src/common/convolution_pd.hpp | 394 - .../mkl-dnn/src/common/deconvolution.cpp | 188 - .../mkl-dnn/src/common/deconvolution_pd.hpp | 350 - .../src/common/deformable_convolution.cpp | 137 - .../src/common/deformable_convolution_pd.hpp | 141 - .../mkl-dnn/src/common/depthwise.cpp | 80 - .../mkl-dnn/src/common/depthwise_pd.hpp | 92 - .../thirdparty/mkl-dnn/src/common/eltwise.cpp | 85 - .../mkl-dnn/src/common/eltwise_pd.hpp | 150 - .../thirdparty/mkl-dnn/src/common/engine.cpp | 99 - .../thirdparty/mkl-dnn/src/common/engine.hpp | 162 - .../thirdparty/mkl-dnn/src/common/event.hpp | 62 - .../mkl-dnn/src/common/format_traits.hpp | 341 - .../mkl-dnn/src/common/inner_product.cpp | 105 - .../mkl-dnn/src/common/inner_product_pd.hpp | 296 - .../thirdparty/mkl-dnn/src/common/lrn.cpp | 91 - .../thirdparty/mkl-dnn/src/common/lrn_pd.hpp | 142 - .../mkl-dnn/src/common/math_utils.hpp | 361 - .../thirdparty/mkl-dnn/src/common/memory.cpp | 304 - .../src/common/memory_desc_wrapper.cpp | 1637 --- .../src/common/memory_desc_wrapper.hpp | 473 - .../mkl-dnn/src/common/memory_pd.hpp | 150 - .../mkl-dnn/src/common/memory_tracking.hpp | 313 - .../mkl-dnn/src/common/mkldnn_debug.cpp | 470 - .../mkl-dnn/src/common/mkldnn_thread.hpp | 146 - .../src/common/mkldnn_thread_parallel_nd.hpp | 352 - .../mkl-dnn/src/common/mkldnn_traits.hpp | 90 - .../thirdparty/mkl-dnn/src/common/nstl.hpp | 186 - .../thirdparty/mkl-dnn/src/common/pooling.cpp | 123 - .../mkl-dnn/src/common/pooling_pd.hpp | 208 - .../mkl-dnn/src/common/primitive.cpp | 94 - .../mkl-dnn/src/common/primitive.hpp | 113 - .../mkl-dnn/src/common/primitive_attr.cpp | 603 -- .../mkl-dnn/src/common/primitive_attr.hpp | 332 - .../mkl-dnn/src/common/primitive_desc.cpp | 75 - .../mkl-dnn/src/common/primitive_desc.hpp | 137 - .../mkl-dnn/src/common/primitive_iterator.cpp | 104 - .../mkl-dnn/src/common/primitive_iterator.hpp | 79 - .../mkl-dnn/src/common/quantization.cpp | 115 - .../mkl-dnn/src/common/quantization_pd.hpp | 100 - .../thirdparty/mkl-dnn/src/common/query.cpp | 67 - .../thirdparty/mkl-dnn/src/common/reorder.cpp | 79 - .../mkl-dnn/src/common/reorder_pd.hpp | 60 - .../thirdparty/mkl-dnn/src/common/rnn.cpp | 402 - .../thirdparty/mkl-dnn/src/common/rnn_pd.hpp | 200 - .../mkl-dnn/src/common/roi_pooling.cpp | 68 - .../mkl-dnn/src/common/roi_pooling_pd.hpp | 89 - .../mkl-dnn/src/common/scratchpad.cpp | 104 - .../mkl-dnn/src/common/scratchpad.hpp | 36 - .../thirdparty/mkl-dnn/src/common/shuffle.cpp | 72 - .../mkl-dnn/src/common/shuffle_pd.hpp | 94 - .../thirdparty/mkl-dnn/src/common/softmax.cpp | 68 - .../mkl-dnn/src/common/softmax_pd.hpp | 195 - .../thirdparty/mkl-dnn/src/common/stream.cpp | 143 - .../thirdparty/mkl-dnn/src/common/stream.hpp | 304 - .../mkl-dnn/src/common/type_helpers.hpp | 429 - .../thirdparty/mkl-dnn/src/common/utils.cpp | 193 - .../thirdparty/mkl-dnn/src/common/utils.hpp | 374 - .../thirdparty/mkl-dnn/src/common/verbose.cpp | 121 - .../thirdparty/mkl-dnn/src/common/verbose.hpp | 535 - .../thirdparty/mkl-dnn/src/common/z_magic.hpp | 39 - .../mkl-dnn/src/cpu/bfloat16_utils.cpp | 47 - .../mkl-dnn/src/cpu/bfloat16_utils.hpp | 126 - .../mkl-dnn/src/cpu/cpu_barrier.cpp | 112 - .../mkl-dnn/src/cpu/cpu_barrier.hpp | 60 - .../src/cpu/cpu_batch_normalization_pd.hpp | 157 - .../src/cpu/cpu_batch_normalization_utils.cpp | 139 - .../src/cpu/cpu_batch_normalization_utils.hpp | 43 - .../src/cpu/cpu_binary_convolution_pd.hpp | 91 - .../thirdparty/mkl-dnn/src/cpu/cpu_concat.cpp | 57 - .../thirdparty/mkl-dnn/src/cpu/cpu_concat.hpp | 178 - .../mkl-dnn/src/cpu/cpu_convolution_pd.hpp | 240 - .../mkl-dnn/src/cpu/cpu_deconvolution_pd.hpp | 159 - .../src/cpu/cpu_deformable_convolution_pd.hpp | 100 - .../mkl-dnn/src/cpu/cpu_depthwise_pd.hpp | 92 - .../mkl-dnn/src/cpu/cpu_eltwise_pd.hpp | 84 - .../thirdparty/mkl-dnn/src/cpu/cpu_engine.cpp | 597 -- .../thirdparty/mkl-dnn/src/cpu/cpu_engine.hpp | 74 - .../mkl-dnn/src/cpu/cpu_inner_product_pd.hpp | 267 - .../mkl-dnn/src/cpu/cpu_isa_traits.hpp | 165 - .../thirdparty/mkl-dnn/src/cpu/cpu_lrn_pd.hpp | 90 - .../thirdparty/mkl-dnn/src/cpu/cpu_memory.cpp | 420 - .../thirdparty/mkl-dnn/src/cpu/cpu_memory.hpp | 195 - .../mkl-dnn/src/cpu/cpu_pooling_pd.hpp | 123 - .../mkl-dnn/src/cpu/cpu_primitive.cpp | 33 - .../mkl-dnn/src/cpu/cpu_primitive.hpp | 93 - .../mkl-dnn/src/cpu/cpu_quantization_pd.hpp | 118 - .../mkl-dnn/src/cpu/cpu_reducer.cpp | 544 - .../mkl-dnn/src/cpu/cpu_reducer.hpp | 334 - .../mkl-dnn/src/cpu/cpu_reorder.cpp | 415 - .../mkl-dnn/src/cpu/cpu_reorder_pd.hpp | 67 - .../mkl-dnn/src/cpu/cpu_roi_pooling_pd.hpp | 77 - .../mkl-dnn/src/cpu/cpu_shuffle_pd.hpp | 65 - .../mkl-dnn/src/cpu/cpu_softmax_pd.hpp | 83 - .../thirdparty/mkl-dnn/src/cpu/cpu_sum.cpp | 54 - .../thirdparty/mkl-dnn/src/cpu/cpu_sum.hpp | 120 - .../mkl-dnn/src/cpu/gemm/bf16/common_s16.hpp | 59 - .../jit_avx512_core_gemm_bf16bf16f32_kern.cpp | 501 - .../jit_avx512_core_gemm_bf16bf16f32_kern.hpp | 96 - .../bf16/jit_avx512_core_s16_copy_an_kern.cpp | 862 -- .../bf16/jit_avx512_core_s16_copy_at_kern.cpp | 1666 --- .../bf16/jit_avx512_core_s16_copy_bn_kern.cpp | 485 - .../bf16/jit_avx512_core_s16_copy_bt_kern.cpp | 493 - .../mkl-dnn/src/cpu/gemm/f32/common_f32.hpp | 172 - .../src/cpu/gemm/f32/gemm_utils_f32.cpp | 347 - .../src/cpu/gemm/f32/gemm_utils_f32.hpp | 71 - .../gemm/f32/jit_avx2_f32_copy_an_kern.cpp | 2102 ---- .../gemm/f32/jit_avx2_f32_copy_at_kern.cpp | 2403 ----- .../gemm/f32/jit_avx2_f32_copy_bn_kern.cpp | 771 -- .../gemm/f32/jit_avx2_f32_copy_bt_kern.cpp | 941 -- .../gemm/f32/jit_avx2_kernel_sgemm_kern.cpp | 443 - .../gemm/f32/jit_avx2_kernel_sgemm_kern.hpp | 681 -- .../gemm/f32/jit_avx512_common_gemm_f32.cpp | 2128 ---- .../gemm/f32/jit_avx512_common_gemm_f32.hpp | 46 - .../f32/jit_avx512_core_f32_copy_an_kern.cpp | 2369 ----- .../f32/jit_avx512_core_f32_copy_at_kern.cpp | 3614 ------- .../f32/jit_avx512_core_f32_copy_bn_kern.cpp | 1106 -- .../f32/jit_avx512_core_f32_copy_bt_kern.cpp | 1208 --- .../cpu/gemm/f32/jit_avx_f32_copy_an_kern.cpp | 1595 --- .../cpu/gemm/f32/jit_avx_f32_copy_at_kern.cpp | 1650 --- .../cpu/gemm/f32/jit_avx_f32_copy_bn_kern.cpp | 771 -- .../cpu/gemm/f32/jit_avx_f32_copy_bt_kern.cpp | 941 -- .../src/cpu/gemm/f32/jit_avx_gemm_f32.cpp | 2706 ----- .../src/cpu/gemm/f32/jit_avx_gemm_f32.hpp | 45 - .../cpu/gemm/f32/jit_avx_gemv_t_f32_kern.cpp | 361 - .../cpu/gemm/f32/jit_avx_gemv_t_f32_kern.hpp | 68 - .../gemm/f32/jit_avx_kernel_b0_sgemm_kern.cpp | 4612 --------- .../gemm/f32/jit_avx_kernel_sgemm_kern.cpp | 4696 --------- .../gemm/f32/jit_sse42_f32_copy_an_kern.cpp | 1328 --- .../gemm/f32/jit_sse42_f32_copy_at_kern.cpp | 1213 --- .../gemm/f32/jit_sse42_f32_copy_bn_kern.cpp | 795 -- .../gemm/f32/jit_sse42_f32_copy_bt_kern.cpp | 941 -- .../gemm/f32/jit_sse42_gemv_t_f32_kern.cpp | 330 - .../gemm/f32/jit_sse42_gemv_t_f32_kern.hpp | 66 - .../f32/jit_sse42_kernel_b0_sgemm_kern.cpp | 3136 ------ .../gemm/f32/jit_sse42_kernel_sgemm_kern.cpp | 3206 ------ .../mkl-dnn/src/cpu/gemm/f32/ref_gemm_f32.cpp | 338 - .../mkl-dnn/src/cpu/gemm/f32/ref_gemm_f32.hpp | 35 - .../thirdparty/mkl-dnn/src/cpu/gemm/gemm.cpp | 318 - .../thirdparty/mkl-dnn/src/cpu/gemm/gemm.hpp | 75 - .../mkl-dnn/src/cpu/gemm/gemm_driver.cpp | 1900 ---- .../mkl-dnn/src/cpu/gemm/gemm_driver.hpp | 61 - .../mkl-dnn/src/cpu/gemm/gemm_info.cpp | 720 -- .../mkl-dnn/src/cpu/gemm/gemm_info.hpp | 126 - .../mkl-dnn/src/cpu/gemm/gemm_pack.cpp | 507 - .../mkl-dnn/src/cpu/gemm/gemm_pack.hpp | 109 - .../src/cpu/gemm/gemm_pack_storage.hpp | 342 - .../mkl-dnn/src/cpu/gemm/gemm_partition.hpp | 254 - .../mkl-dnn/src/cpu/gemm/gemm_threading.hpp | 119 - .../mkl-dnn/src/cpu/gemm/gemv_driver.cpp | 410 - .../mkl-dnn/src/cpu/gemm/gemv_driver.hpp | 33 - .../mkl-dnn/src/cpu/gemm/os_blas.hpp | 66 - .../src/cpu/gemm/s8x8s32/common_u8.hpp | 372 - .../mkl-dnn/src/cpu/gemm/s8x8s32/gemv.hpp | 47 - .../s8x8s32/jit_avx2_gemm_s8u8s32_kern.cpp | 549 - .../s8x8s32/jit_avx2_gemm_s8u8s32_kern.hpp | 86 - .../gemm/s8x8s32/jit_avx2_u8_copy_an_kern.cpp | 580 -- .../gemm/s8x8s32/jit_avx2_u8_copy_at_kern.cpp | 867 -- .../gemm/s8x8s32/jit_avx2_u8_copy_bn_kern.cpp | 385 - .../gemm/s8x8s32/jit_avx2_u8_copy_bt_kern.cpp | 397 - .../s8x8s32/jit_avx2_u8_copy_sum_an_kern.cpp | 793 -- .../s8x8s32/jit_avx2_u8_copy_sum_at_kern.cpp | 1359 --- .../s8x8s32/jit_avx2_u8_copy_sum_bn_kern.cpp | 524 - .../s8x8s32/jit_avx2_u8_copy_sum_bt_kern.cpp | 481 - .../jit_avx512_core_gemm_s8u8s32_kern.cpp | 558 - .../jit_avx512_core_gemm_s8u8s32_kern.hpp | 87 - .../s8x8s32/jit_avx512_core_gemv_s8x8s32.cpp | 298 - .../s8x8s32/jit_avx512_core_gemv_s8x8s32.hpp | 35 - ...t_avx512_core_kernel_gemv_s8x8s32_kern.cpp | 389 - ...t_avx512_core_kernel_gemv_s8x8s32_kern.hpp | 94 - .../jit_avx512_core_u8_copy_an_kern.cpp | 819 -- .../jit_avx512_core_u8_copy_at_kern.cpp | 2209 ---- .../jit_avx512_core_u8_copy_bn_kern.cpp | 616 -- .../jit_avx512_core_u8_copy_bt_kern.cpp | 538 - .../jit_avx512_core_u8_copy_sum_an_kern.cpp | 1273 --- .../jit_avx512_core_u8_copy_sum_at_kern.cpp | 3127 ------ .../jit_avx512_core_u8_copy_sum_bn_kern.cpp | 874 -- .../jit_avx512_core_u8_copy_sum_bt_kern.cpp | 685 -- .../jit_avx_kernel_b0_b_gemm_s8u8s32_kern.cpp | 2191 ---- .../jit_avx_kernel_b0_c_gemm_s8u8s32_kern.cpp | 2111 ---- .../jit_avx_kernel_b0_gemm_s8u8s32_kern.cpp | 2027 ---- .../jit_avx_kernel_b0_r_gemm_s8u8s32_kern.cpp | 2108 ---- .../jit_avx_kernel_b_gemm_s8u8s32_kern.cpp | 2245 ---- .../jit_avx_kernel_c_gemm_s8u8s32_kern.cpp | 2165 ---- .../jit_avx_kernel_gemm_s8u8s32_kern.cpp | 2081 ---- .../jit_avx_kernel_r_gemm_s8u8s32_kern.cpp | 2162 ---- .../gemm/s8x8s32/jit_avx_u8_copy_an_kern.cpp | 579 -- .../gemm/s8x8s32/jit_avx_u8_copy_at_kern.cpp | 866 -- .../gemm/s8x8s32/jit_avx_u8_copy_bn_kern.cpp | 260 - .../gemm/s8x8s32/jit_avx_u8_copy_bt_kern.cpp | 302 - .../s8x8s32/jit_avx_u8_copy_sum_an_kern.cpp | 792 -- .../s8x8s32/jit_avx_u8_copy_sum_at_kern.cpp | 1358 --- .../s8x8s32/jit_avx_u8_copy_sum_bn_kern.cpp | 340 - .../s8x8s32/jit_avx_u8_copy_sum_bt_kern.cpp | 355 - ...it_sse41_kernel_b0_b_gemm_s8u8s32_kern.cpp | 2313 ----- ...it_sse41_kernel_b0_c_gemm_s8u8s32_kern.cpp | 2218 ---- .../jit_sse41_kernel_b0_gemm_s8u8s32_kern.cpp | 2133 ---- ...it_sse41_kernel_b0_r_gemm_s8u8s32_kern.cpp | 2230 ---- .../jit_sse41_kernel_b_gemm_s8u8s32_kern.cpp | 2366 ----- .../jit_sse41_kernel_c_gemm_s8u8s32_kern.cpp | 2271 ----- .../jit_sse41_kernel_gemm_s8u8s32_kern.cpp | 2187 ---- .../jit_sse41_kernel_r_gemm_s8u8s32_kern.cpp | 2283 ----- .../s8x8s32/jit_sse41_u8_copy_an_kern.cpp | 579 -- .../s8x8s32/jit_sse41_u8_copy_at_kern.cpp | 866 -- .../s8x8s32/jit_sse41_u8_copy_bn_kern.cpp | 260 - .../s8x8s32/jit_sse41_u8_copy_bt_kern.cpp | 302 - .../s8x8s32/jit_sse41_u8_copy_sum_an_kern.cpp | 792 -- .../s8x8s32/jit_sse41_u8_copy_sum_at_kern.cpp | 1358 --- .../s8x8s32/jit_sse41_u8_copy_sum_bn_kern.cpp | 340 - .../s8x8s32/jit_sse41_u8_copy_sum_bt_kern.cpp | 355 - .../src/cpu/gemm/s8x8s32/ref_gemm_s8x8s32.cpp | 121 - .../src/cpu/gemm/s8x8s32/ref_gemm_s8x8s32.hpp | 37 - .../cpu/gemm/s8x8s32/simple_gemm_s8s8s32.cpp | 186 - .../cpu/gemm/s8x8s32/simple_gemm_s8s8s32.hpp | 37 - .../mkl-dnn/src/cpu/gemm_bf16_convolution.cpp | 750 -- .../mkl-dnn/src/cpu/gemm_bf16_convolution.hpp | 504 - .../src/cpu/gemm_bf16_inner_product.cpp | 223 - .../src/cpu/gemm_bf16_inner_product.hpp | 301 - .../mkl-dnn/src/cpu/gemm_convolution.cpp | 475 - .../mkl-dnn/src/cpu/gemm_convolution.hpp | 417 - .../src/cpu/gemm_convolution_utils.cpp | 1546 --- .../src/cpu/gemm_convolution_utils.hpp | 77 - .../mkl-dnn/src/cpu/gemm_inner_product.cpp | 152 - .../mkl-dnn/src/cpu/gemm_inner_product.hpp | 211 - .../src/cpu/gemm_inner_product_utils.cpp | 783 -- .../src/cpu/gemm_inner_product_utils.hpp | 211 - .../src/cpu/gemm_x8s8s32x_convolution.cpp | 1246 --- .../src/cpu/gemm_x8s8s32x_convolution.hpp | 456 - .../src/cpu/gemm_x8s8s32x_inner_product.cpp | 85 - .../src/cpu/gemm_x8s8s32x_inner_product.hpp | 172 - .../src/cpu/jit_avx2_1x1_conv_kernel_f32.cpp | 798 -- .../src/cpu/jit_avx2_1x1_conv_kernel_f32.hpp | 127 - .../src/cpu/jit_avx2_1x1_convolution.cpp | 738 -- .../src/cpu/jit_avx2_1x1_convolution.hpp | 447 - .../src/cpu/jit_avx2_conv_kernel_f32.cpp | 1675 --- .../src/cpu/jit_avx2_conv_kernel_f32.hpp | 257 - .../mkl-dnn/src/cpu/jit_avx2_convolution.cpp | 578 -- .../mkl-dnn/src/cpu/jit_avx2_convolution.hpp | 385 - .../cpu/jit_avx512_common_1x1_conv_kernel.cpp | 1409 --- .../cpu/jit_avx512_common_1x1_conv_kernel.hpp | 124 - .../cpu/jit_avx512_common_1x1_convolution.cpp | 804 -- .../cpu/jit_avx512_common_1x1_convolution.hpp | 457 - .../src/cpu/jit_avx512_common_conv_kernel.cpp | 5380 ---------- .../src/cpu/jit_avx512_common_conv_kernel.hpp | 484 - ...avx512_common_conv_winograd_kernel_f32.cpp | 1156 --- ...avx512_common_conv_winograd_kernel_f32.hpp | 179 - .../src/cpu/jit_avx512_common_convolution.cpp | 1813 ---- .../src/cpu/jit_avx512_common_convolution.hpp | 399 - ...jit_avx512_common_convolution_winograd.cpp | 1226 --- ...jit_avx512_common_convolution_winograd.hpp | 391 - .../mkl-dnn/src/cpu/jit_avx512_common_lrn.cpp | 1002 -- .../mkl-dnn/src/cpu/jit_avx512_common_lrn.hpp | 105 - .../jit_avx512_core_bf16_1x1_conv_kernel.cpp | 1266 --- .../jit_avx512_core_bf16_1x1_conv_kernel.hpp | 155 - .../jit_avx512_core_bf16_1x1_convolution.cpp | 869 -- .../jit_avx512_core_bf16_1x1_convolution.hpp | 432 - .../cpu/jit_avx512_core_bf16_conv_kernel.cpp | 2468 ----- .../cpu/jit_avx512_core_bf16_conv_kernel.hpp | 415 - .../cpu/jit_avx512_core_bf16_convolution.cpp | 1269 --- .../cpu/jit_avx512_core_bf16_convolution.hpp | 369 - .../jit_avx512_core_bf16_dw_conv_kernel.cpp | 1000 -- .../jit_avx512_core_bf16_dw_conv_kernel.hpp | 295 - .../src/cpu/jit_avx512_core_bf16_sum.cpp | 322 - .../src/cpu/jit_avx512_core_bf16_sum.hpp | 264 - .../src/cpu/jit_avx512_core_bf16cvt.hpp | 610 -- .../jit_avx512_core_fp32_wino_conv_2x3.cpp | 1127 --- .../jit_avx512_core_fp32_wino_conv_2x3.hpp | 150 - .../jit_avx512_core_fp32_wino_conv_4x3.cpp | 1037 -- .../jit_avx512_core_fp32_wino_conv_4x3.hpp | 447 - ..._avx512_core_fp32_wino_conv_4x3_kernel.cpp | 2591 ----- ..._avx512_core_fp32_wino_conv_4x3_kernel.hpp | 292 - ..._avx512_core_u8s8s32x_wino_convolution.cpp | 1301 --- ..._avx512_core_u8s8s32x_wino_convolution.hpp | 140 - ...t_avx512_core_x8s8s32x_1x1_conv_kernel.cpp | 894 -- ...t_avx512_core_x8s8s32x_1x1_conv_kernel.hpp | 146 - ...t_avx512_core_x8s8s32x_1x1_convolution.cpp | 275 - ...t_avx512_core_x8s8s32x_1x1_convolution.hpp | 161 - ...avx512_core_x8s8s32x_1x1_deconvolution.hpp | 162 - .../jit_avx512_core_x8s8s32x_conv_kernel.cpp | 1375 --- .../jit_avx512_core_x8s8s32x_conv_kernel.hpp | 262 - .../jit_avx512_core_x8s8s32x_convolution.cpp | 718 -- .../jit_avx512_core_x8s8s32x_convolution.hpp | 130 - ...jit_avx512_core_x8s8s32x_deconvolution.cpp | 1028 -- ...jit_avx512_core_x8s8s32x_deconvolution.hpp | 249 - .../mkl-dnn/src/cpu/jit_generator.hpp | 1033 -- .../mkl-dnn/src/cpu/jit_primitive_conf.hpp | 719 -- .../src/cpu/jit_sse42_1x1_conv_kernel_f32.cpp | 810 -- .../src/cpu/jit_sse42_1x1_conv_kernel_f32.hpp | 124 - .../src/cpu/jit_sse42_1x1_convolution.cpp | 311 - .../src/cpu/jit_sse42_1x1_convolution.hpp | 151 - .../src/cpu/jit_sse42_conv_kernel_f32.cpp | 627 -- .../src/cpu/jit_sse42_conv_kernel_f32.hpp | 113 - .../mkl-dnn/src/cpu/jit_sse42_convolution.cpp | 314 - .../mkl-dnn/src/cpu/jit_sse42_convolution.hpp | 152 - .../src/cpu/jit_sse42_i8i8_pooling.cpp | 687 -- .../src/cpu/jit_sse42_i8i8_pooling.hpp | 113 - .../src/cpu/jit_transpose_src_utils.cpp | 1219 --- .../src/cpu/jit_transpose_src_utils.hpp | 145 - .../src/cpu/jit_uni_1x1_conv_utils.hpp | 375 - .../src/cpu/jit_uni_batch_normalization.cpp | 1497 --- .../src/cpu/jit_uni_batch_normalization.hpp | 99 - .../cpu/jit_uni_batch_normalization_s8.cpp | 539 - .../cpu/jit_uni_batch_normalization_s8.hpp | 71 - .../src/cpu/jit_uni_bin_conv_kernel.cpp | 957 -- .../src/cpu/jit_uni_bin_conv_kernel.hpp | 154 - .../src/cpu/jit_uni_binary_convolution.cpp | 251 - .../src/cpu/jit_uni_binary_convolution.hpp | 138 - .../src/cpu/jit_uni_def_conv_kernel_f32.cpp | 836 -- .../src/cpu/jit_uni_def_conv_kernel_f32.hpp | 124 - .../cpu/jit_uni_deformable_convolution.cpp | 98 - .../cpu/jit_uni_deformable_convolution.hpp | 98 - .../mkl-dnn/src/cpu/jit_uni_depthwise.cpp | 1460 --- .../mkl-dnn/src/cpu/jit_uni_depthwise.hpp | 235 - .../src/cpu/jit_uni_dw_conv_kernel_f32.cpp | 1183 --- .../src/cpu/jit_uni_dw_conv_kernel_f32.hpp | 259 - .../src/cpu/jit_uni_dw_conv_kernel_utils.hpp | 590 -- .../src/cpu/jit_uni_dw_convolution.cpp | 601 -- .../src/cpu/jit_uni_dw_convolution.hpp | 368 - .../mkl-dnn/src/cpu/jit_uni_eltwise.cpp | 1426 --- .../mkl-dnn/src/cpu/jit_uni_eltwise.hpp | 206 - .../mkl-dnn/src/cpu/jit_uni_fork_softmax.cpp | 126 - .../mkl-dnn/src/cpu/jit_uni_fork_softmax.hpp | 106 - .../cpu/jit_uni_fork_softmax_kernel_f32.cpp | 664 -- .../cpu/jit_uni_fork_softmax_kernel_f32.hpp | 130 - .../mkl-dnn/src/cpu/jit_uni_i8i8_pooling.cpp | 1157 --- .../mkl-dnn/src/cpu/jit_uni_i8i8_pooling.hpp | 117 - .../mkl-dnn/src/cpu/jit_uni_lrn.cpp | 311 - .../mkl-dnn/src/cpu/jit_uni_lrn.hpp | 106 - .../src/cpu/jit_uni_lrn_kernel_f32.cpp | 1486 --- .../src/cpu/jit_uni_lrn_kernel_f32.hpp | 182 - .../cpu/jit_uni_planar_conv_kernel_f32.cpp | 760 -- .../cpu/jit_uni_planar_conv_kernel_f32.hpp | 135 - .../src/cpu/jit_uni_planar_convolution.cpp | 176 - .../src/cpu/jit_uni_planar_convolution.hpp | 120 - .../mkl-dnn/src/cpu/jit_uni_pool_kernel.cpp | 786 -- .../mkl-dnn/src/cpu/jit_uni_pool_kernel.hpp | 235 - .../mkl-dnn/src/cpu/jit_uni_pooling.cpp | 313 - .../mkl-dnn/src/cpu/jit_uni_pooling.hpp | 209 - .../mkl-dnn/src/cpu/jit_uni_quantization.cpp | 1243 --- .../mkl-dnn/src/cpu/jit_uni_quantization.hpp | 121 - .../mkl-dnn/src/cpu/jit_uni_reorder.cpp | 1117 -- .../mkl-dnn/src/cpu/jit_uni_reorder.hpp | 126 - .../mkl-dnn/src/cpu/jit_uni_reorder_utils.cpp | 420 - .../src/cpu/jit_uni_roi_pool_kernel_f32.cpp | 243 - .../src/cpu/jit_uni_roi_pool_kernel_f32.hpp | 103 - .../mkl-dnn/src/cpu/jit_uni_roi_pooling.cpp | 191 - .../mkl-dnn/src/cpu/jit_uni_roi_pooling.hpp | 109 - .../mkl-dnn/src/cpu/jit_uni_softmax.cpp | 501 - .../mkl-dnn/src/cpu/jit_uni_softmax.hpp | 99 - .../src/cpu/jit_uni_x8s8s32x_conv_kernel.cpp | 1169 --- .../src/cpu/jit_uni_x8s8s32x_conv_kernel.hpp | 166 - .../src/cpu/jit_uni_x8s8s32x_convolution.cpp | 404 - .../src/cpu/jit_uni_x8s8s32x_convolution.hpp | 132 - .../cpu/jit_uni_x8s8s32x_dw_conv_kernel.cpp | 1032 -- .../cpu/jit_uni_x8s8s32x_dw_conv_kernel.hpp | 152 - .../cpu/jit_uni_x8s8s32x_dw_convolution.cpp | 208 - .../cpu/jit_uni_x8s8s32x_dw_convolution.hpp | 127 - .../mkl-dnn/src/cpu/nchw_pooling.cpp | 756 -- .../mkl-dnn/src/cpu/nchw_pooling.hpp | 192 - .../src/cpu/ncsp_batch_normalization.cpp | 487 - .../src/cpu/ncsp_batch_normalization.hpp | 227 - .../mkl-dnn/src/cpu/nhwc_pooling.cpp | 714 -- .../mkl-dnn/src/cpu/nhwc_pooling.hpp | 300 - .../src/cpu/nspc_batch_normalization.cpp | 399 - .../src/cpu/nspc_batch_normalization.hpp | 232 - .../src/cpu/ref_batch_normalization.cpp | 301 - .../src/cpu/ref_batch_normalization.hpp | 177 - .../src/cpu/ref_binary_convolution.cpp | 288 - .../src/cpu/ref_binary_convolution.hpp | 145 - .../thirdparty/mkl-dnn/src/cpu/ref_concat.hpp | 136 - .../mkl-dnn/src/cpu/ref_convolution.cpp | 765 -- .../mkl-dnn/src/cpu/ref_convolution.hpp | 308 - .../mkl-dnn/src/cpu/ref_deconvolution.cpp | 404 - .../mkl-dnn/src/cpu/ref_deconvolution.hpp | 579 -- .../src/cpu/ref_deformable_convolution.cpp | 154 - .../src/cpu/ref_deformable_convolution.hpp | 96 - .../mkl-dnn/src/cpu/ref_depthwise.cpp | 143 - .../mkl-dnn/src/cpu/ref_depthwise.hpp | 87 - .../mkl-dnn/src/cpu/ref_eltwise.cpp | 560 - .../mkl-dnn/src/cpu/ref_eltwise.hpp | 191 - .../mkl-dnn/src/cpu/ref_inner_product.cpp | 286 - .../mkl-dnn/src/cpu/ref_inner_product.hpp | 205 - .../thirdparty/mkl-dnn/src/cpu/ref_lrn.cpp | 311 - .../thirdparty/mkl-dnn/src/cpu/ref_lrn.hpp | 144 - .../mkl-dnn/src/cpu/ref_pooling.cpp | 697 -- .../mkl-dnn/src/cpu/ref_pooling.hpp | 163 - .../mkl-dnn/src/cpu/ref_quantization.cpp | 158 - .../mkl-dnn/src/cpu/ref_quantization.hpp | 89 - .../mkl-dnn/src/cpu/ref_roi_pooling.cpp | 217 - .../mkl-dnn/src/cpu/ref_roi_pooling.hpp | 79 - .../mkl-dnn/src/cpu/ref_shuffle.cpp | 169 - .../mkl-dnn/src/cpu/ref_shuffle.hpp | 113 - .../mkl-dnn/src/cpu/ref_softmax.cpp | 303 - .../mkl-dnn/src/cpu/ref_softmax.hpp | 192 - .../thirdparty/mkl-dnn/src/cpu/ref_sum.hpp | 141 - .../mkl-dnn/src/cpu/rnn/cell_common.cpp | 84 - .../mkl-dnn/src/cpu/rnn/cell_gru.cpp | 148 - .../mkl-dnn/src/cpu/rnn/cell_gru_lbr.cpp | 105 - .../mkl-dnn/src/cpu/rnn/cpu_rnn_pd.hpp | 323 - .../cpu/rnn/jit_uni_gru_cell_postgemm_1.hpp | 200 - .../cpu/rnn/jit_uni_gru_cell_postgemm_2.hpp | 199 - .../cpu/rnn/jit_uni_gru_lbr_cell_postgemm.hpp | 282 - .../cpu/rnn/jit_uni_lstm_cell_postgemm.hpp | 414 - .../src/cpu/rnn/jit_uni_rnn_cell_postgemm.hpp | 307 - .../cpu/rnn/jit_uni_rnn_common_postgemm.hpp | 98 - ...jit_uni_rnn_common_postgemm_dispatcher.hpp | 227 - .../mkl-dnn/src/cpu/rnn/ref_postgemm_gru.cpp | 142 - .../src/cpu/rnn/ref_postgemm_gru_lbr.cpp | 104 - .../mkl-dnn/src/cpu/rnn/ref_postgemm_lstm.cpp | 147 - .../mkl-dnn/src/cpu/rnn/ref_postgemm_rnn.cpp | 113 - .../mkl-dnn/src/cpu/rnn/ref_rnn.cpp | 798 -- .../mkl-dnn/src/cpu/rnn/ref_rnn.hpp | 304 - .../mkl-dnn/src/cpu/rnn/rnn_reorders.hpp | 396 - .../mkl-dnn/src/cpu/rnn/rnn_utils.cpp | 402 - .../mkl-dnn/src/cpu/rnn/rnn_utils.hpp | 224 - .../mkl-dnn/src/cpu/simple_concat.cpp | 125 - .../mkl-dnn/src/cpu/simple_concat.hpp | 172 - .../mkl-dnn/src/cpu/simple_q10n.hpp | 135 - .../mkl-dnn/src/cpu/simple_reorder.hpp | 2127 ---- .../thirdparty/mkl-dnn/src/cpu/simple_sum.cpp | 123 - .../thirdparty/mkl-dnn/src/cpu/simple_sum.hpp | 145 - .../mkl-dnn/src/cpu/wino_reorder.hpp | 376 - .../mkl-dnn/src/cpu/xbyak/COPYRIGHT | 47 - .../thirdparty/mkl-dnn/src/cpu/xbyak/xbyak.h | 2692 ----- .../mkl-dnn/src/cpu/xbyak/xbyak_bin2hex.h | 303 - .../mkl-dnn/src/cpu/xbyak/xbyak_mnemonic.h | 2022 ---- .../mkl-dnn/src/cpu/xbyak/xbyak_util.h | 782 -- .../thirdparty/mkl-dnn/tests/CMakeLists.txt | 81 - .../thirdparty/mkl-dnn/tests/api.c | 369 - .../mkl-dnn/tests/benchdnn/CMakeLists.txt | 89 - .../mkl-dnn/tests/benchdnn/README.md | 839 -- .../thirdparty/mkl-dnn/tests/benchdnn/TODO.md | 32 - .../mkl-dnn/tests/benchdnn/benchdnn.cpp | 106 - .../tests/benchdnn/bnorm/bench_bnorm.cpp | 128 - .../mkl-dnn/tests/benchdnn/bnorm/bnorm.cpp | 761 -- .../mkl-dnn/tests/benchdnn/bnorm/bnorm.hpp | 113 - .../tests/benchdnn/bnorm/bnorm_aux.cpp | 176 - .../tests/benchdnn/bnorm/perf_report.cpp | 122 - .../tests/benchdnn/bnorm/ref_bnorm.cpp | 105 - .../mkl-dnn/tests/benchdnn/common.cpp | 411 - .../mkl-dnn/tests/benchdnn/common.hpp | 199 - .../tests/benchdnn/conv/bench_conv.cpp | 122 - .../tests/benchdnn/conv/bench_deconv.cpp | 121 - .../mkl-dnn/tests/benchdnn/conv/cfg.cpp | 298 - .../mkl-dnn/tests/benchdnn/conv/conv.cpp | 691 -- .../mkl-dnn/tests/benchdnn/conv/conv.hpp | 37 - .../mkl-dnn/tests/benchdnn/conv/conv_aux.cpp | 305 - .../tests/benchdnn/conv/conv_common.hpp | 274 - .../mkl-dnn/tests/benchdnn/conv/deconv.cpp | 317 - .../mkl-dnn/tests/benchdnn/conv/deconv.hpp | 34 - .../tests/benchdnn/conv/perf_report.cpp | 143 - .../mkl-dnn/tests/benchdnn/conv/ref_conv.cpp | 274 - .../mkl-dnn/tests/benchdnn/conv/ref_wino.cpp | 750 -- .../mkl-dnn/tests/benchdnn/dnn_types.cpp | 570 -- .../mkl-dnn/tests/benchdnn/dnn_types.hpp | 135 - .../tests/benchdnn/inputs/bnorm/bnorm_3d | 4 - .../benchdnn/inputs/bnorm/bnorm_densenet_121 | 123 - .../benchdnn/inputs/bnorm/bnorm_googlenet_v2 | 75 - .../benchdnn/inputs/bnorm/bnorm_googlenet_v3 | 96 - .../tests/benchdnn/inputs/bnorm/bnorm_large | 4 - .../benchdnn/inputs/bnorm/bnorm_regressions | 15 - .../benchdnn/inputs/bnorm/bnorm_resnet_50 | 55 - .../tests/benchdnn/inputs/bnorm/bnorm_topo | 4 - .../benchdnn/inputs/bnorm/test_bnorm_all | 135 - .../benchdnn/inputs/bnorm/test_bnorm_bfloat16 | 26 - .../inputs/bnorm/test_bnorm_regressions | 73 - .../inputs/bnorm/test_bnorm_regressions_large | 24 - .../mkl-dnn/tests/benchdnn/inputs/conv_1d | 35 - .../tests/benchdnn/inputs/conv_1d_wavenet | 10 - .../mkl-dnn/tests/benchdnn/inputs/conv_3d | 16 - .../tests/benchdnn/inputs/conv_3d_unet | 13 - .../mkl-dnn/tests/benchdnn/inputs/conv_a3c | 4 - .../tests/benchdnn/inputs/conv_alexnet | 7 - .../mkl-dnn/tests/benchdnn/inputs/conv_all | 9 - .../tests/benchdnn/inputs/conv_all_topo | 20 - .../mkl-dnn/tests/benchdnn/inputs/conv_auto | 2 - .../tests/benchdnn/inputs/conv_densnet | 38 - .../tests/benchdnn/inputs/conv_dilated | 29 - .../tests/benchdnn/inputs/conv_dilated_rfcn | 3 - .../tests/benchdnn/inputs/conv_fastrcnn | 7 - .../tests/benchdnn/inputs/conv_fastrcnn_p1 | 49 - .../tests/benchdnn/inputs/conv_fastrcnn_p2 | 32 - .../tests/benchdnn/inputs/conv_fastrcnn_p3 | 94 - .../mkl-dnn/tests/benchdnn/inputs/conv_gemm | 13 - .../tests/benchdnn/inputs/conv_googlenet_v1 | 61 - .../tests/benchdnn/inputs/conv_googlenet_v2 | 73 - .../tests/benchdnn/inputs/conv_googlenet_v3 | 95 - .../tests/benchdnn/inputs/conv_maskrcnn | 6 - .../tests/benchdnn/inputs/conv_maskrcnn_p1 | 130 - .../tests/benchdnn/inputs/conv_maskrcnn_p2 | 10 - .../tests/benchdnn/inputs/conv_mobilenet | 62 - .../tests/benchdnn/inputs/conv_mobilenet_dw | 11 - .../tests/benchdnn/inputs/conv_regression_dw | 31 - .../benchdnn/inputs/conv_regression_gemm | 6 - .../benchdnn/inputs/conv_regression_padding | 26 - .../inputs/conv_regression_small_spatial | 88 - .../tests/benchdnn/inputs/conv_resnet_50 | 55 - .../benchdnn/inputs/conv_resnet_50_sparse | 76 - .../mkl-dnn/tests/benchdnn/inputs/conv_segnet | 7 - .../benchdnn/inputs/conv_ssd_300_voc0712 | 54 - .../tests/benchdnn/inputs/conv_ssd_mobilenet | 46 - .../mkl-dnn/tests/benchdnn/inputs/conv_tails | 73 - .../mkl-dnn/tests/benchdnn/inputs/conv_unet | 15 - .../mkl-dnn/tests/benchdnn/inputs/conv_vgg_11 | 12 - .../mkl-dnn/tests/benchdnn/inputs/conv_vgg_19 | 18 - .../tests/benchdnn/inputs/conv_xception | 23 - .../mkl-dnn/tests/benchdnn/inputs/conv_yolov2 | 206 - .../tests/benchdnn/inputs/deconv/deconv_1d | 8 - .../tests/benchdnn/inputs/deconv/deconv_1x1 | 33 - .../tests/benchdnn/inputs/deconv/deconv_2d | 63 - .../tests/benchdnn/inputs/deconv/deconv_3d | 8 - .../tests/benchdnn/inputs/deconv/deconv_all | 3 - .../benchdnn/inputs/deconv/deconv_dilated | 73 - .../deconv/harness_deconv_regression_general | 6 - .../benchdnn/inputs/deconv/test_deconv_1x1 | 24 - .../benchdnn/inputs/deconv/test_deconv_all | 40 - .../inputs/deconv/test_deconv_bfloat16 | 17 - .../mkl-dnn/tests/benchdnn/inputs/deepbench | 19 - .../inputs/deepbench_inference_device | 16 - .../inputs/deepbench_inference_server | 107 - .../tests/benchdnn/inputs/deepbench_training | 94 - .../mkl-dnn/tests/benchdnn/inputs/ip/ip_1d | 6 - .../mkl-dnn/tests/benchdnn/inputs/ip/ip_all | 15 - .../tests/benchdnn/inputs/ip/test_ip_all | 34 - .../tests/benchdnn/inputs/ip/test_ip_bfloat16 | 19 - .../benchdnn/inputs/reorder/test_default | 58 - .../mkl-dnn/tests/benchdnn/inputs/rnn/rnn_gru | 4 - .../tests/benchdnn/inputs/rnn/rnn_gru_small | 7 - .../tests/benchdnn/inputs/rnn/rnn_inference | 13 - .../tests/benchdnn/inputs/rnn/rnn_small | 8 - .../tests/benchdnn/inputs/rnn/rnn_training | 12 - .../benchdnn/inputs/rnn/test_rnn_inference | 37 - .../tests/benchdnn/inputs/rnn/test_rnn_small | 99 - .../benchdnn/inputs/rnn/test_rnn_training | 42 - .../benchdnn/inputs/shuffle/test_shuffle | 141 - .../benchdnn/inputs/shuffle/test_shuffle_axis | 126 - .../tests/benchdnn/inputs/test_conv_3d | 5 - .../tests/benchdnn/inputs/test_conv_all | 88 - .../tests/benchdnn/inputs/test_conv_attrs | 76 - .../tests/benchdnn/inputs/test_conv_bfloat16 | 23 - .../tests/benchdnn/inputs/test_conv_depthwise | 45 - .../tests/benchdnn/inputs/test_conv_dilated | 16 - .../benchdnn/inputs/test_conv_dw_bfloat16 | 32 - .../benchdnn/inputs/test_conv_regression | 17 - .../inputs/test_conv_regression_general | 189 - .../tests/benchdnn/inputs/test_conv_tails | 31 - .../mkl-dnn/tests/benchdnn/ip/bench_ip.cpp | 100 - .../mkl-dnn/tests/benchdnn/ip/cfg.cpp | 193 - .../mkl-dnn/tests/benchdnn/ip/ip.cpp | 320 - .../mkl-dnn/tests/benchdnn/ip/ip.hpp | 108 - .../mkl-dnn/tests/benchdnn/ip/ip_aux.cpp | 148 - .../mkl-dnn/tests/benchdnn/ip/perf_report.cpp | 135 - .../mkl-dnn/tests/benchdnn/ip/ref_ip.cpp | 79 - .../mkl-dnn/tests/benchdnn/makefile | 45 - .../mkl-dnn/tests/benchdnn/mkldnn_common.cpp | 22 - .../mkl-dnn/tests/benchdnn/mkldnn_common.hpp | 105 - .../mkl-dnn/tests/benchdnn/mkldnn_debug.cpp | 74 - .../mkl-dnn/tests/benchdnn/mkldnn_debug.hpp | 37 - .../mkl-dnn/tests/benchdnn/mkldnn_memory.hpp | 240 - .../mkl-dnn/tests/benchdnn/norm.hpp | 79 - .../tests/benchdnn/reorder/bench_reorder.cpp | 166 - .../mkl-dnn/tests/benchdnn/reorder/cfg.cpp | 71 - .../tests/benchdnn/reorder/perf_report.cpp | 146 - .../tests/benchdnn/reorder/reorder.cpp | 404 - .../tests/benchdnn/reorder/reorder.hpp | 104 - .../tests/benchdnn/reorder/reorder_aux.cpp | 93 - .../mkl-dnn/tests/benchdnn/rnn/bench_rnn.cpp | 132 - .../mkl-dnn/tests/benchdnn/rnn/cfg.cpp | 128 - .../tests/benchdnn/rnn/perf_report.cpp | 106 - .../mkl-dnn/tests/benchdnn/rnn/ref_rnn.cpp | 1112 -- .../mkl-dnn/tests/benchdnn/rnn/rnn.cpp | 589 -- .../mkl-dnn/tests/benchdnn/rnn/rnn.hpp | 399 - .../mkl-dnn/tests/benchdnn/rnn/rnn_aux.cpp | 495 - .../mkl-dnn/tests/benchdnn/rnn/rnn_aux.hpp | 67 - .../mkl-dnn/tests/benchdnn/self/bnorm.cpp | 81 - .../mkl-dnn/tests/benchdnn/self/common.cpp | 183 - .../mkl-dnn/tests/benchdnn/self/conv.cpp | 54 - .../mkl-dnn/tests/benchdnn/self/self.cpp | 38 - .../mkl-dnn/tests/benchdnn/self/self.hpp | 60 - .../tests/benchdnn/shuffle/bench_shuffle.cpp | 115 - .../tests/benchdnn/shuffle/perf_report.cpp | 125 - .../tests/benchdnn/shuffle/ref_shuffle.cpp | 58 - .../tests/benchdnn/shuffle/shuffle.cpp | 184 - .../tests/benchdnn/shuffle/shuffle.hpp | 86 - .../tests/benchdnn/shuffle/shuffle_aux.cpp | 67 - .../mkl-dnn/tests/generate_c_symbols_refs.sh | 28 - .../mkl-dnn/tests/gtests/CMakeLists.txt | 108 - .../mkl-dnn/tests/gtests/convolution_common.h | 279 - .../mkl-dnn/tests/gtests/gtest/CMakeLists.txt | 11 - .../mkl-dnn/tests/gtests/gtest/LICENSE | 28 - .../tests/gtests/gtest/gtest-death-test.h | 343 - .../tests/gtests/gtest/gtest-matchers.h | 814 -- .../tests/gtests/gtest/gtest-message.h | 224 - .../tests/gtests/gtest/gtest-param-test.h | 503 - .../tests/gtests/gtest/gtest-printers.h | 951 -- .../mkl-dnn/tests/gtests/gtest/gtest-spi.h | 238 - .../tests/gtests/gtest/gtest-test-part.h | 184 - .../tests/gtests/gtest/gtest-typed-test.h | 336 - .../mkl-dnn/tests/gtests/gtest/gtest.h | 2509 ----- .../tests/gtests/gtest/gtest_pred_impl.h | 359 - .../mkl-dnn/tests/gtests/gtest/gtest_prod.h | 61 - .../gtests/gtest/internal/custom/README.md | 56 - .../gtests/gtest/internal/custom/gtest-port.h | 37 - .../gtest/internal/custom/gtest-printers.h | 42 - .../gtests/gtest/internal/custom/gtest.h | 37 - .../internal/gtest-death-test-internal.h | 310 - .../gtests/gtest/internal/gtest-filepath.h | 211 - .../gtests/gtest/internal/gtest-internal.h | 1456 --- .../gtests/gtest/internal/gtest-param-util.h | 880 -- .../gtests/gtest/internal/gtest-port-arch.h | 105 - .../tests/gtests/gtest/internal/gtest-port.h | 2329 ----- .../gtests/gtest/internal/gtest-string.h | 167 - .../gtests/gtest/internal/gtest-type-util.h | 3347 ------ .../gtest/internal/gtest-type-util.h.pump | 314 - .../tests/gtests/gtest/src/gtest-all.cc | 48 - .../gtests/gtest/src/gtest-death-test.cc | 1634 --- .../tests/gtests/gtest/src/gtest-filepath.cc | 379 - .../gtests/gtest/src/gtest-internal-inl.h | 1206 --- .../tests/gtests/gtest/src/gtest-matchers.cc | 152 - .../tests/gtests/gtest/src/gtest-port.cc | 1398 --- .../tests/gtests/gtest/src/gtest-printers.cc | 456 - .../tests/gtests/gtest/src/gtest-test-part.cc | 104 - .../gtests/gtest/src/gtest-typed-test.cc | 118 - .../mkl-dnn/tests/gtests/gtest/src/gtest.cc | 6082 ----------- .../tests/gtests/gtest/src/gtest_main.cc | 47 - .../tests/gtests/in/batch_normalization.h | 264 - .../tests/gtests/in/convolution_attr.h | 30 - .../tests/gtests/in/convolution_simple.h | 322 - .../mkl-dnn/tests/gtests/in/gemm_in.h | 307 - .../thirdparty/mkl-dnn/tests/gtests/main.cpp | 50 - .../tests/gtests/mkldnn_test_common.hpp | 923 -- .../tests/gtests/roi_pooling_test_data.cpp | 9008 ----------------- .../test_batch_normalization_common.hpp | 497 - .../gtests/test_batch_normalization_f32.cpp | 34 - .../gtests/test_batch_normalization_s8.cpp | 34 - .../tests/gtests/test_binarization.cpp | 184 - ...inary_convolution_binarization_forward.cpp | 101 - ...t_binary_convolution_depthwise_forward.cpp | 102 - ...nvolution_dw_conv_binarization_forward.cpp | 72 - ..._convolution_dw_conv_depthwise_forward.cpp | 51 - ...ry_convolution_dw_conv_eltwise_forward.cpp | 60 - ...est_binary_convolution_dw_conv_forward.cpp | 86 - ...ary_convolution_dw_conv_forward_common.hpp | 559 - ...binary_convolution_dw_conv_sum_forward.cpp | 98 - ...est_binary_convolution_eltwise_forward.cpp | 102 - .../test_binary_convolution_forward.cpp | 126 - ...test_binary_convolution_forward_common.hpp | 382 - .../test_binary_convolution_sum_forward.cpp | 97 - .../mkl-dnn/tests/gtests/test_concat.cpp | 522 - .../test_convolution_backward_data_common.hpp | 175 - .../test_convolution_backward_data_f32.cpp | 36 - ...st_convolution_backward_data_s16s16s32.cpp | 36 - ...st_convolution_backward_weights_common.hpp | 227 - .../test_convolution_backward_weights_f32.cpp | 36 - ...convolution_backward_weights_s16s16s32.cpp | 36 - ..._convolution_depthwise_forward_bf16f32.cpp | 87 - ...t_convolution_depthwise_forward_common.hpp | 250 - ...test_convolution_depthwise_forward_f32.cpp | 95 - ...nvolution_depthwise_forward_x8s8f32s32.cpp | 117 - .../test_convolution_dw_conv_common.hpp | 244 - .../gtests/test_convolution_dw_conv_f32.cpp | 93 - .../test_convolution_dw_conv_u8s8s32.cpp | 89 - .../test_convolution_eltwise_forward_bf16.cpp | 89 - ...est_convolution_eltwise_forward_common.hpp | 231 - .../test_convolution_eltwise_forward_f32.cpp | 101 - ...convolution_eltwise_forward_x8s8f32s32.cpp | 116 - .../gtests/test_convolution_format_any.cpp | 178 - .../test_convolution_forward_common.hpp | 322 - .../test_convolution_forward_common_3d.hpp | 351 - .../gtests/test_convolution_forward_f32.cpp | 34 - .../test_convolution_forward_f32_3d.cpp | 114 - .../test_convolution_forward_s16s16s32.cpp | 36 - .../test_convolution_forward_u8s8fp_asymm.cpp | 141 - .../test_convolution_forward_u8s8u8.cpp | 36 - .../test_convolution_forward_x8s8fp.cpp | 138 - .../test_convolution_forward_x8s8fp_3d.cpp | 309 - ...st_convolution_forward_x8s8fp_3d_assym.cpp | 207 - .../test_convolution_forward_x8s8s32.cpp | 133 - .../test_convolution_forward_x8s8s32_3d.cpp | 307 - .../tests/gtests/test_deconvolution.cpp | 451 - ..._deformable_convolution_forward_common.hpp | 247 - ...est_deformable_convolution_forward_f32.cpp | 109 - .../mkl-dnn/tests/gtests/test_depthwise.cpp | 232 - .../mkl-dnn/tests/gtests/test_eltwise.cpp | 347 - .../mkl-dnn/tests/gtests/test_eltwise.hpp | 307 - .../tests/gtests/test_gemm_bf16bf16f32.cpp | 33 - .../mkl-dnn/tests/gtests/test_gemm_common.hpp | 630 -- .../mkl-dnn/tests/gtests/test_gemm_f32.cpp | 33 - .../tests/gtests/test_gemm_s8s8s32.cpp | 33 - .../tests/gtests/test_gemm_s8u8s32.cpp | 33 - .../mkl-dnn/tests/gtests/test_iface_attr.cpp | 99 - .../tests/gtests/test_iface_pd_iter.cpp | 87 - .../test_inner_product_backward_data.cpp | 369 - .../test_inner_product_backward_weights.cpp | 426 - .../gtests/test_inner_product_forward.cpp | 376 - .../tests/gtests/test_lrn_backward.cpp | 960 -- .../mkl-dnn/tests/gtests/test_lrn_forward.cpp | 679 -- .../mkl-dnn/tests/gtests/test_memory.cpp | 101 - .../tests/gtests/test_mkldnn_threading.cpp | 243 - .../tests/gtests/test_pooling_backward.cpp | 1365 --- .../tests/gtests/test_pooling_forward.cpp | 2066 ---- .../tests/gtests/test_quantization.cpp | 344 - .../mkl-dnn/tests/gtests/test_reorder.cpp | 390 - .../mkl-dnn/tests/gtests/test_rnn_forward.cpp | 246 - .../tests/gtests/test_roi_pooling_forward.cpp | 321 - .../mkl-dnn/tests/gtests/test_shuffle.cpp | 372 - .../tests/gtests/test_softmax_backward.cpp | 171 - .../tests/gtests/test_softmax_forward.cpp | 237 - .../mkl-dnn/tests/gtests/test_sum.cpp | 475 - .../tests/other/subproject/CMakeLists.txt | 33 - .../mkl-dnn/tests/other/subproject/main.c | 26 - 1138 files changed, 15 insertions(+), 483225 deletions(-) create mode 160000 inference-engine/samples/thirdparty/gflags delete mode 100644 inference-engine/samples/thirdparty/gflags/.gitattributes delete mode 100644 inference-engine/samples/thirdparty/gflags/.gitignore delete mode 100644 inference-engine/samples/thirdparty/gflags/.travis.yml delete mode 100644 inference-engine/samples/thirdparty/gflags/AUTHORS.txt delete mode 100644 inference-engine/samples/thirdparty/gflags/BUILD delete mode 100644 inference-engine/samples/thirdparty/gflags/CMakeLists.txt delete mode 100644 inference-engine/samples/thirdparty/gflags/COPYING.txt delete mode 100644 inference-engine/samples/thirdparty/gflags/ChangeLog.txt delete mode 100644 inference-engine/samples/thirdparty/gflags/INSTALL.md delete mode 100644 inference-engine/samples/thirdparty/gflags/README.md delete mode 100644 inference-engine/samples/thirdparty/gflags/WORKSPACE delete mode 100644 inference-engine/samples/thirdparty/gflags/appveyor.yml delete mode 100644 inference-engine/samples/thirdparty/gflags/bazel/gflags.bzl delete mode 100644 inference-engine/samples/thirdparty/gflags/cmake/README_runtime.txt delete mode 100644 inference-engine/samples/thirdparty/gflags/cmake/config.cmake.in delete mode 100644 inference-engine/samples/thirdparty/gflags/cmake/execute_test.cmake delete mode 100644 inference-engine/samples/thirdparty/gflags/cmake/package.cmake.in delete mode 100644 inference-engine/samples/thirdparty/gflags/cmake/package.pc.in delete mode 100644 inference-engine/samples/thirdparty/gflags/cmake/utils.cmake delete mode 100644 inference-engine/samples/thirdparty/gflags/cmake/version.cmake.in delete mode 100644 inference-engine/samples/thirdparty/gflags/doc/.nojekyll delete mode 100644 inference-engine/samples/thirdparty/gflags/doc/designstyle.css delete mode 100644 inference-engine/samples/thirdparty/gflags/doc/index.html delete mode 100644 inference-engine/samples/thirdparty/gflags/src/config.h.in delete mode 100644 inference-engine/samples/thirdparty/gflags/src/gflags.cc delete mode 100644 inference-engine/samples/thirdparty/gflags/src/gflags.h.in delete mode 100644 inference-engine/samples/thirdparty/gflags/src/gflags_completions.cc delete mode 100644 inference-engine/samples/thirdparty/gflags/src/gflags_completions.h.in delete mode 100644 inference-engine/samples/thirdparty/gflags/src/gflags_completions.sh delete mode 100644 inference-engine/samples/thirdparty/gflags/src/gflags_declare.h.in delete mode 100644 inference-engine/samples/thirdparty/gflags/src/gflags_ns.h.in delete mode 100644 inference-engine/samples/thirdparty/gflags/src/gflags_reporting.cc delete mode 100644 inference-engine/samples/thirdparty/gflags/src/mutex.h delete mode 100644 inference-engine/samples/thirdparty/gflags/src/util.h delete mode 100644 inference-engine/samples/thirdparty/gflags/src/windows_port.cc delete mode 100644 inference-engine/samples/thirdparty/gflags/src/windows_port.h delete mode 100644 inference-engine/samples/thirdparty/gflags/test/CMakeLists.txt delete mode 100644 inference-engine/samples/thirdparty/gflags/test/config/CMakeLists.txt delete mode 100644 inference-engine/samples/thirdparty/gflags/test/config/main.cc delete mode 100644 inference-engine/samples/thirdparty/gflags/test/flagfile.1 delete mode 100644 inference-engine/samples/thirdparty/gflags/test/flagfile.2 delete mode 100644 inference-engine/samples/thirdparty/gflags/test/flagfile.3 delete mode 100644 inference-engine/samples/thirdparty/gflags/test/gflags_build.py.in delete mode 100644 inference-engine/samples/thirdparty/gflags/test/gflags_declare_flags.cc delete mode 100644 inference-engine/samples/thirdparty/gflags/test/gflags_declare_test.cc delete mode 100644 inference-engine/samples/thirdparty/gflags/test/gflags_strip_flags_test.cc delete mode 100644 inference-engine/samples/thirdparty/gflags/test/gflags_strip_flags_test.cmake delete mode 100644 inference-engine/samples/thirdparty/gflags/test/gflags_unittest.cc delete mode 100644 inference-engine/samples/thirdparty/gflags/test/gflags_unittest_flagfile delete mode 100644 inference-engine/samples/thirdparty/gflags/test/nc/CMakeLists.txt delete mode 100644 inference-engine/samples/thirdparty/gflags/test/nc/gflags_nc.cc create mode 160000 inference-engine/tests/ie_test_utils/common_test_utils/gtest delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/.gitignore delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/.travis.yml delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/BUILD.bazel delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/CMakeLists.txt delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/README.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/WORKSPACE delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/appveyor.yml delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CHANGES delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CMakeLists.txt delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CONTRIBUTORS delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/LICENSE delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/Makefile.am delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/README.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/build-aux/.keep delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/cmake/gmock.pc.in delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/cmake/gmock_main.pc.in delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/configure.ac delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/CheatSheet.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/CookBook.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/DesignDoc.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/DevGuide.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/Documentation.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/ForDummies.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/FrequentlyAskedQuestions.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/KnownIssues.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-actions.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-cardinalities.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-actions.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-matchers.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-matchers.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-more-actions.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-more-matchers.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-spec-builders.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/internal/custom/gmock-port.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/internal/gmock-port.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/make/Makefile delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2005/gmock.sln delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2005/gmock.vcproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2005/gmock_config.vsprops delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2005/gmock_main.vcproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2005/gmock_test.vcproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2010/gmock.sln delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2010/gmock.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2010/gmock_config.props delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2010/gmock_main.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2010/gmock_test.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2015/gmock.sln delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2015/gmock.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2015/gmock_config.props delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2015/gmock_main.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/msvc/2015/gmock_test.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/fuse_gmock_files.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/LICENSE delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/README delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/README.cppclean delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/cpp/__init__.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/cpp/ast.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/cpp/gmock_class.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/cpp/gmock_class_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/cpp/keywords.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/cpp/tokenize.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/cpp/utils.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/generator/gmock_gen.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/gmock-config.in delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/gmock_doctor.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/upload.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/scripts/upload_gmock.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/src/gmock-all.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/src/gmock-cardinalities.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/src/gmock-internal-utils.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/src/gmock-matchers.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/src/gmock-spec-builders.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/src/gmock.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/src/gmock_main.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/BUILD.bazel delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-actions_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-cardinalities_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-generated-actions_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-generated-function-mockers_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-generated-internal-utils_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-generated-matchers_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-internal-utils_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-matchers_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-more-actions_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-nice-strict_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-port_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock-spec-builders_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_all_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_ex_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_leak_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_leak_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_link2_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_link_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_link_test.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_output_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_output_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_output_test_golden.txt delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_stress_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/test/gmock_test_utils.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/.gitignore delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/CHANGES delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/CMakeLists.txt delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/CONTRIBUTORS delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/LICENSE delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/Makefile.am delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/README.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/build-aux/.keep delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/cmake/gtest.pc.in delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/cmake/gtest_main.pc.in delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/cmake/internal_utils.cmake delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/codegear/gtest.cbproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/codegear/gtest.groupproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/codegear/gtest_all.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/codegear/gtest_link.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/codegear/gtest_main.cbproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/codegear/gtest_unittest.cbproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/configure.ac delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/docs/AdvancedGuide.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/docs/DevGuide.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/docs/Documentation.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/docs/FAQ.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/docs/Pkgconfig.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/docs/Primer.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/docs/PumpManual.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/docs/Samples.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/docs/XcodeGuide.md delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest-death-test.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest-message.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest-param-test.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest-param-test.h.pump delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest-printers.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest-spi.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest-test-part.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest-typed-test.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest_pred_impl.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/gtest_prod.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/custom/gtest-port.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/custom/gtest-printers.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/custom/gtest.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-filepath.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-internal.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-linked_ptr.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-param-util.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-port-arch.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-port.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-string.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-tuple.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-tuple.h.pump delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-type-util.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/m4/acx_pthread.m4 delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/m4/gtest.m4 delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/make/Makefile delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest-md.sln delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest-md.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest-md.vcxproj.filters delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest.sln delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest.vcxproj.filters delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_main-md.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_main-md.vcxproj.filters delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_main.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_main.vcxproj.filters delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_unittest.vcxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/msvc/2010/gtest_unittest.vcxproj.filters delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/prime_tables.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample1.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample1.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample10_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample1_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample2.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample2.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample2_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample3-inl.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample3_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample4.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample4.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample4_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample5_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample6_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample7_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample8_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/samples/sample9_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/scripts/common.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/scripts/fuse_gtest_files.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/scripts/gen_gtest_pred_impl.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/scripts/gtest-config.in delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/scripts/pump.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/scripts/release_docs.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/scripts/test/Makefile delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/scripts/upload.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/scripts/upload_gtest.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/src/gtest-all.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/src/gtest-death-test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/src/gtest-filepath.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/src/gtest-internal-inl.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/src/gtest-port.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/src/gtest-printers.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/src/gtest-test-part.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/src/gtest-typed-test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/src/gtest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/src/gtest_main.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/BUILD.bazel delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-death-test_ex_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-death-test_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-filepath_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-linked_ptr_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-listener_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-message_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-options_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-param-test2_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-param-test_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-param-test_test.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-port_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-printers_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-test-part_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-tuple_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-typed-test2_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-typed-test_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-typed-test_test.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest-unittest-api_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_all_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_break_on_failure_unittest.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_break_on_failure_unittest_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_catch_exceptions_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_catch_exceptions_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_color_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_color_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_env_var_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_env_var_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_environment_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_filter_unittest.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_filter_unittest_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_help_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_help_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_list_tests_unittest.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_list_tests_unittest_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_main_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_no_test_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_output_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_output_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_output_test_golden_lin.txt delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_pred_impl_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_premature_exit_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_prod_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_repeat_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_shuffle_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_shuffle_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_sole_header_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_stress_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_test_utils.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_throw_on_failure_ex_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_throw_on_failure_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_throw_on_failure_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_uninitialized_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_uninitialized_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_unittest.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_xml_outfile1_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_xml_outfile2_test_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_xml_outfiles_test.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_xml_output_unittest.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_xml_output_unittest_.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/gtest_xml_test_utils.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/production.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/test/production.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Config/DebugProject.xcconfig delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Config/FrameworkTarget.xcconfig delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Config/General.xcconfig delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Config/ReleaseProject.xcconfig delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Config/StaticLibraryTarget.xcconfig delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Config/TestTarget.xcconfig delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Resources/Info.plist delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Samples/FrameworkSample/Info.plist delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Samples/FrameworkSample/runtests.sh delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Samples/FrameworkSample/widget.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Samples/FrameworkSample/widget.h delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Samples/FrameworkSample/widget_test.cc delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Scripts/runtests.sh delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/Scripts/versiongenerate.py delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj delete mode 100644 inference-engine/tests/ie_test_utils/common_test_utils/gtest/travis.sh create mode 160000 inference-engine/thirdparty/mkl-dnn delete mode 100644 inference-engine/thirdparty/mkl-dnn/.github/issue_template.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/.gitignore delete mode 100644 inference-engine/thirdparty/mkl-dnn/CMakeLists.txt delete mode 100644 inference-engine/thirdparty/mkl-dnn/LICENSE delete mode 100644 inference-engine/thirdparty/mkl-dnn/README.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/_clang-format delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/Doxygen.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/MKL.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/OpenMP.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/SDL.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/TBB.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/Threading.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/config.cmake.in delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/lnx/TBBConfig.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/mac/TBBConfig.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/options.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/platform.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/profiling.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/template.vcxproj.user delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/utils.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/version.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/cmake/win/TBBConfig.cmake delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/Doxyfile.in delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/DoxygenLayout.xml delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/design/mem_fmt_blk.png delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/design/mem_fmt_img1.png delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/design/mem_fmt_img2.png delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/design/mem_fmt_padded_blk.png delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/design/strides.png delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/design/understanding_memory_formats.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/ex_int8_simplenet.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/ex_simplenet.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/header.html.in delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/img_diagram.png delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/img_multiscalar.png delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/img_singlescalar.png delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/legal_information.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/mainpage.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/perf_profile.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/doc/winograd_convolution.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/examples/CMakeLists.txt delete mode 100644 inference-engine/thirdparty/mkl-dnn/examples/CMakeLists.txt.in delete mode 100644 inference-engine/thirdparty/mkl-dnn/examples/simple_net.c delete mode 100644 inference-engine/thirdparty/mkl-dnn/examples/simple_net.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/examples/simple_net_int8.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/examples/simple_rnn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/examples/simple_rnn_int8.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/examples/simple_rnn_training.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/examples/simple_training_net.c delete mode 100644 inference-engine/thirdparty/mkl-dnn/examples/simple_training_net.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/include/mkldnn.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/include/mkldnn.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/include/mkldnn_debug.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/include/mkldnn_types.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/include/mkldnn_version.h.in delete mode 100644 inference-engine/thirdparty/mkl-dnn/scripts/generate_mkldnn_debug.py delete mode 100644 inference-engine/thirdparty/mkl-dnn/scripts/prepare_mkl.bat delete mode 100644 inference-engine/thirdparty/mkl-dnn/scripts/prepare_mkl.sh delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/CMakeLists.txt delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/batch_normalization.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/batch_normalization_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/binary_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/binary_convolution_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/c_types_map.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/convolution_pd.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/convolution_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/deconvolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/deconvolution_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/deformable_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/deformable_convolution_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/depthwise.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/depthwise_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/eltwise.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/eltwise_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/engine.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/engine.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/event.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/format_traits.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/inner_product.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/inner_product_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/lrn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/lrn_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/math_utils.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/memory.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/memory_desc_wrapper.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/memory_desc_wrapper.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/memory_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/memory_tracking.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/mkldnn_debug.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/mkldnn_thread.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/mkldnn_thread_parallel_nd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/mkldnn_traits.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/nstl.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/pooling.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/pooling_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/primitive.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/primitive.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/primitive_attr.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/primitive_attr.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/primitive_desc.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/primitive_desc.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/primitive_iterator.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/primitive_iterator.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/quantization.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/quantization_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/query.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/reorder.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/reorder_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/rnn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/rnn_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/roi_pooling.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/roi_pooling_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/scratchpad.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/scratchpad.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/shuffle.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/shuffle_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/softmax.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/softmax_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/stream.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/stream.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/type_helpers.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/utils.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/utils.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/verbose.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/verbose.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/common/z_magic.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/bfloat16_utils.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/bfloat16_utils.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_barrier.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_barrier.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_batch_normalization_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_batch_normalization_utils.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_batch_normalization_utils.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_binary_convolution_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_concat.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_concat.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_convolution_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_deconvolution_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_deformable_convolution_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_depthwise_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_eltwise_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_engine.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_engine.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_inner_product_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_isa_traits.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_lrn_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_memory.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_memory.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_pooling_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_primitive.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_primitive.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_quantization_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_reducer.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_reducer.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_reorder.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_reorder_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_roi_pooling_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_shuffle_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_softmax_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_sum.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/cpu_sum.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/bf16/common_s16.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/bf16/jit_avx512_core_gemm_bf16bf16f32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/bf16/jit_avx512_core_gemm_bf16bf16f32_kern.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/bf16/jit_avx512_core_s16_copy_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/bf16/jit_avx512_core_s16_copy_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/bf16/jit_avx512_core_s16_copy_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/bf16/jit_avx512_core_s16_copy_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/common_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/gemm_utils_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/gemm_utils_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx2_f32_copy_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx2_f32_copy_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx2_f32_copy_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx2_f32_copy_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx2_kernel_sgemm_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx2_kernel_sgemm_kern.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx512_common_gemm_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx512_common_gemm_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx512_core_f32_copy_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx512_core_f32_copy_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx512_core_f32_copy_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx512_core_f32_copy_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx_f32_copy_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx_f32_copy_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx_f32_copy_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx_f32_copy_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx_gemm_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx_gemm_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx_gemv_t_f32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx_gemv_t_f32_kern.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx_kernel_b0_sgemm_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_avx_kernel_sgemm_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_sse42_f32_copy_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_sse42_f32_copy_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_sse42_f32_copy_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_sse42_f32_copy_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_sse42_gemv_t_f32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_sse42_gemv_t_f32_kern.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_sse42_kernel_b0_sgemm_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/jit_sse42_kernel_sgemm_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/ref_gemm_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/f32/ref_gemm_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm_driver.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm_driver.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm_info.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm_info.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm_pack.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm_pack.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm_pack_storage.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm_partition.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemm_threading.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemv_driver.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/gemv_driver.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/os_blas.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/common_u8.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/gemv.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx2_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx2_gemm_s8u8s32_kern.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx2_u8_copy_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx2_u8_copy_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx2_u8_copy_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx2_u8_copy_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx2_u8_copy_sum_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx2_u8_copy_sum_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx2_u8_copy_sum_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx2_u8_copy_sum_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_gemm_s8u8s32_kern.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_gemv_s8x8s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_gemv_s8x8s32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_kernel_gemv_s8x8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_kernel_gemv_s8x8s32_kern.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_sum_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_sum_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_sum_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx512_core_u8_copy_sum_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_kernel_b0_b_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_kernel_b0_c_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_kernel_b0_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_kernel_b0_r_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_kernel_b_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_kernel_c_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_kernel_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_kernel_r_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_u8_copy_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_u8_copy_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_u8_copy_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_u8_copy_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_u8_copy_sum_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_u8_copy_sum_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_u8_copy_sum_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_avx_u8_copy_sum_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_kernel_b0_b_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_kernel_b0_c_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_kernel_b0_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_kernel_b0_r_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_kernel_b_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_kernel_c_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_kernel_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_kernel_r_gemm_s8u8s32_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_u8_copy_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_u8_copy_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_u8_copy_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_u8_copy_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_u8_copy_sum_an_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_u8_copy_sum_at_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_u8_copy_sum_bn_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/jit_sse41_u8_copy_sum_bt_kern.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/ref_gemm_s8x8s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/ref_gemm_s8x8s32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/simple_gemm_s8s8s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm/s8x8s32/simple_gemm_s8s8s32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_bf16_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_bf16_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_bf16_inner_product.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_bf16_inner_product.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_convolution_utils.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_convolution_utils.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_inner_product.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_inner_product.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_inner_product_utils.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_inner_product_utils.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_x8s8s32x_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_x8s8s32x_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_x8s8s32x_inner_product.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/gemm_x8s8s32x_inner_product.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx2_1x1_conv_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx2_1x1_conv_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx2_1x1_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx2_1x1_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx2_conv_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx2_conv_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx2_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx2_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_1x1_conv_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_1x1_conv_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_1x1_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_1x1_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_conv_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_conv_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_conv_winograd_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_conv_winograd_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_convolution_winograd.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_convolution_winograd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_lrn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_common_lrn.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_1x1_conv_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_1x1_conv_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_1x1_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_1x1_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_conv_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_conv_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_dw_conv_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_dw_conv_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_sum.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16_sum.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_bf16cvt.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_2x3.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_2x3.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_4x3.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_4x3.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_4x3_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_4x3_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_u8s8s32x_wino_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_u8s8s32x_wino_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_1x1_conv_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_1x1_conv_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_1x1_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_1x1_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_1x1_deconvolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_conv_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_conv_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_deconvolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_avx512_core_x8s8s32x_deconvolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_generator.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_primitive_conf.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_sse42_1x1_conv_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_sse42_1x1_conv_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_sse42_1x1_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_sse42_1x1_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_sse42_conv_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_sse42_conv_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_sse42_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_sse42_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_sse42_i8i8_pooling.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_sse42_i8i8_pooling.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_transpose_src_utils.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_transpose_src_utils.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_1x1_conv_utils.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_batch_normalization.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_batch_normalization.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_batch_normalization_s8.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_batch_normalization_s8.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_bin_conv_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_bin_conv_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_binary_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_binary_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_def_conv_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_def_conv_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_deformable_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_deformable_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_depthwise.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_depthwise.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_dw_conv_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_dw_conv_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_dw_conv_kernel_utils.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_dw_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_dw_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_eltwise.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_eltwise.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_fork_softmax.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_fork_softmax.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_fork_softmax_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_fork_softmax_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_i8i8_pooling.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_i8i8_pooling.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_lrn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_lrn.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_lrn_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_lrn_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_planar_conv_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_planar_conv_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_planar_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_planar_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_pool_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_pool_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_pooling.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_pooling.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_quantization.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_quantization.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_reorder.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_reorder.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_reorder_utils.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_roi_pool_kernel_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_roi_pool_kernel_f32.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_roi_pooling.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_roi_pooling.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_softmax.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_softmax.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_x8s8s32x_conv_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_x8s8s32x_conv_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_x8s8s32x_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_x8s8s32x_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_x8s8s32x_dw_conv_kernel.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_x8s8s32x_dw_conv_kernel.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_x8s8s32x_dw_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/jit_uni_x8s8s32x_dw_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/nchw_pooling.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/nchw_pooling.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ncsp_batch_normalization.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ncsp_batch_normalization.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/nhwc_pooling.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/nhwc_pooling.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/nspc_batch_normalization.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/nspc_batch_normalization.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_batch_normalization.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_batch_normalization.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_binary_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_binary_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_concat.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_deconvolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_deconvolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_deformable_convolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_deformable_convolution.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_depthwise.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_depthwise.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_eltwise.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_eltwise.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_inner_product.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_inner_product.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_lrn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_lrn.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_pooling.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_pooling.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_quantization.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_quantization.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_roi_pooling.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_roi_pooling.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_shuffle.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_shuffle.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_softmax.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_softmax.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/ref_sum.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/cell_common.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/cell_gru.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/cell_gru_lbr.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/cpu_rnn_pd.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/jit_uni_gru_cell_postgemm_1.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/jit_uni_gru_cell_postgemm_2.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/jit_uni_gru_lbr_cell_postgemm.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/jit_uni_lstm_cell_postgemm.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/jit_uni_rnn_cell_postgemm.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/jit_uni_rnn_common_postgemm.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/jit_uni_rnn_common_postgemm_dispatcher.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/ref_postgemm_gru.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/ref_postgemm_gru_lbr.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/ref_postgemm_lstm.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/ref_postgemm_rnn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/ref_rnn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/ref_rnn.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/rnn_reorders.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/rnn_utils.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/rnn/rnn_utils.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/simple_concat.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/simple_concat.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/simple_q10n.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/simple_reorder.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/simple_sum.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/simple_sum.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/wino_reorder.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/xbyak/COPYRIGHT delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/xbyak/xbyak.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/xbyak/xbyak_bin2hex.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/xbyak/xbyak_mnemonic.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/src/cpu/xbyak/xbyak_util.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/CMakeLists.txt delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/api.c delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/CMakeLists.txt delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/README.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/TODO.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/benchdnn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/bnorm/bench_bnorm.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/bnorm/bnorm.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/bnorm/bnorm.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/bnorm/bnorm_aux.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/bnorm/perf_report.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/bnorm/ref_bnorm.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/common.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/bench_conv.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/bench_deconv.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/cfg.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/conv.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/conv.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/conv_aux.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/conv_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/deconv.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/deconv.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/perf_report.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/ref_conv.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/conv/ref_wino.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/dnn_types.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/dnn_types.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/bnorm_3d delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/bnorm_densenet_121 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/bnorm_googlenet_v2 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/bnorm_googlenet_v3 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/bnorm_large delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/bnorm_regressions delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/bnorm_resnet_50 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/bnorm_topo delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/test_bnorm_all delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/test_bnorm_bfloat16 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/test_bnorm_regressions delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/bnorm/test_bnorm_regressions_large delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_1d delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_1d_wavenet delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_3d delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_3d_unet delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_a3c delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_alexnet delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_all delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_all_topo delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_auto delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_densnet delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_dilated delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_dilated_rfcn delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_fastrcnn delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_fastrcnn_p1 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_fastrcnn_p2 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_fastrcnn_p3 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_gemm delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_googlenet_v1 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_googlenet_v2 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_googlenet_v3 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_maskrcnn delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_maskrcnn_p1 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_maskrcnn_p2 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_mobilenet delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_mobilenet_dw delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_regression_dw delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_regression_gemm delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_regression_padding delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_regression_small_spatial delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_resnet_50 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_resnet_50_sparse delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_segnet delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_ssd_300_voc0712 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_ssd_mobilenet delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_tails delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_unet delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_vgg_11 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_vgg_19 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_xception delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/conv_yolov2 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deconv/deconv_1d delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deconv/deconv_1x1 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deconv/deconv_2d delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deconv/deconv_3d delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deconv/deconv_all delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deconv/deconv_dilated delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deconv/harness_deconv_regression_general delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deconv/test_deconv_1x1 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deconv/test_deconv_all delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deconv/test_deconv_bfloat16 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deepbench delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deepbench_inference_device delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deepbench_inference_server delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/deepbench_training delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/ip/ip_1d delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/ip/ip_all delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/ip/test_ip_all delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/ip/test_ip_bfloat16 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/reorder/test_default delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/rnn/rnn_gru delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/rnn/rnn_gru_small delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/rnn/rnn_inference delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/rnn/rnn_small delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/rnn/rnn_training delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/rnn/test_rnn_inference delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/rnn/test_rnn_small delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/rnn/test_rnn_training delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/shuffle/test_shuffle delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/shuffle/test_shuffle_axis delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/test_conv_3d delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/test_conv_all delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/test_conv_attrs delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/test_conv_bfloat16 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/test_conv_depthwise delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/test_conv_dilated delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/test_conv_dw_bfloat16 delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/test_conv_regression delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/test_conv_regression_general delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/inputs/test_conv_tails delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/ip/bench_ip.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/ip/cfg.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/ip/ip.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/ip/ip.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/ip/ip_aux.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/ip/perf_report.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/ip/ref_ip.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/makefile delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/mkldnn_common.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/mkldnn_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/mkldnn_debug.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/mkldnn_debug.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/mkldnn_memory.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/norm.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/reorder/bench_reorder.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/reorder/cfg.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/reorder/perf_report.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/reorder/reorder.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/reorder/reorder.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/reorder/reorder_aux.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/rnn/bench_rnn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/rnn/cfg.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/rnn/perf_report.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/rnn/ref_rnn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/rnn/rnn.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/rnn/rnn.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/rnn/rnn_aux.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/rnn/rnn_aux.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/self/bnorm.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/self/common.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/self/conv.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/self/self.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/self/self.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/shuffle/bench_shuffle.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/shuffle/perf_report.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/shuffle/ref_shuffle.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/shuffle/shuffle.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/shuffle/shuffle.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/benchdnn/shuffle/shuffle_aux.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/generate_c_symbols_refs.sh delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/CMakeLists.txt delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/convolution_common.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/CMakeLists.txt delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/LICENSE delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest-death-test.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest-matchers.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest-message.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest-param-test.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest-printers.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest-spi.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest-test-part.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest-typed-test.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest_pred_impl.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/gtest_prod.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/custom/README.md delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/custom/gtest-port.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/custom/gtest-printers.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/custom/gtest.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/gtest-death-test-internal.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/gtest-filepath.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/gtest-internal.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/gtest-param-util.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/gtest-port-arch.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/gtest-port.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/gtest-string.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/gtest-type-util.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/internal/gtest-type-util.h.pump delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest-all.cc delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest-death-test.cc delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest-filepath.cc delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest-internal-inl.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest-matchers.cc delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest-port.cc delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest-printers.cc delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest-test-part.cc delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest-typed-test.cc delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest.cc delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/gtest/src/gtest_main.cc delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/in/batch_normalization.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/in/convolution_attr.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/in/convolution_simple.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/in/gemm_in.h delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/main.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/mkldnn_test_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/roi_pooling_test_data.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_batch_normalization_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_batch_normalization_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_batch_normalization_s8.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binarization.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_binarization_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_depthwise_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_dw_conv_binarization_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_dw_conv_depthwise_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_dw_conv_eltwise_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_dw_conv_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_dw_conv_forward_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_dw_conv_sum_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_eltwise_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_forward_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_binary_convolution_sum_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_concat.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_backward_data_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_backward_data_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_backward_data_s16s16s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_backward_weights_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_backward_weights_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_backward_weights_s16s16s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_depthwise_forward_bf16f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_depthwise_forward_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_depthwise_forward_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_depthwise_forward_x8s8f32s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_dw_conv_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_dw_conv_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_dw_conv_u8s8s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_eltwise_forward_bf16.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_eltwise_forward_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_eltwise_forward_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_eltwise_forward_x8s8f32s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_format_any.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_common_3d.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_f32_3d.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_s16s16s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_u8s8fp_asymm.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_u8s8u8.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_x8s8fp.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_x8s8fp_3d.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_x8s8fp_3d_assym.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_x8s8s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_convolution_forward_x8s8s32_3d.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_deconvolution.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_deformable_convolution_forward_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_deformable_convolution_forward_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_depthwise.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_eltwise.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_eltwise.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_gemm_bf16bf16f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_gemm_common.hpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_gemm_f32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_gemm_s8s8s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_gemm_s8u8s32.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_iface_attr.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_iface_pd_iter.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_inner_product_backward_data.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_inner_product_backward_weights.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_inner_product_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_lrn_backward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_lrn_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_memory.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_mkldnn_threading.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_pooling_backward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_pooling_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_quantization.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_reorder.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_rnn_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_roi_pooling_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_shuffle.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_softmax_backward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_softmax_forward.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/gtests/test_sum.cpp delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/other/subproject/CMakeLists.txt delete mode 100644 inference-engine/thirdparty/mkl-dnn/tests/other/subproject/main.c diff --git a/.gitmodules b/.gitmodules index cbb179049d8..cfeab60491d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,16 @@ [submodule "inference-engine/thirdparty/ade"] path = inference-engine/thirdparty/ade url = https://github.com/opencv/ade.git + ignore = dirty +[submodule "inference-engine/thirdparty/mkl-dnn"] + path = inference-engine/thirdparty/mkl-dnn + url = https://github.com/openvinotoolkit/oneDNN.git + ignore = dirty +[submodule "inference-engine/tests/ie_test_utils/common_test_utils/gtest"] + path = inference-engine/tests/ie_test_utils/common_test_utils/gtest + url = https://github.com/openvinotoolkit/googletest.git + ignore = dirty +[submodule "inference-engine/samples/thirdparty/gflags"] + path = inference-engine/samples/thirdparty/gflags + url = https://github.com/gflags/gflags.git ignore = dirty \ No newline at end of file diff --git a/inference-engine/samples/thirdparty/gflags b/inference-engine/samples/thirdparty/gflags new file mode 160000 index 00000000000..46f73f88b18 --- /dev/null +++ b/inference-engine/samples/thirdparty/gflags @@ -0,0 +1 @@ +Subproject commit 46f73f88b18aee341538c0dfc22b1710a6abedef diff --git a/inference-engine/samples/thirdparty/gflags/.gitattributes b/inference-engine/samples/thirdparty/gflags/.gitattributes deleted file mode 100644 index 87fe9c027ec..00000000000 --- a/inference-engine/samples/thirdparty/gflags/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# treat all files in this repository as text files -# and normalize them to LF line endings when committed -* text diff --git a/inference-engine/samples/thirdparty/gflags/.gitignore b/inference-engine/samples/thirdparty/gflags/.gitignore deleted file mode 100644 index 321f70e72f0..00000000000 --- a/inference-engine/samples/thirdparty/gflags/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -/xcode/ -/build/ -/builds/ -/build-*/ -.DS_Store -CMakeCache.txt -DartConfiguration.tcl -Makefile -CMakeFiles/ -/Testing/ -/include/gflags/config.h -/include/gflags/gflags_completions.h -/include/gflags/gflags_declare.h -/include/gflags/gflags.h -/lib/ -/test/gflags_unittest_main.cc -/test/gflags_unittest-main.cc -/packages/ -CMakeLists.txt.user -/bazel-bin -/bazel-genfiles -/bazel-gflags -/bazel-out -/bazel-testlogs diff --git a/inference-engine/samples/thirdparty/gflags/.travis.yml b/inference-engine/samples/thirdparty/gflags/.travis.yml deleted file mode 100644 index 0989c7c852c..00000000000 --- a/inference-engine/samples/thirdparty/gflags/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -# Ubuntu 14.04 Trusty support, to get newer cmake and compilers. -sudo: required -dist: trusty - -language: cpp - -os: - - linux - - osx - -compiler: - - clang - - gcc - -env: - - CONFIG=Release - - CONFIG=Debug - -script: - - mkdir out && cd out && cmake -D CMAKE_BUILD_TYPE=$CONFIG -D GFLAGS_BUILD_SHARED_LIBS=ON -D GFLAGS_BUILD_STATIC_LIBS=ON -D GFLAGS_BUILD_TESTING=ON .. && cmake --build . --config $CONFIG && ctest diff --git a/inference-engine/samples/thirdparty/gflags/AUTHORS.txt b/inference-engine/samples/thirdparty/gflags/AUTHORS.txt deleted file mode 100644 index 887918bd00e..00000000000 --- a/inference-engine/samples/thirdparty/gflags/AUTHORS.txt +++ /dev/null @@ -1,2 +0,0 @@ -google-gflags@googlegroups.com - diff --git a/inference-engine/samples/thirdparty/gflags/BUILD b/inference-engine/samples/thirdparty/gflags/BUILD deleted file mode 100644 index 0a5c9eb3c23..00000000000 --- a/inference-engine/samples/thirdparty/gflags/BUILD +++ /dev/null @@ -1,12 +0,0 @@ -# Bazel (http://bazel.io/) BUILD file for gflags. -# -# See INSTALL.md for instructions for adding gflags to a Bazel workspace. - -licenses(["notice"]) - -exports_files(["src/gflags_complections.sh", "COPYING.txt"]) - -load(":bazel/gflags.bzl", "gflags_sources", "gflags_library") -(hdrs, srcs) = gflags_sources(namespace=["gflags", "google"]) -gflags_library(hdrs=hdrs, srcs=srcs, threads=0) -gflags_library(hdrs=hdrs, srcs=srcs, threads=1) diff --git a/inference-engine/samples/thirdparty/gflags/CMakeLists.txt b/inference-engine/samples/thirdparty/gflags/CMakeLists.txt deleted file mode 100644 index 370907364e2..00000000000 --- a/inference-engine/samples/thirdparty/gflags/CMakeLists.txt +++ /dev/null @@ -1,702 +0,0 @@ -## CMake configuration file of gflags project -## -## This CMakeLists.txt defines some gflags specific configuration variables -## using the "gflags_define" utility macro. The default values of these variables -## can be overridden either on the CMake command-line using the -D option of -## the cmake command or in a super-project which includes the gflags source -## tree by setting the GFLAGS_ CMake variables before adding the -## gflags source directory via CMake's "add_subdirectory" command. Only when -## the non-cached variable GFLAGS_IS_SUBPROJECT has a value equivalent to FALSE, -## these configuration variables are added to the CMake cache so they can be -## edited in the CMake GUI. By default, GFLAGS_IS_SUBPROJECT is set to TRUE when -## the CMAKE_SOURCE_DIR is not identical to the directory of this CMakeLists.txt -## file, i.e., the top-level directory of the gflags project source tree. -## -## When this project is a subproject (GFLAGS_IS_SUBPROJECT is TRUE), the default -## settings are such that only the static single-threaded library is built without -## installation of the gflags files. The "gflags" target is in this case an ALIAS -## library target for the "gflags_nothreads_static" library target. Targets which -## depend on the gflags library should link to the "gflags" library target. -## -## Example CMakeLists.txt of user project which requires separate gflags installation: -## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -## -## project(Foo) -## -## find_package(gflags REQUIRED) -## -## add_executable(foo src/foo.cc) -## target_link_libraries(foo gflags) -## -## Example CMakeLists.txt of user project which requires separate single-threaded static gflags installation: -## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -## -## project(Foo) -## -## find_package(gflags COMPONENTS nothreads_static) -## -## add_executable(foo src/foo.cc) -## target_link_libraries(foo gflags) -## -## Example CMakeLists.txt of super-project which contains gflags source tree: -## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -## -## project(Foo) -## -## add_subdirectory(gflags) -## -## add_executable(foo src/foo.cc) -## target_link_libraries(foo gflags) -## -## Variables to configure the source files: -## - GFLAGS_IS_A_DLL -## - GFLAGS_NAMESPACE -## - GFLAGS_ATTRIBUTE_UNUSED -## - GFLAGS_INTTYPES_FORMAT -## -## Variables to configure the build: -## - GFLAGS_SOVERSION -## - GFLAGS_BUILD_SHARED_LIBS -## - GFLAGS_BUILD_STATIC_LIBS -## - GFLAGS_BUILD_gflags_LIB -## - GFLAGS_BUILD_gflags_nothreads_LIB -## - GFLAGS_BUILD_TESTING -## - GFLAGS_BUILD_PACKAGING -## -## Variables to configure the installation: -## - GFLAGS_INCLUDE_DIR -## - GFLAGS_LIBRARY_INSTALL_DIR or LIB_INSTALL_DIR or LIB_SUFFIX -## - GFLAGS_INSTALL_HEADERS -## - GFLAGS_INSTALL_SHARED_LIBS -## - GFLAGS_INSTALL_STATIC_LIBS - -cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) - -if (POLICY CMP0042) - cmake_policy (SET CMP0042 NEW) -endif () - -# ---------------------------------------------------------------------------- -# includes -include ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake") - -# ---------------------------------------------------------------------------- -# package information -set (PACKAGE_NAME "gflags") -set (PACKAGE_VERSION "2.2.1") -set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") -set (PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") -set (PACKAGE_BUGREPORT "https://github.com/gflags/gflags/issues") -set (PACKAGE_DESCRIPTION "A commandline flags library that allows for distributed flags.") -set (PACKAGE_URL "http://gflags.github.io/gflags") - -project (${PACKAGE_NAME} CXX) -if (CMAKE_VERSION VERSION_LESS 3.4) - # C language still needed because the following required CMake modules - # (or their dependencies, respectively) are not correctly handling - # the case where only CXX is enabled - # - CheckTypeSize.cmake (fixed in CMake 3.1, cf. https://cmake.org/Bug/view.php?id=14056) - # - FindThreads.cmake (fixed in CMake 3.4, cf. https://cmake.org/Bug/view.php?id=14905) - enable_language (C) -endif () - -version_numbers ( - ${PACKAGE_VERSION} - PACKAGE_VERSION_MAJOR - PACKAGE_VERSION_MINOR - PACKAGE_VERSION_PATCH -) - -# shared library ABI version number, can be overridden by package maintainers -# using -DGFLAGS_SOVERSION=XXX on the command-line -if (GFLAGS_SOVERSION) - set (PACKAGE_SOVERSION "${GFLAGS_SOVERSION}") -else () - # TODO: Change default SOVERSION back to PACKAGE_VERSION_MAJOR with the - # next increase of major version number (i.e., 3.0.0 -> SOVERSION 3) - # The . SOVERSION should be used for the 2.x releases - # versions only which temporarily broke the API by changing the default - # namespace from "google" to "gflags". - set (PACKAGE_SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}") -endif () - -# when gflags is included as subproject (e.g., as Git submodule/subtree) in the source -# tree of a project that uses it, no variables should be added to the CMake cache; -# users may set the non-cached variable GFLAGS_IS_SUBPROJECT before add_subdirectory(gflags) -if (NOT DEFINED GFLAGS_IS_SUBPROJECT) - if ("^${CMAKE_SOURCE_DIR}$" STREQUAL "^${PROJECT_SOURCE_DIR}$") - set (GFLAGS_IS_SUBPROJECT FALSE) - else () - set (GFLAGS_IS_SUBPROJECT TRUE) - endif () -endif () - -# prefix for package variables in CMake configuration file -string (TOUPPER "${PACKAGE_NAME}" PACKAGE_PREFIX) - -# convert file path on Windows with back slashes to path with forward slashes -# otherwise this causes an issue with the cmake_install.cmake script -file (TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX) - -# ---------------------------------------------------------------------------- -# options - -# maintain binary backwards compatibility with gflags library version <= 2.0, -# but at the same time enable the use of the preferred new "gflags" namespace -gflags_define (STRING NAMESPACE "Name(s) of library namespace (separate multiple options by semicolon)" "google;${PACKAGE_NAME}" "${PACKAGE_NAME}") -gflags_property (NAMESPACE ADVANCED TRUE) -set (GFLAGS_NAMESPACE_SECONDARY "${NAMESPACE}") -list (REMOVE_DUPLICATES GFLAGS_NAMESPACE_SECONDARY) -if (NOT GFLAGS_NAMESPACE_SECONDARY) - message (FATAL_ERROR "GFLAGS_NAMESPACE must be set to one (or more) valid C++ namespace identifier(s separated by semicolon \";\").") -endif () -foreach (ns IN LISTS GFLAGS_NAMESPACE_SECONDARY) - if (NOT ns MATCHES "^[a-zA-Z][a-zA-Z0-9_]*$") - message (FATAL_ERROR "GFLAGS_NAMESPACE contains invalid namespace identifier: ${ns}") - endif () -endforeach () -list (GET GFLAGS_NAMESPACE_SECONDARY 0 GFLAGS_NAMESPACE) -list (REMOVE_AT GFLAGS_NAMESPACE_SECONDARY 0) - -# cached build options when gflags is not a subproject, otherwise non-cached CMake variables -# usage: gflags_define(BOOL []) -gflags_define (BOOL BUILD_SHARED_LIBS "Request build of shared libraries." OFF OFF) -gflags_define (BOOL BUILD_STATIC_LIBS "Request build of static libraries (default if BUILD_SHARED_LIBS is OFF)." OFF ON) -gflags_define (BOOL BUILD_gflags_LIB "Request build of the multi-threaded gflags library." ON OFF) -gflags_define (BOOL BUILD_gflags_nothreads_LIB "Request build of the single-threaded gflags library." ON ON) -gflags_define (BOOL BUILD_PACKAGING "Enable build of distribution packages using CPack." OFF OFF) -gflags_define (BOOL BUILD_TESTING "Enable build of the unit tests and their execution using CTest." OFF OFF) -gflags_define (BOOL INSTALL_HEADERS "Request installation of headers and other development files." ON OFF) -gflags_define (BOOL INSTALL_SHARED_LIBS "Request installation of shared libraries." ON ON) -gflags_define (BOOL INSTALL_STATIC_LIBS "Request installation of static libraries." ON OFF) -gflags_define (BOOL REGISTER_BUILD_DIR "Request entry of build directory in CMake's package registry." OFF OFF) -gflags_define (BOOL REGISTER_INSTALL_PREFIX "Request entry of installed package in CMake's package registry." ON OFF) - -gflags_property (BUILD_STATIC_LIBS ADVANCED TRUE) -gflags_property (INSTALL_HEADERS ADVANCED TRUE) -gflags_property (INSTALL_SHARED_LIBS ADVANCED TRUE) -gflags_property (INSTALL_STATIC_LIBS ADVANCED TRUE) - -if (NOT GFLAGS_IS_SUBPROJECT) - foreach (varname IN ITEMS CMAKE_INSTALL_PREFIX) - gflags_property (${varname} ADVANCED FALSE) - endforeach () - foreach (varname IN ITEMS CMAKE_CONFIGURATION_TYPES CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT) - gflags_property (${varname} ADVANCED TRUE) - endforeach () - if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) - gflags_set (CMAKE_BUILD_TYPE Release) - endif () - if (CMAKE_CONFIGURATION_TYPES) - gflags_property (CMAKE_BUILD_TYPE STRINGS "${CMAKE_CONFIGURATION_TYPES}") - endif () -endif () # NOT GFLAGS_IS_SUBPROJECT - -if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) - set (BUILD_STATIC_LIBS ON) -endif () -if (NOT BUILD_gflags_LIB AND NOT BUILD_gflags_nothreads_LIB) - message (FATAL_ERROR "At least one of [GFLAGS_]BUILD_gflags_LIB and [GFLAGS_]BUILD_gflags_nothreads_LIB must be ON.") -endif () - -gflags_define (STRING INCLUDE_DIR "Name of include directory of installed header files relative to CMAKE_INSTALL_PREFIX/include/" "${PACKAGE_NAME}") -gflags_property (INCLUDE_DIR ADVANCED TRUE) -file (TO_CMAKE_PATH "${INCLUDE_DIR}" INCLUDE_DIR) -if (IS_ABSOLUTE INCLUDE_DIR) - message (FATAL_ERROR "[GFLAGS_]INCLUDE_DIR must be a path relative to CMAKE_INSTALL_PREFIX/include/") -endif () -if (INCLUDE_DIR MATCHES "^\\.\\.[/\\]") - message (FATAL_ERROR "[GFLAGS_]INCLUDE_DIR must not start with parent directory reference (../)") -endif () -set (GFLAGS_INCLUDE_DIR "${INCLUDE_DIR}") - -# ---------------------------------------------------------------------------- -# system checks -include (CheckTypeSize) -include (CheckIncludeFileCXX) -include (CheckCXXSymbolExists) - -if (WIN32 AND NOT CYGWIN) - set (OS_WINDOWS 1) -else () - set (OS_WINDOWS 0) -endif () - -if (MSVC) - set (HAVE_SYS_TYPES_H 1) - set (HAVE_STDDEF_H 1) # used by CheckTypeSize module - set (HAVE_UNISTD_H 0) - set (HAVE_SYS_STAT_H 1) - set (HAVE_SHLWAPI_H 1) - if (MSVC_VERSION VERSION_LESS 1600) - check_include_file_cxx ("stdint.h" HAVE_STDINT_H) - bool_to_int (HAVE_STDINT_H) # used in #if directive - else () - set (HAVE_STDINT_H 1) - endif () - if (MSVC_VERSION VERSION_LESS 1800) - check_include_file_cxx ("inttypes.h" HAVE_INTTYPES_H) - bool_to_int (HAVE_INTTYPES_H) # used in #if directive - else () - set (HAVE_INTTYPES_H 1) - endif () -else () - foreach (fname IN ITEMS unistd stdint inttypes sys/types sys/stat fnmatch) - string (TOUPPER "${fname}" FNAME) - string (REPLACE "/" "_" FNAME "${FNAME}") - if (NOT HAVE_${FNAME}_H) - check_include_file_cxx ("${fname}.h" HAVE_${FNAME}_H) - endif () - endforeach () - if (NOT HAVE_FNMATCH_H AND OS_WINDOWS) - check_include_file_cxx ("shlwapi.h" HAVE_SHLWAPI_H) - endif () - # the following are used in #if directives not #ifdef - bool_to_int (HAVE_STDINT_H) - bool_to_int (HAVE_SYS_TYPES_H) - bool_to_int (HAVE_INTTYPES_H) -endif () - -gflags_define (STRING INTTYPES_FORMAT "Format of integer types: \"C99\" (uint32_t), \"BSD\" (u_int32_t), \"VC7\" (__int32)" "") -gflags_property (INTTYPES_FORMAT STRINGS "C99;BSD;VC7") -gflags_property (INTTYPES_FORMAT ADVANCED TRUE) -if (NOT INTTYPES_FORMAT) - set (TYPES uint32_t u_int32_t) - if (MSVC) - list (INSERT TYPES 0 __int32) - endif () - foreach (type IN LISTS TYPES) - check_type_size (${type} ${type} LANGUAGE CXX) - if (HAVE_${type}) - break () - endif () - endforeach () - if (HAVE_uint32_t) - gflags_set (INTTYPES_FORMAT C99) - elseif (HAVE_u_int32_t) - gflags_set (INTTYPES_FORMAT BSD) - elseif (HAVE___int32) - gflags_set (INTTYPES_FORMAT VC7) - else () - gflags_property (INTTYPES_FORMAT ADVANCED FALSE) - message (FATAL_ERROR "Do not know how to define a 32-bit integer quantity on your system!" - " Neither uint32_t, u_int32_t, nor __int32 seem to be available." - " Set [GFLAGS_]INTTYPES_FORMAT to either C99, BSD, or VC7 and try again.") - endif () -endif () -# use of special characters in strings to circumvent bug #0008226 -if ("^${INTTYPES_FORMAT}$" STREQUAL "^WIN$") - gflags_set (INTTYPES_FORMAT VC7) -endif () -if (NOT INTTYPES_FORMAT MATCHES "^(C99|BSD|VC7)$") - message (FATAL_ERROR "Invalid value for [GFLAGS_]INTTYPES_FORMAT! Choose one of \"C99\", \"BSD\", or \"VC7\"") -endif () -set (GFLAGS_INTTYPES_FORMAT "${INTTYPES_FORMAT}") -set (GFLAGS_INTTYPES_FORMAT_C99 0) -set (GFLAGS_INTTYPES_FORMAT_BSD 0) -set (GFLAGS_INTTYPES_FORMAT_VC7 0) -set ("GFLAGS_INTTYPES_FORMAT_${INTTYPES_FORMAT}" 1) - -if (MSVC) - set (HAVE_strtoll 0) - set (HAVE_strtoq 0) -else () - check_cxx_symbol_exists (strtoll stdlib.h HAVE_STRTOLL) - if (NOT HAVE_STRTOLL) - check_cxx_symbol_exists (strtoq stdlib.h HAVE_STRTOQ) - endif () -endif () - -if (BUILD_gflags_LIB) - set (CMAKE_THREAD_PREFER_PTHREAD TRUE) - find_package (Threads) - if (Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) - set (HAVE_PTHREAD 1) - check_type_size (pthread_rwlock_t RWLOCK LANGUAGE CXX) - else () - set (HAVE_PTHREAD 0) - endif () - if (UNIX AND NOT HAVE_PTHREAD) - if (CMAKE_HAVE_PTHREAD_H) - set (what "library") - else () - set (what ".h file") - endif () - message (FATAL_ERROR "Could not find pthread${what}. Check the log file" - "\n\t${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "\nor disable the build of the multi-threaded gflags library (BUILD_gflags_LIB=OFF).") - endif () -else () - set (HAVE_PTHREAD 0) -endif () - -# ---------------------------------------------------------------------------- -# source files - excluding root subdirectory and/or .in suffix -set (PUBLIC_HDRS - "gflags.h" - "gflags_declare.h" - "gflags_completions.h" -) - -if (GFLAGS_NAMESPACE_SECONDARY) - set (INCLUDE_GFLAGS_NS_H "// Import gflags library symbols into alternative/deprecated namespace(s)") - foreach (ns IN LISTS GFLAGS_NAMESPACE_SECONDARY) - string (TOUPPER "${ns}" NS) - set (gflags_ns_h "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/gflags_${ns}.h") - configure_file ("${PROJECT_SOURCE_DIR}/src/gflags_ns.h.in" "${gflags_ns_h}" @ONLY) - list (APPEND PUBLIC_HDRS "${gflags_ns_h}") - set (INCLUDE_GFLAGS_NS_H "${INCLUDE_GFLAGS_NS_H}\n#include \"gflags_${ns}.h\"") - endforeach () -else () - set (INCLUDE_GFLAGS_NS_H) -endif () - -set (PRIVATE_HDRS - "config.h" - "util.h" - "mutex.h" -) - -set (GFLAGS_SRCS - "gflags.cc" - "gflags_reporting.cc" - "gflags_completions.cc" -) - -if (OS_WINDOWS) - list (APPEND PRIVATE_HDRS "windows_port.h") - list (APPEND GFLAGS_SRCS "windows_port.cc") -endif () - -# ---------------------------------------------------------------------------- -# configure source files -if (NOT DEFINED GFLAGS_ATTRIBUTE_UNUSED) - if (CMAKE_COMPILER_IS_GNUCXX) - set (GFLAGS_ATTRIBUTE_UNUSED "__attribute((unused))") - else () - set (GFLAGS_ATTRIBUTE_UNUSED) - endif () -endif () - -# whenever we build a shared library (DLL on Windows), configure the public -# headers of the API for use of this shared library rather than the optionally -# also build statically linked library; users can override GFLAGS_DLL_DECL -# in particular, this done by setting the INTERFACE_COMPILE_DEFINITIONS of -# static libraries to include an empty definition for GFLAGS_DLL_DECL -if (NOT DEFINED GFLAGS_IS_A_DLL) - if (BUILD_SHARED_LIBS) - set (GFLAGS_IS_A_DLL 1) - else () - set (GFLAGS_IS_A_DLL 0) - endif () -endif () - -configure_headers (PUBLIC_HDRS ${PUBLIC_HDRS}) -configure_sources (PRIVATE_HDRS ${PRIVATE_HDRS}) -configure_sources (GFLAGS_SRCS ${GFLAGS_SRCS}) - -# ---------------------------------------------------------------------------- -# output directories -if (NOT GFLAGS_IS_SUBPROJECT) - set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin") - set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib") - set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "lib") -endif () - -# ---------------------------------------------------------------------------- -# installation directories -if (OS_WINDOWS) - set (RUNTIME_INSTALL_DIR "bin") - set (LIBRARY_INSTALL_DIR "lib") - set (INCLUDE_INSTALL_DIR "include") - set (CONFIG_INSTALL_DIR "lib/cmake/${PACKAGE_NAME}") - set (PKGCONFIG_INSTALL_DIR) -else () - set (RUNTIME_INSTALL_DIR bin) - # The LIB_INSTALL_DIR and LIB_SUFFIX variables are used by the Fedora - # package maintainers. Also package maintainers of other distribution - # packages need to be able to specify the name of the library directory. - if (NOT GFLAGS_LIBRARY_INSTALL_DIR AND LIB_INSTALL_DIR) - set (GFLAGS_LIBRARY_INSTALL_DIR "${LIB_INSTALL_DIR}") - endif () - gflags_define (PATH LIBRARY_INSTALL_DIR "Directory of installed libraries, e.g., \"lib64\"" "lib${LIB_SUFFIX}") - gflags_property (LIBRARY_INSTALL_DIR ADVANCED TRUE) - set (INCLUDE_INSTALL_DIR include) - set (CONFIG_INSTALL_DIR ${LIBRARY_INSTALL_DIR}/cmake/${PACKAGE_NAME}) - set (PKGCONFIG_INSTALL_DIR ${LIBRARY_INSTALL_DIR}/pkgconfig) -endif () - -# ---------------------------------------------------------------------------- -# add library targets -set (TARGETS) -# static vs. shared -foreach (TYPE IN ITEMS STATIC SHARED) - if (BUILD_${TYPE}_LIBS) - string (TOLOWER "${TYPE}" type) - # whether or not targets are a DLL - if (OS_WINDOWS AND "^${TYPE}$" STREQUAL "^SHARED$") - set (GFLAGS_IS_A_DLL 1) - else () - set (GFLAGS_IS_A_DLL 0) - endif () - # filename suffix for static libraries on Windows - if (OS_WINDOWS AND "^${TYPE}$" STREQUAL "^STATIC$") - set (type_suffix "_${type}") - else () - set (type_suffix "") - endif () - # multi-threaded vs. single-threaded - foreach (opts IN ITEMS "" _nothreads) - if (BUILD_gflags${opts}_LIB) - set (target_name "gflags${opts}_${type}") - add_library (${target_name} ${TYPE} ${GFLAGS_SRCS} ${PRIVATE_HDRS} ${PUBLIC_HDRS}) - set_target_properties (${target_name} PROPERTIES - OUTPUT_NAME "gflags${opts}${type_suffix}" - VERSION "${PACKAGE_VERSION}" - SOVERSION "${PACKAGE_SOVERSION}" - ) - set (include_dirs "$") - if (INSTALL_HEADERS) - list (APPEND include_dirs "$") - endif () - target_include_directories (${target_name} - PUBLIC "${include_dirs}" - PRIVATE "${PROJECT_SOURCE_DIR}/src;${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}" - ) - target_compile_definitions (${target_name} PUBLIC GFLAGS_IS_A_DLL=${GFLAGS_IS_A_DLL}) - if (opts MATCHES "nothreads") - target_compile_definitions (${target_name} PRIVATE NO_THREADS) - elseif (CMAKE_USE_PTHREADS_INIT) - target_link_libraries (${target_name} ${CMAKE_THREAD_LIBS_INIT}) - endif () - if (HAVE_SHLWAPI_H) - target_link_libraries (${target_name} shlwapi.lib) - endif () - list (APPEND TARGETS ${target_name}) - # add convenience make target for build of both shared and static libraries - if (NOT GFLAGS_IS_SUBPROJECT) - if (NOT TARGET gflags${opts}) - add_custom_target (gflags${opts}) - endif () - add_dependencies (gflags${opts} ${target_name}) - endif () - endif () - endforeach () - endif () -endforeach () - -# add ALIAS target for use in super-project, prefer static over shared, single-threaded over multi-threaded -if (GFLAGS_IS_SUBPROJECT) - foreach (type IN ITEMS static shared) - foreach (opts IN ITEMS "_nothreads" "") - if (TARGET gflags${opts}_${type}) - add_library (gflags ALIAS gflags${opts}_${type}) - break () - endif () - endforeach () - if (TARGET gflags) - break () - endif () - endforeach () -endif () - -# ---------------------------------------------------------------------------- -# installation rules -set (EXPORT_NAME ${PACKAGE_NAME}-targets) -file (RELATIVE_PATH INSTALL_PREFIX_REL2CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${CONFIG_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}") -configure_file (cmake/config.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-install.cmake" @ONLY) -configure_file (cmake/version.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" @ONLY) - -if (BUILD_SHARED_LIBS AND INSTALL_SHARED_LIBS) - foreach (opts IN ITEMS "" _nothreads) - if (BUILD_gflags${opts}_LIB) - install (TARGETS gflags${opts}_shared - EXPORT ${EXPORT_NAME} - RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} - LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} - ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}) - endif () - endforeach () -endif () -if (BUILD_STATIC_LIBS AND INSTALL_STATIC_LIBS) - foreach (opts IN ITEMS "" _nothreads) - if (BUILD_gflags${opts}_LIB) - install (TARGETS gflags${opts}_static - EXPORT ${EXPORT_NAME} - RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} - LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} - ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}) - endif () - endforeach () -endif () - -if (INSTALL_HEADERS) - install (FILES ${PUBLIC_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/${GFLAGS_INCLUDE_DIR}) - install ( - FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-install.cmake" - RENAME ${PACKAGE_NAME}-config.cmake - DESTINATION ${CONFIG_INSTALL_DIR} - ) - install ( - FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" - DESTINATION ${CONFIG_INSTALL_DIR} - ) - install (EXPORT ${EXPORT_NAME} DESTINATION ${CONFIG_INSTALL_DIR}) - if (UNIX) - install (PROGRAMS src/gflags_completions.sh DESTINATION ${RUNTIME_INSTALL_DIR}) - endif () -endif () - -if (PKGCONFIG_INSTALL_DIR) - configure_file ("cmake/package.pc.in" "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}.pc" @ONLY) - install (FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}.pc" DESTINATION "${PKGCONFIG_INSTALL_DIR}") -endif () - -# ---------------------------------------------------------------------------- -# support direct use of build tree -set (INSTALL_PREFIX_REL2CONFIG_DIR .) -export (TARGETS ${TARGETS} FILE "${PROJECT_BINARY_DIR}/${EXPORT_NAME}.cmake") -if (REGISTER_BUILD_DIR) - export (PACKAGE ${PACKAGE_NAME}) -endif () -if (REGISTER_INSTALL_PREFIX) - register_gflags_package(${CONFIG_INSTALL_DIR}) -endif () -configure_file (cmake/config.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config.cmake" @ONLY) - -# ---------------------------------------------------------------------------- -# testing - MUST follow the generation of the build tree config file -if (BUILD_TESTING) - include (CTest) - enable_testing () - add_subdirectory (test) -endif () - -# ---------------------------------------------------------------------------- -# packaging -if (BUILD_PACKAGING) - - if (NOT BUILD_SHARED_LIBS AND NOT INSTALL_HEADERS) - message (WARNING "Package will contain static libraries without headers!" - "\nRecommended options for generation of runtime package:" - "\n BUILD_SHARED_LIBS=ON" - "\n BUILD_STATIC_LIBS=OFF" - "\n INSTALL_HEADERS=OFF" - "\n INSTALL_SHARED_LIBS=ON" - "\nRecommended options for generation of development package:" - "\n BUILD_SHARED_LIBS=ON" - "\n BUILD_STATIC_LIBS=ON" - "\n INSTALL_HEADERS=ON" - "\n INSTALL_SHARED_LIBS=ON" - "\n INSTALL_STATIC_LIBS=ON") - endif () - - # default package generators - if (APPLE) - set (PACKAGE_GENERATOR "PackageMaker") - set (PACKAGE_SOURCE_GENERATOR "TGZ;ZIP") - elseif (UNIX) - set (PACKAGE_GENERATOR "DEB;RPM") - set (PACKAGE_SOURCE_GENERATOR "TGZ;ZIP") - else () - set (PACKAGE_GENERATOR "ZIP") - set (PACKAGE_SOURCE_GENERATOR "ZIP") - endif () - - # used package generators - set (CPACK_GENERATOR "${PACKAGE_GENERATOR}" CACHE STRING "List of binary package generators (CPack).") - set (CPACK_SOURCE_GENERATOR "${PACKAGE_SOURCE_GENERATOR}" CACHE STRING "List of source package generators (CPack).") - mark_as_advanced (CPACK_GENERATOR CPACK_SOURCE_GENERATOR) - - # some package generators (e.g., PackageMaker) do not allow .md extension - configure_file ("${CMAKE_CURRENT_LIST_DIR}/README.md" "${CMAKE_CURRENT_BINARY_DIR}/README.txt" COPYONLY) - - # common package information - set (CPACK_PACKAGE_VENDOR "Andreas Schuh") - set (CPACK_PACKAGE_CONTACT "google-gflags@googlegroups.com") - set (CPACK_PACKAGE_NAME "${PACKAGE_NAME}") - set (CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}") - set (CPACK_PACKAGE_VERSION_MAJOR "${PACKAGE_VERSION_MAJOR}") - set (CPACK_PACKAGE_VERSION_MINOR "${PACKAGE_VERSION_MINOR}") - set (CPACK_PACKAGE_VERSION_PATCH "${PACKAGE_VERSION_PATCH}") - set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_DESCRIPTION}") - set (CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_BINARY_DIR}/README.txt") - set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/COPYING.txt") - set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/README.txt") - set (CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") - set (CPACK_OUTPUT_FILE_PREFIX packages) - set (CPACK_PACKAGE_RELOCATABLE TRUE) - set (CPACK_MONOLITHIC_INSTALL TRUE) - - # RPM package information -- used in cmake/package.cmake.in also for DEB - set (CPACK_RPM_PACKAGE_GROUP "Development/Libraries") - set (CPACK_RPM_PACKAGE_LICENSE "BSD") - set (CPACK_RPM_PACKAGE_URL "${PACKAGE_URL}") - set (CPACK_RPM_CHANGELOG_FILE "${CMAKE_CURRENT_LIST_DIR}/ChangeLog.txt") - - if (INSTALL_HEADERS) - set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}/doc/index.html") - else () - set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}/cmake/README_runtime.txt") - endif () - - # system/architecture - if (WINDOWS) - if (CMAKE_CL_64) - set (CPACK_SYSTEM_NAME "win64") - else () - set (CPACK_SYSTEM_NAME "win32") - endif () - set (CPACK_PACKAGE_ARCHITECTURE) - elseif (APPLE) - set (CPACK_PACKAGE_ARCHITECTURE darwin) - else () - string (TOLOWER "${CMAKE_SYSTEM_NAME}" CPACK_SYSTEM_NAME) - if (CMAKE_CXX_FLAGS MATCHES "-m32") - set (CPACK_PACKAGE_ARCHITECTURE i386) - else () - execute_process ( - COMMAND dpkg --print-architecture - RESULT_VARIABLE RV - OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE - ) - if (RV EQUAL 0) - string (STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE) - else () - execute_process (COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE) - if (CPACK_PACKAGE_ARCHITECTURE MATCHES "x86_64") - set (CPACK_PACKAGE_ARCHITECTURE amd64) - else () - set (CPACK_PACKAGE_ARCHITECTURE i386) - endif () - endif () - endif () - endif () - - # source package settings - set (CPACK_SOURCE_TOPLEVEL_TAG "source") - set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") - set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;\\\\.swp$;\\\\.#;/#;\\\\.*~;cscope\\\\.*;/[Bb]uild[.+-_a-zA-Z0-9]*/") - - # default binary package settings - set (CPACK_INCLUDE_TOPLEVEL_DIRECTORY TRUE) - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}") - if (CPACK_PACKAGE_ARCHITECTURE) - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_ARCHITECTURE}") - endif () - - # generator specific configuration file - # - # allow package maintainers to use their own configuration file - # $ cmake -DCPACK_PROJECT_CONFIG_FILE:FILE=/path/to/package/config - if (NOT CPACK_PROJECT_CONFIG_FILE) - configure_file ( - "${CMAKE_CURRENT_LIST_DIR}/cmake/package.cmake.in" - "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-package.cmake" @ONLY - ) - set (CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-package.cmake") - endif () - - include (CPack) - -endif () # BUILD_PACKAGING diff --git a/inference-engine/samples/thirdparty/gflags/COPYING.txt b/inference-engine/samples/thirdparty/gflags/COPYING.txt deleted file mode 100644 index d15b0c24134..00000000000 --- a/inference-engine/samples/thirdparty/gflags/COPYING.txt +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (c) 2006, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/inference-engine/samples/thirdparty/gflags/ChangeLog.txt b/inference-engine/samples/thirdparty/gflags/ChangeLog.txt deleted file mode 100644 index c26d0ab11fb..00000000000 --- a/inference-engine/samples/thirdparty/gflags/ChangeLog.txt +++ /dev/null @@ -1,254 +0,0 @@ -* Tue Jul 11 2017 - Andreas Schuh - -- gflags: version 2.2.1 -- Link to online documentation in README -- Merged 194: Include utils by file instead of CMAKE_MODULE_PATH search -- Merged 195: Remove unused program_name variable -- Merged 196: Enable language C for older CMake versions when needed -- Merged 202: Changed include directory in bazel build -- Merged 207: Mark single argument constructors in mutex.h as explicit -- Merged 209: Use inttypes.h on VC++ 2013 and later -- Merged 212: Fix statically linked gflags library with MSVC -- Meregd 213: Modify installation paths on Windows for vcpkg -- Merged 215: Fix static initialization order fiasco caused by global registry lock -- Merged 216: Fix use of ARGC in CMake macros -- Merged 222: Static code analyzer error regarding strncmp with empty kRootDir -- Merged 224: Check HAVE_STDINT_H or HAVE_INTTYPES_H for older MSVC versions - -* Fri Nov 25 2016 - Andreas Schuh - -- gflags: version 2.2.0 -- Merged 178: Implicitly convert dashes in option names to underscores -- Merged 159: CI builds and automatic tests with Travis CI and AppVeyor -- Merged 158: Use enum for flag value types -- Merged 126: File name postfix for static libraries on Windows -- Closed issue 120: Configure and install gflags.pc file for pkg-config users -- Fixed issue 127: snprintf already defined when building with MSVC 2015 -- Fixed issue 51/138: Memory leaks reported by valgrind -- Fixed issue 173: Validate flags only once -- Fixed issue 168: Unsigned and signed comparison in gflags_reporting.cc -- Fixed issues 176/153: Add -lpthread link argument to Bazel build, refactor BUILD rules -- Fixed issue 89: Add GFLAGS_IS_A_DLL to imported CMake target INTERFACE_COMPILE_DEFINITIONS -- Fixed issue 104: Set INTERFACE_INCLUDE_DIRECTORIES of exported CMake targets -- Fixed issue 174: Missing gflags-targets.cmake file after installation -- Fixed issue 186: Error linking to gflags IMPLIB with MSVC using CMake -- Closed issue 106: Add example project to test use of gflags library - -* Tue Mar 24 2014 - Andreas Schuh - -- gflags: version 2.1.2 -- Moved project to GitHub -- Added GFLAGS_NAMESPACE definition to gflags_declare.h -- Fixed issue 94: Keep "google" as primary namespace and import symbols into "gflags" namespace -- Fixed issue 96: Fix binary ABI compatibility with gflags 2.0 using "google" as primary namespace -- Fixed issue 97/101: Removed (patched) CMake modules and enabled C language instead -- Fixed issue 103: Set CMake policy CMP0042 to silence warning regarding MACOS_RPATH setting - -* Sun Mar 20 2014 - Andreas Schuh - -- gflags: version 2.1.1 -- Fixed issue 77: GFLAGS_IS_A_DLL expands to empty string in gflags_declare.h -- Fixed issue 79: GFLAGS_NAMESPACE not expanded to actual namespace in gflags_declare.h -- Fixed issue 80: Allow include path to differ from GFLAGS_NAMESPACE - -* Thu Mar 20 2014 - Andreas Schuh - -- gflags: version 2.1.0 -- Build system configuration using CMake instead of autotools -- CPack packaging support for Debian/Ubuntu, Red Hat, and Mac OS X -- Fixed issue 54: Fix "invalid suffix on literal" (C++11) -- Fixed issue 57: Use _strdup instead of strdup on Windows -- Fixed issue 62: Change all preprocessor include guards to start with GFLAGS_ -- Fixed issue 64: Add DEFINE_validator macro -- Fixed issue 73: Warnings in Visual Studio 2010 and unable to compile unit test - -* Wed Jan 25 2012 - Google Inc. - -- gflags: version 2.0 -- Changed the 'official' gflags email in setup.py/etc -- Renamed google-gflags.sln to gflags.sln -- Changed copyright text to reflect Google's relinquished ownership - -* Tue Dec 20 2011 - Google Inc. - -- google-gflags: version 1.7 -- Add CommandLineFlagInfo::flag_ptr pointing to current storage (musji) -- PORTING: flush after writing to stderr, needed on cygwin -- PORTING: Clean up the GFLAGS_DLL_DECL stuff better -- Fix a bug in StringPrintf() that affected large strings (csilvers) -- Die at configure-time when g++ isn't installed - -* Fri Jul 29 2011 - Google Inc. - -- google-gflags: version 1.6 -- BUGFIX: Fix a bug where we were leaving out a required $(top_srcdir) -- Fix definition of clstring (jyrki) -- Split up flag declares into its own file (jyrki) -- Add --version support (csilvers) -- Update the README for gflags with static libs -- Update acx_pthread.m4 for nostdlib -- Change ReparseCommandLineFlags to return void (csilvers) -- Some doc typofixes and example augmentation (various) - -* Mon Jan 24 2011 - Google Inc. - -- google-gflags: version 1.5 -- Better reporting of current vs default value (handler) -- Add API for cleaning up of memory at program-exit (jmarantz) -- Fix macros to work inside namespaces (csilvers) -- Use our own string typedef in case string is redefined (csilvers) -- Updated to autoconf 2.65 - -* Wed Oct 13 2010 - Google Inc. - -- google-gflags: version 1.4 -- Add a check to prevent passing 0 to DEFINE_string (jorg) -- Reduce compile (.o) size (jyrki) -- Some small changes to quiet debug compiles (alexk) -- PORTING: better support static linking on windows (csilvers) -- DOCUMENTATION: change default values, use validators, etc. -- Update the NEWS file to be non-empty -- Add pkg-config (.pc) files for libgflags and libgflags_nothreads - -* Mon Jan 4 2010 - Google Inc. - -- google-gflags: version 1.3 -- PORTABILITY: can now build and run tests under MSVC (csilvers) -- Remove the python gflags code, which is now its own package (tansell) -- Clarify that "last flag wins" in the docs (csilvers) -- Comment danger of using GetAllFlags in validators (wojtekm) -- PORTABILITY: Some fixes necessary for c++0x (mboerger) -- Makefile fix: $(srcdir) -> $(top_srcdir) in one place (csilvres) -- INSTALL: autotools to autoconf v2.64 + automake v1.11 (csilvers) - -* Thu Sep 10 2009 - Google Inc. - -- google-gflags: version 1.2 -- PORTABILITY: can now build and run tests under mingw (csilvers) -- Using a string arg for a bool flag is a compile-time error (rbayardo) -- Add --helpxml to gflags.py (salcianu) -- Protect against a hypothetical global d'tor mutex problem (csilvers) -- BUGFIX: can now define a flag after 'using namespace google' (hamaji) - -* Tue Apr 14 2009 - Google Inc. - -- google-gflags: version 1.1 -- Add both foo and nofoo for boolean flags, with --undefok (andychu) -- Better document how validators work (wojtekm) -- Improve binary-detection for bash-completion (mtamsky) -- Python: Add a concept of "key flags", used with --help (salcianu) -- Python: Robustify flag_values (salcianu) -- Python: Add a new DEFINE_bool alias (keir, andrewliu) -- Python: Do module introspection based on module name (dsturtevant) -- Fix autoconf a bit better, especially on windows and solaris (ajenjo) -- BUG FIX: gflags_nothreads was linking against the wrong lib (ajenjo) -- BUG FIX: threads-detection failed on FreeBSD; replace it (ajenjo) -- PORTABILITY: Quiet an internal compiler error with SUSE 10 (csilvers) -- PORTABILITY: Update deb.sh for more recenty debuilds (csilvers) -- PORTABILITY: #include more headers to satify new gcc's (csilvers) -- INSTALL: Updated to autoconf 2.61 and libtool 1.5.26 (csilvers) - -* Fri Oct 3 2008 - Google Inc. - -- google-gflags: version 1.0 -- Add a missing newline to an error string (bcmills) -- (otherwise exactly the same as gflags 1.0rc2) - -* Thu Sep 18 2008 - Google Inc. - -- google-gflags: version 1.0rc2 -- Report current flag values in --helpxml (hdn) -- Fix compilation troubles with gcc 4.3.3 (simonb) -- BUG FIX: I was missing a std:: in DECLARE_string (csilvers) -- BUG FIX: Clarify in docs how to specify --bool flags (csilvers) -- BUG FIX: Fix --helpshort for source files not in a subdir (csilvers) -- BUG FIX: Fix python unittest for 64-bit builds (bcmills) - -* Tue Aug 19 2008 - Google Inc. - -- google-gflags: version 1.0rc1 -- Move #include files from google/ to gflags/ (csilvers) -- Small optimizations to reduce binary (library) size (jyrki) -- BUGFIX: forgot a std:: in one of the .h files (csilvers) -- Speed up locking by making sure calls are inlined (ajenjo) -- 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers) -- PORTABILITY: fix Makefile to work with Cygwin (ajenjo) -- PORTABILITY: fix code to compile under Visual Studio (ajenjo) -- PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers) - -* Mon Jul 21 2008 - Google Inc. - -- google-gflags: version 0.9 -- Add the ability to validate a command-line flag (csilvers) -- Add completion support for commandline flags in bash (daven) -- Add -W compile flags to Makefile, when using gcc (csilvers) -- Allow helpstring to be NULL (cristianoc) -- Improved documentation of classes in the .cc file (csilvers) -- Fix python bug with AppendFlagValues + shortnames (jjtswan) -- Use bool instead of int for boolean flags in gflags.py (bcmills) -- Simplify the way we declare flags, now more foolproof (csilvers) -- Better error messages when bool flags collide (colohan) -- Only evaluate DEFINE_foo macro args once (csilvers) - -* Wed Mar 26 2008 - Google Inc. - -- google-gflags: version 0.8 -- Export DescribeOneFlag() in the API -- Add support for automatic line wrapping at 80 cols for gflags.py -- Bugfix: do not treat an isolated "-" the same as an isolated "--" -- Update rpm spec to point to Google Code rather than sourceforge (!) -- Improve documentation (including documenting thread-safety) -- Improve #include hygiene -- Improve testing - -* Thu Oct 18 2007 - Google Inc. - -- google-gflags: version 0.7 -- Deal even more correctly with libpthread not linked in (csilvers) -- Add STRIP_LOG, an improved DO_NOT_SHOW_COMMANDLINE_HELP (sioffe) -- Be more accurate printing default flag values in --help (dsturtevant) -- Reduce .o file size a bit by using shorter namespace names (jeff) -- Use relative install path, so 'setup.py --home' works (csilvers) -- Notice when a boolean flag has a non-boolean default (bnmouli) -- Broaden --helpshort to match foo-main.cc and foo_main.cc (hendrie) -- Fix "no modules match" message for --helpshort, etc (hendrie) - -* Wed Aug 15 2007 - Google Inc. - -- google-gflags: version 0.6 -- Deal correctly with case that libpthread is not linked in (csilvers) -- Update Makefile/tests so we pass "make distcheck" (csilvers) -- Document and test that last assignment to a flag wins (wan) - -* Tue Jun 12 2007 - Google Inc. - -- google-gflags: version 0.5 -- Include all m4 macros in the distribution (csilvers) -- Python: Fix broken data_files field in setup.py (sidlon) -- Python: better string serliaizing and unparsing (abo, csimmons) -- Fix checks for NaN and inf to work with Mac OS X (csilvers) - -* Thu Apr 19 2007 - Google Inc. - -- google-gflags: version 0.4 -- Remove is_default from GetCommandLineFlagInfo (csilvers) -- Portability fixes: includes, strtoll, gcc4.3 errors (csilvers) -- A few doc typo cleanups (csilvers) - -* Wed Mar 28 2007 - Google Inc. - -- google-gflags: version 0.3 -- python portability fix: use popen instead of subprocess (csilvers) -- Add is_default to CommandLineFlagInfo (pchien) -- Make docs a bit prettier (csilvers) -- Actually include the python files in the distribution! :-/ (csilvers) - -* Mon Jan 22 2007 - Google Inc. - -- google-gflags: version 0.2 -- added support for python commandlineflags, as well as c++ -- gflags2man, a script to turn flags into a man page (dchristian) - -* Wed Dec 13 2006 - Google Inc. - -- google-gflags: version 0.1 diff --git a/inference-engine/samples/thirdparty/gflags/INSTALL.md b/inference-engine/samples/thirdparty/gflags/INSTALL.md deleted file mode 100644 index d37528fb841..00000000000 --- a/inference-engine/samples/thirdparty/gflags/INSTALL.md +++ /dev/null @@ -1,88 +0,0 @@ -Installing a binary distribution package -======================================== - -No official binary distribution packages are provided by the gflags developers. -There may, however, be binary packages available for your OS. Please consult -also the package repositories of your Linux distribution. - -For example on Debian/Ubuntu Linux, gflags can be installed using the -following command: - - sudo apt-get install libgflags-dev - - -Compiling the source code with CMake -========================= - -The build system of gflags is since version 2.1 based on [CMake](http://cmake.org). -The common steps to build, test, and install software are therefore: - -1. Extract source files. -2. Create build directory and change to it. -3. Run CMake to configure the build tree. -4. Build the software using selected build tool. -5. Test the built software. -6. Install the built files. - -On Unix-like systems with GNU Make as build tool, these build steps can be -summarized by the following sequence of commands executed in a shell, -where ```$package``` and ```$version``` are shell variables which represent -the name of this package and the obtained version of the software. - - $ tar xzf gflags-$version-source.tar.gz - $ cd gflags-$version - $ mkdir build && cd build - $ ccmake .. - - - Press 'c' to configure the build system and 'e' to ignore warnings. - - Set CMAKE_INSTALL_PREFIX and other CMake variables and options. - - Continue pressing 'c' until the option 'g' is available. - - Then press 'g' to generate the configuration files for GNU Make. - - $ make - $ make test (optional) - $ make install (optional) - -In the following, only gflags-specific CMake settings available to -configure the build and installation are documented. Note that most of these -variables are for advanced users and binary package maintainers only. -They usually do not have to be modified. - - -CMake Option | Description ---------------------------- | ------------------------------------------------------- -CMAKE_INSTALL_PREFIX | Installation directory, e.g., "/usr/local" on Unix and "C:\Program Files\gflags" on Windows. -BUILD_SHARED_LIBS | Request build of dynamic link libraries. -BUILD_STATIC_LIBS | Request build of static link libraries. Implied if BUILD_SHARED_LIBS is OFF. -BUILD_PACKAGING | Enable binary package generation using CPack. -BUILD_TESTING | Build tests for execution by CTest. -BUILD_NC_TESTS | Request inclusion of negative compilation tests (requires Python). -BUILD_CONFIG_TESTS | Request inclusion of package configuration tests (requires Python). -BUILD_gflags_LIBS | Request build of multi-threaded gflags libraries (if threading library found). -BUILD_gflags_nothreads_LIBS | Request build of single-threaded gflags libraries. -GFLAGS_NAMESPACE | Name of the C++ namespace to be used by the gflags library. Note that the public source header files are installed in a subdirectory named after this namespace. To maintain backwards compatibility with the Google Commandline Flags, set this variable to "google". The default is "gflags". -GFLAGS_INTTYPES_FORMAT | String identifying format of built-in integer types. -GFLAGS_INCLUDE_DIR | Name of headers installation directory relative to CMAKE_INSTALL_PREFIX. -LIBRARY_INSTALL_DIR | Name of library installation directory relative to CMAKE_INSTALL_PREFIX. -INSTALL_HEADERS | Request installation of public header files. - -Using gflags with [Bazel](http://bazel.io) -========================= - -To use gflags in a Bazel project, map it in as an external dependency by editing -your WORKSPACE file: - - git_repository( - name = "com_github_gflags_gflags", - commit = "", - remote = "https://github.com/gflags/gflags.git", - ) - - bind( - name = "gflags", - actual = "@com_github_gflags_gflags//:gflags", - ) - -You can then add `//external:gflags` to the `deps` section of a `cc_binary` or -`cc_library` rule, and `#include ` to include it in your source -code. diff --git a/inference-engine/samples/thirdparty/gflags/README.md b/inference-engine/samples/thirdparty/gflags/README.md deleted file mode 100644 index 9f3e3f2dac3..00000000000 --- a/inference-engine/samples/thirdparty/gflags/README.md +++ /dev/null @@ -1,305 +0,0 @@ -[![Build Status](https://travis-ci.org/gflags/gflags.svg?branch=master)](https://travis-ci.org/gflags/gflags) -[![Build status](https://ci.appveyor.com/api/projects/status/4ctod566ysraus74/branch/master?svg=true)](https://ci.appveyor.com/project/schuhschuh/gflags/branch/master) - -The documentation of the gflags library is available online at https://gflags.github.io/gflags/. - -11 July 2017 ------------- - -I've just released gflags 2.2.1. - -This maintenance release primarily fixes build issues on Windows and -false alarms reported by static code analyzers. - -Please report any further issues with this release using the GitHub issue tracker. - - -25 November 2016 ----------------- - -I've finally released gflags 2.2.0. - -This release adds support for use of the gflags library as external dependency -not only in projects using CMake, but also [Bazel](https://bazel.build/), -or [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/). -One new minor feature is added in this release: when a command flag argument -contains dashes, these are implicitly converted to underscores. -This is to allow those used to separate words of the flag name by dashes -to do so, while the flag variable names are required to use underscores. - -Memory leaks reported by valgrind should be resolved by this release. -This release fixes build errors with MS Visual Studio 2015. - -Please report any further issues with this release using the GitHub issue tracker. - - -24 March 2015 -------------- - -I've just released gflags 2.1.2. - -This release completes the namespace change fixes. In particular, -it restores binary ABI compatibility with release version 2.0. -The deprecated "google" namespace is by default still kept as -primary namespace while symbols are imported into the new "gflags" namespace. -This can be overridden using the CMake variable GFLAGS_NAMESPACE. - -Other fixes of the build configuration are related to the (patched) -CMake modules FindThreads.cmake and CheckTypeSize.cmake. These have -been removed and instead the C language is enabled again even though -gflags is written in C++ only. - -This release also marks the complete move of the gflags project -from Google Code to GitHub. Email addresses of original issue -reporters got lost in the process. Given the age of most issue reports, -this should be negligable. - -Please report any further issues using the GitHub issue tracker. - - -30 March 2014 -------------- - -I've just released gflags 2.1.1. - -This release fixes a few bugs in the configuration of gflags\_declare.h -and adds a separate GFLAGS\_INCLUDE\_DIR CMake variable to the build configuration. -Setting GFLAGS\_NAMESPACE to "google" no longer changes also the include -path of the public header files. This allows the use of the library with -other Google projects such as glog which still use the deprecated "google" -namespace for the gflags library, but include it as "gflags/gflags.h". - -20 March 2014 -------------- - -I've just released gflags 2.1. - -The major changes are the use of CMake for the build configuration instead -of the autotools and packaging support through CPack. The default namespace -of all C++ symbols is now "gflags" instead of "google". This can be -configured via the GFLAGS\_NAMESPACE variable. - -This release compiles with all major compilers without warnings and passed -the unit tests on Ubuntu 12.04, Windows 7 (Visual Studio 2008 and 2010, -Cygwin, MinGW), and Mac OS X (Xcode 5.1). - -The SVN repository on Google Code is now frozen and replaced by a Git -repository such that it can be used as Git submodule by projects. The main -hosting of this project remains at Google Code. Thanks to the distributed -character of Git, I can push (and pull) changes from both GitHub and Google Code -in order to keep the two public repositories in sync. -When fixing an issue for a pull request through either of these hosting -platforms, please reference the issue number as -[described here](https://code.google.com/p/support/wiki/IssueTracker#Integration_with_version_control). -For the further development, I am following the -[Git branching model](http://nvie.com/posts/a-successful-git-branching-model/) -with feature branch names prefixed by "feature/" and bugfix branch names -prefixed by "bugfix/", respectively. - -Binary and source [packages](https://github.com/schuhschuh/gflags/releases) are available on GitHub. - - -14 January 2014 ---------------- - -The migration of the build system to CMake is almost complete. -What remains to be done is rewriting the tests in Python such they can be -executed on non-Unix platforms and splitting them up into separate CTest tests. -Though merging these changes into the master branch yet remains to be done, -it is recommended to already start using the -[cmake-migration](https://github.com/schuhschuh/gflags/tree/cmake-migration) branch. - - -20 April 2013 -------------- - -More than a year has past since I (Andreas) took over the maintenance for -`gflags`. Only few minor changes have been made since then, much to my regret. -To get more involved and stimulate participation in the further -development of the library, I moved the project source code today to -[GitHub](https://github.com/schuhschuh/gflags). -I believe that the strengths of [Git](http://git-scm.com/) will allow for better community collaboration -as well as ease the integration of changes made by others. I encourage everyone -who would like to contribute to send me pull requests. -Git's lightweight feature branches will also provide the right tool for more -radical changes which should only be merged back into the master branch -after these are complete and implement the desired behavior. - -The SVN repository remains accessible at Google Code and I will keep the -master branch of the Git repository hosted at GitHub and the trunk of the -Subversion repository synchronized. Initially, I was going to simply switch the -Google Code project to Git, but in this case the SVN repository would be -frozen and force everyone who would like the latest development changes to -use Git as well. Therefore I decided to host the public Git repository at GitHub -instead. - -Please continue to report any issues with gflags on Google Code. The GitHub project will -only be used to host the Git repository. - -One major change of the project structure I have in mind for the next weeks -is the migration from autotools to [CMake](http://www.cmake.org/). -Check out the (unstable!) -[cmake-migration](https://github.com/schuhschuh/gflags/tree/cmake-migration) -branch on GitHub for details. - - -25 January 2012 ---------------- - -I've just released gflags 2.0. - -The `google-gflags` project has been renamed to `gflags`. I -(csilvers) am stepping down as maintainer, to be replaced by Andreas -Schuh. Welcome to the team, Andreas! I've seen the energy you have -around gflags and the ideas you have for the project going forward, -and look forward to having you on the team. - -I bumped the major version number up to 2 to reflect the new community -ownership of the project. All the [changes](ChangeLog.txt) -are related to the renaming. There are no functional changes from -gflags 1.7. In particular, I've kept the code in the namespace -`google`, though in a future version it should be renamed to `gflags`. -I've also kept the `/usr/local/include/google/` subdirectory as -synonym of `/usr/local/include/gflags/`, though the former name has -been obsolete for some time now. - - -18 January 2011 ---------------- - -The `google-gflags` Google Code page has been renamed to -`gflags`, in preparation for the project being renamed to -`gflags`. In the coming weeks, I'll be stepping down as -maintainer for the gflags project, and as part of that Google is -relinquishing ownership of the project; it will now be entirely -community run. The name change reflects that shift. - - -20 December 2011 ----------------- - -I've just released gflags 1.7. This is a minor release; the major -change is that `CommandLineFlagInfo` now exports the address in memory -where the flag is located. There has also been a bugfix involving -very long --help strings, and some other minor [changes](ChangeLog.txt). - -29 July 2011 ------------- - -I've just released gflags 1.6. The major new feature in this release -is support for setting version info, so that --version does something -useful. - -One minor change has required bumping the library number: -`ReparseCommandlineFlags` now returns `void` instead of `int` (the int -return value was always meaningless). Though I doubt anyone ever used -this (meaningless) return value, technically it's a change to the ABI -that requires a version bump. A bit sad. - -There's also a procedural change with this release: I've changed the -internal tools used to integrate Google-supplied patches for gflags -into the opensource release. These new tools should result in more -frequent updates with better change descriptions. They will also -result in future `ChangeLog` entries being much more verbose (for better -or for worse). - -See the [ChangeLog](ChangeLog.txt) for a full list of changes for this release. - -24 January 2011 ---------------- - -I've just released gflags 1.5. This release has only minor changes -from 1.4, including some slightly better reporting in --help, and -an new memory-cleanup function that can help when running gflags-using -libraries under valgrind. The major change is to fix up the macros -(`DEFINE_bool` and the like) to work more reliably inside namespaces. - -If you have not had a problem with these macros, and don't need any of -the other changes described, there is no need to upgrade. See the -[ChangeLog](ChangeLog.txt) for a full list of changes for this release. - -11 October 2010 ---------------- - -I've just released gflags 1.4. This release has only minor changes -from 1.3, including some documentation tweaks and some work to make -the library smaller. If 1.3 is working well for you, there's no -particular reason to upgrade. - -4 January 2010 --------------- - -I've just released gflags 1.3. gflags now compiles under MSVC, and -all tests pass. I **really** never thought non-unix-y Windows folks -would want gflags, but at least some of them do. - -The major news, though, is that I've separated out the python package -into its own library, [python-gflags](http://code.google.com/p/python-gflags). -If you're interested in the Python version of gflags, that's the place to -get it now. - -10 September 2009 ------------------ - -I've just released gflags 1.2. The major change from gflags 1.1 is it -now compiles under MinGW (as well as cygwin), and all tests pass. I -never thought Windows folks would want unix-style command-line flags, -since they're so different from the Windows style, but I guess I was -wrong! - -The other changes are minor, such as support for --htmlxml in the -python version of gflags. - -15 April 2009 -------------- - -I've just released gflags 1.1. It has only minor changes fdrom gflags -1.0 (see the [ChangeLog](ChangeLog.txt) for details). -The major change is that I moved to a new system for creating .deb and .rpm files. -This allows me to create x86\_64 deb and rpm files. - -In the process of moving to this new system, I noticed an -inconsistency: the tar.gz and .rpm files created libraries named -libgflags.so, but the deb file created libgoogle-gflags.so. I have -fixed the deb file to create libraries like the others. I'm no expert -in debian packaging, but I believe this has caused the package name to -change as well. Please let me know (at -[[mailto:google-gflags@googlegroups.com](mailto:google-gflags@googlegroups.com) -google-gflags@googlegroups.com]) if this causes problems for you -- -especially if you know of a fix! I would be happy to change the deb -packages to add symlinks from the old library name to the new -(libgoogle-gflags.so -> libgflags.so), but that is beyond my knowledge -of how to make .debs. - -If you've tried to install a .rpm or .deb and it doesn't work for you, -let me know. I'm excited to finally have 64-bit package files, but -there may still be some wrinkles in the new system to iron out. - -1 October 2008 --------------- - -gflags 1.0rc2 was out for a few weeks without any issues, so gflags -1.0 is now released. This is much like gflags 0.9. The major change -is that the .h files have been moved from `/usr/include/google` to -`/usr/include/gflags`. While I have backwards-compatibility -forwarding headeds in place, please rewrite existing code to say -``` - #include -``` -instead of -``` - #include -``` - -I've kept the default namespace to google. You can still change with -with the appropriate flag to the configure script (`./configure ---help` to see the flags). If you have feedback as to whether the -default namespace should change to gflags, which would be a -non-backwards-compatible change, send mail to -`google-gflags@googlegroups.com`! - -Version 1.0 also has some neat new features, like support for bash -commandline-completion of help flags. See the [ChangeLog](ChangeLog.txt) -for more details. - -If I don't hear any bad news for a few weeks, I'll release 1.0-final. diff --git a/inference-engine/samples/thirdparty/gflags/WORKSPACE b/inference-engine/samples/thirdparty/gflags/WORKSPACE deleted file mode 100644 index f3707e9069b..00000000000 --- a/inference-engine/samples/thirdparty/gflags/WORKSPACE +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright 2006 Google Inc. All Rights Reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the COPYING.txt file. - -# Bazel (http://bazel.io/) WORKSPACE file for gflags. -workspace(name="com_github_gflags_gflags") diff --git a/inference-engine/samples/thirdparty/gflags/appveyor.yml b/inference-engine/samples/thirdparty/gflags/appveyor.yml deleted file mode 100644 index a5110e55594..00000000000 --- a/inference-engine/samples/thirdparty/gflags/appveyor.yml +++ /dev/null @@ -1,68 +0,0 @@ -# Configuration for continuous integration service at appveyor.com - -version: '{build}' - -os: Visual Studio 2015 - -environment: - matrix: - - Toolset: v140 - - Toolset: v120 - - Toolset: v110 - - Toolset: v100 - - Toolset: v90 - -platform: - - Win32 - - x64 - -configuration: - - Release - -matrix: - exclude: - - Toolset: v90 - platform: x64 - - Toolset: v100 - platform: x64 - -build: - verbosity: minimal - -before_build: -- ps: | - Write-Output "Configuration: $env:CONFIGURATION" - Write-Output "Platform: $env:PLATFORM" - $generator = switch ($env:TOOLSET) - { - "v140" {"Visual Studio 14 2015"} - "v120" {"Visual Studio 12 2013"} - "v110" {"Visual Studio 11 2012"} - "v100" {"Visual Studio 10 2010"} - "v90" {"Visual Studio 9 2008"} - } - if ($env:PLATFORM -eq "x64") - { - $generator = "$generator Win64" - } - -build_script: -- ps: | - md _build -Force | Out-Null - cd _build - - & cmake -G "$generator" -D CMAKE_CONFIGURATION_TYPES="Debug;Release" -D GFLAGS_BUILD_TESTING=ON -D GFLAGS_BUILD_SHARED_LIBS=ON -D GFLAGS_BUILD_STATIC_LIBS=ON .. - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } - & cmake --build . --config $env:CONFIGURATION - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } - -test_script: -- ps: | - & ctest -C $env:CONFIGURATION --output-on-failure - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } diff --git a/inference-engine/samples/thirdparty/gflags/bazel/gflags.bzl b/inference-engine/samples/thirdparty/gflags/bazel/gflags.bzl deleted file mode 100644 index cd0edad6783..00000000000 --- a/inference-engine/samples/thirdparty/gflags/bazel/gflags.bzl +++ /dev/null @@ -1,92 +0,0 @@ -# ------------------------------------------------------------------------------ -# Add native rules to configure source files -def gflags_sources(namespace=["google", "gflags"]): - native.genrule( - name = "config_h", - srcs = ["src/config.h.in"], - outs = ["config.h"], - cmd = "awk '{ gsub(/^#cmakedefine/, \"//cmakedefine\"); print; }' $(<) > $(@)" - ) - native.genrule( - name = "gflags_declare_h", - srcs = ["src/gflags_declare.h.in"], - outs = ["include/gflags/gflags_declare.h"], - cmd = ("awk '{ " + - "gsub(/@GFLAGS_NAMESPACE@/, \"" + namespace[0] + "\"); " + - "gsub(/@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@/, \"1\"); " + - "gsub(/@([A-Z0-9_]+)@/, \"0\"); " + - "print; }' $(<) > $(@)") - ) - gflags_ns_h_files = [] - for ns in namespace[1:]: - gflags_ns_h_file = "gflags_{}.h".format(ns) - native.genrule( - name = gflags_ns_h_file.replace('.', '_'), - srcs = ["src/gflags_ns.h.in"], - outs = ["include/gflags/" + gflags_ns_h_file], - cmd = ("awk '{ " + - "gsub(/@ns@/, \"" + ns + "\"); " + - "gsub(/@NS@/, \"" + ns.upper() + "\"); " + - "print; }' $(<) > $(@)") - ) - gflags_ns_h_files.append(gflags_ns_h_file) - native.genrule( - name = "gflags_h", - srcs = ["src/gflags.h.in"], - outs = ["include/gflags/gflags.h"], - cmd = ("awk '{ " + - "gsub(/@GFLAGS_ATTRIBUTE_UNUSED@/, \"\"); " + - "gsub(/@INCLUDE_GFLAGS_NS_H@/, \"" + '\n'.join(["#include \\\"gflags/{}\\\"".format(hdr) for hdr in gflags_ns_h_files]) + "\"); " + - "print; }' $(<) > $(@)") - ) - native.genrule( - name = "gflags_completions_h", - srcs = ["src/gflags_completions.h.in"], - outs = ["include/gflags/gflags_completions.h"], - cmd = "awk '{ gsub(/@GFLAGS_NAMESPACE@/, \"" + namespace[0] + "\"); print; }' $(<) > $(@)" - ) - hdrs = [":gflags_h", ":gflags_declare_h", ":gflags_completions_h"] - hdrs.extend([':' + hdr.replace('.', '_') for hdr in gflags_ns_h_files]) - srcs = [ - ":config_h", - "src/gflags.cc", - "src/gflags_completions.cc", - "src/gflags_reporting.cc", - "src/mutex.h", - "src/util.h" - ] - return [hdrs, srcs] - -# ------------------------------------------------------------------------------ -# Add native rule to build gflags library -def gflags_library(hdrs=[], srcs=[], threads=1): - name = "gflags" - copts = [ - "-DHAVE_STDINT_H", - "-DHAVE_SYS_TYPES_H", - "-DHAVE_INTTYPES_H", - "-DHAVE_SYS_STAT_H", - "-DHAVE_UNISTD_H", - "-DHAVE_FNMATCH_H", - "-DHAVE_STRTOLL", - "-DHAVE_STRTOQ", - "-DHAVE_PTHREAD", - "-DHAVE_RWLOCK", - "-DGFLAGS_INTTYPES_FORMAT_C99", - "-DGFLAGS_IS_A_DLL=0", - ] - linkopts = [] - if threads: - linkopts.append("-lpthread") - else: - name += "_nothreads" - copts.append("-DNO_THREADS") - native.cc_library( - name = name, - hdrs = hdrs, - srcs = srcs, - includes = ["include/"], - copts = copts, - linkopts = linkopts, - visibility = ["//visibility:public"] - ) diff --git a/inference-engine/samples/thirdparty/gflags/cmake/README_runtime.txt b/inference-engine/samples/thirdparty/gflags/cmake/README_runtime.txt deleted file mode 100644 index d2556b2e8d4..00000000000 --- a/inference-engine/samples/thirdparty/gflags/cmake/README_runtime.txt +++ /dev/null @@ -1,4 +0,0 @@ -This package contains runtime libraries only which are required -by applications that use these libraries for the commandline flags -processing. If you want to develop such application, download -and install the development package instead. diff --git a/inference-engine/samples/thirdparty/gflags/cmake/config.cmake.in b/inference-engine/samples/thirdparty/gflags/cmake/config.cmake.in deleted file mode 100644 index a121b3a2489..00000000000 --- a/inference-engine/samples/thirdparty/gflags/cmake/config.cmake.in +++ /dev/null @@ -1,169 +0,0 @@ -## gflags CMake configuration file - -# library version information -set (@PACKAGE_PREFIX@_VERSION_STRING "@PACKAGE_VERSION@") -set (@PACKAGE_PREFIX@_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@) -set (@PACKAGE_PREFIX@_VERSION_MINOR @PACKAGE_VERSION_MINOR@) -set (@PACKAGE_PREFIX@_VERSION_PATCH @PACKAGE_VERSION_PATCH@) - -# import targets -include ("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@.cmake") - -# installation prefix -get_filename_component (CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -get_filename_component (_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PREFIX_REL2CONFIG_DIR@" ABSOLUTE) - -# include directory -# -# Newer versions of CMake set the INTERFACE_INCLUDE_DIRECTORIES property -# of the imported targets. It is hence not necessary to add this path -# manually to the include search path for targets which link to gflags. -set (@PACKAGE_PREFIX@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@") - -if (@PACKAGE_NAME@_FIND_COMPONENTS) - foreach (@PACKAGE_NAME@_FIND_COMPONENT IN LISTS @PACKAGE_NAME@_FIND_COMPONENTS) - if (@PACKAGE_NAME@_FIND_REQUIRED_${@PACKAGE_NAME@_FIND_COMPONENT} AND NOT TARGET @PACKAGE_NAME@_${@PACKAGE_NAME@_FIND_COMPONENT}) - message (FATAL_ERROR "Package @PACKAGE_NAME@ was installed without required component ${@PACKAGE_NAME@_FIND_COMPONENT}!") - endif () - endforeach () - list (GET @PACKAGE_NAME@_FIND_COMPONENTS 0 @PACKAGE_NAME@_FIND_COMPONENT) -else () - set (@PACKAGE_NAME@_FIND_COMPONENT) -endif () - -# default settings of @PACKAGE_PREFIX@_SHARED and @PACKAGE_PREFIX@_NOTHREADS -# -# It is recommended to use either one of the following find_package commands -# instead of setting the @PACKAGE_PREFIX@_(SHARED|NOTHREADS) variables: -# - find_package(@PACKAGE_NAME@ REQUIRED) -# - find_package(@PACKAGE_NAME@ COMPONENTS nothreads_static) -# - find_package(@PACKAGE_NAME@ COMPONENTS nothreads_shared) -# - find_package(@PACKAGE_NAME@ COMPONENTS static) -# - find_package(@PACKAGE_NAME@ COMPONENTS shared) -if (NOT DEFINED @PACKAGE_PREFIX@_SHARED) - if (DEFINED @PACKAGE_NAME@_SHARED) - set (@PACKAGE_PREFIX@_SHARED ${@PACKAGE_NAME@_SHARED}) - elseif (@PACKAGE_NAME@_FIND_COMPONENT) - if (@PACKAGE_NAME@_FIND_COMPONENT MATCHES "shared") - set (@PACKAGE_PREFIX@_SHARED TRUE) - else () - set (@PACKAGE_PREFIX@_SHARED FALSE) - endif () - elseif (TARGET @PACKAGE_NAME@_shared OR TARGET @PACKAGE_NAME@_nothreads_shared) - set (@PACKAGE_PREFIX@_SHARED TRUE) - else () - set (@PACKAGE_PREFIX@_SHARED FALSE) - endif () -endif () -if (NOT DEFINED @PACKAGE_PREFIX@_NOTHREADS) - if (DEFINED @PACKAGE_NAME@_NOTHREADS) - set (@PACKAGE_PREFIX@_NOTHREADS ${@PACKAGE_NAME@_NOTHREADS}) - elseif (@PACKAGE_NAME@_FIND_COMPONENT) - if (@PACKAGE_NAME@_FIND_COMPONENT MATCHES "nothreads") - set (@PACKAGE_PREFIX@_NOTHREADS TRUE) - else () - set (@PACKAGE_PREFIX@_NOTHREADS FALSE) - endif () - elseif (TARGET @PACKAGE_NAME@_static OR TARGET @PACKAGE_NAME@_shared) - set (@PACKAGE_PREFIX@_NOTHREADS FALSE) - else () - set (@PACKAGE_PREFIX@_NOTHREADS TRUE) - endif () -endif () - -# choose imported library target -if (NOT @PACKAGE_PREFIX@_TARGET) - if (@PACKAGE_NAME@_TARGET) - set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_NAME@_TARGET}) - elseif (@PACKAGE_PREFIX@_SHARED) - if (@PACKAGE_PREFIX@_NOTHREADS) - set (@PACKAGE_PREFIX@_TARGET @PACKAGE_NAME@_nothreads_shared) - else () - set (@PACKAGE_PREFIX@_TARGET @PACKAGE_NAME@_shared) - endif () - else () - if (@PACKAGE_PREFIX@_NOTHREADS) - set (@PACKAGE_PREFIX@_TARGET @PACKAGE_NAME@_nothreads_static) - else () - set (@PACKAGE_PREFIX@_TARGET @PACKAGE_NAME@_static) - endif () - endif () -endif () -if (NOT TARGET ${@PACKAGE_PREFIX@_TARGET}) - message (FATAL_ERROR "Your @PACKAGE_NAME@ installation does not contain a ${@PACKAGE_PREFIX@_TARGET} library target!" - " Try a different combination of @PACKAGE_PREFIX@_SHARED and @PACKAGE_PREFIX@_NOTHREADS.") -endif () - -# add more convenient "@PACKAGE_NAME@" import target -if (NOT TARGET @PACKAGE_NAME@) - if (@PACKAGE_PREFIX@_SHARED) - add_library (@PACKAGE_NAME@ SHARED IMPORTED) - else () - add_library (@PACKAGE_NAME@ STATIC IMPORTED) - endif () - # copy INTERFACE_* properties - foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS - COMPILE_DEFINITIONS - COMPILE_FEATURES - COMPILE_OPTIONS - INCLUDE_DIRECTORIES - LINK_LIBRARIES - POSITION_INDEPENDENT_CODE - ) - get_target_property (_@PACKAGE_PREFIX@_PROPERTY_VALUE ${@PACKAGE_PREFIX@_TARGET} INTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME}) - if (_@PACKAGE_PREFIX@_PROPERTY_VALUE) - set_target_properties(@PACKAGE_NAME@ PROPERTIES - INTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE}" - ) - endif () - endforeach () - # copy IMPORTED_*_ properties - get_target_property (_@PACKAGE_PREFIX@_CONFIGURATIONS ${@PACKAGE_PREFIX@_TARGET} IMPORTED_CONFIGURATIONS) - set_target_properties (@PACKAGE_NAME@ PROPERTIES IMPORTED_CONFIGURATIONS "${_@PACKAGE_PREFIX@_CONFIGURATIONS}") - foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS - IMPLIB - LOCATION - LINK_DEPENDENT_LIBRARIES - LINK_INTERFACE_LIBRARIES - LINK_INTERFACE_LANGUAGES - LINK_INTERFACE_MULTIPLICITY - NO_SONAME - SONAME - ) - foreach (_@PACKAGE_PREFIX@_CONFIG IN LISTS _@PACKAGE_PREFIX@_CONFIGURATIONS) - get_target_property (_@PACKAGE_PREFIX@_PROPERTY_VALUE ${@PACKAGE_PREFIX@_TARGET} IMPORTED_${_@PACKAGE_PREFIX@_PROPERTY_NAME}_${_@PACKAGE_PREFIX@_CONFIG}) - if (_@PACKAGE_PREFIX@_PROPERTY_VALUE) - set_target_properties(@PACKAGE_NAME@ PROPERTIES - IMPORTED_${_@PACKAGE_PREFIX@_PROPERTY_NAME}_${_@PACKAGE_PREFIX@_CONFIG} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE}" - ) - endif () - endforeach () - endforeach () - unset (_@PACKAGE_PREFIX@_CONFIGURATIONS) - unset (_@PACKAGE_PREFIX@_CONFIG) - unset (_@PACKAGE_PREFIX@_PROPERTY_NAME) - unset (_@PACKAGE_PREFIX@_PROPERTY_VALUE) -endif () - -# alias for default import target to be compatible with older CMake package configurations -set (@PACKAGE_PREFIX@_LIBRARIES "${@PACKAGE_PREFIX@_TARGET}") - -# set @PACKAGE_NAME@_* variables for backwards compatibility -if (NOT "^@PACKAGE_NAME@$" STREQUAL "^@PACKAGE_PREFIX@$") - foreach (_@PACKAGE_PREFIX@_VARIABLE IN ITEMS - VERSION_STRING - VERSION_MAJOR - VERSION_MINOR - VERSION_PATCH - INCLUDE_DIR - LIBRARIES - TARGET - ) - set (@PACKAGE_NAME@_${_@PACKAGE_PREFIX@_VARIABLE} "${@PACKAGE_PREFIX@_${_@PACKAGE_PREFIX@_VARIABLE}}") - endforeach () - unset (_@PACKAGE_PREFIX@_VARIABLE) -endif () - -# unset private variables -unset (@PACKAGE_NAME@_FIND_COMPONENT) -unset (_INSTALL_PREFIX) diff --git a/inference-engine/samples/thirdparty/gflags/cmake/execute_test.cmake b/inference-engine/samples/thirdparty/gflags/cmake/execute_test.cmake deleted file mode 100644 index df008cf465e..00000000000 --- a/inference-engine/samples/thirdparty/gflags/cmake/execute_test.cmake +++ /dev/null @@ -1,53 +0,0 @@ -# ---------------------------------------------------------------------------- -# sanitize string stored in variable for use in regular expression. -macro (sanitize_for_regex STRVAR) - string (REGEX REPLACE "([.+*?^$()])" "\\\\\\1" ${STRVAR} "${${STRVAR}}") -endmacro () - -# ---------------------------------------------------------------------------- -# script arguments -if (NOT COMMAND) - message (FATAL_ERROR "Test command not specified!") -endif () -if (NOT DEFINED EXPECTED_RC) - set (EXPECTED_RC 0) -endif () -if (EXPECTED_OUTPUT) - sanitize_for_regex(EXPECTED_OUTPUT) -endif () -if (UNEXPECTED_OUTPUT) - sanitize_for_regex(UNEXPECTED_OUTPUT) -endif () - -# ---------------------------------------------------------------------------- -# set a few environment variables (useful for --tryfromenv) -set (ENV{FLAGS_undefok} "foo,bar") -set (ENV{FLAGS_weirdo} "") -set (ENV{FLAGS_version} "true") -set (ENV{FLAGS_help} "false") - -# ---------------------------------------------------------------------------- -# execute test command -execute_process( - COMMAND ${COMMAND} - RESULT_VARIABLE RC - OUTPUT_VARIABLE OUTPUT - ERROR_VARIABLE OUTPUT -) - -if (OUTPUT) - message ("${OUTPUT}") -endif () - -# ---------------------------------------------------------------------------- -# check test result -if (NOT RC EQUAL EXPECTED_RC) - string (REPLACE ";" " " COMMAND "${COMMAND}") - message (FATAL_ERROR "Command:\n\t${COMMAND}\nExit status is ${RC}, expected ${EXPECTED_RC}") -endif () -if (EXPECTED_OUTPUT AND NOT OUTPUT MATCHES "${EXPECTED_OUTPUT}") - message (FATAL_ERROR "Test output does not match expected output: ${EXPECTED_OUTPUT}") -endif () -if (UNEXPECTED_OUTPUT AND OUTPUT MATCHES "${UNEXPECTED_OUTPUT}") - message (FATAL_ERROR "Test output matches unexpected output: ${UNEXPECTED_OUTPUT}") -endif () \ No newline at end of file diff --git a/inference-engine/samples/thirdparty/gflags/cmake/package.cmake.in b/inference-engine/samples/thirdparty/gflags/cmake/package.cmake.in deleted file mode 100644 index aaec7925e34..00000000000 --- a/inference-engine/samples/thirdparty/gflags/cmake/package.cmake.in +++ /dev/null @@ -1,49 +0,0 @@ -# Per-generator CPack configuration file. See CPACK_PROJECT_CONFIG_FILE documented at -# http://www.cmake.org/cmake/help/v2.8.12/cpack.html#variable:CPACK_PROJECT_CONFIG_FILE -# -# All common CPACK_* variables are set in CMakeLists.txt already. This file only -# overrides some of these to provide package generator specific settings. - -# whether package contains all development files or only runtime files -set (DEVEL @INSTALL_HEADERS@) - -# ------------------------------------------------------------------------------ -# Mac OS X package -if (CPACK_GENERATOR MATCHES "PackageMaker|DragNDrop") - - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") - if (DEVEL) - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-devel") - endif () - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_VERSION}") - -# ------------------------------------------------------------------------------ -# Debian package -elseif (CPACK_GENERATOR MATCHES "DEB") - - set (CPACK_PACKAGE_FILE_NAME "lib${CPACK_PACKAGE_NAME}") - if (DEVEL) - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-dev") - else () - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}0") - endif () - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_PACKAGE_VERSION}-1_${CPACK_PACKAGE_ARCHITECTURE}") - - set (CPACK_DEBIAN_PACKAGE_DEPENDS) - set (CPACK_DEBIAN_PACKAGE_SECTION "devel") - set (CPACK_DEBIAN_PACKAGE_PRIORITY "optional") - set (CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_RPM_PACKAGE_URL}") - set (CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}") - set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_PACKAGE_ARCHITECTURE}") - -# ------------------------------------------------------------------------------ -# RPM package -elseif (CPACK_GENERATOR MATCHES "RPM") - - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") - if (DEVEL) - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-devel") - endif () - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_VERSION}-1.${CPACK_PACKAGE_ARCHITECTURE}") - -endif () diff --git a/inference-engine/samples/thirdparty/gflags/cmake/package.pc.in b/inference-engine/samples/thirdparty/gflags/cmake/package.pc.in deleted file mode 100644 index 80df818eba3..00000000000 --- a/inference-engine/samples/thirdparty/gflags/cmake/package.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -bindir=${prefix}/@RUNTIME_INSTALL_DIR@ -libdir=${prefix}/@LIBRARY_INSTALL_DIR@ -includedir=${prefix}/@INCLUDE_INSTALL_DIR@ - -Name: @PACKAGE_NAME@ -Version: @PACKAGE_VERSION@ -Description: @PACKAGE_DESCRIPTION@ -URL: @PACKAGE_URL@ -Requires: -Libs: -L${libdir} -lgflags -Libs.private: -lpthread -Cflags: -I${includedir} diff --git a/inference-engine/samples/thirdparty/gflags/cmake/utils.cmake b/inference-engine/samples/thirdparty/gflags/cmake/utils.cmake deleted file mode 100644 index d039e5c8831..00000000000 --- a/inference-engine/samples/thirdparty/gflags/cmake/utils.cmake +++ /dev/null @@ -1,205 +0,0 @@ -## Utility CMake functions. - -# ---------------------------------------------------------------------------- -## Convert boolean value to 0 or 1 -macro (bool_to_int VAR) - if (${VAR}) - set (${VAR} 1) - else () - set (${VAR} 0) - endif () -endmacro () - -# ---------------------------------------------------------------------------- -## Extract version numbers from version string -function (version_numbers version major minor patch) - if (version MATCHES "([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(rc[1-9][0-9]*|[a-z]+)?") - if (CMAKE_MATCH_1) - set (_major ${CMAKE_MATCH_1}) - else () - set (_major 0) - endif () - if (CMAKE_MATCH_2) - set (_minor ${CMAKE_MATCH_2}) - string (REGEX REPLACE "^\\." "" _minor "${_minor}") - else () - set (_minor 0) - endif () - if (CMAKE_MATCH_3) - set (_patch ${CMAKE_MATCH_3}) - string (REGEX REPLACE "^\\." "" _patch "${_patch}") - else () - set (_patch 0) - endif () - else () - set (_major 0) - set (_minor 0) - set (_patch 0) - endif () - set ("${major}" "${_major}" PARENT_SCOPE) - set ("${minor}" "${_minor}" PARENT_SCOPE) - set ("${patch}" "${_patch}" PARENT_SCOPE) -endfunction () - -# ---------------------------------------------------------------------------- -## Determine if cache entry exists -macro (gflags_is_cached retvar varname) - if (DEFINED ${varname}) - get_property (${retvar} CACHE ${varname} PROPERTY TYPE SET) - else () - set (${retvar} FALSE) - endif () -endmacro () - -# ---------------------------------------------------------------------------- -## Add gflags configuration variable -# -# The default value of the (cached) configuration value can be overridden either -# on the CMake command-line or the super-project by setting the GFLAGS_ -# variable. When gflags is a subproject of another project (GFLAGS_IS_SUBPROJECT), -# the variable is not added to the CMake cache. Otherwise it is cached. -macro (gflags_define type varname docstring default) - # note that ARGC must be expanded here, as it is not a "real" variable - # (see the CMake documentation for the macro command) - if ("${ARGC}" GREATER 5) - message (FATAL_ERROR "gflags_variable: Too many macro arguments") - endif () - if (NOT DEFINED GFLAGS_${varname}) - if (GFLAGS_IS_SUBPROJECT AND "${ARGC}" EQUAL 5) - set (GFLAGS_${varname} "${ARGV4}") - else () - set (GFLAGS_${varname} "${default}") - endif () - endif () - if (GFLAGS_IS_SUBPROJECT) - if (NOT DEFINED ${varname}) - set (${varname} "${GFLAGS_${varname}}") - endif () - else () - set (${varname} "${GFLAGS_${varname}}" CACHE ${type} "${docstring}") - endif () -endmacro () - -# ---------------------------------------------------------------------------- -## Set property of cached gflags configuration variable -macro (gflags_property varname property value) - gflags_is_cached (_cached ${varname}) - if (_cached) - # note that property must be expanded here, as it is not a "real" variable - # (see the CMake documentation for the macro command) - if ("${property}" STREQUAL "ADVANCED") - if (${value}) - mark_as_advanced (FORCE ${varname}) - else () - mark_as_advanced (CLEAR ${varname}) - endif () - else () - set_property (CACHE ${varname} PROPERTY "${property}" "${value}") - endif () - endif () - unset (_cached) -endmacro () - -# ---------------------------------------------------------------------------- -## Modify value of gflags configuration variable -macro (gflags_set varname value) - gflags_is_cached (_cached ${varname}) - if (_cached) - set_property (CACHE ${varname} PROPERTY VALUE "${value}") - else () - set (${varname} "${value}") - endif () - unset (_cached) -endmacro () - -# ---------------------------------------------------------------------------- -## Configure public header files -function (configure_headers out) - set (tmp) - foreach (src IN LISTS ARGN) - if (IS_ABSOLUTE "${src}") - list (APPEND tmp "${src}") - elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in") - configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" @ONLY) - list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}") - else () - configure_file ("${PROJECT_SOURCE_DIR}/src/${src}" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" COPYONLY) - list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}") - endif () - endforeach () - set (${out} "${tmp}" PARENT_SCOPE) -endfunction () - -# ---------------------------------------------------------------------------- -## Configure source files with .in suffix -function (configure_sources out) - set (tmp) - foreach (src IN LISTS ARGN) - if (src MATCHES ".h$" AND EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in") - configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" @ONLY) - list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}") - else () - list (APPEND tmp "${PROJECT_SOURCE_DIR}/src/${src}") - endif () - endforeach () - set (${out} "${tmp}" PARENT_SCOPE) -endfunction () - -# ---------------------------------------------------------------------------- -## Add usage test -# -# Using PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION would -# do as well, but CMake/CTest does not allow us to specify an -# expected exit status. Moreover, the execute_test.cmake script -# sets environment variables needed by the --fromenv/--tryfromenv tests. -macro (add_gflags_test name expected_rc expected_output unexpected_output cmd) - set (args "--test_tmpdir=${PROJECT_BINARY_DIR}/Testing/Temporary" - "--srcdir=${PROJECT_SOURCE_DIR}/test") - add_test ( - NAME ${name} - COMMAND "${CMAKE_COMMAND}" "-DCOMMAND:STRING=$;${args};${ARGN}" - "-DEXPECTED_RC:STRING=${expected_rc}" - "-DEXPECTED_OUTPUT:STRING=${expected_output}" - "-DUNEXPECTED_OUTPUT:STRING=${unexpected_output}" - -P "${PROJECT_SOURCE_DIR}/cmake/execute_test.cmake" - WORKING_DIRECTORY "${GFLAGS_FLAGFILES_DIR}" - ) -endmacro () - -# ------------------------------------------------------------------------------ -## Register installed package with CMake -# -# This function adds an entry to the CMake registry for packages with the -# path of the directory where the package configuration file of the installed -# package is located in order to help CMake find the package in a custom -# installation prefix. This differs from CMake's export(PACKAGE) command -# which registers the build directory instead. -function (register_gflags_package CONFIG_DIR) - if (NOT IS_ABSOLUTE "${CONFIG_DIR}") - set (CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${CONFIG_DIR}") - endif () - string (MD5 REGISTRY_ENTRY "${CONFIG_DIR}") - if (WIN32) - install (CODE - "execute_process ( - COMMAND reg add \"HKCU\\\\Software\\\\Kitware\\\\CMake\\\\Packages\\\\${PACKAGE_NAME}\" /v \"${REGISTRY_ENTRY}\" /d \"${CONFIG_DIR}\" /t REG_SZ /f - RESULT_VARIABLE RT - ERROR_VARIABLE ERR - OUTPUT_QUIET - ) - if (RT EQUAL 0) - message (STATUS \"Register: Added HKEY_CURRENT_USER\\\\Software\\\\Kitware\\\\CMake\\\\Packages\\\\${PACKAGE_NAME}\\\\${REGISTRY_ENTRY}\") - else () - string (STRIP \"\${ERR}\" ERR) - message (STATUS \"Register: Failed to add registry entry: \${ERR}\") - endif ()" - ) - elseif (IS_DIRECTORY "$ENV{HOME}") - file (WRITE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-registry-entry" "${CONFIG_DIR}") - install ( - FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-registry-entry" - DESTINATION "$ENV{HOME}/.cmake/packages/${PACKAGE_NAME}" - RENAME "${REGISTRY_ENTRY}" - ) - endif () -endfunction () diff --git a/inference-engine/samples/thirdparty/gflags/cmake/version.cmake.in b/inference-engine/samples/thirdparty/gflags/cmake/version.cmake.in deleted file mode 100644 index 1e1af050d97..00000000000 --- a/inference-engine/samples/thirdparty/gflags/cmake/version.cmake.in +++ /dev/null @@ -1,21 +0,0 @@ -## gflags CMake configuration version file - -# ----------------------------------------------------------------------------- -# library version -set (PACKAGE_VERSION "@PACKAGE_VERSION@") - -# ----------------------------------------------------------------------------- -# check compatibility - -# Perform compatibility check here using the input CMake variables. -# See example in http://www.cmake.org/Wiki/CMake_2.6_Notes. - -set (PACKAGE_VERSION_COMPATIBLE TRUE) -set (PACKAGE_VERSION_UNSUITABLE FALSE) - -if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@PACKAGE_VERSION_MAJOR@" AND - "${PACKAGE_FIND_VERSION_MINOR}" EQUAL "@PACKAGE_VERSION_MINOR@") - set (PACKAGE_VERSION_EXACT TRUE) -else () - set (PACKAGE_VERSION_EXACT FALSE) -endif () diff --git a/inference-engine/samples/thirdparty/gflags/doc/.nojekyll b/inference-engine/samples/thirdparty/gflags/doc/.nojekyll deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/inference-engine/samples/thirdparty/gflags/doc/designstyle.css b/inference-engine/samples/thirdparty/gflags/doc/designstyle.css deleted file mode 100644 index f5d1ec2f767..00000000000 --- a/inference-engine/samples/thirdparty/gflags/doc/designstyle.css +++ /dev/null @@ -1,115 +0,0 @@ -body { - background-color: #ffffff; - color: black; - margin-right: 1in; - margin-left: 1in; -} - - -h1, h2, h3, h4, h5, h6 { - color: #3366ff; - font-family: sans-serif; -} -@media print { - /* Darker version for printing */ - h1, h2, h3, h4, h5, h6 { - color: #000080; - font-family: helvetica, sans-serif; - } -} - -h1 { - text-align: center; - font-size: 18pt; -} -h2 { - margin-left: -0.5in; -} -h3 { - margin-left: -0.25in; -} -h4 { - margin-left: -0.125in; -} -hr { - margin-left: -1in; -} - -/* Definition lists: definition term bold */ -dt { - font-weight: bold; -} - -address { - text-align: right; -} -/* Use the tag for bits of code and for variables and objects. */ -code,pre,samp,var { - color: #006000; -} -/* Use the tag for file and directory paths and names. */ -file { - color: #905050; - font-family: monospace; -} -/* Use the tag for stuff the user should type. */ -kbd { - color: #600000; -} -div.note p { - float: right; - width: 3in; - margin-right: 0%; - padding: 1px; - border: 2px solid #6060a0; - background-color: #fffff0; -} - -UL.nobullets { - list-style-type: none; - list-style-image: none; - margin-left: -1em; -} - -/* -body:after { - content: "Google Confidential"; -} -*/ - -/* pretty printing styles. See prettify.js */ -.str { color: #080; } -.kwd { color: #008; } -.com { color: #800; } -.typ { color: #606; } -.lit { color: #066; } -.pun { color: #660; } -.pln { color: #000; } -.tag { color: #008; } -.atn { color: #606; } -.atv { color: #080; } -pre.prettyprint { padding: 2px; border: 1px solid #888; } - -.embsrc { background: #eee; } - -@media print { - .str { color: #060; } - .kwd { color: #006; font-weight: bold; } - .com { color: #600; font-style: italic; } - .typ { color: #404; font-weight: bold; } - .lit { color: #044; } - .pun { color: #440; } - .pln { color: #000; } - .tag { color: #006; font-weight: bold; } - .atn { color: #404; } - .atv { color: #060; } -} - -/* Table Column Headers */ -.hdr { - color: #006; - font-weight: bold; - background-color: #dddddd; } -.hdr2 { - color: #006; - background-color: #eeeeee; } \ No newline at end of file diff --git a/inference-engine/samples/thirdparty/gflags/doc/index.html b/inference-engine/samples/thirdparty/gflags/doc/index.html deleted file mode 100644 index e0afb476113..00000000000 --- a/inference-engine/samples/thirdparty/gflags/doc/index.html +++ /dev/null @@ -1,648 +0,0 @@ - - - - -How To Use Gflags (formerly Google Commandline Flags) - - - - - - - - -

How To Use gflags (formerly Google Commandline Flags)

-(as of -) - -
- -
-
Table of contents
-
Introduction
-
Download and Installation
-
Declare dependency on gflags with CMake
-
Declare dependency on gflags with Bazel
-
DEFINE: Defining Flags In Program
-
Accessing the Flag
-
DECLARE: Using the Flag in a Different File
-
RegisterFlagValidator: Sanity-checking Flag Values
-
Putting It Together: How to Set Up Flags
-
Setting Flags on the Command Line
-
Setting Flags at Runtime
-
Changing the Default Flag Value
-
Special Flags
-
The API
-
Miscellaneous Notes
-
Issues and Feature Requests
-

-
- -

Introduction, and Comparison to Other Commandline - Flags Libraries

- -

Commandline flags are flags that users specify on the -command line when they run an executable. In the command

-
-   fgrep -l -f /var/tmp/foo johannes brahms
-
-

-l and -f /var/tmp/foo are the two -commandline flags. (johannes and brahms, -which don't start with a dash, are commandline arguments.)

- -

Typically, an application lists what flags the user is allowed to -pass in, and what arguments they take -- in this example, --l takes no argument, and -f takes a -string (in particular, a filename) as an argument. Users can use a -library to help parse the commandline and store the flags in some data -structure.

- -

Gflags, the commandline flags library used within Google, -differs from other libraries, -such as getopt(), in that flag definitions can be -scattered around the source code, and not just listed in one place -such as main(). In practice, this means that a single -source-code file will define and use flags that are meaningful to that -file. Any application that links in that file will get the flags, and -the gflags library will automatically handle that -flag appropriately.

- -

There's significant gain in flexibility, and ease of code reuse, -due to this technique. However, there is a danger that two files will -define the same flag, and then give an error when they're linked -together.

- -

The rest of this document describes how to use the commandlineflag -library. It's a C++ library, so examples are in C++. However, there -is a Python port with the same functionality, and this discussion -translates directly to Python.

- -

Download and Installation

- -

The gflags library can be downloaded from GitHub. -You can clone the project using the command:

-
-   git clone https://github.com/gflags/gflags.git
-
-

Build and installation instructions are provided in the -INSTALL file. -The installation of the gflags package includes configuration files for popular build systems -such as pkg-config, -CMake, and Bazel.

- - -

Declare dependency on gflags with CMake

- -

Using gflags within a project which uses CMake for its build system is easy. -You can either require an external installation of the gflags package and find it using CMake's find_package -command, or include the gflags project as subtree or submodule within your project's source tree and add the directory -using CMake's add_subdirectory command. - -

To use an external gflags installation, add the following CMake code to your CMakeLists.txt file.

- -

Find gflags installation. The gflags_DIR variable must be set to the <prefix>/lib/cmake/gflags directory -containing the gflags-config.cmake file if <prefix> is a non-standard location. Otherwise, CMake should find -the gflags installation automatically.

-
-   find_package(gflags REQUIRED)
-
-

To request a particular imported gflags library target to link against, use the COMPONENTS option of -the find_package command. For example, to force the use of the single-threaded static library, use the command

-
-   find_package(gflags COMPONENTS nothreads_static)
-
-

Note that this will raise a fatal error when the installed gflags package does not contain the requested library. -It is therefore recommended to only specify the particular component to look for if a specific library must be used. -Otherwise, the gflags-config.cmake module will choose a suitable and available library for you. By default, the -multi-threaded gflags library with shared linkage is chosen if available.

- -

When the source tree of the gflags project is included as subtree or submodule in the "gflags" directory of your project, -replace the above find_package command by add_subdirectory(gflags). See the top of the gflags/CMakeLists.txt -file for a listing of available CMake variables that can be set before this command to configure the build of the -gflags library. The default build settings are the build of a single-threaded static library which does not require -any installation of the gflags subproject products.

- -

Finally, add your executable build target which uses gflags to parse the command arguments with dependency on the -imported gflags library target:

-
-   add_executable(foo main.cc)
-   target_link_libraries(foo gflags)
-
- -

Declare dependency on gflags with Bazel

- -

To use gflags within a project which uses Bazel as build tool, -add the following lines to your WORKSPACE file -(see also Bazel documentation of git_repository): - -

-git_repository(
-    name   = "com_github_gflags_gflags",
-    commit = "<INSERT COMMIT SHA HERE>",
-    remote = "https://github.com/gflags/gflags.git",
-)
-
-bind(
-    name = "gflags",
-    actual = "@com_github_gflags_gflags//:gflags",
-)
-
-bind(
-    name = "gflags_nothreads",
-    actual = "@com_github_gflags_gflags//:gflags_nothreads",
-)
-
- -

You can then add //external:gflags to the deps section of a cc_binary -or cc_library rule, and #include "gflags/gflags.h" to include it in your source code. -This use the shared gflags library with multi-threading enabled. In order to use the single-threaded shared -gflags library, use the external dependency //external:gflags_nothreads instead.

- -

For example, see the following BUILD rule of the gflags/example project:

- -
-cc_binary(
-    name = "foo",
-    srcs = ["main.cc"],
-    deps = ["//external:gflags"],
-)
-
- -

DEFINE: Defining Flags In Program

- -

Defining a flag is easy: just use the appropriate macro for the -type you want the flag to be, as defined at the bottom of -gflags/gflags.h. Here's an example file, -foo.cc:

- -
-   #include <gflags/gflags.h>
-
-   DEFINE_bool(big_menu, true, "Include 'advanced' options in the menu listing");
-   DEFINE_string(languages, "english,french,german",
-                 "comma-separated list of languages to offer in the 'lang' menu");
-
- -

DEFINE_bool defines a boolean flag. Here are the -types supported:

-
    -
  • DEFINE_bool: boolean -
  • DEFINE_int32: 32-bit integer -
  • DEFINE_int64: 64-bit integer -
  • DEFINE_uint64: unsigned 64-bit integer -
  • DEFINE_double: double -
  • DEFINE_string: C++ string -
- -

Note that there are no 'complex' types like lists: the "languages" -flag in our example is a list of strings, but is defined of type -"string", not "list_of_string" or similar. This is by design. We'd -rather use only simple types for the flags, and allow for complex, -arbitrary parsing routines to parse them, than to try to put the logic -inside the flags library proper.

- -

All DEFINE macros take the same three arguments: the name of the -flag, its default value, and a 'help' string that describes its use. -The 'help' string is displayed when the user runs the application with -the --help flag.

- -

You can define a flag in any source-code file in your executable. -Only define a flag once! If you want to access a flag in more than -one source file, DEFINE it in one file, and DECLARE it in the others. Even better, DEFINE it -in foo.cc and DECLARE it in foo.h; then -everyone who #includes foo.h can use the flag.

- -

-Defining flags in libraries rather than in main() is powerful, but -does have some costs. One is that a library might not have a good -default value for its flags, for example if the flag holds a -filename that might not exist in some environments. To mitigate such problems, -you can use flag validators to ensure prompt -notification (in the form of a crash) of an invalid flag value. -

- -

Note that while most functions in this library are defined in the -google namespace, DEFINE_foo (and -DECLARE_foo, below), should always -be in the global namespace.

- - -

Accessing the Flag

- -

All defined flags are available to the program as just a normal -variable, with the prefix FLAGS_ prepended. In the above -example, the macros define two variables, FLAGS_big_menu -(a bool), and FLAGS_languages (a C++ string).

- -

You can read and write to the flag just like any other -variable:

-
-   if (FLAGS_consider_made_up_languages)
-     FLAGS_languages += ",klingon";   // implied by --consider_made_up_languages
-   if (FLAGS_languages.find("finnish") != string::npos)
-     HandleFinnish();
-
- -

You can also get and set flag values via special functions in -gflags.h. That's a rarer use case, though.

- - -

DECLARE: Using the Flag in a Different File

- -

Accessing a flag in the manner of the previous section only works -if the flag was DEFINE-ed at the top of the file. If it -wasn't, you'll get an 'unknown variable' error.

- -

The DECLARE_type macro is available when you want to -use a flag that's defined in another file. For instance, if I were -writing bar.cc but wanted to access the big_menu, flag, I -would put this near the top of bar.cc:

-
-   DECLARE_bool(big_menu);
-
- -

This is functionally equivalent to saying extern -FLAGS_big_menu.

- -

Note that such an extern declaration introduces a dependency -between your file and the file that defines the big_menu -flag: foo.cc, in this case. Such implicit dependencies -can be difficult to manage in large projects. For that reason we -recommend the following guideline:

- -
-If you DEFINE a flag in foo.cc, either don't DECLARE it -at all, only DECLARE it in tightly related tests, or only DECLARE -it in foo.h. -
- -

You should go the do-not-DECLARE route when the flag is only needed -by foo.cc, and not in any other file. If you want to -modify the value of the flag in the related test file to see if it is -functioning as expected, DECLARE it in the foo_test.cc -file. - -

If the flag does span multiple files, DECLARE it in the associated -.h file, and make others #include that -.h file if they want to access the flag. The -#include will make explicit the dependency between the -two files. This causes the flag to be a global variable.

- - -

RegisterFlagValidator: Sanity-checking Flag Values

- -

After DEFINE-ing a flag, you may optionally register a validator -function with the flag. If you do this, after the flag is parsed from -the commandline, and whenever its value is changed via a call to -SetCommandLineOption(), the validator function is called -with the new value as an argument. The validator function should -return 'true' if the flag value is valid, and false otherwise. -If the function returns false for the new setting of the -flag, the flag will retain its current value. If it returns false for the -default value, ParseCommandLineFlags will die. - -

Here is an example use of this functionality:

-
-static bool ValidatePort(const char* flagname, int32 value) {
-   if (value > 0 && value < 32768)   // value is ok
-     return true;
-   printf("Invalid value for --%s: %d\n", flagname, (int)value);
-   return false;
-}
-DEFINE_int32(port, 0, "What port to listen on");
-DEFINE_validator(port, &ValidatePort);
-
- -

By doing the registration at global initialization time (right -after the DEFINE_int32), we ensure that the registration happens before -the commandline is parsed at the beginning of main().

- -

The above used DEFINE_validator macro calls the -RegisterFlagValidator() function which returns true if the -registration is successful. It returns false if the registration fails -because a) the first argument does not refer to a commandline flag, or -b) a different validator has already been registered for this flag. -The return value is available as global static boolean variable named -<flag>_validator_registered.

- - -

Putting It Together: How to Set Up Flags

- -

The final piece is the one that tells the executable to process the -commandline flags, and set the FLAGS_* variables to the -appropriate, non-default value based on what is seen on the -commandline. This is equivalent to the getopt() call in -the getopt library, but has much less overhead to use. In fact, it's -just a single function call:

- -
-   gflags::ParseCommandLineFlags(&argc, &argv, true);
-
- -

Usually, this code is at the beginning of main(). -argc and argv are exactly as passed in to -main(). This routine might modify them, which is why -pointers to them are passed in.

- -

The last argument is called "remove_flags". If true, then -ParseCommandLineFlags removes the flags and their -arguments from argv, and modifies argc -appropriately. In this case, after the function call, -argv will hold only commandline arguments, and not -commandline flags.

- -

If, on the other hand, remove_flags is false, then -ParseCommandLineFlags will leave argc unchanged, but will -rearrange the arguments in argv so that the flags are all at the -beginning. For example, if the input is "/bin/foo" "arg1" "-q" -"arg2" (which is legal but weird), the function will rearrange -argv so it reads "/bin/foo", "-q", "arg1", -"arg2". In this case, ParseCommandLineFlags -returns the index into argv that holds the first commandline argument: -that is, the index past the last flag. (In this example, it would -return 2, since argv[2] points to arg1.)

- -

In either case, the FLAGS_* variables are modified -based on what was passed in on the -commandline.

- - -

Setting Flags on the Command Line

- -

The reason you make something a flag instead of a compile-time -constant, is so users can specify a non-default value on the -commandline. Here's how they might do it for an application that -links in foo.cc:

-
-   app_containing_foo --nobig_menu -languages="chinese,japanese,korean" ...
-
- -

This sets FLAGS_big_menu = false; and -FLAGS_languages = "chinese,japanese,korean", when -ParseCommandLineFlags is run.

- -

Note the atypical syntax for setting a boolean flag to false: -putting "no" in front of its name. There's a fair bit of flexibility -to how flags may be specified. Here's an example of all the ways to -specify the "languages" flag:

-
    -
  • app_containing_foo --languages="chinese,japanese,korean" -
  • app_containing_foo -languages="chinese,japanese,korean" -
  • app_containing_foo --languages "chinese,japanese,korean" -
  • app_containing_foo -languages "chinese,japanese,korean" -
- -

For boolean flags, the possibilities are slightly different:

-
    -
  • app_containing_foo --big_menu -
  • app_containing_foo --nobig_menu -
  • app_containing_foo --big_menu=true -
  • app_containing_foo --big_menu=false -
-

(as well as the single-dash variant on all of these).

- -

Despite this flexibility, we recommend using only a single form: ---variable=value for non-boolean flags, and ---variable/--novariable for boolean flags. This -consistency will make your code more readable, and is also the format -required for certain special-use cases like flagfiles.

- -

It is a fatal error to specify a flag on the commandline that has -not been DEFINED somewhere in the executable. If you need that -functionality for some reason -- say you want to use the same set of -flags for several executables, but not all of them DEFINE every flag -in your list -- you can specify --undefok to suppress the error.

- -

As in getopt(), -- by itself will terminate flags -processing. So in foo -f1 1 -- -f2 2, f1 is -considered a flag, but -f2 is not.

- -

If a flag is specified more than once, only the last specification -is used; the others are ignored.

- -

Note that flags do not have single-letter synonyms, like they do in -the getopt library, nor do we allow "combining" flags behind a -single dash, as in ls -la.

- - - -

Changing the Default Flag Value

- -

Sometimes a flag is defined in a library, and you want to change -its default value in one application but not others. It's simple to -do this: just assign a new value to the flag in main(), -before calling ParseCommandLineFlags():

-
-   DECLARE_bool(lib_verbose);   // mylib has a lib_verbose flag, default is false
-   int main(int argc, char** argv) {
-     FLAGS_lib_verbose = true;  // in my app, I want a verbose lib by default
-     ParseCommandLineFlags(...);
-   }
-
- -

For this application, users can still set the flag value on the -commandline, but if they do not, the flag's value will default to -true.

- - -

Special Flags

- -

There are a few flags defined by the commandlineflags module -itself, and are available to all applications that use -commandlineflags. These fall into -three categories. First are the 'reporting' flags that, when found, cause -the application to print some information about itself and exit.

- - - - - - - - - - - - - - - - - - - - - - - - - -
--helpshows all flags from all files, sorted by file and then by name; - shows the flagname, its default value, and its help string
--helpfullsame as -help, but unambiguously asks for all flags - (in case -help changes in the future)
--helpshortshows only flags for the file with the same name as the executable - (usually the one containing main())
--helpxmllike --help, but output is in xml for easier parsing
--helpon=FILE  shows only flags defined in FILE.*
--helpmatch=Sshows only flags defined in *S*.*
--helppackageshows flags defined in files in same directory as main()
--versionprints version info for the executable
- -

Second are the flags that affect how other flags are parsed.

- - - -
--undefok=flagname,flagname,...for those names listed as the argument to --undefok, - suppress the normal error-exit that occurs when - --name is seen on the commandline, but - name has not been DEFINED anywhere in the - application -
- -

Third are the 'recursive' flags, that cause other flag values to be -set: --fromenv, --tryfromenv, ---flagfile. These are described below in more -detail.

- -

--fromenv

- -

--fromenv=foo,bar says to read the values for the -foo and bar flags from the environment. -In concert with this flag, you must actually set the values in the -environment, via a line like one of the two below:

-
-   export FLAGS_foo=xxx; export FLAGS_bar=yyy   # sh
-   setenv FLAGS_foo xxx; setenv FLAGS_bar yyy   # tcsh
-
-

This is equivalent to specifying --foo=xxx, ---bar=yyy on the commandline.

- -

Note it is a fatal error to say --fromenv=foo if -foo is not DEFINED somewhere in the application. (Though -you can suppress this error via --undefok=foo, just like -for any other flag.)

- -

It is also a fatal error to say --fromenv=foo if -FLAGS_foo is not actually defined in the environment.

- -

--tryfromenv

- -

--tryfromenv is exactly like --fromenv, -except it is not a fatal error to say ---tryfromenv=foo if FLAGS_foo is not -actually defined in the environment. Instead, in such cases, -FLAGS_foo just keeps its default value as specified in -the application.

- -

Note it is still an error to say --tryfromenv=foo if -foo is not DEFINED somewhere in the application.

- -

--flagfile

- -

--flagfile=f tells the commandlineflags module to read -the file f, and to run all the flag-assignments found in -that file as if these flags had been specified on the commandline.

- -

In its simplest form, f should just be a list of flag -assignments, one per line. Unlike on the commandline, the equals sign -separating a flagname from its argument is required for -flagfiles. An example flagfile, /tmp/myflags:

-
---nobig_menus
---languages=english,french
-
- -

With this flagfile, the following two lines are equivalent:

-

-   ./myapp --foo --nobig_menus --languages=english,french --bar
-   ./myapp --foo --flagfile=/tmp/myflags --bar
-
- -

Note that many errors are silently suppressed in flagfiles. In -particular, unrecognized flagnames are silently ignored, as are flags -that are missing a required value (e.g., a flagfile that just says ---languages).

- -

The general format of a flagfile is a bit more complicated than the -simple, common case above. It is: a sequence of filenames, one per -line, followed by a sequence of flags, one per line, repeated as many -times as desired. Filenames in a flagfile can use wildcards -(* and ?), and the sequence of flags located -after a sequence of filenames is processed only if the current -executable's name matches one of the filenames. It is possible to -start the flagfile with a sequence of flags instead of a sequence of -filenames; if such a sequence of flags is present, these flags are -applied to the current executable no matter what it is.

- -

Lines that start with a # are ignored as comments. -Leading whitespace is also ignored in flagfiles, as are blank -lines.

- -

It is possible for a flagfile to use the --flagfile -flag to include another flagfile.

- -

Flags are always processed in the expected order. That is, -processing begins by examining the flags specified directly on the -command line. If a flagfile is specified, its contents are processed, -and then processing continues with remaining flags from the command -line.

- - -

The API

- -

In addition to accessing FLAGS_foo directly, it is -possible to access the flags programmatically, through an API. It is -also possible to access information about a flag, such as its default -value and help-string. A FlagSaver makes it easy to -modify flags and then automatically undo the modifications later. -Finally, there are somewhat unrelated, but useful, routines to easily -access parts of argv outside main, including the program -name (argv[0]).

- -

For more information about these routines, and other useful helper -methods such as gflags::SetUsageMessage() and -gflags::SetVersionString, see gflags.h.

- - -

Miscellaneous Notes

- -

If your application has code like this:

-
-   #define STRIP_FLAG_HELP 1    // this must go before the #include!
-   #include <gflags/gflags.h>
-
-

we will remove the help messages from the compiled source. This can -reduce the size of the resulting binary somewhat, and may also be -useful for security reasons.

- -

Issues and Feature Requests

- -

Please report any issues or ideas for additional features on GitHub. -We would also like to encourage pull requests for bug fixes and implementations of new features.

- -
-
-Craig Silverstein, Andreas Schuh
- -
- - - diff --git a/inference-engine/samples/thirdparty/gflags/src/config.h.in b/inference-engine/samples/thirdparty/gflags/src/config.h.in deleted file mode 100644 index f6d18d8dcc4..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/config.h.in +++ /dev/null @@ -1,114 +0,0 @@ -/* Generated from config.h.in during build configuration using CMake. */ - -// Note: This header file is only used internally. It is not part of public interface! - -#ifndef GFLAGS_CONFIG_H_ -#define GFLAGS_CONFIG_H_ - - -// --------------------------------------------------------------------------- -// System checks - -// Define if you build this library for a MS Windows OS. -#cmakedefine OS_WINDOWS - -// Define if you have the header file. -#cmakedefine HAVE_STDINT_H - -// Define if you have the header file. -#cmakedefine HAVE_SYS_TYPES_H - -// Define if you have the header file. -#cmakedefine HAVE_INTTYPES_H - -// Define if you have the header file. -#cmakedefine HAVE_SYS_STAT_H - -// Define if you have the header file. -#cmakedefine HAVE_UNISTD_H - -// Define if you have the header file. -#cmakedefine HAVE_FNMATCH_H - -// Define if you have the header file (Windows 2000/XP). -#cmakedefine HAVE_SHLWAPI_H - -// Define if you have the strtoll function. -#cmakedefine HAVE_STRTOLL - -// Define if you have the strtoq function. -#cmakedefine HAVE_STRTOQ - -// Define if you have the header file. -#cmakedefine HAVE_PTHREAD - -// Define if your pthread library defines the type pthread_rwlock_t -#cmakedefine HAVE_RWLOCK - -// gcc requires this to get PRId64, etc. -#if defined(HAVE_INTTYPES_H) && !defined(__STDC_FORMAT_MACROS) -# define __STDC_FORMAT_MACROS 1 -#endif - -// --------------------------------------------------------------------------- -// Package information - -// Name of package. -#define PACKAGE @PROJECT_NAME@ - -// Define to the full name of this package. -#define PACKAGE_NAME @PACKAGE_NAME@ - -// Define to the full name and version of this package. -#define PACKAGE_STRING @PACKAGE_STRING@ - -// Define to the one symbol short name of this package. -#define PACKAGE_TARNAME @PACKAGE_TARNAME@ - -// Define to the version of this package. -#define PACKAGE_VERSION @PACKAGE_VERSION@ - -// Version number of package. -#define VERSION PACKAGE_VERSION - -// Define to the address where bug reports for this package should be sent. -#define PACKAGE_BUGREPORT @PACKAGE_BUGREPORT@ - -// --------------------------------------------------------------------------- -// Path separator -#ifndef PATH_SEPARATOR -# ifdef OS_WINDOWS -# define PATH_SEPARATOR '\\' -# else -# define PATH_SEPARATOR '/' -# endif -#endif - -// --------------------------------------------------------------------------- -// Windows - -// Always export symbols when compiling a shared library as this file is only -// included by internal modules when building the gflags library itself. -// The gflags_declare.h header file will set it to import these symbols otherwise. -#ifndef GFLAGS_DLL_DECL -# if GFLAGS_IS_A_DLL && defined(_MSC_VER) -# define GFLAGS_DLL_DECL __declspec(dllexport) -# else -# define GFLAGS_DLL_DECL -# endif -#endif -// Flags defined by the gflags library itself must be exported -#ifndef GFLAGS_DLL_DEFINE_FLAG -# define GFLAGS_DLL_DEFINE_FLAG GFLAGS_DLL_DECL -#endif - -#ifdef OS_WINDOWS -// The unittests import the symbols of the shared gflags library -# if GFLAGS_IS_A_DLL && defined(_MSC_VER) -# define GFLAGS_DLL_DECL_FOR_UNITTESTS __declspec(dllimport) -# endif -# include "windows_port.h" -#endif - - -#endif // GFLAGS_CONFIG_H_ diff --git a/inference-engine/samples/thirdparty/gflags/src/gflags.cc b/inference-engine/samples/thirdparty/gflags/src/gflags.cc deleted file mode 100644 index f27079862f0..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/gflags.cc +++ /dev/null @@ -1,2050 +0,0 @@ -// Copyright (c) 1999, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// Revamped and reorganized by Craig Silverstein -// -// This file contains the implementation of all our command line flags -// stuff. Here's how everything fits together -// -// * FlagRegistry owns CommandLineFlags owns FlagValue. -// * FlagSaver holds a FlagRegistry (saves it at construct time, -// restores it at destroy time). -// * CommandLineFlagParser lives outside that hierarchy, but works on -// CommandLineFlags (modifying the FlagValues). -// * Free functions like SetCommandLineOption() work via one of the -// above (such as CommandLineFlagParser). -// -// In more detail: -// -// -- The main classes that hold flag data: -// -// FlagValue holds the current value of a flag. It's -// pseudo-templatized: every operation on a FlagValue is typed. It -// also deals with storage-lifetime issues (so flag values don't go -// away in a destructor), which is why we need a whole class to hold a -// variable's value. -// -// CommandLineFlag is all the information about a single command-line -// flag. It has a FlagValue for the flag's current value, but also -// the flag's name, type, etc. -// -// FlagRegistry is a collection of CommandLineFlags. There's the -// global registry, which is where flags defined via DEFINE_foo() -// live. But it's possible to define your own flag, manually, in a -// different registry you create. (In practice, multiple registries -// are used only by FlagSaver). -// -// A given FlagValue is owned by exactly one CommandLineFlag. A given -// CommandLineFlag is owned by exactly one FlagRegistry. FlagRegistry -// has a lock; any operation that writes to a FlagValue or -// CommandLineFlag owned by that registry must acquire the -// FlagRegistry lock before doing so. -// -// --- Some other classes and free functions: -// -// CommandLineFlagInfo is a client-exposed version of CommandLineFlag. -// Once it's instantiated, it has no dependencies or relationships -// with any other part of this file. -// -// FlagRegisterer is the helper class used by the DEFINE_* macros to -// allow work to be done at global initialization time. -// -// CommandLineFlagParser is the class that reads from the commandline -// and instantiates flag values based on that. It needs to poke into -// the innards of the FlagValue->CommandLineFlag->FlagRegistry class -// hierarchy to do that. It's careful to acquire the FlagRegistry -// lock before doing any writing or other non-const actions. -// -// GetCommandLineOption is just a hook into registry routines to -// retrieve a flag based on its name. SetCommandLineOption, on the -// other hand, hooks into CommandLineFlagParser. Other API functions -// are, similarly, mostly hooks into the functionality described above. - -#include "config.h" -#include "gflags/gflags.h" - -#include -#include -#include -#if defined(HAVE_FNMATCH_H) -# include -#elif defined(HAVE_SHLWAPI_H) -# define NO_SHLWAPI_ISOS -# include -#endif -#include // For va_list and related operations -#include -#include - -#include -#include -#include -#include // for pair<> -#include - -#include "mutex.h" -#include "util.h" - -using namespace MUTEX_NAMESPACE; - - -// Special flags, type 1: the 'recursive' flags. They set another flag's val. -DEFINE_string(flagfile, "", "load flags from file"); -DEFINE_string(fromenv, "", "set flags from the environment" - " [use 'export FLAGS_flag1=value']"); -DEFINE_string(tryfromenv, "", "set flags from the environment if present"); - -// Special flags, type 2: the 'parsing' flags. They modify how we parse. -DEFINE_string(undefok, "", "comma-separated list of flag names that it is okay to specify " - "on the command line even if the program does not define a flag " - "with that name. IMPORTANT: flags in this list that have " - "arguments MUST use the flag=value format"); - -namespace GFLAGS_NAMESPACE { - -using std::map; -using std::pair; -using std::sort; -using std::string; -using std::vector; - -// This is used by the unittest to test error-exit code -void GFLAGS_DLL_DECL (*gflags_exitfunc)(int) = &exit; // from stdlib.h - - -// The help message indicating that the commandline flag has been -// 'stripped'. It will not show up when doing "-help" and its -// variants. The flag is stripped if STRIP_FLAG_HELP is set to 1 -// before including base/gflags.h - -// This is used by this file, and also in gflags_reporting.cc -const char kStrippedFlagHelp[] = "\001\002\003\004 (unknown) \004\003\002\001"; - -namespace { - -// There are also 'reporting' flags, in gflags_reporting.cc. - -static const char kError[] = "ERROR: "; - -// Indicates that undefined options are to be ignored. -// Enables deferred processing of flags in dynamically loaded libraries. -static bool allow_command_line_reparsing = false; - -static bool logging_is_probably_set_up = false; - -// This is a 'prototype' validate-function. 'Real' validate -// functions, take a flag-value as an argument: ValidateFn(bool) or -// ValidateFn(uint64). However, for easier storage, we strip off this -// argument and then restore it when actually calling the function on -// a flag value. -typedef bool (*ValidateFnProto)(); - -// Whether we should die when reporting an error. -enum DieWhenReporting { DIE, DO_NOT_DIE }; - -// Report Error and exit if requested. -static void ReportError(DieWhenReporting should_die, const char* format, ...) { - va_list ap; - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - fflush(stderr); // should be unnecessary, but cygwin's rxvt buffers stderr - if (should_die == DIE) gflags_exitfunc(1); -} - - -// -------------------------------------------------------------------- -// FlagValue -// This represent the value a single flag might have. The major -// functionality is to convert from a string to an object of a -// given type, and back. Thread-compatible. -// -------------------------------------------------------------------- - -class CommandLineFlag; -class FlagValue { - public: - enum ValueType { - FV_BOOL = 0, - FV_INT32 = 1, - FV_UINT32 = 2, - FV_INT64 = 3, - FV_UINT64 = 4, - FV_DOUBLE = 5, - FV_STRING = 6, - FV_MAX_INDEX = 6, - }; - - template - FlagValue(FlagType* valbuf, bool transfer_ownership_of_value); - ~FlagValue(); - - bool ParseFrom(const char* spec); - string ToString() const; - - ValueType Type() const { return static_cast(type_); } - - private: - friend class CommandLineFlag; // for many things, including Validate() - friend class GFLAGS_NAMESPACE::FlagSaverImpl; // calls New() - friend class FlagRegistry; // checks value_buffer_ for flags_by_ptr_ map - template friend T GetFromEnv(const char*, T); - friend bool TryParseLocked(const CommandLineFlag*, FlagValue*, - const char*, string*); // for New(), CopyFrom() - - template - struct FlagValueTraits; - - const char* TypeName() const; - bool Equal(const FlagValue& x) const; - FlagValue* New() const; // creates a new one with default value - void CopyFrom(const FlagValue& x); - int ValueSize() const; - - // Calls the given validate-fn on value_buffer_, and returns - // whatever it returns. But first casts validate_fn_proto to a - // function that takes our value as an argument (eg void - // (*validate_fn)(bool) for a bool flag). - bool Validate(const char* flagname, ValidateFnProto validate_fn_proto) const; - - void* const value_buffer_; // points to the buffer holding our data - const int8 type_; // how to interpret value_ - const bool owns_value_; // whether to free value on destruct - - FlagValue(const FlagValue&); // no copying! - void operator=(const FlagValue&); -}; - -// Map the given C++ type to a value of the ValueType enum at compile time. -#define DEFINE_FLAG_TRAITS(type, value) \ - template <> \ - struct FlagValue::FlagValueTraits { \ - static const ValueType kValueType = value; \ - } - -// Define full template specializations of the FlagValueTraits template -// for all supported flag types. -DEFINE_FLAG_TRAITS(bool, FV_BOOL); -DEFINE_FLAG_TRAITS(int32, FV_INT32); -DEFINE_FLAG_TRAITS(uint32, FV_UINT32); -DEFINE_FLAG_TRAITS(int64, FV_INT64); -DEFINE_FLAG_TRAITS(uint64, FV_UINT64); -DEFINE_FLAG_TRAITS(double, FV_DOUBLE); -DEFINE_FLAG_TRAITS(std::string, FV_STRING); - -#undef DEFINE_FLAG_TRAITS - - -// This could be a templated method of FlagValue, but doing so adds to the -// size of the .o. Since there's no type-safety here anyway, macro is ok. -#define VALUE_AS(type) *reinterpret_cast(value_buffer_) -#define OTHER_VALUE_AS(fv, type) *reinterpret_cast(fv.value_buffer_) -#define SET_VALUE_AS(type, value) VALUE_AS(type) = (value) - -template -FlagValue::FlagValue(FlagType* valbuf, - bool transfer_ownership_of_value) - : value_buffer_(valbuf), - type_(FlagValueTraits::kValueType), - owns_value_(transfer_ownership_of_value) { -} - -FlagValue::~FlagValue() { - if (!owns_value_) { - return; - } - switch (type_) { - case FV_BOOL: delete reinterpret_cast(value_buffer_); break; - case FV_INT32: delete reinterpret_cast(value_buffer_); break; - case FV_UINT32: delete reinterpret_cast(value_buffer_); break; - case FV_INT64: delete reinterpret_cast(value_buffer_); break; - case FV_UINT64: delete reinterpret_cast(value_buffer_); break; - case FV_DOUBLE: delete reinterpret_cast(value_buffer_); break; - case FV_STRING: delete reinterpret_cast(value_buffer_); break; - } -} - -bool FlagValue::ParseFrom(const char* value) { - if (type_ == FV_BOOL) { - const char* kTrue[] = { "1", "t", "true", "y", "yes" }; - const char* kFalse[] = { "0", "f", "false", "n", "no" }; - COMPILE_ASSERT(sizeof(kTrue) == sizeof(kFalse), true_false_equal); - for (size_t i = 0; i < sizeof(kTrue)/sizeof(*kTrue); ++i) { - if (strcasecmp(value, kTrue[i]) == 0) { - SET_VALUE_AS(bool, true); - return true; - } else if (strcasecmp(value, kFalse[i]) == 0) { - SET_VALUE_AS(bool, false); - return true; - } - } - return false; // didn't match a legal input - - } else if (type_ == FV_STRING) { - SET_VALUE_AS(string, value); - return true; - } - - // OK, it's likely to be numeric, and we'll be using a strtoXXX method. - if (value[0] == '\0') // empty-string is only allowed for string type. - return false; - char* end; - // Leading 0x puts us in base 16. But leading 0 does not put us in base 8! - // It caused too many bugs when we had that behavior. - int base = 10; // by default - if (value[0] == '0' && (value[1] == 'x' || value[1] == 'X')) - base = 16; - errno = 0; - - switch (type_) { - case FV_INT32: { - const int64 r = strto64(value, &end, base); - if (errno || end != value + strlen(value)) return false; // bad parse - if (static_cast(r) != r) // worked, but number out of range - return false; - SET_VALUE_AS(int32, static_cast(r)); - return true; - } - case FV_UINT32: { - while (*value == ' ') value++; - if (*value == '-') return false; // negative number - const uint64 r = strtou64(value, &end, base); - if (errno || end != value + strlen(value)) return false; // bad parse - if (static_cast(r) != r) // worked, but number out of range - return false; - SET_VALUE_AS(uint32, static_cast(r)); - return true; - } - case FV_INT64: { - const int64 r = strto64(value, &end, base); - if (errno || end != value + strlen(value)) return false; // bad parse - SET_VALUE_AS(int64, r); - return true; - } - case FV_UINT64: { - while (*value == ' ') value++; - if (*value == '-') return false; // negative number - const uint64 r = strtou64(value, &end, base); - if (errno || end != value + strlen(value)) return false; // bad parse - SET_VALUE_AS(uint64, r); - return true; - } - case FV_DOUBLE: { - const double r = strtod(value, &end); - if (errno || end != value + strlen(value)) return false; // bad parse - SET_VALUE_AS(double, r); - return true; - } - default: { - assert(false); // unknown type - return false; - } - } -} - -string FlagValue::ToString() const { - char intbuf[64]; // enough to hold even the biggest number - switch (type_) { - case FV_BOOL: - return VALUE_AS(bool) ? "true" : "false"; - case FV_INT32: - snprintf(intbuf, sizeof(intbuf), "%" PRId32, VALUE_AS(int32)); - return intbuf; - case FV_UINT32: - snprintf(intbuf, sizeof(intbuf), "%" PRIu32, VALUE_AS(uint32)); - return intbuf; - case FV_INT64: - snprintf(intbuf, sizeof(intbuf), "%" PRId64, VALUE_AS(int64)); - return intbuf; - case FV_UINT64: - snprintf(intbuf, sizeof(intbuf), "%" PRIu64, VALUE_AS(uint64)); - return intbuf; - case FV_DOUBLE: - snprintf(intbuf, sizeof(intbuf), "%.17g", VALUE_AS(double)); - return intbuf; - case FV_STRING: - return VALUE_AS(string); - default: - assert(false); - return ""; // unknown type - } -} - -bool FlagValue::Validate(const char* flagname, - ValidateFnProto validate_fn_proto) const { - switch (type_) { - case FV_BOOL: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(bool)); - case FV_INT32: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(int32)); - case FV_UINT32: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(uint32)); - case FV_INT64: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(int64)); - case FV_UINT64: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(uint64)); - case FV_DOUBLE: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(double)); - case FV_STRING: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(string)); - default: - assert(false); // unknown type - return false; - } -} - -const char* FlagValue::TypeName() const { - static const char types[] = - "bool\0xx" - "int32\0x" - "uint32\0" - "int64\0x" - "uint64\0" - "double\0" - "string"; - if (type_ > FV_MAX_INDEX) { - assert(false); - return ""; - } - // Directly indexing the strings in the 'types' string, each of them is 7 bytes long. - return &types[type_ * 7]; -} - -bool FlagValue::Equal(const FlagValue& x) const { - if (type_ != x.type_) - return false; - switch (type_) { - case FV_BOOL: return VALUE_AS(bool) == OTHER_VALUE_AS(x, bool); - case FV_INT32: return VALUE_AS(int32) == OTHER_VALUE_AS(x, int32); - case FV_UINT32: return VALUE_AS(uint32) == OTHER_VALUE_AS(x, uint32); - case FV_INT64: return VALUE_AS(int64) == OTHER_VALUE_AS(x, int64); - case FV_UINT64: return VALUE_AS(uint64) == OTHER_VALUE_AS(x, uint64); - case FV_DOUBLE: return VALUE_AS(double) == OTHER_VALUE_AS(x, double); - case FV_STRING: return VALUE_AS(string) == OTHER_VALUE_AS(x, string); - default: assert(false); return false; // unknown type - } -} - -FlagValue* FlagValue::New() const { - switch (type_) { - case FV_BOOL: return new FlagValue(new bool(false), true); - case FV_INT32: return new FlagValue(new int32(0), true); - case FV_UINT32: return new FlagValue(new uint32(0), true); - case FV_INT64: return new FlagValue(new int64(0), true); - case FV_UINT64: return new FlagValue(new uint64(0), true); - case FV_DOUBLE: return new FlagValue(new double(0.0), true); - case FV_STRING: return new FlagValue(new string, true); - default: assert(false); return NULL; // unknown type - } -} - -void FlagValue::CopyFrom(const FlagValue& x) { - assert(type_ == x.type_); - switch (type_) { - case FV_BOOL: SET_VALUE_AS(bool, OTHER_VALUE_AS(x, bool)); break; - case FV_INT32: SET_VALUE_AS(int32, OTHER_VALUE_AS(x, int32)); break; - case FV_UINT32: SET_VALUE_AS(uint32, OTHER_VALUE_AS(x, uint32)); break; - case FV_INT64: SET_VALUE_AS(int64, OTHER_VALUE_AS(x, int64)); break; - case FV_UINT64: SET_VALUE_AS(uint64, OTHER_VALUE_AS(x, uint64)); break; - case FV_DOUBLE: SET_VALUE_AS(double, OTHER_VALUE_AS(x, double)); break; - case FV_STRING: SET_VALUE_AS(string, OTHER_VALUE_AS(x, string)); break; - default: assert(false); // unknown type - } -} - -int FlagValue::ValueSize() const { - if (type_ > FV_MAX_INDEX) { - assert(false); // unknown type - return 0; - } - static const uint8 valuesize[] = { - sizeof(bool), - sizeof(int32), - sizeof(uint32), - sizeof(int64), - sizeof(uint64), - sizeof(double), - sizeof(string), - }; - return valuesize[type_]; -} - -// -------------------------------------------------------------------- -// CommandLineFlag -// This represents a single flag, including its name, description, -// default value, and current value. Mostly this serves as a -// struct, though it also knows how to register itself. -// All CommandLineFlags are owned by a (exactly one) -// FlagRegistry. If you wish to modify fields in this class, you -// should acquire the FlagRegistry lock for the registry that owns -// this flag. -// -------------------------------------------------------------------- - -class CommandLineFlag { - public: - // Note: we take over memory-ownership of current_val and default_val. - CommandLineFlag(const char* name, const char* help, const char* filename, - FlagValue* current_val, FlagValue* default_val); - ~CommandLineFlag(); - - const char* name() const { return name_; } - const char* help() const { return help_; } - const char* filename() const { return file_; } - const char* CleanFileName() const; // nixes irrelevant prefix such as homedir - string current_value() const { return current_->ToString(); } - string default_value() const { return defvalue_->ToString(); } - const char* type_name() const { return defvalue_->TypeName(); } - ValidateFnProto validate_function() const { return validate_fn_proto_; } - const void* flag_ptr() const { return current_->value_buffer_; } - - FlagValue::ValueType Type() const { return defvalue_->Type(); } - - void FillCommandLineFlagInfo(struct CommandLineFlagInfo* result); - - // If validate_fn_proto_ is non-NULL, calls it on value, returns result. - bool Validate(const FlagValue& value) const; - bool ValidateCurrent() const { return Validate(*current_); } - bool Modified() const { return modified_; } - - private: - // for SetFlagLocked() and setting flags_by_ptr_ - friend class FlagRegistry; - friend class GFLAGS_NAMESPACE::FlagSaverImpl; // for cloning the values - // set validate_fn - friend bool AddFlagValidator(const void*, ValidateFnProto); - - // This copies all the non-const members: modified, processed, defvalue, etc. - void CopyFrom(const CommandLineFlag& src); - - void UpdateModifiedBit(); - - const char* const name_; // Flag name - const char* const help_; // Help message - const char* const file_; // Which file did this come from? - bool modified_; // Set after default assignment? - FlagValue* defvalue_; // Default value for flag - FlagValue* current_; // Current value for flag - // This is a casted, 'generic' version of validate_fn, which actually - // takes a flag-value as an arg (void (*validate_fn)(bool), say). - // When we pass this to current_->Validate(), it will cast it back to - // the proper type. This may be NULL to mean we have no validate_fn. - ValidateFnProto validate_fn_proto_; - - CommandLineFlag(const CommandLineFlag&); // no copying! - void operator=(const CommandLineFlag&); -}; - -CommandLineFlag::CommandLineFlag(const char* name, const char* help, - const char* filename, - FlagValue* current_val, FlagValue* default_val) - : name_(name), help_(help), file_(filename), modified_(false), - defvalue_(default_val), current_(current_val), validate_fn_proto_(NULL) { -} - -CommandLineFlag::~CommandLineFlag() { - delete current_; - delete defvalue_; -} - -const char* CommandLineFlag::CleanFileName() const { - // Compute top-level directory & file that this appears in - // search full path backwards. - // Stop going backwards at kRootDir; and skip by the first slash. - static const char kRootDir[] = ""; // can set this to root directory, - - if (sizeof(kRootDir)-1 == 0) // no prefix to strip - return filename(); - - const char* clean_name = filename() + strlen(filename()) - 1; - while ( clean_name > filename() ) { - if (*clean_name == PATH_SEPARATOR) { - if (sizeof(kRootDir) > 1 && strncmp(clean_name, kRootDir, sizeof(kRootDir)-1) == 0) { - clean_name += sizeof(kRootDir)-1; // past root-dir - break; - } - } - --clean_name; - } - while ( *clean_name == PATH_SEPARATOR ) ++clean_name; // Skip any slashes - return clean_name; -} - -void CommandLineFlag::FillCommandLineFlagInfo( - CommandLineFlagInfo* result) { - result->name = name(); - result->type = type_name(); - result->description = help(); - result->current_value = current_value(); - result->default_value = default_value(); - result->filename = CleanFileName(); - UpdateModifiedBit(); - result->is_default = !modified_; - result->has_validator_fn = validate_function() != NULL; - result->flag_ptr = flag_ptr(); -} - -void CommandLineFlag::UpdateModifiedBit() { - // Update the "modified" bit in case somebody bypassed the - // Flags API and wrote directly through the FLAGS_name variable. - if (!modified_ && !current_->Equal(*defvalue_)) { - modified_ = true; - } -} - -void CommandLineFlag::CopyFrom(const CommandLineFlag& src) { - // Note we only copy the non-const members; others are fixed at construct time - if (modified_ != src.modified_) modified_ = src.modified_; - if (!current_->Equal(*src.current_)) current_->CopyFrom(*src.current_); - if (!defvalue_->Equal(*src.defvalue_)) defvalue_->CopyFrom(*src.defvalue_); - if (validate_fn_proto_ != src.validate_fn_proto_) - validate_fn_proto_ = src.validate_fn_proto_; -} - -bool CommandLineFlag::Validate(const FlagValue& value) const { - - if (validate_function() == NULL) - return true; - else - return value.Validate(name(), validate_function()); -} - - -// -------------------------------------------------------------------- -// FlagRegistry -// A FlagRegistry singleton object holds all flag objects indexed -// by their names so that if you know a flag's name (as a C -// string), you can access or set it. If the function is named -// FooLocked(), you must own the registry lock before calling -// the function; otherwise, you should *not* hold the lock, and -// the function will acquire it itself if needed. -// -------------------------------------------------------------------- - -struct StringCmp { // Used by the FlagRegistry map class to compare char*'s - bool operator() (const char* s1, const char* s2) const { - return (strcmp(s1, s2) < 0); - } -}; - - -class FlagRegistry { - public: - FlagRegistry() { - } - ~FlagRegistry() { - // Not using STLDeleteElements as that resides in util and this - // class is base. - for (FlagMap::iterator p = flags_.begin(), e = flags_.end(); p != e; ++p) { - CommandLineFlag* flag = p->second; - delete flag; - } - } - - static void DeleteGlobalRegistry() { - delete global_registry_; - global_registry_ = NULL; - } - - // Store a flag in this registry. Takes ownership of the given pointer. - void RegisterFlag(CommandLineFlag* flag); - - void Lock() { lock_.Lock(); } - void Unlock() { lock_.Unlock(); } - - // Returns the flag object for the specified name, or NULL if not found. - CommandLineFlag* FindFlagLocked(const char* name); - - // Returns the flag object whose current-value is stored at flag_ptr. - // That is, for whom current_->value_buffer_ == flag_ptr - CommandLineFlag* FindFlagViaPtrLocked(const void* flag_ptr); - - // A fancier form of FindFlag that works correctly if name is of the - // form flag=value. In that case, we set key to point to flag, and - // modify v to point to the value (if present), and return the flag - // with the given name. If the flag does not exist, returns NULL - // and sets error_message. - CommandLineFlag* SplitArgumentLocked(const char* argument, - string* key, const char** v, - string* error_message); - - // Set the value of a flag. If the flag was successfully set to - // value, set msg to indicate the new flag-value, and return true. - // Otherwise, set msg to indicate the error, leave flag unchanged, - // and return false. msg can be NULL. - bool SetFlagLocked(CommandLineFlag* flag, const char* value, - FlagSettingMode set_mode, string* msg); - - static FlagRegistry* GlobalRegistry(); // returns a singleton registry - - private: - friend class GFLAGS_NAMESPACE::FlagSaverImpl; // reads all the flags in order to copy them - friend class CommandLineFlagParser; // for ValidateUnmodifiedFlags - friend void GFLAGS_NAMESPACE::GetAllFlags(vector*); - - // The map from name to flag, for FindFlagLocked(). - typedef map FlagMap; - typedef FlagMap::iterator FlagIterator; - typedef FlagMap::const_iterator FlagConstIterator; - FlagMap flags_; - - // The map from current-value pointer to flag, fo FindFlagViaPtrLocked(). - typedef map FlagPtrMap; - FlagPtrMap flags_by_ptr_; - - static FlagRegistry* global_registry_; // a singleton registry - - Mutex lock_; - - static void InitGlobalRegistry(); - - // Disallow - FlagRegistry(const FlagRegistry&); - FlagRegistry& operator=(const FlagRegistry&); -}; - -class FlagRegistryLock { - public: - explicit FlagRegistryLock(FlagRegistry* fr) : fr_(fr) { fr_->Lock(); } - ~FlagRegistryLock() { fr_->Unlock(); } - private: - FlagRegistry *const fr_; -}; - - -void FlagRegistry::RegisterFlag(CommandLineFlag* flag) { - Lock(); - pair ins = - flags_.insert(pair(flag->name(), flag)); - if (ins.second == false) { // means the name was already in the map - if (strcmp(ins.first->second->filename(), flag->filename()) != 0) { - ReportError(DIE, "ERROR: flag '%s' was defined more than once " - "(in files '%s' and '%s').\n", - flag->name(), - ins.first->second->filename(), - flag->filename()); - } else { - ReportError(DIE, "ERROR: something wrong with flag '%s' in file '%s'. " - "One possibility: file '%s' is being linked both statically " - "and dynamically into this executable.\n", - flag->name(), - flag->filename(), flag->filename()); - } - } - // Also add to the flags_by_ptr_ map. - flags_by_ptr_[flag->current_->value_buffer_] = flag; - Unlock(); -} - -CommandLineFlag* FlagRegistry::FindFlagLocked(const char* name) { - FlagConstIterator i = flags_.find(name); - if (i == flags_.end()) { - // If the name has dashes in it, try again after replacing with - // underscores. - if (strchr(name, '-') == NULL) return NULL; - string name_rep = name; - std::replace(name_rep.begin(), name_rep.end(), '-', '_'); - return FindFlagLocked(name_rep.c_str()); - } else { - return i->second; - } -} - -CommandLineFlag* FlagRegistry::FindFlagViaPtrLocked(const void* flag_ptr) { - FlagPtrMap::const_iterator i = flags_by_ptr_.find(flag_ptr); - if (i == flags_by_ptr_.end()) { - return NULL; - } else { - return i->second; - } -} - -CommandLineFlag* FlagRegistry::SplitArgumentLocked(const char* arg, - string* key, - const char** v, - string* error_message) { - // Find the flag object for this option - const char* flag_name; - const char* value = strchr(arg, '='); - if (value == NULL) { - key->assign(arg); - *v = NULL; - } else { - // Strip out the "=value" portion from arg - key->assign(arg, value-arg); - *v = ++value; // advance past the '=' - } - flag_name = key->c_str(); - - CommandLineFlag* flag = FindFlagLocked(flag_name); - - if (flag == NULL) { - // If we can't find the flag-name, then we should return an error. - // The one exception is if 1) the flag-name is 'nox', 2) there - // exists a flag named 'x', and 3) 'x' is a boolean flag. - // In that case, we want to return flag 'x'. - if (!(flag_name[0] == 'n' && flag_name[1] == 'o')) { - // flag-name is not 'nox', so we're not in the exception case. - *error_message = StringPrintf("%sunknown command line flag '%s'\n", - kError, key->c_str()); - return NULL; - } - flag = FindFlagLocked(flag_name+2); - if (flag == NULL) { - // No flag named 'x' exists, so we're not in the exception case. - *error_message = StringPrintf("%sunknown command line flag '%s'\n", - kError, key->c_str()); - return NULL; - } - if (flag->Type() != FlagValue::FV_BOOL) { - // 'x' exists but is not boolean, so we're not in the exception case. - *error_message = StringPrintf( - "%sboolean value (%s) specified for %s command line flag\n", - kError, key->c_str(), flag->type_name()); - return NULL; - } - // We're in the exception case! - // Make up a fake value to replace the "no" we stripped out - key->assign(flag_name+2); // the name without the "no" - *v = "0"; - } - - // Assign a value if this is a boolean flag - if (*v == NULL && flag->Type() == FlagValue::FV_BOOL) { - *v = "1"; // the --nox case was already handled, so this is the --x case - } - - return flag; -} - -bool TryParseLocked(const CommandLineFlag* flag, FlagValue* flag_value, - const char* value, string* msg) { - // Use tenative_value, not flag_value, until we know value is valid. - FlagValue* tentative_value = flag_value->New(); - if (!tentative_value->ParseFrom(value)) { - if (msg) { - StringAppendF(msg, - "%sillegal value '%s' specified for %s flag '%s'\n", - kError, value, - flag->type_name(), flag->name()); - } - delete tentative_value; - return false; - } else if (!flag->Validate(*tentative_value)) { - if (msg) { - StringAppendF(msg, - "%sfailed validation of new value '%s' for flag '%s'\n", - kError, tentative_value->ToString().c_str(), - flag->name()); - } - delete tentative_value; - return false; - } else { - flag_value->CopyFrom(*tentative_value); - if (msg) { - StringAppendF(msg, "%s set to %s\n", - flag->name(), flag_value->ToString().c_str()); - } - delete tentative_value; - return true; - } -} - -bool FlagRegistry::SetFlagLocked(CommandLineFlag* flag, - const char* value, - FlagSettingMode set_mode, - string* msg) { - flag->UpdateModifiedBit(); - switch (set_mode) { - case SET_FLAGS_VALUE: { - // set or modify the flag's value - if (!TryParseLocked(flag, flag->current_, value, msg)) - return false; - flag->modified_ = true; - break; - } - case SET_FLAG_IF_DEFAULT: { - // set the flag's value, but only if it hasn't been set by someone else - if (!flag->modified_) { - if (!TryParseLocked(flag, flag->current_, value, msg)) - return false; - flag->modified_ = true; - } else { - *msg = StringPrintf("%s set to %s", - flag->name(), flag->current_value().c_str()); - } - break; - } - case SET_FLAGS_DEFAULT: { - // modify the flag's default-value - if (!TryParseLocked(flag, flag->defvalue_, value, msg)) - return false; - if (!flag->modified_) { - // Need to set both defvalue *and* current, in this case - TryParseLocked(flag, flag->current_, value, NULL); - } - break; - } - default: { - // unknown set_mode - assert(false); - return false; - } - } - - return true; -} - -// Get the singleton FlagRegistry object -FlagRegistry* FlagRegistry::global_registry_ = NULL; - -FlagRegistry* FlagRegistry::GlobalRegistry() { - static Mutex lock(Mutex::LINKER_INITIALIZED); - MutexLock acquire_lock(&lock); - if (!global_registry_) { - global_registry_ = new FlagRegistry; - } - return global_registry_; -} - -// -------------------------------------------------------------------- -// CommandLineFlagParser -// Parsing is done in two stages. In the first, we go through -// argv. For every flag-like arg we can make sense of, we parse -// it and set the appropriate FLAGS_* variable. For every flag- -// like arg we can't make sense of, we store it in a vector, -// along with an explanation of the trouble. In stage 2, we -// handle the 'reporting' flags like --help and --mpm_version. -// (This is via a call to HandleCommandLineHelpFlags(), in -// gflags_reporting.cc.) -// An optional stage 3 prints out the error messages. -// This is a bit of a simplification. For instance, --flagfile -// is handled as soon as it's seen in stage 1, not in stage 2. -// -------------------------------------------------------------------- - -class CommandLineFlagParser { - public: - // The argument is the flag-registry to register the parsed flags in - explicit CommandLineFlagParser(FlagRegistry* reg) : registry_(reg) {} - ~CommandLineFlagParser() {} - - // Stage 1: Every time this is called, it reads all flags in argv. - // However, it ignores all flags that have been successfully set - // before. Typically this is only called once, so this 'reparsing' - // behavior isn't important. It can be useful when trying to - // reparse after loading a dll, though. - uint32 ParseNewCommandLineFlags(int* argc, char*** argv, bool remove_flags); - - // Stage 2: print reporting info and exit, if requested. - // In gflags_reporting.cc:HandleCommandLineHelpFlags(). - - // Stage 3: validate all the commandline flags that have validators - // registered and were not set/modified by ParseNewCommandLineFlags. - void ValidateFlags(bool all); - void ValidateAllFlags(); - void ValidateUnmodifiedFlags(); - - // Stage 4: report any errors and return true if any were found. - bool ReportErrors(); - - // Set a particular command line option. "newval" is a string - // describing the new value that the option has been set to. If - // option_name does not specify a valid option name, or value is not - // a valid value for option_name, newval is empty. Does recursive - // processing for --flagfile and --fromenv. Returns the new value - // if everything went ok, or empty-string if not. (Actually, the - // return-string could hold many flag/value pairs due to --flagfile.) - // NB: Must have called registry_->Lock() before calling this function. - string ProcessSingleOptionLocked(CommandLineFlag* flag, - const char* value, - FlagSettingMode set_mode); - - // Set a whole batch of command line options as specified by contentdata, - // which is in flagfile format (and probably has been read from a flagfile). - // Returns the new value if everything went ok, or empty-string if - // not. (Actually, the return-string could hold many flag/value - // pairs due to --flagfile.) - // NB: Must have called registry_->Lock() before calling this function. - string ProcessOptionsFromStringLocked(const string& contentdata, - FlagSettingMode set_mode); - - // These are the 'recursive' flags, defined at the top of this file. - // Whenever we see these flags on the commandline, we must take action. - // These are called by ProcessSingleOptionLocked and, similarly, return - // new values if everything went ok, or the empty-string if not. - string ProcessFlagfileLocked(const string& flagval, FlagSettingMode set_mode); - // diff fromenv/tryfromenv - string ProcessFromenvLocked(const string& flagval, FlagSettingMode set_mode, - bool errors_are_fatal); - - private: - FlagRegistry* const registry_; - map error_flags_; // map from name to error message - // This could be a set, but we reuse the map to minimize the .o size - map undefined_names_; // --[flag] name was not registered -}; - - -// Parse a list of (comma-separated) flags. -static void ParseFlagList(const char* value, vector* flags) { - for (const char *p = value; p && *p; value = p) { - p = strchr(value, ','); - size_t len; - if (p) { - len = p - value; - p++; - } else { - len = strlen(value); - } - - if (len == 0) - ReportError(DIE, "ERROR: empty flaglist entry\n"); - if (value[0] == '-') - ReportError(DIE, "ERROR: flag \"%*s\" begins with '-'\n", len, value); - - flags->push_back(string(value, len)); - } -} - -// Snarf an entire file into a C++ string. This is just so that we -// can do all the I/O in one place and not worry about it everywhere. -// Plus, it's convenient to have the whole file contents at hand. -// Adds a newline at the end of the file. -#define PFATAL(s) do { perror(s); gflags_exitfunc(1); } while (0) - -static string ReadFileIntoString(const char* filename) { - const int kBufSize = 8092; - char buffer[kBufSize]; - string s; - FILE* fp; - if ((errno = SafeFOpen(&fp, filename, "r")) != 0) PFATAL(filename); - size_t n; - while ( (n=fread(buffer, 1, kBufSize, fp)) > 0 ) { - if (ferror(fp)) PFATAL(filename); - s.append(buffer, n); - } - fclose(fp); - return s; -} - -uint32 CommandLineFlagParser::ParseNewCommandLineFlags(int* argc, char*** argv, - bool remove_flags) { - int first_nonopt = *argc; // for non-options moved to the end - - registry_->Lock(); - for (int i = 1; i < first_nonopt; i++) { - char* arg = (*argv)[i]; - - // Like getopt(), we permute non-option flags to be at the end. - if (arg[0] != '-' || // must be a program argument - (arg[0] == '-' && arg[1] == '\0')) { // "-" is an argument, not a flag - memmove((*argv) + i, (*argv) + i+1, (*argc - (i+1)) * sizeof((*argv)[i])); - (*argv)[*argc-1] = arg; // we go last - first_nonopt--; // we've been pushed onto the stack - i--; // to undo the i++ in the loop - continue; - } - - if (arg[0] == '-') arg++; // allow leading '-' - if (arg[0] == '-') arg++; // or leading '--' - - // -- alone means what it does for GNU: stop options parsing - if (*arg == '\0') { - first_nonopt = i+1; - break; - } - - // Find the flag object for this option - string key; - const char* value; - string error_message; - CommandLineFlag* flag = registry_->SplitArgumentLocked(arg, &key, &value, - &error_message); - if (flag == NULL) { - undefined_names_[key] = ""; // value isn't actually used - error_flags_[key] = error_message; - continue; - } - - if (value == NULL) { - // Boolean options are always assigned a value by SplitArgumentLocked() - assert(flag->Type() != FlagValue::FV_BOOL); - if (i+1 >= first_nonopt) { - // This flag needs a value, but there is nothing available - error_flags_[key] = (string(kError) + "flag '" + (*argv)[i] + "'" - + " is missing its argument"); - if (flag->help() && flag->help()[0] > '\001') { - // Be useful in case we have a non-stripped description. - error_flags_[key] += string("; flag description: ") + flag->help(); - } - error_flags_[key] += "\n"; - break; // we treat this as an unrecoverable error - } else { - value = (*argv)[++i]; // read next arg for value - - // Heuristic to detect the case where someone treats a string arg - // like a bool: - // --my_string_var --foo=bar - // We look for a flag of string type, whose value begins with a - // dash, and where the flag-name and value are separated by a - // space rather than an '='. - // To avoid false positives, we also require the word "true" - // or "false" in the help string. Without this, a valid usage - // "-lat -30.5" would trigger the warning. The common cases we - // want to solve talk about true and false as values. - if (value[0] == '-' - && flag->Type() == FlagValue::FV_STRING - && (strstr(flag->help(), "true") - || strstr(flag->help(), "false"))) { - LOG(WARNING) << "Did you really mean to set flag '" - << flag->name() << "' to the value '" - << value << "'?"; - } - } - } - - // TODO(csilvers): only set a flag if we hadn't set it before here - ProcessSingleOptionLocked(flag, value, SET_FLAGS_VALUE); - } - registry_->Unlock(); - - if (remove_flags) { // Fix up argc and argv by removing command line flags - (*argv)[first_nonopt-1] = (*argv)[0]; - (*argv) += (first_nonopt-1); - (*argc) -= (first_nonopt-1); - first_nonopt = 1; // because we still don't count argv[0] - } - - logging_is_probably_set_up = true; // because we've parsed --logdir, etc. - - return first_nonopt; -} - -string CommandLineFlagParser::ProcessFlagfileLocked(const string& flagval, - FlagSettingMode set_mode) { - if (flagval.empty()) - return ""; - - string msg; - vector filename_list; - ParseFlagList(flagval.c_str(), &filename_list); // take a list of filenames - for (size_t i = 0; i < filename_list.size(); ++i) { - const char* file = filename_list[i].c_str(); - msg += ProcessOptionsFromStringLocked(ReadFileIntoString(file), set_mode); - } - return msg; -} - -string CommandLineFlagParser::ProcessFromenvLocked(const string& flagval, - FlagSettingMode set_mode, - bool errors_are_fatal) { - if (flagval.empty()) - return ""; - - string msg; - vector flaglist; - ParseFlagList(flagval.c_str(), &flaglist); - - for (size_t i = 0; i < flaglist.size(); ++i) { - const char* flagname = flaglist[i].c_str(); - CommandLineFlag* flag = registry_->FindFlagLocked(flagname); - if (flag == NULL) { - error_flags_[flagname] = - StringPrintf("%sunknown command line flag '%s' " - "(via --fromenv or --tryfromenv)\n", - kError, flagname); - undefined_names_[flagname] = ""; - continue; - } - - const string envname = string("FLAGS_") + string(flagname); - string envval; - if (!SafeGetEnv(envname.c_str(), envval)) { - if (errors_are_fatal) { - error_flags_[flagname] = (string(kError) + envname + - " not found in environment\n"); - } - continue; - } - - // Avoid infinite recursion. - if (envval == "fromenv" || envval == "tryfromenv") { - error_flags_[flagname] = - StringPrintf("%sinfinite recursion on environment flag '%s'\n", - kError, envval.c_str()); - continue; - } - - msg += ProcessSingleOptionLocked(flag, envval.c_str(), set_mode); - } - return msg; -} - -string CommandLineFlagParser::ProcessSingleOptionLocked( - CommandLineFlag* flag, const char* value, FlagSettingMode set_mode) { - string msg; - if (value && !registry_->SetFlagLocked(flag, value, set_mode, &msg)) { - error_flags_[flag->name()] = msg; - return ""; - } - - // The recursive flags, --flagfile and --fromenv and --tryfromenv, - // must be dealt with as soon as they're seen. They will emit - // messages of their own. - if (strcmp(flag->name(), "flagfile") == 0) { - msg += ProcessFlagfileLocked(FLAGS_flagfile, set_mode); - - } else if (strcmp(flag->name(), "fromenv") == 0) { - // last arg indicates envval-not-found is fatal (unlike in --tryfromenv) - msg += ProcessFromenvLocked(FLAGS_fromenv, set_mode, true); - - } else if (strcmp(flag->name(), "tryfromenv") == 0) { - msg += ProcessFromenvLocked(FLAGS_tryfromenv, set_mode, false); - } - - return msg; -} - -void CommandLineFlagParser::ValidateFlags(bool all) { - FlagRegistryLock frl(registry_); - for (FlagRegistry::FlagConstIterator i = registry_->flags_.begin(); - i != registry_->flags_.end(); ++i) { - if ((all || !i->second->Modified()) && !i->second->ValidateCurrent()) { - // only set a message if one isn't already there. (If there's - // an error message, our job is done, even if it's not exactly - // the same error.) - if (error_flags_[i->second->name()].empty()) { - error_flags_[i->second->name()] = - string(kError) + "--" + i->second->name() + - " must be set on the commandline"; - if (!i->second->Modified()) { - error_flags_[i->second->name()] += " (default value fails validation)"; - } - error_flags_[i->second->name()] += "\n"; - } - } - } -} - -void CommandLineFlagParser::ValidateAllFlags() { - ValidateFlags(true); -} - -void CommandLineFlagParser::ValidateUnmodifiedFlags() { - ValidateFlags(false); -} - -bool CommandLineFlagParser::ReportErrors() { - // error_flags_ indicates errors we saw while parsing. - // But we ignore undefined-names if ok'ed by --undef_ok - if (!FLAGS_undefok.empty()) { - vector flaglist; - ParseFlagList(FLAGS_undefok.c_str(), &flaglist); - for (size_t i = 0; i < flaglist.size(); ++i) { - // We also deal with --no, in case the flagname was boolean - const string no_version = string("no") + flaglist[i]; - if (undefined_names_.find(flaglist[i]) != undefined_names_.end()) { - error_flags_[flaglist[i]] = ""; // clear the error message - } else if (undefined_names_.find(no_version) != undefined_names_.end()) { - error_flags_[no_version] = ""; - } - } - } - // Likewise, if they decided to allow reparsing, all undefined-names - // are ok; we just silently ignore them now, and hope that a future - // parse will pick them up somehow. - if (allow_command_line_reparsing) { - for (map::const_iterator it = undefined_names_.begin(); - it != undefined_names_.end(); ++it) - error_flags_[it->first] = ""; // clear the error message - } - - bool found_error = false; - string error_message; - for (map::const_iterator it = error_flags_.begin(); - it != error_flags_.end(); ++it) { - if (!it->second.empty()) { - error_message.append(it->second.data(), it->second.size()); - found_error = true; - } - } - if (found_error) - ReportError(DO_NOT_DIE, "%s", error_message.c_str()); - return found_error; -} - -string CommandLineFlagParser::ProcessOptionsFromStringLocked( - const string& contentdata, FlagSettingMode set_mode) { - string retval; - const char* flagfile_contents = contentdata.c_str(); - bool flags_are_relevant = true; // set to false when filenames don't match - bool in_filename_section = false; - - const char* line_end = flagfile_contents; - // We read this file a line at a time. - for (; line_end; flagfile_contents = line_end + 1) { - while (*flagfile_contents && isspace(*flagfile_contents)) - ++flagfile_contents; - // Windows uses "\r\n" - line_end = strchr(flagfile_contents, '\r'); - if (line_end == NULL) - line_end = strchr(flagfile_contents, '\n'); - - size_t len = line_end ? line_end - flagfile_contents - : strlen(flagfile_contents); - string line(flagfile_contents, len); - - // Each line can be one of four things: - // 1) A comment line -- we skip it - // 2) An empty line -- we skip it - // 3) A list of filenames -- starts a new filenames+flags section - // 4) A --flag=value line -- apply if previous filenames match - if (line.empty() || line[0] == '#') { - // comment or empty line; just ignore - - } else if (line[0] == '-') { // flag - in_filename_section = false; // instead, it was a flag-line - if (!flags_are_relevant) // skip this flag; applies to someone else - continue; - - const char* name_and_val = line.c_str() + 1; // skip the leading - - if (*name_and_val == '-') - name_and_val++; // skip second - too - string key; - const char* value; - string error_message; - CommandLineFlag* flag = registry_->SplitArgumentLocked(name_and_val, - &key, &value, - &error_message); - // By API, errors parsing flagfile lines are silently ignored. - if (flag == NULL) { - // "WARNING: flagname '" + key + "' not found\n" - } else if (value == NULL) { - // "WARNING: flagname '" + key + "' missing a value\n" - } else { - retval += ProcessSingleOptionLocked(flag, value, set_mode); - } - - } else { // a filename! - if (!in_filename_section) { // start over: assume filenames don't match - in_filename_section = true; - flags_are_relevant = false; - } - - // Split the line up at spaces into glob-patterns - const char* space = line.c_str(); // just has to be non-NULL - for (const char* word = line.c_str(); *space; word = space+1) { - if (flags_are_relevant) // we can stop as soon as we match - break; - space = strchr(word, ' '); - if (space == NULL) - space = word + strlen(word); - const string glob(word, space - word); - // We try matching both against the full argv0 and basename(argv0) - if (glob == ProgramInvocationName() // small optimization - || glob == ProgramInvocationShortName() -#if defined(HAVE_FNMATCH_H) - || fnmatch(glob.c_str(), ProgramInvocationName(), FNM_PATHNAME) == 0 - || fnmatch(glob.c_str(), ProgramInvocationShortName(), FNM_PATHNAME) == 0 -#elif defined(HAVE_SHLWAPI_H) - || PathMatchSpec(glob.c_str(), ProgramInvocationName()) - || PathMatchSpec(glob.c_str(), ProgramInvocationShortName()) -#endif - ) { - flags_are_relevant = true; - } - } - } - } - return retval; -} - -// -------------------------------------------------------------------- -// GetFromEnv() -// AddFlagValidator() -// These are helper functions for routines like BoolFromEnv() and -// RegisterFlagValidator, defined below. They're defined here so -// they can live in the unnamed namespace (which makes friendship -// declarations for these classes possible). -// -------------------------------------------------------------------- - -template -T GetFromEnv(const char *varname, T dflt) { - std::string valstr; - if (SafeGetEnv(varname, valstr)) { - FlagValue ifv(new T, true); - if (!ifv.ParseFrom(valstr.c_str())) { - ReportError(DIE, "ERROR: error parsing env variable '%s' with value '%s'\n", - varname, valstr.c_str()); - } - return OTHER_VALUE_AS(ifv, T); - } else return dflt; -} - -bool AddFlagValidator(const void* flag_ptr, ValidateFnProto validate_fn_proto) { - // We want a lock around this routine, in case two threads try to - // add a validator (hopefully the same one!) at once. We could use - // our own thread, but we need to loook at the registry anyway, so - // we just steal that one. - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - FlagRegistryLock frl(registry); - // First, find the flag whose current-flag storage is 'flag'. - // This is the CommandLineFlag whose current_->value_buffer_ == flag - CommandLineFlag* flag = registry->FindFlagViaPtrLocked(flag_ptr); - if (!flag) { - LOG(WARNING) << "Ignoring RegisterValidateFunction() for flag pointer " - << flag_ptr << ": no flag found at that address"; - return false; - } else if (validate_fn_proto == flag->validate_function()) { - return true; // ok to register the same function over and over again - } else if (validate_fn_proto != NULL && flag->validate_function() != NULL) { - LOG(WARNING) << "Ignoring RegisterValidateFunction() for flag '" - << flag->name() << "': validate-fn already registered"; - return false; - } else { - flag->validate_fn_proto_ = validate_fn_proto; - return true; - } -} - -} // end unnamed namespaces - - -// Now define the functions that are exported via the .h file - -// -------------------------------------------------------------------- -// FlagRegisterer -// This class exists merely to have a global constructor (the -// kind that runs before main(), that goes an initializes each -// flag that's been declared. Note that it's very important we -// don't have a destructor that deletes flag_, because that would -// cause us to delete current_storage/defvalue_storage as well, -// which can cause a crash if anything tries to access the flag -// values in a global destructor. -// -------------------------------------------------------------------- - -namespace { -void RegisterCommandLineFlag(const char* name, - const char* help, - const char* filename, - FlagValue* current, - FlagValue* defvalue) { - if (help == NULL) - help = ""; - // Importantly, flag_ will never be deleted, so storage is always good. - CommandLineFlag* flag = - new CommandLineFlag(name, help, filename, current, defvalue); - FlagRegistry::GlobalRegistry()->RegisterFlag(flag); // default registry -} -} - -template -FlagRegisterer::FlagRegisterer(const char* name, - const char* help, - const char* filename, - FlagType* current_storage, - FlagType* defvalue_storage) { - FlagValue* const current = new FlagValue(current_storage, false); - FlagValue* const defvalue = new FlagValue(defvalue_storage, false); - RegisterCommandLineFlag(name, help, filename, current, defvalue); -} - -// Force compiler to generate code for the given template specialization. -#define INSTANTIATE_FLAG_REGISTERER_CTOR(type) \ - template GFLAGS_DLL_DECL FlagRegisterer::FlagRegisterer( \ - const char* name, const char* help, const char* filename, \ - type* current_storage, type* defvalue_storage) - -// Do this for all supported flag types. -INSTANTIATE_FLAG_REGISTERER_CTOR(bool); -INSTANTIATE_FLAG_REGISTERER_CTOR(int32); -INSTANTIATE_FLAG_REGISTERER_CTOR(uint32); -INSTANTIATE_FLAG_REGISTERER_CTOR(int64); -INSTANTIATE_FLAG_REGISTERER_CTOR(uint64); -INSTANTIATE_FLAG_REGISTERER_CTOR(double); -INSTANTIATE_FLAG_REGISTERER_CTOR(std::string); - -#undef INSTANTIATE_FLAG_REGISTERER_CTOR - -// -------------------------------------------------------------------- -// GetAllFlags() -// The main way the FlagRegistry class exposes its data. This -// returns, as strings, all the info about all the flags in -// the main registry, sorted first by filename they are defined -// in, and then by flagname. -// -------------------------------------------------------------------- - -struct FilenameFlagnameCmp { - bool operator()(const CommandLineFlagInfo& a, - const CommandLineFlagInfo& b) const { - int cmp = strcmp(a.filename.c_str(), b.filename.c_str()); - if (cmp == 0) - cmp = strcmp(a.name.c_str(), b.name.c_str()); // secondary sort key - return cmp < 0; - } -}; - -void GetAllFlags(vector* OUTPUT) { - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - registry->Lock(); - for (FlagRegistry::FlagConstIterator i = registry->flags_.begin(); - i != registry->flags_.end(); ++i) { - CommandLineFlagInfo fi; - i->second->FillCommandLineFlagInfo(&fi); - OUTPUT->push_back(fi); - } - registry->Unlock(); - // Now sort the flags, first by filename they occur in, then alphabetically - sort(OUTPUT->begin(), OUTPUT->end(), FilenameFlagnameCmp()); -} - -// -------------------------------------------------------------------- -// SetArgv() -// GetArgvs() -// GetArgv() -// GetArgv0() -// ProgramInvocationName() -// ProgramInvocationShortName() -// SetUsageMessage() -// ProgramUsage() -// Functions to set and get argv. Typically the setter is called -// by ParseCommandLineFlags. Also can get the ProgramUsage string, -// set by SetUsageMessage. -// -------------------------------------------------------------------- - -// These values are not protected by a Mutex because they are normally -// set only once during program startup. -static string argv0("UNKNOWN"); // just the program name -static string cmdline; // the entire command-line -static string program_usage; -static vector argvs; -static uint32 argv_sum = 0; - -void SetArgv(int argc, const char** argv) { - static bool called_set_argv = false; - if (called_set_argv) return; - called_set_argv = true; - - assert(argc > 0); // every program has at least a name - argv0 = argv[0]; - - cmdline.clear(); - for (int i = 0; i < argc; i++) { - if (i != 0) cmdline += " "; - cmdline += argv[i]; - argvs.push_back(argv[i]); - } - - // Compute a simple sum of all the chars in argv - argv_sum = 0; - for (string::const_iterator c = cmdline.begin(); c != cmdline.end(); ++c) { - argv_sum += *c; - } -} - -const vector& GetArgvs() { return argvs; } -const char* GetArgv() { return cmdline.c_str(); } -const char* GetArgv0() { return argv0.c_str(); } -uint32 GetArgvSum() { return argv_sum; } -const char* ProgramInvocationName() { // like the GNU libc fn - return GetArgv0(); -} -const char* ProgramInvocationShortName() { // like the GNU libc fn - size_t pos = argv0.rfind('/'); -#ifdef OS_WINDOWS - if (pos == string::npos) pos = argv0.rfind('\\'); -#endif - return (pos == string::npos ? argv0.c_str() : (argv0.c_str() + pos + 1)); -} - -void SetUsageMessage(const string& usage) { - program_usage = usage; -} - -const char* ProgramUsage() { - if (program_usage.empty()) { - return "Warning: SetUsageMessage() never called"; - } - return program_usage.c_str(); -} - -// -------------------------------------------------------------------- -// SetVersionString() -// VersionString() -// -------------------------------------------------------------------- - -static string version_string; - -void SetVersionString(const string& version) { - version_string = version; -} - -const char* VersionString() { - return version_string.c_str(); -} - - -// -------------------------------------------------------------------- -// GetCommandLineOption() -// GetCommandLineFlagInfo() -// GetCommandLineFlagInfoOrDie() -// SetCommandLineOption() -// SetCommandLineOptionWithMode() -// The programmatic way to set a flag's value, using a string -// for its name rather than the variable itself (that is, -// SetCommandLineOption("foo", x) rather than FLAGS_foo = x). -// There's also a bit more flexibility here due to the various -// set-modes, but typically these are used when you only have -// that flag's name as a string, perhaps at runtime. -// All of these work on the default, global registry. -// For GetCommandLineOption, return false if no such flag -// is known, true otherwise. We clear "value" if a suitable -// flag is found. -// -------------------------------------------------------------------- - - -bool GetCommandLineOption(const char* name, string* value) { - if (NULL == name) - return false; - assert(value); - - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - FlagRegistryLock frl(registry); - CommandLineFlag* flag = registry->FindFlagLocked(name); - if (flag == NULL) { - return false; - } else { - *value = flag->current_value(); - return true; - } -} - -bool GetCommandLineFlagInfo(const char* name, CommandLineFlagInfo* OUTPUT) { - if (NULL == name) return false; - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - FlagRegistryLock frl(registry); - CommandLineFlag* flag = registry->FindFlagLocked(name); - if (flag == NULL) { - return false; - } else { - assert(OUTPUT); - flag->FillCommandLineFlagInfo(OUTPUT); - return true; - } -} - -CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name) { - CommandLineFlagInfo info; - if (!GetCommandLineFlagInfo(name, &info)) { - fprintf(stderr, "FATAL ERROR: flag name '%s' doesn't exist\n", name); - gflags_exitfunc(1); // almost certainly gflags_exitfunc() - } - return info; -} - -string SetCommandLineOptionWithMode(const char* name, const char* value, - FlagSettingMode set_mode) { - string result; - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - FlagRegistryLock frl(registry); - CommandLineFlag* flag = registry->FindFlagLocked(name); - if (flag) { - CommandLineFlagParser parser(registry); - result = parser.ProcessSingleOptionLocked(flag, value, set_mode); - if (!result.empty()) { // in the error case, we've already logged - // Could consider logging this change - } - } - // The API of this function is that we return empty string on error - return result; -} - -string SetCommandLineOption(const char* name, const char* value) { - return SetCommandLineOptionWithMode(name, value, SET_FLAGS_VALUE); -} - -// -------------------------------------------------------------------- -// FlagSaver -// FlagSaverImpl -// This class stores the states of all flags at construct time, -// and restores all flags to that state at destruct time. -// Its major implementation challenge is that it never modifies -// pointers in the 'main' registry, so global FLAG_* vars always -// point to the right place. -// -------------------------------------------------------------------- - -class FlagSaverImpl { - public: - // Constructs an empty FlagSaverImpl object. - explicit FlagSaverImpl(FlagRegistry* main_registry) - : main_registry_(main_registry) { } - ~FlagSaverImpl() { - // reclaim memory from each of our CommandLineFlags - vector::const_iterator it; - for (it = backup_registry_.begin(); it != backup_registry_.end(); ++it) - delete *it; - } - - // Saves the flag states from the flag registry into this object. - // It's an error to call this more than once. - // Must be called when the registry mutex is not held. - void SaveFromRegistry() { - FlagRegistryLock frl(main_registry_); - assert(backup_registry_.empty()); // call only once! - for (FlagRegistry::FlagConstIterator it = main_registry_->flags_.begin(); - it != main_registry_->flags_.end(); - ++it) { - const CommandLineFlag* main = it->second; - // Sets up all the const variables in backup correctly - CommandLineFlag* backup = new CommandLineFlag( - main->name(), main->help(), main->filename(), - main->current_->New(), main->defvalue_->New()); - // Sets up all the non-const variables in backup correctly - backup->CopyFrom(*main); - backup_registry_.push_back(backup); // add it to a convenient list - } - } - - // Restores the saved flag states into the flag registry. We - // assume no flags were added or deleted from the registry since - // the SaveFromRegistry; if they were, that's trouble! Must be - // called when the registry mutex is not held. - void RestoreToRegistry() { - FlagRegistryLock frl(main_registry_); - vector::const_iterator it; - for (it = backup_registry_.begin(); it != backup_registry_.end(); ++it) { - CommandLineFlag* main = main_registry_->FindFlagLocked((*it)->name()); - if (main != NULL) { // if NULL, flag got deleted from registry(!) - main->CopyFrom(**it); - } - } - } - - private: - FlagRegistry* const main_registry_; - vector backup_registry_; - - FlagSaverImpl(const FlagSaverImpl&); // no copying! - void operator=(const FlagSaverImpl&); -}; - -FlagSaver::FlagSaver() - : impl_(new FlagSaverImpl(FlagRegistry::GlobalRegistry())) { - impl_->SaveFromRegistry(); -} - -FlagSaver::~FlagSaver() { - impl_->RestoreToRegistry(); - delete impl_; -} - - -// -------------------------------------------------------------------- -// CommandlineFlagsIntoString() -// ReadFlagsFromString() -// AppendFlagsIntoFile() -// ReadFromFlagsFile() -// These are mostly-deprecated routines that stick the -// commandline flags into a file/string and read them back -// out again. I can see a use for CommandlineFlagsIntoString, -// for creating a flagfile, but the rest don't seem that useful -// -- some, I think, are a poor-man's attempt at FlagSaver -- -// and are included only until we can delete them from callers. -// Note they don't save --flagfile flags (though they do save -// the result of having called the flagfile, of course). -// -------------------------------------------------------------------- - -static string TheseCommandlineFlagsIntoString( - const vector& flags) { - vector::const_iterator i; - - size_t retval_space = 0; - for (i = flags.begin(); i != flags.end(); ++i) { - // An (over)estimate of how much space it will take to print this flag - retval_space += i->name.length() + i->current_value.length() + 5; - } - - string retval; - retval.reserve(retval_space); - for (i = flags.begin(); i != flags.end(); ++i) { - retval += "--"; - retval += i->name; - retval += "="; - retval += i->current_value; - retval += "\n"; - } - return retval; -} - -string CommandlineFlagsIntoString() { - vector sorted_flags; - GetAllFlags(&sorted_flags); - return TheseCommandlineFlagsIntoString(sorted_flags); -} - -bool ReadFlagsFromString(const string& flagfilecontents, - const char* /*prog_name*/, // TODO(csilvers): nix this - bool errors_are_fatal) { - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - FlagSaverImpl saved_states(registry); - saved_states.SaveFromRegistry(); - - CommandLineFlagParser parser(registry); - registry->Lock(); - parser.ProcessOptionsFromStringLocked(flagfilecontents, SET_FLAGS_VALUE); - registry->Unlock(); - // Should we handle --help and such when reading flags from a string? Sure. - HandleCommandLineHelpFlags(); - if (parser.ReportErrors()) { - // Error. Restore all global flags to their previous values. - if (errors_are_fatal) - gflags_exitfunc(1); - saved_states.RestoreToRegistry(); - return false; - } - return true; -} - -// TODO(csilvers): nix prog_name in favor of ProgramInvocationShortName() -bool AppendFlagsIntoFile(const string& filename, const char *prog_name) { - FILE *fp; - if (SafeFOpen(&fp, filename.c_str(), "a") != 0) { - return false; - } - - if (prog_name) - fprintf(fp, "%s\n", prog_name); - - vector flags; - GetAllFlags(&flags); - // But we don't want --flagfile, which leads to weird recursion issues - vector::iterator i; - for (i = flags.begin(); i != flags.end(); ++i) { - if (strcmp(i->name.c_str(), "flagfile") == 0) { - flags.erase(i); - break; - } - } - fprintf(fp, "%s", TheseCommandlineFlagsIntoString(flags).c_str()); - - fclose(fp); - return true; -} - -bool ReadFromFlagsFile(const string& filename, const char* prog_name, - bool errors_are_fatal) { - return ReadFlagsFromString(ReadFileIntoString(filename.c_str()), - prog_name, errors_are_fatal); -} - - -// -------------------------------------------------------------------- -// BoolFromEnv() -// Int32FromEnv() -// Uint32FromEnv() -// Int64FromEnv() -// Uint64FromEnv() -// DoubleFromEnv() -// StringFromEnv() -// Reads the value from the environment and returns it. -// We use an FlagValue to make the parsing easy. -// Example usage: -// DEFINE_bool(myflag, BoolFromEnv("MYFLAG_DEFAULT", false), "whatever"); -// -------------------------------------------------------------------- - -bool BoolFromEnv(const char *v, bool dflt) { - return GetFromEnv(v, dflt); -} -int32 Int32FromEnv(const char *v, int32 dflt) { - return GetFromEnv(v, dflt); -} -uint32 Uint32FromEnv(const char *v, uint32 dflt) { - return GetFromEnv(v, dflt); -} -int64 Int64FromEnv(const char *v, int64 dflt) { - return GetFromEnv(v, dflt); -} -uint64 Uint64FromEnv(const char *v, uint64 dflt) { - return GetFromEnv(v, dflt); -} -double DoubleFromEnv(const char *v, double dflt) { - return GetFromEnv(v, dflt); -} - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4996) // ignore getenv security warning -#endif -const char *StringFromEnv(const char *varname, const char *dflt) { - const char* const val = getenv(varname); - return val ? val : dflt; -} -#ifdef _MSC_VER -# pragma warning(pop) -#endif - - -// -------------------------------------------------------------------- -// RegisterFlagValidator() -// RegisterFlagValidator() is the function that clients use to -// 'decorate' a flag with a validation function. Once this is -// done, every time the flag is set (including when the flag -// is parsed from argv), the validator-function is called. -// These functions return true if the validator was added -// successfully, or false if not: the flag already has a validator, -// (only one allowed per flag), the 1st arg isn't a flag, etc. -// This function is not thread-safe. -// -------------------------------------------------------------------- - -bool RegisterFlagValidator(const bool* flag, - bool (*validate_fn)(const char*, bool)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const int32* flag, - bool (*validate_fn)(const char*, int32)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const uint32* flag, - bool (*validate_fn)(const char*, uint32)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const int64* flag, - bool (*validate_fn)(const char*, int64)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const uint64* flag, - bool (*validate_fn)(const char*, uint64)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const double* flag, - bool (*validate_fn)(const char*, double)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const string* flag, - bool (*validate_fn)(const char*, const string&)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} - - -// -------------------------------------------------------------------- -// ParseCommandLineFlags() -// ParseCommandLineNonHelpFlags() -// HandleCommandLineHelpFlags() -// This is the main function called from main(), to actually -// parse the commandline. It modifies argc and argv as described -// at the top of gflags.h. You can also divide this -// function into two parts, if you want to do work between -// the parsing of the flags and the printing of any help output. -// -------------------------------------------------------------------- - -static uint32 ParseCommandLineFlagsInternal(int* argc, char*** argv, - bool remove_flags, bool do_report) { - SetArgv(*argc, const_cast(*argv)); // save it for later - - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - CommandLineFlagParser parser(registry); - - // When we parse the commandline flags, we'll handle --flagfile, - // --tryfromenv, etc. as we see them (since flag-evaluation order - // may be important). But sometimes apps set FLAGS_tryfromenv/etc. - // manually before calling ParseCommandLineFlags. We want to evaluate - // those too, as if they were the first flags on the commandline. - registry->Lock(); - parser.ProcessFlagfileLocked(FLAGS_flagfile, SET_FLAGS_VALUE); - // Last arg here indicates whether flag-not-found is a fatal error or not - parser.ProcessFromenvLocked(FLAGS_fromenv, SET_FLAGS_VALUE, true); - parser.ProcessFromenvLocked(FLAGS_tryfromenv, SET_FLAGS_VALUE, false); - registry->Unlock(); - - // Now get the flags specified on the commandline - const int r = parser.ParseNewCommandLineFlags(argc, argv, remove_flags); - - if (do_report) - HandleCommandLineHelpFlags(); // may cause us to exit on --help, etc. - - // See if any of the unset flags fail their validation checks - parser.ValidateUnmodifiedFlags(); - - if (parser.ReportErrors()) // may cause us to exit on illegal flags - gflags_exitfunc(1); - return r; -} - -uint32 ParseCommandLineFlags(int* argc, char*** argv, bool remove_flags) { - return ParseCommandLineFlagsInternal(argc, argv, remove_flags, true); -} - -uint32 ParseCommandLineNonHelpFlags(int* argc, char*** argv, - bool remove_flags) { - return ParseCommandLineFlagsInternal(argc, argv, remove_flags, false); -} - -// -------------------------------------------------------------------- -// AllowCommandLineReparsing() -// ReparseCommandLineNonHelpFlags() -// This is most useful for shared libraries. The idea is if -// a flag is defined in a shared library that is dlopen'ed -// sometime after main(), you can ParseCommandLineFlags before -// the dlopen, then ReparseCommandLineNonHelpFlags() after the -// dlopen, to get the new flags. But you have to explicitly -// Allow() it; otherwise, you get the normal default behavior -// of unrecognized flags calling a fatal error. -// TODO(csilvers): this isn't used. Just delete it? -// -------------------------------------------------------------------- - -void AllowCommandLineReparsing() { - allow_command_line_reparsing = true; -} - -void ReparseCommandLineNonHelpFlags() { - // We make a copy of argc and argv to pass in - const vector& argvs = GetArgvs(); - int tmp_argc = static_cast(argvs.size()); - char** tmp_argv = new char* [tmp_argc + 1]; - for (int i = 0; i < tmp_argc; ++i) - tmp_argv[i] = strdup(argvs[i].c_str()); // TODO(csilvers): don't dup - - ParseCommandLineNonHelpFlags(&tmp_argc, &tmp_argv, false); - - for (int i = 0; i < tmp_argc; ++i) - free(tmp_argv[i]); - delete[] tmp_argv; -} - -void ShutDownCommandLineFlags() { - FlagRegistry::DeleteGlobalRegistry(); -} - - -} // namespace GFLAGS_NAMESPACE diff --git a/inference-engine/samples/thirdparty/gflags/src/gflags.h.in b/inference-engine/samples/thirdparty/gflags/src/gflags.h.in deleted file mode 100644 index 82e640fb0d8..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/gflags.h.in +++ /dev/null @@ -1,605 +0,0 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// Revamped and reorganized by Craig Silverstein -// -// This is the file that should be included by any file which declares -// or defines a command line flag or wants to parse command line flags -// or print a program usage message (which will include information about -// flags). Executive summary, in the form of an example foo.cc file: -// -// #include "foo.h" // foo.h has a line "DECLARE_int32(start);" -// #include "validators.h" // hypothetical file defining ValidateIsFile() -// -// DEFINE_int32(end, 1000, "The last record to read"); -// -// DEFINE_string(filename, "my_file.txt", "The file to read"); -// // Crash if the specified file does not exist. -// static bool dummy = RegisterFlagValidator(&FLAGS_filename, -// &ValidateIsFile); -// -// DECLARE_bool(verbose); // some other file has a DEFINE_bool(verbose, ...) -// -// void MyFunc() { -// if (FLAGS_verbose) printf("Records %d-%d\n", FLAGS_start, FLAGS_end); -// } -// -// Then, at the command-line: -// ./foo --noverbose --start=5 --end=100 -// -// For more details, see -// doc/gflags.html -// -// --- A note about thread-safety: -// -// We describe many functions in this routine as being thread-hostile, -// thread-compatible, or thread-safe. Here are the meanings we use: -// -// thread-safe: it is safe for multiple threads to call this routine -// (or, when referring to a class, methods of this class) -// concurrently. -// thread-hostile: it is not safe for multiple threads to call this -// routine (or methods of this class) concurrently. In gflags, -// most thread-hostile routines are intended to be called early in, -// or even before, main() -- that is, before threads are spawned. -// thread-compatible: it is safe for multiple threads to read from -// this variable (when applied to variables), or to call const -// methods of this class (when applied to classes), as long as no -// other thread is writing to the variable or calling non-const -// methods of this class. - -#ifndef GFLAGS_GFLAGS_H_ -#define GFLAGS_GFLAGS_H_ - -#include -#include - -#include "gflags/gflags_declare.h" // IWYU pragma: export - - -// We always want to export variables defined in user code -#ifndef GFLAGS_DLL_DEFINE_FLAG -# if GFLAGS_IS_A_DLL && defined(_MSC_VER) -# define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport) -# else -# define GFLAGS_DLL_DEFINE_FLAG -# endif -#endif - - -namespace GFLAGS_NAMESPACE { - - -// -------------------------------------------------------------------- -// To actually define a flag in a file, use DEFINE_bool, -// DEFINE_string, etc. at the bottom of this file. You may also find -// it useful to register a validator with the flag. This ensures that -// when the flag is parsed from the commandline, or is later set via -// SetCommandLineOption, we call the validation function. It is _not_ -// called when you assign the value to the flag directly using the = operator. -// -// The validation function should return true if the flag value is valid, and -// false otherwise. If the function returns false for the new setting of the -// flag, the flag will retain its current value. If it returns false for the -// default value, ParseCommandLineFlags() will die. -// -// This function is safe to call at global construct time (as in the -// example below). -// -// Example use: -// static bool ValidatePort(const char* flagname, int32 value) { -// if (value > 0 && value < 32768) // value is ok -// return true; -// printf("Invalid value for --%s: %d\n", flagname, (int)value); -// return false; -// } -// DEFINE_int32(port, 0, "What port to listen on"); -// static bool dummy = RegisterFlagValidator(&FLAGS_port, &ValidatePort); - -// Returns true if successfully registered, false if not (because the -// first argument doesn't point to a command-line flag, or because a -// validator is already registered for this flag). -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const bool* flag, bool (*validate_fn)(const char*, bool)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int32* flag, bool (*validate_fn)(const char*, int32)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const uint32* flag, bool (*validate_fn)(const char*, uint32)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int64* flag, bool (*validate_fn)(const char*, int64)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const uint64* flag, bool (*validate_fn)(const char*, uint64)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const double* flag, bool (*validate_fn)(const char*, double)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag, bool (*validate_fn)(const char*, const std::string&)); - -// Convenience macro for the registration of a flag validator -#define DEFINE_validator(name, validator) \ - static const bool name##_validator_registered = \ - GFLAGS_NAMESPACE::RegisterFlagValidator(&FLAGS_##name, validator) - - -// -------------------------------------------------------------------- -// These methods are the best way to get access to info about the -// list of commandline flags. Note that these routines are pretty slow. -// GetAllFlags: mostly-complete info about the list, sorted by file. -// ShowUsageWithFlags: pretty-prints the list to stdout (what --help does) -// ShowUsageWithFlagsRestrict: limit to filenames with restrict as a substr -// -// In addition to accessing flags, you can also access argv[0] (the program -// name) and argv (the entire commandline), which we sock away a copy of. -// These variables are static, so you should only set them once. -// -// No need to export this data only structure from DLL, avoiding VS warning 4251. -struct CommandLineFlagInfo { - std::string name; // the name of the flag - std::string type; // the type of the flag: int32, etc - std::string description; // the "help text" associated with the flag - std::string current_value; // the current value, as a string - std::string default_value; // the default value, as a string - std::string filename; // 'cleaned' version of filename holding the flag - bool has_validator_fn; // true if RegisterFlagValidator called on this flag - bool is_default; // true if the flag has the default value and - // has not been set explicitly from the cmdline - // or via SetCommandLineOption - const void* flag_ptr; // pointer to the flag's current value (i.e. FLAGS_foo) -}; - -// Using this inside of a validator is a recipe for a deadlock. -// TODO(user) Fix locking when validators are running, to make it safe to -// call validators during ParseAllFlags. -// Also make sure then to uncomment the corresponding unit test in -// gflags_unittest.sh -extern GFLAGS_DLL_DECL void GetAllFlags(std::vector* OUTPUT); -// These two are actually defined in gflags_reporting.cc. -extern GFLAGS_DLL_DECL void ShowUsageWithFlags(const char *argv0); // what --help does -extern GFLAGS_DLL_DECL void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict); - -// Create a descriptive string for a flag. -// Goes to some trouble to make pretty line breaks. -extern GFLAGS_DLL_DECL std::string DescribeOneFlag(const CommandLineFlagInfo& flag); - -// Thread-hostile; meant to be called before any threads are spawned. -extern GFLAGS_DLL_DECL void SetArgv(int argc, const char** argv); - -// The following functions are thread-safe as long as SetArgv() is -// only called before any threads start. -extern GFLAGS_DLL_DECL const std::vector& GetArgvs(); -extern GFLAGS_DLL_DECL const char* GetArgv(); // all of argv as a string -extern GFLAGS_DLL_DECL const char* GetArgv0(); // only argv0 -extern GFLAGS_DLL_DECL uint32 GetArgvSum(); // simple checksum of argv -extern GFLAGS_DLL_DECL const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set -extern GFLAGS_DLL_DECL const char* ProgramInvocationShortName(); // basename(argv0) - -// ProgramUsage() is thread-safe as long as SetUsageMessage() is only -// called before any threads start. -extern GFLAGS_DLL_DECL const char* ProgramUsage(); // string set by SetUsageMessage() - -// VersionString() is thread-safe as long as SetVersionString() is only -// called before any threads start. -extern GFLAGS_DLL_DECL const char* VersionString(); // string set by SetVersionString() - - - -// -------------------------------------------------------------------- -// Normally you access commandline flags by just saying "if (FLAGS_foo)" -// or whatever, and set them by calling "FLAGS_foo = bar" (or, more -// commonly, via the DEFINE_foo macro). But if you need a bit more -// control, we have programmatic ways to get/set the flags as well. -// These programmatic ways to access flags are thread-safe, but direct -// access is only thread-compatible. - -// Return true iff the flagname was found. -// OUTPUT is set to the flag's value, or unchanged if we return false. -extern GFLAGS_DLL_DECL bool GetCommandLineOption(const char* name, std::string* OUTPUT); - -// Return true iff the flagname was found. OUTPUT is set to the flag's -// CommandLineFlagInfo or unchanged if we return false. -extern GFLAGS_DLL_DECL bool GetCommandLineFlagInfo(const char* name, CommandLineFlagInfo* OUTPUT); - -// Return the CommandLineFlagInfo of the flagname. exit() if name not found. -// Example usage, to check if a flag's value is currently the default value: -// if (GetCommandLineFlagInfoOrDie("foo").is_default) ... -extern GFLAGS_DLL_DECL CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name); - -enum GFLAGS_DLL_DECL FlagSettingMode { - // update the flag's value (can call this multiple times). - SET_FLAGS_VALUE, - // update the flag's value, but *only if* it has not yet been updated - // with SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef". - SET_FLAG_IF_DEFAULT, - // set the flag's default value to this. If the flag has not yet updated - // yet (via SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef") - // change the flag's current value to the new default value as well. - SET_FLAGS_DEFAULT -}; - -// Set a particular flag ("command line option"). Returns a string -// describing the new value that the option has been set to. The -// return value API is not well-specified, so basically just depend on -// it to be empty if the setting failed for some reason -- the name is -// not a valid flag name, or the value is not a valid value -- and -// non-empty else. - -// SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case) -extern GFLAGS_DLL_DECL std::string SetCommandLineOption (const char* name, const char* value); -extern GFLAGS_DLL_DECL std::string SetCommandLineOptionWithMode(const char* name, const char* value, FlagSettingMode set_mode); - - -// -------------------------------------------------------------------- -// Saves the states (value, default value, whether the user has set -// the flag, registered validators, etc) of all flags, and restores -// them when the FlagSaver is destroyed. This is very useful in -// tests, say, when you want to let your tests change the flags, but -// make sure that they get reverted to the original states when your -// test is complete. -// -// Example usage: -// void TestFoo() { -// FlagSaver s1; -// FLAG_foo = false; -// FLAG_bar = "some value"; -// -// // test happens here. You can return at any time -// // without worrying about restoring the FLAG values. -// } -// -// Note: This class is marked with GFLAGS_ATTRIBUTE_UNUSED because all -// the work is done in the constructor and destructor, so in the standard -// usage example above, the compiler would complain that it's an -// unused variable. -// -// This class is thread-safe. However, its destructor writes to -// exactly the set of flags that have changed value during its -// lifetime, so concurrent _direct_ access to those flags -// (i.e. FLAGS_foo instead of {Get,Set}CommandLineOption()) is unsafe. - -class GFLAGS_DLL_DECL FlagSaver { - public: - FlagSaver(); - ~FlagSaver(); - - private: - class FlagSaverImpl* impl_; // we use pimpl here to keep API steady - - FlagSaver(const FlagSaver&); // no copying! - void operator=(const FlagSaver&); -}@GFLAGS_ATTRIBUTE_UNUSED@; - -// -------------------------------------------------------------------- -// Some deprecated or hopefully-soon-to-be-deprecated functions. - -// This is often used for logging. TODO(csilvers): figure out a better way -extern GFLAGS_DLL_DECL std::string CommandlineFlagsIntoString(); -// Usually where this is used, a FlagSaver should be used instead. -extern GFLAGS_DLL_DECL -bool ReadFlagsFromString(const std::string& flagfilecontents, - const char* prog_name, - bool errors_are_fatal); // uses SET_FLAGS_VALUE - -// These let you manually implement --flagfile functionality. -// DEPRECATED. -extern GFLAGS_DLL_DECL bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name); -extern GFLAGS_DLL_DECL bool ReadFromFlagsFile(const std::string& filename, const char* prog_name, bool errors_are_fatal); // uses SET_FLAGS_VALUE - - -// -------------------------------------------------------------------- -// Useful routines for initializing flags from the environment. -// In each case, if 'varname' does not exist in the environment -// return defval. If 'varname' does exist but is not valid -// (e.g., not a number for an int32 flag), abort with an error. -// Otherwise, return the value. NOTE: for booleans, for true use -// 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'. - -extern GFLAGS_DLL_DECL bool BoolFromEnv(const char *varname, bool defval); -extern GFLAGS_DLL_DECL int32 Int32FromEnv(const char *varname, int32 defval); -extern GFLAGS_DLL_DECL uint32 Uint32FromEnv(const char *varname, uint32 defval); -extern GFLAGS_DLL_DECL int64 Int64FromEnv(const char *varname, int64 defval); -extern GFLAGS_DLL_DECL uint64 Uint64FromEnv(const char *varname, uint64 defval); -extern GFLAGS_DLL_DECL double DoubleFromEnv(const char *varname, double defval); -extern GFLAGS_DLL_DECL const char *StringFromEnv(const char *varname, const char *defval); - - -// -------------------------------------------------------------------- -// The next two functions parse gflags from main(): - -// Set the "usage" message for this program. For example: -// string usage("This program does nothing. Sample usage:\n"); -// usage += argv[0] + " "; -// SetUsageMessage(usage); -// Do not include commandline flags in the usage: we do that for you! -// Thread-hostile; meant to be called before any threads are spawned. -extern GFLAGS_DLL_DECL void SetUsageMessage(const std::string& usage); - -// Sets the version string, which is emitted with --version. -// For instance: SetVersionString("1.3"); -// Thread-hostile; meant to be called before any threads are spawned. -extern GFLAGS_DLL_DECL void SetVersionString(const std::string& version); - - -// Looks for flags in argv and parses them. Rearranges argv to put -// flags first, or removes them entirely if remove_flags is true. -// If a flag is defined more than once in the command line or flag -// file, the last definition is used. Returns the index (into argv) -// of the first non-flag argument. -// See top-of-file for more details on this function. -#ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead. -extern GFLAGS_DLL_DECL uint32 ParseCommandLineFlags(int *argc, char*** argv, bool remove_flags); -#endif - - -// Calls to ParseCommandLineNonHelpFlags and then to -// HandleCommandLineHelpFlags can be used instead of a call to -// ParseCommandLineFlags during initialization, in order to allow for -// changing default values for some FLAGS (via -// e.g. SetCommandLineOptionWithMode calls) between the time of -// command line parsing and the time of dumping help information for -// the flags as a result of command line parsing. If a flag is -// defined more than once in the command line or flag file, the last -// definition is used. Returns the index (into argv) of the first -// non-flag argument. (If remove_flags is true, will always return 1.) -extern GFLAGS_DLL_DECL uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv, bool remove_flags); - -// This is actually defined in gflags_reporting.cc. -// This function is misnamed (it also handles --version, etc.), but -// it's too late to change that now. :-( -extern GFLAGS_DLL_DECL void HandleCommandLineHelpFlags(); // in gflags_reporting.cc - -// Allow command line reparsing. Disables the error normally -// generated when an unknown flag is found, since it may be found in a -// later parse. Thread-hostile; meant to be called before any threads -// are spawned. -extern GFLAGS_DLL_DECL void AllowCommandLineReparsing(); - -// Reparse the flags that have not yet been recognized. Only flags -// registered since the last parse will be recognized. Any flag value -// must be provided as part of the argument using "=", not as a -// separate command line argument that follows the flag argument. -// Intended for handling flags from dynamically loaded libraries, -// since their flags are not registered until they are loaded. -extern GFLAGS_DLL_DECL void ReparseCommandLineNonHelpFlags(); - -// Clean up memory allocated by flags. This is only needed to reduce -// the quantity of "potentially leaked" reports emitted by memory -// debugging tools such as valgrind. It is not required for normal -// operation, or for the google perftools heap-checker. It must only -// be called when the process is about to exit, and all threads that -// might access flags are quiescent. Referencing flags after this is -// called will have unexpected consequences. This is not safe to run -// when multiple threads might be running: the function is -// thread-hostile. -extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags(); - - -// -------------------------------------------------------------------- -// Now come the command line flag declaration/definition macros that -// will actually be used. They're kind of hairy. A major reason -// for this is initialization: we want people to be able to access -// variables in global constructors and have that not crash, even if -// their global constructor runs before the global constructor here. -// (Obviously, we can't guarantee the flags will have the correct -// default value in that case, but at least accessing them is safe.) -// The only way to do that is have flags point to a static buffer. -// So we make one, using a union to ensure proper alignment, and -// then use placement-new to actually set up the flag with the -// correct default value. In the same vein, we have to worry about -// flag access in global destructors, so FlagRegisterer has to be -// careful never to destroy the flag-values it constructs. -// -// Note that when we define a flag variable FLAGS_, we also -// preemptively define a junk variable, FLAGS_no. This is to -// cause a link-time error if someone tries to define 2 flags with -// names like "logging" and "nologging". We do this because a bool -// flag FLAG can be set from the command line to true with a "-FLAG" -// argument, and to false with a "-noFLAG" argument, and so this can -// potentially avert confusion. -// -// We also put flags into their own namespace. It is purposefully -// named in an opaque way that people should have trouble typing -// directly. The idea is that DEFINE puts the flag in the weird -// namespace, and DECLARE imports the flag from there into the current -// namespace. The net result is to force people to use DECLARE to get -// access to a flag, rather than saying "extern GFLAGS_DLL_DECL bool FLAGS_whatever;" -// or some such instead. We want this so we can put extra -// functionality (like sanity-checking) in DECLARE if we want, and -// make sure it is picked up everywhere. -// -// We also put the type of the variable in the namespace, so that -// people can't DECLARE_int32 something that they DEFINE_bool'd -// elsewhere. - -class GFLAGS_DLL_DECL FlagRegisterer { - public: - // We instantiate this template ctor for all supported types, - // so it is possible to place implementation of the FlagRegisterer ctor in - // .cc file. - // Calling this constructor with unsupported type will produce linker error. - template - FlagRegisterer(const char* name, - const char* help, const char* filename, - FlagType* current_storage, FlagType* defvalue_storage); -}; - -// If your application #defines STRIP_FLAG_HELP to a non-zero value -// before #including this file, we remove the help message from the -// binary file. This can reduce the size of the resulting binary -// somewhat, and may also be useful for security reasons. - -extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[]; - - -} // namespace GFLAGS_NAMESPACE - - -#ifndef SWIG // In swig, ignore the main flag declarations - -#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0 -// Need this construct to avoid the 'defined but not used' warning. -#define MAYBE_STRIPPED_HELP(txt) \ - (false ? (txt) : GFLAGS_NAMESPACE::kStrippedFlagHelp) -#else -#define MAYBE_STRIPPED_HELP(txt) txt -#endif - -// Each command-line flag has two variables associated with it: one -// with the current value, and one with the default value. However, -// we have a third variable, which is where value is assigned; it's a -// constant. This guarantees that FLAG_##value is initialized at -// static initialization time (e.g. before program-start) rather than -// than global construction time (which is after program-start but -// before main), at least when 'value' is a compile-time constant. We -// use a small trick for the "default value" variable, and call it -// FLAGS_no. This serves the second purpose of assuring a -// compile error if someone tries to define a flag named no -// which is illegal (--foo and --nofoo both affect the "foo" flag). -#define DEFINE_VARIABLE(type, shorttype, name, value, help) \ - namespace fL##shorttype { \ - static const type FLAGS_nono##name = value; \ - /* We always want to export defined variables, dll or no */ \ - GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \ - type FLAGS_no##name = FLAGS_nono##name; \ - static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \ - #name, MAYBE_STRIPPED_HELP(help), __FILE__, \ - &FLAGS_##name, &FLAGS_no##name); \ - } \ - using fL##shorttype::FLAGS_##name - -// For DEFINE_bool, we want to do the extra check that the passed-in -// value is actually a bool, and not a string or something that can be -// coerced to a bool. These declarations (no definition needed!) will -// help us do that, and never evaluate From, which is important. -// We'll use 'sizeof(IsBool(val))' to distinguish. This code requires -// that the compiler have different sizes for bool & double. Since -// this is not guaranteed by the standard, we check it with a -// COMPILE_ASSERT. -namespace fLB { -struct CompileAssert {}; -typedef CompileAssert expected_sizeof_double_neq_sizeof_bool[ - (sizeof(double) != sizeof(bool)) ? 1 : -1]; -template double GFLAGS_DLL_DECL IsBoolFlag(const From& from); -GFLAGS_DLL_DECL bool IsBoolFlag(bool from); -} // namespace fLB - -// Here are the actual DEFINE_*-macros. The respective DECLARE_*-macros -// are in a separate include, gflags_declare.h, for reducing -// the physical transitive size for DECLARE use. -#define DEFINE_bool(name, val, txt) \ - namespace fLB { \ - typedef ::fLB::CompileAssert FLAG_##name##_value_is_not_a_bool[ \ - (sizeof(::fLB::IsBoolFlag(val)) != sizeof(double))? 1: -1]; \ - } \ - DEFINE_VARIABLE(bool, B, name, val, txt) - -#define DEFINE_int32(name, val, txt) \ - DEFINE_VARIABLE(GFLAGS_NAMESPACE::int32, I, \ - name, val, txt) - -#define DEFINE_uint32(name,val, txt) \ - DEFINE_VARIABLE(GFLAGS_NAMESPACE::uint32, U, \ - name, val, txt) - -#define DEFINE_int64(name, val, txt) \ - DEFINE_VARIABLE(GFLAGS_NAMESPACE::int64, I64, \ - name, val, txt) - -#define DEFINE_uint64(name,val, txt) \ - DEFINE_VARIABLE(GFLAGS_NAMESPACE::uint64, U64, \ - name, val, txt) - -#define DEFINE_double(name, val, txt) \ - DEFINE_VARIABLE(double, D, name, val, txt) - -// Strings are trickier, because they're not a POD, so we can't -// construct them at static-initialization time (instead they get -// constructed at global-constructor time, which is much later). To -// try to avoid crashes in that case, we use a char buffer to store -// the string, which we can static-initialize, and then placement-new -// into it later. It's not perfect, but the best we can do. - -namespace fLS { - -inline clstring* dont_pass0toDEFINE_string(char *stringspot, - const char *value) { - return new(stringspot) clstring(value); -} -inline clstring* dont_pass0toDEFINE_string(char *stringspot, - const clstring &value) { - return new(stringspot) clstring(value); -} -inline clstring* dont_pass0toDEFINE_string(char *stringspot, - int value); - -// Auxiliary class used to explicitly call destructor of string objects -// allocated using placement new during static program deinitialization. -// The destructor MUST be an inline function such that the explicit -// destruction occurs in the same compilation unit as the placement new. -class StringFlagDestructor { - void *current_storage_; - void *defvalue_storage_; - -public: - - StringFlagDestructor(void *current, void *defvalue) - : current_storage_(current), defvalue_storage_(defvalue) {} - - ~StringFlagDestructor() { - reinterpret_cast(current_storage_ )->~clstring(); - reinterpret_cast(defvalue_storage_)->~clstring(); - } -}; - -} // namespace fLS - -// We need to define a var named FLAGS_no##name so people don't define -// --string and --nostring. And we need a temporary place to put val -// so we don't have to evaluate it twice. Two great needs that go -// great together! -// The weird 'using' + 'extern' inside the fLS namespace is to work around -// an unknown compiler bug/issue with the gcc 4.2.1 on SUSE 10. See -// http://code.google.com/p/google-gflags/issues/detail?id=20 -#define DEFINE_string(name, val, txt) \ - namespace fLS { \ - using ::fLS::clstring; \ - using ::fLS::StringFlagDestructor; \ - static union { void* align; char s[sizeof(clstring)]; } s_##name[2]; \ - clstring* const FLAGS_no##name = ::fLS:: \ - dont_pass0toDEFINE_string(s_##name[0].s, \ - val); \ - static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \ - #name, MAYBE_STRIPPED_HELP(txt), __FILE__, \ - FLAGS_no##name, new (s_##name[1].s) clstring(*FLAGS_no##name)); \ - static StringFlagDestructor d_##name(s_##name[0].s, s_##name[1].s); \ - extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name; \ - using fLS::FLAGS_##name; \ - clstring& FLAGS_##name = *FLAGS_no##name; \ - } \ - using fLS::FLAGS_##name - -#endif // SWIG - - -@INCLUDE_GFLAGS_NS_H@ - - -#endif // GFLAGS_GFLAGS_H_ diff --git a/inference-engine/samples/thirdparty/gflags/src/gflags_completions.cc b/inference-engine/samples/thirdparty/gflags/src/gflags_completions.cc deleted file mode 100644 index f7724864d58..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/gflags_completions.cc +++ /dev/null @@ -1,768 +0,0 @@ -// Copyright (c) 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --- - -// Bash-style command line flag completion for C++ binaries -// -// This module implements bash-style completions. It achieves this -// goal in the following broad chunks: -// -// 1) Take a to-be-completed word, and examine it for search hints -// 2) Identify all potentially matching flags -// 2a) If there are no matching flags, do nothing. -// 2b) If all matching flags share a common prefix longer than the -// completion word, output just that matching prefix -// 3) Categorize those flags to produce a rough ordering of relevence. -// 4) Potentially trim the set of flags returned to a smaller number -// that bash is happier with -// 5) Output the matching flags in groups ordered by relevence. -// 5a) Force bash to place most-relevent groups at the top of the list -// 5b) Trim most flag's descriptions to fit on a single terminal line - -#include -#include -#include // for strlen - -#include -#include -#include -#include - -#include "config.h" -#include "gflags/gflags.h" -#include "gflags/gflags_completions.h" -#include "util.h" - -using std::set; -using std::string; -using std::vector; - - -DEFINE_string(tab_completion_word, "", - "If non-empty, HandleCommandLineCompletions() will hijack the " - "process and attempt to do bash-style command line flag " - "completion on this value."); -DEFINE_int32(tab_completion_columns, 80, - "Number of columns to use in output for tab completion"); - - -namespace GFLAGS_NAMESPACE { - - -namespace { -// Function prototypes and Type forward declarations. Code may be -// more easily understood if it is roughly ordered according to -// control flow, rather than by C's "declare before use" ordering -struct CompletionOptions; -struct NotableFlags; - -// The entry point if flag completion is to be used. -static void PrintFlagCompletionInfo(void); - - -// 1) Examine search word -static void CanonicalizeCursorWordAndSearchOptions( - const string &cursor_word, - string *canonical_search_token, - CompletionOptions *options); - -static bool RemoveTrailingChar(string *str, char c); - - -// 2) Find all matches -static void FindMatchingFlags( - const vector &all_flags, - const CompletionOptions &options, - const string &match_token, - set *all_matches, - string *longest_common_prefix); - -static bool DoesSingleFlagMatch( - const CommandLineFlagInfo &flag, - const CompletionOptions &options, - const string &match_token); - - -// 3) Categorize matches -static void CategorizeAllMatchingFlags( - const set &all_matches, - const string &search_token, - const string &module, - const string &package_dir, - NotableFlags *notable_flags); - -static void TryFindModuleAndPackageDir( - const vector &all_flags, - string *module, - string *package_dir); - - -// 4) Decide which flags to use -static void FinalizeCompletionOutput( - const set &matching_flags, - CompletionOptions *options, - NotableFlags *notable_flags, - vector *completions); - -static void RetrieveUnusedFlags( - const set &matching_flags, - const NotableFlags ¬able_flags, - set *unused_flags); - - -// 5) Output matches -static void OutputSingleGroupWithLimit( - const set &group, - const string &line_indentation, - const string &header, - const string &footer, - bool long_output_format, - int *remaining_line_limit, - size_t *completion_elements_added, - vector *completions); - -// (helpers for #5) -static string GetShortFlagLine( - const string &line_indentation, - const CommandLineFlagInfo &info); - -static string GetLongFlagLine( - const string &line_indentation, - const CommandLineFlagInfo &info); - - -// -// Useful types - -// Try to deduce the intentions behind this completion attempt. Return the -// canonical search term in 'canonical_search_token'. Binary search options -// are returned in the various booleans, which should all have intuitive -// semantics, possibly except: -// - return_all_matching_flags: Generally, we'll trim the number of -// returned candidates to some small number, showing those that are -// most likely to be useful first. If this is set, however, the user -// really does want us to return every single flag as an option. -// - force_no_update: Any time we output lines, all of which share a -// common prefix, bash will 'helpfully' not even bother to show the -// output, instead changing the current word to be that common prefix. -// If it's clear this shouldn't happen, we'll set this boolean -struct CompletionOptions { - bool flag_name_substring_search; - bool flag_location_substring_search; - bool flag_description_substring_search; - bool return_all_matching_flags; - bool force_no_update; -}; - -// Notable flags are flags that are special or preferred for some -// reason. For example, flags that are defined in the binary's module -// are expected to be much more relevent than flags defined in some -// other random location. These sets are specified roughly in precedence -// order. Once a flag is placed in one of these 'higher' sets, it won't -// be placed in any of the 'lower' sets. -struct NotableFlags { - typedef set FlagSet; - FlagSet perfect_match_flag; - FlagSet module_flags; // Found in module file - FlagSet package_flags; // Found in same directory as module file - FlagSet most_common_flags; // One of the XXX most commonly supplied flags - FlagSet subpackage_flags; // Found in subdirectories of package -}; - - -// -// Tab completion implementation - entry point -static void PrintFlagCompletionInfo(void) { - string cursor_word = FLAGS_tab_completion_word; - string canonical_token; - CompletionOptions options = { }; - CanonicalizeCursorWordAndSearchOptions( - cursor_word, - &canonical_token, - &options); - - DVLOG(1) << "Identified canonical_token: '" << canonical_token << "'"; - - vector all_flags; - set matching_flags; - GetAllFlags(&all_flags); - DVLOG(2) << "Found " << all_flags.size() << " flags overall"; - - string longest_common_prefix; - FindMatchingFlags( - all_flags, - options, - canonical_token, - &matching_flags, - &longest_common_prefix); - DVLOG(1) << "Identified " << matching_flags.size() << " matching flags"; - DVLOG(1) << "Identified " << longest_common_prefix - << " as longest common prefix."; - if (longest_common_prefix.size() > canonical_token.size()) { - // There's actually a shared common prefix to all matching flags, - // so may as well output that and quit quickly. - DVLOG(1) << "The common prefix '" << longest_common_prefix - << "' was longer than the token '" << canonical_token - << "'. Returning just this prefix for completion."; - fprintf(stdout, "--%s", longest_common_prefix.c_str()); - return; - } - if (matching_flags.empty()) { - VLOG(1) << "There were no matching flags, returning nothing."; - return; - } - - string module; - string package_dir; - TryFindModuleAndPackageDir(all_flags, &module, &package_dir); - DVLOG(1) << "Identified module: '" << module << "'"; - DVLOG(1) << "Identified package_dir: '" << package_dir << "'"; - - NotableFlags notable_flags; - CategorizeAllMatchingFlags( - matching_flags, - canonical_token, - module, - package_dir, - ¬able_flags); - DVLOG(2) << "Categorized matching flags:"; - DVLOG(2) << " perfect_match: " << notable_flags.perfect_match_flag.size(); - DVLOG(2) << " module: " << notable_flags.module_flags.size(); - DVLOG(2) << " package: " << notable_flags.package_flags.size(); - DVLOG(2) << " most common: " << notable_flags.most_common_flags.size(); - DVLOG(2) << " subpackage: " << notable_flags.subpackage_flags.size(); - - vector completions; - FinalizeCompletionOutput( - matching_flags, - &options, - ¬able_flags, - &completions); - - if (options.force_no_update) - completions.push_back("~"); - - DVLOG(1) << "Finalized with " << completions.size() - << " chosen completions"; - - for (vector::const_iterator it = completions.begin(); - it != completions.end(); - ++it) { - DVLOG(9) << " Completion entry: '" << *it << "'"; - fprintf(stdout, "%s\n", it->c_str()); - } -} - - -// 1) Examine search word (and helper method) -static void CanonicalizeCursorWordAndSearchOptions( - const string &cursor_word, - string *canonical_search_token, - CompletionOptions *options) { - *canonical_search_token = cursor_word; - if (canonical_search_token->empty()) return; - - // Get rid of leading quotes and dashes in the search term - if ((*canonical_search_token)[0] == '"') - *canonical_search_token = canonical_search_token->substr(1); - while ((*canonical_search_token)[0] == '-') - *canonical_search_token = canonical_search_token->substr(1); - - options->flag_name_substring_search = false; - options->flag_location_substring_search = false; - options->flag_description_substring_search = false; - options->return_all_matching_flags = false; - options->force_no_update = false; - - // Look for all search options we can deduce now. Do this by walking - // backwards through the term, looking for up to three '?' and up to - // one '+' as suffixed characters. Consume them if found, and remove - // them from the canonical search token. - int found_question_marks = 0; - int found_plusses = 0; - while (true) { - if (found_question_marks < 3 && - RemoveTrailingChar(canonical_search_token, '?')) { - ++found_question_marks; - continue; - } - if (found_plusses < 1 && - RemoveTrailingChar(canonical_search_token, '+')) { - ++found_plusses; - continue; - } - break; - } - - switch (found_question_marks) { // all fallthroughs - case 3: options->flag_description_substring_search = true; - case 2: options->flag_location_substring_search = true; - case 1: options->flag_name_substring_search = true; - }; - - options->return_all_matching_flags = (found_plusses > 0); -} - -// Returns true if a char was removed -static bool RemoveTrailingChar(string *str, char c) { - if (str->empty()) return false; - if ((*str)[str->size() - 1] == c) { - *str = str->substr(0, str->size() - 1); - return true; - } - return false; -} - - -// 2) Find all matches (and helper methods) -static void FindMatchingFlags( - const vector &all_flags, - const CompletionOptions &options, - const string &match_token, - set *all_matches, - string *longest_common_prefix) { - all_matches->clear(); - bool first_match = true; - for (vector::const_iterator it = all_flags.begin(); - it != all_flags.end(); - ++it) { - if (DoesSingleFlagMatch(*it, options, match_token)) { - all_matches->insert(&*it); - if (first_match) { - first_match = false; - *longest_common_prefix = it->name; - } else { - if (longest_common_prefix->empty() || it->name.empty()) { - longest_common_prefix->clear(); - continue; - } - string::size_type pos = 0; - while (pos < longest_common_prefix->size() && - pos < it->name.size() && - (*longest_common_prefix)[pos] == it->name[pos]) - ++pos; - longest_common_prefix->erase(pos); - } - } - } -} - -// Given the set of all flags, the parsed match options, and the -// canonical search token, produce the set of all candidate matching -// flags for subsequent analysis or filtering. -static bool DoesSingleFlagMatch( - const CommandLineFlagInfo &flag, - const CompletionOptions &options, - const string &match_token) { - // Is there a prefix match? - string::size_type pos = flag.name.find(match_token); - if (pos == 0) return true; - - // Is there a substring match if we want it? - if (options.flag_name_substring_search && - pos != string::npos) - return true; - - // Is there a location match if we want it? - if (options.flag_location_substring_search && - flag.filename.find(match_token) != string::npos) - return true; - - // TODO(user): All searches should probably be case-insensitive - // (especially this one...) - if (options.flag_description_substring_search && - flag.description.find(match_token) != string::npos) - return true; - - return false; -} - -// 3) Categorize matches (and helper method) - -// Given a set of matching flags, categorize them by -// likely relevence to this specific binary -static void CategorizeAllMatchingFlags( - const set &all_matches, - const string &search_token, - const string &module, // empty if we couldn't find any - const string &package_dir, // empty if we couldn't find any - NotableFlags *notable_flags) { - notable_flags->perfect_match_flag.clear(); - notable_flags->module_flags.clear(); - notable_flags->package_flags.clear(); - notable_flags->most_common_flags.clear(); - notable_flags->subpackage_flags.clear(); - - for (set::const_iterator it = - all_matches.begin(); - it != all_matches.end(); - ++it) { - DVLOG(2) << "Examining match '" << (*it)->name << "'"; - DVLOG(7) << " filename: '" << (*it)->filename << "'"; - string::size_type pos = string::npos; - if (!package_dir.empty()) - pos = (*it)->filename.find(package_dir); - string::size_type slash = string::npos; - if (pos != string::npos) // candidate for package or subpackage match - slash = (*it)->filename.find( - PATH_SEPARATOR, - pos + package_dir.size() + 1); - - if ((*it)->name == search_token) { - // Exact match on some flag's name - notable_flags->perfect_match_flag.insert(*it); - DVLOG(3) << "Result: perfect match"; - } else if (!module.empty() && (*it)->filename == module) { - // Exact match on module filename - notable_flags->module_flags.insert(*it); - DVLOG(3) << "Result: module match"; - } else if (!package_dir.empty() && - pos != string::npos && slash == string::npos) { - // In the package, since there was no slash after the package portion - notable_flags->package_flags.insert(*it); - DVLOG(3) << "Result: package match"; - } else if (false) { - // In the list of the XXX most commonly supplied flags overall - // TODO(user): Compile this list. - DVLOG(3) << "Result: most-common match"; - } else if (!package_dir.empty() && - pos != string::npos && slash != string::npos) { - // In a subdirectory of the package - notable_flags->subpackage_flags.insert(*it); - DVLOG(3) << "Result: subpackage match"; - } - - DVLOG(3) << "Result: not special match"; - } -} - -static void PushNameWithSuffix(vector* suffixes, const char* suffix) { - suffixes->push_back( - StringPrintf("/%s%s", ProgramInvocationShortName(), suffix)); -} - -static void TryFindModuleAndPackageDir( - const vector &all_flags, - string *module, - string *package_dir) { - module->clear(); - package_dir->clear(); - - vector suffixes; - // TODO(user): There's some inherant ambiguity here - multiple directories - // could share the same trailing folder and file structure (and even worse, - // same file names), causing us to be unsure as to which of the two is the - // actual package for this binary. In this case, we'll arbitrarily choose. - PushNameWithSuffix(&suffixes, "."); - PushNameWithSuffix(&suffixes, "-main."); - PushNameWithSuffix(&suffixes, "_main."); - // These four are new but probably merited? - PushNameWithSuffix(&suffixes, "-test."); - PushNameWithSuffix(&suffixes, "_test."); - PushNameWithSuffix(&suffixes, "-unittest."); - PushNameWithSuffix(&suffixes, "_unittest."); - - for (vector::const_iterator it = all_flags.begin(); - it != all_flags.end(); - ++it) { - for (vector::const_iterator suffix = suffixes.begin(); - suffix != suffixes.end(); - ++suffix) { - // TODO(user): Make sure the match is near the end of the string - if (it->filename.find(*suffix) != string::npos) { - *module = it->filename; - string::size_type sep = it->filename.rfind(PATH_SEPARATOR); - *package_dir = it->filename.substr(0, (sep == string::npos) ? 0 : sep); - return; - } - } - } -} - -// Can't specialize template type on a locally defined type. Silly C++... -struct DisplayInfoGroup { - const char* header; - const char* footer; - set *group; - - int SizeInLines() const { - int size_in_lines = static_cast(group->size()) + 1; - if (strlen(header) > 0) { - size_in_lines++; - } - if (strlen(footer) > 0) { - size_in_lines++; - } - return size_in_lines; - } -}; - -// 4) Finalize and trim output flag set -static void FinalizeCompletionOutput( - const set &matching_flags, - CompletionOptions *options, - NotableFlags *notable_flags, - vector *completions) { - - // We want to output lines in groups. Each group needs to be indented - // the same to keep its lines together. Unless otherwise required, - // only 99 lines should be output to prevent bash from harassing the - // user. - - // First, figure out which output groups we'll actually use. For each - // nonempty group, there will be ~3 lines of header & footer, plus all - // output lines themselves. - int max_desired_lines = // "999999 flags should be enough for anyone. -dave" - (options->return_all_matching_flags ? 999999 : 98); - int lines_so_far = 0; - - vector output_groups; - bool perfect_match_found = false; - if (lines_so_far < max_desired_lines && - !notable_flags->perfect_match_flag.empty()) { - perfect_match_found = true; - DisplayInfoGroup group = - { "", - "==========", - ¬able_flags->perfect_match_flag }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - if (lines_so_far < max_desired_lines && - !notable_flags->module_flags.empty()) { - DisplayInfoGroup group = { - "-* Matching module flags *-", - "===========================", - ¬able_flags->module_flags }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - if (lines_so_far < max_desired_lines && - !notable_flags->package_flags.empty()) { - DisplayInfoGroup group = { - "-* Matching package flags *-", - "============================", - ¬able_flags->package_flags }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - if (lines_so_far < max_desired_lines && - !notable_flags->most_common_flags.empty()) { - DisplayInfoGroup group = { - "-* Commonly used flags *-", - "=========================", - ¬able_flags->most_common_flags }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - if (lines_so_far < max_desired_lines && - !notable_flags->subpackage_flags.empty()) { - DisplayInfoGroup group = { - "-* Matching sub-package flags *-", - "================================", - ¬able_flags->subpackage_flags }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - - set obscure_flags; // flags not notable - if (lines_so_far < max_desired_lines) { - RetrieveUnusedFlags(matching_flags, *notable_flags, &obscure_flags); - if (!obscure_flags.empty()) { - DisplayInfoGroup group = { - "-* Other flags *-", - "", - &obscure_flags }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - } - - // Second, go through each of the chosen output groups and output - // as many of those flags as we can, while remaining below our limit - int remaining_lines = max_desired_lines; - size_t completions_output = 0; - int indent = static_cast(output_groups.size()) - 1; - for (vector::const_iterator it = - output_groups.begin(); - it != output_groups.end(); - ++it, --indent) { - OutputSingleGroupWithLimit( - *it->group, // group - string(indent, ' '), // line indentation - string(it->header), // header - string(it->footer), // footer - perfect_match_found, // long format - &remaining_lines, // line limit - reduces this by number printed - &completions_output, // completions (not lines) added - completions); // produced completions - perfect_match_found = false; - } - - if (completions_output != matching_flags.size()) { - options->force_no_update = false; - completions->push_back("~ (Remaining flags hidden) ~"); - } else { - options->force_no_update = true; - } -} - -static void RetrieveUnusedFlags( - const set &matching_flags, - const NotableFlags ¬able_flags, - set *unused_flags) { - // Remove from 'matching_flags' set all members of the sets of - // flags we've already printed (specifically, those in notable_flags) - for (set::const_iterator it = - matching_flags.begin(); - it != matching_flags.end(); - ++it) { - if (notable_flags.perfect_match_flag.count(*it) || - notable_flags.module_flags.count(*it) || - notable_flags.package_flags.count(*it) || - notable_flags.most_common_flags.count(*it) || - notable_flags.subpackage_flags.count(*it)) - continue; - unused_flags->insert(*it); - } -} - -// 5) Output matches (and helper methods) - -static void OutputSingleGroupWithLimit( - const set &group, - const string &line_indentation, - const string &header, - const string &footer, - bool long_output_format, - int *remaining_line_limit, - size_t *completion_elements_output, - vector *completions) { - if (group.empty()) return; - if (!header.empty()) { - if (*remaining_line_limit < 2) return; - *remaining_line_limit -= 2; - completions->push_back(line_indentation + header); - completions->push_back(line_indentation + string(header.size(), '-')); - } - for (set::const_iterator it = group.begin(); - it != group.end() && *remaining_line_limit > 0; - ++it) { - --*remaining_line_limit; - ++*completion_elements_output; - completions->push_back( - (long_output_format - ? GetLongFlagLine(line_indentation, **it) - : GetShortFlagLine(line_indentation, **it))); - } - if (!footer.empty()) { - if (*remaining_line_limit < 1) return; - --*remaining_line_limit; - completions->push_back(line_indentation + footer); - } -} - -static string GetShortFlagLine( - const string &line_indentation, - const CommandLineFlagInfo &info) { - string prefix; - bool is_string = (info.type == "string"); - SStringPrintf(&prefix, "%s--%s [%s%s%s] ", - line_indentation.c_str(), - info.name.c_str(), - (is_string ? "'" : ""), - info.default_value.c_str(), - (is_string ? "'" : "")); - int remainder = - FLAGS_tab_completion_columns - static_cast(prefix.size()); - string suffix; - if (remainder > 0) - suffix = - (static_cast(info.description.size()) > remainder ? - (info.description.substr(0, remainder - 3) + "...").c_str() : - info.description.c_str()); - return prefix + suffix; -} - -static string GetLongFlagLine( - const string &line_indentation, - const CommandLineFlagInfo &info) { - - string output = DescribeOneFlag(info); - - // Replace '-' with '--', and remove trailing newline before appending - // the module definition location. - string old_flagname = "-" + info.name; - output.replace( - output.find(old_flagname), - old_flagname.size(), - "-" + old_flagname); - // Stick a newline and indentation in front of the type and default - // portions of DescribeOneFlag()s description - static const char kNewlineWithIndent[] = "\n "; - output.replace(output.find(" type:"), 1, string(kNewlineWithIndent)); - output.replace(output.find(" default:"), 1, string(kNewlineWithIndent)); - output = StringPrintf("%s Details for '--%s':\n" - "%s defined: %s", - line_indentation.c_str(), - info.name.c_str(), - output.c_str(), - info.filename.c_str()); - - // Eliminate any doubled newlines that crept in. Specifically, if - // DescribeOneFlag() decided to break the line just before "type" - // or "default", we don't want to introduce an extra blank line - static const string line_of_spaces(FLAGS_tab_completion_columns, ' '); - static const char kDoubledNewlines[] = "\n \n"; - for (string::size_type newlines = output.find(kDoubledNewlines); - newlines != string::npos; - newlines = output.find(kDoubledNewlines)) - // Replace each 'doubled newline' with a single newline - output.replace(newlines, sizeof(kDoubledNewlines) - 1, string("\n")); - - for (string::size_type newline = output.find('\n'); - newline != string::npos; - newline = output.find('\n')) { - int newline_pos = static_cast(newline) % FLAGS_tab_completion_columns; - int missing_spaces = FLAGS_tab_completion_columns - newline_pos; - output.replace(newline, 1, line_of_spaces, 1, missing_spaces); - } - return output; -} -} // anonymous - -void HandleCommandLineCompletions(void) { - if (FLAGS_tab_completion_word.empty()) return; - PrintFlagCompletionInfo(); - gflags_exitfunc(0); -} - - -} // namespace GFLAGS_NAMESPACE diff --git a/inference-engine/samples/thirdparty/gflags/src/gflags_completions.h.in b/inference-engine/samples/thirdparty/gflags/src/gflags_completions.h.in deleted file mode 100644 index b27e5fda114..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/gflags_completions.h.in +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --- - -// -// Implement helpful bash-style command line flag completions -// -// ** Functional API: -// HandleCommandLineCompletions() should be called early during -// program startup, but after command line flag code has been -// initialized, such as the beginning of HandleCommandLineHelpFlags(). -// It checks the value of the flag --tab_completion_word. If this -// flag is empty, nothing happens here. If it contains a string, -// however, then HandleCommandLineCompletions() will hijack the -// process, attempting to identify the intention behind this -// completion. Regardless of the outcome of this deduction, the -// process will be terminated, similar to --helpshort flag -// handling. -// -// ** Overview of Bash completions: -// Bash can be told to programatically determine completions for the -// current 'cursor word'. It does this by (in this case) invoking a -// command with some additional arguments identifying the command -// being executed, the word being completed, and the previous word -// (if any). Bash then expects a sequence of output lines to be -// printed to stdout. If these lines all contain a common prefix -// longer than the cursor word, bash will replace the cursor word -// with that common prefix, and display nothing. If there isn't such -// a common prefix, bash will display the lines in pages using 'more'. -// -// ** Strategy taken for command line completions: -// If we can deduce either the exact flag intended, or a common flag -// prefix, we'll output exactly that. Otherwise, if information -// must be displayed to the user, we'll take the opportunity to add -// some helpful information beyond just the flag name (specifically, -// we'll include the default flag value and as much of the flag's -// description as can fit on a single terminal line width, as specified -// by the flag --tab_completion_columns). Furthermore, we'll try to -// make bash order the output such that the most useful or relevent -// flags are the most likely to be shown at the top. -// -// ** Additional features: -// To assist in finding that one really useful flag, substring matching -// was implemented. Before pressing a to get completion for the -// current word, you can append one or more '?' to the flag to do -// substring matching. Here's the semantics: -// --foo Show me all flags with names prefixed by 'foo' -// --foo? Show me all flags with 'foo' somewhere in the name -// --foo?? Same as prior case, but also search in module -// definition path for 'foo' -// --foo??? Same as prior case, but also search in flag -// descriptions for 'foo' -// Finally, we'll trim the output to a relatively small number of -// flags to keep bash quiet about the verbosity of output. If one -// really wanted to see all possible matches, appending a '+' to the -// search word will force the exhaustive list of matches to be printed. -// -// ** How to have bash accept completions from a binary: -// Bash requires that it be informed about each command that programmatic -// completion should be enabled for. Example addition to a .bashrc -// file would be (your path to gflags_completions.sh file may differ): - -/* -$ complete -o bashdefault -o default -o nospace -C \ - '/home/build/eng/bash/bash_completions.sh --tab_completion_columns $COLUMNS' \ - time env binary_name another_binary [...] -*/ - -// This would allow the following to work: -// $ /path/to/binary_name --vmodule -// Or: -// $ ./bin/path/another_binary --gfs_u -// (etc) -// -// Sadly, it appears that bash gives no easy way to force this behavior for -// all commands. That's where the "time" in the above example comes in. -// If you haven't specifically added a command to the list of completion -// supported commands, you can still get completions by prefixing the -// entire command with "env". -// $ env /some/brand/new/binary --vmod -// Assuming that "binary" is a newly compiled binary, this should still -// produce the expected completion output. - - -#ifndef GFLAGS_COMPLETIONS_H_ -#define GFLAGS_COMPLETIONS_H_ - -namespace @GFLAGS_NAMESPACE@ { - -extern void HandleCommandLineCompletions(void); - -} - -#endif // GFLAGS_COMPLETIONS_H_ diff --git a/inference-engine/samples/thirdparty/gflags/src/gflags_completions.sh b/inference-engine/samples/thirdparty/gflags/src/gflags_completions.sh deleted file mode 100644 index c5fb7e6bc57..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/gflags_completions.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2008, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# --- -# Author: Dave Nicponski -# -# This script is invoked by bash in response to a matching compspec. When -# this happens, bash calls this script using the command shown in the -C -# block of the complete entry, but also appends 3 arguments. They are: -# - The command being used for completion -# - The word being completed -# - The word preceding the completion word. -# -# Here's an example of how you might use this script: -# $ complete -o bashdefault -o default -o nospace -C \ -# '/usr/local/bin/gflags_completions.sh --tab_completion_columns $COLUMNS' \ -# time env binary_name another_binary [...] - -# completion_word_index gets the index of the (N-1)th argument for -# this command line. completion_word gets the actual argument from -# this command line at the (N-1)th position -completion_word_index="$(($# - 1))" -completion_word="${!completion_word_index}" - -# TODO(user): Replace this once gflags_completions.cc has -# a bool parameter indicating unambiguously to hijack the process for -# completion purposes. -if [ -z "$completion_word" ]; then - # Until an empty value for the completion word stops being misunderstood - # by binaries, don't actually execute the binary or the process - # won't be hijacked! - exit 0 -fi - -# binary_index gets the index of the command being completed (which bash -# places in the (N-2)nd position. binary gets the actual command from -# this command line at that (N-2)nd position -binary_index="$(($# - 2))" -binary="${!binary_index}" - -# For completions to be universal, we may have setup the compspec to -# trigger on 'harmless pass-through' commands, like 'time' or 'env'. -# If the command being completed is one of those two, we'll need to -# identify the actual command being executed. To do this, we need -# the actual command line that the was pressed on. Bash helpfully -# places this in the $COMP_LINE variable. -if [ "$binary" == "time" ] || [ "$binary" == "env" ]; then - # we'll assume that the first 'argument' is actually the - # binary - - - # TODO(user): This is not perfect - the 'env' command, for instance, - # is allowed to have options between the 'env' and 'the command to - # be executed'. For example, consider: - # $ env FOO="bar" bin/do_something --help - # In this case, we'll mistake the FOO="bar" portion as the binary. - # Perhaps we should continuing consuming leading words until we - # either run out of words, or find a word that is a valid file - # marked as executable. I can't think of any reason this wouldn't - # work. - - # Break up the 'original command line' (not this script's command line, - # rather the one the was pressed on) and find the second word. - parts=( ${COMP_LINE} ) - binary=${parts[1]} -fi - -# Build the command line to use for completion. Basically it involves -# passing through all the arguments given to this script (except the 3 -# that bash added), and appending a '--tab_completion_word "WORD"' to -# the arguments. -params="" -for ((i=1; i<=$(($# - 3)); ++i)); do - params="$params \"${!i}\""; -done -params="$params --tab_completion_word \"$completion_word\"" - -# TODO(user): Perhaps stash the output in a temporary file somewhere -# in /tmp, and only cat it to stdout if the command returned a success -# code, to prevent false positives - -# If we think we have a reasonable command to execute, then execute it -# and hope for the best. -candidate=$(type -p "$binary") -if [ ! -z "$candidate" ]; then - eval "$candidate 2>/dev/null $params" -elif [ -f "$binary" ] && [ -x "$binary" ]; then - eval "$binary 2>/dev/null $params" -fi diff --git a/inference-engine/samples/thirdparty/gflags/src/gflags_declare.h.in b/inference-engine/samples/thirdparty/gflags/src/gflags_declare.h.in deleted file mode 100644 index 508d46b37f9..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/gflags_declare.h.in +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 1999, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// -// Revamped and reorganized by Craig Silverstein -// -// This is the file that should be included by any file which declares -// command line flag. - -#ifndef GFLAGS_DECLARE_H_ -#define GFLAGS_DECLARE_H_ - - -// --------------------------------------------------------------------------- -// Namespace of gflags library symbols. -#define GFLAGS_NAMESPACE @GFLAGS_NAMESPACE@ - -// --------------------------------------------------------------------------- -// Windows DLL import/export. - -// Whether gflags library is a DLL. -// -// Set to 1 by default when the shared gflags library was built on Windows. -// Must be overwritten when this header file is used with the optionally also -// built static library instead; set by CMake's INTERFACE_COMPILE_DEFINITIONS. -#ifndef GFLAGS_IS_A_DLL -# define GFLAGS_IS_A_DLL @GFLAGS_IS_A_DLL@ -#endif - -// We always want to import the symbols of the gflags library. -#ifndef GFLAGS_DLL_DECL -# if GFLAGS_IS_A_DLL && defined(_MSC_VER) -# define GFLAGS_DLL_DECL __declspec(dllimport) -# else -# define GFLAGS_DLL_DECL -# endif -#endif - -// We always want to import variables declared in user code. -#ifndef GFLAGS_DLL_DECLARE_FLAG -# if GFLAGS_IS_A_DLL && defined(_MSC_VER) -# define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport) -# else -# define GFLAGS_DLL_DECLARE_FLAG -# endif -#endif - -// --------------------------------------------------------------------------- -// Flag types -#include -#if @HAVE_STDINT_H@ -# include // the normal place uint32_t is defined -#elif @HAVE_SYS_TYPES_H@ -# include // the normal place u_int32_t is defined -#elif @HAVE_INTTYPES_H@ -# include // a third place for uint32_t or u_int32_t -#endif - -namespace GFLAGS_NAMESPACE { - -#if @GFLAGS_INTTYPES_FORMAT_C99@ // C99 -typedef int32_t int32; -typedef uint32_t uint32; -typedef int64_t int64; -typedef uint64_t uint64; -#elif @GFLAGS_INTTYPES_FORMAT_BSD@ // BSD -typedef int32_t int32; -typedef u_int32_t uint32; -typedef int64_t int64; -typedef u_int64_t uint64; -#elif @GFLAGS_INTTYPES_FORMAT_VC7@ // Windows -typedef __int32 int32; -typedef unsigned __int32 uint32; -typedef __int64 int64; -typedef unsigned __int64 uint64; -#else -# error Do not know how to define a 32-bit integer quantity on your system -#endif - -} // namespace GFLAGS_NAMESPACE - - -namespace fLS { - -// The meaning of "string" might be different between now and when the -// macros below get invoked (e.g., if someone is experimenting with -// other string implementations that get defined after this file is -// included). Save the current meaning now and use it in the macros. -typedef std::string clstring; - -} // namespace fLS - - -#define DECLARE_VARIABLE(type, shorttype, name) \ - /* We always want to import declared variables, dll or no */ \ - namespace fL##shorttype { extern GFLAGS_DLL_DECLARE_FLAG type FLAGS_##name; } \ - using fL##shorttype::FLAGS_##name - -#define DECLARE_bool(name) \ - DECLARE_VARIABLE(bool, B, name) - -#define DECLARE_int32(name) \ - DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int32, I, name) - -#define DECLARE_uint32(name) \ - DECLARE_VARIABLE(::GFLAGS_NAMESPACE::uint32, U, name) - -#define DECLARE_int64(name) \ - DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int64, I64, name) - -#define DECLARE_uint64(name) \ - DECLARE_VARIABLE(::GFLAGS_NAMESPACE::uint64, U64, name) - -#define DECLARE_double(name) \ - DECLARE_VARIABLE(double, D, name) - -#define DECLARE_string(name) \ - /* We always want to import declared variables, dll or no */ \ - namespace fLS { \ - using ::fLS::clstring; \ - extern GFLAGS_DLL_DECLARE_FLAG ::fLS::clstring& FLAGS_##name; \ - } \ - using fLS::FLAGS_##name - - -#endif // GFLAGS_DECLARE_H_ diff --git a/inference-engine/samples/thirdparty/gflags/src/gflags_ns.h.in b/inference-engine/samples/thirdparty/gflags/src/gflags_ns.h.in deleted file mode 100644 index ef6ac29868c..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/gflags_ns.h.in +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2014, Andreas Schuh -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// ----------------------------------------------------------------------------- -// Imports the gflags library symbols into an alternative/deprecated namespace. - -#ifndef GFLAGS_GFLAGS_H_ -# error The internal header gflags_@ns@.h may only be included by gflags.h -#endif - -#ifndef GFLAGS_NS_@NS@_H_ -#define GFLAGS_NS_@NS@_H_ - - -namespace @ns@ { - - -using GFLAGS_NAMESPACE::int32; -using GFLAGS_NAMESPACE::uint32; -using GFLAGS_NAMESPACE::int64; -using GFLAGS_NAMESPACE::uint64; - -using GFLAGS_NAMESPACE::RegisterFlagValidator; -using GFLAGS_NAMESPACE::CommandLineFlagInfo; -using GFLAGS_NAMESPACE::GetAllFlags; -using GFLAGS_NAMESPACE::ShowUsageWithFlags; -using GFLAGS_NAMESPACE::ShowUsageWithFlagsRestrict; -using GFLAGS_NAMESPACE::DescribeOneFlag; -using GFLAGS_NAMESPACE::SetArgv; -using GFLAGS_NAMESPACE::GetArgvs; -using GFLAGS_NAMESPACE::GetArgv; -using GFLAGS_NAMESPACE::GetArgv0; -using GFLAGS_NAMESPACE::GetArgvSum; -using GFLAGS_NAMESPACE::ProgramInvocationName; -using GFLAGS_NAMESPACE::ProgramInvocationShortName; -using GFLAGS_NAMESPACE::ProgramUsage; -using GFLAGS_NAMESPACE::VersionString; -using GFLAGS_NAMESPACE::GetCommandLineOption; -using GFLAGS_NAMESPACE::GetCommandLineFlagInfo; -using GFLAGS_NAMESPACE::GetCommandLineFlagInfoOrDie; -using GFLAGS_NAMESPACE::FlagSettingMode; -using GFLAGS_NAMESPACE::SET_FLAGS_VALUE; -using GFLAGS_NAMESPACE::SET_FLAG_IF_DEFAULT; -using GFLAGS_NAMESPACE::SET_FLAGS_DEFAULT; -using GFLAGS_NAMESPACE::SetCommandLineOption; -using GFLAGS_NAMESPACE::SetCommandLineOptionWithMode; -using GFLAGS_NAMESPACE::FlagSaver; -using GFLAGS_NAMESPACE::CommandlineFlagsIntoString; -using GFLAGS_NAMESPACE::ReadFlagsFromString; -using GFLAGS_NAMESPACE::AppendFlagsIntoFile; -using GFLAGS_NAMESPACE::ReadFromFlagsFile; -using GFLAGS_NAMESPACE::BoolFromEnv; -using GFLAGS_NAMESPACE::Int32FromEnv; -using GFLAGS_NAMESPACE::Uint32FromEnv; -using GFLAGS_NAMESPACE::Int64FromEnv; -using GFLAGS_NAMESPACE::Uint64FromEnv; -using GFLAGS_NAMESPACE::DoubleFromEnv; -using GFLAGS_NAMESPACE::StringFromEnv; -using GFLAGS_NAMESPACE::SetUsageMessage; -using GFLAGS_NAMESPACE::SetVersionString; -using GFLAGS_NAMESPACE::ParseCommandLineNonHelpFlags; -using GFLAGS_NAMESPACE::HandleCommandLineHelpFlags; -using GFLAGS_NAMESPACE::AllowCommandLineReparsing; -using GFLAGS_NAMESPACE::ReparseCommandLineNonHelpFlags; -using GFLAGS_NAMESPACE::ShutDownCommandLineFlags; -using GFLAGS_NAMESPACE::FlagRegisterer; - -#ifndef SWIG -using GFLAGS_NAMESPACE::ParseCommandLineFlags; -#endif - - -} // namespace @ns@ - - -#endif // GFLAGS_NS_@NS@_H_ diff --git a/inference-engine/samples/thirdparty/gflags/src/gflags_reporting.cc b/inference-engine/samples/thirdparty/gflags/src/gflags_reporting.cc deleted file mode 100644 index 7cc66913459..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/gflags_reporting.cc +++ /dev/null @@ -1,442 +0,0 @@ -// Copyright (c) 1999, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// -// Revamped and reorganized by Craig Silverstein -// -// This file contains code for handling the 'reporting' flags. These -// are flags that, when present, cause the program to report some -// information and then exit. --help and --version are the canonical -// reporting flags, but we also have flags like --helpxml, etc. -// -// There's only one function that's meant to be called externally: -// HandleCommandLineHelpFlags(). (Well, actually, ShowUsageWithFlags(), -// ShowUsageWithFlagsRestrict(), and DescribeOneFlag() can be called -// externally too, but there's little need for it.) These are all -// declared in the main gflags.h header file. -// -// HandleCommandLineHelpFlags() will check what 'reporting' flags have -// been defined, if any -- the "help" part of the function name is a -// bit misleading -- and do the relevant reporting. It should be -// called after all flag-values have been assigned, that is, after -// parsing the command-line. - -#include -#include -#include -#include -#include -#include - -#include "config.h" -#include "gflags/gflags.h" -#include "gflags/gflags_completions.h" -#include "util.h" - - -// The 'reporting' flags. They all call gflags_exitfunc(). -DEFINE_bool (help, false, "show help on all flags [tip: all flags can have two dashes]"); -DEFINE_bool (helpfull, false, "show help on all flags -- same as -help"); -DEFINE_bool (helpshort, false, "show help on only the main module for this program"); -DEFINE_string(helpon, "", "show help on the modules named by this flag value"); -DEFINE_string(helpmatch, "", "show help on modules whose name contains the specified substr"); -DEFINE_bool (helppackage, false, "show help on all modules in the main package"); -DEFINE_bool (helpxml, false, "produce an xml version of help"); -DEFINE_bool (version, false, "show version and build info and exit"); - - -namespace GFLAGS_NAMESPACE { - - -using std::string; -using std::vector; - - -// -------------------------------------------------------------------- -// DescribeOneFlag() -// DescribeOneFlagInXML() -// Routines that pretty-print info about a flag. These use -// a CommandLineFlagInfo, which is the way the gflags -// API exposes static info about a flag. -// -------------------------------------------------------------------- - -static const int kLineLength = 80; - -static void AddString(const string& s, - string* final_string, int* chars_in_line) { - const int slen = static_cast(s.length()); - if (*chars_in_line + 1 + slen >= kLineLength) { // < 80 chars/line - *final_string += "\n "; - *chars_in_line = 6; - } else { - *final_string += " "; - *chars_in_line += 1; - } - *final_string += s; - *chars_in_line += slen; -} - -static string PrintStringFlagsWithQuotes(const CommandLineFlagInfo& flag, - const string& text, bool current) { - const char* c_string = (current ? flag.current_value.c_str() : - flag.default_value.c_str()); - if (strcmp(flag.type.c_str(), "string") == 0) { // add quotes for strings - return StringPrintf("%s: \"%s\"", text.c_str(), c_string); - } else { - return StringPrintf("%s: %s", text.c_str(), c_string); - } -} - -// Create a descriptive string for a flag. -// Goes to some trouble to make pretty line breaks. -string DescribeOneFlag(const CommandLineFlagInfo& flag) { - string main_part; - SStringPrintf(&main_part, " -%s (%s)", - flag.name.c_str(), - flag.description.c_str()); - const char* c_string = main_part.c_str(); - int chars_left = static_cast(main_part.length()); - string final_string = ""; - int chars_in_line = 0; // how many chars in current line so far? - while (1) { - assert(static_cast(chars_left) - == strlen(c_string)); // Unless there's a \0 in there? - const char* newline = strchr(c_string, '\n'); - if (newline == NULL && chars_in_line+chars_left < kLineLength) { - // The whole remainder of the string fits on this line - final_string += c_string; - chars_in_line += chars_left; - break; - } - if (newline != NULL && newline - c_string < kLineLength - chars_in_line) { - int n = static_cast(newline - c_string); - final_string.append(c_string, n); - chars_left -= n + 1; - c_string += n + 1; - } else { - // Find the last whitespace on this 80-char line - int whitespace = kLineLength-chars_in_line-1; // < 80 chars/line - while ( whitespace > 0 && !isspace(c_string[whitespace]) ) { - --whitespace; - } - if (whitespace <= 0) { - // Couldn't find any whitespace to make a line break. Just dump the - // rest out! - final_string += c_string; - chars_in_line = kLineLength; // next part gets its own line for sure! - break; - } - final_string += string(c_string, whitespace); - chars_in_line += whitespace; - while (isspace(c_string[whitespace])) ++whitespace; - c_string += whitespace; - chars_left -= whitespace; - } - if (*c_string == '\0') - break; - StringAppendF(&final_string, "\n "); - chars_in_line = 6; - } - - // Append data type - AddString(string("type: ") + flag.type, &final_string, &chars_in_line); - // The listed default value will be the actual default from the flag - // definition in the originating source file, unless the value has - // subsequently been modified using SetCommandLineOptionWithMode() with mode - // SET_FLAGS_DEFAULT, or by setting FLAGS_foo = bar before ParseCommandLineFlags(). - AddString(PrintStringFlagsWithQuotes(flag, "default", false), &final_string, - &chars_in_line); - if (!flag.is_default) { - AddString(PrintStringFlagsWithQuotes(flag, "currently", true), - &final_string, &chars_in_line); - } - - StringAppendF(&final_string, "\n"); - return final_string; -} - -// Simple routine to xml-escape a string: escape & and < only. -static string XMLText(const string& txt) { - string ans = txt; - for (string::size_type pos = 0; (pos = ans.find("&", pos)) != string::npos; ) - ans.replace(pos++, 1, "&"); - for (string::size_type pos = 0; (pos = ans.find("<", pos)) != string::npos; ) - ans.replace(pos++, 1, "<"); - return ans; -} - -static void AddXMLTag(string* r, const char* tag, const string& txt) { - StringAppendF(r, "<%s>%s", tag, XMLText(txt).c_str(), tag); -} - - -static string DescribeOneFlagInXML(const CommandLineFlagInfo& flag) { - // The file and flagname could have been attributes, but default - // and meaning need to avoid attribute normalization. This way it - // can be parsed by simple programs, in addition to xml parsers. - string r(""); - AddXMLTag(&r, "file", flag.filename); - AddXMLTag(&r, "name", flag.name); - AddXMLTag(&r, "meaning", flag.description); - AddXMLTag(&r, "default", flag.default_value); - AddXMLTag(&r, "current", flag.current_value); - AddXMLTag(&r, "type", flag.type); - r += ""; - return r; -} - -// -------------------------------------------------------------------- -// ShowUsageWithFlags() -// ShowUsageWithFlagsRestrict() -// ShowXMLOfFlags() -// These routines variously expose the registry's list of flag -// values. ShowUsage*() prints the flag-value information -// to stdout in a user-readable format (that's what --help uses). -// The Restrict() version limits what flags are shown. -// ShowXMLOfFlags() prints the flag-value information to stdout -// in a machine-readable format. In all cases, the flags are -// sorted: first by filename they are defined in, then by flagname. -// -------------------------------------------------------------------- - -static const char* Basename(const char* filename) { - const char* sep = strrchr(filename, PATH_SEPARATOR); - return sep ? sep + 1 : filename; -} - -static string Dirname(const string& filename) { - string::size_type sep = filename.rfind(PATH_SEPARATOR); - return filename.substr(0, (sep == string::npos) ? 0 : sep); -} - -// Test whether a filename contains at least one of the substrings. -static bool FileMatchesSubstring(const string& filename, - const vector& substrings) { - for (vector::const_iterator target = substrings.begin(); - target != substrings.end(); - ++target) { - if (strstr(filename.c_str(), target->c_str()) != NULL) - return true; - // If the substring starts with a '/', that means that we want - // the string to be at the beginning of a directory component. - // That should match the first directory component as well, so - // we allow '/foo' to match a filename of 'foo'. - if (!target->empty() && (*target)[0] == PATH_SEPARATOR && - strncmp(filename.c_str(), target->c_str() + 1, - strlen(target->c_str() + 1)) == 0) - return true; - } - return false; -} - -// Show help for every filename which matches any of the target substrings. -// If substrings is empty, shows help for every file. If a flag's help message -// has been stripped (e.g. by adding '#define STRIP_FLAG_HELP 1' -// before including gflags/gflags.h), then this flag will not be displayed -// by '--help' and its variants. -static void ShowUsageWithFlagsMatching(const char *argv0, - const vector &substrings) { - fprintf(stdout, "%s: %s\n", Basename(argv0), ProgramUsage()); - - vector flags; - GetAllFlags(&flags); // flags are sorted by filename, then flagname - - string last_filename; // so we know when we're at a new file - bool first_directory = true; // controls blank lines between dirs - bool found_match = false; // stays false iff no dir matches restrict - for (vector::const_iterator flag = flags.begin(); - flag != flags.end(); - ++flag) { - if (substrings.empty() || - FileMatchesSubstring(flag->filename, substrings)) { - // If the flag has been stripped, pretend that it doesn't exist. - if (flag->description == kStrippedFlagHelp) continue; - found_match = true; // this flag passed the match! - if (flag->filename != last_filename) { // new file - if (Dirname(flag->filename) != Dirname(last_filename)) { // new dir! - if (!first_directory) - fprintf(stdout, "\n\n"); // put blank lines between directories - first_directory = false; - } - fprintf(stdout, "\n Flags from %s:\n", flag->filename.c_str()); - last_filename = flag->filename; - } - // Now print this flag - fprintf(stdout, "%s", DescribeOneFlag(*flag).c_str()); - } - } - if (!found_match && !substrings.empty()) { - fprintf(stdout, "\n No modules matched: use -help\n"); - } -} - -void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict) { - vector substrings; - if (restrict != NULL && *restrict != '\0') { - substrings.push_back(restrict); - } - ShowUsageWithFlagsMatching(argv0, substrings); -} - -void ShowUsageWithFlags(const char *argv0) { - ShowUsageWithFlagsRestrict(argv0, ""); -} - -// Convert the help, program, and usage to xml. -static void ShowXMLOfFlags(const char *prog_name) { - vector flags; - GetAllFlags(&flags); // flags are sorted: by filename, then flagname - - // XML. There is no corresponding schema yet - fprintf(stdout, "\n"); - // The document - fprintf(stdout, "\n"); - // the program name and usage - fprintf(stdout, "%s\n", - XMLText(Basename(prog_name)).c_str()); - fprintf(stdout, "%s\n", - XMLText(ProgramUsage()).c_str()); - // All the flags - for (vector::const_iterator flag = flags.begin(); - flag != flags.end(); - ++flag) { - if (flag->description != kStrippedFlagHelp) - fprintf(stdout, "%s\n", DescribeOneFlagInXML(*flag).c_str()); - } - // The end of the document - fprintf(stdout, "\n"); -} - -// -------------------------------------------------------------------- -// ShowVersion() -// Called upon --version. Prints build-related info. -// -------------------------------------------------------------------- - -static void ShowVersion() { - const char* version_string = VersionString(); - if (version_string && *version_string) { - fprintf(stdout, "%s version %s\n", - ProgramInvocationShortName(), version_string); - } else { - fprintf(stdout, "%s\n", ProgramInvocationShortName()); - } -# if !defined(NDEBUG) - fprintf(stdout, "Debug build (NDEBUG not #defined)\n"); -# endif -} - -static void AppendPrognameStrings(vector* substrings, - const char* progname) { - string r(""); - r += PATH_SEPARATOR; - r += progname; - substrings->push_back(r + "."); - substrings->push_back(r + "-main."); - substrings->push_back(r + "_main."); -} - -// -------------------------------------------------------------------- -// HandleCommandLineHelpFlags() -// Checks all the 'reporting' commandline flags to see if any -// have been set. If so, handles them appropriately. Note -// that all of them, by definition, cause the program to exit -// if they trigger. -// -------------------------------------------------------------------- - -void HandleCommandLineHelpFlags() { - const char* progname = ProgramInvocationShortName(); - - HandleCommandLineCompletions(); - - vector substrings; - AppendPrognameStrings(&substrings, progname); - - if (FLAGS_helpshort) { - // show only flags related to this binary: - // E.g. for fileutil.cc, want flags containing ... "/fileutil." cc - ShowUsageWithFlagsMatching(progname, substrings); - gflags_exitfunc(1); - - } else if (FLAGS_help || FLAGS_helpfull) { - // show all options - ShowUsageWithFlagsRestrict(progname, ""); // empty restrict - gflags_exitfunc(1); - - } else if (!FLAGS_helpon.empty()) { - string restrict = PATH_SEPARATOR + FLAGS_helpon + "."; - ShowUsageWithFlagsRestrict(progname, restrict.c_str()); - gflags_exitfunc(1); - - } else if (!FLAGS_helpmatch.empty()) { - ShowUsageWithFlagsRestrict(progname, FLAGS_helpmatch.c_str()); - gflags_exitfunc(1); - - } else if (FLAGS_helppackage) { - // Shows help for all files in the same directory as main(). We - // don't want to resort to looking at dirname(progname), because - // the user can pick progname, and it may not relate to the file - // where main() resides. So instead, we search the flags for a - // filename like "/progname.cc", and take the dirname of that. - vector flags; - GetAllFlags(&flags); - string last_package; - for (vector::const_iterator flag = flags.begin(); - flag != flags.end(); - ++flag) { - if (!FileMatchesSubstring(flag->filename, substrings)) - continue; - const string package = Dirname(flag->filename) + PATH_SEPARATOR; - if (package != last_package) { - ShowUsageWithFlagsRestrict(progname, package.c_str()); - VLOG(7) << "Found package: " << package; - if (!last_package.empty()) { // means this isn't our first pkg - LOG(WARNING) << "Multiple packages contain a file=" << progname; - } - last_package = package; - } - } - if (last_package.empty()) { // never found a package to print - LOG(WARNING) << "Unable to find a package for file=" << progname; - } - gflags_exitfunc(1); - - } else if (FLAGS_helpxml) { - ShowXMLOfFlags(progname); - gflags_exitfunc(1); - - } else if (FLAGS_version) { - ShowVersion(); - // Unlike help, we may be asking for version in a script, so return 0 - gflags_exitfunc(0); - - } -} - - -} // namespace GFLAGS_NAMESPACE diff --git a/inference-engine/samples/thirdparty/gflags/src/mutex.h b/inference-engine/samples/thirdparty/gflags/src/mutex.h deleted file mode 100644 index 7d7c364b795..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/mutex.h +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --- -// -// A simple mutex wrapper, supporting locks and read-write locks. -// You should assume the locks are *not* re-entrant. -// -// This class is meant to be internal-only and should be wrapped by an -// internal namespace. Before you use this module, please give the -// name of your internal namespace for this module. Or, if you want -// to expose it, you'll want to move it to the Google namespace. We -// cannot put this class in global namespace because there can be some -// problems when we have multiple versions of Mutex in each shared object. -// -// NOTE: by default, we have #ifdef'ed out the TryLock() method. -// This is for two reasons: -// 1) TryLock() under Windows is a bit annoying (it requires a -// #define to be defined very early). -// 2) TryLock() is broken for NO_THREADS mode, at least in NDEBUG -// mode. -// If you need TryLock(), and either these two caveats are not a -// problem for you, or you're willing to work around them, then -// feel free to #define GMUTEX_TRYLOCK, or to remove the #ifdefs -// in the code below. -// -// CYGWIN NOTE: Cygwin support for rwlock seems to be buggy: -// http://www.cygwin.com/ml/cygwin/2008-12/msg00017.html -// Because of that, we might as well use windows locks for -// cygwin. They seem to be more reliable than the cygwin pthreads layer. -// -// TRICKY IMPLEMENTATION NOTE: -// This class is designed to be safe to use during -// dynamic-initialization -- that is, by global constructors that are -// run before main() starts. The issue in this case is that -// dynamic-initialization happens in an unpredictable order, and it -// could be that someone else's dynamic initializer could call a -// function that tries to acquire this mutex -- but that all happens -// before this mutex's constructor has run. (This can happen even if -// the mutex and the function that uses the mutex are in the same .cc -// file.) Basically, because Mutex does non-trivial work in its -// constructor, it's not, in the naive implementation, safe to use -// before dynamic initialization has run on it. -// -// The solution used here is to pair the actual mutex primitive with a -// bool that is set to true when the mutex is dynamically initialized. -// (Before that it's false.) Then we modify all mutex routines to -// look at the bool, and not try to lock/unlock until the bool makes -// it to true (which happens after the Mutex constructor has run.) -// -// This works because before main() starts -- particularly, during -// dynamic initialization -- there are no threads, so a) it's ok that -// the mutex operations are a no-op, since we don't need locking then -// anyway; and b) we can be quite confident our bool won't change -// state between a call to Lock() and a call to Unlock() (that would -// require a global constructor in one translation unit to call Lock() -// and another global constructor in another translation unit to call -// Unlock() later, which is pretty perverse). -// -// That said, it's tricky, and can conceivably fail; it's safest to -// avoid trying to acquire a mutex in a global constructor, if you -// can. One way it can fail is that a really smart compiler might -// initialize the bool to true at static-initialization time (too -// early) rather than at dynamic-initialization time. To discourage -// that, we set is_safe_ to true in code (not the constructor -// colon-initializer) and set it to true via a function that always -// evaluates to true, but that the compiler can't know always -// evaluates to true. This should be good enough. -// -// A related issue is code that could try to access the mutex -// after it's been destroyed in the global destructors (because -// the Mutex global destructor runs before some other global -// destructor, that tries to acquire the mutex). The way we -// deal with this is by taking a constructor arg that global -// mutexes should pass in, that causes the destructor to do no -// work. We still depend on the compiler not doing anything -// weird to a Mutex's memory after it is destroyed, but for a -// static global variable, that's pretty safe. - -#ifndef GFLAGS_MUTEX_H_ -#define GFLAGS_MUTEX_H_ - -#include "gflags/gflags_declare.h" // to figure out pthreads support - -#if defined(NO_THREADS) - typedef int MutexType; // to keep a lock-count -#elif defined(OS_WINDOWS) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN // We only need minimal includes -# endif -# ifndef NOMINMAX -# define NOMINMAX // Don't want windows to override min()/max() -# endif -# ifdef GMUTEX_TRYLOCK - // We need Windows NT or later for TryEnterCriticalSection(). If you - // don't need that functionality, you can remove these _WIN32_WINNT - // lines, and change TryLock() to assert(0) or something. -# ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0400 -# endif -# endif -# include - typedef CRITICAL_SECTION MutexType; -#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK) - // Needed for pthread_rwlock_*. If it causes problems, you could take it - // out, but then you'd have to unset HAVE_RWLOCK (at least on linux -- it - // *does* cause problems for FreeBSD, or MacOSX, but isn't needed - // for locking there.) -# ifdef __linux__ -# if _XOPEN_SOURCE < 500 // including not being defined at all -# undef _XOPEN_SOURCE -# define _XOPEN_SOURCE 500 // may be needed to get the rwlock calls -# endif -# endif -# include - typedef pthread_rwlock_t MutexType; -#elif defined(HAVE_PTHREAD) -# include - typedef pthread_mutex_t MutexType; -#else -# error Need to implement mutex.h for your architecture, or #define NO_THREADS -#endif - -#include -#include // for abort() - -#define MUTEX_NAMESPACE gflags_mutex_namespace - -namespace MUTEX_NAMESPACE { - -class Mutex { - public: - // This is used for the single-arg constructor - enum LinkerInitialized { LINKER_INITIALIZED }; - - // Create a Mutex that is not held by anybody. This constructor is - // typically used for Mutexes allocated on the heap or the stack. - inline Mutex(); - // This constructor should be used for global, static Mutex objects. - // It inhibits work being done by the destructor, which makes it - // safer for code that tries to acqiure this mutex in their global - // destructor. - explicit inline Mutex(LinkerInitialized); - - // Destructor - inline ~Mutex(); - - inline void Lock(); // Block if needed until free then acquire exclusively - inline void Unlock(); // Release a lock acquired via Lock() -#ifdef GMUTEX_TRYLOCK - inline bool TryLock(); // If free, Lock() and return true, else return false -#endif - // Note that on systems that don't support read-write locks, these may - // be implemented as synonyms to Lock() and Unlock(). So you can use - // these for efficiency, but don't use them anyplace where being able - // to do shared reads is necessary to avoid deadlock. - inline void ReaderLock(); // Block until free or shared then acquire a share - inline void ReaderUnlock(); // Release a read share of this Mutex - inline void WriterLock() { Lock(); } // Acquire an exclusive lock - inline void WriterUnlock() { Unlock(); } // Release a lock from WriterLock() - - private: - MutexType mutex_; - // We want to make sure that the compiler sets is_safe_ to true only - // when we tell it to, and never makes assumptions is_safe_ is - // always true. volatile is the most reliable way to do that. - volatile bool is_safe_; - // This indicates which constructor was called. - bool destroy_; - - inline void SetIsSafe() { is_safe_ = true; } - - // Catch the error of writing Mutex when intending MutexLock. - explicit Mutex(Mutex* /*ignored*/) {} - // Disallow "evil" constructors - Mutex(const Mutex&); - void operator=(const Mutex&); -}; - -// Now the implementation of Mutex for various systems -#if defined(NO_THREADS) - -// When we don't have threads, we can be either reading or writing, -// but not both. We can have lots of readers at once (in no-threads -// mode, that's most likely to happen in recursive function calls), -// but only one writer. We represent this by having mutex_ be -1 when -// writing and a number > 0 when reading (and 0 when no lock is held). -// -// In debug mode, we assert these invariants, while in non-debug mode -// we do nothing, for efficiency. That's why everything is in an -// assert. - -Mutex::Mutex() : mutex_(0) { } -Mutex::Mutex(Mutex::LinkerInitialized) : mutex_(0) { } -Mutex::~Mutex() { assert(mutex_ == 0); } -void Mutex::Lock() { assert(--mutex_ == -1); } -void Mutex::Unlock() { assert(mutex_++ == -1); } -#ifdef GMUTEX_TRYLOCK -bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; } -#endif -void Mutex::ReaderLock() { assert(++mutex_ > 0); } -void Mutex::ReaderUnlock() { assert(mutex_-- > 0); } - -#elif defined(OS_WINDOWS) - -Mutex::Mutex() : destroy_(true) { - InitializeCriticalSection(&mutex_); - SetIsSafe(); -} -Mutex::Mutex(LinkerInitialized) : destroy_(false) { - InitializeCriticalSection(&mutex_); - SetIsSafe(); -} -Mutex::~Mutex() { if (destroy_) DeleteCriticalSection(&mutex_); } -void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); } -void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); } -#ifdef GMUTEX_TRYLOCK -bool Mutex::TryLock() { return is_safe_ ? - TryEnterCriticalSection(&mutex_) != 0 : true; } -#endif -void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks -void Mutex::ReaderUnlock() { Unlock(); } - -#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK) - -#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \ - if (is_safe_ && fncall(&mutex_) != 0) abort(); \ -} while (0) - -Mutex::Mutex() : destroy_(true) { - SetIsSafe(); - if (is_safe_ && pthread_rwlock_init(&mutex_, NULL) != 0) abort(); -} -Mutex::Mutex(Mutex::LinkerInitialized) : destroy_(false) { - SetIsSafe(); - if (is_safe_ && pthread_rwlock_init(&mutex_, NULL) != 0) abort(); -} -Mutex::~Mutex() { if (destroy_) SAFE_PTHREAD(pthread_rwlock_destroy); } -void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock); } -void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } -#ifdef GMUTEX_TRYLOCK -bool Mutex::TryLock() { return is_safe_ ? - pthread_rwlock_trywrlock(&mutex_) == 0 : true; } -#endif -void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock); } -void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } -#undef SAFE_PTHREAD - -#elif defined(HAVE_PTHREAD) - -#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \ - if (is_safe_ && fncall(&mutex_) != 0) abort(); \ -} while (0) - -Mutex::Mutex() : destroy_(true) { - SetIsSafe(); - if (is_safe_ && pthread_mutex_init(&mutex_, NULL) != 0) abort(); -} -Mutex::Mutex(Mutex::LinkerInitialized) : destroy_(false) { - SetIsSafe(); - if (is_safe_ && pthread_mutex_init(&mutex_, NULL) != 0) abort(); -} -Mutex::~Mutex() { if (destroy_) SAFE_PTHREAD(pthread_mutex_destroy); } -void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock); } -void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock); } -#ifdef GMUTEX_TRYLOCK -bool Mutex::TryLock() { return is_safe_ ? - pthread_mutex_trylock(&mutex_) == 0 : true; } -#endif -void Mutex::ReaderLock() { Lock(); } -void Mutex::ReaderUnlock() { Unlock(); } -#undef SAFE_PTHREAD - -#endif - -// -------------------------------------------------------------------------- -// Some helper classes - -// MutexLock(mu) acquires mu when constructed and releases it when destroyed. -class MutexLock { - public: - explicit MutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); } - ~MutexLock() { mu_->Unlock(); } - private: - Mutex * const mu_; - // Disallow "evil" constructors - MutexLock(const MutexLock&); - void operator=(const MutexLock&); -}; - -// ReaderMutexLock and WriterMutexLock do the same, for rwlocks -class ReaderMutexLock { - public: - explicit ReaderMutexLock(Mutex *mu) : mu_(mu) { mu_->ReaderLock(); } - ~ReaderMutexLock() { mu_->ReaderUnlock(); } - private: - Mutex * const mu_; - // Disallow "evil" constructors - ReaderMutexLock(const ReaderMutexLock&); - void operator=(const ReaderMutexLock&); -}; - -class WriterMutexLock { - public: - explicit WriterMutexLock(Mutex *mu) : mu_(mu) { mu_->WriterLock(); } - ~WriterMutexLock() { mu_->WriterUnlock(); } - private: - Mutex * const mu_; - // Disallow "evil" constructors - WriterMutexLock(const WriterMutexLock&); - void operator=(const WriterMutexLock&); -}; - -// Catch bug where variable name is omitted, e.g. MutexLock (&mu); -#define MutexLock(x) COMPILE_ASSERT(0, mutex_lock_decl_missing_var_name) -#define ReaderMutexLock(x) COMPILE_ASSERT(0, rmutex_lock_decl_missing_var_name) -#define WriterMutexLock(x) COMPILE_ASSERT(0, wmutex_lock_decl_missing_var_name) - -} // namespace MUTEX_NAMESPACE - - -#endif /* #define GFLAGS_MUTEX_H__ */ diff --git a/inference-engine/samples/thirdparty/gflags/src/util.h b/inference-engine/samples/thirdparty/gflags/src/util.h deleted file mode 100644 index 164e3cf86ab..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/util.h +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) 2011, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// --- -// -// Some generically useful utility routines that in google-land would -// be their own projects. We make a shortened version here. - -#ifndef GFLAGS_UTIL_H_ -#define GFLAGS_UTIL_H_ - -#include "config.h" - -#include -#ifdef HAVE_INTTYPES_H -# include -#endif -#include // for va_* -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_STAT_H -# include // for mkdir -#endif - - -namespace GFLAGS_NAMESPACE { - - -// This is used for unittests for death-testing. It is defined in gflags.cc. -extern GFLAGS_DLL_DECL void (*gflags_exitfunc)(int); - -// Work properly if either strtoll or strtoq is on this system. -#if defined(strtoll) || defined(HAVE_STRTOLL) -# define strto64 strtoll -# define strtou64 strtoull -#elif defined(HAVE_STRTOQ) -# define strto64 strtoq -# define strtou64 strtouq -// Neither strtoll nor strtoq are defined. I hope strtol works! -#else -# define strto64 strtol -# define strtou64 strtoul -#endif - -// If we have inttypes.h, it will have defined PRId32/etc for us. -// If not, take our best guess. -#ifndef PRId32 -# define PRId32 "d" -#endif -#ifndef PRId64 -# define PRId64 "lld" -#endif -#ifndef PRIu64 -# define PRIu64 "llu" -#endif - -typedef signed char int8; -typedef unsigned char uint8; - -// -- utility macros --------------------------------------------------------- - -template struct CompileAssert; -template <> struct CompileAssert {}; -#define COMPILE_ASSERT(expr, msg) \ - enum { assert_##msg = sizeof(CompileAssert) } - -// Returns the number of elements in an array. -#define arraysize(arr) (sizeof(arr)/sizeof(*(arr))) - - -// -- logging and testing --------------------------------------------------- - -// For now, we ignore the level for logging, and don't show *VLOG's at -// all, except by hand-editing the lines below -#define LOG(level) std::cerr -#define VLOG(level) if (true) {} else std::cerr -#define DVLOG(level) if (true) {} else std::cerr - -// CHECK dies with a fatal error if condition is not true. It is *not* -// controlled by NDEBUG, so the check will be executed regardless of -// compilation mode. Therefore, it is safe to do things like: -// CHECK(fp->Write(x) == 4) -// We allow stream-like objects after this for debugging, but they're ignored. -#define EXPECT_TRUE(condition) \ - if (true) { \ - if (!(condition)) { \ - fprintf(stderr, "Check failed: %s\n", #condition); \ - exit(1); \ - } \ - } else std::cerr << "" - -#define EXPECT_OP(op, val1, val2) \ - if (true) { \ - if (!((val1) op (val2))) { \ - fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \ - exit(1); \ - } \ - } else std::cerr << "" - -#define EXPECT_EQ(val1, val2) EXPECT_OP(==, val1, val2) -#define EXPECT_NE(val1, val2) EXPECT_OP(!=, val1, val2) -#define EXPECT_LE(val1, val2) EXPECT_OP(<=, val1, val2) -#define EXPECT_LT(val1, val2) EXPECT_OP(< , val1, val2) -#define EXPECT_GE(val1, val2) EXPECT_OP(>=, val1, val2) -#define EXPECT_GT(val1, val2) EXPECT_OP(> , val1, val2) -#define EXPECT_FALSE(cond) EXPECT_TRUE(!(cond)) - -// C99 declares isnan and isinf should be macros, so the #ifdef test -// should be reliable everywhere. Of course, it's not, but these -// are testing pertty marginal functionality anyway, so it's ok to -// not-run them even in situations they might, with effort, be made to work. -#ifdef isnan // Some compilers, like sun's for Solaris 10, don't define this -#define EXPECT_NAN(arg) \ - do { \ - if (!isnan(arg)) { \ - fprintf(stderr, "Check failed: isnan(%s)\n", #arg); \ - exit(1); \ - } \ - } while (0) -#else -#define EXPECT_NAN(arg) -#endif - -#ifdef isinf // Some compilers, like sun's for Solaris 10, don't define this -#define EXPECT_INF(arg) \ - do { \ - if (!isinf(arg)) { \ - fprintf(stderr, "Check failed: isinf(%s)\n", #arg); \ - exit(1); \ - } \ - } while (0) -#else -#define EXPECT_INF(arg) -#endif - -#define EXPECT_DOUBLE_EQ(val1, val2) \ - do { \ - if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \ - fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \ - exit(1); \ - } \ - } while (0) - -#define EXPECT_STREQ(val1, val2) \ - do { \ - if (strcmp((val1), (val2)) != 0) { \ - fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \ - exit(1); \ - } \ - } while (0) - -// Call this in a .cc file where you will later call RUN_ALL_TESTS in main(). -#define TEST_INIT \ - static std::vector g_testlist; /* the tests to run */ \ - static int RUN_ALL_TESTS() { \ - std::vector::const_iterator it; \ - for (it = g_testlist.begin(); it != g_testlist.end(); ++it) { \ - (*it)(); /* The test will error-exit if there's a problem. */ \ - } \ - fprintf(stderr, "\nPassed %d tests\n\nPASS\n", \ - static_cast(g_testlist.size())); \ - return 0; \ - } - -// Note that this macro uses a FlagSaver to keep tests isolated. -#define TEST(a, b) \ - struct Test_##a##_##b { \ - Test_##a##_##b() { g_testlist.push_back(&Run); } \ - static void Run() { \ - FlagSaver fs; \ - fprintf(stderr, "Running test %s/%s\n", #a, #b); \ - RunTest(); \ - } \ - static void RunTest(); \ - }; \ - static Test_##a##_##b g_test_##a##_##b; \ - void Test_##a##_##b::RunTest() - -// This is a dummy class that eases the google->opensource transition. -namespace testing { -class Test {}; -} - -// Call this in a .cc file where you will later call EXPECT_DEATH -#define EXPECT_DEATH_INIT \ - static bool g_called_exit; \ - static void CalledExit(int) { g_called_exit = true; } - -#define EXPECT_DEATH(fn, msg) \ - do { \ - g_called_exit = false; \ - gflags_exitfunc = &CalledExit; \ - fn; \ - gflags_exitfunc = &exit; /* set back to its default */ \ - if (!g_called_exit) { \ - fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \ - exit(1); \ - } \ - } while (0) - -#define GTEST_HAS_DEATH_TEST 1 - -// -- path routines ---------------------------------------------------------- - -// Tries to create the directory path as a temp-dir. If it fails, -// changes path to some directory it *can* create. -#if defined(__MINGW32__) -#include -inline void MakeTmpdir(std::string* path) { - if (!path->empty()) { - path->append("/gflags_unittest_testdir"); - int err = mkdir(path->c_str()); - if (err == 0 || errno == EEXIST) return; - } - // I had trouble creating a directory in /tmp from mingw - *path = "./gflags_unittest"; - mkdir(path->c_str()); -} -#elif defined(_MSC_VER) -#include -inline void MakeTmpdir(std::string* path) { - if (!path->empty()) { - int err = _mkdir(path->c_str()); - if (err == 0 || errno == EEXIST) return; - } - char tmppath_buffer[1024]; - int tmppath_len = GetTempPathA(sizeof(tmppath_buffer), tmppath_buffer); - assert(tmppath_len > 0 && tmppath_len < sizeof(tmppath_buffer)); - assert(tmppath_buffer[tmppath_len - 1] == '\\'); // API guarantees it - *path = std::string(tmppath_buffer) + "gflags_unittest"; - _mkdir(path->c_str()); -} -#else -inline void MakeTmpdir(std::string* path) { - if (!path->empty()) { - int err = mkdir(path->c_str(), 0755); - if (err == 0 || errno == EEXIST) return; - } - mkdir("/tmp/gflags_unittest", 0755); -} -#endif - -// -- string routines -------------------------------------------------------- - -inline void InternalStringPrintf(std::string* output, const char* format, - va_list ap) { - char space[128]; // try a small buffer and hope it fits - - // It's possible for methods that use a va_list to invalidate - // the data in it upon use. The fix is to make a copy - // of the structure before using it and use that copy instead. - va_list backup_ap; - va_copy(backup_ap, ap); - int bytes_written = vsnprintf(space, sizeof(space), format, backup_ap); - va_end(backup_ap); - - if ((bytes_written >= 0) && (static_cast(bytes_written) < sizeof(space))) { - output->append(space, bytes_written); - return; - } - - // Repeatedly increase buffer size until it fits. - int length = sizeof(space); - while (true) { - if (bytes_written < 0) { - // Older snprintf() behavior. :-( Just try doubling the buffer size - length *= 2; - } else { - // We need exactly "bytes_written+1" characters - length = bytes_written+1; - } - char* buf = new char[length]; - - // Restore the va_list before we use it again - va_copy(backup_ap, ap); - bytes_written = vsnprintf(buf, length, format, backup_ap); - va_end(backup_ap); - - if ((bytes_written >= 0) && (bytes_written < length)) { - output->append(buf, bytes_written); - delete[] buf; - return; - } - delete[] buf; - } -} - -// Clears output before writing to it. -inline void SStringPrintf(std::string* output, const char* format, ...) { - va_list ap; - va_start(ap, format); - output->clear(); - InternalStringPrintf(output, format, ap); - va_end(ap); -} - -inline void StringAppendF(std::string* output, const char* format, ...) { - va_list ap; - va_start(ap, format); - InternalStringPrintf(output, format, ap); - va_end(ap); -} - -inline std::string StringPrintf(const char* format, ...) { - va_list ap; - va_start(ap, format); - std::string output; - InternalStringPrintf(&output, format, ap); - va_end(ap); - return output; -} - -inline bool SafeGetEnv(const char *varname, std::string &valstr) -{ -#if defined(_MSC_VER) && _MSC_VER >= 1400 - char *val; - size_t sz; - if (_dupenv_s(&val, &sz, varname) != 0 || !val) return false; - valstr = val; - free(val); -#else - const char * const val = getenv(varname); - if (!val) return false; - valstr = val; -#endif - return true; -} - -inline int SafeFOpen(FILE **fp, const char* fname, const char *mode) -{ -#if defined(_MSC_VER) && _MSC_VER >= 1400 - return fopen_s(fp, fname, mode); -#else - assert(fp != NULL); - *fp = fopen(fname, mode); - // errno only guaranteed to be set on failure - return ((*fp == NULL) ? errno : 0); -#endif -} - - -} // namespace GFLAGS_NAMESPACE - - -#endif // GFLAGS_UTIL_H_ diff --git a/inference-engine/samples/thirdparty/gflags/src/windows_port.cc b/inference-engine/samples/thirdparty/gflags/src/windows_port.cc deleted file mode 100644 index b5b7194c9a4..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/windows_port.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (c) 2009, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * --- - * Author: Craig Silverstein - */ - -#ifndef _WIN32 -# error You should only be including windows/port.cc in a windows environment! -#endif - -#include // for strlen(), memset(), memcmp() -#include -#include // for va_list, va_start, va_end -#include - -#include "windows_port.h" - -// These call the windows _vsnprintf, but always NUL-terminate. -#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */ -#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */ - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4996) // ignore _vsnprintf security warning -#endif -int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) { - if (size == 0) // not even room for a \0? - return -1; // not what C99 says to do, but what windows does - str[size-1] = '\0'; - return _vsnprintf(str, size-1, format, ap); -} -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -int snprintf(char *str, size_t size, const char *format, ...) { - int r; - va_list ap; - va_start(ap, format); - r = vsnprintf(str, size, format, ap); - va_end(ap); - return r; -} - -#endif /* if !(defined(_MSC_VER) && _MSC_VER >= 1900) */ -#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */ diff --git a/inference-engine/samples/thirdparty/gflags/src/windows_port.h b/inference-engine/samples/thirdparty/gflags/src/windows_port.h deleted file mode 100644 index 61cf5b7e3a1..00000000000 --- a/inference-engine/samples/thirdparty/gflags/src/windows_port.h +++ /dev/null @@ -1,133 +0,0 @@ -/* Copyright (c) 2009, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * --- - * Author: Craig Silverstein - * - * These are some portability typedefs and defines to make it a bit - * easier to compile this code under VC++. - * - * Several of these are taken from glib: - * http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html - */ - -#ifndef GFLAGS_WINDOWS_PORT_H_ -#define GFLAGS_WINDOWS_PORT_H_ - -#include "config.h" - -// This must be defined before the windows.h is included. -// It's needed for mutex.h, to give access to the TryLock method. -# if !defined(_WIN32_WINNT) && !(defined( __MINGW32__) || defined(__MINGW64__)) -# define _WIN32_WINNT 0x0400 -# endif -// We always want minimal includes -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -#include -#include /* for mkdir */ -#include /* for _putenv, getenv */ -#include /* need this to override stdio's snprintf, also defines _unlink used by unit tests */ -#include /* util.h uses va_copy */ -#include /* for _stricmp and _strdup */ - -/* We can't just use _vsnprintf and _snprintf as drop-in-replacements, - * because they don't always NUL-terminate. :-( We also can't use the - * name vsnprintf, since windows defines that (but not snprintf (!)). - */ -#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */ -#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */ -extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size, - const char *format, ...); -extern int GFLAGS_DLL_DECL safe_vsnprintf(char *str, size_t size, - const char *format, va_list ap); -#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap) -#define va_copy(dst, src) (dst) = (src) -#endif -#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */ - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4996) // ignore getenv security warning -#endif -inline void setenv(const char* name, const char* value, int) { - // In windows, it's impossible to set a variable to the empty string. - // We handle this by setting it to "0" and the NUL-ing out the \0. - // That is, we putenv("FOO=0") and then find out where in memory the - // putenv wrote "FOO=0", and change it in-place to "FOO=\0". - // c.f. http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/environ.cpp?r1=611451&r2=637508&pathrev=637508 - static const char* const kFakeZero = "0"; - if (*value == '\0') - value = kFakeZero; - // Apparently the semantics of putenv() is that the input - // must live forever, so we leak memory here. :-( - const size_t nameval_len = strlen(name) + 1 + strlen(value) + 1; - char* nameval = reinterpret_cast(malloc(nameval_len)); - snprintf(nameval, nameval_len, "%s=%s", name, value); - _putenv(nameval); - if (value == kFakeZero) { - nameval[nameval_len - 2] = '\0'; // works when putenv() makes no copy - if (*getenv(name) != '\0') - *getenv(name) = '\0'; // works when putenv() copies nameval - } -} -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#define strcasecmp _stricmp - -#if defined(_MSC_VER) && _MSC_VER >= 1400 -#define strdup _strdup -#define unlink _unlink -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1800 -#include -#else -#define PRId32 "d" -#define PRIu32 "u" -#define PRId64 "I64d" -#define PRIu64 "I64u" -#endif - -#if !defined(__MINGW32__) && !defined(__MINGW64__) -#define strtoq _strtoi64 -#define strtouq _strtoui64 -#define strtoll _strtoi64 -#define strtoull _strtoui64 -#define atoll _atoi64 -#endif - -#ifndef PATH_MAX -#define PATH_MAX 1024 -#endif - -#endif /* GFLAGS_WINDOWS_PORT_H_ */ diff --git a/inference-engine/samples/thirdparty/gflags/test/CMakeLists.txt b/inference-engine/samples/thirdparty/gflags/test/CMakeLists.txt deleted file mode 100644 index 4cd1e69702a..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/CMakeLists.txt +++ /dev/null @@ -1,209 +0,0 @@ -## gflags tests - -# ---------------------------------------------------------------------------- -# output directories -set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") -set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") -set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") - -# set working directory of test commands -set (GFLAGS_FLAGFILES_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - -# ---------------------------------------------------------------------------- -# common include directories and link libraries -include_directories ("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories ("${gflags_SOURCE_DIR}/src") -include_directories ("${gflags_BINARY_DIR}/include") -include_directories ("${gflags_BINARY_DIR}/include/gflags") - -if (BUILD_SHARED_LIBS) - set (type shared) - if (GFLAGS_IS_A_DLL) - add_definitions(-DGFLAGS_IS_A_DLL) - endif () -else () - set (type static) -endif () -if (BUILD_gflags_LIB) - link_libraries (gflags_${type}) -else () - link_libraries (gflags_nothreads_${type}) -endif () - -# ---------------------------------------------------------------------------- -# STRIP_FLAG_HELP -add_executable (gflags_strip_flags_test gflags_strip_flags_test.cc) -# Make sure the --help output doesn't print the stripped text. -add_gflags_test (strip_flags_help 1 "" "This text should be stripped out" gflags_strip_flags_test --help) -# Make sure the stripped text isn't in the binary at all. -add_test ( - NAME strip_flags_binary - COMMAND "${CMAKE_COMMAND}" "-DBINARY=$" - -P "${CMAKE_CURRENT_SOURCE_DIR}/gflags_strip_flags_test.cmake" - CONFIGURATIONS Release MinSizeRel -) - -# ---------------------------------------------------------------------------- -# unit tests -configure_file (gflags_unittest.cc gflags_unittest-main.cc COPYONLY) -configure_file (gflags_unittest.cc gflags_unittest_main.cc COPYONLY) - -add_executable (gflags_unittest gflags_unittest.cc) -add_executable (gflags_unittest-main gflags_unittest-main.cc) -add_executable (gflags_unittest_main gflags_unittest_main.cc) - -if (OS_WINDOWS) - set (SLASH "\\\\") -else () - set (SLASH "/") -endif () - -# First, just make sure the gflags_unittest works as-is -add_gflags_test(unittest 0 "" "" gflags_unittest) - -# --help should show all flags, including flags from gflags_reporting -add_gflags_test(help-reporting 1 "${SLASH}gflags_reporting.cc:" "" gflags_unittest --help) - -# Make sure that --help prints even very long helpstrings. -add_gflags_test(long-helpstring 1 "end of a long helpstring" "" gflags_unittest --help) - -# Make sure --help reflects flag changes made before flag-parsing -add_gflags_test(changed_bool1 1 "-changed_bool1 (changed) type: bool default: true" "" gflags_unittest --help) -add_gflags_test(changed_bool2 1 "-changed_bool2 (changed) type: bool default: false currently: true" "" gflags_unittest --help) -# And on the command-line, too -add_gflags_test(changeable_string_var 1 "-changeable_string_var () type: string default: \"1\" currently: \"2\"" "" gflags_unittest --changeable_string_var 2 --help) - -# --nohelp and --help=false should be as if we didn't say anything -add_gflags_test(nohelp 0 "PASS" "" gflags_unittest --nohelp) -add_gflags_test(help=false 0 "PASS" "" gflags_unittest --help=false) - -# --helpfull is the same as help -add_gflags_test(helpfull 1 "${SLASH}gflags_reporting.cc:" "" gflags_unittest --helpfull) - -# --helpshort should show only flags from the gflags_unittest itself -add_gflags_test(helpshort 1 "${SLASH}gflags_unittest.cc:" "${SLASH}gflags_reporting.cc:" gflags_unittest --helpshort) - -# --helpshort should show the tldflag we created in the gflags_unittest dir -add_gflags_test(helpshort-tldflag1 1 "tldflag1" "${SLASH}google.cc:" gflags_unittest --helpshort) -add_gflags_test(helpshort-tldflag2 1 "tldflag2" "${SLASH}google.cc:" gflags_unittest --helpshort) - -# --helpshort should work if the main source file is suffixed with [_-]main -add_gflags_test(helpshort-main 1 "${SLASH}gflags_unittest-main.cc:" "${SLASH}gflags_reporting.cc:" gflags_unittest-main --helpshort) -add_gflags_test(helpshort_main 1 "${SLASH}gflags_unittest_main.cc:" "${SLASH}gflags_reporting.cc:" gflags_unittest_main --helpshort) - -# --helpon needs an argument -add_gflags_test(helpon 1 "'--helpon' is missing its argument; flag description: show help on" "" gflags_unittest --helpon) -# --helpon argument indicates what file we'll show args from -add_gflags_test(helpon=gflags 1 "${SLASH}gflags.cc:" "${SLASH}gflags_unittest.cc:" gflags_unittest --helpon=gflags) -# another way of specifying the argument -add_gflags_test(helpon_gflags 1 "${SLASH}gflags.cc:" "${SLASH}gflags_unittest.cc:" gflags_unittest --helpon gflags) -# test another argument -add_gflags_test(helpon=gflags_unittest 1 "${SLASH}gflags_unittest.cc:" "${SLASH}gflags.cc:" gflags_unittest --helpon=gflags_unittest) - -# helpmatch is like helpon but takes substrings -add_gflags_test(helpmatch_reporting 1 "${SLASH}gflags_reporting.cc:" "${SLASH}gflags_unittest.cc:" gflags_unittest -helpmatch reporting) -add_gflags_test(helpmatch=unittest 1 "${SLASH}gflags_unittest.cc:" "${SLASH}gflags.cc:" gflags_unittest -helpmatch=unittest) - -# if no flags are found with helpmatch or helpon, suggest --help -add_gflags_test(helpmatch=nosuchsubstring 1 "No modules matched" "${SLASH}gflags_unittest.cc:" gflags_unittest -helpmatch=nosuchsubstring) -add_gflags_test(helpon=nosuchmodule 1 "No modules matched" "${SLASH}gflags_unittest.cc:" gflags_unittest -helpon=nosuchmodule) - -# helppackage shows all the flags in the same dir as this unittest -# --help should show all flags, including flags from google.cc -add_gflags_test(helppackage 1 "${SLASH}gflags_reporting.cc:" "" gflags_unittest --helppackage) - -# xml! -add_gflags_test(helpxml 1 "${SLASH}gflags_unittest.cc" "${SLASH}gflags_unittest.cc:" gflags_unittest --helpxml) - -# just print the version info and exit -add_gflags_test(version-1 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --version) -add_gflags_test(version-2 0 "version test_version" "${SLASH}gflags_unittest.cc:" gflags_unittest --version) - -# --undefok is a fun flag... -add_gflags_test(undefok-1 1 "unknown command line flag 'foo'" "" gflags_unittest --undefok= --foo --unused_bool) -add_gflags_test(undefok-2 0 "PASS" "" gflags_unittest --undefok=foo --foo --unused_bool) -# If you say foo is ok to be undefined, we'll accept --nofoo as well -add_gflags_test(undefok-3 0 "PASS" "" gflags_unittest --undefok=foo --nofoo --unused_bool) -# It's ok if the foo is in the middle -add_gflags_test(undefok-4 0 "PASS" "" gflags_unittest --undefok=fee,fi,foo,fum --foo --unused_bool) -# But the spelling has to be just right... -add_gflags_test(undefok-5 1 "unknown command line flag 'foo'" "" gflags_unittest --undefok=fo --foo --unused_bool) -add_gflags_test(undefok-6 1 "unknown command line flag 'foo'" "" gflags_unittest --undefok=foot --foo --unused_bool) - -# See if we can successfully load our flags from the flagfile -add_gflags_test(flagfile.1 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest "--flagfile=flagfile.1") -add_gflags_test(flagfile.2 0 "PASS" "" gflags_unittest "--flagfile=flagfile.2") -add_gflags_test(flagfile.3 0 "PASS" "" gflags_unittest "--flagfile=flagfile.3") - -# Also try to load flags from the environment -add_gflags_test(fromenv=version 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --fromenv=version) -add_gflags_test(tryfromenv=version 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --tryfromenv=version) -add_gflags_test(fromenv=help 0 "PASS" "" gflags_unittest --fromenv=help) -add_gflags_test(tryfromenv=help 0 "PASS" "" gflags_unittest --tryfromenv=help) -add_gflags_test(fromenv=helpfull 1 "helpfull not found in environment" "" gflags_unittest --fromenv=helpfull) -add_gflags_test(tryfromenv=helpfull 0 "PASS" "" gflags_unittest --tryfromenv=helpfull) -add_gflags_test(tryfromenv=undefok 0 "PASS" "" gflags_unittest --tryfromenv=undefok --foo) -add_gflags_test(tryfromenv=weirdo 1 "unknown command line flag" "" gflags_unittest --tryfromenv=weirdo) -add_gflags_test(tryfromenv-multiple 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --tryfromenv=test_bool,version,unused_bool) -add_gflags_test(fromenv=test_bool 1 "not found in environment" "" gflags_unittest --fromenv=test_bool) -add_gflags_test(fromenv=test_bool-ok 1 "unknown command line flag" "" gflags_unittest --fromenv=test_bool,ok) -# Here, the --version overrides the fromenv -add_gflags_test(version-overrides-fromenv 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --fromenv=test_bool,version,ok) - -# Make sure -- by itself stops argv processing -add_gflags_test(dashdash 0 "PASS" "" gflags_unittest -- --help) - -# And we should die if the flag value doesn't pass the validator -add_gflags_test(always_fail 1 "ERROR: failed validation of new value 'true' for flag 'always_fail'" "" gflags_unittest --always_fail) - -# And if locking in validators fails -# TODO(andreas): Worked on Windows 7 Release configuration, but causes -# debugger abort() intervention in case of Debug configuration. -#add_gflags_test(deadlock_if_cant_lock 0 "PASS" "" gflags_unittest --deadlock_if_cant_lock) - -# ---------------------------------------------------------------------------- -# use gflags_declare.h -add_executable (gflags_declare_test gflags_declare_test.cc gflags_declare_flags.cc) - -add_test(NAME gflags_declare COMMAND gflags_declare_test --message "Hello gflags!") -set_tests_properties(gflags_declare PROPERTIES PASS_REGULAR_EXPRESSION "Hello gflags!") - -# ---------------------------------------------------------------------------- -# configure Python script which configures and builds a test project -if (BUILD_NC_TESTS OR BUILD_CONFIG_TESTS) - find_package (PythonInterp) - if (NOT PYTHON_EXECUTABLE) - message (FATAL_ERROR "No Python installation found! It is required by the (negative) compilation tests." - " Either install Python or set BUILD_NC_TESTS and BUILD_CONFIG_TESTS to FALSE.") - endif () - set (TMPDIR "${PROJECT_BINARY_DIR}/Testing/Temporary") - configure_file (gflags_build.py.in "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/build.py" @ONLY) - function (add_gflags_build_test name srcdir expect_fail) - set (srcdir "${CMAKE_CURRENT_SOURCE_DIR}/${srcdir}") - add_test ( - NAME "${name}" - COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/build.py" - ${name} ${srcdir} ${expect_fail} - ) - endfunction () -endif () - -# ---------------------------------------------------------------------------- -# negative compilation tests -option (BUILD_NC_TESTS "Request addition of negative compilation tests." OFF) -mark_as_advanced (BUILD_NC_TESTS) -if (BUILD_NC_TESTS) - add_gflags_build_test (nc_sanity nc 0) - add_gflags_build_test (nc_swapped_args nc 1) - add_gflags_build_test (nc_int_instead_of_bool nc 1) - add_gflags_build_test (nc_bool_in_quotes nc 1) - add_gflags_build_test (nc_define_string_with_0 nc 1) -endif () - -# ---------------------------------------------------------------------------- -# build configuration test -option (BUILD_CONFIG_TESTS "Request addition of package configuration tests." OFF) -mark_as_advanced (BUILD_CONFIG_TESTS) -if (BUILD_CONFIG_TESTS) - add_gflags_build_test (cmake_config config 0) -endif () diff --git a/inference-engine/samples/thirdparty/gflags/test/config/CMakeLists.txt b/inference-engine/samples/thirdparty/gflags/test/config/CMakeLists.txt deleted file mode 100644 index c54f54b71ce..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/config/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -## gflags package configuration tests - -cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) - -project (gflags_${TEST_NAME}) - -find_package (gflags REQUIRED) - -add_executable (foo main.cc) -target_link_libraries (foo gflags) diff --git a/inference-engine/samples/thirdparty/gflags/test/config/main.cc b/inference-engine/samples/thirdparty/gflags/test/config/main.cc deleted file mode 100644 index 3c033e3afbb..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/config/main.cc +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -DEFINE_string(message, "Hello World!", "The message to print"); - -static bool ValidateMessage(const char* flagname, const std::string &message) -{ - return !message.empty(); -} -DEFINE_validator(message, ValidateMessage); - -int main(int argc, char **argv) -{ - gflags::SetUsageMessage("Test CMake configuration of gflags library (gflags-config.cmake)"); - gflags::SetVersionString("0.1"); - gflags::ParseCommandLineFlags(&argc, &argv, true); - std::cout << FLAGS_message << std::endl; - gflags::ShutDownCommandLineFlags(); - return 0; -} diff --git a/inference-engine/samples/thirdparty/gflags/test/flagfile.1 b/inference-engine/samples/thirdparty/gflags/test/flagfile.1 deleted file mode 100644 index e0f921769cf..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/flagfile.1 +++ /dev/null @@ -1 +0,0 @@ ---version \ No newline at end of file diff --git a/inference-engine/samples/thirdparty/gflags/test/flagfile.2 b/inference-engine/samples/thirdparty/gflags/test/flagfile.2 deleted file mode 100644 index 864f8e8a138..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/flagfile.2 +++ /dev/null @@ -1,2 +0,0 @@ ---foo=bar ---nounused_bool \ No newline at end of file diff --git a/inference-engine/samples/thirdparty/gflags/test/flagfile.3 b/inference-engine/samples/thirdparty/gflags/test/flagfile.3 deleted file mode 100644 index 76d92bb1e0f..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/flagfile.3 +++ /dev/null @@ -1 +0,0 @@ ---flagfile=flagfile.2 \ No newline at end of file diff --git a/inference-engine/samples/thirdparty/gflags/test/gflags_build.py.in b/inference-engine/samples/thirdparty/gflags/test/gflags_build.py.in deleted file mode 100644 index a8cba2bf5c0..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/gflags_build.py.in +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python - -import os -import sys -import subprocess -import shutil - -CMAKE = '@CMAKE_COMMAND@' -CMAKE_BUILD_TYPE = '@CMAKE_BUILD_TYPE@' -TMPDIR = '@TMPDIR@' -SRCDIR = '@SRCDIR@' -GFLAGS_DIR = '@gflags_BINARY_DIR@' - -if __name__ == "__main__": - if len(sys.argv) != 4: - sys.stderr.write(' '.join(['usage:', sys.argv[0], ' \n'])) - sys.exit(1) - test_name = sys.argv[1] - srcdir = sys.argv[2] - expect_fail = (sys.argv[3].lower() in ['true', 'yes', 'on', '1']) - bindir = os.path.join(TMPDIR, test_name) - if TMPDIR == '': - sys.stderr.write('Temporary directory not set!\n') - sys.exit(1) - # create build directory - if os.path.isdir(bindir): shutil.rmtree(bindir) - os.makedirs(bindir) - # configure the build tree - if subprocess.call([CMAKE, '-DCMAKE_BUILD_TYPE:STRING='+CMAKE_BUILD_TYPE, - '-Dgflags_DIR:PATH='+GFLAGS_DIR, - '-DTEST_NAME:STRING='+test_name, srcdir], cwd=bindir) != 0: - sys.stderr.write('Failed to configure the build tree!\n') - sys.exit(1) - # build the test project - exit_code = subprocess.call([CMAKE, '--build', bindir, '--config', CMAKE_BUILD_TYPE], cwd=bindir) - if expect_fail == True: - if exit_code == 0: - sys.stderr.write('Build expected to fail, but it succeeded!\n') - sys.exit(1) - else: - sys.stderr.write('Build failed as expected\n') - exit_code = 0 - sys.exit(exit_code) diff --git a/inference-engine/samples/thirdparty/gflags/test/gflags_declare_flags.cc b/inference-engine/samples/thirdparty/gflags/test/gflags_declare_flags.cc deleted file mode 100644 index 3d952a88ea0..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/gflags_declare_flags.cc +++ /dev/null @@ -1,12 +0,0 @@ -#define GFLAGS_DLL_DECLARE_FLAG - -#include -#include - -DECLARE_string(message); // in gflags_delcare_test.cc - -void print_message(); -void print_message() -{ - std::cout << FLAGS_message << std::endl; -} diff --git a/inference-engine/samples/thirdparty/gflags/test/gflags_declare_test.cc b/inference-engine/samples/thirdparty/gflags/test/gflags_declare_test.cc deleted file mode 100644 index 707bcc07d03..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/gflags_declare_test.cc +++ /dev/null @@ -1,12 +0,0 @@ -#include - -DEFINE_string(message, "", "The message to print"); -void print_message(); // in gflags_declare_flags.cc - -int main(int argc, char **argv) -{ - gflags::SetUsageMessage("Test compilation and use of gflags_declare.h"); - gflags::ParseCommandLineFlags(&argc, &argv, true); - print_message(); - return 0; -} diff --git a/inference-engine/samples/thirdparty/gflags/test/gflags_strip_flags_test.cc b/inference-engine/samples/thirdparty/gflags/test/gflags_strip_flags_test.cc deleted file mode 100644 index 143f0c68daf..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/gflags_strip_flags_test.cc +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2011, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --- -// Author: csilvers@google.com (Craig Silverstein) -// -// A simple program that uses STRIP_FLAG_HELP. We'll have a shell -// script that runs 'strings' over this program and makes sure -// that the help string is not in there. - -#define STRIP_FLAG_HELP 1 -#include - -#include - -using GFLAGS_NAMESPACE::SetUsageMessage; -using GFLAGS_NAMESPACE::ParseCommandLineFlags; - - -DEFINE_bool(test, true, "This text should be stripped out"); - -int main(int argc, char** argv) { - SetUsageMessage("Usage message"); - ParseCommandLineFlags(&argc, &argv, false); - - // Unfortunately, for us, libtool can replace executables with a shell - // script that does some work before calling the 'real' executable - // under a different name. We need the 'real' executable name to run - // 'strings' on it, so we construct this binary to print the real - // name (argv[0]) on stdout when run. - puts(argv[0]); - - return 0; -} diff --git a/inference-engine/samples/thirdparty/gflags/test/gflags_strip_flags_test.cmake b/inference-engine/samples/thirdparty/gflags/test/gflags_strip_flags_test.cmake deleted file mode 100644 index 5bb5cc1a1fb..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/gflags_strip_flags_test.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if (NOT BINARY) - message (FATAL_ERROR "BINARY file to check not specified!") -endif () -file (STRINGS "${BINARY}" strings REGEX "This text should be stripped out") -if (strings) - message (FATAL_ERROR "Text not stripped from binary like it should be: ${BINARY}") -endif () diff --git a/inference-engine/samples/thirdparty/gflags/test/gflags_unittest.cc b/inference-engine/samples/thirdparty/gflags/test/gflags_unittest.cc deleted file mode 100644 index 9a922efdadd..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/gflags_unittest.cc +++ /dev/null @@ -1,1572 +0,0 @@ -// Copyright (c) 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// -// For now, this unit test does not cover all features of -// gflags.cc - -#include - -#include "config.h" -#include "util.h" - -#include // for isinf() and isnan() -#include -#include -#include -#ifdef HAVE_UNISTD_H -# include // for unlink() -#endif -#include -#include -TEST_INIT -EXPECT_DEATH_INIT - -// I don't actually use this header file, but #include it under the -// old location to make sure that the include-header-forwarding -// works. But don't bother on windows; the windows port is so new -// it never had the old location-names. -#ifndef _MSC_VER -#include -void (*unused_fn)() = &GFLAGS_NAMESPACE::HandleCommandLineCompletions; -#endif - -using std::string; -using std::vector; -using GFLAGS_NAMESPACE::int32; -using GFLAGS_NAMESPACE::FlagRegisterer; -using GFLAGS_NAMESPACE::StringFromEnv; -using GFLAGS_NAMESPACE::RegisterFlagValidator; -using GFLAGS_NAMESPACE::CommandLineFlagInfo; -using GFLAGS_NAMESPACE::GetAllFlags; - -DEFINE_string(test_tmpdir, "", "Dir we use for temp files"); -DEFINE_string(srcdir, StringFromEnv("SRCDIR", "."), "Source-dir root, needed to find gflags_unittest_flagfile"); - -DECLARE_string(tryfromenv); // in gflags.cc - -DEFINE_bool(test_bool, false, "tests bool-ness"); -DEFINE_int32(test_int32, -1, ""); -DEFINE_int64(test_int64, -2, ""); -DEFINE_uint32(test_uint32, 1, ""); -DEFINE_uint64(test_uint64, 2, ""); -DEFINE_double(test_double, -1.0, ""); -DEFINE_string(test_string, "initial", ""); - -// -// The below ugliness gets some additional code coverage in the -helpxml -// and -helpmatch test cases having to do with string lengths and formatting -// -DEFINE_bool(test_bool_with_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_long_name, - false, - "extremely_extremely_extremely_extremely_extremely_extremely_extremely_extremely_long_meaning"); - -DEFINE_string(test_str1, "initial", ""); -DEFINE_string(test_str2, "initial", ""); -DEFINE_string(test_str3, "initial", ""); - -// This is used to test setting tryfromenv manually -DEFINE_string(test_tryfromenv, "initial", ""); - -// Don't try this at home! -static int changeable_var = 12; -DEFINE_int32(changeable_var, ++changeable_var, ""); - -static int changeable_bool_var = 8008; -DEFINE_bool(changeable_bool_var, ++changeable_bool_var == 8009, ""); - -static int changeable_string_var = 0; -static string ChangeableString() { - char r[] = {static_cast('0' + ++changeable_string_var), '\0'}; - return r; -} -DEFINE_string(changeable_string_var, ChangeableString(), ""); - -// These are never used in this unittest, but can be used by -// gflags_unittest.sh when it needs to specify flags -// that are legal for gflags_unittest but don't need to -// be a particular value. -DEFINE_bool(unused_bool, true, "unused bool-ness"); -DEFINE_int32(unused_int32, -1001, ""); -DEFINE_int64(unused_int64, -2001, ""); -DEFINE_uint32(unused_uint32, 1000, ""); -DEFINE_uint64(unused_uint64, 2000, ""); -DEFINE_double(unused_double, -1000.0, ""); -DEFINE_string(unused_string, "unused", ""); - -// These flags are used by gflags_unittest.sh -DEFINE_bool(changed_bool1, false, "changed"); -DEFINE_bool(changed_bool2, false, "changed"); -DEFINE_bool(long_helpstring, false, - "This helpstring goes on forever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever. This is the end of a long helpstring"); - - -static bool AlwaysFail(const char* flag, bool value) { return value == false; } -DEFINE_bool(always_fail, false, "will fail to validate when you set it"); -DEFINE_validator(always_fail, AlwaysFail); - -// See the comment by GetAllFlags in gflags.h -static bool DeadlockIfCantLockInValidators(const char* flag, bool value) { - if (!value) { - return true; - } - vector dummy; - GetAllFlags(&dummy); - return true; -} -DEFINE_bool(deadlock_if_cant_lock, - false, - "will deadlock if set to true and " - "if locking of registry in validators fails."); -DEFINE_validator(deadlock_if_cant_lock, DeadlockIfCantLockInValidators); - -#define MAKEFLAG(x) DEFINE_int32(test_flag_num##x, x, "Test flag") - -// Define 10 flags -#define MAKEFLAG10(x) \ - MAKEFLAG(x##0); \ - MAKEFLAG(x##1); \ - MAKEFLAG(x##2); \ - MAKEFLAG(x##3); \ - MAKEFLAG(x##4); \ - MAKEFLAG(x##5); \ - MAKEFLAG(x##6); \ - MAKEFLAG(x##7); \ - MAKEFLAG(x##8); \ - MAKEFLAG(x##9) - -// Define 100 flags -#define MAKEFLAG100(x) \ - MAKEFLAG10(x##0); \ - MAKEFLAG10(x##1); \ - MAKEFLAG10(x##2); \ - MAKEFLAG10(x##3); \ - MAKEFLAG10(x##4); \ - MAKEFLAG10(x##5); \ - MAKEFLAG10(x##6); \ - MAKEFLAG10(x##7); \ - MAKEFLAG10(x##8); \ - MAKEFLAG10(x##9) - -// Define a bunch of command-line flags. Each occurrence of the MAKEFLAG100 -// macro defines 100 integer flags. This lets us test the effect of having -// many flags on startup time. -MAKEFLAG100(1); -MAKEFLAG100(2); -MAKEFLAG100(3); -MAKEFLAG100(4); -MAKEFLAG100(5); -MAKEFLAG100(6); -MAKEFLAG100(7); -MAKEFLAG100(8); -MAKEFLAG100(9); -MAKEFLAG100(10); -MAKEFLAG100(11); -MAKEFLAG100(12); -MAKEFLAG100(13); -MAKEFLAG100(14); -MAKEFLAG100(15); - -#undef MAKEFLAG100 -#undef MAKEFLAG10 -#undef MAKEFLAG - -// This is a pseudo-flag -- we want to register a flag with a filename -// at the top level, but there is no way to do this except by faking -// the filename. -namespace fLI { - static const int32 FLAGS_nonotldflag1 = 12; - int32 FLAGS_tldflag1 = FLAGS_nonotldflag1; - int32 FLAGS_notldflag1 = FLAGS_nonotldflag1; - static FlagRegisterer o_tldflag1( - "tldflag1", - "should show up in --helpshort", "gflags_unittest.cc", - &FLAGS_tldflag1, &FLAGS_notldflag1); -} -using fLI::FLAGS_tldflag1; - -namespace fLI { - static const int32 FLAGS_nonotldflag2 = 23; - int32 FLAGS_tldflag2 = FLAGS_nonotldflag2; - int32 FLAGS_notldflag2 = FLAGS_nonotldflag2; - static FlagRegisterer o_tldflag2( - "tldflag2", - "should show up in --helpshort", "gflags_unittest.", - &FLAGS_tldflag2, &FLAGS_notldflag2); -} -using fLI::FLAGS_tldflag2; - -namespace GFLAGS_NAMESPACE { - -namespace { - - -static string TmpFile(const string& basename) { -#ifdef _MSC_VER - return FLAGS_test_tmpdir + "\\" + basename; -#else - return FLAGS_test_tmpdir + "/" + basename; -#endif -} - -// Returns the definition of the --flagfile flag to be used in the tests. -// Must be called after ParseCommandLineFlags(). -static const char* GetFlagFileFlag() { -#ifdef _MSC_VER - static const string flagfile = FLAGS_srcdir + "\\gflags_unittest_flagfile"; -#else - static const string flagfile = FLAGS_srcdir + "/gflags_unittest_flagfile"; -#endif - static const string flagfile_flag = string("--flagfile=") + flagfile; - return flagfile_flag.c_str(); -} - - -// Defining a variable of type CompileAssertTypesEqual will cause a -// compiler error iff T1 and T2 are different types. -template -struct CompileAssertTypesEqual; - -template -struct CompileAssertTypesEqual { -}; - - -template -void AssertIsType(Actual& x) { - CompileAssertTypesEqual(); -} - -// Verify all the flags are the right type. -TEST(FlagTypes, FlagTypes) { - AssertIsType(FLAGS_test_bool); - AssertIsType(FLAGS_test_int32); - AssertIsType(FLAGS_test_int64); - AssertIsType(FLAGS_test_uint32); - AssertIsType(FLAGS_test_uint64); - AssertIsType(FLAGS_test_double); - AssertIsType(FLAGS_test_string); -} - -#ifdef GTEST_HAS_DEATH_TEST -// Death tests for "help" options. -// -// The help system automatically calls gflags_exitfunc(1) when you specify any of -// the help-related flags ("-helpmatch", "-helpxml") so we can't test -// those mainline. - -// Tests that "-helpmatch" causes the process to die. -TEST(ReadFlagsFromStringDeathTest, HelpMatch) { - EXPECT_DEATH(ReadFlagsFromString("-helpmatch=base", GetArgv0(), true), - ""); -} - - -// Tests that "-helpxml" causes the process to die. -TEST(ReadFlagsFromStringDeathTest, HelpXml) { - EXPECT_DEATH(ReadFlagsFromString("-helpxml", GetArgv0(), true), - ""); -} -#endif - - -// A subroutine needed for testing reading flags from a string. -void TestFlagString(const string& flags, - const string& expected_string, - bool expected_bool, - int32 expected_int32, - double expected_double) { - EXPECT_TRUE(ReadFlagsFromString(flags, - GetArgv0(), - // errors are fatal - true)); - - EXPECT_EQ(expected_string, FLAGS_test_string); - EXPECT_EQ(expected_bool, FLAGS_test_bool); - EXPECT_EQ(expected_int32, FLAGS_test_int32); - EXPECT_DOUBLE_EQ(expected_double, FLAGS_test_double); -} - - -// Tests reading flags from a string. -TEST(FlagFileTest, ReadFlagsFromString) { - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "-test_bool=true\n" - " -test_int32=1\n" - "-test_double=0.0\n", - // Expected values - "continued", - true, - 1, - 0.0); - - TestFlagString( - // Flag string - "# let's make sure it can update values\n" - "-test_string=initial\n" - "-test_bool=false\n" - "-test_int32=123\n" - "-test_double=123.0\n", - // Expected values - "initial", - false, - 123, - 123.0); - - // Test that flags can use dashes instead of underscores. - TestFlagString( - // Flag string - "-test-string=initial\n" - "--test-bool=false\n" - "--test-int32=123\n" - "--test-double=123.0\n", - // Expected values - "initial", - false, - 123, - 123.0); -} - -// Tests the filename part of the flagfile -TEST(FlagFileTest, FilenamesOurfileLast) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "not_our_filename\n" - "-test_bool=true\n" - " -test_int32=1\n" - "gflags_unittest\n" - "-test_double=1000.0\n", - // Expected values - "continued", - false, - -1, - 1000.0); -} - -TEST(FlagFileTest, FilenamesOurfileFirst) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "gflags_unittest\n" - "-test_bool=true\n" - " -test_int32=1\n" - "not_our_filename\n" - "-test_double=1000.0\n", - // Expected values - "continued", - true, - 1, - -1.0); -} - -#if defined(HAVE_FNMATCH_H) || defined(HAVE_SHLWAPI_H) // otherwise glob isn't supported -TEST(FlagFileTest, FilenamesOurfileGlob) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "*flags*\n" - "-test_bool=true\n" - " -test_int32=1\n" - "flags\n" - "-test_double=1000.0\n", - // Expected values - "continued", - true, - 1, - -1.0); -} - -TEST(FlagFileTest, FilenamesOurfileInBigList) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "*first* *flags* *third*\n" - "-test_bool=true\n" - " -test_int32=1\n" - "flags\n" - "-test_double=1000.0\n", - // Expected values - "continued", - true, - 1, - -1.0); -} -#endif // defined(HAVE_FNMATCH_H) || defined(HAVE_SHLWAPI_H) - -// Tests that a failed flag-from-string read keeps flags at default values -TEST(FlagFileTest, FailReadFlagsFromString) { - FLAGS_test_int32 = 119; - string flags("# let's make sure it can update values\n" - "-test_string=non_initial\n" - "-test_bool=false\n" - "-test_int32=123\n" - "-test_double=illegal\n"); - - EXPECT_FALSE(ReadFlagsFromString(flags, - GetArgv0(), - // errors are fatal - false)); - - EXPECT_EQ(119, FLAGS_test_int32); - EXPECT_EQ("initial", FLAGS_test_string); -} - -// Tests that flags can be set to ordinary values. -TEST(SetFlagValueTest, OrdinaryValues) { - EXPECT_EQ("initial", FLAGS_test_str1); - - SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str1); // set; was default - - SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str1); // already set once - - FLAGS_test_str1 = "initial"; - SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("initial", FLAGS_test_str1); // still already set before - - SetCommandLineOptionWithMode("test_str1", "third", SET_FLAGS_VALUE); - EXPECT_EQ("third", FLAGS_test_str1); // changed value - - SetCommandLineOptionWithMode("test_str1", "fourth", SET_FLAGS_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str1); - // value not changed (already set before) - - EXPECT_EQ("initial", FLAGS_test_str2); - - SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str2); // changed (was default) - - FLAGS_test_str2 = "extra"; - EXPECT_EQ("extra", FLAGS_test_str2); - - FLAGS_test_str2 = "second"; - SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str2); // still changed (was equal to default) - - SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("fourth", FLAGS_test_str2); // changed (was default) - - EXPECT_EQ("initial", FLAGS_test_str3); - - SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str3); // changed - - FLAGS_test_str3 = "third"; - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) - - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) - - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_VALUE); - EXPECT_EQ("fourth", FLAGS_test_str3); // changed value -} - - -// Tests that flags can be set to exceptional values. -// Note: apparently MINGW doesn't parse inf and nan correctly: -// http://www.mail-archive.com/bug-gnulib@gnu.org/msg09573.html -// This url says FreeBSD also has a problem, but I didn't see that. -TEST(SetFlagValueTest, ExceptionalValues) { -#if defined(isinf) && !defined(__MINGW32__) - EXPECT_EQ("test_double set to inf\n", - SetCommandLineOption("test_double", "inf")); - EXPECT_INF(FLAGS_test_double); - - EXPECT_EQ("test_double set to inf\n", - SetCommandLineOption("test_double", "INF")); - EXPECT_INF(FLAGS_test_double); -#endif - - // set some bad values - EXPECT_EQ("", - SetCommandLineOption("test_double", "0.1xxx")); - EXPECT_EQ("", - SetCommandLineOption("test_double", " ")); - EXPECT_EQ("", - SetCommandLineOption("test_double", "")); -#if defined(isinf) && !defined(__MINGW32__) - EXPECT_EQ("test_double set to -inf\n", - SetCommandLineOption("test_double", "-inf")); - EXPECT_INF(FLAGS_test_double); - EXPECT_GT(0, FLAGS_test_double); -#endif - -#if defined(isnan) && !defined(__MINGW32__) - EXPECT_EQ("test_double set to nan\n", - SetCommandLineOption("test_double", "NaN")); - EXPECT_NAN(FLAGS_test_double); -#endif -} - -// Tests that integer flags can be specified in many ways -TEST(SetFlagValueTest, DifferentRadices) { - EXPECT_EQ("test_int32 set to 12\n", - SetCommandLineOption("test_int32", "12")); - - EXPECT_EQ("test_int32 set to 16\n", - SetCommandLineOption("test_int32", "0x10")); - - EXPECT_EQ("test_int32 set to 34\n", - SetCommandLineOption("test_int32", "0X22")); - - // Leading 0 is *not* octal; it's still decimal - EXPECT_EQ("test_int32 set to 10\n", - SetCommandLineOption("test_int32", "010")); -} - -// Tests what happens when you try to set a flag to an illegal value -TEST(SetFlagValueTest, IllegalValues) { - FLAGS_test_bool = true; - FLAGS_test_int32 = 119; - FLAGS_test_int64 = 1191; - FLAGS_test_uint32 = 11911; - FLAGS_test_uint64 = 119111; - - EXPECT_EQ("", - SetCommandLineOption("test_bool", "12")); - - EXPECT_EQ("", - SetCommandLineOption("test_uint32", "-1970")); - - EXPECT_EQ("", - SetCommandLineOption("test_int32", "7000000000000")); - - EXPECT_EQ("", - SetCommandLineOption("test_uint64", "-1")); - - EXPECT_EQ("", - SetCommandLineOption("test_int64", "not a number!")); - - // Test the empty string with each type of input - EXPECT_EQ("", SetCommandLineOption("test_bool", "")); - EXPECT_EQ("", SetCommandLineOption("test_int32", "")); - EXPECT_EQ("", SetCommandLineOption("test_int64", "")); - EXPECT_EQ("", SetCommandLineOption("test_uint32", "")); - EXPECT_EQ("", SetCommandLineOption("test_uint64", "")); - EXPECT_EQ("", SetCommandLineOption("test_double", "")); - EXPECT_EQ("test_string set to \n", SetCommandLineOption("test_string", "")); - - EXPECT_TRUE(FLAGS_test_bool); - EXPECT_EQ(119, FLAGS_test_int32); - EXPECT_EQ(1191, FLAGS_test_int64); - EXPECT_EQ(11911, FLAGS_test_uint32); - EXPECT_EQ(119111, FLAGS_test_uint64); -} - - -// Tests that we only evaluate macro args once -TEST(MacroArgs, EvaluateOnce) { - EXPECT_EQ(13, FLAGS_changeable_var); - // Make sure we don't ++ the value somehow, when evaluating the flag. - EXPECT_EQ(13, FLAGS_changeable_var); - // Make sure the macro only evaluated this var once. - EXPECT_EQ(13, changeable_var); - // Make sure the actual value and default value are the same - SetCommandLineOptionWithMode("changeable_var", "21", SET_FLAG_IF_DEFAULT); - EXPECT_EQ(21, FLAGS_changeable_var); -} - -TEST(MacroArgs, EvaluateOnceBool) { - EXPECT_TRUE(FLAGS_changeable_bool_var); - EXPECT_TRUE(FLAGS_changeable_bool_var); - EXPECT_EQ(8009, changeable_bool_var); - SetCommandLineOptionWithMode("changeable_bool_var", "false", - SET_FLAG_IF_DEFAULT); - EXPECT_FALSE(FLAGS_changeable_bool_var); -} - -TEST(MacroArgs, EvaluateOnceStrings) { - EXPECT_EQ("1", FLAGS_changeable_string_var); - EXPECT_EQ("1", FLAGS_changeable_string_var); - EXPECT_EQ(1, changeable_string_var); - SetCommandLineOptionWithMode("changeable_string_var", "different", - SET_FLAG_IF_DEFAULT); - EXPECT_EQ("different", FLAGS_changeable_string_var); -} - -// Tests that the FooFromEnv does the right thing -TEST(FromEnvTest, LegalValues) { - setenv("BOOL_VAL1", "true", 1); - setenv("BOOL_VAL2", "false", 1); - setenv("BOOL_VAL3", "1", 1); - setenv("BOOL_VAL4", "F", 1); - EXPECT_TRUE(BoolFromEnv("BOOL_VAL1", false)); - EXPECT_FALSE(BoolFromEnv("BOOL_VAL2", true)); - EXPECT_TRUE(BoolFromEnv("BOOL_VAL3", false)); - EXPECT_FALSE(BoolFromEnv("BOOL_VAL4", true)); - EXPECT_TRUE(BoolFromEnv("BOOL_VAL_UNKNOWN", true)); - EXPECT_FALSE(BoolFromEnv("BOOL_VAL_UNKNOWN", false)); - - setenv("INT_VAL1", "1", 1); - setenv("INT_VAL2", "-1", 1); - EXPECT_EQ(1, Int32FromEnv("INT_VAL1", 10)); - EXPECT_EQ(-1, Int32FromEnv("INT_VAL2", 10)); - EXPECT_EQ(10, Int32FromEnv("INT_VAL_UNKNOWN", 10)); - - setenv("INT_VAL3", "4294967295", 1); - EXPECT_EQ(1, Uint32FromEnv("INT_VAL1", 10)); - EXPECT_EQ(4294967295L, Uint32FromEnv("INT_VAL3", 30)); - EXPECT_EQ(10, Uint32FromEnv("INT_VAL_UNKNOWN", 10)); - - setenv("INT_VAL4", "1099511627776", 1); - EXPECT_EQ(1, Int64FromEnv("INT_VAL1", 20)); - EXPECT_EQ(-1, Int64FromEnv("INT_VAL2", 20)); - EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL4", 20)); - EXPECT_EQ(20, Int64FromEnv("INT_VAL_UNKNOWN", 20)); - - EXPECT_EQ(1, Uint64FromEnv("INT_VAL1", 30)); - EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL4", 30)); - EXPECT_EQ(30, Uint64FromEnv("INT_VAL_UNKNOWN", 30)); - - // I pick values here that can be easily represented exactly in floating-point - setenv("DOUBLE_VAL1", "0.0", 1); - setenv("DOUBLE_VAL2", "1.0", 1); - setenv("DOUBLE_VAL3", "-1.0", 1); - EXPECT_EQ(0.0, DoubleFromEnv("DOUBLE_VAL1", 40.0)); - EXPECT_EQ(1.0, DoubleFromEnv("DOUBLE_VAL2", 40.0)); - EXPECT_EQ(-1.0, DoubleFromEnv("DOUBLE_VAL3", 40.0)); - EXPECT_EQ(40.0, DoubleFromEnv("DOUBLE_VAL_UNKNOWN", 40.0)); - - setenv("STRING_VAL1", "", 1); - setenv("STRING_VAL2", "my happy string!", 1); - EXPECT_STREQ("", StringFromEnv("STRING_VAL1", "unknown")); - EXPECT_STREQ("my happy string!", StringFromEnv("STRING_VAL2", "unknown")); - EXPECT_STREQ("unknown", StringFromEnv("STRING_VAL_UNKNOWN", "unknown")); -} - -#ifdef GTEST_HAS_DEATH_TEST -// Tests that the FooFromEnv dies on parse-error -TEST(FromEnvDeathTest, IllegalValues) { - setenv("BOOL_BAD1", "so true!", 1); - setenv("BOOL_BAD2", "", 1); - EXPECT_DEATH(BoolFromEnv("BOOL_BAD1", false), "error parsing env variable"); - EXPECT_DEATH(BoolFromEnv("BOOL_BAD2", true), "error parsing env variable"); - - setenv("INT_BAD1", "one", 1); - setenv("INT_BAD2", "100000000000000000", 1); - setenv("INT_BAD3", "0xx10", 1); - setenv("INT_BAD4", "", 1); - EXPECT_DEATH(Int32FromEnv("INT_BAD1", 10), "error parsing env variable"); - EXPECT_DEATH(Int32FromEnv("INT_BAD2", 10), "error parsing env variable"); - EXPECT_DEATH(Int32FromEnv("INT_BAD3", 10), "error parsing env variable"); - EXPECT_DEATH(Int32FromEnv("INT_BAD4", 10), "error parsing env variable"); - - EXPECT_DEATH(Uint32FromEnv("INT_BAD1", 10), "error parsing env variable"); - EXPECT_DEATH(Uint32FromEnv("INT_BAD2", 10), "error parsing env variable"); - EXPECT_DEATH(Uint32FromEnv("INT_BAD3", 10), "error parsing env variable"); - EXPECT_DEATH(Uint32FromEnv("INT_BAD4", 10), "error parsing env variable"); - - setenv("BIGINT_BAD1", "18446744073709551616000", 1); - EXPECT_DEATH(Int64FromEnv("INT_BAD1", 20), "error parsing env variable"); - EXPECT_DEATH(Int64FromEnv("INT_BAD3", 20), "error parsing env variable"); - EXPECT_DEATH(Int64FromEnv("INT_BAD4", 20), "error parsing env variable"); - EXPECT_DEATH(Int64FromEnv("BIGINT_BAD1", 200), "error parsing env variable"); - - setenv("BIGINT_BAD2", "-1", 1); - EXPECT_DEATH(Uint64FromEnv("INT_BAD1", 30), "error parsing env variable"); - EXPECT_DEATH(Uint64FromEnv("INT_BAD3", 30), "error parsing env variable"); - EXPECT_DEATH(Uint64FromEnv("INT_BAD4", 30), "error parsing env variable"); - EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD1", 30), "error parsing env variable"); - // TODO(csilvers): uncomment this when we disallow negative numbers for uint64 -#if 0 - EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD2", 30), "error parsing env variable"); -#endif - - setenv("DOUBLE_BAD1", "0.0.0", 1); - setenv("DOUBLE_BAD2", "", 1); - EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD1", 40.0), "error parsing env variable"); - EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD2", 40.0), "error parsing env variable"); -} -#endif - - -// Tests that FlagSaver can save the states of string flags. -TEST(FlagSaverTest, CanSaveStringFlagStates) { - // 1. Initializes the flags. - - // State of flag test_str1: - // default value - "initial" - // current value - "initial" - // not set - true - - SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_VALUE); - // State of flag test_str2: - // default value - "initial" - // current value - "second" - // not set - false - - SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); - // State of flag test_str3: - // default value - "second" - // current value - "second" - // not set - true - - // 2. Saves the flag states. - - { - FlagSaver fs; - - // 3. Modifies the flag states. - - SetCommandLineOptionWithMode("test_str1", "second", SET_FLAGS_VALUE); - EXPECT_EQ("second", FLAGS_test_str1); - // State of flag test_str1: - // default value - "second" - // current value - "second" - // not set - true - - SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str2); - // State of flag test_str2: - // default value - "third" - // current value - "second" - // not set - false - - SetCommandLineOptionWithMode("test_str3", "third", SET_FLAGS_VALUE); - EXPECT_EQ("third", FLAGS_test_str3); - // State of flag test_str1: - // default value - "second" - // current value - "third" - // not set - false - - // 4. Restores the flag states. - } - - // 5. Verifies that the states were restored. - - // Verifies that the value of test_str1 was restored. - EXPECT_EQ("initial", FLAGS_test_str1); - // Verifies that the "not set" attribute of test_str1 was restored to true. - SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str1); - - // Verifies that the value of test_str2 was restored. - EXPECT_EQ("second", FLAGS_test_str2); - // Verifies that the "not set" attribute of test_str2 was restored to false. - SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str2); - - // Verifies that the value of test_str3 was restored. - EXPECT_EQ("second", FLAGS_test_str3); - // Verifies that the "not set" attribute of test_str3 was restored to true. - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("fourth", FLAGS_test_str3); -} - - -// Tests that FlagSaver can save the values of various-typed flags. -TEST(FlagSaverTest, CanSaveVariousTypedFlagValues) { - // Initializes the flags. - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_uint32 = 2; - FLAGS_test_int64 = -3; - FLAGS_test_uint64 = 4; - FLAGS_test_double = 5.0; - FLAGS_test_string = "good"; - - // Saves the flag states. - { - FlagSaver fs; - - // Modifies the flags. - FLAGS_test_bool = true; - FLAGS_test_int32 = -5; - FLAGS_test_uint32 = 6; - FLAGS_test_int64 = -7; - FLAGS_test_uint64 = 8; - FLAGS_test_double = 8.0; - FLAGS_test_string = "bad"; - - // Restores the flag states. - } - - // Verifies the flag values were restored. - EXPECT_FALSE(FLAGS_test_bool); - EXPECT_EQ(-1, FLAGS_test_int32); - EXPECT_EQ(2, FLAGS_test_uint32); - EXPECT_EQ(-3, FLAGS_test_int64); - EXPECT_EQ(4, FLAGS_test_uint64); - EXPECT_DOUBLE_EQ(5.0, FLAGS_test_double); - EXPECT_EQ("good", FLAGS_test_string); -} - -TEST(GetAllFlagsTest, BaseTest) { - vector flags; - GetAllFlags(&flags); - bool found_test_bool = false; - vector::const_iterator i; - for (i = flags.begin(); i != flags.end(); ++i) { - if (i->name == "test_bool") { - found_test_bool = true; - EXPECT_EQ(i->type, "bool"); - EXPECT_EQ(i->default_value, "false"); - EXPECT_EQ(i->flag_ptr, &FLAGS_test_bool); - break; - } - } - EXPECT_TRUE(found_test_bool); -} - -TEST(ShowUsageWithFlagsTest, BaseTest) { - // TODO(csilvers): test this by allowing output other than to stdout. - // Not urgent since this functionality is tested via - // gflags_unittest.sh, though only through use of --help. -} - -TEST(ShowUsageWithFlagsRestrictTest, BaseTest) { - // TODO(csilvers): test this by allowing output other than to stdout. - // Not urgent since this functionality is tested via - // gflags_unittest.sh, though only through use of --helpmatch. -} - -// Note: all these argv-based tests depend on SetArgv being called -// before ParseCommandLineFlags() in main(), below. -TEST(GetArgvsTest, BaseTest) { - vector argvs = GetArgvs(); - EXPECT_EQ(4, argvs.size()); - EXPECT_EQ("/test/argv/for/gflags_unittest", argvs[0]); - EXPECT_EQ("argv 2", argvs[1]); - EXPECT_EQ("3rd argv", argvs[2]); - EXPECT_EQ("argv #4", argvs[3]); -} - -TEST(GetArgvTest, BaseTest) { - EXPECT_STREQ("/test/argv/for/gflags_unittest " - "argv 2 3rd argv argv #4", GetArgv()); -} - -TEST(GetArgv0Test, BaseTest) { - EXPECT_STREQ("/test/argv/for/gflags_unittest", GetArgv0()); -} - -TEST(GetArgvSumTest, BaseTest) { - // This number is just the sum of the ASCII values of all the chars - // in GetArgv(). - EXPECT_EQ(4904, GetArgvSum()); -} - -TEST(ProgramInvocationNameTest, BaseTest) { - EXPECT_STREQ("/test/argv/for/gflags_unittest", - ProgramInvocationName()); -} - -TEST(ProgramInvocationShortNameTest, BaseTest) { - EXPECT_STREQ("gflags_unittest", ProgramInvocationShortName()); -} - -TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to ParseCommandLineFlags() - EXPECT_STREQ("/test/argv/for/gflags_unittest: " - " [...]\nDoes something useless.\n", - ProgramUsage()); -} - -TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) { - string value("will be changed"); - bool r = GetCommandLineOption("test_bool", &value); - EXPECT_TRUE(r); - EXPECT_EQ("false", value); - - r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("-1", value); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) { - FLAGS_test_int32 = 400; - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("400", value); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasSet) { - SetCommandLineOption("test_int32", "700"); - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("700", value); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) { - // This doesn't set the flag's value, but rather its default value. - // is_default is still true, but the 'default' value returned has changed! - SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT); - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("800", value); - EXPECT_TRUE(GetCommandLineFlagInfoOrDie("test_int32").is_default); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) { - SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT); - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("900", value); -} - -TEST(GetCommandLineOptionTest, NameDoesNotExist) { - string value("will not be changed"); - const bool r = GetCommandLineOption("test_int3210", &value); - EXPECT_FALSE(r); - EXPECT_EQ("will not be changed", value); -} - -TEST(GetCommandLineFlagInfoTest, FlagExists) { - CommandLineFlagInfo info; - bool r = GetCommandLineFlagInfo("test_int32", &info); - EXPECT_TRUE(r); - EXPECT_EQ("test_int32", info.name); - EXPECT_EQ("int32", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("-1", info.current_value); - EXPECT_EQ("-1", info.default_value); - EXPECT_TRUE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); - - FLAGS_test_bool = true; - r = GetCommandLineFlagInfo("test_bool", &info); - EXPECT_TRUE(r); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("true", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_FALSE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); - - FLAGS_test_bool = false; - r = GetCommandLineFlagInfo("test_bool", &info); - EXPECT_TRUE(r); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("false", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_FALSE(info.is_default); // value is same, but flag *was* modified - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); -} - -TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) { - CommandLineFlagInfo info; - // Set to some random values that GetCommandLineFlagInfo should not change - info.name = "name"; - info.type = "type"; - info.current_value = "curr"; - info.default_value = "def"; - info.filename = "/"; - info.is_default = false; - info.has_validator_fn = true; - info.flag_ptr = NULL; - bool r = GetCommandLineFlagInfo("test_int3210", &info); - EXPECT_FALSE(r); - EXPECT_EQ("name", info.name); - EXPECT_EQ("type", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("curr", info.current_value); - EXPECT_EQ("def", info.default_value); - EXPECT_EQ("/", info.filename); - EXPECT_FALSE(info.is_default); - EXPECT_TRUE(info.has_validator_fn); - EXPECT_EQ(NULL, info.flag_ptr); -} - -TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) { - CommandLineFlagInfo info; - info = GetCommandLineFlagInfoOrDie("test_int32"); - EXPECT_EQ("test_int32", info.name); - EXPECT_EQ("int32", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("-1", info.current_value); - EXPECT_EQ("-1", info.default_value); - EXPECT_TRUE(info.is_default); - EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); - info = GetCommandLineFlagInfoOrDie("test_bool"); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("false", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_TRUE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); -} - -TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) { - FLAGS_test_int32 = 400; - CommandLineFlagInfo info; - info = GetCommandLineFlagInfoOrDie("test_int32"); - EXPECT_EQ("test_int32", info.name); - EXPECT_EQ("int32", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("400", info.current_value); - EXPECT_EQ("-1", info.default_value); - EXPECT_FALSE(info.is_default); - EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); - FLAGS_test_bool = true; - info = GetCommandLineFlagInfoOrDie("test_bool"); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("true", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_FALSE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(GetCommandLineFlagInfoOrDieDeathTest, FlagDoesNotExist) { - EXPECT_DEATH(GetCommandLineFlagInfoOrDie("test_int3210"), - ".*: flag test_int3210 does not exist"); -} -#endif - - -// These are lightly tested because they're deprecated. Basically, -// the tests are meant to cover how existing users use these functions, -// but not necessarily how new users could use them. -TEST(DeprecatedFunctionsTest, CommandlineFlagsIntoString) { - string s = CommandlineFlagsIntoString(); - EXPECT_NE(string::npos, s.find("--test_bool=")); -} - -TEST(DeprecatedFunctionsTest, AppendFlagsIntoFile) { - FLAGS_test_int32 = 10; // just to make the test more interesting - string filename(TmpFile("flagfile")); - unlink(filename.c_str()); // just to be safe - const bool r = AppendFlagsIntoFile(filename, "not the real argv0"); - EXPECT_TRUE(r); - - FILE* fp; - EXPECT_EQ(0, SafeFOpen(&fp, filename.c_str(), "r")); - EXPECT_TRUE(fp != NULL); - char line[8192]; - EXPECT_TRUE(fgets(line, sizeof(line)-1, fp) != NULL); // get the first line - // First line should be progname. - EXPECT_STREQ("not the real argv0\n", line); - - bool found_bool = false, found_int32 = false; - while (fgets(line, sizeof(line)-1, fp)) { - line[sizeof(line)-1] = '\0'; // just to be safe - if (strcmp(line, "--test_bool=false\n") == 0) - found_bool = true; - if (strcmp(line, "--test_int32=10\n") == 0) - found_int32 = true; - } - EXPECT_TRUE(found_int32); - EXPECT_TRUE(found_bool); - fclose(fp); -} - -TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) { - FLAGS_test_int32 = -10; // just to make the test more interesting - string filename(TmpFile("flagfile2")); - unlink(filename.c_str()); // just to be safe - bool r = AppendFlagsIntoFile(filename, GetArgv0()); - EXPECT_TRUE(r); - - FLAGS_test_int32 = -11; - r = ReadFromFlagsFile(filename, GetArgv0(), true); - EXPECT_TRUE(r); - EXPECT_EQ(-10, FLAGS_test_int32); -} // unnamed namespace - -TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) { - FLAGS_test_int32 = -20; - string filename(TmpFile("flagfile3")); - FILE* fp; - EXPECT_EQ(0, SafeFOpen(&fp, filename.c_str(), "w")); - EXPECT_TRUE(fp != NULL); - // Note the error in the bool assignment below... - fprintf(fp, "%s\n--test_int32=-21\n--test_bool=not_a_bool!\n", GetArgv0()); - fclose(fp); - - FLAGS_test_int32 = -22; - const bool r = ReadFromFlagsFile(filename, GetArgv0(), false); - EXPECT_FALSE(r); - EXPECT_EQ(-22, FLAGS_test_int32); // the -21 from the flagsfile didn't take -} - -TEST(FlagsSetBeforeInitTest, TryFromEnv) { - EXPECT_EQ("pre-set", FLAGS_test_tryfromenv); -} - -// The following test case verifies that ParseCommandLineFlags() and -// ParseCommandLineNonHelpFlags() uses the last definition of a flag -// in case it's defined more than once. - -DEFINE_int32(test_flag, -1, "used for testing gflags.cc"); - -// Parses and returns the --test_flag flag. -// If with_help is true, calls ParseCommandLineFlags; otherwise calls -// ParseCommandLineNonHelpFlags. -int32 ParseTestFlag(bool with_help, int argc, const char** const_argv) { - FlagSaver fs; // Restores the flags before returning. - - // Makes a copy of the input array s.t. it can be reused - // (ParseCommandLineFlags() will alter the array). - char** const argv_save = new char*[argc + 1]; - char** argv = argv_save; - memcpy(argv, const_argv, sizeof(*argv)*(argc + 1)); - - if (with_help) { - ParseCommandLineFlags(&argc, &argv, true); - } else { - ParseCommandLineNonHelpFlags(&argc, &argv, true); - } - - delete[] argv_save; - return FLAGS_test_flag; -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedTwiceOnCommandLine) { - const char* argv[] = { - "my_test", - "--test_flag=1", - "--test_flag=2", - NULL, - }; - - EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedTwiceInFlagFile) { - const char* argv[] = { - "my_test", - GetFlagFileFlag(), - NULL, - }; - - EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedInCommandLineAndThenFlagFile) { - const char* argv[] = { - "my_test", - "--test_flag=0", - GetFlagFileFlag(), - NULL, - }; - - EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedInFlagFileAndThenCommandLine) { - const char* argv[] = { - "my_test", - GetFlagFileFlag(), - "--test_flag=3", - NULL, - }; - - EXPECT_EQ(3, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(3, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedInCommandLineAndFlagFileAndThenCommandLine) { - const char* argv[] = { - "my_test", - "--test_flag=0", - GetFlagFileFlag(), - "--test_flag=3", - NULL, - }; - - EXPECT_EQ(3, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(3, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgFirst) { - const char* argv[] = { - "my_test", - "--", - "--test_flag=0", - NULL, - }; - - EXPECT_EQ(-1, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(-1, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgMiddle) { - const char* argv[] = { - "my_test", - "--test_flag=7", - "--", - "--test_flag=0", - NULL, - }; - - EXPECT_EQ(7, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(7, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsAndDashArgs, OneDashArg) { - const char* argv[] = { - "my_test", - "-", - "--test_flag=0", - NULL, - }; - - EXPECT_EQ(0, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(0, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(ParseCommandLineFlagsUnknownFlagDeathTest, - FlagIsCompletelyUnknown) { - const char* argv[] = { - "my_test", - "--this_flag_does_not_exist", - NULL, - }; - - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "unknown command line flag.*"); - EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), - "unknown command line flag.*"); -} - -TEST(ParseCommandLineFlagsUnknownFlagDeathTest, - BoolFlagIsCompletelyUnknown) { - const char* argv[] = { - "my_test", - "--nothis_flag_does_not_exist", - NULL, - }; - - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "unknown command line flag.*"); - EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), - "unknown command line flag.*"); -} - -TEST(ParseCommandLineFlagsUnknownFlagDeathTest, - FlagIsNotABool) { - const char* argv[] = { - "my_test", - "--notest_string", - NULL, - }; - - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "boolean value .* specified for .* command line flag"); - EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), - "boolean value .* specified for .* command line flag"); -} -#endif - -TEST(ParseCommandLineFlagsWrongFields, - DescriptionIsInvalid) { - // These must not be automatic variables, since command line flags - // aren't unregistered and gUnit uses FlagSaver to save and restore - // command line flags' values. If these are on the stack, then when - // later tests attempt to save and restore their values, the stack - // addresses of these variables will be overwritten... Stack smash! - static bool current_storage; - static bool defvalue_storage; - FlagRegisterer fr("flag_name", NULL, "filename", - ¤t_storage, &defvalue_storage); - CommandLineFlagInfo fi; - EXPECT_TRUE(GetCommandLineFlagInfo("flag_name", &fi)); - EXPECT_EQ("", fi.description); - EXPECT_EQ(¤t_storage, fi.flag_ptr); -} - -static bool ValidateTestFlagIs5(const char* flagname, int32 flagval) { - if (flagval == 5) - return true; - printf("%s isn't 5!\n", flagname); - return false; -} - -static bool ValidateTestFlagIs10(const char* flagname, int32 flagval) { - return flagval == 10; -} - - -TEST(FlagsValidator, ValidFlagViaArgv) { - const char* argv[] = { - "my_test", - "--test_flag=5", - NULL, - }; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_EQ(5, ParseTestFlag(true, arraysize(argv) - 1, argv)); - // Undo the flag validator setting - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, ValidFlagViaSetDefault) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", - SET_FLAG_IF_DEFAULT)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, ValidFlagViaSetValue) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - FLAGS_test_flag = 100; // doesn't trigger the validator - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", - SET_FLAGS_VALUE)); - EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", - SET_FLAGS_DEFAULT)); - EXPECT_NE("", SetCommandLineOption("test_flag", "5")); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(FlagsValidatorDeathTest, InvalidFlagViaArgv) { - const char* argv[] = { - "my_test", - "--test_flag=50", - NULL, - }; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "ERROR: failed validation of new value '50' for flag 'test_flag'"); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} -#endif - -TEST(FlagsValidator, InvalidFlagViaSetDefault) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", - SET_FLAG_IF_DEFAULT)); - EXPECT_EQ(-1, FLAGS_test_flag); // the setting-to-50 should have failed - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, InvalidFlagViaSetValue) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - FLAGS_test_flag = 100; // doesn't trigger the validator - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", - SET_FLAGS_VALUE)); - EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", - SET_FLAGS_DEFAULT)); - EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); - EXPECT_EQ(100, FLAGS_test_flag); // the setting-to-50 should have failed - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(FlagsValidatorDeathTest, InvalidFlagNeverSet) { - // If a flag keeps its default value, and that default value is - // invalid, we should die at argv-parse time. - const char* argv[] = { - "my_test", - NULL, - }; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "ERROR: --test_flag must be set on the commandline"); -} -#endif - -TEST(FlagsValidator, InvalidFlagPtr) { - int32 dummy; - EXPECT_FALSE(RegisterFlagValidator(NULL, &ValidateTestFlagIs5)); - EXPECT_FALSE(RegisterFlagValidator(&dummy, &ValidateTestFlagIs5)); -} - -TEST(FlagsValidator, RegisterValidatorTwice) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); - EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, CommandLineFlagInfo) { - CommandLineFlagInfo info; - info = GetCommandLineFlagInfoOrDie("test_flag"); - EXPECT_FALSE(info.has_validator_fn); - - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - info = GetCommandLineFlagInfoOrDie("test_flag"); - EXPECT_TRUE(info.has_validator_fn); - - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); - info = GetCommandLineFlagInfoOrDie("test_flag"); - EXPECT_FALSE(info.has_validator_fn); -} - -TEST(FlagsValidator, FlagSaver) { - { - FlagSaver fs; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // fails validation - } - EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // validator is gone - - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - { - FlagSaver fs; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); - EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // no validator - } - EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // validator is back -} - - -} // unnamed namespace - -static int main(int argc, char **argv) { - - // Run unit tests only if called without arguments, otherwise this program - // is used by an "external" usage test - const bool run_tests = (argc == 1); - - // We need to call SetArgv before parsing flags, so our "test" argv will - // win out over this executable's real argv. That makes running this - // test with a real --help flag kinda annoying, unfortunately. - const char* test_argv[] = { "/test/argv/for/gflags_unittest", - "argv 2", "3rd argv", "argv #4" }; - SetArgv(arraysize(test_argv), test_argv); - - // The first arg is the usage message, also important for testing. - string usage_message = (string(GetArgv0()) + - ": [...]\nDoes something useless.\n"); - - // We test setting tryfromenv manually, and making sure - // ParseCommandLineFlags still evaluates it. - FLAGS_tryfromenv = "test_tryfromenv"; - setenv("FLAGS_test_tryfromenv", "pre-set", 1); - - // Modify flag values from declared default value in two ways. - // The recommended way: - SetCommandLineOptionWithMode("changed_bool1", "true", SET_FLAGS_DEFAULT); - - // The non-recommended way: - FLAGS_changed_bool2 = true; - - SetUsageMessage(usage_message); - SetVersionString("test_version"); - ParseCommandLineFlags(&argc, &argv, true); - MakeTmpdir(&FLAGS_test_tmpdir); - - int exit_status = 0; - if (run_tests) { - fprintf(stdout, "Running the unit tests now...\n\n"); fflush(stdout); - exit_status = RUN_ALL_TESTS(); - } else fprintf(stderr, "\n\nPASS\n"); - ShutDownCommandLineFlags(); - return exit_status; -} - -} // GFLAGS_NAMESPACE - -int main(int argc, char** argv) { - return GFLAGS_NAMESPACE::main(argc, argv); -} - diff --git a/inference-engine/samples/thirdparty/gflags/test/gflags_unittest_flagfile b/inference-engine/samples/thirdparty/gflags/test/gflags_unittest_flagfile deleted file mode 100644 index f4fa0c4d5c5..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/gflags_unittest_flagfile +++ /dev/null @@ -1,2 +0,0 @@ ---test_flag=1 ---test_flag=2 diff --git a/inference-engine/samples/thirdparty/gflags/test/nc/CMakeLists.txt b/inference-engine/samples/thirdparty/gflags/test/nc/CMakeLists.txt deleted file mode 100644 index d00b07d07dc..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/nc/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -## gflags negative compilation tests - -cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) - -if (NOT TEST_NAME) - message (FATAL_ERROR "Missing TEST_NAME CMake flag") -endif () -string (TOUPPER ${TEST_NAME} TEST_NAME_UPPER) - -project (gflags_${TEST_NAME}) - -find_package (gflags REQUIRED) -include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/..") -add_definitions (-DTEST_${TEST_NAME_UPPER}) -add_executable (gflags_${TEST_NAME} gflags_nc.cc) -target_link_libraries(gflags_${TEST_NAME} gflags) diff --git a/inference-engine/samples/thirdparty/gflags/test/nc/gflags_nc.cc b/inference-engine/samples/thirdparty/gflags/test/nc/gflags_nc.cc deleted file mode 100644 index 1990c30a6a9..00000000000 --- a/inference-engine/samples/thirdparty/gflags/test/nc/gflags_nc.cc +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2009, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// -// A negative comiple test for gflags. - -#include - -#if defined(TEST_NC_SWAPPED_ARGS) - -DEFINE_bool(some_bool_flag, - "the default value should go here, not the description", - false); - - -#elif defined(TEST_NC_INT_INSTEAD_OF_BOOL) - -DEFINE_bool(some_bool_flag_2, - 0, - "should have been an int32 flag but mistakenly used bool instead"); - -#elif defined(TEST_NC_BOOL_IN_QUOTES) - - -DEFINE_bool(some_bool_flag_3, - "false", - "false in in quotes, which is wrong"); - -#elif defined(TEST_NC_SANITY) - -DEFINE_bool(some_bool_flag_4, - true, - "this is the correct usage of DEFINE_bool"); - -#elif defined(TEST_NC_DEFINE_STRING_WITH_0) - -DEFINE_string(some_string_flag, - 0, - "Trying to construct a string by passing 0 would cause a crash."); - -#endif - -int main(int, char **) -{ - return 0; -} diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest b/inference-engine/tests/ie_test_utils/common_test_utils/gtest new file mode 160000 index 00000000000..9bd163b9934 --- /dev/null +++ b/inference-engine/tests/ie_test_utils/common_test_utils/gtest @@ -0,0 +1 @@ +Subproject commit 9bd163b993459b2ca6ba2dc508577bbc8774c851 diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/.gitignore b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/.gitignore deleted file mode 100644 index da68162d12c..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# Ignore CI build directory -build/ -xcuserdata -cmake-build-debug/ -.idea/ -bazel-bin -bazel-genfiles -bazel-googletest -bazel-out -bazel-testlogs diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/.travis.yml b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/.travis.yml deleted file mode 100644 index c155e571d0c..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Build matrix / environment variable are explained on: -# http://about.travis-ci.org/docs/user/build-configuration/ -# This file can be validated on: -# http://lint.travis-ci.org/ - -install: -# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available. -- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi -# /usr/bin/clang is 3.4, lets override with modern one. -- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi -- echo ${PATH} -- echo ${CXX} -- ${CXX} --version -- ${CXX} -v -addons: - apt: - # List of whitelisted in travis packages for ubuntu-precise can be found here: - # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise - # List of whitelisted in travis apt-sources: - # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.7 - packages: - - gcc-4.9 - - g++-4.9 - - clang-3.7 - - valgrind -os: - - linux - - osx -language: cpp -compiler: - - gcc - - clang -script: ./travis.sh -env: - matrix: - - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE=1 - - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE=1 CXX_FLAGS=-std=c++11 -notifications: - email: false -sudo: false diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/BUILD.bazel b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/BUILD.bazel deleted file mode 100644 index a44237409e2..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/BUILD.bazel +++ /dev/null @@ -1,147 +0,0 @@ -# Copyright 2017 Google Inc. -# All Rights Reserved. -# -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# Author: misterg@google.com (Gennadiy Civil) -# -# Bazel Build for Google C++ Testing Framework(Google Test) - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -config_setting( - name = "win", - values = {"cpu": "x64_windows_msvc"}, -) - -# Google Test including Google Mock -cc_library( - name = "gtest", - srcs = glob( - include = [ - "googletest/src/*.cc", - "googletest/src/*.h", - "googletest/include/gtest/**/*.h", - "googlemock/src/*.cc", - "googlemock/include/gmock/**/*.h", - ], - exclude = [ - "googletest/src/gtest-all.cc", - "googletest/src/gtest_main.cc", - "googlemock/src/gmock-all.cc", - "googlemock/src/gmock_main.cc", - ], - ), - hdrs =glob([ - "googletest/include/gtest/*.h", - "googlemock/include/gmock/*.h", - ]), - copts = select( - { - ":win": [], - "//conditions:default": ["-pthread"], - }, - ), - includes = [ - "googlemock", - "googlemock/include", - "googletest", - "googletest/include", - ], - linkopts = select({ - ":win": [], - "//conditions:default": [ - "-pthread", - ], - }), -) - -cc_library( - name = "gtest_main", - srcs = [ - "googlemock/src/gmock_main.cc", - ], - deps = ["//:gtest"], -) - -# The following rules build samples of how to use gTest. -cc_library( - name = "gtest_sample_lib", - srcs = [ - "googletest/samples/sample1.cc", - "googletest/samples/sample2.cc", - "googletest/samples/sample4.cc", - ], - hdrs = [ - "googletest/samples/prime_tables.h", - "googletest/samples/sample1.h", - "googletest/samples/sample2.h", - "googletest/samples/sample3-inl.h", - "googletest/samples/sample4.h", - ], -) - -cc_test( - name = "gtest_samples", - size = "small", - #All Samples except: - #sample9 ( main ) - #sample10 (main and takes a command line option and needs to be separate) - srcs = [ - "googletest/samples/sample1_unittest.cc", - "googletest/samples/sample2_unittest.cc", - "googletest/samples/sample3_unittest.cc", - "googletest/samples/sample4_unittest.cc", - "googletest/samples/sample5_unittest.cc", - "googletest/samples/sample6_unittest.cc", - "googletest/samples/sample7_unittest.cc", - "googletest/samples/sample8_unittest.cc", - ], - deps = [ - "gtest_sample_lib", - ":gtest_main", - ], -) - -cc_test( - name = "sample9_unittest", - size = "small", - srcs = ["googletest/samples/sample9_unittest.cc"], - deps = [":gtest"], -) - -cc_test( - name = "sample10_unittest", - size = "small", - srcs = ["googletest/samples/sample10_unittest.cc"], - deps = [ - ":gtest", - ], -) diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/CMakeLists.txt b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/CMakeLists.txt deleted file mode 100644 index f8a97faaeb8..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 2.6.4) - -if (POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) -endif (POLICY CMP0048) - -project( googletest-distribution ) - -enable_testing() - -include(CMakeDependentOption) -if (CMAKE_VERSION VERSION_LESS 2.8.5) - set(CMAKE_INSTALL_BINDIR "bin" CACHE STRING "User executables (bin)") - set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}" CACHE STRING "Object code libraries (lib)") - set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE STRING "C header files (include)") - mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR) -else() - include(GNUInstallDirs) -endif() - -option(BUILD_GTEST "Builds the googletest subproject" OFF) - -#Note that googlemock target already builds googletest -option(BUILD_GMOCK "Builds the googlemock subproject" ON) - -cmake_dependent_option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON "BUILD_GTEST OR BUILD_GMOCK" OFF) -cmake_dependent_option(INSTALL_GMOCK "Enable installation of googlemock. (Projects embedding googlemock may want to turn this OFF.)" ON "BUILD_GMOCK" OFF) - -if(BUILD_GMOCK) - add_subdirectory( googlemock ) -elseif(BUILD_GTEST) - add_subdirectory( googletest ) -endif() diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/README.md b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/README.md deleted file mode 100644 index f858833dc54..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/README.md +++ /dev/null @@ -1,148 +0,0 @@ - -# Google Test # - -[![Build Status](https://travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest) -[![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master) - -Welcome to **Google Test**, Google's C++ test framework! - -This repository is a merger of the formerly separate GoogleTest and -GoogleMock projects. These were so closely related that it makes sense to -maintain and release them together. - -Please see the project page above for more information as well as the -mailing list for questions, discussions, and development. There is -also an IRC channel on [OFTC](https://webchat.oftc.net/) (irc.oftc.net) #gtest available. Please -join us! - -Getting started information for **Google Test** is available in the -[Google Test Primer](googletest/docs/Primer.md) documentation. - -**Google Mock** is an extension to Google Test for writing and using C++ mock -classes. See the separate [Google Mock documentation](googlemock/README.md). - -More detailed documentation for googletest (including build instructions) are -in its interior [googletest/README.md](googletest/README.md) file. - -## Features ## - - * An [xUnit](https://en.wikipedia.org/wiki/XUnit) test framework. - * Test discovery. - * A rich set of assertions. - * User-defined assertions. - * Death tests. - * Fatal and non-fatal failures. - * Value-parameterized tests. - * Type-parameterized tests. - * Various options for running the tests. - * XML test report generation. - -## Platforms ## - -Google test has been used on a variety of platforms: - - * Linux - * Mac OS X - * Windows - * Cygwin - * MinGW - * Windows Mobile - * Symbian - -## Who Is Using Google Test? ## - -In addition to many internal projects at Google, Google Test is also used by -the following notable projects: - - * The [Chromium projects](http://www.chromium.org/) (behind the Chrome - browser and Chrome OS). - * The [LLVM](http://llvm.org/) compiler. - * [Protocol Buffers](https://github.com/google/protobuf), Google's data - interchange format. - * The [OpenCV](http://opencv.org/) computer vision library. - * [tiny-dnn](https://github.com/tiny-dnn/tiny-dnn): header only, dependency-free deep learning framework in C++11. - -## Related Open Source Projects ## - -[GTest Runner](https://github.com/nholthaus/gtest-runner) is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms. - -[Google Test UI](https://github.com/ospector/gtest-gbar) is test runner that runs -your test binary, allows you to track its progress via a progress bar, and -displays a list of test failures. Clicking on one shows failure text. Google -Test UI is written in C#. - -[GTest TAP Listener](https://github.com/kinow/gtest-tap-listener) is an event -listener for Google Test that implements the -[TAP protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol) for test -result output. If your test runner understands TAP, you may find it useful. - -[gtest-parallel](https://github.com/google/gtest-parallel) is a test runner that -runs tests from your binary in parallel to provide significant speed-up. - -## Requirements ## - -Google Test is designed to have fairly minimal requirements to build -and use with your projects, but there are some. Currently, we support -Linux, Windows, Mac OS X, and Cygwin. We will also make our best -effort to support other platforms (e.g. Solaris, AIX, and z/OS). -However, since core members of the Google Test project have no access -to these platforms, Google Test may have outstanding issues there. If -you notice any problems on your platform, please notify -[googletestframework@googlegroups.com](https://groups.google.com/forum/#!forum/googletestframework). Patches for fixing them are -even more welcome! - -### Linux Requirements ### - -These are the base requirements to build and use Google Test from a source -package (as described below): - - * GNU-compatible Make or gmake - * POSIX-standard shell - * POSIX(-2) Regular Expressions (regex.h) - * A C++98-standard-compliant compiler - -### Windows Requirements ### - - * Microsoft Visual C++ 2010 or newer - -### Cygwin Requirements ### - - * Cygwin v1.5.25-14 or newer - -### Mac OS X Requirements ### - - * Mac OS X v10.4 Tiger or newer - * Xcode Developer Tools - -### Requirements for Contributors ### - -We welcome patches. If you plan to contribute a patch, you need to -build Google Test and its own tests from a git checkout (described -below), which has further requirements: - - * [Python](https://www.python.org/) v2.3 or newer (for running some of - the tests and re-generating certain source files from templates) - * [CMake](https://cmake.org/) v2.6.4 or newer - -## Regenerating Source Files ## - -Some of Google Test's source files are generated from templates (not -in the C++ sense) using a script. -For example, the -file include/gtest/internal/gtest-type-util.h.pump is used to generate -gtest-type-util.h in the same directory. - -You don't need to worry about regenerating the source files -unless you need to modify them. You would then modify the -corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)' -generator script. See the [Pump Manual](googletest/docs/PumpManual.md). - -### Contributing Code ### - -We welcome patches. Please read the -[Developer's Guide](googletest/docs/DevGuide.md) -for how you can contribute. In particular, make sure you have signed -the Contributor License Agreement, or we won't be able to accept the -patch. - -Happy testing! diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/WORKSPACE b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/WORKSPACE deleted file mode 100644 index 106b824ecf9..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/WORKSPACE +++ /dev/null @@ -1 +0,0 @@ -workspace(name = "com_google_googletest") diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/appveyor.yml b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/appveyor.yml deleted file mode 100644 index d613fd60278..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/appveyor.yml +++ /dev/null @@ -1,71 +0,0 @@ -version: '{build}' - -os: Visual Studio 2015 - -environment: - matrix: - - Toolset: v140 - - Toolset: v120 - - Toolset: v110 - - Toolset: v100 - -platform: - - Win32 - - x64 - -configuration: -# - Release - - Debug - -build: - verbosity: minimal - -artifacts: - - path: '_build/Testing/Temporary/*' - name: test_results - -before_build: -- ps: | - Write-Output "Configuration: $env:CONFIGURATION" - Write-Output "Platform: $env:PLATFORM" - $generator = switch ($env:TOOLSET) - { - "v140" {"Visual Studio 14 2015"} - "v120" {"Visual Studio 12 2013"} - "v110" {"Visual Studio 11 2012"} - "v100" {"Visual Studio 10 2010"} - } - if ($env:PLATFORM -eq "x64") - { - $generator = "$generator Win64" - } - -build_script: -- ps: | - if (($env:TOOLSET -eq "v100") -and ($env:PLATFORM -eq "x64")) - { - return - } - md _build -Force | Out-Null - cd _build - - & cmake -G "$generator" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -Dgtest_build_tests=ON -Dgtest_build_samples=ON -Dgmock_build_tests=ON .. - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } - & cmake --build . --config $env:CONFIGURATION - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } - -test_script: -- ps: | - if (($env:Toolset -eq "v100") -and ($env:PLATFORM -eq "x64")) - { - return - } - - & ctest -C $env:CONFIGURATION --output-on-failure - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CHANGES b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CHANGES deleted file mode 100644 index 4328ece3d3a..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CHANGES +++ /dev/null @@ -1,126 +0,0 @@ -Changes for 1.7.0: - -* All new improvements in Google Test 1.7.0. -* New feature: matchers DoubleNear(), FloatNear(), - NanSensitiveDoubleNear(), NanSensitiveFloatNear(), - UnorderedElementsAre(), UnorderedElementsAreArray(), WhenSorted(), - WhenSortedBy(), IsEmpty(), and SizeIs(). -* Improvement: Google Mock can now be built as a DLL. -* Improvement: when compiled by a C++11 compiler, matchers AllOf() - and AnyOf() can accept an arbitrary number of matchers. -* Improvement: when compiled by a C++11 compiler, matchers - ElementsAreArray() can accept an initializer list. -* Improvement: when exceptions are enabled, a mock method with no - default action now throws instead crashing the test. -* Improvement: added class testing::StringMatchResultListener to aid - definition of composite matchers. -* Improvement: function return types used in MOCK_METHOD*() macros can - now contain unprotected commas. -* Improvement (potentially breaking): EXPECT_THAT() and ASSERT_THAT() - are now more strict in ensuring that the value type and the matcher - type are compatible, catching potential bugs in tests. -* Improvement: Pointee() now works on an optional. -* Improvement: the ElementsAreArray() matcher can now take a vector or - iterator range as input, and makes a copy of its input elements - before the conversion to a Matcher. -* Improvement: the Google Mock Generator can now generate mocks for - some class templates. -* Bug fix: mock object destruction triggerred by another mock object's - destruction no longer hangs. -* Improvement: Google Mock Doctor works better with newer Clang and - GCC now. -* Compatibility fixes. -* Bug/warning fixes. - -Changes for 1.6.0: - -* Compilation is much faster and uses much less memory, especially - when the constructor and destructor of a mock class are moved out of - the class body. -* New matchers: Pointwise(), Each(). -* New actions: ReturnPointee() and ReturnRefOfCopy(). -* CMake support. -* Project files for Visual Studio 2010. -* AllOf() and AnyOf() can handle up-to 10 arguments now. -* Google Mock doctor understands Clang error messages now. -* SetArgPointee<> now accepts string literals. -* gmock_gen.py handles storage specifier macros and template return - types now. -* Compatibility fixes. -* Bug fixes and implementation clean-ups. -* Potentially incompatible changes: disables the harmful 'make install' - command in autotools. - -Potentially breaking changes: - -* The description string for MATCHER*() changes from Python-style - interpolation to an ordinary C++ string expression. -* SetArgumentPointee is deprecated in favor of SetArgPointee. -* Some non-essential project files for Visual Studio 2005 are removed. - -Changes for 1.5.0: - - * New feature: Google Mock can be safely used in multi-threaded tests - on platforms having pthreads. - * New feature: function for printing a value of arbitrary type. - * New feature: function ExplainMatchResult() for easy definition of - composite matchers. - * The new matcher API lets user-defined matchers generate custom - explanations more directly and efficiently. - * Better failure messages all around. - * NotNull() and IsNull() now work with smart pointers. - * Field() and Property() now work when the matcher argument is a pointer - passed by reference. - * Regular expression matchers on all platforms. - * Added GCC 4.0 support for Google Mock Doctor. - * Added gmock_all_test.cc for compiling most Google Mock tests - in a single file. - * Significantly cleaned up compiler warnings. - * Bug fixes, better test coverage, and implementation clean-ups. - - Potentially breaking changes: - - * Custom matchers defined using MatcherInterface or MakePolymorphicMatcher() - need to be updated after upgrading to Google Mock 1.5.0; matchers defined - using MATCHER or MATCHER_P* aren't affected. - * Dropped support for 'make install'. - -Changes for 1.4.0 (we skipped 1.2.* and 1.3.* to match the version of -Google Test): - - * Works in more environments: Symbian and minGW, Visual C++ 7.1. - * Lighter weight: comes with our own implementation of TR1 tuple (no - more dependency on Boost!). - * New feature: --gmock_catch_leaked_mocks for detecting leaked mocks. - * New feature: ACTION_TEMPLATE for defining templatized actions. - * New feature: the .After() clause for specifying expectation order. - * New feature: the .With() clause for specifying inter-argument - constraints. - * New feature: actions ReturnArg(), ReturnNew(...), and - DeleteArg(). - * New feature: matchers Key(), Pair(), Args<...>(), AllArgs(), IsNull(), - and Contains(). - * New feature: utility class MockFunction, useful for checkpoints, etc. - * New feature: functions Value(x, m) and SafeMatcherCast(m). - * New feature: copying a mock object is rejected at compile time. - * New feature: a script for fusing all Google Mock and Google Test - source files for easy deployment. - * Improved the Google Mock doctor to diagnose more diseases. - * Improved the Google Mock generator script. - * Compatibility fixes for Mac OS X and gcc. - * Bug fixes and implementation clean-ups. - -Changes for 1.1.0: - - * New feature: ability to use Google Mock with any testing framework. - * New feature: macros for easily defining new matchers - * New feature: macros for easily defining new actions. - * New feature: more container matchers. - * New feature: actions for accessing function arguments and throwing - exceptions. - * Improved the Google Mock doctor script for diagnosing compiler errors. - * Bug fixes and implementation clean-ups. - -Changes for 1.0.0: - - * Initial Open Source release of Google Mock diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CMakeLists.txt b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CMakeLists.txt deleted file mode 100644 index bd759dfd3e0..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CMakeLists.txt +++ /dev/null @@ -1,223 +0,0 @@ -######################################################################## -# CMake build script for Google Mock. -# -# To run the tests for Google Mock itself on Linux, use 'make test' or -# ctest. You can select which tests to run using 'ctest -R regex'. -# For more options, run 'ctest --help'. - -# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to -# make it prominent in the GUI. -option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) - -option(gmock_build_tests "Build all of Google Mock's own tests." OFF) - -# A directory to find Google Test sources. -if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt") - set(gtest_dir gtest) -else() - set(gtest_dir ../googletest) -endif() - -# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build(). -include("${gtest_dir}/cmake/hermetic_build.cmake" OPTIONAL) - -if (COMMAND pre_project_set_up_hermetic_build) - # Google Test also calls hermetic setup functions from add_subdirectory, - # although its changes will not affect things at the current scope. - pre_project_set_up_hermetic_build() -endif() - -######################################################################## -# -# Project-wide settings - -# Name of the project. -# -# CMake files in this project can refer to the root source directory -# as ${gmock_SOURCE_DIR} and to the root binary directory as -# ${gmock_BINARY_DIR}. -# Language "C" is required for find_package(Threads). -if (CMAKE_VERSION VERSION_LESS 3.0) - project(gmock CXX C) -else() - cmake_policy(SET CMP0048 NEW) - project(gmock VERSION 1.9.0 LANGUAGES CXX C) -endif() -cmake_minimum_required(VERSION 2.6.4) - -if (COMMAND set_up_hermetic_build) - set_up_hermetic_build() -endif() - -# Instructs CMake to process Google Test's CMakeLists.txt and add its -# targets to the current scope. We are placing Google Test's binary -# directory in a subdirectory of our own as VC compilation may break -# if they are the same (the default). -add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest") - -# Although Google Test's CMakeLists.txt calls this function, the -# changes there don't affect the current scope. Therefore we have to -# call it again here. -config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake - -# Adds Google Mock's and Google Test's header directories to the search path. -include_directories("${gmock_SOURCE_DIR}/include" - "${gmock_SOURCE_DIR}" - "${gtest_SOURCE_DIR}/include" - # This directory is needed to build directly from Google - # Test sources. - "${gtest_SOURCE_DIR}") - -# Summary of tuple support for Microsoft Visual Studio: -# Compiler version(MS) version(cmake) Support -# ---------- ----------- -------------- ----------------------------- -# <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple. -# VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10 -# VS 2013 12 1800 std::tr1::tuple -if (MSVC AND MSVC_VERSION EQUAL 1700) - add_definitions(/D _VARIADIC_MAX=10) -endif() - -######################################################################## -# -# Defines the gmock & gmock_main libraries. User tests should link -# with one of them. - -# Google Mock libraries. We build them using more strict warnings than what -# are used for other targets, to ensure that Google Mock can be compiled by -# a user aggressive about warnings. -cxx_library(gmock - "${cxx_strict}" - "${gtest_dir}/src/gtest-all.cc" - src/gmock-all.cc) - -cxx_library(gmock_main - "${cxx_strict}" - "${gtest_dir}/src/gtest-all.cc" - src/gmock-all.cc - src/gmock_main.cc) - -# If the CMake version supports it, attach header directory information -# to the targets for when we are part of a parent build (ie being pulled -# in via add_subdirectory() rather than being a standalone build). -if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - target_include_directories(gmock INTERFACE "${gmock_SOURCE_DIR}/include") - target_include_directories(gmock_main INTERFACE "${gmock_SOURCE_DIR}/include") -endif() - -######################################################################## -# -# Install rules -if(INSTALL_GMOCK) - install(TARGETS gmock gmock_main - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install(DIRECTORY ${gmock_SOURCE_DIR}/include/gmock - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - - # configure and install pkgconfig files - configure_file( - cmake/gmock.pc.in - "${CMAKE_BINARY_DIR}/gmock.pc" - @ONLY) - configure_file( - cmake/gmock_main.pc.in - "${CMAKE_BINARY_DIR}/gmock_main.pc" - @ONLY) - install(FILES "${CMAKE_BINARY_DIR}/gmock.pc" "${CMAKE_BINARY_DIR}/gmock_main.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") -endif() - -######################################################################## -# -# Google Mock's own tests. -# -# You can skip this section if you aren't interested in testing -# Google Mock itself. -# -# The tests are not built by default. To build them, set the -# gmock_build_tests option to ON. You can do it by running ccmake -# or specifying the -Dgmock_build_tests=ON flag when running cmake. - -if (gmock_build_tests) - # This must be set in the root directory for the tests to be run by - # 'make test' or ctest. - enable_testing() - - ############################################################ - # C++ tests built with standard compiler flags. - - cxx_test(gmock-actions_test gmock_main) - cxx_test(gmock-cardinalities_test gmock_main) - cxx_test(gmock_ex_test gmock_main) - cxx_test(gmock-generated-actions_test gmock_main) - cxx_test(gmock-generated-function-mockers_test gmock_main) - cxx_test(gmock-generated-internal-utils_test gmock_main) - cxx_test(gmock-generated-matchers_test gmock_main) - cxx_test(gmock-internal-utils_test gmock_main) - cxx_test(gmock-matchers_test gmock_main) - cxx_test(gmock-more-actions_test gmock_main) - cxx_test(gmock-nice-strict_test gmock_main) - cxx_test(gmock-port_test gmock_main) - cxx_test(gmock-spec-builders_test gmock_main) - cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc) - cxx_test(gmock_test gmock_main) - - if (CMAKE_USE_PTHREADS_INIT) - cxx_test(gmock_stress_test gmock) - endif() - - # gmock_all_test is commented to save time building and running tests. - # Uncomment if necessary. - # cxx_test(gmock_all_test gmock_main) - - ############################################################ - # C++ tests built with non-standard compiler flags. - - cxx_library(gmock_main_no_exception "${cxx_no_exception}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - if (NOT MSVC OR MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010. - # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that - # conflict with our own definitions. Therefore using our own tuple does not - # work on those compilers. - cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}" - gmock_main_use_own_tuple test/gmock-spec-builders_test.cc) - endif() - - cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}" - gmock_main_no_exception test/gmock-more-actions_test.cc) - - cxx_test_with_flags(gmock_no_rtti_test "${cxx_no_rtti}" - gmock_main_no_rtti test/gmock-spec-builders_test.cc) - - cxx_shared_library(shared_gmock_main "${cxx_default}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - # Tests that a binary can be built with Google Mock as a shared library. On - # some system configurations, it may not possible to run the binary without - # knowing more details about the system configurations. We do not try to run - # this binary. To get a more robust shared library coverage, configure with - # -DBUILD_SHARED_LIBS=ON. - cxx_executable_with_flags(shared_gmock_test_ "${cxx_default}" - shared_gmock_main test/gmock-spec-builders_test.cc) - set_target_properties(shared_gmock_test_ - PROPERTIES - COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") - - ############################################################ - # Python tests. - - cxx_executable(gmock_leak_test_ test gmock_main) - py_test(gmock_leak_test) - - cxx_executable(gmock_output_test_ test gmock) - py_test(gmock_output_test) -endif() diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CONTRIBUTORS b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CONTRIBUTORS deleted file mode 100644 index 6e9ae362b60..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/CONTRIBUTORS +++ /dev/null @@ -1,40 +0,0 @@ -# This file contains a list of people who've made non-trivial -# contribution to the Google C++ Mocking Framework project. People -# who commit code to the project are encouraged to add their names -# here. Please keep the list sorted by first names. - -Benoit Sigoure -Bogdan Piloca -Chandler Carruth -Dave MacLachlan -David Anderson -Dean Sturtevant -Gene Volovich -Hal Burch -Jeffrey Yasskin -Jim Keller -Joe Walnes -Jon Wray -Keir Mierle -Keith Ray -Kostya Serebryany -Lev Makhlis -Manuel Klimek -Mario Tanev -Mark Paskin -Markus Heule -Matthew Simmons -Mike Bland -Neal Norwitz -Nermin Ozkiranartli -Owen Carlsen -Paneendra Ba -Paul Menage -Piotr Kaminski -Russ Rufer -Sverre Sundsdal -Takeshi Yoshino -Vadim Berman -Vlad Losev -Wolfgang Klier -Zhanyong Wan diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/LICENSE b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/LICENSE deleted file mode 100644 index 1941a11f8ce..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2008, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/Makefile.am b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/Makefile.am deleted file mode 100644 index 9adbc5163dd..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/Makefile.am +++ /dev/null @@ -1,224 +0,0 @@ -# Automake file - -# Nonstandard package files for distribution. -EXTRA_DIST = LICENSE - -# We may need to build our internally packaged gtest. If so, it will be -# included in the 'subdirs' variable. -SUBDIRS = $(subdirs) - -# This is generated by the configure script, so clean it for distribution. -DISTCLEANFILES = scripts/gmock-config - -# We define the global AM_CPPFLAGS as everything we compile includes from these -# directories. -AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I$(srcdir)/include - -# Modifies compiler and linker flags for pthreads compatibility. -if HAVE_PTHREADS - AM_CXXFLAGS = @PTHREAD_CFLAGS@ -DGTEST_HAS_PTHREAD=1 - AM_LIBS = @PTHREAD_LIBS@ -endif - -# Build rules for libraries. -lib_LTLIBRARIES = lib/libgmock.la lib/libgmock_main.la - -lib_libgmock_la_SOURCES = src/gmock-all.cc - -pkginclude_HEADERS = \ - include/gmock/gmock-actions.h \ - include/gmock/gmock-cardinalities.h \ - include/gmock/gmock-generated-actions.h \ - include/gmock/gmock-generated-function-mockers.h \ - include/gmock/gmock-generated-matchers.h \ - include/gmock/gmock-generated-nice-strict.h \ - include/gmock/gmock-matchers.h \ - include/gmock/gmock-more-actions.h \ - include/gmock/gmock-more-matchers.h \ - include/gmock/gmock-spec-builders.h \ - include/gmock/gmock.h - -pkginclude_internaldir = $(pkgincludedir)/internal -pkginclude_internal_HEADERS = \ - include/gmock/internal/gmock-generated-internal-utils.h \ - include/gmock/internal/gmock-internal-utils.h \ - include/gmock/internal/gmock-port.h \ - include/gmock/internal/custom/gmock-generated-actions.h \ - include/gmock/internal/custom/gmock-matchers.h \ - include/gmock/internal/custom/gmock-port.h - -lib_libgmock_main_la_SOURCES = src/gmock_main.cc -lib_libgmock_main_la_LIBADD = lib/libgmock.la - -# Build rules for tests. Automake's naming for some of these variables isn't -# terribly obvious, so this is a brief reference: -# -# TESTS -- Programs run automatically by "make check" -# check_PROGRAMS -- Programs built by "make check" but not necessarily run - -TESTS= -check_PROGRAMS= -AM_LDFLAGS = $(GTEST_LDFLAGS) - -# This exercises all major components of Google Mock. It also -# verifies that libgmock works. -TESTS += test/gmock-spec-builders_test -check_PROGRAMS += test/gmock-spec-builders_test -test_gmock_spec_builders_test_SOURCES = test/gmock-spec-builders_test.cc -test_gmock_spec_builders_test_LDADD = $(GTEST_LIBS) lib/libgmock.la - -# This tests using Google Mock in multiple translation units. It also -# verifies that libgmock_main and libgmock work. -TESTS += test/gmock_link_test -check_PROGRAMS += test/gmock_link_test -test_gmock_link_test_SOURCES = \ - test/gmock_link2_test.cc \ - test/gmock_link_test.cc \ - test/gmock_link_test.h -test_gmock_link_test_LDADD = $(GTEST_LIBS) lib/libgmock_main.la lib/libgmock.la - -if HAVE_PYTHON - # Tests that fused gmock files compile and work. - TESTS += test/gmock_fused_test - check_PROGRAMS += test/gmock_fused_test - test_gmock_fused_test_SOURCES = \ - fused-src/gmock-gtest-all.cc \ - fused-src/gmock/gmock.h \ - fused-src/gmock_main.cc \ - fused-src/gtest/gtest.h \ - test/gmock_test.cc - test_gmock_fused_test_CPPFLAGS = -I"$(srcdir)/fused-src" -endif - -# Google Mock source files that we don't compile directly. -GMOCK_SOURCE_INGLUDES = \ - src/gmock-cardinalities.cc \ - src/gmock-internal-utils.cc \ - src/gmock-matchers.cc \ - src/gmock-spec-builders.cc \ - src/gmock.cc - -EXTRA_DIST += $(GMOCK_SOURCE_INGLUDES) - -# C++ tests that we don't compile using autotools. -EXTRA_DIST += \ - test/gmock-actions_test.cc \ - test/gmock_all_test.cc \ - test/gmock-cardinalities_test.cc \ - test/gmock_ex_test.cc \ - test/gmock-generated-actions_test.cc \ - test/gmock-generated-function-mockers_test.cc \ - test/gmock-generated-internal-utils_test.cc \ - test/gmock-generated-matchers_test.cc \ - test/gmock-internal-utils_test.cc \ - test/gmock-matchers_test.cc \ - test/gmock-more-actions_test.cc \ - test/gmock-nice-strict_test.cc \ - test/gmock-port_test.cc \ - test/gmock_stress_test.cc - -# Python tests, which we don't run using autotools. -EXTRA_DIST += \ - test/gmock_leak_test.py \ - test/gmock_leak_test_.cc \ - test/gmock_output_test.py \ - test/gmock_output_test_.cc \ - test/gmock_output_test_golden.txt \ - test/gmock_test_utils.py - -# Nonstandard package files for distribution. -EXTRA_DIST += \ - CHANGES \ - CONTRIBUTORS \ - make/Makefile - -# Pump scripts for generating Google Mock headers. -# TODO(chandlerc@google.com): automate the generation of *.h from *.h.pump. -EXTRA_DIST += \ - include/gmock/gmock-generated-actions.h.pump \ - include/gmock/gmock-generated-function-mockers.h.pump \ - include/gmock/gmock-generated-matchers.h.pump \ - include/gmock/gmock-generated-nice-strict.h.pump \ - include/gmock/internal/gmock-generated-internal-utils.h.pump \ - include/gmock/internal/custom/gmock-generated-actions.h.pump - -# Script for fusing Google Mock and Google Test source files. -EXTRA_DIST += scripts/fuse_gmock_files.py - -# The Google Mock Generator tool from the cppclean project. -EXTRA_DIST += \ - scripts/generator/LICENSE \ - scripts/generator/README \ - scripts/generator/README.cppclean \ - scripts/generator/cpp/__init__.py \ - scripts/generator/cpp/ast.py \ - scripts/generator/cpp/gmock_class.py \ - scripts/generator/cpp/keywords.py \ - scripts/generator/cpp/tokenize.py \ - scripts/generator/cpp/utils.py \ - scripts/generator/gmock_gen.py - -# Script for diagnosing compiler errors in programs that use Google -# Mock. -EXTRA_DIST += scripts/gmock_doctor.py - -# CMake scripts. -EXTRA_DIST += \ - CMakeLists.txt - -# Microsoft Visual Studio 2005 projects. -EXTRA_DIST += \ - msvc/2005/gmock.sln \ - msvc/2005/gmock.vcproj \ - msvc/2005/gmock_config.vsprops \ - msvc/2005/gmock_main.vcproj \ - msvc/2005/gmock_test.vcproj - -# Microsoft Visual Studio 2010 projects. -EXTRA_DIST += \ - msvc/2010/gmock.sln \ - msvc/2010/gmock.vcxproj \ - msvc/2010/gmock_config.props \ - msvc/2010/gmock_main.vcxproj \ - msvc/2010/gmock_test.vcxproj - -if HAVE_PYTHON -# gmock_test.cc does not really depend on files generated by the -# fused-gmock-internal rule. However, gmock_test.o does, and it is -# important to include test/gmock_test.cc as part of this rule in order to -# prevent compiling gmock_test.o until all dependent files have been -# generated. -$(test_gmock_fused_test_SOURCES): fused-gmock-internal - -# TODO(vladl@google.com): Find a way to add Google Tests's sources here. -fused-gmock-internal: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \ - $(lib_libgmock_la_SOURCES) $(GMOCK_SOURCE_INGLUDES) \ - $(lib_libgmock_main_la_SOURCES) \ - scripts/fuse_gmock_files.py - mkdir -p "$(srcdir)/fused-src" - chmod -R u+w "$(srcdir)/fused-src" - rm -f "$(srcdir)/fused-src/gtest/gtest.h" - rm -f "$(srcdir)/fused-src/gmock/gmock.h" - rm -f "$(srcdir)/fused-src/gmock-gtest-all.cc" - "$(srcdir)/scripts/fuse_gmock_files.py" "$(srcdir)/fused-src" - cp -f "$(srcdir)/src/gmock_main.cc" "$(srcdir)/fused-src" - -maintainer-clean-local: - rm -rf "$(srcdir)/fused-src" -endif - -# Death tests may produce core dumps in the build directory. In case -# this happens, clean them to keep distcleancheck happy. -CLEANFILES = core - -# Disables 'make install' as installing a compiled version of Google -# Mock can lead to undefined behavior due to violation of the -# One-Definition Rule. - -install-exec-local: - echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system." - false - -install-data-local: - echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system." - false diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/README.md b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/README.md deleted file mode 100644 index f0ea6a0e5a5..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/README.md +++ /dev/null @@ -1,376 +0,0 @@ -## Google Mock ## - -The Google C++ mocking framework. - -### Overview ### - -Google's framework for writing and using C++ mock classes. -It can help you derive better designs of your system and write better tests. - -It is inspired by: - - * [jMock](http://www.jmock.org/), - * [EasyMock](http://www.easymock.org/), and - * [Hamcrest](http://code.google.com/p/hamcrest/), - -and designed with C++'s specifics in mind. - -Google mock: - - * lets you create mock classes trivially using simple macros. - * supports a rich set of matchers and actions. - * handles unordered, partially ordered, or completely ordered expectations. - * is extensible by users. - -We hope you find it useful! - -### Features ### - - * Provides a declarative syntax for defining mocks. - * Can easily define partial (hybrid) mocks, which are a cross of real - and mock objects. - * Handles functions of arbitrary types and overloaded functions. - * Comes with a rich set of matchers for validating function arguments. - * Uses an intuitive syntax for controlling the behavior of a mock. - * Does automatic verification of expectations (no record-and-replay needed). - * Allows arbitrary (partial) ordering constraints on - function calls to be expressed,. - * Lets an user extend it by defining new matchers and actions. - * Does not use exceptions. - * Is easy to learn and use. - -Please see the project page above for more information as well as the -mailing list for questions, discussions, and development. There is -also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please -join us! - -Please note that code under [scripts/generator](scripts/generator/) is -from [cppclean](http://code.google.com/p/cppclean/) and released under -the Apache License, which is different from Google Mock's license. - -## Getting Started ## - -If you are new to the project, we suggest that you read the user -documentation in the following order: - - * Learn the [basics](../../master/googletest/docs/Primer.md) of - Google Test, if you choose to use Google Mock with it (recommended). - * Read [Google Mock for Dummies](../../master/googlemock/docs/ForDummies.md). - * Read the instructions below on how to build Google Mock. - -You can also watch Zhanyong's [talk](http://www.youtube.com/watch?v=sYpCyLI47rM) on Google Mock's usage and implementation. - -Once you understand the basics, check out the rest of the docs: - - * [CheatSheet](../../master/googlemock/docs/CheatSheet.md) - all the commonly used stuff - at a glance. - * [CookBook](../../master/googlemock/docs/CookBook.md) - recipes for getting things done, - including advanced techniques. - -If you need help, please check the -[KnownIssues](docs/KnownIssues.md) and -[FrequentlyAskedQuestions](docs/FrequentlyAskedQuestions.md) before -posting a question on the -[discussion group](http://groups.google.com/group/googlemock). - - -### Using Google Mock Without Google Test ### - -Google Mock is not a testing framework itself. Instead, it needs a -testing framework for writing tests. Google Mock works seamlessly -with [Google Test](http://code.google.com/p/googletest/), but -you can also use it with [any C++ testing framework](../../master/googlemock/docs/ForDummies.md#using-google-mock-with-any-testing-framework). - -### Requirements for End Users ### - -Google Mock is implemented on top of [Google Test]( -http://github.com/google/googletest/), and depends on it. -You must use the bundled version of Google Test when using Google Mock. - -You can also easily configure Google Mock to work with another testing -framework, although it will still need Google Test. Please read -["Using_Google_Mock_with_Any_Testing_Framework"]( - ../../master/googlemock/docs/ForDummies.md#using-google-mock-with-any-testing-framework) -for instructions. - -Google Mock depends on advanced C++ features and thus requires a more -modern compiler. The following are needed to use Google Mock: - -#### Linux Requirements #### - - * GNU-compatible Make or "gmake" - * POSIX-standard shell - * POSIX(-2) Regular Expressions (regex.h) - * C++98-standard-compliant compiler (e.g. GCC 3.4 or newer) - -#### Windows Requirements #### - - * Microsoft Visual C++ 8.0 SP1 or newer - -#### Mac OS X Requirements #### - - * Mac OS X 10.4 Tiger or newer - * Developer Tools Installed - -### Requirements for Contributors ### - -We welcome patches. If you plan to contribute a patch, you need to -build Google Mock and its tests, which has further requirements: - - * Automake version 1.9 or newer - * Autoconf version 2.59 or newer - * Libtool / Libtoolize - * Python version 2.3 or newer (for running some of the tests and - re-generating certain source files from templates) - -### Building Google Mock ### - -#### Using CMake #### - -If you have CMake available, it is recommended that you follow the -[build instructions][gtest_cmakebuild] -as described for Google Test. - -If are using Google Mock with an -existing CMake project, the section -[Incorporating Into An Existing CMake Project][gtest_incorpcmake] -may be of particular interest. -To make it work for Google Mock you will need to change - - target_link_libraries(example gtest_main) - -to - - target_link_libraries(example gmock_main) - -This works because `gmock_main` library is compiled with Google Test. -However, it does not automatically add Google Test includes. -Therefore you will also have to change - - if (CMAKE_VERSION VERSION_LESS 2.8.11) - include_directories("${gtest_SOURCE_DIR}/include") - endif() - -to - - if (CMAKE_VERSION VERSION_LESS 2.8.11) - include_directories(BEFORE SYSTEM - "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include") - else() - target_include_directories(gmock_main SYSTEM BEFORE INTERFACE - "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include") - endif() - -This will addtionally mark Google Mock includes as system, which will -silence compiler warnings when compiling your tests using clang with -`-Wpedantic -Wall -Wextra -Wconversion`. - - -#### Preparing to Build (Unix only) #### - -If you are using a Unix system and plan to use the GNU Autotools build -system to build Google Mock (described below), you'll need to -configure it now. - -To prepare the Autotools build system: - - cd googlemock - autoreconf -fvi - -To build Google Mock and your tests that use it, you need to tell your -build system where to find its headers and source files. The exact -way to do it depends on which build system you use, and is usually -straightforward. - -This section shows how you can integrate Google Mock into your -existing build system. - -Suppose you put Google Mock in directory `${GMOCK_DIR}` and Google Test -in `${GTEST_DIR}` (the latter is `${GMOCK_DIR}/gtest` by default). To -build Google Mock, create a library build target (or a project as -called by Visual Studio and Xcode) to compile - - ${GTEST_DIR}/src/gtest-all.cc and ${GMOCK_DIR}/src/gmock-all.cc - -with - - ${GTEST_DIR}/include and ${GMOCK_DIR}/include - -in the system header search path, and - - ${GTEST_DIR} and ${GMOCK_DIR} - -in the normal header search path. Assuming a Linux-like system and gcc, -something like the following will do: - - g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \ - -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} \ - -pthread -c ${GTEST_DIR}/src/gtest-all.cc - g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \ - -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} \ - -pthread -c ${GMOCK_DIR}/src/gmock-all.cc - ar -rv libgmock.a gtest-all.o gmock-all.o - -(We need -pthread as Google Test and Google Mock use threads.) - -Next, you should compile your test source file with -${GTEST\_DIR}/include and ${GMOCK\_DIR}/include in the header search -path, and link it with gmock and any other necessary libraries: - - g++ -isystem ${GTEST_DIR}/include -isystem ${GMOCK_DIR}/include \ - -pthread path/to/your_test.cc libgmock.a -o your_test - -As an example, the make/ directory contains a Makefile that you can -use to build Google Mock on systems where GNU make is available -(e.g. Linux, Mac OS X, and Cygwin). It doesn't try to build Google -Mock's own tests. Instead, it just builds the Google Mock library and -a sample test. You can use it as a starting point for your own build -script. - -If the default settings are correct for your environment, the -following commands should succeed: - - cd ${GMOCK_DIR}/make - make - ./gmock_test - -If you see errors, try to tweak the contents of -[make/Makefile](make/Makefile) to make them go away. - -### Windows ### - -The msvc/2005 directory contains VC++ 2005 projects and the msvc/2010 -directory contains VC++ 2010 projects for building Google Mock and -selected tests. - -Change to the appropriate directory and run "msbuild gmock.sln" to -build the library and tests (or open the gmock.sln in the MSVC IDE). -If you want to create your own project to use with Google Mock, you'll -have to configure it to use the `gmock_config` propety sheet. For that: - - * Open the Property Manager window (View | Other Windows | Property Manager) - * Right-click on your project and select "Add Existing Property Sheet..." - * Navigate to `gmock_config.vsprops` or `gmock_config.props` and select it. - * In Project Properties | Configuration Properties | General | Additional - Include Directories, type /include. - -### Tweaking Google Mock ### - -Google Mock can be used in diverse environments. The default -configuration may not work (or may not work well) out of the box in -some environments. However, you can easily tweak Google Mock by -defining control macros on the compiler command line. Generally, -these macros are named like `GTEST_XYZ` and you define them to either 1 -or 0 to enable or disable a certain feature. - -We list the most frequently used macros below. For a complete list, -see file [${GTEST\_DIR}/include/gtest/internal/gtest-port.h]( -../googletest/include/gtest/internal/gtest-port.h). - -### Choosing a TR1 Tuple Library ### - -Google Mock uses the C++ Technical Report 1 (TR1) tuple library -heavily. Unfortunately TR1 tuple is not yet widely available with all -compilers. The good news is that Google Test 1.4.0+ implements a -subset of TR1 tuple that's enough for Google Mock's need. Google Mock -will automatically use that implementation when the compiler doesn't -provide TR1 tuple. - -Usually you don't need to care about which tuple library Google Test -and Google Mock use. However, if your project already uses TR1 tuple, -you need to tell Google Test and Google Mock to use the same TR1 tuple -library the rest of your project uses, or the two tuple -implementations will clash. To do that, add - - -DGTEST_USE_OWN_TR1_TUPLE=0 - -to the compiler flags while compiling Google Test, Google Mock, and -your tests. If you want to force Google Test and Google Mock to use -their own tuple library, just add - - -DGTEST_USE_OWN_TR1_TUPLE=1 - -to the compiler flags instead. - -If you want to use Boost's TR1 tuple library with Google Mock, please -refer to the Boost website (http://www.boost.org/) for how to obtain -it and set it up. - -### As a Shared Library (DLL) ### - -Google Mock is compact, so most users can build and link it as a static -library for the simplicity. Google Mock can be used as a DLL, but the -same DLL must contain Google Test as well. See -[Google Test's README][gtest_readme] -for instructions on how to set up necessary compiler settings. - -### Tweaking Google Mock ### - -Most of Google Test's control macros apply to Google Mock as well. -Please see [Google Test's README][gtest_readme] for how to tweak them. - -### Upgrading from an Earlier Version ### - -We strive to keep Google Mock releases backward compatible. -Sometimes, though, we have to make some breaking changes for the -users' long-term benefits. This section describes what you'll need to -do if you are upgrading from an earlier version of Google Mock. - -#### Upgrading from 1.1.0 or Earlier #### - -You may need to explicitly enable or disable Google Test's own TR1 -tuple library. See the instructions in section "[Choosing a TR1 Tuple -Library](../googletest/#choosing-a-tr1-tuple-library)". - -#### Upgrading from 1.4.0 or Earlier #### - -On platforms where the pthread library is available, Google Test and -Google Mock use it in order to be thread-safe. For this to work, you -may need to tweak your compiler and/or linker flags. Please see the -"[Multi-threaded Tests](../googletest#multi-threaded-tests -)" section in file Google Test's README for what you may need to do. - -If you have custom matchers defined using `MatcherInterface` or -`MakePolymorphicMatcher()`, you'll need to update their definitions to -use the new matcher API ( -[monomorphic](http://code.google.com/p/googlemock/wiki/CookBook#Writing_New_Monomorphic_Matchers), -[polymorphic](http://code.google.com/p/googlemock/wiki/CookBook#Writing_New_Polymorphic_Matchers)). -Matchers defined using `MATCHER()` or `MATCHER_P*()` aren't affected. - -### Developing Google Mock ### - -This section discusses how to make your own changes to Google Mock. - -#### Testing Google Mock Itself #### - -To make sure your changes work as intended and don't break existing -functionality, you'll want to compile and run Google Test's own tests. -For that you'll need Autotools. First, make sure you have followed -the instructions above to configure Google Mock. -Then, create a build output directory and enter it. Next, - - ${GMOCK_DIR}/configure # try --help for more info - -Once you have successfully configured Google Mock, the build steps are -standard for GNU-style OSS packages. - - make # Standard makefile following GNU conventions - make check # Builds and runs all tests - all should pass. - -Note that when building your project against Google Mock, you are building -against Google Test as well. There is no need to configure Google Test -separately. - -#### Contributing a Patch #### - -We welcome patches. -Please read the [Developer's Guide](docs/DevGuide.md) -for how you can contribute. In particular, make sure you have signed -the Contributor License Agreement, or we won't be able to accept the -patch. - -Happy testing! - -[gtest_readme]: ../googletest/README.md "googletest" -[gtest_cmakebuild]: ../googletest/README.md#using-cmake "Using CMake" -[gtest_incorpcmake]: ../googletest/README.md#incorporating-into-an-existing-cmake-project "Incorporating Into An Existing CMake Project" diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/build-aux/.keep b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/build-aux/.keep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/cmake/gmock.pc.in b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/cmake/gmock.pc.in deleted file mode 100644 index c44164264ac..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/cmake/gmock.pc.in +++ /dev/null @@ -1,9 +0,0 @@ -libdir=@CMAKE_INSTALL_FULL_LIBDIR@ -includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ - -Name: gmock -Description: GoogleMock (without main() function) -Version: @PROJECT_VERSION@ -URL: https://github.com/google/googletest -Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/cmake/gmock_main.pc.in b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/cmake/gmock_main.pc.in deleted file mode 100644 index c377dba1e57..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/cmake/gmock_main.pc.in +++ /dev/null @@ -1,9 +0,0 @@ -libdir=@CMAKE_INSTALL_FULL_LIBDIR@ -includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ - -Name: gmock_main -Description: GoogleMock (with main() function) -Version: @PROJECT_VERSION@ -URL: https://github.com/google/googletest -Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/configure.ac b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/configure.ac deleted file mode 100644 index edfd8963f89..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/configure.ac +++ /dev/null @@ -1,146 +0,0 @@ -m4_include(../googletest/m4/acx_pthread.m4) - -AC_INIT([Google C++ Mocking Framework], - [1.7.0], - [googlemock@googlegroups.com], - [gmock]) - -# Provide various options to initialize the Autoconf and configure processes. -AC_PREREQ([2.59]) -AC_CONFIG_SRCDIR([./LICENSE]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_HEADERS([build-aux/config.h]) -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([scripts/gmock-config], [chmod +x scripts/gmock-config]) - -# Initialize Automake with various options. We require at least v1.9, prevent -# pedantic complaints about package files, and enable various distribution -# targets. -AM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip foreign subdir-objects]) - -# Check for programs used in building Google Test. -AC_PROG_CC -AC_PROG_CXX -AC_LANG([C++]) -AC_PROG_LIBTOOL - -# TODO(chandlerc@google.com): Currently we aren't running the Python tests -# against the interpreter detected by AM_PATH_PYTHON, and so we condition -# HAVE_PYTHON by requiring "python" to be in the PATH, and that interpreter's -# version to be >= 2.3. This will allow the scripts to use a "/usr/bin/env" -# hashbang. -PYTHON= # We *do not* allow the user to specify a python interpreter -AC_PATH_PROG([PYTHON],[python],[:]) -AS_IF([test "$PYTHON" != ":"], - [AM_PYTHON_CHECK_VERSION([$PYTHON],[2.3],[:],[PYTHON=":"])]) -AM_CONDITIONAL([HAVE_PYTHON],[test "$PYTHON" != ":"]) - -# TODO(chandlerc@google.com) Check for the necessary system headers. - -# Configure pthreads. -AC_ARG_WITH([pthreads], - [AS_HELP_STRING([--with-pthreads], - [use pthreads (default is yes)])], - [with_pthreads=$withval], - [with_pthreads=check]) - -have_pthreads=no -AS_IF([test "x$with_pthreads" != "xno"], - [ACX_PTHREAD( - [], - [AS_IF([test "x$with_pthreads" != "xcheck"], - [AC_MSG_FAILURE( - [--with-pthreads was specified, but unable to be used])])]) - have_pthreads="$acx_pthread_ok"]) -AM_CONDITIONAL([HAVE_PTHREADS],[test "x$have_pthreads" == "xyes"]) -AC_SUBST(PTHREAD_CFLAGS) -AC_SUBST(PTHREAD_LIBS) - -# GoogleMock currently has hard dependencies upon GoogleTest above and beyond -# running its own test suite, so we both provide our own version in -# a subdirectory and provide some logic to use a custom version or a system -# installed version. -AC_ARG_WITH([gtest], - [AS_HELP_STRING([--with-gtest], - [Specifies how to find the gtest package. If no - arguments are given, the default behavior, a - system installed gtest will be used if present, - and an internal version built otherwise. If a - path is provided, the gtest built or installed at - that prefix will be used.])], - [], - [with_gtest=yes]) -AC_ARG_ENABLE([external-gtest], - [AS_HELP_STRING([--disable-external-gtest], - [Disables any detection or use of a system - installed or user provided gtest. Any option to - '--with-gtest' is ignored. (Default is enabled.)]) - ], [], [enable_external_gtest=yes]) -AS_IF([test "x$with_gtest" == "xno"], - [AC_MSG_ERROR([dnl -Support for GoogleTest was explicitly disabled. Currently GoogleMock has a hard -dependency upon GoogleTest to build, please provide a version, or allow -GoogleMock to use any installed version and fall back upon its internal -version.])]) - -# Setup various GTEST variables. TODO(chandlerc@google.com): When these are -# used below, they should be used such that any pre-existing values always -# trump values we set them to, so that they can be used to selectively override -# details of the detection process. -AC_ARG_VAR([GTEST_CONFIG], - [The exact path of Google Test's 'gtest-config' script.]) -AC_ARG_VAR([GTEST_CPPFLAGS], - [C-like preprocessor flags for Google Test.]) -AC_ARG_VAR([GTEST_CXXFLAGS], - [C++ compile flags for Google Test.]) -AC_ARG_VAR([GTEST_LDFLAGS], - [Linker path and option flags for Google Test.]) -AC_ARG_VAR([GTEST_LIBS], - [Library linking flags for Google Test.]) -AC_ARG_VAR([GTEST_VERSION], - [The version of Google Test available.]) -HAVE_BUILT_GTEST="no" - -GTEST_MIN_VERSION="1.7.0" - -AS_IF([test "x${enable_external_gtest}" = "xyes"], - [# Begin filling in variables as we are able. - AS_IF([test "x${with_gtest}" != "xyes"], - [AS_IF([test -x "${with_gtest}/scripts/gtest-config"], - [GTEST_CONFIG="${with_gtest}/scripts/gtest-config"], - [GTEST_CONFIG="${with_gtest}/bin/gtest-config"]) - AS_IF([test -x "${GTEST_CONFIG}"], [], - [AC_MSG_ERROR([dnl -Unable to locate either a built or installed Google Test at '${with_gtest}'.]) - ])]) - - AS_IF([test -x "${GTEST_CONFIG}"], [], - [AC_PATH_PROG([GTEST_CONFIG], [gtest-config])]) - AS_IF([test -x "${GTEST_CONFIG}"], - [AC_MSG_CHECKING([for Google Test version >= ${GTEST_MIN_VERSION}]) - AS_IF([${GTEST_CONFIG} --min-version=${GTEST_MIN_VERSION}], - [AC_MSG_RESULT([yes]) - HAVE_BUILT_GTEST="yes"], - [AC_MSG_RESULT([no])])])]) - -AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"], - [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags` - GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags` - GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags` - GTEST_LIBS=`${GTEST_CONFIG} --libs` - GTEST_VERSION=`${GTEST_CONFIG} --version`], - [AC_CONFIG_SUBDIRS([../googletest]) - # GTEST_CONFIG needs to be executable both in a Makefile environment and - # in a shell script environment, so resolve an absolute path for it here. - GTEST_CONFIG="`pwd -P`/../googletest/scripts/gtest-config" - GTEST_CPPFLAGS='-I$(top_srcdir)/../googletest/include' - GTEST_CXXFLAGS='-g' - GTEST_LDFLAGS='' - GTEST_LIBS='$(top_builddir)/../googletest/lib/libgtest.la' - GTEST_VERSION="${GTEST_MIN_VERSION}"]) - -# TODO(chandlerc@google.com) Check the types, structures, and other compiler -# and architecture characteristics. - -# Output the generated files. No further autoconf macros may be used. -AC_OUTPUT diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/CheatSheet.md b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/CheatSheet.md deleted file mode 100644 index ef4451b8786..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/CheatSheet.md +++ /dev/null @@ -1,562 +0,0 @@ - - -# Defining a Mock Class # - -## Mocking a Normal Class ## - -Given -``` -class Foo { - ... - virtual ~Foo(); - virtual int GetSize() const = 0; - virtual string Describe(const char* name) = 0; - virtual string Describe(int type) = 0; - virtual bool Process(Bar elem, int count) = 0; -}; -``` -(note that `~Foo()` **must** be virtual) we can define its mock as -``` -#include "gmock/gmock.h" - -class MockFoo : public Foo { - MOCK_CONST_METHOD0(GetSize, int()); - MOCK_METHOD1(Describe, string(const char* name)); - MOCK_METHOD1(Describe, string(int type)); - MOCK_METHOD2(Process, bool(Bar elem, int count)); -}; -``` - -To create a "nice" mock object which ignores all uninteresting calls, -or a "strict" mock object, which treats them as failures: -``` -NiceMock nice_foo; // The type is a subclass of MockFoo. -StrictMock strict_foo; // The type is a subclass of MockFoo. -``` - -## Mocking a Class Template ## - -To mock -``` -template -class StackInterface { - public: - ... - virtual ~StackInterface(); - virtual int GetSize() const = 0; - virtual void Push(const Elem& x) = 0; -}; -``` -(note that `~StackInterface()` **must** be virtual) just append `_T` to the `MOCK_*` macros: -``` -template -class MockStack : public StackInterface { - public: - ... - MOCK_CONST_METHOD0_T(GetSize, int()); - MOCK_METHOD1_T(Push, void(const Elem& x)); -}; -``` - -## Specifying Calling Conventions for Mock Functions ## - -If your mock function doesn't use the default calling convention, you -can specify it by appending `_WITH_CALLTYPE` to any of the macros -described in the previous two sections and supplying the calling -convention as the first argument to the macro. For example, -``` - MOCK_METHOD_1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int n)); - MOCK_CONST_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, Bar, int(double x, double y)); -``` -where `STDMETHODCALLTYPE` is defined by `` on Windows. - -# Using Mocks in Tests # - -The typical flow is: - 1. Import the Google Mock names you need to use. All Google Mock names are in the `testing` namespace unless they are macros or otherwise noted. - 1. Create the mock objects. - 1. Optionally, set the default actions of the mock objects. - 1. Set your expectations on the mock objects (How will they be called? What wil they do?). - 1. Exercise code that uses the mock objects; if necessary, check the result using [Google Test](../../googletest/) assertions. - 1. When a mock objects is destructed, Google Mock automatically verifies that all expectations on it have been satisfied. - -Here is an example: -``` -using ::testing::Return; // #1 - -TEST(BarTest, DoesThis) { - MockFoo foo; // #2 - - ON_CALL(foo, GetSize()) // #3 - .WillByDefault(Return(1)); - // ... other default actions ... - - EXPECT_CALL(foo, Describe(5)) // #4 - .Times(3) - .WillRepeatedly(Return("Category 5")); - // ... other expectations ... - - EXPECT_EQ("good", MyProductionFunction(&foo)); // #5 -} // #6 -``` - -# Setting Default Actions # - -Google Mock has a **built-in default action** for any function that -returns `void`, `bool`, a numeric value, or a pointer. - -To customize the default action for functions with return type `T` globally: -``` -using ::testing::DefaultValue; - -// Sets the default value to be returned. T must be CopyConstructible. -DefaultValue::Set(value); -// Sets a factory. Will be invoked on demand. T must be MoveConstructible. -// T MakeT(); -DefaultValue::SetFactory(&MakeT); -// ... use the mocks ... -// Resets the default value. -DefaultValue::Clear(); -``` - -To customize the default action for a particular method, use `ON_CALL()`: -``` -ON_CALL(mock_object, method(matchers)) - .With(multi_argument_matcher) ? - .WillByDefault(action); -``` - -# Setting Expectations # - -`EXPECT_CALL()` sets **expectations** on a mock method (How will it be -called? What will it do?): -``` -EXPECT_CALL(mock_object, method(matchers)) - .With(multi_argument_matcher) ? - .Times(cardinality) ? - .InSequence(sequences) * - .After(expectations) * - .WillOnce(action) * - .WillRepeatedly(action) ? - .RetiresOnSaturation(); ? -``` - -If `Times()` is omitted, the cardinality is assumed to be: - - * `Times(1)` when there is neither `WillOnce()` nor `WillRepeatedly()`; - * `Times(n)` when there are `n WillOnce()`s but no `WillRepeatedly()`, where `n` >= 1; or - * `Times(AtLeast(n))` when there are `n WillOnce()`s and a `WillRepeatedly()`, where `n` >= 0. - -A method with no `EXPECT_CALL()` is free to be invoked _any number of times_, and the default action will be taken each time. - -# Matchers # - -A **matcher** matches a _single_ argument. You can use it inside -`ON_CALL()` or `EXPECT_CALL()`, or use it to validate a value -directly: - -| `EXPECT_THAT(value, matcher)` | Asserts that `value` matches `matcher`. | -|:------------------------------|:----------------------------------------| -| `ASSERT_THAT(value, matcher)` | The same as `EXPECT_THAT(value, matcher)`, except that it generates a **fatal** failure. | - -Built-in matchers (where `argument` is the function argument) are -divided into several categories: - -## Wildcard ## -|`_`|`argument` can be any value of the correct type.| -|:--|:-----------------------------------------------| -|`A()` or `An()`|`argument` can be any value of type `type`. | - -## Generic Comparison ## - -|`Eq(value)` or `value`|`argument == value`| -|:---------------------|:------------------| -|`Ge(value)` |`argument >= value`| -|`Gt(value)` |`argument > value` | -|`Le(value)` |`argument <= value`| -|`Lt(value)` |`argument < value` | -|`Ne(value)` |`argument != value`| -|`IsNull()` |`argument` is a `NULL` pointer (raw or smart).| -|`NotNull()` |`argument` is a non-null pointer (raw or smart).| -|`Ref(variable)` |`argument` is a reference to `variable`.| -|`TypedEq(value)`|`argument` has type `type` and is equal to `value`. You may need to use this instead of `Eq(value)` when the mock function is overloaded.| - -Except `Ref()`, these matchers make a _copy_ of `value` in case it's -modified or destructed later. If the compiler complains that `value` -doesn't have a public copy constructor, try wrap it in `ByRef()`, -e.g. `Eq(ByRef(non_copyable_value))`. If you do that, make sure -`non_copyable_value` is not changed afterwards, or the meaning of your -matcher will be changed. - -## Floating-Point Matchers ## - -|`DoubleEq(a_double)`|`argument` is a `double` value approximately equal to `a_double`, treating two NaNs as unequal.| -|:-------------------|:----------------------------------------------------------------------------------------------| -|`FloatEq(a_float)` |`argument` is a `float` value approximately equal to `a_float`, treating two NaNs as unequal. | -|`NanSensitiveDoubleEq(a_double)`|`argument` is a `double` value approximately equal to `a_double`, treating two NaNs as equal. | -|`NanSensitiveFloatEq(a_float)`|`argument` is a `float` value approximately equal to `a_float`, treating two NaNs as equal. | - -The above matchers use ULP-based comparison (the same as used in -[Google Test](../../googletest/)). They -automatically pick a reasonable error bound based on the absolute -value of the expected value. `DoubleEq()` and `FloatEq()` conform to -the IEEE standard, which requires comparing two NaNs for equality to -return false. The `NanSensitive*` version instead treats two NaNs as -equal, which is often what a user wants. - -|`DoubleNear(a_double, max_abs_error)`|`argument` is a `double` value close to `a_double` (absolute error <= `max_abs_error`), treating two NaNs as unequal.| -|:------------------------------------|:--------------------------------------------------------------------------------------------------------------------| -|`FloatNear(a_float, max_abs_error)` |`argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`), treating two NaNs as unequal. | -|`NanSensitiveDoubleNear(a_double, max_abs_error)`|`argument` is a `double` value close to `a_double` (absolute error <= `max_abs_error`), treating two NaNs as equal. | -|`NanSensitiveFloatNear(a_float, max_abs_error)`|`argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`), treating two NaNs as equal. | - -## String Matchers ## - -The `argument` can be either a C string or a C++ string object: - -|`ContainsRegex(string)`|`argument` matches the given regular expression.| -|:----------------------|:-----------------------------------------------| -|`EndsWith(suffix)` |`argument` ends with string `suffix`. | -|`HasSubstr(string)` |`argument` contains `string` as a sub-string. | -|`MatchesRegex(string)` |`argument` matches the given regular expression with the match starting at the first character and ending at the last character.| -|`StartsWith(prefix)` |`argument` starts with string `prefix`. | -|`StrCaseEq(string)` |`argument` is equal to `string`, ignoring case. | -|`StrCaseNe(string)` |`argument` is not equal to `string`, ignoring case.| -|`StrEq(string)` |`argument` is equal to `string`. | -|`StrNe(string)` |`argument` is not equal to `string`. | - -`ContainsRegex()` and `MatchesRegex()` use the regular expression -syntax defined -[here](../../googletest/docs/AdvancedGuide.md#regular-expression-syntax). -`StrCaseEq()`, `StrCaseNe()`, `StrEq()`, and `StrNe()` work for wide -strings as well. - -## Container Matchers ## - -Most STL-style containers support `==`, so you can use -`Eq(expected_container)` or simply `expected_container` to match a -container exactly. If you want to write the elements in-line, -match them more flexibly, or get more informative messages, you can use: - -| `ContainerEq(container)` | The same as `Eq(container)` except that the failure message also includes which elements are in one container but not the other. | -|:-------------------------|:---------------------------------------------------------------------------------------------------------------------------------| -| `Contains(e)` | `argument` contains an element that matches `e`, which can be either a value or a matcher. | -| `Each(e)` | `argument` is a container where _every_ element matches `e`, which can be either a value or a matcher. | -| `ElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, where the i-th element matches `ei`, which can be a value or a matcher. 0 to 10 arguments are allowed. | -| `ElementsAreArray({ e0, e1, ..., en })`, `ElementsAreArray(array)`, or `ElementsAreArray(array, count)` | The same as `ElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, or C-style array. | -| `IsEmpty()` | `argument` is an empty container (`container.empty()`). | -| `Pointwise(m, container)` | `argument` contains the same number of elements as in `container`, and for all i, (the i-th element in `argument`, the i-th element in `container`) match `m`, which is a matcher on 2-tuples. E.g. `Pointwise(Le(), upper_bounds)` verifies that each element in `argument` doesn't exceed the corresponding element in `upper_bounds`. See more detail below. | -| `SizeIs(m)` | `argument` is a container whose size matches `m`. E.g. `SizeIs(2)` or `SizeIs(Lt(2))`. | -| `UnorderedElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, and under some permutation each element matches an `ei` (for a different `i`), which can be a value or a matcher. 0 to 10 arguments are allowed. | -| `UnorderedElementsAreArray({ e0, e1, ..., en })`, `UnorderedElementsAreArray(array)`, or `UnorderedElementsAreArray(array, count)` | The same as `UnorderedElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, or C-style array. | -| `WhenSorted(m)` | When `argument` is sorted using the `<` operator, it matches container matcher `m`. E.g. `WhenSorted(UnorderedElementsAre(1, 2, 3))` verifies that `argument` contains elements `1`, `2`, and `3`, ignoring order. | -| `WhenSortedBy(comparator, m)` | The same as `WhenSorted(m)`, except that the given comparator instead of `<` is used to sort `argument`. E.g. `WhenSortedBy(std::greater(), ElementsAre(3, 2, 1))`. | - -Notes: - - * These matchers can also match: - 1. a native array passed by reference (e.g. in `Foo(const int (&a)[5])`), and - 1. an array passed as a pointer and a count (e.g. in `Bar(const T* buffer, int len)` -- see [Multi-argument Matchers](#Multiargument_Matchers.md)). - * The array being matched may be multi-dimensional (i.e. its elements can be arrays). - * `m` in `Pointwise(m, ...)` should be a matcher for `::testing::tuple` where `T` and `U` are the element type of the actual container and the expected container, respectively. For example, to compare two `Foo` containers where `Foo` doesn't support `operator==` but has an `Equals()` method, one might write: - -``` -using ::testing::get; -MATCHER(FooEq, "") { - return get<0>(arg).Equals(get<1>(arg)); -} -... -EXPECT_THAT(actual_foos, Pointwise(FooEq(), expected_foos)); -``` - -## Member Matchers ## - -|`Field(&class::field, m)`|`argument.field` (or `argument->field` when `argument` is a plain pointer) matches matcher `m`, where `argument` is an object of type _class_.| -|:------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------| -|`Key(e)` |`argument.first` matches `e`, which can be either a value or a matcher. E.g. `Contains(Key(Le(5)))` can verify that a `map` contains a key `<= 5`.| -|`Pair(m1, m2)` |`argument` is an `std::pair` whose `first` field matches `m1` and `second` field matches `m2`. | -|`Property(&class::property, m)`|`argument.property()` (or `argument->property()` when `argument` is a plain pointer) matches matcher `m`, where `argument` is an object of type _class_.| - -## Matching the Result of a Function or Functor ## - -|`ResultOf(f, m)`|`f(argument)` matches matcher `m`, where `f` is a function or functor.| -|:---------------|:---------------------------------------------------------------------| - -## Pointer Matchers ## - -|`Pointee(m)`|`argument` (either a smart pointer or a raw pointer) points to a value that matches matcher `m`.| -|:-----------|:-----------------------------------------------------------------------------------------------| -|`WhenDynamicCastTo(m)`| when `argument` is passed through `dynamic_cast()`, it matches matcher `m`. | - -## Multiargument Matchers ## - -Technically, all matchers match a _single_ value. A "multi-argument" -matcher is just one that matches a _tuple_. The following matchers can -be used to match a tuple `(x, y)`: - -|`Eq()`|`x == y`| -|:-----|:-------| -|`Ge()`|`x >= y`| -|`Gt()`|`x > y` | -|`Le()`|`x <= y`| -|`Lt()`|`x < y` | -|`Ne()`|`x != y`| - -You can use the following selectors to pick a subset of the arguments -(or reorder them) to participate in the matching: - -|`AllArgs(m)`|Equivalent to `m`. Useful as syntactic sugar in `.With(AllArgs(m))`.| -|:-----------|:-------------------------------------------------------------------| -|`Args(m)`|The tuple of the `k` selected (using 0-based indices) arguments matches `m`, e.g. `Args<1, 2>(Eq())`.| - -## Composite Matchers ## - -You can make a matcher from one or more other matchers: - -|`AllOf(m1, m2, ..., mn)`|`argument` matches all of the matchers `m1` to `mn`.| -|:-----------------------|:---------------------------------------------------| -|`AnyOf(m1, m2, ..., mn)`|`argument` matches at least one of the matchers `m1` to `mn`.| -|`Not(m)` |`argument` doesn't match matcher `m`. | - -## Adapters for Matchers ## - -|`MatcherCast(m)`|casts matcher `m` to type `Matcher`.| -|:------------------|:--------------------------------------| -|`SafeMatcherCast(m)`| [safely casts](CookBook.md#casting-matchers) matcher `m` to type `Matcher`. | -|`Truly(predicate)` |`predicate(argument)` returns something considered by C++ to be true, where `predicate` is a function or functor.| - -## Matchers as Predicates ## - -|`Matches(m)(value)`|evaluates to `true` if `value` matches `m`. You can use `Matches(m)` alone as a unary functor.| -|:------------------|:---------------------------------------------------------------------------------------------| -|`ExplainMatchResult(m, value, result_listener)`|evaluates to `true` if `value` matches `m`, explaining the result to `result_listener`. | -|`Value(value, m)` |evaluates to `true` if `value` matches `m`. | - -## Defining Matchers ## - -| `MATCHER(IsEven, "") { return (arg % 2) == 0; }` | Defines a matcher `IsEven()` to match an even number. | -|:-------------------------------------------------|:------------------------------------------------------| -| `MATCHER_P(IsDivisibleBy, n, "") { *result_listener << "where the remainder is " << (arg % n); return (arg % n) == 0; }` | Defines a macher `IsDivisibleBy(n)` to match a number divisible by `n`. | -| `MATCHER_P2(IsBetween, a, b, std::string(negation ? "isn't" : "is") + " between " + PrintToString(a) + " and " + PrintToString(b)) { return a <= arg && arg <= b; }` | Defines a matcher `IsBetween(a, b)` to match a value in the range [`a`, `b`]. | - -**Notes:** - - 1. The `MATCHER*` macros cannot be used inside a function or class. - 1. The matcher body must be _purely functional_ (i.e. it cannot have any side effect, and the result must not depend on anything other than the value being matched and the matcher parameters). - 1. You can use `PrintToString(x)` to convert a value `x` of any type to a string. - -## Matchers as Test Assertions ## - -|`ASSERT_THAT(expression, m)`|Generates a [fatal failure](../../googletest/docs/Primer.md#assertions) if the value of `expression` doesn't match matcher `m`.| -|:---------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------| -|`EXPECT_THAT(expression, m)`|Generates a non-fatal failure if the value of `expression` doesn't match matcher `m`. | - -# Actions # - -**Actions** specify what a mock function should do when invoked. - -## Returning a Value ## - -|`Return()`|Return from a `void` mock function.| -|:---------|:----------------------------------| -|`Return(value)`|Return `value`. If the type of `value` is different to the mock function's return type, `value` is converted to the latter type at the time the expectation is set, not when the action is executed.| -|`ReturnArg()`|Return the `N`-th (0-based) argument.| -|`ReturnNew(a1, ..., ak)`|Return `new T(a1, ..., ak)`; a different object is created each time.| -|`ReturnNull()`|Return a null pointer. | -|`ReturnPointee(ptr)`|Return the value pointed to by `ptr`.| -|`ReturnRef(variable)`|Return a reference to `variable`. | -|`ReturnRefOfCopy(value)`|Return a reference to a copy of `value`; the copy lives as long as the action.| - -## Side Effects ## - -|`Assign(&variable, value)`|Assign `value` to variable.| -|:-------------------------|:--------------------------| -| `DeleteArg()` | Delete the `N`-th (0-based) argument, which must be a pointer. | -| `SaveArg(pointer)` | Save the `N`-th (0-based) argument to `*pointer`. | -| `SaveArgPointee(pointer)` | Save the value pointed to by the `N`-th (0-based) argument to `*pointer`. | -| `SetArgReferee(value)` | Assign value to the variable referenced by the `N`-th (0-based) argument. | -|`SetArgPointee(value)` |Assign `value` to the variable pointed by the `N`-th (0-based) argument.| -|`SetArgumentPointee(value)`|Same as `SetArgPointee(value)`. Deprecated. Will be removed in v1.7.0.| -|`SetArrayArgument(first, last)`|Copies the elements in source range [`first`, `last`) to the array pointed to by the `N`-th (0-based) argument, which can be either a pointer or an iterator. The action does not take ownership of the elements in the source range.| -|`SetErrnoAndReturn(error, value)`|Set `errno` to `error` and return `value`.| -|`Throw(exception)` |Throws the given exception, which can be any copyable value. Available since v1.1.0.| - -## Using a Function or a Functor as an Action ## - -|`Invoke(f)`|Invoke `f` with the arguments passed to the mock function, where `f` can be a global/static function or a functor.| -|:----------|:-----------------------------------------------------------------------------------------------------------------| -|`Invoke(object_pointer, &class::method)`|Invoke the {method on the object with the arguments passed to the mock function. | -|`InvokeWithoutArgs(f)`|Invoke `f`, which can be a global/static function or a functor. `f` must take no arguments. | -|`InvokeWithoutArgs(object_pointer, &class::method)`|Invoke the method on the object, which takes no arguments. | -|`InvokeArgument(arg1, arg2, ..., argk)`|Invoke the mock function's `N`-th (0-based) argument, which must be a function or a functor, with the `k` arguments.| - -The return value of the invoked function is used as the return value -of the action. - -When defining a function or functor to be used with `Invoke*()`, you can declare any unused parameters as `Unused`: -``` - double Distance(Unused, double x, double y) { return sqrt(x*x + y*y); } - ... - EXPECT_CALL(mock, Foo("Hi", _, _)).WillOnce(Invoke(Distance)); -``` - -In `InvokeArgument(...)`, if an argument needs to be passed by reference, wrap it inside `ByRef()`. For example, -``` - InvokeArgument<2>(5, string("Hi"), ByRef(foo)) -``` -calls the mock function's #2 argument, passing to it `5` and `string("Hi")` by value, and `foo` by reference. - -## Default Action ## - -|`DoDefault()`|Do the default action (specified by `ON_CALL()` or the built-in one).| -|:------------|:--------------------------------------------------------------------| - -**Note:** due to technical reasons, `DoDefault()` cannot be used inside a composite action - trying to do so will result in a run-time error. - -## Composite Actions ## - -|`DoAll(a1, a2, ..., an)`|Do all actions `a1` to `an` and return the result of `an` in each invocation. The first `n - 1` sub-actions must return void. | -|:-----------------------|:-----------------------------------------------------------------------------------------------------------------------------| -|`IgnoreResult(a)` |Perform action `a` and ignore its result. `a` must not return void. | -|`WithArg(a)` |Pass the `N`-th (0-based) argument of the mock function to action `a` and perform it. | -|`WithArgs(a)`|Pass the selected (0-based) arguments of the mock function to action `a` and perform it. | -|`WithoutArgs(a)` |Perform action `a` without any arguments. | - -## Defining Actions ## - -| `ACTION(Sum) { return arg0 + arg1; }` | Defines an action `Sum()` to return the sum of the mock function's argument #0 and #1. | -|:--------------------------------------|:---------------------------------------------------------------------------------------| -| `ACTION_P(Plus, n) { return arg0 + n; }` | Defines an action `Plus(n)` to return the sum of the mock function's argument #0 and `n`. | -| `ACTION_Pk(Foo, p1, ..., pk) { statements; }` | Defines a parameterized action `Foo(p1, ..., pk)` to execute the given `statements`. | - -The `ACTION*` macros cannot be used inside a function or class. - -# Cardinalities # - -These are used in `Times()` to specify how many times a mock function will be called: - -|`AnyNumber()`|The function can be called any number of times.| -|:------------|:----------------------------------------------| -|`AtLeast(n)` |The call is expected at least `n` times. | -|`AtMost(n)` |The call is expected at most `n` times. | -|`Between(m, n)`|The call is expected between `m` and `n` (inclusive) times.| -|`Exactly(n) or n`|The call is expected exactly `n` times. In particular, the call should never happen when `n` is 0.| - -# Expectation Order # - -By default, the expectations can be matched in _any_ order. If some -or all expectations must be matched in a given order, there are two -ways to specify it. They can be used either independently or -together. - -## The After Clause ## - -``` -using ::testing::Expectation; -... -Expectation init_x = EXPECT_CALL(foo, InitX()); -Expectation init_y = EXPECT_CALL(foo, InitY()); -EXPECT_CALL(foo, Bar()) - .After(init_x, init_y); -``` -says that `Bar()` can be called only after both `InitX()` and -`InitY()` have been called. - -If you don't know how many pre-requisites an expectation has when you -write it, you can use an `ExpectationSet` to collect them: - -``` -using ::testing::ExpectationSet; -... -ExpectationSet all_inits; -for (int i = 0; i < element_count; i++) { - all_inits += EXPECT_CALL(foo, InitElement(i)); -} -EXPECT_CALL(foo, Bar()) - .After(all_inits); -``` -says that `Bar()` can be called only after all elements have been -initialized (but we don't care about which elements get initialized -before the others). - -Modifying an `ExpectationSet` after using it in an `.After()` doesn't -affect the meaning of the `.After()`. - -## Sequences ## - -When you have a long chain of sequential expectations, it's easier to -specify the order using **sequences**, which don't require you to given -each expectation in the chain a different name. All expected
-calls
in the same sequence must occur in the order they are -specified. - -``` -using ::testing::Sequence; -Sequence s1, s2; -... -EXPECT_CALL(foo, Reset()) - .InSequence(s1, s2) - .WillOnce(Return(true)); -EXPECT_CALL(foo, GetSize()) - .InSequence(s1) - .WillOnce(Return(1)); -EXPECT_CALL(foo, Describe(A())) - .InSequence(s2) - .WillOnce(Return("dummy")); -``` -says that `Reset()` must be called before _both_ `GetSize()` _and_ -`Describe()`, and the latter two can occur in any order. - -To put many expectations in a sequence conveniently: -``` -using ::testing::InSequence; -{ - InSequence dummy; - - EXPECT_CALL(...)...; - EXPECT_CALL(...)...; - ... - EXPECT_CALL(...)...; -} -``` -says that all expected calls in the scope of `dummy` must occur in -strict order. The name `dummy` is irrelevant.) - -# Verifying and Resetting a Mock # - -Google Mock will verify the expectations on a mock object when it is destructed, or you can do it earlier: -``` -using ::testing::Mock; -... -// Verifies and removes the expectations on mock_obj; -// returns true iff successful. -Mock::VerifyAndClearExpectations(&mock_obj); -... -// Verifies and removes the expectations on mock_obj; -// also removes the default actions set by ON_CALL(); -// returns true iff successful. -Mock::VerifyAndClear(&mock_obj); -``` - -You can also tell Google Mock that a mock object can be leaked and doesn't -need to be verified: -``` -Mock::AllowLeak(&mock_obj); -``` - -# Mock Classes # - -Google Mock defines a convenient mock class template -``` -class MockFunction { - public: - MOCK_METHODn(Call, R(A1, ..., An)); -}; -``` -See this [recipe](CookBook.md#using-check-points) for one application of it. - -# Flags # - -| `--gmock_catch_leaked_mocks=0` | Don't report leaked mock objects as failures. | -|:-------------------------------|:----------------------------------------------| -| `--gmock_verbose=LEVEL` | Sets the default verbosity level (`info`, `warning`, or `error`) of Google Mock messages. | diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/CookBook.md b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/CookBook.md deleted file mode 100644 index 753c6dd315c..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/CookBook.md +++ /dev/null @@ -1,3679 +0,0 @@ - - -You can find recipes for using Google Mock here. If you haven't yet, -please read the [ForDummies](ForDummies.md) document first to make sure you understand -the basics. - -**Note:** Google Mock lives in the `testing` name space. For -readability, it is recommended to write `using ::testing::Foo;` once in -your file before using the name `Foo` defined by Google Mock. We omit -such `using` statements in this page for brevity, but you should do it -in your own code. - -# Creating Mock Classes # - -## Mocking Private or Protected Methods ## - -You must always put a mock method definition (`MOCK_METHOD*`) in a -`public:` section of the mock class, regardless of the method being -mocked being `public`, `protected`, or `private` in the base class. -This allows `ON_CALL` and `EXPECT_CALL` to reference the mock function -from outside of the mock class. (Yes, C++ allows a subclass to specify -a different access level than the base class on a virtual function.) -Example: - -``` -class Foo { - public: - ... - virtual bool Transform(Gadget* g) = 0; - - protected: - virtual void Resume(); - - private: - virtual int GetTimeOut(); -}; - -class MockFoo : public Foo { - public: - ... - MOCK_METHOD1(Transform, bool(Gadget* g)); - - // The following must be in the public section, even though the - // methods are protected or private in the base class. - MOCK_METHOD0(Resume, void()); - MOCK_METHOD0(GetTimeOut, int()); -}; -``` - -## Mocking Overloaded Methods ## - -You can mock overloaded functions as usual. No special attention is required: - -``` -class Foo { - ... - - // Must be virtual as we'll inherit from Foo. - virtual ~Foo(); - - // Overloaded on the types and/or numbers of arguments. - virtual int Add(Element x); - virtual int Add(int times, Element x); - - // Overloaded on the const-ness of this object. - virtual Bar& GetBar(); - virtual const Bar& GetBar() const; -}; - -class MockFoo : public Foo { - ... - MOCK_METHOD1(Add, int(Element x)); - MOCK_METHOD2(Add, int(int times, Element x); - - MOCK_METHOD0(GetBar, Bar&()); - MOCK_CONST_METHOD0(GetBar, const Bar&()); -}; -``` - -**Note:** if you don't mock all versions of the overloaded method, the -compiler will give you a warning about some methods in the base class -being hidden. To fix that, use `using` to bring them in scope: - -``` -class MockFoo : public Foo { - ... - using Foo::Add; - MOCK_METHOD1(Add, int(Element x)); - // We don't want to mock int Add(int times, Element x); - ... -}; -``` - -## Mocking Class Templates ## - -To mock a class template, append `_T` to the `MOCK_*` macros: - -``` -template -class StackInterface { - ... - // Must be virtual as we'll inherit from StackInterface. - virtual ~StackInterface(); - - virtual int GetSize() const = 0; - virtual void Push(const Elem& x) = 0; -}; - -template -class MockStack : public StackInterface { - ... - MOCK_CONST_METHOD0_T(GetSize, int()); - MOCK_METHOD1_T(Push, void(const Elem& x)); -}; -``` - -## Mocking Nonvirtual Methods ## - -Google Mock can mock non-virtual functions to be used in what we call _hi-perf -dependency injection_. - -In this case, instead of sharing a common base class with the real -class, your mock class will be _unrelated_ to the real class, but -contain methods with the same signatures. The syntax for mocking -non-virtual methods is the _same_ as mocking virtual methods: - -``` -// A simple packet stream class. None of its members is virtual. -class ConcretePacketStream { - public: - void AppendPacket(Packet* new_packet); - const Packet* GetPacket(size_t packet_number) const; - size_t NumberOfPackets() const; - ... -}; - -// A mock packet stream class. It inherits from no other, but defines -// GetPacket() and NumberOfPackets(). -class MockPacketStream { - public: - MOCK_CONST_METHOD1(GetPacket, const Packet*(size_t packet_number)); - MOCK_CONST_METHOD0(NumberOfPackets, size_t()); - ... -}; -``` - -Note that the mock class doesn't define `AppendPacket()`, unlike the -real class. That's fine as long as the test doesn't need to call it. - -Next, you need a way to say that you want to use -`ConcretePacketStream` in production code and to use `MockPacketStream` -in tests. Since the functions are not virtual and the two classes are -unrelated, you must specify your choice at _compile time_ (as opposed -to run time). - -One way to do it is to templatize your code that needs to use a packet -stream. More specifically, you will give your code a template type -argument for the type of the packet stream. In production, you will -instantiate your template with `ConcretePacketStream` as the type -argument. In tests, you will instantiate the same template with -`MockPacketStream`. For example, you may write: - -``` -template -void CreateConnection(PacketStream* stream) { ... } - -template -class PacketReader { - public: - void ReadPackets(PacketStream* stream, size_t packet_num); -}; -``` - -Then you can use `CreateConnection()` and -`PacketReader` in production code, and use -`CreateConnection()` and -`PacketReader` in tests. - -``` - MockPacketStream mock_stream; - EXPECT_CALL(mock_stream, ...)...; - .. set more expectations on mock_stream ... - PacketReader reader(&mock_stream); - ... exercise reader ... -``` - -## Mocking Free Functions ## - -It's possible to use Google Mock to mock a free function (i.e. a -C-style function or a static method). You just need to rewrite your -code to use an interface (abstract class). - -Instead of calling a free function (say, `OpenFile`) directly, -introduce an interface for it and have a concrete subclass that calls -the free function: - -``` -class FileInterface { - public: - ... - virtual bool Open(const char* path, const char* mode) = 0; -}; - -class File : public FileInterface { - public: - ... - virtual bool Open(const char* path, const char* mode) { - return OpenFile(path, mode); - } -}; -``` - -Your code should talk to `FileInterface` to open a file. Now it's -easy to mock out the function. - -This may seem much hassle, but in practice you often have multiple -related functions that you can put in the same interface, so the -per-function syntactic overhead will be much lower. - -If you are concerned about the performance overhead incurred by -virtual functions, and profiling confirms your concern, you can -combine this with the recipe for [mocking non-virtual methods](#mocking-nonvirtual-methods). - -## The Nice, the Strict, and the Naggy ## - -If a mock method has no `EXPECT_CALL` spec but is called, Google Mock -will print a warning about the "uninteresting call". The rationale is: - - * New methods may be added to an interface after a test is written. We shouldn't fail a test just because a method it doesn't know about is called. - * However, this may also mean there's a bug in the test, so Google Mock shouldn't be silent either. If the user believes these calls are harmless, he can add an `EXPECT_CALL()` to suppress the warning. - -However, sometimes you may want to suppress all "uninteresting call" -warnings, while sometimes you may want the opposite, i.e. to treat all -of them as errors. Google Mock lets you make the decision on a -per-mock-object basis. - -Suppose your test uses a mock class `MockFoo`: - -``` -TEST(...) { - MockFoo mock_foo; - EXPECT_CALL(mock_foo, DoThis()); - ... code that uses mock_foo ... -} -``` - -If a method of `mock_foo` other than `DoThis()` is called, it will be -reported by Google Mock as a warning. However, if you rewrite your -test to use `NiceMock` instead, the warning will be gone, -resulting in a cleaner test output: - -``` -using ::testing::NiceMock; - -TEST(...) { - NiceMock mock_foo; - EXPECT_CALL(mock_foo, DoThis()); - ... code that uses mock_foo ... -} -``` - -`NiceMock` is a subclass of `MockFoo`, so it can be used -wherever `MockFoo` is accepted. - -It also works if `MockFoo`'s constructor takes some arguments, as -`NiceMock` "inherits" `MockFoo`'s constructors: - -``` -using ::testing::NiceMock; - -TEST(...) { - NiceMock mock_foo(5, "hi"); // Calls MockFoo(5, "hi"). - EXPECT_CALL(mock_foo, DoThis()); - ... code that uses mock_foo ... -} -``` - -The usage of `StrictMock` is similar, except that it makes all -uninteresting calls failures: - -``` -using ::testing::StrictMock; - -TEST(...) { - StrictMock mock_foo; - EXPECT_CALL(mock_foo, DoThis()); - ... code that uses mock_foo ... - - // The test will fail if a method of mock_foo other than DoThis() - // is called. -} -``` - -There are some caveats though (I don't like them just as much as the -next guy, but sadly they are side effects of C++'s limitations): - - 1. `NiceMock` and `StrictMock` only work for mock methods defined using the `MOCK_METHOD*` family of macros **directly** in the `MockFoo` class. If a mock method is defined in a **base class** of `MockFoo`, the "nice" or "strict" modifier may not affect it, depending on the compiler. In particular, nesting `NiceMock` and `StrictMock` (e.g. `NiceMock >`) is **not** supported. - 1. The constructors of the base mock (`MockFoo`) cannot have arguments passed by non-const reference, which happens to be banned by the [Google C++ style guide](https://google.github.io/styleguide/cppguide.html). - 1. During the constructor or destructor of `MockFoo`, the mock object is _not_ nice or strict. This may cause surprises if the constructor or destructor calls a mock method on `this` object. (This behavior, however, is consistent with C++'s general rule: if a constructor or destructor calls a virtual method of `this` object, that method is treated as non-virtual. In other words, to the base class's constructor or destructor, `this` object behaves like an instance of the base class, not the derived class. This rule is required for safety. Otherwise a base constructor may use members of a derived class before they are initialized, or a base destructor may use members of a derived class after they have been destroyed.) - -Finally, you should be **very cautious** about when to use naggy or strict mocks, as they tend to make tests more brittle and harder to maintain. When you refactor your code without changing its externally visible behavior, ideally you should't need to update any tests. If your code interacts with a naggy mock, however, you may start to get spammed with warnings as the result of your change. Worse, if your code interacts with a strict mock, your tests may start to fail and you'll be forced to fix them. Our general recommendation is to use nice mocks (not yet the default) most of the time, use naggy mocks (the current default) when developing or debugging tests, and use strict mocks only as the last resort. - -## Simplifying the Interface without Breaking Existing Code ## - -Sometimes a method has a long list of arguments that is mostly -uninteresting. For example, - -``` -class LogSink { - public: - ... - virtual void send(LogSeverity severity, const char* full_filename, - const char* base_filename, int line, - const struct tm* tm_time, - const char* message, size_t message_len) = 0; -}; -``` - -This method's argument list is lengthy and hard to work with (let's -say that the `message` argument is not even 0-terminated). If we mock -it as is, using the mock will be awkward. If, however, we try to -simplify this interface, we'll need to fix all clients depending on -it, which is often infeasible. - -The trick is to re-dispatch the method in the mock class: - -``` -class ScopedMockLog : public LogSink { - public: - ... - virtual void send(LogSeverity severity, const char* full_filename, - const char* base_filename, int line, const tm* tm_time, - const char* message, size_t message_len) { - // We are only interested in the log severity, full file name, and - // log message. - Log(severity, full_filename, std::string(message, message_len)); - } - - // Implements the mock method: - // - // void Log(LogSeverity severity, - // const string& file_path, - // const string& message); - MOCK_METHOD3(Log, void(LogSeverity severity, const string& file_path, - const string& message)); -}; -``` - -By defining a new mock method with a trimmed argument list, we make -the mock class much more user-friendly. - -## Alternative to Mocking Concrete Classes ## - -Often you may find yourself using classes that don't implement -interfaces. In order to test your code that uses such a class (let's -call it `Concrete`), you may be tempted to make the methods of -`Concrete` virtual and then mock it. - -Try not to do that. - -Making a non-virtual function virtual is a big decision. It creates an -extension point where subclasses can tweak your class' behavior. This -weakens your control on the class because now it's harder to maintain -the class' invariants. You should make a function virtual only when -there is a valid reason for a subclass to override it. - -Mocking concrete classes directly is problematic as it creates a tight -coupling between the class and the tests - any small change in the -class may invalidate your tests and make test maintenance a pain. - -To avoid such problems, many programmers have been practicing "coding -to interfaces": instead of talking to the `Concrete` class, your code -would define an interface and talk to it. Then you implement that -interface as an adaptor on top of `Concrete`. In tests, you can easily -mock that interface to observe how your code is doing. - -This technique incurs some overhead: - - * You pay the cost of virtual function calls (usually not a problem). - * There is more abstraction for the programmers to learn. - -However, it can also bring significant benefits in addition to better -testability: - - * `Concrete`'s API may not fit your problem domain very well, as you may not be the only client it tries to serve. By designing your own interface, you have a chance to tailor it to your need - you may add higher-level functionalities, rename stuff, etc instead of just trimming the class. This allows you to write your code (user of the interface) in a more natural way, which means it will be more readable, more maintainable, and you'll be more productive. - * If `Concrete`'s implementation ever has to change, you don't have to rewrite everywhere it is used. Instead, you can absorb the change in your implementation of the interface, and your other code and tests will be insulated from this change. - -Some people worry that if everyone is practicing this technique, they -will end up writing lots of redundant code. This concern is totally -understandable. However, there are two reasons why it may not be the -case: - - * Different projects may need to use `Concrete` in different ways, so the best interfaces for them will be different. Therefore, each of them will have its own domain-specific interface on top of `Concrete`, and they will not be the same code. - * If enough projects want to use the same interface, they can always share it, just like they have been sharing `Concrete`. You can check in the interface and the adaptor somewhere near `Concrete` (perhaps in a `contrib` sub-directory) and let many projects use it. - -You need to weigh the pros and cons carefully for your particular -problem, but I'd like to assure you that the Java community has been -practicing this for a long time and it's a proven effective technique -applicable in a wide variety of situations. :-) - -## Delegating Calls to a Fake ## - -Some times you have a non-trivial fake implementation of an -interface. For example: - -``` -class Foo { - public: - virtual ~Foo() {} - virtual char DoThis(int n) = 0; - virtual void DoThat(const char* s, int* p) = 0; -}; - -class FakeFoo : public Foo { - public: - virtual char DoThis(int n) { - return (n > 0) ? '+' : - (n < 0) ? '-' : '0'; - } - - virtual void DoThat(const char* s, int* p) { - *p = strlen(s); - } -}; -``` - -Now you want to mock this interface such that you can set expectations -on it. However, you also want to use `FakeFoo` for the default -behavior, as duplicating it in the mock object is, well, a lot of -work. - -When you define the mock class using Google Mock, you can have it -delegate its default action to a fake class you already have, using -this pattern: - -``` -using ::testing::_; -using ::testing::Invoke; - -class MockFoo : public Foo { - public: - // Normal mock method definitions using Google Mock. - MOCK_METHOD1(DoThis, char(int n)); - MOCK_METHOD2(DoThat, void(const char* s, int* p)); - - // Delegates the default actions of the methods to a FakeFoo object. - // This must be called *before* the custom ON_CALL() statements. - void DelegateToFake() { - ON_CALL(*this, DoThis(_)) - .WillByDefault(Invoke(&fake_, &FakeFoo::DoThis)); - ON_CALL(*this, DoThat(_, _)) - .WillByDefault(Invoke(&fake_, &FakeFoo::DoThat)); - } - private: - FakeFoo fake_; // Keeps an instance of the fake in the mock. -}; -``` - -With that, you can use `MockFoo` in your tests as usual. Just remember -that if you don't explicitly set an action in an `ON_CALL()` or -`EXPECT_CALL()`, the fake will be called upon to do it: - -``` -using ::testing::_; - -TEST(AbcTest, Xyz) { - MockFoo foo; - foo.DelegateToFake(); // Enables the fake for delegation. - - // Put your ON_CALL(foo, ...)s here, if any. - - // No action specified, meaning to use the default action. - EXPECT_CALL(foo, DoThis(5)); - EXPECT_CALL(foo, DoThat(_, _)); - - int n = 0; - EXPECT_EQ('+', foo.DoThis(5)); // FakeFoo::DoThis() is invoked. - foo.DoThat("Hi", &n); // FakeFoo::DoThat() is invoked. - EXPECT_EQ(2, n); -} -``` - -**Some tips:** - - * If you want, you can still override the default action by providing your own `ON_CALL()` or using `.WillOnce()` / `.WillRepeatedly()` in `EXPECT_CALL()`. - * In `DelegateToFake()`, you only need to delegate the methods whose fake implementation you intend to use. - * The general technique discussed here works for overloaded methods, but you'll need to tell the compiler which version you mean. To disambiguate a mock function (the one you specify inside the parentheses of `ON_CALL()`), see the "Selecting Between Overloaded Functions" section on this page; to disambiguate a fake function (the one you place inside `Invoke()`), use a `static_cast` to specify the function's type. For instance, if class `Foo` has methods `char DoThis(int n)` and `bool DoThis(double x) const`, and you want to invoke the latter, you need to write `Invoke(&fake_, static_cast(&FakeFoo::DoThis))` instead of `Invoke(&fake_, &FakeFoo::DoThis)` (The strange-looking thing inside the angled brackets of `static_cast` is the type of a function pointer to the second `DoThis()` method.). - * Having to mix a mock and a fake is often a sign of something gone wrong. Perhaps you haven't got used to the interaction-based way of testing yet. Or perhaps your interface is taking on too many roles and should be split up. Therefore, **don't abuse this**. We would only recommend to do it as an intermediate step when you are refactoring your code. - -Regarding the tip on mixing a mock and a fake, here's an example on -why it may be a bad sign: Suppose you have a class `System` for -low-level system operations. In particular, it does file and I/O -operations. And suppose you want to test how your code uses `System` -to do I/O, and you just want the file operations to work normally. If -you mock out the entire `System` class, you'll have to provide a fake -implementation for the file operation part, which suggests that -`System` is taking on too many roles. - -Instead, you can define a `FileOps` interface and an `IOOps` interface -and split `System`'s functionalities into the two. Then you can mock -`IOOps` without mocking `FileOps`. - -## Delegating Calls to a Real Object ## - -When using testing doubles (mocks, fakes, stubs, and etc), sometimes -their behaviors will differ from those of the real objects. This -difference could be either intentional (as in simulating an error such -that you can test the error handling code) or unintentional. If your -mocks have different behaviors than the real objects by mistake, you -could end up with code that passes the tests but fails in production. - -You can use the _delegating-to-real_ technique to ensure that your -mock has the same behavior as the real object while retaining the -ability to validate calls. This technique is very similar to the -delegating-to-fake technique, the difference being that we use a real -object instead of a fake. Here's an example: - -``` -using ::testing::_; -using ::testing::AtLeast; -using ::testing::Invoke; - -class MockFoo : public Foo { - public: - MockFoo() { - // By default, all calls are delegated to the real object. - ON_CALL(*this, DoThis()) - .WillByDefault(Invoke(&real_, &Foo::DoThis)); - ON_CALL(*this, DoThat(_)) - .WillByDefault(Invoke(&real_, &Foo::DoThat)); - ... - } - MOCK_METHOD0(DoThis, ...); - MOCK_METHOD1(DoThat, ...); - ... - private: - Foo real_; -}; -... - - MockFoo mock; - - EXPECT_CALL(mock, DoThis()) - .Times(3); - EXPECT_CALL(mock, DoThat("Hi")) - .Times(AtLeast(1)); - ... use mock in test ... -``` - -With this, Google Mock will verify that your code made the right calls -(with the right arguments, in the right order, called the right number -of times, etc), and a real object will answer the calls (so the -behavior will be the same as in production). This gives you the best -of both worlds. - -## Delegating Calls to a Parent Class ## - -Ideally, you should code to interfaces, whose methods are all pure -virtual. In reality, sometimes you do need to mock a virtual method -that is not pure (i.e, it already has an implementation). For example: - -``` -class Foo { - public: - virtual ~Foo(); - - virtual void Pure(int n) = 0; - virtual int Concrete(const char* str) { ... } -}; - -class MockFoo : public Foo { - public: - // Mocking a pure method. - MOCK_METHOD1(Pure, void(int n)); - // Mocking a concrete method. Foo::Concrete() is shadowed. - MOCK_METHOD1(Concrete, int(const char* str)); -}; -``` - -Sometimes you may want to call `Foo::Concrete()` instead of -`MockFoo::Concrete()`. Perhaps you want to do it as part of a stub -action, or perhaps your test doesn't need to mock `Concrete()` at all -(but it would be oh-so painful to have to define a new mock class -whenever you don't need to mock one of its methods). - -The trick is to leave a back door in your mock class for accessing the -real methods in the base class: - -``` -class MockFoo : public Foo { - public: - // Mocking a pure method. - MOCK_METHOD1(Pure, void(int n)); - // Mocking a concrete method. Foo::Concrete() is shadowed. - MOCK_METHOD1(Concrete, int(const char* str)); - - // Use this to call Concrete() defined in Foo. - int FooConcrete(const char* str) { return Foo::Concrete(str); } -}; -``` - -Now, you can call `Foo::Concrete()` inside an action by: - -``` -using ::testing::_; -using ::testing::Invoke; -... - EXPECT_CALL(foo, Concrete(_)) - .WillOnce(Invoke(&foo, &MockFoo::FooConcrete)); -``` - -or tell the mock object that you don't want to mock `Concrete()`: - -``` -using ::testing::Invoke; -... - ON_CALL(foo, Concrete(_)) - .WillByDefault(Invoke(&foo, &MockFoo::FooConcrete)); -``` - -(Why don't we just write `Invoke(&foo, &Foo::Concrete)`? If you do -that, `MockFoo::Concrete()` will be called (and cause an infinite -recursion) since `Foo::Concrete()` is virtual. That's just how C++ -works.) - -# Using Matchers # - -## Matching Argument Values Exactly ## - -You can specify exactly which arguments a mock method is expecting: - -``` -using ::testing::Return; -... - EXPECT_CALL(foo, DoThis(5)) - .WillOnce(Return('a')); - EXPECT_CALL(foo, DoThat("Hello", bar)); -``` - -## Using Simple Matchers ## - -You can use matchers to match arguments that have a certain property: - -``` -using ::testing::Ge; -using ::testing::NotNull; -using ::testing::Return; -... - EXPECT_CALL(foo, DoThis(Ge(5))) // The argument must be >= 5. - .WillOnce(Return('a')); - EXPECT_CALL(foo, DoThat("Hello", NotNull())); - // The second argument must not be NULL. -``` - -A frequently used matcher is `_`, which matches anything: - -``` -using ::testing::_; -using ::testing::NotNull; -... - EXPECT_CALL(foo, DoThat(_, NotNull())); -``` - -## Combining Matchers ## - -You can build complex matchers from existing ones using `AllOf()`, -`AnyOf()`, and `Not()`: - -``` -using ::testing::AllOf; -using ::testing::Gt; -using ::testing::HasSubstr; -using ::testing::Ne; -using ::testing::Not; -... - // The argument must be > 5 and != 10. - EXPECT_CALL(foo, DoThis(AllOf(Gt(5), - Ne(10)))); - - // The first argument must not contain sub-string "blah". - EXPECT_CALL(foo, DoThat(Not(HasSubstr("blah")), - NULL)); -``` - -## Casting Matchers ## - -Google Mock matchers are statically typed, meaning that the compiler -can catch your mistake if you use a matcher of the wrong type (for -example, if you use `Eq(5)` to match a `string` argument). Good for -you! - -Sometimes, however, you know what you're doing and want the compiler -to give you some slack. One example is that you have a matcher for -`long` and the argument you want to match is `int`. While the two -types aren't exactly the same, there is nothing really wrong with -using a `Matcher` to match an `int` - after all, we can first -convert the `int` argument to a `long` before giving it to the -matcher. - -To support this need, Google Mock gives you the -`SafeMatcherCast(m)` function. It casts a matcher `m` to type -`Matcher`. To ensure safety, Google Mock checks that (let `U` be the -type `m` accepts): - - 1. Type `T` can be implicitly cast to type `U`; - 1. When both `T` and `U` are built-in arithmetic types (`bool`, integers, and floating-point numbers), the conversion from `T` to `U` is not lossy (in other words, any value representable by `T` can also be represented by `U`); and - 1. When `U` is a reference, `T` must also be a reference (as the underlying matcher may be interested in the address of the `U` value). - -The code won't compile if any of these conditions aren't met. - -Here's one example: - -``` -using ::testing::SafeMatcherCast; - -// A base class and a child class. -class Base { ... }; -class Derived : public Base { ... }; - -class MockFoo : public Foo { - public: - MOCK_METHOD1(DoThis, void(Derived* derived)); -}; -... - - MockFoo foo; - // m is a Matcher we got from somewhere. - EXPECT_CALL(foo, DoThis(SafeMatcherCast(m))); -``` - -If you find `SafeMatcherCast(m)` too limiting, you can use a similar -function `MatcherCast(m)`. The difference is that `MatcherCast` works -as long as you can `static_cast` type `T` to type `U`. - -`MatcherCast` essentially lets you bypass C++'s type system -(`static_cast` isn't always safe as it could throw away information, -for example), so be careful not to misuse/abuse it. - -## Selecting Between Overloaded Functions ## - -If you expect an overloaded function to be called, the compiler may -need some help on which overloaded version it is. - -To disambiguate functions overloaded on the const-ness of this object, -use the `Const()` argument wrapper. - -``` -using ::testing::ReturnRef; - -class MockFoo : public Foo { - ... - MOCK_METHOD0(GetBar, Bar&()); - MOCK_CONST_METHOD0(GetBar, const Bar&()); -}; -... - - MockFoo foo; - Bar bar1, bar2; - EXPECT_CALL(foo, GetBar()) // The non-const GetBar(). - .WillOnce(ReturnRef(bar1)); - EXPECT_CALL(Const(foo), GetBar()) // The const GetBar(). - .WillOnce(ReturnRef(bar2)); -``` - -(`Const()` is defined by Google Mock and returns a `const` reference -to its argument.) - -To disambiguate overloaded functions with the same number of arguments -but different argument types, you may need to specify the exact type -of a matcher, either by wrapping your matcher in `Matcher()`, or -using a matcher whose type is fixed (`TypedEq`, `An()`, -etc): - -``` -using ::testing::An; -using ::testing::Lt; -using ::testing::Matcher; -using ::testing::TypedEq; - -class MockPrinter : public Printer { - public: - MOCK_METHOD1(Print, void(int n)); - MOCK_METHOD1(Print, void(char c)); -}; - -TEST(PrinterTest, Print) { - MockPrinter printer; - - EXPECT_CALL(printer, Print(An())); // void Print(int); - EXPECT_CALL(printer, Print(Matcher(Lt(5)))); // void Print(int); - EXPECT_CALL(printer, Print(TypedEq('a'))); // void Print(char); - - printer.Print(3); - printer.Print(6); - printer.Print('a'); -} -``` - -## Performing Different Actions Based on the Arguments ## - -When a mock method is called, the _last_ matching expectation that's -still active will be selected (think "newer overrides older"). So, you -can make a method do different things depending on its argument values -like this: - -``` -using ::testing::_; -using ::testing::Lt; -using ::testing::Return; -... - // The default case. - EXPECT_CALL(foo, DoThis(_)) - .WillRepeatedly(Return('b')); - - // The more specific case. - EXPECT_CALL(foo, DoThis(Lt(5))) - .WillRepeatedly(Return('a')); -``` - -Now, if `foo.DoThis()` is called with a value less than 5, `'a'` will -be returned; otherwise `'b'` will be returned. - -## Matching Multiple Arguments as a Whole ## - -Sometimes it's not enough to match the arguments individually. For -example, we may want to say that the first argument must be less than -the second argument. The `With()` clause allows us to match -all arguments of a mock function as a whole. For example, - -``` -using ::testing::_; -using ::testing::Lt; -using ::testing::Ne; -... - EXPECT_CALL(foo, InRange(Ne(0), _)) - .With(Lt()); -``` - -says that the first argument of `InRange()` must not be 0, and must be -less than the second argument. - -The expression inside `With()` must be a matcher of type -`Matcher< ::testing::tuple >`, where `A1`, ..., `An` are the -types of the function arguments. - -You can also write `AllArgs(m)` instead of `m` inside `.With()`. The -two forms are equivalent, but `.With(AllArgs(Lt()))` is more readable -than `.With(Lt())`. - -You can use `Args(m)` to match the `n` selected arguments -(as a tuple) against `m`. For example, - -``` -using ::testing::_; -using ::testing::AllOf; -using ::testing::Args; -using ::testing::Lt; -... - EXPECT_CALL(foo, Blah(_, _, _)) - .With(AllOf(Args<0, 1>(Lt()), Args<1, 2>(Lt()))); -``` - -says that `Blah()` will be called with arguments `x`, `y`, and `z` where -`x < y < z`. - -As a convenience and example, Google Mock provides some matchers for -2-tuples, including the `Lt()` matcher above. See the [CheatSheet](CheatSheet.md) for -the complete list. - -Note that if you want to pass the arguments to a predicate of your own -(e.g. `.With(Args<0, 1>(Truly(&MyPredicate)))`), that predicate MUST be -written to take a `::testing::tuple` as its argument; Google Mock will pass the `n` selected arguments as _one_ single tuple to the predicate. - -## Using Matchers as Predicates ## - -Have you noticed that a matcher is just a fancy predicate that also -knows how to describe itself? Many existing algorithms take predicates -as arguments (e.g. those defined in STL's `` header), and -it would be a shame if Google Mock matchers are not allowed to -participate. - -Luckily, you can use a matcher where a unary predicate functor is -expected by wrapping it inside the `Matches()` function. For example, - -``` -#include -#include - -std::vector v; -... -// How many elements in v are >= 10? -const int count = count_if(v.begin(), v.end(), Matches(Ge(10))); -``` - -Since you can build complex matchers from simpler ones easily using -Google Mock, this gives you a way to conveniently construct composite -predicates (doing the same using STL's `` header is just -painful). For example, here's a predicate that's satisfied by any -number that is >= 0, <= 100, and != 50: - -``` -Matches(AllOf(Ge(0), Le(100), Ne(50))) -``` - -## Using Matchers in Google Test Assertions ## - -Since matchers are basically predicates that also know how to describe -themselves, there is a way to take advantage of them in -[Google Test](../../googletest/) assertions. It's -called `ASSERT_THAT` and `EXPECT_THAT`: - -``` - ASSERT_THAT(value, matcher); // Asserts that value matches matcher. - EXPECT_THAT(value, matcher); // The non-fatal version. -``` - -For example, in a Google Test test you can write: - -``` -#include "gmock/gmock.h" - -using ::testing::AllOf; -using ::testing::Ge; -using ::testing::Le; -using ::testing::MatchesRegex; -using ::testing::StartsWith; -... - - EXPECT_THAT(Foo(), StartsWith("Hello")); - EXPECT_THAT(Bar(), MatchesRegex("Line \\d+")); - ASSERT_THAT(Baz(), AllOf(Ge(5), Le(10))); -``` - -which (as you can probably guess) executes `Foo()`, `Bar()`, and -`Baz()`, and verifies that: - - * `Foo()` returns a string that starts with `"Hello"`. - * `Bar()` returns a string that matches regular expression `"Line \\d+"`. - * `Baz()` returns a number in the range [5, 10]. - -The nice thing about these macros is that _they read like -English_. They generate informative messages too. For example, if the -first `EXPECT_THAT()` above fails, the message will be something like: - -``` -Value of: Foo() - Actual: "Hi, world!" -Expected: starts with "Hello" -``` - -**Credit:** The idea of `(ASSERT|EXPECT)_THAT` was stolen from the -[Hamcrest](https://github.com/hamcrest/) project, which adds -`assertThat()` to JUnit. - -## Using Predicates as Matchers ## - -Google Mock provides a built-in set of matchers. In case you find them -lacking, you can use an arbitray unary predicate function or functor -as a matcher - as long as the predicate accepts a value of the type -you want. You do this by wrapping the predicate inside the `Truly()` -function, for example: - -``` -using ::testing::Truly; - -int IsEven(int n) { return (n % 2) == 0 ? 1 : 0; } -... - - // Bar() must be called with an even number. - EXPECT_CALL(foo, Bar(Truly(IsEven))); -``` - -Note that the predicate function / functor doesn't have to return -`bool`. It works as long as the return value can be used as the -condition in statement `if (condition) ...`. - -## Matching Arguments that Are Not Copyable ## - -When you do an `EXPECT_CALL(mock_obj, Foo(bar))`, Google Mock saves -away a copy of `bar`. When `Foo()` is called later, Google Mock -compares the argument to `Foo()` with the saved copy of `bar`. This -way, you don't need to worry about `bar` being modified or destroyed -after the `EXPECT_CALL()` is executed. The same is true when you use -matchers like `Eq(bar)`, `Le(bar)`, and so on. - -But what if `bar` cannot be copied (i.e. has no copy constructor)? You -could define your own matcher function and use it with `Truly()`, as -the previous couple of recipes have shown. Or, you may be able to get -away from it if you can guarantee that `bar` won't be changed after -the `EXPECT_CALL()` is executed. Just tell Google Mock that it should -save a reference to `bar`, instead of a copy of it. Here's how: - -``` -using ::testing::Eq; -using ::testing::ByRef; -using ::testing::Lt; -... - // Expects that Foo()'s argument == bar. - EXPECT_CALL(mock_obj, Foo(Eq(ByRef(bar)))); - - // Expects that Foo()'s argument < bar. - EXPECT_CALL(mock_obj, Foo(Lt(ByRef(bar)))); -``` - -Remember: if you do this, don't change `bar` after the -`EXPECT_CALL()`, or the result is undefined. - -## Validating a Member of an Object ## - -Often a mock function takes a reference to object as an argument. When -matching the argument, you may not want to compare the entire object -against a fixed object, as that may be over-specification. Instead, -you may need to validate a certain member variable or the result of a -certain getter method of the object. You can do this with `Field()` -and `Property()`. More specifically, - -``` -Field(&Foo::bar, m) -``` - -is a matcher that matches a `Foo` object whose `bar` member variable -satisfies matcher `m`. - -``` -Property(&Foo::baz, m) -``` - -is a matcher that matches a `Foo` object whose `baz()` method returns -a value that satisfies matcher `m`. - -For example: - -| Expression | Description | -|:-----------------------------|:-----------------------------------| -| `Field(&Foo::number, Ge(3))` | Matches `x` where `x.number >= 3`. | -| `Property(&Foo::name, StartsWith("John "))` | Matches `x` where `x.name()` starts with `"John "`. | - -Note that in `Property(&Foo::baz, ...)`, method `baz()` must take no -argument and be declared as `const`. - -BTW, `Field()` and `Property()` can also match plain pointers to -objects. For instance, - -``` -Field(&Foo::number, Ge(3)) -``` - -matches a plain pointer `p` where `p->number >= 3`. If `p` is `NULL`, -the match will always fail regardless of the inner matcher. - -What if you want to validate more than one members at the same time? -Remember that there is `AllOf()`. - -## Validating the Value Pointed to by a Pointer Argument ## - -C++ functions often take pointers as arguments. You can use matchers -like `IsNull()`, `NotNull()`, and other comparison matchers to match a -pointer, but what if you want to make sure the value _pointed to_ by -the pointer, instead of the pointer itself, has a certain property? -Well, you can use the `Pointee(m)` matcher. - -`Pointee(m)` matches a pointer iff `m` matches the value the pointer -points to. For example: - -``` -using ::testing::Ge; -using ::testing::Pointee; -... - EXPECT_CALL(foo, Bar(Pointee(Ge(3)))); -``` - -expects `foo.Bar()` to be called with a pointer that points to a value -greater than or equal to 3. - -One nice thing about `Pointee()` is that it treats a `NULL` pointer as -a match failure, so you can write `Pointee(m)` instead of - -``` - AllOf(NotNull(), Pointee(m)) -``` - -without worrying that a `NULL` pointer will crash your test. - -Also, did we tell you that `Pointee()` works with both raw pointers -**and** smart pointers (`linked_ptr`, `shared_ptr`, `scoped_ptr`, and -etc)? - -What if you have a pointer to pointer? You guessed it - you can use -nested `Pointee()` to probe deeper inside the value. For example, -`Pointee(Pointee(Lt(3)))` matches a pointer that points to a pointer -that points to a number less than 3 (what a mouthful...). - -## Testing a Certain Property of an Object ## - -Sometimes you want to specify that an object argument has a certain -property, but there is no existing matcher that does this. If you want -good error messages, you should define a matcher. If you want to do it -quick and dirty, you could get away with writing an ordinary function. - -Let's say you have a mock function that takes an object of type `Foo`, -which has an `int bar()` method and an `int baz()` method, and you -want to constrain that the argument's `bar()` value plus its `baz()` -value is a given number. Here's how you can define a matcher to do it: - -``` -using ::testing::MatcherInterface; -using ::testing::MatchResultListener; - -class BarPlusBazEqMatcher : public MatcherInterface { - public: - explicit BarPlusBazEqMatcher(int expected_sum) - : expected_sum_(expected_sum) {} - - virtual bool MatchAndExplain(const Foo& foo, - MatchResultListener* listener) const { - return (foo.bar() + foo.baz()) == expected_sum_; - } - - virtual void DescribeTo(::std::ostream* os) const { - *os << "bar() + baz() equals " << expected_sum_; - } - - virtual void DescribeNegationTo(::std::ostream* os) const { - *os << "bar() + baz() does not equal " << expected_sum_; - } - private: - const int expected_sum_; -}; - -inline Matcher BarPlusBazEq(int expected_sum) { - return MakeMatcher(new BarPlusBazEqMatcher(expected_sum)); -} - -... - - EXPECT_CALL(..., DoThis(BarPlusBazEq(5)))...; -``` - -## Matching Containers ## - -Sometimes an STL container (e.g. list, vector, map, ...) is passed to -a mock function and you may want to validate it. Since most STL -containers support the `==` operator, you can write -`Eq(expected_container)` or simply `expected_container` to match a -container exactly. - -Sometimes, though, you may want to be more flexible (for example, the -first element must be an exact match, but the second element can be -any positive number, and so on). Also, containers used in tests often -have a small number of elements, and having to define the expected -container out-of-line is a bit of a hassle. - -You can use the `ElementsAre()` or `UnorderedElementsAre()` matcher in -such cases: - -``` -using ::testing::_; -using ::testing::ElementsAre; -using ::testing::Gt; -... - - MOCK_METHOD1(Foo, void(const vector& numbers)); -... - - EXPECT_CALL(mock, Foo(ElementsAre(1, Gt(0), _, 5))); -``` - -The above matcher says that the container must have 4 elements, which -must be 1, greater than 0, anything, and 5 respectively. - -If you instead write: - -``` -using ::testing::_; -using ::testing::Gt; -using ::testing::UnorderedElementsAre; -... - - MOCK_METHOD1(Foo, void(const vector& numbers)); -... - - EXPECT_CALL(mock, Foo(UnorderedElementsAre(1, Gt(0), _, 5))); -``` - -It means that the container must have 4 elements, which under some -permutation must be 1, greater than 0, anything, and 5 respectively. - -`ElementsAre()` and `UnorderedElementsAre()` are overloaded to take 0 -to 10 arguments. If more are needed, you can place them in a C-style -array and use `ElementsAreArray()` or `UnorderedElementsAreArray()` -instead: - -``` -using ::testing::ElementsAreArray; -... - - // ElementsAreArray accepts an array of element values. - const int expected_vector1[] = { 1, 5, 2, 4, ... }; - EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector1))); - - // Or, an array of element matchers. - Matcher expected_vector2 = { 1, Gt(2), _, 3, ... }; - EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector2))); -``` - -In case the array needs to be dynamically created (and therefore the -array size cannot be inferred by the compiler), you can give -`ElementsAreArray()` an additional argument to specify the array size: - -``` -using ::testing::ElementsAreArray; -... - int* const expected_vector3 = new int[count]; - ... fill expected_vector3 with values ... - EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector3, count))); -``` - -**Tips:** - - * `ElementsAre*()` can be used to match _any_ container that implements the STL iterator pattern (i.e. it has a `const_iterator` type and supports `begin()/end()`), not just the ones defined in STL. It will even work with container types yet to be written - as long as they follows the above pattern. - * You can use nested `ElementsAre*()` to match nested (multi-dimensional) containers. - * If the container is passed by pointer instead of by reference, just write `Pointee(ElementsAre*(...))`. - * The order of elements _matters_ for `ElementsAre*()`. Therefore don't use it with containers whose element order is undefined (e.g. `hash_map`). - -## Sharing Matchers ## - -Under the hood, a Google Mock matcher object consists of a pointer to -a ref-counted implementation object. Copying matchers is allowed and -very efficient, as only the pointer is copied. When the last matcher -that references the implementation object dies, the implementation -object will be deleted. - -Therefore, if you have some complex matcher that you want to use again -and again, there is no need to build it everytime. Just assign it to a -matcher variable and use that variable repeatedly! For example, - -``` - Matcher in_range = AllOf(Gt(5), Le(10)); - ... use in_range as a matcher in multiple EXPECT_CALLs ... -``` - -# Setting Expectations # - -## Knowing When to Expect ## - -`ON_CALL` is likely the single most under-utilized construct in Google Mock. - -There are basically two constructs for defining the behavior of a mock object: `ON_CALL` and `EXPECT_CALL`. The difference? `ON_CALL` defines what happens when a mock method is called, but _doesn't imply any expectation on the method being called._ `EXPECT_CALL` not only defines the behavior, but also sets an expectation that _the method will be called with the given arguments, for the given number of times_ (and _in the given order_ when you specify the order too). - -Since `EXPECT_CALL` does more, isn't it better than `ON_CALL`? Not really. Every `EXPECT_CALL` adds a constraint on the behavior of the code under test. Having more constraints than necessary is _baaad_ - even worse than not having enough constraints. - -This may be counter-intuitive. How could tests that verify more be worse than tests that verify less? Isn't verification the whole point of tests? - -The answer, lies in _what_ a test should verify. **A good test verifies the contract of the code.** If a test over-specifies, it doesn't leave enough freedom to the implementation. As a result, changing the implementation without breaking the contract (e.g. refactoring and optimization), which should be perfectly fine to do, can break such tests. Then you have to spend time fixing them, only to see them broken again the next time the implementation is changed. - -Keep in mind that one doesn't have to verify more than one property in one test. In fact, **it's a good style to verify only one thing in one test.** If you do that, a bug will likely break only one or two tests instead of dozens (which case would you rather debug?). If you are also in the habit of giving tests descriptive names that tell what they verify, you can often easily guess what's wrong just from the test log itself. - -So use `ON_CALL` by default, and only use `EXPECT_CALL` when you actually intend to verify that the call is made. For example, you may have a bunch of `ON_CALL`s in your test fixture to set the common mock behavior shared by all tests in the same group, and write (scarcely) different `EXPECT_CALL`s in different `TEST_F`s to verify different aspects of the code's behavior. Compared with the style where each `TEST` has many `EXPECT_CALL`s, this leads to tests that are more resilient to implementational changes (and thus less likely to require maintenance) and makes the intent of the tests more obvious (so they are easier to maintain when you do need to maintain them). - -If you are bothered by the "Uninteresting mock function call" message printed when a mock method without an `EXPECT_CALL` is called, you may use a `NiceMock` instead to suppress all such messages for the mock object, or suppress the message for specific methods by adding `EXPECT_CALL(...).Times(AnyNumber())`. DO NOT suppress it by blindly adding an `EXPECT_CALL(...)`, or you'll have a test that's a pain to maintain. - -## Ignoring Uninteresting Calls ## - -If you are not interested in how a mock method is called, just don't -say anything about it. In this case, if the method is ever called, -Google Mock will perform its default action to allow the test program -to continue. If you are not happy with the default action taken by -Google Mock, you can override it using `DefaultValue::Set()` -(described later in this document) or `ON_CALL()`. - -Please note that once you expressed interest in a particular mock -method (via `EXPECT_CALL()`), all invocations to it must match some -expectation. If this function is called but the arguments don't match -any `EXPECT_CALL()` statement, it will be an error. - -## Disallowing Unexpected Calls ## - -If a mock method shouldn't be called at all, explicitly say so: - -``` -using ::testing::_; -... - EXPECT_CALL(foo, Bar(_)) - .Times(0); -``` - -If some calls to the method are allowed, but the rest are not, just -list all the expected calls: - -``` -using ::testing::AnyNumber; -using ::testing::Gt; -... - EXPECT_CALL(foo, Bar(5)); - EXPECT_CALL(foo, Bar(Gt(10))) - .Times(AnyNumber()); -``` - -A call to `foo.Bar()` that doesn't match any of the `EXPECT_CALL()` -statements will be an error. - -## Understanding Uninteresting vs Unexpected Calls ## - -_Uninteresting_ calls and _unexpected_ calls are different concepts in Google Mock. _Very_ different. - -A call `x.Y(...)` is **uninteresting** if there's _not even a single_ `EXPECT_CALL(x, Y(...))` set. In other words, the test isn't interested in the `x.Y()` method at all, as evident in that the test doesn't care to say anything about it. - -A call `x.Y(...)` is **unexpected** if there are some `EXPECT_CALL(x, Y(...))s` set, but none of them matches the call. Put another way, the test is interested in the `x.Y()` method (therefore it _explicitly_ sets some `EXPECT_CALL` to verify how it's called); however, the verification fails as the test doesn't expect this particular call to happen. - -**An unexpected call is always an error,** as the code under test doesn't behave the way the test expects it to behave. - -**By default, an uninteresting call is not an error,** as it violates no constraint specified by the test. (Google Mock's philosophy is that saying nothing means there is no constraint.) However, it leads to a warning, as it _might_ indicate a problem (e.g. the test author might have forgotten to specify a constraint). - -In Google Mock, `NiceMock` and `StrictMock` can be used to make a mock class "nice" or "strict". How does this affect uninteresting calls and unexpected calls? - -A **nice mock** suppresses uninteresting call warnings. It is less chatty than the default mock, but otherwise is the same. If a test fails with a default mock, it will also fail using a nice mock instead. And vice versa. Don't expect making a mock nice to change the test's result. - -A **strict mock** turns uninteresting call warnings into errors. So making a mock strict may change the test's result. - -Let's look at an example: - -``` -TEST(...) { - NiceMock mock_registry; - EXPECT_CALL(mock_registry, GetDomainOwner("google.com")) - .WillRepeatedly(Return("Larry Page")); - - // Use mock_registry in code under test. - ... &mock_registry ... -} -``` - -The sole `EXPECT_CALL` here says that all calls to `GetDomainOwner()` must have `"google.com"` as the argument. If `GetDomainOwner("yahoo.com")` is called, it will be an unexpected call, and thus an error. Having a nice mock doesn't change the severity of an unexpected call. - -So how do we tell Google Mock that `GetDomainOwner()` can be called with some other arguments as well? The standard technique is to add a "catch all" `EXPECT_CALL`: - -``` - EXPECT_CALL(mock_registry, GetDomainOwner(_)) - .Times(AnyNumber()); // catches all other calls to this method. - EXPECT_CALL(mock_registry, GetDomainOwner("google.com")) - .WillRepeatedly(Return("Larry Page")); -``` - -Remember that `_` is the wildcard matcher that matches anything. With this, if `GetDomainOwner("google.com")` is called, it will do what the second `EXPECT_CALL` says; if it is called with a different argument, it will do what the first `EXPECT_CALL` says. - -Note that the order of the two `EXPECT_CALLs` is important, as a newer `EXPECT_CALL` takes precedence over an older one. - -For more on uninteresting calls, nice mocks, and strict mocks, read ["The Nice, the Strict, and the Naggy"](#the-nice-the-strict-and-the-naggy). - -## Expecting Ordered Calls ## - -Although an `EXPECT_CALL()` statement defined earlier takes precedence -when Google Mock tries to match a function call with an expectation, -by default calls don't have to happen in the order `EXPECT_CALL()` -statements are written. For example, if the arguments match the -matchers in the third `EXPECT_CALL()`, but not those in the first two, -then the third expectation will be used. - -If you would rather have all calls occur in the order of the -expectations, put the `EXPECT_CALL()` statements in a block where you -define a variable of type `InSequence`: - -``` - using ::testing::_; - using ::testing::InSequence; - - { - InSequence s; - - EXPECT_CALL(foo, DoThis(5)); - EXPECT_CALL(bar, DoThat(_)) - .Times(2); - EXPECT_CALL(foo, DoThis(6)); - } -``` - -In this example, we expect a call to `foo.DoThis(5)`, followed by two -calls to `bar.DoThat()` where the argument can be anything, which are -in turn followed by a call to `foo.DoThis(6)`. If a call occurred -out-of-order, Google Mock will report an error. - -## Expecting Partially Ordered Calls ## - -Sometimes requiring everything to occur in a predetermined order can -lead to brittle tests. For example, we may care about `A` occurring -before both `B` and `C`, but aren't interested in the relative order -of `B` and `C`. In this case, the test should reflect our real intent, -instead of being overly constraining. - -Google Mock allows you to impose an arbitrary DAG (directed acyclic -graph) on the calls. One way to express the DAG is to use the -[After](CheatSheet.md#the-after-clause) clause of `EXPECT_CALL`. - -Another way is via the `InSequence()` clause (not the same as the -`InSequence` class), which we borrowed from jMock 2. It's less -flexible than `After()`, but more convenient when you have long chains -of sequential calls, as it doesn't require you to come up with -different names for the expectations in the chains. Here's how it -works: - -If we view `EXPECT_CALL()` statements as nodes in a graph, and add an -edge from node A to node B wherever A must occur before B, we can get -a DAG. We use the term "sequence" to mean a directed path in this -DAG. Now, if we decompose the DAG into sequences, we just need to know -which sequences each `EXPECT_CALL()` belongs to in order to be able to -reconstruct the orginal DAG. - -So, to specify the partial order on the expectations we need to do two -things: first to define some `Sequence` objects, and then for each -`EXPECT_CALL()` say which `Sequence` objects it is part -of. Expectations in the same sequence must occur in the order they are -written. For example, - -``` - using ::testing::Sequence; - - Sequence s1, s2; - - EXPECT_CALL(foo, A()) - .InSequence(s1, s2); - EXPECT_CALL(bar, B()) - .InSequence(s1); - EXPECT_CALL(bar, C()) - .InSequence(s2); - EXPECT_CALL(foo, D()) - .InSequence(s2); -``` - -specifies the following DAG (where `s1` is `A -> B`, and `s2` is `A -> -C -> D`): - -``` - +---> B - | - A ---| - | - +---> C ---> D -``` - -This means that A must occur before B and C, and C must occur before -D. There's no restriction about the order other than these. - -## Controlling When an Expectation Retires ## - -When a mock method is called, Google Mock only consider expectations -that are still active. An expectation is active when created, and -becomes inactive (aka _retires_) when a call that has to occur later -has occurred. For example, in - -``` - using ::testing::_; - using ::testing::Sequence; - - Sequence s1, s2; - - EXPECT_CALL(log, Log(WARNING, _, "File too large.")) // #1 - .Times(AnyNumber()) - .InSequence(s1, s2); - EXPECT_CALL(log, Log(WARNING, _, "Data set is empty.")) // #2 - .InSequence(s1); - EXPECT_CALL(log, Log(WARNING, _, "User not found.")) // #3 - .InSequence(s2); -``` - -as soon as either #2 or #3 is matched, #1 will retire. If a warning -`"File too large."` is logged after this, it will be an error. - -Note that an expectation doesn't retire automatically when it's -saturated. For example, - -``` -using ::testing::_; -... - EXPECT_CALL(log, Log(WARNING, _, _)); // #1 - EXPECT_CALL(log, Log(WARNING, _, "File too large.")); // #2 -``` - -says that there will be exactly one warning with the message `"File -too large."`. If the second warning contains this message too, #2 will -match again and result in an upper-bound-violated error. - -If this is not what you want, you can ask an expectation to retire as -soon as it becomes saturated: - -``` -using ::testing::_; -... - EXPECT_CALL(log, Log(WARNING, _, _)); // #1 - EXPECT_CALL(log, Log(WARNING, _, "File too large.")) // #2 - .RetiresOnSaturation(); -``` - -Here #2 can be used only once, so if you have two warnings with the -message `"File too large."`, the first will match #2 and the second -will match #1 - there will be no error. - -# Using Actions # - -## Returning References from Mock Methods ## - -If a mock function's return type is a reference, you need to use -`ReturnRef()` instead of `Return()` to return a result: - -``` -using ::testing::ReturnRef; - -class MockFoo : public Foo { - public: - MOCK_METHOD0(GetBar, Bar&()); -}; -... - - MockFoo foo; - Bar bar; - EXPECT_CALL(foo, GetBar()) - .WillOnce(ReturnRef(bar)); -``` - -## Returning Live Values from Mock Methods ## - -The `Return(x)` action saves a copy of `x` when the action is -_created_, and always returns the same value whenever it's -executed. Sometimes you may want to instead return the _live_ value of -`x` (i.e. its value at the time when the action is _executed_.). - -If the mock function's return type is a reference, you can do it using -`ReturnRef(x)`, as shown in the previous recipe ("Returning References -from Mock Methods"). However, Google Mock doesn't let you use -`ReturnRef()` in a mock function whose return type is not a reference, -as doing that usually indicates a user error. So, what shall you do? - -You may be tempted to try `ByRef()`: - -``` -using testing::ByRef; -using testing::Return; - -class MockFoo : public Foo { - public: - MOCK_METHOD0(GetValue, int()); -}; -... - int x = 0; - MockFoo foo; - EXPECT_CALL(foo, GetValue()) - .WillRepeatedly(Return(ByRef(x))); - x = 42; - EXPECT_EQ(42, foo.GetValue()); -``` - -Unfortunately, it doesn't work here. The above code will fail with error: - -``` -Value of: foo.GetValue() - Actual: 0 -Expected: 42 -``` - -The reason is that `Return(value)` converts `value` to the actual -return type of the mock function at the time when the action is -_created_, not when it is _executed_. (This behavior was chosen for -the action to be safe when `value` is a proxy object that references -some temporary objects.) As a result, `ByRef(x)` is converted to an -`int` value (instead of a `const int&`) when the expectation is set, -and `Return(ByRef(x))` will always return 0. - -`ReturnPointee(pointer)` was provided to solve this problem -specifically. It returns the value pointed to by `pointer` at the time -the action is _executed_: - -``` -using testing::ReturnPointee; -... - int x = 0; - MockFoo foo; - EXPECT_CALL(foo, GetValue()) - .WillRepeatedly(ReturnPointee(&x)); // Note the & here. - x = 42; - EXPECT_EQ(42, foo.GetValue()); // This will succeed now. -``` - -## Combining Actions ## - -Want to do more than one thing when a function is called? That's -fine. `DoAll()` allow you to do sequence of actions every time. Only -the return value of the last action in the sequence will be used. - -``` -using ::testing::DoAll; - -class MockFoo : public Foo { - public: - MOCK_METHOD1(Bar, bool(int n)); -}; -... - - EXPECT_CALL(foo, Bar(_)) - .WillOnce(DoAll(action_1, - action_2, - ... - action_n)); -``` - -## Mocking Side Effects ## - -Sometimes a method exhibits its effect not via returning a value but -via side effects. For example, it may change some global state or -modify an output argument. To mock side effects, in general you can -define your own action by implementing `::testing::ActionInterface`. - -If all you need to do is to change an output argument, the built-in -`SetArgPointee()` action is convenient: - -``` -using ::testing::SetArgPointee; - -class MockMutator : public Mutator { - public: - MOCK_METHOD2(Mutate, void(bool mutate, int* value)); - ... -}; -... - - MockMutator mutator; - EXPECT_CALL(mutator, Mutate(true, _)) - .WillOnce(SetArgPointee<1>(5)); -``` - -In this example, when `mutator.Mutate()` is called, we will assign 5 -to the `int` variable pointed to by argument #1 -(0-based). - -`SetArgPointee()` conveniently makes an internal copy of the -value you pass to it, removing the need to keep the value in scope and -alive. The implication however is that the value must have a copy -constructor and assignment operator. - -If the mock method also needs to return a value as well, you can chain -`SetArgPointee()` with `Return()` using `DoAll()`: - -``` -using ::testing::_; -using ::testing::Return; -using ::testing::SetArgPointee; - -class MockMutator : public Mutator { - public: - ... - MOCK_METHOD1(MutateInt, bool(int* value)); -}; -... - - MockMutator mutator; - EXPECT_CALL(mutator, MutateInt(_)) - .WillOnce(DoAll(SetArgPointee<0>(5), - Return(true))); -``` - -If the output argument is an array, use the -`SetArrayArgument(first, last)` action instead. It copies the -elements in source range `[first, last)` to the array pointed to by -the `N`-th (0-based) argument: - -``` -using ::testing::NotNull; -using ::testing::SetArrayArgument; - -class MockArrayMutator : public ArrayMutator { - public: - MOCK_METHOD2(Mutate, void(int* values, int num_values)); - ... -}; -... - - MockArrayMutator mutator; - int values[5] = { 1, 2, 3, 4, 5 }; - EXPECT_CALL(mutator, Mutate(NotNull(), 5)) - .WillOnce(SetArrayArgument<0>(values, values + 5)); -``` - -This also works when the argument is an output iterator: - -``` -using ::testing::_; -using ::testing::SetArrayArgument; - -class MockRolodex : public Rolodex { - public: - MOCK_METHOD1(GetNames, void(std::back_insert_iterator >)); - ... -}; -... - - MockRolodex rolodex; - vector names; - names.push_back("George"); - names.push_back("John"); - names.push_back("Thomas"); - EXPECT_CALL(rolodex, GetNames(_)) - .WillOnce(SetArrayArgument<0>(names.begin(), names.end())); -``` - -## Changing a Mock Object's Behavior Based on the State ## - -If you expect a call to change the behavior of a mock object, you can use `::testing::InSequence` to specify different behaviors before and after the call: - -``` -using ::testing::InSequence; -using ::testing::Return; - -... - { - InSequence seq; - EXPECT_CALL(my_mock, IsDirty()) - .WillRepeatedly(Return(true)); - EXPECT_CALL(my_mock, Flush()); - EXPECT_CALL(my_mock, IsDirty()) - .WillRepeatedly(Return(false)); - } - my_mock.FlushIfDirty(); -``` - -This makes `my_mock.IsDirty()` return `true` before `my_mock.Flush()` is called and return `false` afterwards. - -If the behavior change is more complex, you can store the effects in a variable and make a mock method get its return value from that variable: - -``` -using ::testing::_; -using ::testing::SaveArg; -using ::testing::Return; - -ACTION_P(ReturnPointee, p) { return *p; } -... - int previous_value = 0; - EXPECT_CALL(my_mock, GetPrevValue()) - .WillRepeatedly(ReturnPointee(&previous_value)); - EXPECT_CALL(my_mock, UpdateValue(_)) - .WillRepeatedly(SaveArg<0>(&previous_value)); - my_mock.DoSomethingToUpdateValue(); -``` - -Here `my_mock.GetPrevValue()` will always return the argument of the last `UpdateValue()` call. - -## Setting the Default Value for a Return Type ## - -If a mock method's return type is a built-in C++ type or pointer, by -default it will return 0 when invoked. Also, in C++ 11 and above, a mock -method whose return type has a default constructor will return a default-constructed -value by default. You only need to specify an -action if this default value doesn't work for you. - -Sometimes, you may want to change this default value, or you may want -to specify a default value for types Google Mock doesn't know -about. You can do this using the `::testing::DefaultValue` class -template: - -``` -class MockFoo : public Foo { - public: - MOCK_METHOD0(CalculateBar, Bar()); -}; -... - - Bar default_bar; - // Sets the default return value for type Bar. - DefaultValue::Set(default_bar); - - MockFoo foo; - - // We don't need to specify an action here, as the default - // return value works for us. - EXPECT_CALL(foo, CalculateBar()); - - foo.CalculateBar(); // This should return default_bar. - - // Unsets the default return value. - DefaultValue::Clear(); -``` - -Please note that changing the default value for a type can make you -tests hard to understand. We recommend you to use this feature -judiciously. For example, you may want to make sure the `Set()` and -`Clear()` calls are right next to the code that uses your mock. - -## Setting the Default Actions for a Mock Method ## - -You've learned how to change the default value of a given -type. However, this may be too coarse for your purpose: perhaps you -have two mock methods with the same return type and you want them to -have different behaviors. The `ON_CALL()` macro allows you to -customize your mock's behavior at the method level: - -``` -using ::testing::_; -using ::testing::AnyNumber; -using ::testing::Gt; -using ::testing::Return; -... - ON_CALL(foo, Sign(_)) - .WillByDefault(Return(-1)); - ON_CALL(foo, Sign(0)) - .WillByDefault(Return(0)); - ON_CALL(foo, Sign(Gt(0))) - .WillByDefault(Return(1)); - - EXPECT_CALL(foo, Sign(_)) - .Times(AnyNumber()); - - foo.Sign(5); // This should return 1. - foo.Sign(-9); // This should return -1. - foo.Sign(0); // This should return 0. -``` - -As you may have guessed, when there are more than one `ON_CALL()` -statements, the news order take precedence over the older ones. In -other words, the **last** one that matches the function arguments will -be used. This matching order allows you to set up the common behavior -in a mock object's constructor or the test fixture's set-up phase and -specialize the mock's behavior later. - -## Using Functions/Methods/Functors as Actions ## - -If the built-in actions don't suit you, you can easily use an existing -function, method, or functor as an action: - -``` -using ::testing::_; -using ::testing::Invoke; - -class MockFoo : public Foo { - public: - MOCK_METHOD2(Sum, int(int x, int y)); - MOCK_METHOD1(ComplexJob, bool(int x)); -}; - -int CalculateSum(int x, int y) { return x + y; } - -class Helper { - public: - bool ComplexJob(int x); -}; -... - - MockFoo foo; - Helper helper; - EXPECT_CALL(foo, Sum(_, _)) - .WillOnce(Invoke(CalculateSum)); - EXPECT_CALL(foo, ComplexJob(_)) - .WillOnce(Invoke(&helper, &Helper::ComplexJob)); - - foo.Sum(5, 6); // Invokes CalculateSum(5, 6). - foo.ComplexJob(10); // Invokes helper.ComplexJob(10); -``` - -The only requirement is that the type of the function, etc must be -_compatible_ with the signature of the mock function, meaning that the -latter's arguments can be implicitly converted to the corresponding -arguments of the former, and the former's return type can be -implicitly converted to that of the latter. So, you can invoke -something whose type is _not_ exactly the same as the mock function, -as long as it's safe to do so - nice, huh? - -## Invoking a Function/Method/Functor Without Arguments ## - -`Invoke()` is very useful for doing actions that are more complex. It -passes the mock function's arguments to the function or functor being -invoked such that the callee has the full context of the call to work -with. If the invoked function is not interested in some or all of the -arguments, it can simply ignore them. - -Yet, a common pattern is that a test author wants to invoke a function -without the arguments of the mock function. `Invoke()` allows her to -do that using a wrapper function that throws away the arguments before -invoking an underlining nullary function. Needless to say, this can be -tedious and obscures the intent of the test. - -`InvokeWithoutArgs()` solves this problem. It's like `Invoke()` except -that it doesn't pass the mock function's arguments to the -callee. Here's an example: - -``` -using ::testing::_; -using ::testing::InvokeWithoutArgs; - -class MockFoo : public Foo { - public: - MOCK_METHOD1(ComplexJob, bool(int n)); -}; - -bool Job1() { ... } -... - - MockFoo foo; - EXPECT_CALL(foo, ComplexJob(_)) - .WillOnce(InvokeWithoutArgs(Job1)); - - foo.ComplexJob(10); // Invokes Job1(). -``` - -## Invoking an Argument of the Mock Function ## - -Sometimes a mock function will receive a function pointer or a functor -(in other words, a "callable") as an argument, e.g. - -``` -class MockFoo : public Foo { - public: - MOCK_METHOD2(DoThis, bool(int n, bool (*fp)(int))); -}; -``` - -and you may want to invoke this callable argument: - -``` -using ::testing::_; -... - MockFoo foo; - EXPECT_CALL(foo, DoThis(_, _)) - .WillOnce(...); - // Will execute (*fp)(5), where fp is the - // second argument DoThis() receives. -``` - -Arghh, you need to refer to a mock function argument but your version -of C++ has no lambdas, so you have to define your own action. :-( -Or do you really? - -Well, Google Mock has an action to solve _exactly_ this problem: - -``` - InvokeArgument(arg_1, arg_2, ..., arg_m) -``` - -will invoke the `N`-th (0-based) argument the mock function receives, -with `arg_1`, `arg_2`, ..., and `arg_m`. No matter if the argument is -a function pointer or a functor, Google Mock handles them both. - -With that, you could write: - -``` -using ::testing::_; -using ::testing::InvokeArgument; -... - EXPECT_CALL(foo, DoThis(_, _)) - .WillOnce(InvokeArgument<1>(5)); - // Will execute (*fp)(5), where fp is the - // second argument DoThis() receives. -``` - -What if the callable takes an argument by reference? No problem - just -wrap it inside `ByRef()`: - -``` -... - MOCK_METHOD1(Bar, bool(bool (*fp)(int, const Helper&))); -... -using ::testing::_; -using ::testing::ByRef; -using ::testing::InvokeArgument; -... - - MockFoo foo; - Helper helper; - ... - EXPECT_CALL(foo, Bar(_)) - .WillOnce(InvokeArgument<0>(5, ByRef(helper))); - // ByRef(helper) guarantees that a reference to helper, not a copy of it, - // will be passed to the callable. -``` - -What if the callable takes an argument by reference and we do **not** -wrap the argument in `ByRef()`? Then `InvokeArgument()` will _make a -copy_ of the argument, and pass a _reference to the copy_, instead of -a reference to the original value, to the callable. This is especially -handy when the argument is a temporary value: - -``` -... - MOCK_METHOD1(DoThat, bool(bool (*f)(const double& x, const string& s))); -... -using ::testing::_; -using ::testing::InvokeArgument; -... - - MockFoo foo; - ... - EXPECT_CALL(foo, DoThat(_)) - .WillOnce(InvokeArgument<0>(5.0, string("Hi"))); - // Will execute (*f)(5.0, string("Hi")), where f is the function pointer - // DoThat() receives. Note that the values 5.0 and string("Hi") are - // temporary and dead once the EXPECT_CALL() statement finishes. Yet - // it's fine to perform this action later, since a copy of the values - // are kept inside the InvokeArgument action. -``` - -## Ignoring an Action's Result ## - -Sometimes you have an action that returns _something_, but you need an -action that returns `void` (perhaps you want to use it in a mock -function that returns `void`, or perhaps it needs to be used in -`DoAll()` and it's not the last in the list). `IgnoreResult()` lets -you do that. For example: - -``` -using ::testing::_; -using ::testing::Invoke; -using ::testing::Return; - -int Process(const MyData& data); -string DoSomething(); - -class MockFoo : public Foo { - public: - MOCK_METHOD1(Abc, void(const MyData& data)); - MOCK_METHOD0(Xyz, bool()); -}; -... - - MockFoo foo; - EXPECT_CALL(foo, Abc(_)) - // .WillOnce(Invoke(Process)); - // The above line won't compile as Process() returns int but Abc() needs - // to return void. - .WillOnce(IgnoreResult(Invoke(Process))); - - EXPECT_CALL(foo, Xyz()) - .WillOnce(DoAll(IgnoreResult(Invoke(DoSomething)), - // Ignores the string DoSomething() returns. - Return(true))); -``` - -Note that you **cannot** use `IgnoreResult()` on an action that already -returns `void`. Doing so will lead to ugly compiler errors. - -## Selecting an Action's Arguments ## - -Say you have a mock function `Foo()` that takes seven arguments, and -you have a custom action that you want to invoke when `Foo()` is -called. Trouble is, the custom action only wants three arguments: - -``` -using ::testing::_; -using ::testing::Invoke; -... - MOCK_METHOD7(Foo, bool(bool visible, const string& name, int x, int y, - const map, double>& weight, - double min_weight, double max_wight)); -... - -bool IsVisibleInQuadrant1(bool visible, int x, int y) { - return visible && x >= 0 && y >= 0; -} -... - - EXPECT_CALL(mock, Foo(_, _, _, _, _, _, _)) - .WillOnce(Invoke(IsVisibleInQuadrant1)); // Uh, won't compile. :-( -``` - -To please the compiler God, you can to define an "adaptor" that has -the same signature as `Foo()` and calls the custom action with the -right arguments: - -``` -using ::testing::_; -using ::testing::Invoke; - -bool MyIsVisibleInQuadrant1(bool visible, const string& name, int x, int y, - const map, double>& weight, - double min_weight, double max_wight) { - return IsVisibleInQuadrant1(visible, x, y); -} -... - - EXPECT_CALL(mock, Foo(_, _, _, _, _, _, _)) - .WillOnce(Invoke(MyIsVisibleInQuadrant1)); // Now it works. -``` - -But isn't this awkward? - -Google Mock provides a generic _action adaptor_, so you can spend your -time minding more important business than writing your own -adaptors. Here's the syntax: - -``` - WithArgs(action) -``` - -creates an action that passes the arguments of the mock function at -the given indices (0-based) to the inner `action` and performs -it. Using `WithArgs`, our original example can be written as: - -``` -using ::testing::_; -using ::testing::Invoke; -using ::testing::WithArgs; -... - EXPECT_CALL(mock, Foo(_, _, _, _, _, _, _)) - .WillOnce(WithArgs<0, 2, 3>(Invoke(IsVisibleInQuadrant1))); - // No need to define your own adaptor. -``` - -For better readability, Google Mock also gives you: - - * `WithoutArgs(action)` when the inner `action` takes _no_ argument, and - * `WithArg(action)` (no `s` after `Arg`) when the inner `action` takes _one_ argument. - -As you may have realized, `InvokeWithoutArgs(...)` is just syntactic -sugar for `WithoutArgs(Invoke(...))`. - -Here are more tips: - - * The inner action used in `WithArgs` and friends does not have to be `Invoke()` -- it can be anything. - * You can repeat an argument in the argument list if necessary, e.g. `WithArgs<2, 3, 3, 5>(...)`. - * You can change the order of the arguments, e.g. `WithArgs<3, 2, 1>(...)`. - * The types of the selected arguments do _not_ have to match the signature of the inner action exactly. It works as long as they can be implicitly converted to the corresponding arguments of the inner action. For example, if the 4-th argument of the mock function is an `int` and `my_action` takes a `double`, `WithArg<4>(my_action)` will work. - -## Ignoring Arguments in Action Functions ## - -The selecting-an-action's-arguments recipe showed us one way to make a -mock function and an action with incompatible argument lists fit -together. The downside is that wrapping the action in -`WithArgs<...>()` can get tedious for people writing the tests. - -If you are defining a function, method, or functor to be used with -`Invoke*()`, and you are not interested in some of its arguments, an -alternative to `WithArgs` is to declare the uninteresting arguments as -`Unused`. This makes the definition less cluttered and less fragile in -case the types of the uninteresting arguments change. It could also -increase the chance the action function can be reused. For example, -given - -``` - MOCK_METHOD3(Foo, double(const string& label, double x, double y)); - MOCK_METHOD3(Bar, double(int index, double x, double y)); -``` - -instead of - -``` -using ::testing::_; -using ::testing::Invoke; - -double DistanceToOriginWithLabel(const string& label, double x, double y) { - return sqrt(x*x + y*y); -} - -double DistanceToOriginWithIndex(int index, double x, double y) { - return sqrt(x*x + y*y); -} -... - - EXEPCT_CALL(mock, Foo("abc", _, _)) - .WillOnce(Invoke(DistanceToOriginWithLabel)); - EXEPCT_CALL(mock, Bar(5, _, _)) - .WillOnce(Invoke(DistanceToOriginWithIndex)); -``` - -you could write - -``` -using ::testing::_; -using ::testing::Invoke; -using ::testing::Unused; - -double DistanceToOrigin(Unused, double x, double y) { - return sqrt(x*x + y*y); -} -... - - EXEPCT_CALL(mock, Foo("abc", _, _)) - .WillOnce(Invoke(DistanceToOrigin)); - EXEPCT_CALL(mock, Bar(5, _, _)) - .WillOnce(Invoke(DistanceToOrigin)); -``` - -## Sharing Actions ## - -Just like matchers, a Google Mock action object consists of a pointer -to a ref-counted implementation object. Therefore copying actions is -also allowed and very efficient. When the last action that references -the implementation object dies, the implementation object will be -deleted. - -If you have some complex action that you want to use again and again, -you may not have to build it from scratch everytime. If the action -doesn't have an internal state (i.e. if it always does the same thing -no matter how many times it has been called), you can assign it to an -action variable and use that variable repeatedly. For example: - -``` - Action set_flag = DoAll(SetArgPointee<0>(5), - Return(true)); - ... use set_flag in .WillOnce() and .WillRepeatedly() ... -``` - -However, if the action has its own state, you may be surprised if you -share the action object. Suppose you have an action factory -`IncrementCounter(init)` which creates an action that increments and -returns a counter whose initial value is `init`, using two actions -created from the same expression and using a shared action will -exihibit different behaviors. Example: - -``` - EXPECT_CALL(foo, DoThis()) - .WillRepeatedly(IncrementCounter(0)); - EXPECT_CALL(foo, DoThat()) - .WillRepeatedly(IncrementCounter(0)); - foo.DoThis(); // Returns 1. - foo.DoThis(); // Returns 2. - foo.DoThat(); // Returns 1 - Blah() uses a different - // counter than Bar()'s. -``` - -versus - -``` - Action increment = IncrementCounter(0); - - EXPECT_CALL(foo, DoThis()) - .WillRepeatedly(increment); - EXPECT_CALL(foo, DoThat()) - .WillRepeatedly(increment); - foo.DoThis(); // Returns 1. - foo.DoThis(); // Returns 2. - foo.DoThat(); // Returns 3 - the counter is shared. -``` - -# Misc Recipes on Using Google Mock # - -## Mocking Methods That Use Move-Only Types ## - -C++11 introduced move-only types. A move-only-typed value can be moved from one object to another, but cannot be copied. `std::unique_ptr` is probably the most commonly used move-only type. - -Mocking a method that takes and/or returns move-only types presents some challenges, but nothing insurmountable. This recipe shows you how you can do it. - -Let’s say we are working on a fictional project that lets one post and share snippets called “buzzes”. Your code uses these types: - -``` -enum class AccessLevel { kInternal, kPublic }; - -class Buzz { - public: - explicit Buzz(AccessLevel access) { … } - ... -}; - -class Buzzer { - public: - virtual ~Buzzer() {} - virtual std::unique_ptr MakeBuzz(const std::string& text) = 0; - virtual bool ShareBuzz(std::unique_ptr buzz, Time timestamp) = 0; - ... -}; -``` - -A `Buzz` object represents a snippet being posted. A class that implements the `Buzzer` interface is capable of creating and sharing `Buzz`. Methods in `Buzzer` may return a `unique_ptr` or take a `unique_ptr`. Now we need to mock `Buzzer` in our tests. - -To mock a method that returns a move-only type, you just use the familiar `MOCK_METHOD` syntax as usual: - -``` -class MockBuzzer : public Buzzer { - public: - MOCK_METHOD1(MakeBuzz, std::unique_ptr(const std::string& text)); - … -}; -``` - -However, if you attempt to use the same `MOCK_METHOD` pattern to mock a method that takes a move-only parameter, you’ll get a compiler error currently: - -``` - // Does NOT compile! - MOCK_METHOD2(ShareBuzz, bool(std::unique_ptr buzz, Time timestamp)); -``` - -While it’s highly desirable to make this syntax just work, it’s not trivial and the work hasn’t been done yet. Fortunately, there is a trick you can apply today to get something that works nearly as well as this. - -The trick, is to delegate the `ShareBuzz()` method to a mock method (let’s call it `DoShareBuzz()`) that does not take move-only parameters: - -``` -class MockBuzzer : public Buzzer { - public: - MOCK_METHOD1(MakeBuzz, std::unique_ptr(const std::string& text)); - MOCK_METHOD2(DoShareBuzz, bool(Buzz* buzz, Time timestamp)); - bool ShareBuzz(std::unique_ptr buzz, Time timestamp) { - return DoShareBuzz(buzz.get(), timestamp); - } -}; -``` - -Note that there's no need to define or declare `DoShareBuzz()` in a base class. You only need to define it as a `MOCK_METHOD` in the mock class. - -Now that we have the mock class defined, we can use it in tests. In the following code examples, we assume that we have defined a `MockBuzzer` object named `mock_buzzer_`: - -``` - MockBuzzer mock_buzzer_; -``` - -First let’s see how we can set expectations on the `MakeBuzz()` method, which returns a `unique_ptr`. - -As usual, if you set an expectation without an action (i.e. the `.WillOnce()` or `.WillRepeated()` clause), when that expectation fires, the default action for that method will be taken. Since `unique_ptr<>` has a default constructor that returns a null `unique_ptr`, that’s what you’ll get if you don’t specify an action: - -``` - // Use the default action. - EXPECT_CALL(mock_buzzer_, MakeBuzz("hello")); - - // Triggers the previous EXPECT_CALL. - EXPECT_EQ(nullptr, mock_buzzer_.MakeBuzz("hello")); -``` - -If you are not happy with the default action, you can tweak it. Depending on what you need, you may either tweak the default action for a specific (mock object, mock method) combination using `ON_CALL()`, or you may tweak the default action for all mock methods that return a specific type. The usage of `ON_CALL()` is similar to `EXPECT_CALL()`, so we’ll skip it and just explain how to do the latter (tweaking the default action for a specific return type). You do this via the `DefaultValue<>::SetFactory()` and `DefaultValue<>::Clear()` API: - -``` - // Sets the default action for return type std::unique_ptr to - // creating a new Buzz every time. - DefaultValue>::SetFactory( - [] { return MakeUnique(AccessLevel::kInternal); }); - - // When this fires, the default action of MakeBuzz() will run, which - // will return a new Buzz object. - EXPECT_CALL(mock_buzzer_, MakeBuzz("hello")).Times(AnyNumber()); - - auto buzz1 = mock_buzzer_.MakeBuzz("hello"); - auto buzz2 = mock_buzzer_.MakeBuzz("hello"); - EXPECT_NE(nullptr, buzz1); - EXPECT_NE(nullptr, buzz2); - EXPECT_NE(buzz1, buzz2); - - // Resets the default action for return type std::unique_ptr, - // to avoid interfere with other tests. - DefaultValue>::Clear(); -``` - -What if you want the method to do something other than the default action? If you just need to return a pre-defined move-only value, you can use the `Return(ByMove(...))` action: - -``` - // When this fires, the unique_ptr<> specified by ByMove(...) will - // be returned. - EXPECT_CALL(mock_buzzer_, MakeBuzz("world")) - .WillOnce(Return(ByMove(MakeUnique(AccessLevel::kInternal)))); - - EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("world")); -``` - -Note that `ByMove()` is essential here - if you drop it, the code won’t compile. - -Quiz time! What do you think will happen if a `Return(ByMove(...))` action is performed more than once (e.g. you write `….WillRepeatedly(Return(ByMove(...)));`)? Come think of it, after the first time the action runs, the source value will be consumed (since it’s a move-only value), so the next time around, there’s no value to move from -- you’ll get a run-time error that `Return(ByMove(...))` can only be run once. - -If you need your mock method to do more than just moving a pre-defined value, remember that you can always use `Invoke()` to call a lambda or a callable object, which can do pretty much anything you want: - -``` - EXPECT_CALL(mock_buzzer_, MakeBuzz("x")) - .WillRepeatedly(Invoke([](const std::string& text) { - return std::make_unique(AccessLevel::kInternal); - })); - - EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("x")); - EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("x")); -``` - -Every time this `EXPECT_CALL` fires, a new `unique_ptr` will be created and returned. You cannot do this with `Return(ByMove(...))`. - -Now there’s one topic we haven’t covered: how do you set expectations on `ShareBuzz()`, which takes a move-only-typed parameter? The answer is you don’t. Instead, you set expectations on the `DoShareBuzz()` mock method (remember that we defined a `MOCK_METHOD` for `DoShareBuzz()`, not `ShareBuzz()`): - -``` - EXPECT_CALL(mock_buzzer_, DoShareBuzz(NotNull(), _)); - - // When one calls ShareBuzz() on the MockBuzzer like this, the call is - // forwarded to DoShareBuzz(), which is mocked. Therefore this statement - // will trigger the above EXPECT_CALL. - mock_buzzer_.ShareBuzz(MakeUnique(AccessLevel::kInternal), - ::base::Now()); -``` - -Some of you may have spotted one problem with this approach: the `DoShareBuzz()` mock method differs from the real `ShareBuzz()` method in that it cannot take ownership of the buzz parameter - `ShareBuzz()` will always delete buzz after `DoShareBuzz()` returns. What if you need to save the buzz object somewhere for later use when `ShareBuzz()` is called? Indeed, you'd be stuck. - -Another problem with the `DoShareBuzz()` we had is that it can surprise people reading or maintaining the test, as one would expect that `DoShareBuzz()` has (logically) the same contract as `ShareBuzz()`. - -Fortunately, these problems can be fixed with a bit more code. Let's try to get it right this time: - -``` -class MockBuzzer : public Buzzer { - public: - MockBuzzer() { - // Since DoShareBuzz(buzz, time) is supposed to take ownership of - // buzz, define a default behavior for DoShareBuzz(buzz, time) to - // delete buzz. - ON_CALL(*this, DoShareBuzz(_, _)) - .WillByDefault(Invoke([](Buzz* buzz, Time timestamp) { - delete buzz; - return true; - })); - } - - MOCK_METHOD1(MakeBuzz, std::unique_ptr(const std::string& text)); - - // Takes ownership of buzz. - MOCK_METHOD2(DoShareBuzz, bool(Buzz* buzz, Time timestamp)); - bool ShareBuzz(std::unique_ptr buzz, Time timestamp) { - return DoShareBuzz(buzz.release(), timestamp); - } -}; -``` - -Now, the mock `DoShareBuzz()` method is free to save the buzz argument for later use if this is what you want: - -``` - std::unique_ptr intercepted_buzz; - EXPECT_CALL(mock_buzzer_, DoShareBuzz(NotNull(), _)) - .WillOnce(Invoke([&intercepted_buzz](Buzz* buzz, Time timestamp) { - // Save buzz in intercepted_buzz for analysis later. - intercepted_buzz.reset(buzz); - return false; - })); - - mock_buzzer_.ShareBuzz(std::make_unique(AccessLevel::kInternal), - Now()); - EXPECT_NE(nullptr, intercepted_buzz); -``` - -Using the tricks covered in this recipe, you are now able to mock methods that take and/or return move-only types. Put your newly-acquired power to good use - when you design a new API, you can now feel comfortable using `unique_ptrs` as appropriate, without fearing that doing so will compromise your tests. - -## Making the Compilation Faster ## - -Believe it or not, the _vast majority_ of the time spent on compiling -a mock class is in generating its constructor and destructor, as they -perform non-trivial tasks (e.g. verification of the -expectations). What's more, mock methods with different signatures -have different types and thus their constructors/destructors need to -be generated by the compiler separately. As a result, if you mock many -different types of methods, compiling your mock class can get really -slow. - -If you are experiencing slow compilation, you can move the definition -of your mock class' constructor and destructor out of the class body -and into a `.cpp` file. This way, even if you `#include` your mock -class in N files, the compiler only needs to generate its constructor -and destructor once, resulting in a much faster compilation. - -Let's illustrate the idea using an example. Here's the definition of a -mock class before applying this recipe: - -``` -// File mock_foo.h. -... -class MockFoo : public Foo { - public: - // Since we don't declare the constructor or the destructor, - // the compiler will generate them in every translation unit - // where this mock class is used. - - MOCK_METHOD0(DoThis, int()); - MOCK_METHOD1(DoThat, bool(const char* str)); - ... more mock methods ... -}; -``` - -After the change, it would look like: - -``` -// File mock_foo.h. -... -class MockFoo : public Foo { - public: - // The constructor and destructor are declared, but not defined, here. - MockFoo(); - virtual ~MockFoo(); - - MOCK_METHOD0(DoThis, int()); - MOCK_METHOD1(DoThat, bool(const char* str)); - ... more mock methods ... -}; -``` -and -``` -// File mock_foo.cpp. -#include "path/to/mock_foo.h" - -// The definitions may appear trivial, but the functions actually do a -// lot of things through the constructors/destructors of the member -// variables used to implement the mock methods. -MockFoo::MockFoo() {} -MockFoo::~MockFoo() {} -``` - -## Forcing a Verification ## - -When it's being destroyed, your friendly mock object will automatically -verify that all expectations on it have been satisfied, and will -generate [Google Test](../../googletest/) failures -if not. This is convenient as it leaves you with one less thing to -worry about. That is, unless you are not sure if your mock object will -be destroyed. - -How could it be that your mock object won't eventually be destroyed? -Well, it might be created on the heap and owned by the code you are -testing. Suppose there's a bug in that code and it doesn't delete the -mock object properly - you could end up with a passing test when -there's actually a bug. - -Using a heap checker is a good idea and can alleviate the concern, but -its implementation may not be 100% reliable. So, sometimes you do want -to _force_ Google Mock to verify a mock object before it is -(hopefully) destructed. You can do this with -`Mock::VerifyAndClearExpectations(&mock_object)`: - -``` -TEST(MyServerTest, ProcessesRequest) { - using ::testing::Mock; - - MockFoo* const foo = new MockFoo; - EXPECT_CALL(*foo, ...)...; - // ... other expectations ... - - // server now owns foo. - MyServer server(foo); - server.ProcessRequest(...); - - // In case that server's destructor will forget to delete foo, - // this will verify the expectations anyway. - Mock::VerifyAndClearExpectations(foo); -} // server is destroyed when it goes out of scope here. -``` - -**Tip:** The `Mock::VerifyAndClearExpectations()` function returns a -`bool` to indicate whether the verification was successful (`true` for -yes), so you can wrap that function call inside a `ASSERT_TRUE()` if -there is no point going further when the verification has failed. - -## Using Check Points ## - -Sometimes you may want to "reset" a mock object at various check -points in your test: at each check point, you verify that all existing -expectations on the mock object have been satisfied, and then you set -some new expectations on it as if it's newly created. This allows you -to work with a mock object in "phases" whose sizes are each -manageable. - -One such scenario is that in your test's `SetUp()` function, you may -want to put the object you are testing into a certain state, with the -help from a mock object. Once in the desired state, you want to clear -all expectations on the mock, such that in the `TEST_F` body you can -set fresh expectations on it. - -As you may have figured out, the `Mock::VerifyAndClearExpectations()` -function we saw in the previous recipe can help you here. Or, if you -are using `ON_CALL()` to set default actions on the mock object and -want to clear the default actions as well, use -`Mock::VerifyAndClear(&mock_object)` instead. This function does what -`Mock::VerifyAndClearExpectations(&mock_object)` does and returns the -same `bool`, **plus** it clears the `ON_CALL()` statements on -`mock_object` too. - -Another trick you can use to achieve the same effect is to put the -expectations in sequences and insert calls to a dummy "check-point" -function at specific places. Then you can verify that the mock -function calls do happen at the right time. For example, if you are -exercising code: - -``` -Foo(1); -Foo(2); -Foo(3); -``` - -and want to verify that `Foo(1)` and `Foo(3)` both invoke -`mock.Bar("a")`, but `Foo(2)` doesn't invoke anything. You can write: - -``` -using ::testing::MockFunction; - -TEST(FooTest, InvokesBarCorrectly) { - MyMock mock; - // Class MockFunction has exactly one mock method. It is named - // Call() and has type F. - MockFunction check; - { - InSequence s; - - EXPECT_CALL(mock, Bar("a")); - EXPECT_CALL(check, Call("1")); - EXPECT_CALL(check, Call("2")); - EXPECT_CALL(mock, Bar("a")); - } - Foo(1); - check.Call("1"); - Foo(2); - check.Call("2"); - Foo(3); -} -``` - -The expectation spec says that the first `Bar("a")` must happen before -check point "1", the second `Bar("a")` must happen after check point "2", -and nothing should happen between the two check points. The explicit -check points make it easy to tell which `Bar("a")` is called by which -call to `Foo()`. - -## Mocking Destructors ## - -Sometimes you want to make sure a mock object is destructed at the -right time, e.g. after `bar->A()` is called but before `bar->B()` is -called. We already know that you can specify constraints on the order -of mock function calls, so all we need to do is to mock the destructor -of the mock function. - -This sounds simple, except for one problem: a destructor is a special -function with special syntax and special semantics, and the -`MOCK_METHOD0` macro doesn't work for it: - -``` - MOCK_METHOD0(~MockFoo, void()); // Won't compile! -``` - -The good news is that you can use a simple pattern to achieve the same -effect. First, add a mock function `Die()` to your mock class and call -it in the destructor, like this: - -``` -class MockFoo : public Foo { - ... - // Add the following two lines to the mock class. - MOCK_METHOD0(Die, void()); - virtual ~MockFoo() { Die(); } -}; -``` - -(If the name `Die()` clashes with an existing symbol, choose another -name.) Now, we have translated the problem of testing when a `MockFoo` -object dies to testing when its `Die()` method is called: - -``` - MockFoo* foo = new MockFoo; - MockBar* bar = new MockBar; - ... - { - InSequence s; - - // Expects *foo to die after bar->A() and before bar->B(). - EXPECT_CALL(*bar, A()); - EXPECT_CALL(*foo, Die()); - EXPECT_CALL(*bar, B()); - } -``` - -And that's that. - -## Using Google Mock and Threads ## - -**IMPORTANT NOTE:** What we describe in this recipe is **ONLY** true on -platforms where Google Mock is thread-safe. Currently these are only -platforms that support the pthreads library (this includes Linux and Mac). -To make it thread-safe on other platforms we only need to implement -some synchronization operations in `"gtest/internal/gtest-port.h"`. - -In a **unit** test, it's best if you could isolate and test a piece of -code in a single-threaded context. That avoids race conditions and -dead locks, and makes debugging your test much easier. - -Yet many programs are multi-threaded, and sometimes to test something -we need to pound on it from more than one thread. Google Mock works -for this purpose too. - -Remember the steps for using a mock: - - 1. Create a mock object `foo`. - 1. Set its default actions and expectations using `ON_CALL()` and `EXPECT_CALL()`. - 1. The code under test calls methods of `foo`. - 1. Optionally, verify and reset the mock. - 1. Destroy the mock yourself, or let the code under test destroy it. The destructor will automatically verify it. - -If you follow the following simple rules, your mocks and threads can -live happily together: - - * Execute your _test code_ (as opposed to the code being tested) in _one_ thread. This makes your test easy to follow. - * Obviously, you can do step #1 without locking. - * When doing step #2 and #5, make sure no other thread is accessing `foo`. Obvious too, huh? - * #3 and #4 can be done either in one thread or in multiple threads - anyway you want. Google Mock takes care of the locking, so you don't have to do any - unless required by your test logic. - -If you violate the rules (for example, if you set expectations on a -mock while another thread is calling its methods), you get undefined -behavior. That's not fun, so don't do it. - -Google Mock guarantees that the action for a mock function is done in -the same thread that called the mock function. For example, in - -``` - EXPECT_CALL(mock, Foo(1)) - .WillOnce(action1); - EXPECT_CALL(mock, Foo(2)) - .WillOnce(action2); -``` - -if `Foo(1)` is called in thread 1 and `Foo(2)` is called in thread 2, -Google Mock will execute `action1` in thread 1 and `action2` in thread -2. - -Google Mock does _not_ impose a sequence on actions performed in -different threads (doing so may create deadlocks as the actions may -need to cooperate). This means that the execution of `action1` and -`action2` in the above example _may_ interleave. If this is a problem, -you should add proper synchronization logic to `action1` and `action2` -to make the test thread-safe. - - -Also, remember that `DefaultValue` is a global resource that -potentially affects _all_ living mock objects in your -program. Naturally, you won't want to mess with it from multiple -threads or when there still are mocks in action. - -## Controlling How Much Information Google Mock Prints ## - -When Google Mock sees something that has the potential of being an -error (e.g. a mock function with no expectation is called, a.k.a. an -uninteresting call, which is allowed but perhaps you forgot to -explicitly ban the call), it prints some warning messages, including -the arguments of the function and the return value. Hopefully this -will remind you to take a look and see if there is indeed a problem. - -Sometimes you are confident that your tests are correct and may not -appreciate such friendly messages. Some other times, you are debugging -your tests or learning about the behavior of the code you are testing, -and wish you could observe every mock call that happens (including -argument values and the return value). Clearly, one size doesn't fit -all. - -You can control how much Google Mock tells you using the -`--gmock_verbose=LEVEL` command-line flag, where `LEVEL` is a string -with three possible values: - - * `info`: Google Mock will print all informational messages, warnings, and errors (most verbose). At this setting, Google Mock will also log any calls to the `ON_CALL/EXPECT_CALL` macros. - * `warning`: Google Mock will print both warnings and errors (less verbose). This is the default. - * `error`: Google Mock will print errors only (least verbose). - -Alternatively, you can adjust the value of that flag from within your -tests like so: - -``` - ::testing::FLAGS_gmock_verbose = "error"; -``` - -Now, judiciously use the right flag to enable Google Mock serve you better! - -## Gaining Super Vision into Mock Calls ## - -You have a test using Google Mock. It fails: Google Mock tells you -that some expectations aren't satisfied. However, you aren't sure why: -Is there a typo somewhere in the matchers? Did you mess up the order -of the `EXPECT_CALL`s? Or is the code under test doing something -wrong? How can you find out the cause? - -Won't it be nice if you have X-ray vision and can actually see the -trace of all `EXPECT_CALL`s and mock method calls as they are made? -For each call, would you like to see its actual argument values and -which `EXPECT_CALL` Google Mock thinks it matches? - -You can unlock this power by running your test with the -`--gmock_verbose=info` flag. For example, given the test program: - -``` -using testing::_; -using testing::HasSubstr; -using testing::Return; - -class MockFoo { - public: - MOCK_METHOD2(F, void(const string& x, const string& y)); -}; - -TEST(Foo, Bar) { - MockFoo mock; - EXPECT_CALL(mock, F(_, _)).WillRepeatedly(Return()); - EXPECT_CALL(mock, F("a", "b")); - EXPECT_CALL(mock, F("c", HasSubstr("d"))); - - mock.F("a", "good"); - mock.F("a", "b"); -} -``` - -if you run it with `--gmock_verbose=info`, you will see this output: - -``` -[ RUN ] Foo.Bar - -foo_test.cc:14: EXPECT_CALL(mock, F(_, _)) invoked -foo_test.cc:15: EXPECT_CALL(mock, F("a", "b")) invoked -foo_test.cc:16: EXPECT_CALL(mock, F("c", HasSubstr("d"))) invoked -foo_test.cc:14: Mock function call matches EXPECT_CALL(mock, F(_, _))... - Function call: F(@0x7fff7c8dad40"a", @0x7fff7c8dad10"good") -foo_test.cc:15: Mock function call matches EXPECT_CALL(mock, F("a", "b"))... - Function call: F(@0x7fff7c8dada0"a", @0x7fff7c8dad70"b") -foo_test.cc:16: Failure -Actual function call count doesn't match EXPECT_CALL(mock, F("c", HasSubstr("d")))... - Expected: to be called once - Actual: never called - unsatisfied and active -[ FAILED ] Foo.Bar -``` - -Suppose the bug is that the `"c"` in the third `EXPECT_CALL` is a typo -and should actually be `"a"`. With the above message, you should see -that the actual `F("a", "good")` call is matched by the first -`EXPECT_CALL`, not the third as you thought. From that it should be -obvious that the third `EXPECT_CALL` is written wrong. Case solved. - -## Running Tests in Emacs ## - -If you build and run your tests in Emacs, the source file locations of -Google Mock and [Google Test](../../googletest/) -errors will be highlighted. Just press `` on one of them and -you'll be taken to the offending line. Or, you can just type `C-x `` -to jump to the next error. - -To make it even easier, you can add the following lines to your -`~/.emacs` file: - -``` -(global-set-key "\M-m" 'compile) ; m is for make -(global-set-key [M-down] 'next-error) -(global-set-key [M-up] '(lambda () (interactive) (next-error -1))) -``` - -Then you can type `M-m` to start a build, or `M-up`/`M-down` to move -back and forth between errors. - -## Fusing Google Mock Source Files ## - -Google Mock's implementation consists of dozens of files (excluding -its own tests). Sometimes you may want them to be packaged up in -fewer files instead, such that you can easily copy them to a new -machine and start hacking there. For this we provide an experimental -Python script `fuse_gmock_files.py` in the `scripts/` directory -(starting with release 1.2.0). Assuming you have Python 2.4 or above -installed on your machine, just go to that directory and run -``` -python fuse_gmock_files.py OUTPUT_DIR -``` - -and you should see an `OUTPUT_DIR` directory being created with files -`gtest/gtest.h`, `gmock/gmock.h`, and `gmock-gtest-all.cc` in it. -These three files contain everything you need to use Google Mock (and -Google Test). Just copy them to anywhere you want and you are ready -to write tests and use mocks. You can use the -[scrpts/test/Makefile](../scripts/test/Makefile) file as an example on how to compile your tests -against them. - -# Extending Google Mock # - -## Writing New Matchers Quickly ## - -The `MATCHER*` family of macros can be used to define custom matchers -easily. The syntax: - -``` -MATCHER(name, description_string_expression) { statements; } -``` - -will define a matcher with the given name that executes the -statements, which must return a `bool` to indicate if the match -succeeds. Inside the statements, you can refer to the value being -matched by `arg`, and refer to its type by `arg_type`. - -The description string is a `string`-typed expression that documents -what the matcher does, and is used to generate the failure message -when the match fails. It can (and should) reference the special -`bool` variable `negation`, and should evaluate to the description of -the matcher when `negation` is `false`, or that of the matcher's -negation when `negation` is `true`. - -For convenience, we allow the description string to be empty (`""`), -in which case Google Mock will use the sequence of words in the -matcher name as the description. - -For example: -``` -MATCHER(IsDivisibleBy7, "") { return (arg % 7) == 0; } -``` -allows you to write -``` - // Expects mock_foo.Bar(n) to be called where n is divisible by 7. - EXPECT_CALL(mock_foo, Bar(IsDivisibleBy7())); -``` -or, -``` -using ::testing::Not; -... - EXPECT_THAT(some_expression, IsDivisibleBy7()); - EXPECT_THAT(some_other_expression, Not(IsDivisibleBy7())); -``` -If the above assertions fail, they will print something like: -``` - Value of: some_expression - Expected: is divisible by 7 - Actual: 27 -... - Value of: some_other_expression - Expected: not (is divisible by 7) - Actual: 21 -``` -where the descriptions `"is divisible by 7"` and `"not (is divisible -by 7)"` are automatically calculated from the matcher name -`IsDivisibleBy7`. - -As you may have noticed, the auto-generated descriptions (especially -those for the negation) may not be so great. You can always override -them with a string expression of your own: -``` -MATCHER(IsDivisibleBy7, std::string(negation ? "isn't" : "is") + - " divisible by 7") { - return (arg % 7) == 0; -} -``` - -Optionally, you can stream additional information to a hidden argument -named `result_listener` to explain the match result. For example, a -better definition of `IsDivisibleBy7` is: -``` -MATCHER(IsDivisibleBy7, "") { - if ((arg % 7) == 0) - return true; - - *result_listener << "the remainder is " << (arg % 7); - return false; -} -``` - -With this definition, the above assertion will give a better message: -``` - Value of: some_expression - Expected: is divisible by 7 - Actual: 27 (the remainder is 6) -``` - -You should let `MatchAndExplain()` print _any additional information_ -that can help a user understand the match result. Note that it should -explain why the match succeeds in case of a success (unless it's -obvious) - this is useful when the matcher is used inside -`Not()`. There is no need to print the argument value itself, as -Google Mock already prints it for you. - -**Notes:** - - 1. The type of the value being matched (`arg_type`) is determined by the context in which you use the matcher and is supplied to you by the compiler, so you don't need to worry about declaring it (nor can you). This allows the matcher to be polymorphic. For example, `IsDivisibleBy7()` can be used to match any type where the value of `(arg % 7) == 0` can be implicitly converted to a `bool`. In the `Bar(IsDivisibleBy7())` example above, if method `Bar()` takes an `int`, `arg_type` will be `int`; if it takes an `unsigned long`, `arg_type` will be `unsigned long`; and so on. - 1. Google Mock doesn't guarantee when or how many times a matcher will be invoked. Therefore the matcher logic must be _purely functional_ (i.e. it cannot have any side effect, and the result must not depend on anything other than the value being matched and the matcher parameters). This requirement must be satisfied no matter how you define the matcher (e.g. using one of the methods described in the following recipes). In particular, a matcher can never call a mock function, as that will affect the state of the mock object and Google Mock. - -## Writing New Parameterized Matchers Quickly ## - -Sometimes you'll want to define a matcher that has parameters. For that you -can use the macro: -``` -MATCHER_P(name, param_name, description_string) { statements; } -``` -where the description string can be either `""` or a string expression -that references `negation` and `param_name`. - -For example: -``` -MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } -``` -will allow you to write: -``` - EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); -``` -which may lead to this message (assuming `n` is 10): -``` - Value of: Blah("a") - Expected: has absolute value 10 - Actual: -9 -``` - -Note that both the matcher description and its parameter are -printed, making the message human-friendly. - -In the matcher definition body, you can write `foo_type` to -reference the type of a parameter named `foo`. For example, in the -body of `MATCHER_P(HasAbsoluteValue, value)` above, you can write -`value_type` to refer to the type of `value`. - -Google Mock also provides `MATCHER_P2`, `MATCHER_P3`, ..., up to -`MATCHER_P10` to support multi-parameter matchers: -``` -MATCHER_Pk(name, param_1, ..., param_k, description_string) { statements; } -``` - -Please note that the custom description string is for a particular -**instance** of the matcher, where the parameters have been bound to -actual values. Therefore usually you'll want the parameter values to -be part of the description. Google Mock lets you do that by -referencing the matcher parameters in the description string -expression. - -For example, -``` - using ::testing::PrintToString; - MATCHER_P2(InClosedRange, low, hi, - std::string(negation ? "isn't" : "is") + " in range [" + - PrintToString(low) + ", " + PrintToString(hi) + "]") { - return low <= arg && arg <= hi; - } - ... - EXPECT_THAT(3, InClosedRange(4, 6)); -``` -would generate a failure that contains the message: -``` - Expected: is in range [4, 6] -``` - -If you specify `""` as the description, the failure message will -contain the sequence of words in the matcher name followed by the -parameter values printed as a tuple. For example, -``` - MATCHER_P2(InClosedRange, low, hi, "") { ... } - ... - EXPECT_THAT(3, InClosedRange(4, 6)); -``` -would generate a failure that contains the text: -``` - Expected: in closed range (4, 6) -``` - -For the purpose of typing, you can view -``` -MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } -``` -as shorthand for -``` -template -FooMatcherPk -Foo(p1_type p1, ..., pk_type pk) { ... } -``` - -When you write `Foo(v1, ..., vk)`, the compiler infers the types of -the parameters `v1`, ..., and `vk` for you. If you are not happy with -the result of the type inference, you can specify the types by -explicitly instantiating the template, as in `Foo(5, false)`. -As said earlier, you don't get to (or need to) specify -`arg_type` as that's determined by the context in which the matcher -is used. - -You can assign the result of expression `Foo(p1, ..., pk)` to a -variable of type `FooMatcherPk`. This can be -useful when composing matchers. Matchers that don't have a parameter -or have only one parameter have special types: you can assign `Foo()` -to a `FooMatcher`-typed variable, and assign `Foo(p)` to a -`FooMatcherP`-typed variable. - -While you can instantiate a matcher template with reference types, -passing the parameters by pointer usually makes your code more -readable. If, however, you still want to pass a parameter by -reference, be aware that in the failure message generated by the -matcher you will see the value of the referenced object but not its -address. - -You can overload matchers with different numbers of parameters: -``` -MATCHER_P(Blah, a, description_string_1) { ... } -MATCHER_P2(Blah, a, b, description_string_2) { ... } -``` - -While it's tempting to always use the `MATCHER*` macros when defining -a new matcher, you should also consider implementing -`MatcherInterface` or using `MakePolymorphicMatcher()` instead (see -the recipes that follow), especially if you need to use the matcher a -lot. While these approaches require more work, they give you more -control on the types of the value being matched and the matcher -parameters, which in general leads to better compiler error messages -that pay off in the long run. They also allow overloading matchers -based on parameter types (as opposed to just based on the number of -parameters). - -## Writing New Monomorphic Matchers ## - -A matcher of argument type `T` implements -`::testing::MatcherInterface` and does two things: it tests whether a -value of type `T` matches the matcher, and can describe what kind of -values it matches. The latter ability is used for generating readable -error messages when expectations are violated. - -The interface looks like this: - -``` -class MatchResultListener { - public: - ... - // Streams x to the underlying ostream; does nothing if the ostream - // is NULL. - template - MatchResultListener& operator<<(const T& x); - - // Returns the underlying ostream. - ::std::ostream* stream(); -}; - -template -class MatcherInterface { - public: - virtual ~MatcherInterface(); - - // Returns true iff the matcher matches x; also explains the match - // result to 'listener'. - virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0; - - // Describes this matcher to an ostream. - virtual void DescribeTo(::std::ostream* os) const = 0; - - // Describes the negation of this matcher to an ostream. - virtual void DescribeNegationTo(::std::ostream* os) const; -}; -``` - -If you need a custom matcher but `Truly()` is not a good option (for -example, you may not be happy with the way `Truly(predicate)` -describes itself, or you may want your matcher to be polymorphic as -`Eq(value)` is), you can define a matcher to do whatever you want in -two steps: first implement the matcher interface, and then define a -factory function to create a matcher instance. The second step is not -strictly needed but it makes the syntax of using the matcher nicer. - -For example, you can define a matcher to test whether an `int` is -divisible by 7 and then use it like this: -``` -using ::testing::MakeMatcher; -using ::testing::Matcher; -using ::testing::MatcherInterface; -using ::testing::MatchResultListener; - -class DivisibleBy7Matcher : public MatcherInterface { - public: - virtual bool MatchAndExplain(int n, MatchResultListener* listener) const { - return (n % 7) == 0; - } - - virtual void DescribeTo(::std::ostream* os) const { - *os << "is divisible by 7"; - } - - virtual void DescribeNegationTo(::std::ostream* os) const { - *os << "is not divisible by 7"; - } -}; - -inline Matcher DivisibleBy7() { - return MakeMatcher(new DivisibleBy7Matcher); -} -... - - EXPECT_CALL(foo, Bar(DivisibleBy7())); -``` - -You may improve the matcher message by streaming additional -information to the `listener` argument in `MatchAndExplain()`: - -``` -class DivisibleBy7Matcher : public MatcherInterface { - public: - virtual bool MatchAndExplain(int n, - MatchResultListener* listener) const { - const int remainder = n % 7; - if (remainder != 0) { - *listener << "the remainder is " << remainder; - } - return remainder == 0; - } - ... -}; -``` - -Then, `EXPECT_THAT(x, DivisibleBy7());` may general a message like this: -``` -Value of: x -Expected: is divisible by 7 - Actual: 23 (the remainder is 2) -``` - -## Writing New Polymorphic Matchers ## - -You've learned how to write your own matchers in the previous -recipe. Just one problem: a matcher created using `MakeMatcher()` only -works for one particular type of arguments. If you want a -_polymorphic_ matcher that works with arguments of several types (for -instance, `Eq(x)` can be used to match a `value` as long as `value` == -`x` compiles -- `value` and `x` don't have to share the same type), -you can learn the trick from `"gmock/gmock-matchers.h"` but it's a bit -involved. - -Fortunately, most of the time you can define a polymorphic matcher -easily with the help of `MakePolymorphicMatcher()`. Here's how you can -define `NotNull()` as an example: - -``` -using ::testing::MakePolymorphicMatcher; -using ::testing::MatchResultListener; -using ::testing::NotNull; -using ::testing::PolymorphicMatcher; - -class NotNullMatcher { - public: - // To implement a polymorphic matcher, first define a COPYABLE class - // that has three members MatchAndExplain(), DescribeTo(), and - // DescribeNegationTo(), like the following. - - // In this example, we want to use NotNull() with any pointer, so - // MatchAndExplain() accepts a pointer of any type as its first argument. - // In general, you can define MatchAndExplain() as an ordinary method or - // a method template, or even overload it. - template - bool MatchAndExplain(T* p, - MatchResultListener* /* listener */) const { - return p != NULL; - } - - // Describes the property of a value matching this matcher. - void DescribeTo(::std::ostream* os) const { *os << "is not NULL"; } - - // Describes the property of a value NOT matching this matcher. - void DescribeNegationTo(::std::ostream* os) const { *os << "is NULL"; } -}; - -// To construct a polymorphic matcher, pass an instance of the class -// to MakePolymorphicMatcher(). Note the return type. -inline PolymorphicMatcher NotNull() { - return MakePolymorphicMatcher(NotNullMatcher()); -} -... - - EXPECT_CALL(foo, Bar(NotNull())); // The argument must be a non-NULL pointer. -``` - -**Note:** Your polymorphic matcher class does **not** need to inherit from -`MatcherInterface` or any other class, and its methods do **not** need -to be virtual. - -Like in a monomorphic matcher, you may explain the match result by -streaming additional information to the `listener` argument in -`MatchAndExplain()`. - -## Writing New Cardinalities ## - -A cardinality is used in `Times()` to tell Google Mock how many times -you expect a call to occur. It doesn't have to be exact. For example, -you can say `AtLeast(5)` or `Between(2, 4)`. - -If the built-in set of cardinalities doesn't suit you, you are free to -define your own by implementing the following interface (in namespace -`testing`): - -``` -class CardinalityInterface { - public: - virtual ~CardinalityInterface(); - - // Returns true iff call_count calls will satisfy this cardinality. - virtual bool IsSatisfiedByCallCount(int call_count) const = 0; - - // Returns true iff call_count calls will saturate this cardinality. - virtual bool IsSaturatedByCallCount(int call_count) const = 0; - - // Describes self to an ostream. - virtual void DescribeTo(::std::ostream* os) const = 0; -}; -``` - -For example, to specify that a call must occur even number of times, -you can write - -``` -using ::testing::Cardinality; -using ::testing::CardinalityInterface; -using ::testing::MakeCardinality; - -class EvenNumberCardinality : public CardinalityInterface { - public: - virtual bool IsSatisfiedByCallCount(int call_count) const { - return (call_count % 2) == 0; - } - - virtual bool IsSaturatedByCallCount(int call_count) const { - return false; - } - - virtual void DescribeTo(::std::ostream* os) const { - *os << "called even number of times"; - } -}; - -Cardinality EvenNumber() { - return MakeCardinality(new EvenNumberCardinality); -} -... - - EXPECT_CALL(foo, Bar(3)) - .Times(EvenNumber()); -``` - -## Writing New Actions Quickly ## - -If the built-in actions don't work for you, and you find it -inconvenient to use `Invoke()`, you can use a macro from the `ACTION*` -family to quickly define a new action that can be used in your code as -if it's a built-in action. - -By writing -``` -ACTION(name) { statements; } -``` -in a namespace scope (i.e. not inside a class or function), you will -define an action with the given name that executes the statements. -The value returned by `statements` will be used as the return value of -the action. Inside the statements, you can refer to the K-th -(0-based) argument of the mock function as `argK`. For example: -``` -ACTION(IncrementArg1) { return ++(*arg1); } -``` -allows you to write -``` -... WillOnce(IncrementArg1()); -``` - -Note that you don't need to specify the types of the mock function -arguments. Rest assured that your code is type-safe though: -you'll get a compiler error if `*arg1` doesn't support the `++` -operator, or if the type of `++(*arg1)` isn't compatible with the mock -function's return type. - -Another example: -``` -ACTION(Foo) { - (*arg2)(5); - Blah(); - *arg1 = 0; - return arg0; -} -``` -defines an action `Foo()` that invokes argument #2 (a function pointer) -with 5, calls function `Blah()`, sets the value pointed to by argument -#1 to 0, and returns argument #0. - -For more convenience and flexibility, you can also use the following -pre-defined symbols in the body of `ACTION`: - -| `argK_type` | The type of the K-th (0-based) argument of the mock function | -|:------------|:-------------------------------------------------------------| -| `args` | All arguments of the mock function as a tuple | -| `args_type` | The type of all arguments of the mock function as a tuple | -| `return_type` | The return type of the mock function | -| `function_type` | The type of the mock function | - -For example, when using an `ACTION` as a stub action for mock function: -``` -int DoSomething(bool flag, int* ptr); -``` -we have: - -| **Pre-defined Symbol** | **Is Bound To** | -|:-----------------------|:----------------| -| `arg0` | the value of `flag` | -| `arg0_type` | the type `bool` | -| `arg1` | the value of `ptr` | -| `arg1_type` | the type `int*` | -| `args` | the tuple `(flag, ptr)` | -| `args_type` | the type `::testing::tuple` | -| `return_type` | the type `int` | -| `function_type` | the type `int(bool, int*)` | - -## Writing New Parameterized Actions Quickly ## - -Sometimes you'll want to parameterize an action you define. For that -we have another macro -``` -ACTION_P(name, param) { statements; } -``` - -For example, -``` -ACTION_P(Add, n) { return arg0 + n; } -``` -will allow you to write -``` -// Returns argument #0 + 5. -... WillOnce(Add(5)); -``` - -For convenience, we use the term _arguments_ for the values used to -invoke the mock function, and the term _parameters_ for the values -used to instantiate an action. - -Note that you don't need to provide the type of the parameter either. -Suppose the parameter is named `param`, you can also use the -Google-Mock-defined symbol `param_type` to refer to the type of the -parameter as inferred by the compiler. For example, in the body of -`ACTION_P(Add, n)` above, you can write `n_type` for the type of `n`. - -Google Mock also provides `ACTION_P2`, `ACTION_P3`, and etc to support -multi-parameter actions. For example, -``` -ACTION_P2(ReturnDistanceTo, x, y) { - double dx = arg0 - x; - double dy = arg1 - y; - return sqrt(dx*dx + dy*dy); -} -``` -lets you write -``` -... WillOnce(ReturnDistanceTo(5.0, 26.5)); -``` - -You can view `ACTION` as a degenerated parameterized action where the -number of parameters is 0. - -You can also easily define actions overloaded on the number of parameters: -``` -ACTION_P(Plus, a) { ... } -ACTION_P2(Plus, a, b) { ... } -``` - -## Restricting the Type of an Argument or Parameter in an ACTION ## - -For maximum brevity and reusability, the `ACTION*` macros don't ask -you to provide the types of the mock function arguments and the action -parameters. Instead, we let the compiler infer the types for us. - -Sometimes, however, we may want to be more explicit about the types. -There are several tricks to do that. For example: -``` -ACTION(Foo) { - // Makes sure arg0 can be converted to int. - int n = arg0; - ... use n instead of arg0 here ... -} - -ACTION_P(Bar, param) { - // Makes sure the type of arg1 is const char*. - ::testing::StaticAssertTypeEq(); - - // Makes sure param can be converted to bool. - bool flag = param; -} -``` -where `StaticAssertTypeEq` is a compile-time assertion in Google Test -that verifies two types are the same. - -## Writing New Action Templates Quickly ## - -Sometimes you want to give an action explicit template parameters that -cannot be inferred from its value parameters. `ACTION_TEMPLATE()` -supports that and can be viewed as an extension to `ACTION()` and -`ACTION_P*()`. - -The syntax: -``` -ACTION_TEMPLATE(ActionName, - HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), - AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } -``` - -defines an action template that takes _m_ explicit template parameters -and _n_ value parameters, where _m_ is between 1 and 10, and _n_ is -between 0 and 10. `name_i` is the name of the i-th template -parameter, and `kind_i` specifies whether it's a `typename`, an -integral constant, or a template. `p_i` is the name of the i-th value -parameter. - -Example: -``` -// DuplicateArg(output) converts the k-th argument of the mock -// function to type T and copies it to *output. -ACTION_TEMPLATE(DuplicateArg, - // Note the comma between int and k: - HAS_2_TEMPLATE_PARAMS(int, k, typename, T), - AND_1_VALUE_PARAMS(output)) { - *output = T(::testing::get(args)); -} -``` - -To create an instance of an action template, write: -``` - ActionName(v1, ..., v_n) -``` -where the `t`s are the template arguments and the -`v`s are the value arguments. The value argument -types are inferred by the compiler. For example: -``` -using ::testing::_; -... - int n; - EXPECT_CALL(mock, Foo(_, _)) - .WillOnce(DuplicateArg<1, unsigned char>(&n)); -``` - -If you want to explicitly specify the value argument types, you can -provide additional template arguments: -``` - ActionName(v1, ..., v_n) -``` -where `u_i` is the desired type of `v_i`. - -`ACTION_TEMPLATE` and `ACTION`/`ACTION_P*` can be overloaded on the -number of value parameters, but not on the number of template -parameters. Without the restriction, the meaning of the following is -unclear: - -``` - OverloadedAction(x); -``` - -Are we using a single-template-parameter action where `bool` refers to -the type of `x`, or a two-template-parameter action where the compiler -is asked to infer the type of `x`? - -## Using the ACTION Object's Type ## - -If you are writing a function that returns an `ACTION` object, you'll -need to know its type. The type depends on the macro used to define -the action and the parameter types. The rule is relatively simple: - -| **Given Definition** | **Expression** | **Has Type** | -|:---------------------|:---------------|:-------------| -| `ACTION(Foo)` | `Foo()` | `FooAction` | -| `ACTION_TEMPLATE(Foo, HAS_m_TEMPLATE_PARAMS(...), AND_0_VALUE_PARAMS())` | `Foo()` | `FooAction` | -| `ACTION_P(Bar, param)` | `Bar(int_value)` | `BarActionP` | -| `ACTION_TEMPLATE(Bar, HAS_m_TEMPLATE_PARAMS(...), AND_1_VALUE_PARAMS(p1))` | `Bar(int_value)` | `FooActionP` | -| `ACTION_P2(Baz, p1, p2)` | `Baz(bool_value, int_value)` | `BazActionP2` | -| `ACTION_TEMPLATE(Baz, HAS_m_TEMPLATE_PARAMS(...), AND_2_VALUE_PARAMS(p1, p2))`| `Baz(bool_value, int_value)` | `FooActionP2` | -| ... | ... | ... | - -Note that we have to pick different suffixes (`Action`, `ActionP`, -`ActionP2`, and etc) for actions with different numbers of value -parameters, or the action definitions cannot be overloaded on the -number of them. - -## Writing New Monomorphic Actions ## - -While the `ACTION*` macros are very convenient, sometimes they are -inappropriate. For example, despite the tricks shown in the previous -recipes, they don't let you directly specify the types of the mock -function arguments and the action parameters, which in general leads -to unoptimized compiler error messages that can baffle unfamiliar -users. They also don't allow overloading actions based on parameter -types without jumping through some hoops. - -An alternative to the `ACTION*` macros is to implement -`::testing::ActionInterface`, where `F` is the type of the mock -function in which the action will be used. For example: - -``` -template class ActionInterface { - public: - virtual ~ActionInterface(); - - // Performs the action. Result is the return type of function type - // F, and ArgumentTuple is the tuple of arguments of F. - // - // For example, if F is int(bool, const string&), then Result would - // be int, and ArgumentTuple would be ::testing::tuple. - virtual Result Perform(const ArgumentTuple& args) = 0; -}; - -using ::testing::_; -using ::testing::Action; -using ::testing::ActionInterface; -using ::testing::MakeAction; - -typedef int IncrementMethod(int*); - -class IncrementArgumentAction : public ActionInterface { - public: - virtual int Perform(const ::testing::tuple& args) { - int* p = ::testing::get<0>(args); // Grabs the first argument. - return *p++; - } -}; - -Action IncrementArgument() { - return MakeAction(new IncrementArgumentAction); -} -... - - EXPECT_CALL(foo, Baz(_)) - .WillOnce(IncrementArgument()); - - int n = 5; - foo.Baz(&n); // Should return 5 and change n to 6. -``` - -## Writing New Polymorphic Actions ## - -The previous recipe showed you how to define your own action. This is -all good, except that you need to know the type of the function in -which the action will be used. Sometimes that can be a problem. For -example, if you want to use the action in functions with _different_ -types (e.g. like `Return()` and `SetArgPointee()`). - -If an action can be used in several types of mock functions, we say -it's _polymorphic_. The `MakePolymorphicAction()` function template -makes it easy to define such an action: - -``` -namespace testing { - -template -PolymorphicAction MakePolymorphicAction(const Impl& impl); - -} // namespace testing -``` - -As an example, let's define an action that returns the second argument -in the mock function's argument list. The first step is to define an -implementation class: - -``` -class ReturnSecondArgumentAction { - public: - template - Result Perform(const ArgumentTuple& args) const { - // To get the i-th (0-based) argument, use ::testing::get(args). - return ::testing::get<1>(args); - } -}; -``` - -This implementation class does _not_ need to inherit from any -particular class. What matters is that it must have a `Perform()` -method template. This method template takes the mock function's -arguments as a tuple in a **single** argument, and returns the result of -the action. It can be either `const` or not, but must be invokable -with exactly one template argument, which is the result type. In other -words, you must be able to call `Perform(args)` where `R` is the -mock function's return type and `args` is its arguments in a tuple. - -Next, we use `MakePolymorphicAction()` to turn an instance of the -implementation class into the polymorphic action we need. It will be -convenient to have a wrapper for this: - -``` -using ::testing::MakePolymorphicAction; -using ::testing::PolymorphicAction; - -PolymorphicAction ReturnSecondArgument() { - return MakePolymorphicAction(ReturnSecondArgumentAction()); -} -``` - -Now, you can use this polymorphic action the same way you use the -built-in ones: - -``` -using ::testing::_; - -class MockFoo : public Foo { - public: - MOCK_METHOD2(DoThis, int(bool flag, int n)); - MOCK_METHOD3(DoThat, string(int x, const char* str1, const char* str2)); -}; -... - - MockFoo foo; - EXPECT_CALL(foo, DoThis(_, _)) - .WillOnce(ReturnSecondArgument()); - EXPECT_CALL(foo, DoThat(_, _, _)) - .WillOnce(ReturnSecondArgument()); - ... - foo.DoThis(true, 5); // Will return 5. - foo.DoThat(1, "Hi", "Bye"); // Will return "Hi". -``` - -## Teaching Google Mock How to Print Your Values ## - -When an uninteresting or unexpected call occurs, Google Mock prints the -argument values and the stack trace to help you debug. Assertion -macros like `EXPECT_THAT` and `EXPECT_EQ` also print the values in -question when the assertion fails. Google Mock and Google Test do this using -Google Test's user-extensible value printer. - -This printer knows how to print built-in C++ types, native arrays, STL -containers, and any type that supports the `<<` operator. For other -types, it prints the raw bytes in the value and hopes that you the -user can figure it out. -[Google Test's advanced guide](../../googletest/docs/AdvancedGuide.md#teaching-google-test-how-to-print-your-values) -explains how to extend the printer to do a better job at -printing your particular type than to dump the bytes. diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/DesignDoc.md b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/DesignDoc.md deleted file mode 100644 index 3f515c3b6dd..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/DesignDoc.md +++ /dev/null @@ -1,280 +0,0 @@ -This page discusses the design of new Google Mock features. - - - -# Macros for Defining Actions # - -## Problem ## - -Due to the lack of closures in C++, it currently requires some -non-trivial effort to define a custom action in Google Mock. For -example, suppose you want to "increment the value pointed to by the -second argument of the mock function and return it", you could write: - -``` -int IncrementArg1(Unused, int* p, Unused) { - return ++(*p); -} - -... WillOnce(Invoke(IncrementArg1)); -``` - -There are several things unsatisfactory about this approach: - - * Even though the action only cares about the second argument of the mock function, its definition needs to list other arguments as dummies. This is tedious. - * The defined action is usable only in mock functions that takes exactly 3 arguments - an unnecessary restriction. - * To use the action, one has to say `Invoke(IncrementArg1)`, which isn't as nice as `IncrementArg1()`. - -The latter two problems can be overcome using `MakePolymorphicAction()`, -but it requires much more boilerplate code: - -``` -class IncrementArg1Action { - public: - template - Result Perform(const ArgumentTuple& args) const { - return ++(*tr1::get<1>(args)); - } -}; - -PolymorphicAction IncrementArg1() { - return MakePolymorphicAction(IncrementArg1Action()); -} - -... WillOnce(IncrementArg1()); -``` - -Our goal is to allow defining custom actions with the least amount of -boiler-plate C++ requires. - -## Solution ## - -We propose to introduce a new macro: -``` -ACTION(name) { statements; } -``` - -Using this in a namespace scope will define an action with the given -name that executes the statements. Inside the statements, you can -refer to the K-th (0-based) argument of the mock function as `argK`. -For example: -``` -ACTION(IncrementArg1) { return ++(*arg1); } -``` -allows you to write -``` -... WillOnce(IncrementArg1()); -``` - -Note that you don't need to specify the types of the mock function -arguments, as brevity is a top design goal here. Rest assured that -your code is still type-safe though: you'll get a compiler error if -`*arg1` doesn't support the `++` operator, or if the type of -`++(*arg1)` isn't compatible with the mock function's return type. - -Another example: -``` -ACTION(Foo) { - (*arg2)(5); - Blah(); - *arg1 = 0; - return arg0; -} -``` -defines an action `Foo()` that invokes argument #2 (a function pointer) -with 5, calls function `Blah()`, sets the value pointed to by argument -#1 to 0, and returns argument #0. - -For more convenience and flexibility, you can also use the following -pre-defined symbols in the body of `ACTION`: - -| `argK_type` | The type of the K-th (0-based) argument of the mock function | -|:------------|:-------------------------------------------------------------| -| `args` | All arguments of the mock function as a tuple | -| `args_type` | The type of all arguments of the mock function as a tuple | -| `return_type` | The return type of the mock function | -| `function_type` | The type of the mock function | - -For example, when using an `ACTION` as a stub action for mock function: -``` -int DoSomething(bool flag, int* ptr); -``` -we have: -| **Pre-defined Symbol** | **Is Bound To** | -|:-----------------------|:----------------| -| `arg0` | the value of `flag` | -| `arg0_type` | the type `bool` | -| `arg1` | the value of `ptr` | -| `arg1_type` | the type `int*` | -| `args` | the tuple `(flag, ptr)` | -| `args_type` | the type `std::tr1::tuple` | -| `return_type` | the type `int` | -| `function_type` | the type `int(bool, int*)` | - -## Parameterized actions ## - -Sometimes you'll want to parameterize the action. For that we propose -another macro -``` -ACTION_P(name, param) { statements; } -``` - -For example, -``` -ACTION_P(Add, n) { return arg0 + n; } -``` -will allow you to write -``` -// Returns argument #0 + 5. -... WillOnce(Add(5)); -``` - -For convenience, we use the term _arguments_ for the values used to -invoke the mock function, and the term _parameters_ for the values -used to instantiate an action. - -Note that you don't need to provide the type of the parameter either. -Suppose the parameter is named `param`, you can also use the -Google-Mock-defined symbol `param_type` to refer to the type of the -parameter as inferred by the compiler. - -We will also provide `ACTION_P2`, `ACTION_P3`, and etc to support -multi-parameter actions. For example, -``` -ACTION_P2(ReturnDistanceTo, x, y) { - double dx = arg0 - x; - double dy = arg1 - y; - return sqrt(dx*dx + dy*dy); -} -``` -lets you write -``` -... WillOnce(ReturnDistanceTo(5.0, 26.5)); -``` - -You can view `ACTION` as a degenerated parameterized action where the -number of parameters is 0. - -## Advanced Usages ## - -### Overloading Actions ### - -You can easily define actions overloaded on the number of parameters: -``` -ACTION_P(Plus, a) { ... } -ACTION_P2(Plus, a, b) { ... } -``` - -### Restricting the Type of an Argument or Parameter ### - -For maximum brevity and reusability, the `ACTION*` macros don't let -you specify the types of the mock function arguments and the action -parameters. Instead, we let the compiler infer the types for us. - -Sometimes, however, we may want to be more explicit about the types. -There are several tricks to do that. For example: -``` -ACTION(Foo) { - // Makes sure arg0 can be converted to int. - int n = arg0; - ... use n instead of arg0 here ... -} - -ACTION_P(Bar, param) { - // Makes sure the type of arg1 is const char*. - ::testing::StaticAssertTypeEq(); - - // Makes sure param can be converted to bool. - bool flag = param; -} -``` -where `StaticAssertTypeEq` is a compile-time assertion we plan to add to -Google Test (the name is chosen to match `static_assert` in C++0x). - -### Using the ACTION Object's Type ### - -If you are writing a function that returns an `ACTION` object, you'll -need to know its type. The type depends on the macro used to define -the action and the parameter types. The rule is relatively simple: -| **Given Definition** | **Expression** | **Has Type** | -|:---------------------|:---------------|:-------------| -| `ACTION(Foo)` | `Foo()` | `FooAction` | -| `ACTION_P(Bar, param)` | `Bar(int_value)` | `BarActionP` | -| `ACTION_P2(Baz, p1, p2)` | `Baz(bool_value, int_value)` | `BazActionP2` | -| ... | ... | ... | - -Note that we have to pick different suffixes (`Action`, `ActionP`, -`ActionP2`, and etc) for actions with different numbers of parameters, -or the action definitions cannot be overloaded on the number of -parameters. - -## When to Use ## - -While the new macros are very convenient, please also consider other -means of implementing actions (e.g. via `ActionInterface` or -`MakePolymorphicAction()`), especially if you need to use the defined -action a lot. While the other approaches require more work, they give -you more control on the types of the mock function arguments and the -action parameters, which in general leads to better compiler error -messages that pay off in the long run. They also allow overloading -actions based on parameter types, as opposed to just the number of -parameters. - -## Related Work ## - -As you may have realized, the `ACTION*` macros resemble closures (also -known as lambda expressions or anonymous functions). Indeed, both of -them seek to lower the syntactic overhead for defining a function. - -C++0x will support lambdas, but they are not part of C++ right now. -Some non-standard libraries (most notably BLL or Boost Lambda Library) -try to alleviate this problem. However, they are not a good choice -for defining actions as: - - * They are non-standard and not widely installed. Google Mock only depends on standard libraries and `tr1::tuple`, which is part of the new C++ standard and comes with gcc 4+. We want to keep it that way. - * They are not trivial to learn. - * They will become obsolete when C++0x's lambda feature is widely supported. We don't want to make our users use a dying library. - * Since they are based on operators, they are rather ad hoc: you cannot use statements, and you cannot pass the lambda arguments to a function, for example. - * They have subtle semantics that easily confuses new users. For example, in expression `_1++ + foo++`, `foo` will be incremented only once where the expression is evaluated, while `_1` will be incremented every time the unnamed function is invoked. This is far from intuitive. - -`ACTION*` avoid all these problems. - -## Future Improvements ## - -There may be a need for composing `ACTION*` definitions (i.e. invoking -another `ACTION` inside the definition of one `ACTION*`). We are not -sure we want it yet, as one can get a similar effect by putting -`ACTION` definitions in function templates and composing the function -templates. We'll revisit this based on user feedback. - -The reason we don't allow `ACTION*()` inside a function body is that -the current C++ standard doesn't allow function-local types to be used -to instantiate templates. The upcoming C++0x standard will lift this -restriction. Once this feature is widely supported by compilers, we -can revisit the implementation and add support for using `ACTION*()` -inside a function. - -C++0x will also support lambda expressions. When they become -available, we may want to support using lambdas as actions. - -# Macros for Defining Matchers # - -Once the macros for defining actions are implemented, we plan to do -the same for matchers: - -``` -MATCHER(name) { statements; } -``` - -where you can refer to the value being matched as `arg`. For example, -given: - -``` -MATCHER(IsPositive) { return arg > 0; } -``` - -you can use `IsPositive()` as a matcher that matches a value iff it is -greater than 0. - -We will also add `MATCHER_P`, `MATCHER_P2`, and etc for parameterized -matchers. \ No newline at end of file diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/DevGuide.md b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/DevGuide.md deleted file mode 100644 index adb74fe1dda..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/DevGuide.md +++ /dev/null @@ -1,132 +0,0 @@ - - -If you are interested in understanding the internals of Google Mock, -building from source, or contributing ideas or modifications to the -project, then this document is for you. - -# Introduction # - -First, let's give you some background of the project. - -## Licensing ## - -All Google Mock source and pre-built packages are provided under the [New BSD License](http://www.opensource.org/licenses/bsd-license.php). - -## The Google Mock Community ## - -The Google Mock community exists primarily through the [discussion group](http://groups.google.com/group/googlemock), the -[issue tracker](https://github.com/google/googletest/issues) and, to a lesser extent, the [source control repository](../). You are definitely encouraged to contribute to the -discussion and you can also help us to keep the effectiveness of the -group high by following and promoting the guidelines listed here. - -### Please Be Friendly ### - -Showing courtesy and respect to others is a vital part of the Google -culture, and we strongly encourage everyone participating in Google -Mock development to join us in accepting nothing less. Of course, -being courteous is not the same as failing to constructively disagree -with each other, but it does mean that we should be respectful of each -other when enumerating the 42 technical reasons that a particular -proposal may not be the best choice. There's never a reason to be -antagonistic or dismissive toward anyone who is sincerely trying to -contribute to a discussion. - -Sure, C++ testing is serious business and all that, but it's also -a lot of fun. Let's keep it that way. Let's strive to be one of the -friendliest communities in all of open source. - -### Where to Discuss Google Mock ### - -As always, discuss Google Mock in the official [Google C++ Mocking Framework discussion group](http://groups.google.com/group/googlemock). You don't have to actually submit -code in order to sign up. Your participation itself is a valuable -contribution. - -# Working with the Code # - -If you want to get your hands dirty with the code inside Google Mock, -this is the section for you. - -## Checking Out the Source from Subversion ## - -Checking out the Google Mock source is most useful if you plan to -tweak it yourself. You check out the source for Google Mock using a -[Subversion](http://subversion.tigris.org/) client as you would for any -other project hosted on Google Code. Please see the instruction on -the [source code access page](../) for how to do it. - -## Compiling from Source ## - -Once you check out the code, you can find instructions on how to -compile it in the [README](../README.md) file. - -## Testing ## - -A mocking framework is of no good if itself is not thoroughly tested. -Tests should be written for any new code, and changes should be -verified to not break existing tests before they are submitted for -review. To perform the tests, follow the instructions in [README](http://code.google.com/p/googlemock/source/browse/trunk/README) and -verify that there are no failures. - -# Contributing Code # - -We are excited that Google Mock is now open source, and hope to get -great patches from the community. Before you fire up your favorite IDE -and begin hammering away at that new feature, though, please take the -time to read this section and understand the process. While it seems -rigorous, we want to keep a high standard of quality in the code -base. - -## Contributor License Agreements ## - -You must sign a Contributor License Agreement (CLA) before we can -accept any code. The CLA protects you and us. - - * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). - * If you work for a company that wants to allow you to contribute your work to Google Mock, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). - -Follow either of the two links above to access the appropriate CLA and -instructions for how to sign and return it. - -## Coding Style ## - -To keep the source consistent, readable, diffable and easy to merge, -we use a fairly rigid coding style, as defined by the [google-styleguide](https://github.com/google/styleguide) project. All patches will be expected -to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html). - -## Submitting Patches ## - -Please do submit code. Here's what you need to do: - - 1. Normally you should make your change against the SVN trunk instead of a branch or a tag, as the latter two are for release control and should be treated mostly as read-only. - 1. Decide which code you want to submit. A submission should be a set of changes that addresses one issue in the [Google Mock issue tracker](http://code.google.com/p/googlemock/issues/list). Please don't mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn't have a corresponding issue in the issue tracker, please create one. - 1. Also, coordinate with team members that are listed on the issue in question. This ensures that work isn't being duplicated and communicating your plan early also generally leads to better patches. - 1. Ensure that your code adheres to the [Google Mock source code style](#Coding_Style.md). - 1. Ensure that there are unit tests for your code. - 1. Sign a Contributor License Agreement. - 1. Create a patch file using `svn diff`. - 1. We use [Rietveld](http://codereview.appspot.com/) to do web-based code reviews. You can read about the tool [here](https://github.com/rietveld-codereview/rietveld/wiki). When you are ready, upload your patch via Rietveld and notify `googlemock@googlegroups.com` to review it. There are several ways to upload the patch. We recommend using the [upload\_gmock.py](../scripts/upload_gmock.py) script, which you can find in the `scripts/` folder in the SVN trunk. - -## Google Mock Committers ## - -The current members of the Google Mock engineering team are the only -committers at present. In the great tradition of eating one's own -dogfood, we will be requiring each new Google Mock engineering team -member to earn the right to become a committer by following the -procedures in this document, writing consistently great code, and -demonstrating repeatedly that he or she truly gets the zen of Google -Mock. - -# Release Process # - -We follow the typical release process for Subversion-based projects: - - 1. A release branch named `release-X.Y` is created. - 1. Bugs are fixed and features are added in trunk; those individual patches are merged into the release branch until it's stable. - 1. An individual point release (the `Z` in `X.Y.Z`) is made by creating a tag from the branch. - 1. Repeat steps 2 and 3 throughout one release cycle (as determined by features or time). - 1. Go back to step 1 to create another release branch and so on. - - ---- - -This page is based on the [Making GWT Better](http://code.google.com/webtoolkit/makinggwtbetter.html) guide from the [Google Web Toolkit](http://code.google.com/webtoolkit/) project. Except as otherwise [noted](http://code.google.com/policies.html#restrictions), the content of this page is licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/). diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/Documentation.md b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/Documentation.md deleted file mode 100644 index a0311871d64..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/Documentation.md +++ /dev/null @@ -1,15 +0,0 @@ -This page lists all documentation markdown files for Google Mock **(the -current git version)** --- **if you use a former version of Google Mock, please read the -documentation for that specific version instead (e.g. by checking out -the respective git branch/tag).** - - * [ForDummies](ForDummies.md) -- start here if you are new to Google Mock. - * [CheatSheet](CheatSheet.md) -- a quick reference. - * [CookBook](CookBook.md) -- recipes for doing various tasks using Google Mock. - * [FrequentlyAskedQuestions](FrequentlyAskedQuestions.md) -- check here before asking a question on the mailing list. - -To contribute code to Google Mock, read: - - * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. - * [Pump Manual](../../googletest/docs/PumpManual.md) -- how we generate some of Google Mock's source files. diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/ForDummies.md b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/ForDummies.md deleted file mode 100644 index 0bf528e949f..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/ForDummies.md +++ /dev/null @@ -1,439 +0,0 @@ - - -(**Note:** If you get compiler errors that you don't understand, be sure to consult [Google Mock Doctor](FrequentlyAskedQuestions.md#how-am-i-supposed-to-make-sense-of-these-horrible-template-errors).) - -# What Is Google C++ Mocking Framework? # -When you write a prototype or test, often it's not feasible or wise to rely on real objects entirely. A **mock object** implements the same interface as a real object (so it can be used as one), but lets you specify at run time how it will be used and what it should do (which methods will be called? in which order? how many times? with what arguments? what will they return? etc). - -**Note:** It is easy to confuse the term _fake objects_ with mock objects. Fakes and mocks actually mean very different things in the Test-Driven Development (TDD) community: - - * **Fake** objects have working implementations, but usually take some shortcut (perhaps to make the operations less expensive), which makes them not suitable for production. An in-memory file system would be an example of a fake. - * **Mocks** are objects pre-programmed with _expectations_, which form a specification of the calls they are expected to receive. - -If all this seems too abstract for you, don't worry - the most important thing to remember is that a mock allows you to check the _interaction_ between itself and code that uses it. The difference between fakes and mocks will become much clearer once you start to use mocks. - -**Google C++ Mocking Framework** (or **Google Mock** for short) is a library (sometimes we also call it a "framework" to make it sound cool) for creating mock classes and using them. It does to C++ what [jMock](http://www.jmock.org/) and [EasyMock](http://www.easymock.org/) do to Java. - -Using Google Mock involves three basic steps: - - 1. Use some simple macros to describe the interface you want to mock, and they will expand to the implementation of your mock class; - 1. Create some mock objects and specify its expectations and behavior using an intuitive syntax; - 1. Exercise code that uses the mock objects. Google Mock will catch any violation of the expectations as soon as it arises. - -# Why Google Mock? # -While mock objects help you remove unnecessary dependencies in tests and make them fast and reliable, using mocks manually in C++ is _hard_: - - * Someone has to implement the mocks. The job is usually tedious and error-prone. No wonder people go great distances to avoid it. - * The quality of those manually written mocks is a bit, uh, unpredictable. You may see some really polished ones, but you may also see some that were hacked up in a hurry and have all sorts of ad-hoc restrictions. - * The knowledge you gained from using one mock doesn't transfer to the next. - -In contrast, Java and Python programmers have some fine mock frameworks, which automate the creation of mocks. As a result, mocking is a proven effective technique and widely adopted practice in those communities. Having the right tool absolutely makes the difference. - -Google Mock was built to help C++ programmers. It was inspired by [jMock](http://www.jmock.org/) and [EasyMock](http://www.easymock.org/), but designed with C++'s specifics in mind. It is your friend if any of the following problems is bothering you: - - * You are stuck with a sub-optimal design and wish you had done more prototyping before it was too late, but prototyping in C++ is by no means "rapid". - * Your tests are slow as they depend on too many libraries or use expensive resources (e.g. a database). - * Your tests are brittle as some resources they use are unreliable (e.g. the network). - * You want to test how your code handles a failure (e.g. a file checksum error), but it's not easy to cause one. - * You need to make sure that your module interacts with other modules in the right way, but it's hard to observe the interaction; therefore you resort to observing the side effects at the end of the action, which is awkward at best. - * You want to "mock out" your dependencies, except that they don't have mock implementations yet; and, frankly, you aren't thrilled by some of those hand-written mocks. - -We encourage you to use Google Mock as: - - * a _design_ tool, for it lets you experiment with your interface design early and often. More iterations lead to better designs! - * a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators. - -# Getting Started # -Using Google Mock is easy! Inside your C++ source file, just `#include` `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go. - -# A Case for Mock Turtles # -Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface: - -``` -class Turtle { - ... - virtual ~Turtle() {} - virtual void PenUp() = 0; - virtual void PenDown() = 0; - virtual void Forward(int distance) = 0; - virtual void Turn(int degrees) = 0; - virtual void GoTo(int x, int y) = 0; - virtual int GetX() const = 0; - virtual int GetY() const = 0; -}; -``` - -(Note that the destructor of `Turtle` **must** be virtual, as is the case for **all** classes you intend to inherit from - otherwise the destructor of the derived class will not be called when you delete an object through a base pointer, and you'll get corrupted program states like memory leaks.) - -You can control whether the turtle's movement will leave a trace using `PenUp()` and `PenDown()`, and control its movement using `Forward()`, `Turn()`, and `GoTo()`. Finally, `GetX()` and `GetY()` tell you the current position of the turtle. - -Your program will normally use a real implementation of this interface. In tests, you can use a mock implementation instead. This allows you to easily check what drawing primitives your program is calling, with what arguments, and in which order. Tests written this way are much more robust (they won't break because your new machine does anti-aliasing differently), easier to read and maintain (the intent of a test is expressed in the code, not in some binary images), and run _much, much faster_. - -# Writing the Mock Class # -If you are lucky, the mocks you need to use have already been implemented by some nice people. If, however, you find yourself in the position to write a mock class, relax - Google Mock turns this task into a fun game! (Well, almost.) - -## How to Define It ## -Using the `Turtle` interface as example, here are the simple steps you need to follow: - - 1. Derive a class `MockTurtle` from `Turtle`. - 1. Take a _virtual_ function of `Turtle` (while it's possible to [mock non-virtual methods using templates](CookBook.md#mocking-nonvirtual-methods), it's much more involved). Count how many arguments it has. - 1. In the `public:` section of the child class, write `MOCK_METHODn();` (or `MOCK_CONST_METHODn();` if you are mocking a `const` method), where `n` is the number of the arguments; if you counted wrong, shame on you, and a compiler error will tell you so. - 1. Now comes the fun part: you take the function signature, cut-and-paste the _function name_ as the _first_ argument to the macro, and leave what's left as the _second_ argument (in case you're curious, this is the _type of the function_). - 1. Repeat until all virtual functions you want to mock are done. - -After the process, you should have something like: - -``` -#include "gmock/gmock.h" // Brings in Google Mock. -class MockTurtle : public Turtle { - public: - ... - MOCK_METHOD0(PenUp, void()); - MOCK_METHOD0(PenDown, void()); - MOCK_METHOD1(Forward, void(int distance)); - MOCK_METHOD1(Turn, void(int degrees)); - MOCK_METHOD2(GoTo, void(int x, int y)); - MOCK_CONST_METHOD0(GetX, int()); - MOCK_CONST_METHOD0(GetY, int()); -}; -``` - -You don't need to define these mock methods somewhere else - the `MOCK_METHOD*` macros will generate the definitions for you. It's that simple! Once you get the hang of it, you can pump out mock classes faster than your source-control system can handle your check-ins. - -**Tip:** If even this is too much work for you, you'll find the -`gmock_gen.py` tool in Google Mock's `scripts/generator/` directory (courtesy of the [cppclean](http://code.google.com/p/cppclean/) project) useful. This command-line -tool requires that you have Python 2.4 installed. You give it a C++ file and the name of an abstract class defined in it, -and it will print the definition of the mock class for you. Due to the -complexity of the C++ language, this script may not always work, but -it can be quite handy when it does. For more details, read the [user documentation](../scripts/generator/README). - -## Where to Put It ## -When you define a mock class, you need to decide where to put its definition. Some people put it in a `*_test.cc`. This is fine when the interface being mocked (say, `Foo`) is owned by the same person or team. Otherwise, when the owner of `Foo` changes it, your test could break. (You can't really expect `Foo`'s maintainer to fix every test that uses `Foo`, can you?) - -So, the rule of thumb is: if you need to mock `Foo` and it's owned by others, define the mock class in `Foo`'s package (better, in a `testing` sub-package such that you can clearly separate production code and testing utilities), and put it in a `mock_foo.h`. Then everyone can reference `mock_foo.h` from their tests. If `Foo` ever changes, there is only one copy of `MockFoo` to change, and only tests that depend on the changed methods need to be fixed. - -Another way to do it: you can introduce a thin layer `FooAdaptor` on top of `Foo` and code to this new interface. Since you own `FooAdaptor`, you can absorb changes in `Foo` much more easily. While this is more work initially, carefully choosing the adaptor interface can make your code easier to write and more readable (a net win in the long run), as you can choose `FooAdaptor` to fit your specific domain much better than `Foo` does. - -# Using Mocks in Tests # -Once you have a mock class, using it is easy. The typical work flow is: - - 1. Import the Google Mock names from the `testing` namespace such that you can use them unqualified (You only have to do it once per file. Remember that namespaces are a good idea and good for your health.). - 1. Create some mock objects. - 1. Specify your expectations on them (How many times will a method be called? With what arguments? What should it do? etc.). - 1. Exercise some code that uses the mocks; optionally, check the result using Google Test assertions. If a mock method is called more than expected or with wrong arguments, you'll get an error immediately. - 1. When a mock is destructed, Google Mock will automatically check whether all expectations on it have been satisfied. - -Here's an example: - -``` -#include "path/to/mock-turtle.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" -using ::testing::AtLeast; // #1 - -TEST(PainterTest, CanDrawSomething) { - MockTurtle turtle; // #2 - EXPECT_CALL(turtle, PenDown()) // #3 - .Times(AtLeast(1)); - - Painter painter(&turtle); // #4 - - EXPECT_TRUE(painter.DrawCircle(0, 0, 10)); -} // #5 - -int main(int argc, char** argv) { - // The following line must be executed to initialize Google Mock - // (and Google Test) before running the tests. - ::testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); -} -``` - -As you might have guessed, this test checks that `PenDown()` is called at least once. If the `painter` object didn't call this method, your test will fail with a message like this: - -``` -path/to/my_test.cc:119: Failure -Actual function call count doesn't match this expectation: -Actually: never called; -Expected: called at least once. -``` - -**Tip 1:** If you run the test from an Emacs buffer, you can hit `` on the line number displayed in the error message to jump right to the failed expectation. - -**Tip 2:** If your mock objects are never deleted, the final verification won't happen. Therefore it's a good idea to use a heap leak checker in your tests when you allocate mocks on the heap. - -**Important note:** Google Mock requires expectations to be set **before** the mock functions are called, otherwise the behavior is **undefined**. In particular, you mustn't interleave `EXPECT_CALL()`s and calls to the mock functions. - -This means `EXPECT_CALL()` should be read as expecting that a call will occur _in the future_, not that a call has occurred. Why does Google Mock work like that? Well, specifying the expectation beforehand allows Google Mock to report a violation as soon as it arises, when the context (stack trace, etc) is still available. This makes debugging much easier. - -Admittedly, this test is contrived and doesn't do much. You can easily achieve the same effect without using Google Mock. However, as we shall reveal soon, Google Mock allows you to do _much more_ with the mocks. - -## Using Google Mock with Any Testing Framework ## -If you want to use something other than Google Test (e.g. [CppUnit](http://sourceforge.net/projects/cppunit/) or -[CxxTest](http://cxxtest.tigris.org/)) as your testing framework, just change the `main()` function in the previous section to: -``` -int main(int argc, char** argv) { - // The following line causes Google Mock to throw an exception on failure, - // which will be interpreted by your testing framework as a test failure. - ::testing::GTEST_FLAG(throw_on_failure) = true; - ::testing::InitGoogleMock(&argc, argv); - ... whatever your testing framework requires ... -} -``` - -This approach has a catch: it makes Google Mock throw an exception -from a mock object's destructor sometimes. With some compilers, this -sometimes causes the test program to crash. You'll still be able to -notice that the test has failed, but it's not a graceful failure. - -A better solution is to use Google Test's -[event listener API](../../googletest/docs/AdvancedGuide.md#extending-google-test-by-handling-test-events) -to report a test failure to your testing framework properly. You'll need to -implement the `OnTestPartResult()` method of the event listener interface, but it -should be straightforward. - -If this turns out to be too much work, we suggest that you stick with -Google Test, which works with Google Mock seamlessly (in fact, it is -technically part of Google Mock.). If there is a reason that you -cannot use Google Test, please let us know. - -# Setting Expectations # -The key to using a mock object successfully is to set the _right expectations_ on it. If you set the expectations too strict, your test will fail as the result of unrelated changes. If you set them too loose, bugs can slip through. You want to do it just right such that your test can catch exactly the kind of bugs you intend it to catch. Google Mock provides the necessary means for you to do it "just right." - -## General Syntax ## -In Google Mock we use the `EXPECT_CALL()` macro to set an expectation on a mock method. The general syntax is: - -``` -EXPECT_CALL(mock_object, method(matchers)) - .Times(cardinality) - .WillOnce(action) - .WillRepeatedly(action); -``` - -The macro has two arguments: first the mock object, and then the method and its arguments. Note that the two are separated by a comma (`,`), not a period (`.`). (Why using a comma? The answer is that it was necessary for technical reasons.) - -The macro can be followed by some optional _clauses_ that provide more information about the expectation. We'll discuss how each clause works in the coming sections. - -This syntax is designed to make an expectation read like English. For example, you can probably guess that - -``` -using ::testing::Return;... -EXPECT_CALL(turtle, GetX()) - .Times(5) - .WillOnce(Return(100)) - .WillOnce(Return(150)) - .WillRepeatedly(Return(200)); -``` - -says that the `turtle` object's `GetX()` method will be called five times, it will return 100 the first time, 150 the second time, and then 200 every time. Some people like to call this style of syntax a Domain-Specific Language (DSL). - -**Note:** Why do we use a macro to do this? It serves two purposes: first it makes expectations easily identifiable (either by `grep` or by a human reader), and second it allows Google Mock to include the source file location of a failed expectation in messages, making debugging easier. - -## Matchers: What Arguments Do We Expect? ## -When a mock function takes arguments, we must specify what arguments we are expecting; for example: - -``` -// Expects the turtle to move forward by 100 units. -EXPECT_CALL(turtle, Forward(100)); -``` - -Sometimes you may not want to be too specific (Remember that talk about tests being too rigid? Over specification leads to brittle tests and obscures the intent of tests. Therefore we encourage you to specify only what's necessary - no more, no less.). If you care to check that `Forward()` will be called but aren't interested in its actual argument, write `_` as the argument, which means "anything goes": - -``` -using ::testing::_; -... -// Expects the turtle to move forward. -EXPECT_CALL(turtle, Forward(_)); -``` - -`_` is an instance of what we call **matchers**. A matcher is like a predicate and can test whether an argument is what we'd expect. You can use a matcher inside `EXPECT_CALL()` wherever a function argument is expected. - -A list of built-in matchers can be found in the [CheatSheet](CheatSheet.md). For example, here's the `Ge` (greater than or equal) matcher: - -``` -using ::testing::Ge;... -EXPECT_CALL(turtle, Forward(Ge(100))); -``` - -This checks that the turtle will be told to go forward by at least 100 units. - -## Cardinalities: How Many Times Will It Be Called? ## -The first clause we can specify following an `EXPECT_CALL()` is `Times()`. We call its argument a **cardinality** as it tells _how many times_ the call should occur. It allows us to repeat an expectation many times without actually writing it as many times. More importantly, a cardinality can be "fuzzy", just like a matcher can be. This allows a user to express the intent of a test exactly. - -An interesting special case is when we say `Times(0)`. You may have guessed - it means that the function shouldn't be called with the given arguments at all, and Google Mock will report a Google Test failure whenever the function is (wrongfully) called. - -We've seen `AtLeast(n)` as an example of fuzzy cardinalities earlier. For the list of built-in cardinalities you can use, see the [CheatSheet](CheatSheet.md). - -The `Times()` clause can be omitted. **If you omit `Times()`, Google Mock will infer the cardinality for you.** The rules are easy to remember: - - * If **neither** `WillOnce()` **nor** `WillRepeatedly()` is in the `EXPECT_CALL()`, the inferred cardinality is `Times(1)`. - * If there are `n WillOnce()`'s but **no** `WillRepeatedly()`, where `n` >= 1, the cardinality is `Times(n)`. - * If there are `n WillOnce()`'s and **one** `WillRepeatedly()`, where `n` >= 0, the cardinality is `Times(AtLeast(n))`. - -**Quick quiz:** what do you think will happen if a function is expected to be called twice but actually called four times? - -## Actions: What Should It Do? ## -Remember that a mock object doesn't really have a working implementation? We as users have to tell it what to do when a method is invoked. This is easy in Google Mock. - -First, if the return type of a mock function is a built-in type or a pointer, the function has a **default action** (a `void` function will just return, a `bool` function will return `false`, and other functions will return 0). In addition, in C++ 11 and above, a mock function whose return type is default-constructible (i.e. has a default constructor) has a default action of returning a default-constructed value. If you don't say anything, this behavior will be used. - -Second, if a mock function doesn't have a default action, or the default action doesn't suit you, you can specify the action to be taken each time the expectation matches using a series of `WillOnce()` clauses followed by an optional `WillRepeatedly()`. For example, - -``` -using ::testing::Return;... -EXPECT_CALL(turtle, GetX()) - .WillOnce(Return(100)) - .WillOnce(Return(200)) - .WillOnce(Return(300)); -``` - -This says that `turtle.GetX()` will be called _exactly three times_ (Google Mock inferred this from how many `WillOnce()` clauses we've written, since we didn't explicitly write `Times()`), and will return 100, 200, and 300 respectively. - -``` -using ::testing::Return;... -EXPECT_CALL(turtle, GetY()) - .WillOnce(Return(100)) - .WillOnce(Return(200)) - .WillRepeatedly(Return(300)); -``` - -says that `turtle.GetY()` will be called _at least twice_ (Google Mock knows this as we've written two `WillOnce()` clauses and a `WillRepeatedly()` while having no explicit `Times()`), will return 100 the first time, 200 the second time, and 300 from the third time on. - -Of course, if you explicitly write a `Times()`, Google Mock will not try to infer the cardinality itself. What if the number you specified is larger than there are `WillOnce()` clauses? Well, after all `WillOnce()`s are used up, Google Mock will do the _default_ action for the function every time (unless, of course, you have a `WillRepeatedly()`.). - -What can we do inside `WillOnce()` besides `Return()`? You can return a reference using `ReturnRef(variable)`, or invoke a pre-defined function, among [others](CheatSheet.md#actions). - -**Important note:** The `EXPECT_CALL()` statement evaluates the action clause only once, even though the action may be performed many times. Therefore you must be careful about side effects. The following may not do what you want: - -``` -int n = 100; -EXPECT_CALL(turtle, GetX()) -.Times(4) -.WillRepeatedly(Return(n++)); -``` - -Instead of returning 100, 101, 102, ..., consecutively, this mock function will always return 100 as `n++` is only evaluated once. Similarly, `Return(new Foo)` will create a new `Foo` object when the `EXPECT_CALL()` is executed, and will return the same pointer every time. If you want the side effect to happen every time, you need to define a custom action, which we'll teach in the [CookBook](CookBook.md). - -Time for another quiz! What do you think the following means? - -``` -using ::testing::Return;... -EXPECT_CALL(turtle, GetY()) -.Times(4) -.WillOnce(Return(100)); -``` - -Obviously `turtle.GetY()` is expected to be called four times. But if you think it will return 100 every time, think twice! Remember that one `WillOnce()` clause will be consumed each time the function is invoked and the default action will be taken afterwards. So the right answer is that `turtle.GetY()` will return 100 the first time, but **return 0 from the second time on**, as returning 0 is the default action for `int` functions. - -## Using Multiple Expectations ## -So far we've only shown examples where you have a single expectation. More realistically, you're going to specify expectations on multiple mock methods, which may be from multiple mock objects. - -By default, when a mock method is invoked, Google Mock will search the expectations in the **reverse order** they are defined, and stop when an active expectation that matches the arguments is found (you can think of it as "newer rules override older ones."). If the matching expectation cannot take any more calls, you will get an upper-bound-violated failure. Here's an example: - -``` -using ::testing::_;... -EXPECT_CALL(turtle, Forward(_)); // #1 -EXPECT_CALL(turtle, Forward(10)) // #2 - .Times(2); -``` - -If `Forward(10)` is called three times in a row, the third time it will be an error, as the last matching expectation (#2) has been saturated. If, however, the third `Forward(10)` call is replaced by `Forward(20)`, then it would be OK, as now #1 will be the matching expectation. - -**Side note:** Why does Google Mock search for a match in the _reverse_ order of the expectations? The reason is that this allows a user to set up the default expectations in a mock object's constructor or the test fixture's set-up phase and then customize the mock by writing more specific expectations in the test body. So, if you have two expectations on the same method, you want to put the one with more specific matchers **after** the other, or the more specific rule would be shadowed by the more general one that comes after it. - -## Ordered vs Unordered Calls ## -By default, an expectation can match a call even though an earlier expectation hasn't been satisfied. In other words, the calls don't have to occur in the order the expectations are specified. - -Sometimes, you may want all the expected calls to occur in a strict order. To say this in Google Mock is easy: - -``` -using ::testing::InSequence;... -TEST(FooTest, DrawsLineSegment) { - ... - { - InSequence dummy; - - EXPECT_CALL(turtle, PenDown()); - EXPECT_CALL(turtle, Forward(100)); - EXPECT_CALL(turtle, PenUp()); - } - Foo(); -} -``` - -By creating an object of type `InSequence`, all expectations in its scope are put into a _sequence_ and have to occur _sequentially_. Since we are just relying on the constructor and destructor of this object to do the actual work, its name is really irrelevant. - -In this example, we test that `Foo()` calls the three expected functions in the order as written. If a call is made out-of-order, it will be an error. - -(What if you care about the relative order of some of the calls, but not all of them? Can you specify an arbitrary partial order? The answer is ... yes! If you are impatient, the details can be found in the [CookBook](CookBook.md#expecting-partially-ordered-calls).) - -## All Expectations Are Sticky (Unless Said Otherwise) ## -Now let's do a quick quiz to see how well you can use this mock stuff already. How would you test that the turtle is asked to go to the origin _exactly twice_ (you want to ignore any other instructions it receives)? - -After you've come up with your answer, take a look at ours and compare notes (solve it yourself first - don't cheat!): - -``` -using ::testing::_;... -EXPECT_CALL(turtle, GoTo(_, _)) // #1 - .Times(AnyNumber()); -EXPECT_CALL(turtle, GoTo(0, 0)) // #2 - .Times(2); -``` - -Suppose `turtle.GoTo(0, 0)` is called three times. In the third time, Google Mock will see that the arguments match expectation #2 (remember that we always pick the last matching expectation). Now, since we said that there should be only two such calls, Google Mock will report an error immediately. This is basically what we've told you in the "Using Multiple Expectations" section above. - -This example shows that **expectations in Google Mock are "sticky" by default**, in the sense that they remain active even after we have reached their invocation upper bounds. This is an important rule to remember, as it affects the meaning of the spec, and is **different** to how it's done in many other mocking frameworks (Why'd we do that? Because we think our rule makes the common cases easier to express and understand.). - -Simple? Let's see if you've really understood it: what does the following code say? - -``` -using ::testing::Return; -... -for (int i = n; i > 0; i--) { - EXPECT_CALL(turtle, GetX()) - .WillOnce(Return(10*i)); -} -``` - -If you think it says that `turtle.GetX()` will be called `n` times and will return 10, 20, 30, ..., consecutively, think twice! The problem is that, as we said, expectations are sticky. So, the second time `turtle.GetX()` is called, the last (latest) `EXPECT_CALL()` statement will match, and will immediately lead to an "upper bound exceeded" error - this piece of code is not very useful! - -One correct way of saying that `turtle.GetX()` will return 10, 20, 30, ..., is to explicitly say that the expectations are _not_ sticky. In other words, they should _retire_ as soon as they are saturated: - -``` -using ::testing::Return; -... -for (int i = n; i > 0; i--) { - EXPECT_CALL(turtle, GetX()) - .WillOnce(Return(10*i)) - .RetiresOnSaturation(); -} -``` - -And, there's a better way to do it: in this case, we expect the calls to occur in a specific order, and we line up the actions to match the order. Since the order is important here, we should make it explicit using a sequence: - -``` -using ::testing::InSequence; -using ::testing::Return; -... -{ - InSequence s; - - for (int i = 1; i <= n; i++) { - EXPECT_CALL(turtle, GetX()) - .WillOnce(Return(10*i)) - .RetiresOnSaturation(); - } -} -``` - -By the way, the other situation where an expectation may _not_ be sticky is when it's in a sequence - as soon as another expectation that comes after it in the sequence has been used, it automatically retires (and will never be used to match any call). - -## Uninteresting Calls ## -A mock object may have many methods, and not all of them are that interesting. For example, in some tests we may not care about how many times `GetX()` and `GetY()` get called. - -In Google Mock, if you are not interested in a method, just don't say anything about it. If a call to this method occurs, you'll see a warning in the test output, but it won't be a failure. - -# What Now? # -Congratulations! You've learned enough about Google Mock to start using it. Now, you might want to join the [googlemock](http://groups.google.com/group/googlemock) discussion group and actually write some tests using Google Mock - it will be fun. Hey, it may even be addictive - you've been warned. - -Then, if you feel like increasing your mock quotient, you should move on to the [CookBook](CookBook.md). You can learn many advanced features of Google Mock there -- and advance your level of enjoyment and testing bliss. diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/FrequentlyAskedQuestions.md b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/FrequentlyAskedQuestions.md deleted file mode 100644 index 5eac83f4b98..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/FrequentlyAskedQuestions.md +++ /dev/null @@ -1,628 +0,0 @@ - - -Please send your questions to the -[googlemock](http://groups.google.com/group/googlemock) discussion -group. If you need help with compiler errors, make sure you have -tried [Google Mock Doctor](#How_am_I_supposed_to_make_sense_of_these_horrible_template_error.md) first. - -## When I call a method on my mock object, the method for the real object is invoked instead. What's the problem? ## - -In order for a method to be mocked, it must be _virtual_, unless you use the [high-perf dependency injection technique](CookBook.md#mocking-nonvirtual-methods). - -## I wrote some matchers. After I upgraded to a new version of Google Mock, they no longer compile. What's going on? ## - -After version 1.4.0 of Google Mock was released, we had an idea on how -to make it easier to write matchers that can generate informative -messages efficiently. We experimented with this idea and liked what -we saw. Therefore we decided to implement it. - -Unfortunately, this means that if you have defined your own matchers -by implementing `MatcherInterface` or using `MakePolymorphicMatcher()`, -your definitions will no longer compile. Matchers defined using the -`MATCHER*` family of macros are not affected. - -Sorry for the hassle if your matchers are affected. We believe it's -in everyone's long-term interest to make this change sooner than -later. Fortunately, it's usually not hard to migrate an existing -matcher to the new API. Here's what you need to do: - -If you wrote your matcher like this: -``` -// Old matcher definition that doesn't work with the latest -// Google Mock. -using ::testing::MatcherInterface; -... -class MyWonderfulMatcher : public MatcherInterface { - public: - ... - virtual bool Matches(MyType value) const { - // Returns true if value matches. - return value.GetFoo() > 5; - } - ... -}; -``` - -you'll need to change it to: -``` -// New matcher definition that works with the latest Google Mock. -using ::testing::MatcherInterface; -using ::testing::MatchResultListener; -... -class MyWonderfulMatcher : public MatcherInterface { - public: - ... - virtual bool MatchAndExplain(MyType value, - MatchResultListener* listener) const { - // Returns true if value matches. - return value.GetFoo() > 5; - } - ... -}; -``` -(i.e. rename `Matches()` to `MatchAndExplain()` and give it a second -argument of type `MatchResultListener*`.) - -If you were also using `ExplainMatchResultTo()` to improve the matcher -message: -``` -// Old matcher definition that doesn't work with the lastest -// Google Mock. -using ::testing::MatcherInterface; -... -class MyWonderfulMatcher : public MatcherInterface { - public: - ... - virtual bool Matches(MyType value) const { - // Returns true if value matches. - return value.GetFoo() > 5; - } - - virtual void ExplainMatchResultTo(MyType value, - ::std::ostream* os) const { - // Prints some helpful information to os to help - // a user understand why value matches (or doesn't match). - *os << "the Foo property is " << value.GetFoo(); - } - ... -}; -``` - -you should move the logic of `ExplainMatchResultTo()` into -`MatchAndExplain()`, using the `MatchResultListener` argument where -the `::std::ostream` was used: -``` -// New matcher definition that works with the latest Google Mock. -using ::testing::MatcherInterface; -using ::testing::MatchResultListener; -... -class MyWonderfulMatcher : public MatcherInterface { - public: - ... - virtual bool MatchAndExplain(MyType value, - MatchResultListener* listener) const { - // Returns true if value matches. - *listener << "the Foo property is " << value.GetFoo(); - return value.GetFoo() > 5; - } - ... -}; -``` - -If your matcher is defined using `MakePolymorphicMatcher()`: -``` -// Old matcher definition that doesn't work with the latest -// Google Mock. -using ::testing::MakePolymorphicMatcher; -... -class MyGreatMatcher { - public: - ... - bool Matches(MyType value) const { - // Returns true if value matches. - return value.GetBar() < 42; - } - ... -}; -... MakePolymorphicMatcher(MyGreatMatcher()) ... -``` - -you should rename the `Matches()` method to `MatchAndExplain()` and -add a `MatchResultListener*` argument (the same as what you need to do -for matchers defined by implementing `MatcherInterface`): -``` -// New matcher definition that works with the latest Google Mock. -using ::testing::MakePolymorphicMatcher; -using ::testing::MatchResultListener; -... -class MyGreatMatcher { - public: - ... - bool MatchAndExplain(MyType value, - MatchResultListener* listener) const { - // Returns true if value matches. - return value.GetBar() < 42; - } - ... -}; -... MakePolymorphicMatcher(MyGreatMatcher()) ... -``` - -If your polymorphic matcher uses `ExplainMatchResultTo()` for better -failure messages: -``` -// Old matcher definition that doesn't work with the latest -// Google Mock. -using ::testing::MakePolymorphicMatcher; -... -class MyGreatMatcher { - public: - ... - bool Matches(MyType value) const { - // Returns true if value matches. - return value.GetBar() < 42; - } - ... -}; -void ExplainMatchResultTo(const MyGreatMatcher& matcher, - MyType value, - ::std::ostream* os) { - // Prints some helpful information to os to help - // a user understand why value matches (or doesn't match). - *os << "the Bar property is " << value.GetBar(); -} -... MakePolymorphicMatcher(MyGreatMatcher()) ... -``` - -you'll need to move the logic inside `ExplainMatchResultTo()` to -`MatchAndExplain()`: -``` -// New matcher definition that works with the latest Google Mock. -using ::testing::MakePolymorphicMatcher; -using ::testing::MatchResultListener; -... -class MyGreatMatcher { - public: - ... - bool MatchAndExplain(MyType value, - MatchResultListener* listener) const { - // Returns true if value matches. - *listener << "the Bar property is " << value.GetBar(); - return value.GetBar() < 42; - } - ... -}; -... MakePolymorphicMatcher(MyGreatMatcher()) ... -``` - -For more information, you can read these -[two](CookBook.md#writing-new-monomorphic-matchers) -[recipes](CookBook.md#writing-new-polymorphic-matchers) -from the cookbook. As always, you -are welcome to post questions on `googlemock@googlegroups.com` if you -need any help. - -## When using Google Mock, do I have to use Google Test as the testing framework? I have my favorite testing framework and don't want to switch. ## - -Google Mock works out of the box with Google Test. However, it's easy -to configure it to work with any testing framework of your choice. -[Here](ForDummies.md#using-google-mock-with-any-testing-framework) is how. - -## How am I supposed to make sense of these horrible template errors? ## - -If you are confused by the compiler errors gcc threw at you, -try consulting the _Google Mock Doctor_ tool first. What it does is to -scan stdin for gcc error messages, and spit out diagnoses on the -problems (we call them diseases) your code has. - -To "install", run command: -``` -alias gmd='/scripts/gmock_doctor.py' -``` - -To use it, do: -``` - 2>&1 | gmd -``` - -For example: -``` -make my_test 2>&1 | gmd -``` - -Or you can run `gmd` and copy-n-paste gcc's error messages to it. - -## Can I mock a variadic function? ## - -You cannot mock a variadic function (i.e. a function taking ellipsis -(`...`) arguments) directly in Google Mock. - -The problem is that in general, there is _no way_ for a mock object to -know how many arguments are passed to the variadic method, and what -the arguments' types are. Only the _author of the base class_ knows -the protocol, and we cannot look into his head. - -Therefore, to mock such a function, the _user_ must teach the mock -object how to figure out the number of arguments and their types. One -way to do it is to provide overloaded versions of the function. - -Ellipsis arguments are inherited from C and not really a C++ feature. -They are unsafe to use and don't work with arguments that have -constructors or destructors. Therefore we recommend to avoid them in -C++ as much as possible. - -## MSVC gives me warning C4301 or C4373 when I define a mock method with a const parameter. Why? ## - -If you compile this using Microsoft Visual C++ 2005 SP1: -``` -class Foo { - ... - virtual void Bar(const int i) = 0; -}; - -class MockFoo : public Foo { - ... - MOCK_METHOD1(Bar, void(const int i)); -}; -``` -You may get the following warning: -``` -warning C4301: 'MockFoo::Bar': overriding virtual function only differs from 'Foo::Bar' by const/volatile qualifier -``` - -This is a MSVC bug. The same code compiles fine with gcc ,for -example. If you use Visual C++ 2008 SP1, you would get the warning: -``` -warning C4373: 'MockFoo::Bar': virtual function overrides 'Foo::Bar', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers -``` - -In C++, if you _declare_ a function with a `const` parameter, the -`const` modifier is _ignored_. Therefore, the `Foo` base class above -is equivalent to: -``` -class Foo { - ... - virtual void Bar(int i) = 0; // int or const int? Makes no difference. -}; -``` - -In fact, you can _declare_ Bar() with an `int` parameter, and _define_ -it with a `const int` parameter. The compiler will still match them -up. - -Since making a parameter `const` is meaningless in the method -_declaration_, we recommend to remove it in both `Foo` and `MockFoo`. -That should workaround the VC bug. - -Note that we are talking about the _top-level_ `const` modifier here. -If the function parameter is passed by pointer or reference, declaring -the _pointee_ or _referee_ as `const` is still meaningful. For -example, the following two declarations are _not_ equivalent: -``` -void Bar(int* p); // Neither p nor *p is const. -void Bar(const int* p); // p is not const, but *p is. -``` - -## I have a huge mock class, and Microsoft Visual C++ runs out of memory when compiling it. What can I do? ## - -We've noticed that when the `/clr` compiler flag is used, Visual C++ -uses 5~6 times as much memory when compiling a mock class. We suggest -to avoid `/clr` when compiling native C++ mocks. - -## I can't figure out why Google Mock thinks my expectations are not satisfied. What should I do? ## - -You might want to run your test with -`--gmock_verbose=info`. This flag lets Google Mock print a trace -of every mock function call it receives. By studying the trace, -you'll gain insights on why the expectations you set are not met. - -## How can I assert that a function is NEVER called? ## - -``` -EXPECT_CALL(foo, Bar(_)) - .Times(0); -``` - -## I have a failed test where Google Mock tells me TWICE that a particular expectation is not satisfied. Isn't this redundant? ## - -When Google Mock detects a failure, it prints relevant information -(the mock function arguments, the state of relevant expectations, and -etc) to help the user debug. If another failure is detected, Google -Mock will do the same, including printing the state of relevant -expectations. - -Sometimes an expectation's state didn't change between two failures, -and you'll see the same description of the state twice. They are -however _not_ redundant, as they refer to _different points in time_. -The fact they are the same _is_ interesting information. - -## I get a heap check failure when using a mock object, but using a real object is fine. What can be wrong? ## - -Does the class (hopefully a pure interface) you are mocking have a -virtual destructor? - -Whenever you derive from a base class, make sure its destructor is -virtual. Otherwise Bad Things will happen. Consider the following -code: - -``` -class Base { - public: - // Not virtual, but should be. - ~Base() { ... } - ... -}; - -class Derived : public Base { - public: - ... - private: - std::string value_; -}; - -... - Base* p = new Derived; - ... - delete p; // Surprise! ~Base() will be called, but ~Derived() will not - // - value_ is leaked. -``` - -By changing `~Base()` to virtual, `~Derived()` will be correctly -called when `delete p` is executed, and the heap checker -will be happy. - -## The "newer expectations override older ones" rule makes writing expectations awkward. Why does Google Mock do that? ## - -When people complain about this, often they are referring to code like: - -``` -// foo.Bar() should be called twice, return 1 the first time, and return -// 2 the second time. However, I have to write the expectations in the -// reverse order. This sucks big time!!! -EXPECT_CALL(foo, Bar()) - .WillOnce(Return(2)) - .RetiresOnSaturation(); -EXPECT_CALL(foo, Bar()) - .WillOnce(Return(1)) - .RetiresOnSaturation(); -``` - -The problem is that they didn't pick the **best** way to express the test's -intent. - -By default, expectations don't have to be matched in _any_ particular -order. If you want them to match in a certain order, you need to be -explicit. This is Google Mock's (and jMock's) fundamental philosophy: it's -easy to accidentally over-specify your tests, and we want to make it -harder to do so. - -There are two better ways to write the test spec. You could either -put the expectations in sequence: - -``` -// foo.Bar() should be called twice, return 1 the first time, and return -// 2 the second time. Using a sequence, we can write the expectations -// in their natural order. -{ - InSequence s; - EXPECT_CALL(foo, Bar()) - .WillOnce(Return(1)) - .RetiresOnSaturation(); - EXPECT_CALL(foo, Bar()) - .WillOnce(Return(2)) - .RetiresOnSaturation(); -} -``` - -or you can put the sequence of actions in the same expectation: - -``` -// foo.Bar() should be called twice, return 1 the first time, and return -// 2 the second time. -EXPECT_CALL(foo, Bar()) - .WillOnce(Return(1)) - .WillOnce(Return(2)) - .RetiresOnSaturation(); -``` - -Back to the original questions: why does Google Mock search the -expectations (and `ON_CALL`s) from back to front? Because this -allows a user to set up a mock's behavior for the common case early -(e.g. in the mock's constructor or the test fixture's set-up phase) -and customize it with more specific rules later. If Google Mock -searches from front to back, this very useful pattern won't be -possible. - -## Google Mock prints a warning when a function without EXPECT\_CALL is called, even if I have set its behavior using ON\_CALL. Would it be reasonable not to show the warning in this case? ## - -When choosing between being neat and being safe, we lean toward the -latter. So the answer is that we think it's better to show the -warning. - -Often people write `ON_CALL`s in the mock object's -constructor or `SetUp()`, as the default behavior rarely changes from -test to test. Then in the test body they set the expectations, which -are often different for each test. Having an `ON_CALL` in the set-up -part of a test doesn't mean that the calls are expected. If there's -no `EXPECT_CALL` and the method is called, it's possibly an error. If -we quietly let the call go through without notifying the user, bugs -may creep in unnoticed. - -If, however, you are sure that the calls are OK, you can write - -``` -EXPECT_CALL(foo, Bar(_)) - .WillRepeatedly(...); -``` - -instead of - -``` -ON_CALL(foo, Bar(_)) - .WillByDefault(...); -``` - -This tells Google Mock that you do expect the calls and no warning should be -printed. - -Also, you can control the verbosity using the `--gmock_verbose` flag. -If you find the output too noisy when debugging, just choose a less -verbose level. - -## How can I delete the mock function's argument in an action? ## - -If you find yourself needing to perform some action that's not -supported by Google Mock directly, remember that you can define your own -actions using -[MakeAction()](CookBook.md#writing-new-actions) or -[MakePolymorphicAction()](CookBook.md#writing_new_polymorphic_actions), -or you can write a stub function and invoke it using -[Invoke()](CookBook.md#using-functions_methods_functors). - -## MOCK\_METHODn()'s second argument looks funny. Why don't you use the MOCK\_METHODn(Method, return\_type, arg\_1, ..., arg\_n) syntax? ## - -What?! I think it's beautiful. :-) - -While which syntax looks more natural is a subjective matter to some -extent, Google Mock's syntax was chosen for several practical advantages it -has. - -Try to mock a function that takes a map as an argument: -``` -virtual int GetSize(const map& m); -``` - -Using the proposed syntax, it would be: -``` -MOCK_METHOD1(GetSize, int, const map& m); -``` - -Guess what? You'll get a compiler error as the compiler thinks that -`const map& m` are **two**, not one, arguments. To work -around this you can use `typedef` to give the map type a name, but -that gets in the way of your work. Google Mock's syntax avoids this -problem as the function's argument types are protected inside a pair -of parentheses: -``` -// This compiles fine. -MOCK_METHOD1(GetSize, int(const map& m)); -``` - -You still need a `typedef` if the return type contains an unprotected -comma, but that's much rarer. - -Other advantages include: - 1. `MOCK_METHOD1(Foo, int, bool)` can leave a reader wonder whether the method returns `int` or `bool`, while there won't be such confusion using Google Mock's syntax. - 1. The way Google Mock describes a function type is nothing new, although many people may not be familiar with it. The same syntax was used in C, and the `function` library in `tr1` uses this syntax extensively. Since `tr1` will become a part of the new version of STL, we feel very comfortable to be consistent with it. - 1. The function type syntax is also used in other parts of Google Mock's API (e.g. the action interface) in order to make the implementation tractable. A user needs to learn it anyway in order to utilize Google Mock's more advanced features. We'd as well stick to the same syntax in `MOCK_METHOD*`! - -## My code calls a static/global function. Can I mock it? ## - -You can, but you need to make some changes. - -In general, if you find yourself needing to mock a static function, -it's a sign that your modules are too tightly coupled (and less -flexible, less reusable, less testable, etc). You are probably better -off defining a small interface and call the function through that -interface, which then can be easily mocked. It's a bit of work -initially, but usually pays for itself quickly. - -This Google Testing Blog -[post](http://googletesting.blogspot.com/2008/06/defeat-static-cling.html) -says it excellently. Check it out. - -## My mock object needs to do complex stuff. It's a lot of pain to specify the actions. Google Mock sucks! ## - -I know it's not a question, but you get an answer for free any way. :-) - -With Google Mock, you can create mocks in C++ easily. And people might be -tempted to use them everywhere. Sometimes they work great, and -sometimes you may find them, well, a pain to use. So, what's wrong in -the latter case? - -When you write a test without using mocks, you exercise the code and -assert that it returns the correct value or that the system is in an -expected state. This is sometimes called "state-based testing". - -Mocks are great for what some call "interaction-based" testing: -instead of checking the system state at the very end, mock objects -verify that they are invoked the right way and report an error as soon -as it arises, giving you a handle on the precise context in which the -error was triggered. This is often more effective and economical to -do than state-based testing. - -If you are doing state-based testing and using a test double just to -simulate the real object, you are probably better off using a fake. -Using a mock in this case causes pain, as it's not a strong point for -mocks to perform complex actions. If you experience this and think -that mocks suck, you are just not using the right tool for your -problem. Or, you might be trying to solve the wrong problem. :-) - -## I got a warning "Uninteresting function call encountered - default action taken.." Should I panic? ## - -By all means, NO! It's just an FYI. - -What it means is that you have a mock function, you haven't set any -expectations on it (by Google Mock's rule this means that you are not -interested in calls to this function and therefore it can be called -any number of times), and it is called. That's OK - you didn't say -it's not OK to call the function! - -What if you actually meant to disallow this function to be called, but -forgot to write `EXPECT_CALL(foo, Bar()).Times(0)`? While -one can argue that it's the user's fault, Google Mock tries to be nice and -prints you a note. - -So, when you see the message and believe that there shouldn't be any -uninteresting calls, you should investigate what's going on. To make -your life easier, Google Mock prints the function name and arguments -when an uninteresting call is encountered. - -## I want to define a custom action. Should I use Invoke() or implement the action interface? ## - -Either way is fine - you want to choose the one that's more convenient -for your circumstance. - -Usually, if your action is for a particular function type, defining it -using `Invoke()` should be easier; if your action can be used in -functions of different types (e.g. if you are defining -`Return(value)`), `MakePolymorphicAction()` is -easiest. Sometimes you want precise control on what types of -functions the action can be used in, and implementing -`ActionInterface` is the way to go here. See the implementation of -`Return()` in `include/gmock/gmock-actions.h` for an example. - -## I'm using the set-argument-pointee action, and the compiler complains about "conflicting return type specified". What does it mean? ## - -You got this error as Google Mock has no idea what value it should return -when the mock method is called. `SetArgPointee()` says what the -side effect is, but doesn't say what the return value should be. You -need `DoAll()` to chain a `SetArgPointee()` with a `Return()`. - -See this [recipe](CookBook.md#mocking_side_effects) for more details and an example. - - -## My question is not in your FAQ! ## - -If you cannot find the answer to your question in this FAQ, there are -some other resources you can use: - - 1. read other [documentation](Documentation.md), - 1. search the mailing list [archive](http://groups.google.com/group/googlemock/topics), - 1. ask it on [googlemock@googlegroups.com](mailto:googlemock@googlegroups.com) and someone will answer it (to prevent spam, we require you to join the [discussion group](http://groups.google.com/group/googlemock) before you can post.). - -Please note that creating an issue in the -[issue tracker](https://github.com/google/googletest/issues) is _not_ -a good way to get your answer, as it is monitored infrequently by a -very small number of people. - -When asking a question, it's helpful to provide as much of the -following information as possible (people cannot help you if there's -not enough information in your question): - - * the version (or the revision number if you check out from SVN directly) of Google Mock you use (Google Mock is under active development, so it's possible that your problem has been solved in a later version), - * your operating system, - * the name and version of your compiler, - * the complete command line flags you give to your compiler, - * the complete compiler error messages (if the question is about compilation), - * the _actual_ code (ideally, a minimal but complete program) that has the problem you encounter. diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/KnownIssues.md b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/KnownIssues.md deleted file mode 100644 index adadf5144b1..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/docs/KnownIssues.md +++ /dev/null @@ -1,19 +0,0 @@ -As any non-trivial software system, Google Mock has some known limitations and problems. We are working on improving it, and welcome your help! The follow is a list of issues we know about. - - - -## README contains outdated information on Google Mock's compatibility with other testing frameworks ## - -The `README` file in release 1.1.0 still says that Google Mock only works with Google Test. Actually, you can configure Google Mock to work with any testing framework you choose. - -## Tests failing on machines using Power PC CPUs (e.g. some Macs) ## - -`gmock_output_test` and `gmock-printers_test` are known to fail with Power PC CPUs. This is due to portability issues with these tests, and is not an indication of problems in Google Mock itself. You can safely ignore them. - -## Failed to resolve libgtest.so.0 in tests when built against installed Google Test ## - -This only applies if you manually built and installed Google Test, and then built a Google Mock against it (either explicitly, or because gtest-config was in your path post-install). In this situation, Libtool has a known issue with certain systems' ldconfig setup: - -http://article.gmane.org/gmane.comp.sysutils.automake.general/9025 - -This requires a manual run of "sudo ldconfig" after the "sudo make install" for Google Test before any binaries which link against it can be executed. This isn't a bug in our install, but we should at least have documented it or hacked a work-around into our install. We should have one of these solutions in our next release. \ No newline at end of file diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-actions.h b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-actions.h deleted file mode 100644 index 845c8232212..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-actions.h +++ /dev/null @@ -1,1205 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used actions. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ - -#ifndef _WIN32_WCE -# include -#endif - -#include -#include - -#include "gmock/internal/gmock-internal-utils.h" -#include "gmock/internal/gmock-port.h" - -#if GTEST_HAS_STD_TYPE_TRAITS_ // Defined by gtest-port.h via gmock-port.h. -#include -#endif - -namespace testing { - -// To implement an action Foo, define: -// 1. a class FooAction that implements the ActionInterface interface, and -// 2. a factory function that creates an Action object from a -// const FooAction*. -// -// The two-level delegation design follows that of Matcher, providing -// consistency for extension developers. It also eases ownership -// management as Action objects can now be copied like plain values. - -namespace internal { - -template -class ActionAdaptor; - -// BuiltInDefaultValueGetter::Get() returns a -// default-constructed T value. BuiltInDefaultValueGetter::Get() crashes with an error. -// -// This primary template is used when kDefaultConstructible is true. -template -struct BuiltInDefaultValueGetter { - static T Get() { return T(); } -}; -template -struct BuiltInDefaultValueGetter { - static T Get() { - Assert(false, __FILE__, __LINE__, - "Default action undefined for the function return type."); - return internal::Invalid(); - // The above statement will never be reached, but is required in - // order for this function to compile. - } -}; - -// BuiltInDefaultValue::Get() returns the "built-in" default value -// for type T, which is NULL when T is a raw pointer type, 0 when T is -// a numeric type, false when T is bool, or "" when T is string or -// std::string. In addition, in C++11 and above, it turns a -// default-constructed T value if T is default constructible. For any -// other type T, the built-in default T value is undefined, and the -// function will abort the process. -template -class BuiltInDefaultValue { - public: -#if GTEST_HAS_STD_TYPE_TRAITS_ - // This function returns true iff type T has a built-in default value. - static bool Exists() { - return ::std::is_default_constructible::value; - } - - static T Get() { - return BuiltInDefaultValueGetter< - T, ::std::is_default_constructible::value>::Get(); - } - -#else // GTEST_HAS_STD_TYPE_TRAITS_ - // This function returns true iff type T has a built-in default value. - static bool Exists() { - return false; - } - - static T Get() { - return BuiltInDefaultValueGetter::Get(); - } - -#endif // GTEST_HAS_STD_TYPE_TRAITS_ -}; - -// This partial specialization says that we use the same built-in -// default value for T and const T. -template -class BuiltInDefaultValue { - public: - static bool Exists() { return BuiltInDefaultValue::Exists(); } - static T Get() { return BuiltInDefaultValue::Get(); } -}; - -// This partial specialization defines the default values for pointer -// types. -template -class BuiltInDefaultValue { - public: - static bool Exists() { return true; } - static T* Get() { return NULL; } -}; - -// The following specializations define the default values for -// specific types we care about. -#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \ - template <> \ - class BuiltInDefaultValue { \ - public: \ - static bool Exists() { return true; } \ - static type Get() { return value; } \ - } - -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT -#if GTEST_HAS_GLOBAL_STRING -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::string, ""); -#endif // GTEST_HAS_GLOBAL_STRING -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, ""); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0'); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0'); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0'); - -// There's no need for a default action for signed wchar_t, as that -// type is the same as wchar_t for gcc, and invalid for MSVC. -// -// There's also no need for a default action for unsigned wchar_t, as -// that type is the same as unsigned int for gcc, and invalid for -// MSVC. -#if GMOCK_WCHAR_T_IS_NATIVE_ -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); // NOLINT -#endif - -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(UInt64, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(Int64, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0); - -#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ - -} // namespace internal - -// When an unexpected function call is encountered, Google Mock will -// let it return a default value if the user has specified one for its -// return type, or if the return type has a built-in default value; -// otherwise Google Mock won't know what value to return and will have -// to abort the process. -// -// The DefaultValue class allows a user to specify the -// default value for a type T that is both copyable and publicly -// destructible (i.e. anything that can be used as a function return -// type). The usage is: -// -// // Sets the default value for type T to be foo. -// DefaultValue::Set(foo); -template -class DefaultValue { - public: - // Sets the default value for type T; requires T to be - // copy-constructable and have a public destructor. - static void Set(T x) { - delete producer_; - producer_ = new FixedValueProducer(x); - } - - // Provides a factory function to be called to generate the default value. - // This method can be used even if T is only move-constructible, but it is not - // limited to that case. - typedef T (*FactoryFunction)(); - static void SetFactory(FactoryFunction factory) { - delete producer_; - producer_ = new FactoryValueProducer(factory); - } - - // Unsets the default value for type T. - static void Clear() { - delete producer_; - producer_ = NULL; - } - - // Returns true iff the user has set the default value for type T. - static bool IsSet() { return producer_ != NULL; } - - // Returns true if T has a default return value set by the user or there - // exists a built-in default value. - static bool Exists() { - return IsSet() || internal::BuiltInDefaultValue::Exists(); - } - - // Returns the default value for type T if the user has set one; - // otherwise returns the built-in default value. Requires that Exists() - // is true, which ensures that the return value is well-defined. - static T Get() { - return producer_ == NULL ? - internal::BuiltInDefaultValue::Get() : producer_->Produce(); - } - - private: - class ValueProducer { - public: - virtual ~ValueProducer() {} - virtual T Produce() = 0; - }; - - class FixedValueProducer : public ValueProducer { - public: - explicit FixedValueProducer(T value) : value_(value) {} - virtual T Produce() { return value_; } - - private: - const T value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(FixedValueProducer); - }; - - class FactoryValueProducer : public ValueProducer { - public: - explicit FactoryValueProducer(FactoryFunction factory) - : factory_(factory) {} - virtual T Produce() { return factory_(); } - - private: - const FactoryFunction factory_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(FactoryValueProducer); - }; - - static ValueProducer* producer_; -}; - -// This partial specialization allows a user to set default values for -// reference types. -template -class DefaultValue { - public: - // Sets the default value for type T&. - static void Set(T& x) { // NOLINT - address_ = &x; - } - - // Unsets the default value for type T&. - static void Clear() { - address_ = NULL; - } - - // Returns true iff the user has set the default value for type T&. - static bool IsSet() { return address_ != NULL; } - - // Returns true if T has a default return value set by the user or there - // exists a built-in default value. - static bool Exists() { - return IsSet() || internal::BuiltInDefaultValue::Exists(); - } - - // Returns the default value for type T& if the user has set one; - // otherwise returns the built-in default value if there is one; - // otherwise aborts the process. - static T& Get() { - return address_ == NULL ? - internal::BuiltInDefaultValue::Get() : *address_; - } - - private: - static T* address_; -}; - -// This specialization allows DefaultValue::Get() to -// compile. -template <> -class DefaultValue { - public: - static bool Exists() { return true; } - static void Get() {} -}; - -// Points to the user-set default value for type T. -template -typename DefaultValue::ValueProducer* DefaultValue::producer_ = NULL; - -// Points to the user-set default value for type T&. -template -T* DefaultValue::address_ = NULL; - -// Implement this interface to define an action for function type F. -template -class ActionInterface { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - ActionInterface() {} - virtual ~ActionInterface() {} - - // Performs the action. This method is not const, as in general an - // action can have side effects and be stateful. For example, a - // get-the-next-element-from-the-collection action will need to - // remember the current element. - virtual Result Perform(const ArgumentTuple& args) = 0; - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface); -}; - -// An Action is a copyable and IMMUTABLE (except by assignment) -// object that represents an action to be taken when a mock function -// of type F is called. The implementation of Action is just a -// linked_ptr to const ActionInterface, so copying is fairly cheap. -// Don't inherit from Action! -// -// You can view an object implementing ActionInterface as a -// concrete action (including its current state), and an Action -// object as a handle to it. -template -class Action { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - // Constructs a null Action. Needed for storing Action objects in - // STL containers. - Action() : impl_(NULL) {} - - // Constructs an Action from its implementation. A NULL impl is - // used to represent the "do-default" action. - explicit Action(ActionInterface* impl) : impl_(impl) {} - - // Copy constructor. - Action(const Action& action) : impl_(action.impl_) {} - - // This constructor allows us to turn an Action object into an - // Action, as long as F's arguments can be implicitly converted - // to Func's and Func's return type can be implicitly converted to - // F's. - template - explicit Action(const Action& action); - - // Returns true iff this is the DoDefault() action. - bool IsDoDefault() const { return impl_.get() == NULL; } - - // Performs the action. Note that this method is const even though - // the corresponding method in ActionInterface is not. The reason - // is that a const Action means that it cannot be re-bound to - // another concrete action, not that the concrete action it binds to - // cannot change state. (Think of the difference between a const - // pointer and a pointer to const.) - Result Perform(const ArgumentTuple& args) const { - internal::Assert( - !IsDoDefault(), __FILE__, __LINE__, - "You are using DoDefault() inside a composite action like " - "DoAll() or WithArgs(). This is not supported for technical " - "reasons. Please instead spell out the default action, or " - "assign the default action to an Action variable and use " - "the variable in various places."); - return impl_->Perform(args); - } - - private: - template - friend class internal::ActionAdaptor; - - internal::linked_ptr > impl_; -}; - -// The PolymorphicAction class template makes it easy to implement a -// polymorphic action (i.e. an action that can be used in mock -// functions of than one type, e.g. Return()). -// -// To define a polymorphic action, a user first provides a COPYABLE -// implementation class that has a Perform() method template: -// -// class FooAction { -// public: -// template -// Result Perform(const ArgumentTuple& args) const { -// // Processes the arguments and returns a result, using -// // tr1::get(args) to get the N-th (0-based) argument in the tuple. -// } -// ... -// }; -// -// Then the user creates the polymorphic action using -// MakePolymorphicAction(object) where object has type FooAction. See -// the definition of Return(void) and SetArgumentPointee(value) for -// complete examples. -template -class PolymorphicAction { - public: - explicit PolymorphicAction(const Impl& impl) : impl_(impl) {} - - template - operator Action() const { - return Action(new MonomorphicImpl(impl_)); - } - - private: - template - class MonomorphicImpl : public ActionInterface { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} - - virtual Result Perform(const ArgumentTuple& args) { - return impl_.template Perform(args); - } - - private: - Impl impl_; - - GTEST_DISALLOW_ASSIGN_(MonomorphicImpl); - }; - - Impl impl_; - - GTEST_DISALLOW_ASSIGN_(PolymorphicAction); -}; - -// Creates an Action from its implementation and returns it. The -// created Action object owns the implementation. -template -Action MakeAction(ActionInterface* impl) { - return Action(impl); -} - -// Creates a polymorphic action from its implementation. This is -// easier to use than the PolymorphicAction constructor as it -// doesn't require you to explicitly write the template argument, e.g. -// -// MakePolymorphicAction(foo); -// vs -// PolymorphicAction(foo); -template -inline PolymorphicAction MakePolymorphicAction(const Impl& impl) { - return PolymorphicAction(impl); -} - -namespace internal { - -// Allows an Action object to pose as an Action, as long as F2 -// and F1 are compatible. -template -class ActionAdaptor : public ActionInterface { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - explicit ActionAdaptor(const Action& from) : impl_(from.impl_) {} - - virtual Result Perform(const ArgumentTuple& args) { - return impl_->Perform(args); - } - - private: - const internal::linked_ptr > impl_; - - GTEST_DISALLOW_ASSIGN_(ActionAdaptor); -}; - -// Helper struct to specialize ReturnAction to execute a move instead of a copy -// on return. Useful for move-only types, but could be used on any type. -template -struct ByMoveWrapper { - explicit ByMoveWrapper(T value) : payload(internal::move(value)) {} - T payload; -}; - -// Implements the polymorphic Return(x) action, which can be used in -// any function that returns the type of x, regardless of the argument -// types. -// -// Note: The value passed into Return must be converted into -// Function::Result when this action is cast to Action rather than -// when that action is performed. This is important in scenarios like -// -// MOCK_METHOD1(Method, T(U)); -// ... -// { -// Foo foo; -// X x(&foo); -// EXPECT_CALL(mock, Method(_)).WillOnce(Return(x)); -// } -// -// In the example above the variable x holds reference to foo which leaves -// scope and gets destroyed. If copying X just copies a reference to foo, -// that copy will be left with a hanging reference. If conversion to T -// makes a copy of foo, the above code is safe. To support that scenario, we -// need to make sure that the type conversion happens inside the EXPECT_CALL -// statement, and conversion of the result of Return to Action is a -// good place for that. -// -template -class ReturnAction { - public: - // Constructs a ReturnAction object from the value to be returned. - // 'value' is passed by value instead of by const reference in order - // to allow Return("string literal") to compile. - explicit ReturnAction(R value) : value_(new R(internal::move(value))) {} - - // This template type conversion operator allows Return(x) to be - // used in ANY function that returns x's type. - template - operator Action() const { - // Assert statement belongs here because this is the best place to verify - // conditions on F. It produces the clearest error messages - // in most compilers. - // Impl really belongs in this scope as a local class but can't - // because MSVC produces duplicate symbols in different translation units - // in this case. Until MS fixes that bug we put Impl into the class scope - // and put the typedef both here (for use in assert statement) and - // in the Impl class. But both definitions must be the same. - typedef typename Function::Result Result; - GTEST_COMPILE_ASSERT_( - !is_reference::value, - use_ReturnRef_instead_of_Return_to_return_a_reference); - return Action(new Impl(value_)); - } - - private: - // Implements the Return(x) action for a particular function type F. - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - // The implicit cast is necessary when Result has more than one - // single-argument constructor (e.g. Result is std::vector) and R - // has a type conversion operator template. In that case, value_(value) - // won't compile as the compiler doesn't known which constructor of - // Result to call. ImplicitCast_ forces the compiler to convert R to - // Result without considering explicit constructors, thus resolving the - // ambiguity. value_ is then initialized using its copy constructor. - explicit Impl(const linked_ptr& value) - : value_before_cast_(*value), - value_(ImplicitCast_(value_before_cast_)) {} - - virtual Result Perform(const ArgumentTuple&) { return value_; } - - private: - GTEST_COMPILE_ASSERT_(!is_reference::value, - Result_cannot_be_a_reference_type); - // We save the value before casting just in case it is being cast to a - // wrapper type. - R value_before_cast_; - Result value_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl); - }; - - // Partially specialize for ByMoveWrapper. This version of ReturnAction will - // move its contents instead. - template - class Impl, F> : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - explicit Impl(const linked_ptr& wrapper) - : performed_(false), wrapper_(wrapper) {} - - virtual Result Perform(const ArgumentTuple&) { - GTEST_CHECK_(!performed_) - << "A ByMove() action should only be performed once."; - performed_ = true; - return internal::move(wrapper_->payload); - } - - private: - bool performed_; - const linked_ptr wrapper_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - const linked_ptr value_; - - GTEST_DISALLOW_ASSIGN_(ReturnAction); -}; - -// Implements the ReturnNull() action. -class ReturnNullAction { - public: - // Allows ReturnNull() to be used in any pointer-returning function. In C++11 - // this is enforced by returning nullptr, and in non-C++11 by asserting a - // pointer type on compile time. - template - static Result Perform(const ArgumentTuple&) { -#if GTEST_LANG_CXX11 - return nullptr; -#else - GTEST_COMPILE_ASSERT_(internal::is_pointer::value, - ReturnNull_can_be_used_to_return_a_pointer_only); - return NULL; -#endif // GTEST_LANG_CXX11 - } -}; - -// Implements the Return() action. -class ReturnVoidAction { - public: - // Allows Return() to be used in any void-returning function. - template - static void Perform(const ArgumentTuple&) { - CompileAssertTypesEqual(); - } -}; - -// Implements the polymorphic ReturnRef(x) action, which can be used -// in any function that returns a reference to the type of x, -// regardless of the argument types. -template -class ReturnRefAction { - public: - // Constructs a ReturnRefAction object from the reference to be returned. - explicit ReturnRefAction(T& ref) : ref_(ref) {} // NOLINT - - // This template type conversion operator allows ReturnRef(x) to be - // used in ANY function that returns a reference to x's type. - template - operator Action() const { - typedef typename Function::Result Result; - // Asserts that the function return type is a reference. This - // catches the user error of using ReturnRef(x) when Return(x) - // should be used, and generates some helpful error message. - GTEST_COMPILE_ASSERT_(internal::is_reference::value, - use_Return_instead_of_ReturnRef_to_return_a_value); - return Action(new Impl(ref_)); - } - - private: - // Implements the ReturnRef(x) action for a particular function type F. - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - explicit Impl(T& ref) : ref_(ref) {} // NOLINT - - virtual Result Perform(const ArgumentTuple&) { - return ref_; - } - - private: - T& ref_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - T& ref_; - - GTEST_DISALLOW_ASSIGN_(ReturnRefAction); -}; - -// Implements the polymorphic ReturnRefOfCopy(x) action, which can be -// used in any function that returns a reference to the type of x, -// regardless of the argument types. -template -class ReturnRefOfCopyAction { - public: - // Constructs a ReturnRefOfCopyAction object from the reference to - // be returned. - explicit ReturnRefOfCopyAction(const T& value) : value_(value) {} // NOLINT - - // This template type conversion operator allows ReturnRefOfCopy(x) to be - // used in ANY function that returns a reference to x's type. - template - operator Action() const { - typedef typename Function::Result Result; - // Asserts that the function return type is a reference. This - // catches the user error of using ReturnRefOfCopy(x) when Return(x) - // should be used, and generates some helpful error message. - GTEST_COMPILE_ASSERT_( - internal::is_reference::value, - use_Return_instead_of_ReturnRefOfCopy_to_return_a_value); - return Action(new Impl(value_)); - } - - private: - // Implements the ReturnRefOfCopy(x) action for a particular function type F. - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - explicit Impl(const T& value) : value_(value) {} // NOLINT - - virtual Result Perform(const ArgumentTuple&) { - return value_; - } - - private: - T value_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - const T value_; - - GTEST_DISALLOW_ASSIGN_(ReturnRefOfCopyAction); -}; - -// Implements the polymorphic DoDefault() action. -class DoDefaultAction { - public: - // This template type conversion operator allows DoDefault() to be - // used in any function. - template - operator Action() const { return Action(NULL); } -}; - -// Implements the Assign action to set a given pointer referent to a -// particular value. -template -class AssignAction { - public: - AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {} - - template - void Perform(const ArgumentTuple& /* args */) const { - *ptr_ = value_; - } - - private: - T1* const ptr_; - const T2 value_; - - GTEST_DISALLOW_ASSIGN_(AssignAction); -}; - -#if !GTEST_OS_WINDOWS_MOBILE - -// Implements the SetErrnoAndReturn action to simulate return from -// various system calls and libc functions. -template -class SetErrnoAndReturnAction { - public: - SetErrnoAndReturnAction(int errno_value, T result) - : errno_(errno_value), - result_(result) {} - template - Result Perform(const ArgumentTuple& /* args */) const { - errno = errno_; - return result_; - } - - private: - const int errno_; - const T result_; - - GTEST_DISALLOW_ASSIGN_(SetErrnoAndReturnAction); -}; - -#endif // !GTEST_OS_WINDOWS_MOBILE - -// Implements the SetArgumentPointee(x) action for any function -// whose N-th argument (0-based) is a pointer to x's type. The -// template parameter kIsProto is true iff type A is ProtocolMessage, -// proto2::Message, or a sub-class of those. -template -class SetArgumentPointeeAction { - public: - // Constructs an action that sets the variable pointed to by the - // N-th function argument to 'value'. - explicit SetArgumentPointeeAction(const A& value) : value_(value) {} - - template - void Perform(const ArgumentTuple& args) const { - CompileAssertTypesEqual(); - *::testing::get(args) = value_; - } - - private: - const A value_; - - GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction); -}; - -template -class SetArgumentPointeeAction { - public: - // Constructs an action that sets the variable pointed to by the - // N-th function argument to 'proto'. Both ProtocolMessage and - // proto2::Message have the CopyFrom() method, so the same - // implementation works for both. - explicit SetArgumentPointeeAction(const Proto& proto) : proto_(new Proto) { - proto_->CopyFrom(proto); - } - - template - void Perform(const ArgumentTuple& args) const { - CompileAssertTypesEqual(); - ::testing::get(args)->CopyFrom(*proto_); - } - - private: - const internal::linked_ptr proto_; - - GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction); -}; - -// Implements the InvokeWithoutArgs(f) action. The template argument -// FunctionImpl is the implementation type of f, which can be either a -// function pointer or a functor. InvokeWithoutArgs(f) can be used as an -// Action as long as f's type is compatible with F (i.e. f can be -// assigned to a tr1::function). -template -class InvokeWithoutArgsAction { - public: - // The c'tor makes a copy of function_impl (either a function - // pointer or a functor). - explicit InvokeWithoutArgsAction(FunctionImpl function_impl) - : function_impl_(function_impl) {} - - // Allows InvokeWithoutArgs(f) to be used as any action whose type is - // compatible with f. - template - Result Perform(const ArgumentTuple&) { return function_impl_(); } - - private: - FunctionImpl function_impl_; - - GTEST_DISALLOW_ASSIGN_(InvokeWithoutArgsAction); -}; - -// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action. -template -class InvokeMethodWithoutArgsAction { - public: - InvokeMethodWithoutArgsAction(Class* obj_ptr, MethodPtr method_ptr) - : obj_ptr_(obj_ptr), method_ptr_(method_ptr) {} - - template - Result Perform(const ArgumentTuple&) const { - return (obj_ptr_->*method_ptr_)(); - } - - private: - Class* const obj_ptr_; - const MethodPtr method_ptr_; - - GTEST_DISALLOW_ASSIGN_(InvokeMethodWithoutArgsAction); -}; - -// Implements the IgnoreResult(action) action. -template -class IgnoreResultAction { - public: - explicit IgnoreResultAction(const A& action) : action_(action) {} - - template - operator Action() const { - // Assert statement belongs here because this is the best place to verify - // conditions on F. It produces the clearest error messages - // in most compilers. - // Impl really belongs in this scope as a local class but can't - // because MSVC produces duplicate symbols in different translation units - // in this case. Until MS fixes that bug we put Impl into the class scope - // and put the typedef both here (for use in assert statement) and - // in the Impl class. But both definitions must be the same. - typedef typename internal::Function::Result Result; - - // Asserts at compile time that F returns void. - CompileAssertTypesEqual(); - - return Action(new Impl(action_)); - } - - private: - template - class Impl : public ActionInterface { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - explicit Impl(const A& action) : action_(action) {} - - virtual void Perform(const ArgumentTuple& args) { - // Performs the action and ignores its result. - action_.Perform(args); - } - - private: - // Type OriginalFunction is the same as F except that its return - // type is IgnoredValue. - typedef typename internal::Function::MakeResultIgnoredValue - OriginalFunction; - - const Action action_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - const A action_; - - GTEST_DISALLOW_ASSIGN_(IgnoreResultAction); -}; - -// A ReferenceWrapper object represents a reference to type T, -// which can be either const or not. It can be explicitly converted -// from, and implicitly converted to, a T&. Unlike a reference, -// ReferenceWrapper can be copied and can survive template type -// inference. This is used to support by-reference arguments in the -// InvokeArgument(...) action. The idea was from "reference -// wrappers" in tr1, which we don't have in our source tree yet. -template -class ReferenceWrapper { - public: - // Constructs a ReferenceWrapper object from a T&. - explicit ReferenceWrapper(T& l_value) : pointer_(&l_value) {} // NOLINT - - // Allows a ReferenceWrapper object to be implicitly converted to - // a T&. - operator T&() const { return *pointer_; } - private: - T* pointer_; -}; - -// Allows the expression ByRef(x) to be printed as a reference to x. -template -void PrintTo(const ReferenceWrapper& ref, ::std::ostream* os) { - T& value = ref; - UniversalPrinter::Print(value, os); -} - -// Does two actions sequentially. Used for implementing the DoAll(a1, -// a2, ...) action. -template -class DoBothAction { - public: - DoBothAction(Action1 action1, Action2 action2) - : action1_(action1), action2_(action2) {} - - // This template type conversion operator allows DoAll(a1, ..., a_n) - // to be used in ANY function of compatible type. - template - operator Action() const { - return Action(new Impl(action1_, action2_)); - } - - private: - // Implements the DoAll(...) action for a particular function type F. - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - typedef typename Function::MakeResultVoid VoidResult; - - Impl(const Action& action1, const Action& action2) - : action1_(action1), action2_(action2) {} - - virtual Result Perform(const ArgumentTuple& args) { - action1_.Perform(args); - return action2_.Perform(args); - } - - private: - const Action action1_; - const Action action2_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - Action1 action1_; - Action2 action2_; - - GTEST_DISALLOW_ASSIGN_(DoBothAction); -}; - -} // namespace internal - -// An Unused object can be implicitly constructed from ANY value. -// This is handy when defining actions that ignore some or all of the -// mock function arguments. For example, given -// -// MOCK_METHOD3(Foo, double(const string& label, double x, double y)); -// MOCK_METHOD3(Bar, double(int index, double x, double y)); -// -// instead of -// -// double DistanceToOriginWithLabel(const string& label, double x, double y) { -// return sqrt(x*x + y*y); -// } -// double DistanceToOriginWithIndex(int index, double x, double y) { -// return sqrt(x*x + y*y); -// } -// ... -// EXPECT_CALL(mock, Foo("abc", _, _)) -// .WillOnce(Invoke(DistanceToOriginWithLabel)); -// EXPECT_CALL(mock, Bar(5, _, _)) -// .WillOnce(Invoke(DistanceToOriginWithIndex)); -// -// you could write -// -// // We can declare any uninteresting argument as Unused. -// double DistanceToOrigin(Unused, double x, double y) { -// return sqrt(x*x + y*y); -// } -// ... -// EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin)); -// EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); -typedef internal::IgnoredValue Unused; - -// This constructor allows us to turn an Action object into an -// Action, as long as To's arguments can be implicitly converted -// to From's and From's return type cann be implicitly converted to -// To's. -template -template -Action::Action(const Action& from) - : impl_(new internal::ActionAdaptor(from)) {} - -// Creates an action that returns 'value'. 'value' is passed by value -// instead of const reference - otherwise Return("string literal") -// will trigger a compiler error about using array as initializer. -template -internal::ReturnAction Return(R value) { - return internal::ReturnAction(internal::move(value)); -} - -// Creates an action that returns NULL. -inline PolymorphicAction ReturnNull() { - return MakePolymorphicAction(internal::ReturnNullAction()); -} - -// Creates an action that returns from a void function. -inline PolymorphicAction Return() { - return MakePolymorphicAction(internal::ReturnVoidAction()); -} - -// Creates an action that returns the reference to a variable. -template -inline internal::ReturnRefAction ReturnRef(R& x) { // NOLINT - return internal::ReturnRefAction(x); -} - -// Creates an action that returns the reference to a copy of the -// argument. The copy is created when the action is constructed and -// lives as long as the action. -template -inline internal::ReturnRefOfCopyAction ReturnRefOfCopy(const R& x) { - return internal::ReturnRefOfCopyAction(x); -} - -// Modifies the parent action (a Return() action) to perform a move of the -// argument instead of a copy. -// Return(ByMove()) actions can only be executed once and will assert this -// invariant. -template -internal::ByMoveWrapper ByMove(R x) { - return internal::ByMoveWrapper(internal::move(x)); -} - -// Creates an action that does the default action for the give mock function. -inline internal::DoDefaultAction DoDefault() { - return internal::DoDefaultAction(); -} - -// Creates an action that sets the variable pointed by the N-th -// (0-based) function argument to 'value'. -template -PolymorphicAction< - internal::SetArgumentPointeeAction< - N, T, internal::IsAProtocolMessage::value> > -SetArgPointee(const T& x) { - return MakePolymorphicAction(internal::SetArgumentPointeeAction< - N, T, internal::IsAProtocolMessage::value>(x)); -} - -#if !((GTEST_GCC_VER_ && GTEST_GCC_VER_ < 40000) || GTEST_OS_SYMBIAN) -// This overload allows SetArgPointee() to accept a string literal. -// GCC prior to the version 4.0 and Symbian C++ compiler cannot distinguish -// this overload from the templated version and emit a compile error. -template -PolymorphicAction< - internal::SetArgumentPointeeAction > -SetArgPointee(const char* p) { - return MakePolymorphicAction(internal::SetArgumentPointeeAction< - N, const char*, false>(p)); -} - -template -PolymorphicAction< - internal::SetArgumentPointeeAction > -SetArgPointee(const wchar_t* p) { - return MakePolymorphicAction(internal::SetArgumentPointeeAction< - N, const wchar_t*, false>(p)); -} -#endif - -// The following version is DEPRECATED. -template -PolymorphicAction< - internal::SetArgumentPointeeAction< - N, T, internal::IsAProtocolMessage::value> > -SetArgumentPointee(const T& x) { - return MakePolymorphicAction(internal::SetArgumentPointeeAction< - N, T, internal::IsAProtocolMessage::value>(x)); -} - -// Creates an action that sets a pointer referent to a given value. -template -PolymorphicAction > Assign(T1* ptr, T2 val) { - return MakePolymorphicAction(internal::AssignAction(ptr, val)); -} - -#if !GTEST_OS_WINDOWS_MOBILE - -// Creates an action that sets errno and returns the appropriate error. -template -PolymorphicAction > -SetErrnoAndReturn(int errval, T result) { - return MakePolymorphicAction( - internal::SetErrnoAndReturnAction(errval, result)); -} - -#endif // !GTEST_OS_WINDOWS_MOBILE - -// Various overloads for InvokeWithoutArgs(). - -// Creates an action that invokes 'function_impl' with no argument. -template -PolymorphicAction > -InvokeWithoutArgs(FunctionImpl function_impl) { - return MakePolymorphicAction( - internal::InvokeWithoutArgsAction(function_impl)); -} - -// Creates an action that invokes the given method on the given object -// with no argument. -template -PolymorphicAction > -InvokeWithoutArgs(Class* obj_ptr, MethodPtr method_ptr) { - return MakePolymorphicAction( - internal::InvokeMethodWithoutArgsAction( - obj_ptr, method_ptr)); -} - -// Creates an action that performs an_action and throws away its -// result. In other words, it changes the return type of an_action to -// void. an_action MUST NOT return void, or the code won't compile. -template -inline internal::IgnoreResultAction IgnoreResult(const A& an_action) { - return internal::IgnoreResultAction(an_action); -} - -// Creates a reference wrapper for the given L-value. If necessary, -// you can explicitly specify the type of the reference. For example, -// suppose 'derived' is an object of type Derived, ByRef(derived) -// would wrap a Derived&. If you want to wrap a const Base& instead, -// where Base is a base class of Derived, just write: -// -// ByRef(derived) -template -inline internal::ReferenceWrapper ByRef(T& l_value) { // NOLINT - return internal::ReferenceWrapper(l_value); -} - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-cardinalities.h b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-cardinalities.h deleted file mode 100644 index fc315f92ab5..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-cardinalities.h +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used cardinalities. More -// cardinalities can be defined by the user implementing the -// CardinalityInterface interface if necessary. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ - -#include -#include // NOLINT -#include "gmock/internal/gmock-port.h" -#include "gtest/gtest.h" - -namespace testing { - -// To implement a cardinality Foo, define: -// 1. a class FooCardinality that implements the -// CardinalityInterface interface, and -// 2. a factory function that creates a Cardinality object from a -// const FooCardinality*. -// -// The two-level delegation design follows that of Matcher, providing -// consistency for extension developers. It also eases ownership -// management as Cardinality objects can now be copied like plain values. - -// The implementation of a cardinality. -class CardinalityInterface { - public: - virtual ~CardinalityInterface() {} - - // Conservative estimate on the lower/upper bound of the number of - // calls allowed. - virtual int ConservativeLowerBound() const { return 0; } - virtual int ConservativeUpperBound() const { return INT_MAX; } - - // Returns true iff call_count calls will satisfy this cardinality. - virtual bool IsSatisfiedByCallCount(int call_count) const = 0; - - // Returns true iff call_count calls will saturate this cardinality. - virtual bool IsSaturatedByCallCount(int call_count) const = 0; - - // Describes self to an ostream. - virtual void DescribeTo(::std::ostream* os) const = 0; -}; - -// A Cardinality is a copyable and IMMUTABLE (except by assignment) -// object that specifies how many times a mock function is expected to -// be called. The implementation of Cardinality is just a linked_ptr -// to const CardinalityInterface, so copying is fairly cheap. -// Don't inherit from Cardinality! -class GTEST_API_ Cardinality { - public: - // Constructs a null cardinality. Needed for storing Cardinality - // objects in STL containers. - Cardinality() {} - - // Constructs a Cardinality from its implementation. - explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {} - - // Conservative estimate on the lower/upper bound of the number of - // calls allowed. - int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); } - int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); } - - // Returns true iff call_count calls will satisfy this cardinality. - bool IsSatisfiedByCallCount(int call_count) const { - return impl_->IsSatisfiedByCallCount(call_count); - } - - // Returns true iff call_count calls will saturate this cardinality. - bool IsSaturatedByCallCount(int call_count) const { - return impl_->IsSaturatedByCallCount(call_count); - } - - // Returns true iff call_count calls will over-saturate this - // cardinality, i.e. exceed the maximum number of allowed calls. - bool IsOverSaturatedByCallCount(int call_count) const { - return impl_->IsSaturatedByCallCount(call_count) && - !impl_->IsSatisfiedByCallCount(call_count); - } - - // Describes self to an ostream - void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } - - // Describes the given actual call count to an ostream. - static void DescribeActualCallCountTo(int actual_call_count, - ::std::ostream* os); - - private: - internal::linked_ptr impl_; -}; - -// Creates a cardinality that allows at least n calls. -GTEST_API_ Cardinality AtLeast(int n); - -// Creates a cardinality that allows at most n calls. -GTEST_API_ Cardinality AtMost(int n); - -// Creates a cardinality that allows any number of calls. -GTEST_API_ Cardinality AnyNumber(); - -// Creates a cardinality that allows between min and max calls. -GTEST_API_ Cardinality Between(int min, int max); - -// Creates a cardinality that allows exactly n calls. -GTEST_API_ Cardinality Exactly(int n); - -// Creates a cardinality from its implementation. -inline Cardinality MakeCardinality(const CardinalityInterface* c) { - return Cardinality(c); -} - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-actions.h b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-actions.h deleted file mode 100644 index b5a889c0c3a..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-actions.h +++ /dev/null @@ -1,2377 +0,0 @@ -// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! - -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used variadic actions. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ - -#include "gmock/gmock-actions.h" -#include "gmock/internal/gmock-port.h" - -namespace testing { -namespace internal { - -// InvokeHelper knows how to unpack an N-tuple and invoke an N-ary -// function or method with the unpacked values, where F is a function -// type that takes N arguments. -template -class InvokeHelper; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple<>&) { - return function(); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple<>&) { - return (obj_ptr->*method_ptr)(); - } -}; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args)); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args)); - } -}; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args)); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args)); - } -}; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args)); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args)); - } -}; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args)); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args)); - } -}; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args)); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args)); - } -}; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args), get<5>(args)); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args), get<5>(args)); - } -}; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args), get<5>(args), get<6>(args)); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args), get<5>(args), - get<6>(args)); - } -}; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args), get<5>(args), get<6>(args), - get<7>(args)); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args), get<5>(args), - get<6>(args), get<7>(args)); - } -}; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args), get<5>(args), get<6>(args), - get<7>(args), get<8>(args)); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args), get<5>(args), - get<6>(args), get<7>(args), get<8>(args)); - } -}; - -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple& args) { - return function(get<0>(args), get<1>(args), get<2>(args), - get<3>(args), get<4>(args), get<5>(args), get<6>(args), - get<7>(args), get<8>(args), get<9>(args)); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple& args) { - return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), - get<2>(args), get<3>(args), get<4>(args), get<5>(args), - get<6>(args), get<7>(args), get<8>(args), get<9>(args)); - } -}; - -// An INTERNAL macro for extracting the type of a tuple field. It's -// subject to change without notice - DO NOT USE IN USER CODE! -#define GMOCK_FIELD_(Tuple, N) \ - typename ::testing::tuple_element::type - -// SelectArgs::type is the -// type of an n-ary function whose i-th (1-based) argument type is the -// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple -// type, and whose return type is Result. For example, -// SelectArgs, 0, 3>::type -// is int(bool, long). -// -// SelectArgs::Select(args) -// returns the selected fields (k1, k2, ..., k_n) of args as a tuple. -// For example, -// SelectArgs, 2, 0>::Select( -// ::testing::make_tuple(true, 'a', 2.5)) -// returns tuple (2.5, true). -// -// The numbers in list k1, k2, ..., k_n must be >= 0, where n can be -// in the range [0, 10]. Duplicates are allowed and they don't have -// to be in an ascending or descending order. - -template -class SelectArgs { - public: - typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), - GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), - GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), - GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), - GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9), - GMOCK_FIELD_(ArgumentTuple, k10)); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args), get(args), get(args), - get(args), get(args), get(args)); - } -}; - -template -class SelectArgs { - public: - typedef Result type(); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& /* args */) { - return SelectedArgs(); - } -}; - -template -class SelectArgs { - public: - typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1)); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args)); - } -}; - -template -class SelectArgs { - public: - typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), - GMOCK_FIELD_(ArgumentTuple, k2)); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args)); - } -}; - -template -class SelectArgs { - public: - typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), - GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3)); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args)); - } -}; - -template -class SelectArgs { - public: - typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), - GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), - GMOCK_FIELD_(ArgumentTuple, k4)); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args)); - } -}; - -template -class SelectArgs { - public: - typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), - GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), - GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5)); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args)); - } -}; - -template -class SelectArgs { - public: - typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), - GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), - GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), - GMOCK_FIELD_(ArgumentTuple, k6)); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args), get(args)); - } -}; - -template -class SelectArgs { - public: - typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), - GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), - GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), - GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7)); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args), get(args), get(args)); - } -}; - -template -class SelectArgs { - public: - typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), - GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), - GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), - GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), - GMOCK_FIELD_(ArgumentTuple, k8)); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args), get(args), get(args), - get(args)); - } -}; - -template -class SelectArgs { - public: - typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), - GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), - GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), - GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), - GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9)); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs(get(args), get(args), get(args), - get(args), get(args), get(args), get(args), - get(args), get(args)); - } -}; - -#undef GMOCK_FIELD_ - -// Implements the WithArgs action. -template -class WithArgsAction { - public: - explicit WithArgsAction(const InnerAction& action) : action_(action) {} - - template - operator Action() const { return MakeAction(new Impl(action_)); } - - private: - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - explicit Impl(const InnerAction& action) : action_(action) {} - - virtual Result Perform(const ArgumentTuple& args) { - return action_.Perform(SelectArgs::Select(args)); - } - - private: - typedef typename SelectArgs::type InnerFunctionType; - - Action action_; - }; - - const InnerAction action_; - - GTEST_DISALLOW_ASSIGN_(WithArgsAction); -}; - -// A macro from the ACTION* family (defined later in this file) -// defines an action that can be used in a mock function. Typically, -// these actions only care about a subset of the arguments of the mock -// function. For example, if such an action only uses the second -// argument, it can be used in any mock function that takes >= 2 -// arguments where the type of the second argument is compatible. -// -// Therefore, the action implementation must be prepared to take more -// arguments than it needs. The ExcessiveArg type is used to -// represent those excessive arguments. In order to keep the compiler -// error messages tractable, we define it in the testing namespace -// instead of testing::internal. However, this is an INTERNAL TYPE -// and subject to change without notice, so a user MUST NOT USE THIS -// TYPE DIRECTLY. -struct ExcessiveArg {}; - -// A helper class needed for implementing the ACTION* macros. -template -class ActionHelper { - public: - static Result Perform(Impl* impl, const ::testing::tuple<>& args) { - return impl->template gmock_PerformImpl<>(args, ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), - get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), - get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), - get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, - get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, - get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), - get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, - get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), - get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), - get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(), - ExcessiveArg()); - } - - template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), - get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), - ExcessiveArg()); - } - - template - static Result Perform(Impl* impl, const ::testing::tuple& args) { - return impl->template gmock_PerformImpl(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), - get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), - get<9>(args)); - } -}; - -} // namespace internal - -// Various overloads for Invoke(). - -// WithArgs(an_action) creates an action that passes -// the selected arguments of the mock function to an_action and -// performs it. It serves as an adaptor between actions with -// different argument lists. C++ doesn't support default arguments for -// function templates, so we have to overload it. -template -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - -template -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - -template -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - -template -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - -template -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - -template -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - -template -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - -template -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - -template -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - -template -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - -// Creates an action that does actions a1, a2, ..., sequentially in -// each invocation. -template -inline internal::DoBothAction -DoAll(Action1 a1, Action2 a2) { - return internal::DoBothAction(a1, a2); -} - -template -inline internal::DoBothAction > -DoAll(Action1 a1, Action2 a2, Action3 a3) { - return DoAll(a1, DoAll(a2, a3)); -} - -template -inline internal::DoBothAction > > -DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) { - return DoAll(a1, DoAll(a2, a3, a4)); -} - -template -inline internal::DoBothAction > > > -DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) { - return DoAll(a1, DoAll(a2, a3, a4, a5)); -} - -template -inline internal::DoBothAction > > > > -DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) { - return DoAll(a1, DoAll(a2, a3, a4, a5, a6)); -} - -template -inline internal::DoBothAction > > > > > -DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, - Action7 a7) { - return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7)); -} - -template -inline internal::DoBothAction > > > > > > -DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, - Action7 a7, Action8 a8) { - return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8)); -} - -template -inline internal::DoBothAction > > > > > > > -DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, - Action7 a7, Action8 a8, Action9 a9) { - return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9)); -} - -template -inline internal::DoBothAction > > > > > > > > -DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, - Action7 a7, Action8 a8, Action9 a9, Action10 a10) { - return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10)); -} - -} // namespace testing - -// The ACTION* family of macros can be used in a namespace scope to -// define custom actions easily. The syntax: -// -// ACTION(name) { statements; } -// -// will define an action with the given name that executes the -// statements. The value returned by the statements will be used as -// the return value of the action. Inside the statements, you can -// refer to the K-th (0-based) argument of the mock function by -// 'argK', and refer to its type by 'argK_type'. For example: -// -// ACTION(IncrementArg1) { -// arg1_type temp = arg1; -// return ++(*temp); -// } -// -// allows you to write -// -// ...WillOnce(IncrementArg1()); -// -// You can also refer to the entire argument tuple and its type by -// 'args' and 'args_type', and refer to the mock function type and its -// return type by 'function_type' and 'return_type'. -// -// Note that you don't need to specify the types of the mock function -// arguments. However rest assured that your code is still type-safe: -// you'll get a compiler error if *arg1 doesn't support the ++ -// operator, or if the type of ++(*arg1) isn't compatible with the -// mock function's return type, for example. -// -// Sometimes you'll want to parameterize the action. For that you can use -// another macro: -// -// ACTION_P(name, param_name) { statements; } -// -// For example: -// -// ACTION_P(Add, n) { return arg0 + n; } -// -// will allow you to write: -// -// ...WillOnce(Add(5)); -// -// Note that you don't need to provide the type of the parameter -// either. If you need to reference the type of a parameter named -// 'foo', you can write 'foo_type'. For example, in the body of -// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type -// of 'n'. -// -// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support -// multi-parameter actions. -// -// For the purpose of typing, you can view -// -// ACTION_Pk(Foo, p1, ..., pk) { ... } -// -// as shorthand for -// -// template -// FooActionPk Foo(p1_type p1, ..., pk_type pk) { ... } -// -// In particular, you can provide the template type arguments -// explicitly when invoking Foo(), as in Foo(5, false); -// although usually you can rely on the compiler to infer the types -// for you automatically. You can assign the result of expression -// Foo(p1, ..., pk) to a variable of type FooActionPk. This can be useful when composing actions. -// -// You can also overload actions with different numbers of parameters: -// -// ACTION_P(Plus, a) { ... } -// ACTION_P2(Plus, a, b) { ... } -// -// While it's tempting to always use the ACTION* macros when defining -// a new action, you should also consider implementing ActionInterface -// or using MakePolymorphicAction() instead, especially if you need to -// use the action a lot. While these approaches require more work, -// they give you more control on the types of the mock function -// arguments and the action parameters, which in general leads to -// better compiler error messages that pay off in the long run. They -// also allow overloading actions based on parameter types (as opposed -// to just based on the number of parameters). -// -// CAVEAT: -// -// ACTION*() can only be used in a namespace scope. The reason is -// that C++ doesn't yet allow function-local types to be used to -// instantiate templates. The up-coming C++0x standard will fix this. -// Once that's done, we'll consider supporting using ACTION*() inside -// a function. -// -// MORE INFORMATION: -// -// To learn more about using these macros, please search for 'ACTION' -// on http://code.google.com/p/googlemock/wiki/CookBook. - -// An internal macro needed for implementing ACTION*(). -#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ - const args_type& args GTEST_ATTRIBUTE_UNUSED_, \ - arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_, \ - arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_, \ - arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_, \ - arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_, \ - arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_, \ - arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_, \ - arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_, \ - arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_, \ - arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_, \ - arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_ - -// Sometimes you want to give an action explicit template parameters -// that cannot be inferred from its value parameters. ACTION() and -// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that -// and can be viewed as an extension to ACTION() and ACTION_P*(). -// -// The syntax: -// -// ACTION_TEMPLATE(ActionName, -// HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), -// AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } -// -// defines an action template that takes m explicit template -// parameters and n value parameters. name_i is the name of the i-th -// template parameter, and kind_i specifies whether it's a typename, -// an integral constant, or a template. p_i is the name of the i-th -// value parameter. -// -// Example: -// -// // DuplicateArg(output) converts the k-th argument of the mock -// // function to type T and copies it to *output. -// ACTION_TEMPLATE(DuplicateArg, -// HAS_2_TEMPLATE_PARAMS(int, k, typename, T), -// AND_1_VALUE_PARAMS(output)) { -// *output = T(::testing::get(args)); -// } -// ... -// int n; -// EXPECT_CALL(mock, Foo(_, _)) -// .WillOnce(DuplicateArg<1, unsigned char>(&n)); -// -// To create an instance of an action template, write: -// -// ActionName(v1, ..., v_n) -// -// where the ts are the template arguments and the vs are the value -// arguments. The value argument types are inferred by the compiler. -// If you want to explicitly specify the value argument types, you can -// provide additional template arguments: -// -// ActionName(v1, ..., v_n) -// -// where u_i is the desired type of v_i. -// -// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the -// number of value parameters, but not on the number of template -// parameters. Without the restriction, the meaning of the following -// is unclear: -// -// OverloadedAction(x); -// -// Are we using a single-template-parameter action where 'bool' refers -// to the type of x, or are we using a two-template-parameter action -// where the compiler is asked to infer the type of x? -// -// Implementation notes: -// -// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and -// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for -// implementing ACTION_TEMPLATE. The main trick we use is to create -// new macro invocations when expanding a macro. For example, we have -// -// #define ACTION_TEMPLATE(name, template_params, value_params) -// ... GMOCK_INTERNAL_DECL_##template_params ... -// -// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...) -// to expand to -// -// ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ... -// -// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the -// preprocessor will continue to expand it to -// -// ... typename T ... -// -// This technique conforms to the C++ standard and is portable. It -// allows us to implement action templates using O(N) code, where N is -// the maximum number of template/value parameters supported. Without -// using it, we'd have to devote O(N^2) amount of code to implement all -// combinations of m and n. - -// Declares the template parameters. -#define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0 -#define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1) kind0 name0, kind1 name1 -#define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2) kind0 name0, kind1 name1, kind2 name2 -#define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \ - kind3 name3 -#define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \ - kind2 name2, kind3 name3, kind4 name4 -#define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \ - kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5 -#define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ - kind5 name5, kind6 name6 -#define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \ - kind4 name4, kind5 name5, kind6 name6, kind7 name7 -#define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \ - kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \ - kind8 name8 -#define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \ - kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \ - kind6 name6, kind7 name7, kind8 name8, kind9 name9 - -// Lists the template parameters. -#define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0 -#define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1) name0, name1 -#define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2) name0, name1, name2 -#define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3) name0, name1, name2, name3 -#define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \ - name4 -#define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \ - name2, name3, name4, name5 -#define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6) name0, name1, name2, name3, name4, name5, name6 -#define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7 -#define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \ - name6, name7, name8 -#define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \ - name3, name4, name5, name6, name7, name8, name9 - -// Declares the types of value parameters. -#define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \ - typename p0##_type, typename p1##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \ - typename p0##_type, typename p1##_type, typename p2##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ - typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ - typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ - typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) , typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \ - typename p2##_type, typename p3##_type, typename p4##_type, \ - typename p5##_type, typename p6##_type, typename p7##_type, \ - typename p8##_type, typename p9##_type - -// Initializes the value parameters. -#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ - () -#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ - (p0##_type gmock_p0) : p0(gmock_p0) -#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ - (p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1) -#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ - (p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) -#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3) -#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \ - p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) -#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) -#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) -#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \ - p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ - p7(gmock_p7) -#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ - p8(gmock_p8) -#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ - p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ - p8(gmock_p8), p9(gmock_p9) - -// Declares the fields for storing the value parameters. -#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0; -#define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \ - p1##_type p1; -#define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \ - p1##_type p1; p2##_type p2; -#define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \ - p1##_type p1; p2##_type p2; p3##_type p3; -#define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ - p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; -#define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ - p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ - p5##_type p5; -#define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ - p5##_type p5; p6##_type p6; -#define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ - p5##_type p5; p6##_type p6; p7##_type p7; -#define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ - p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; -#define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ - p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \ - p9##_type p9; - -// Lists the value parameters. -#define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0 -#define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1 -#define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2 -#define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3 -#define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \ - p2, p3, p4 -#define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \ - p1, p2, p3, p4, p5 -#define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) p0, p1, p2, p3, p4, p5, p6 -#define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) p0, p1, p2, p3, p4, p5, p6, p7 -#define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8 -#define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 - -// Lists the value parameter types. -#define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \ - p1##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \ - p1##_type, p2##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ - p0##_type, p1##_type, p2##_type, p3##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ - p0##_type, p1##_type, p2##_type, p3##_type, p4##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ - p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \ - p6##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, p8##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, p8##_type, p9##_type - -// Declares the value parameters. -#define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0 -#define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \ - p1##_type p1 -#define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \ - p1##_type p1, p2##_type p2 -#define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \ - p1##_type p1, p2##_type p2, p3##_type p3 -#define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ - p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4 -#define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ - p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ - p5##_type p5 -#define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ - p5##_type p5, p6##_type p6 -#define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ - p5##_type p5, p6##_type p6, p7##_type p7 -#define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8 -#define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ - p9##_type p9 - -// The suffix of the class template implementing the action template. -#define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P -#define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2 -#define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3 -#define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4 -#define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5 -#define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6 -#define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7 -#define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) P8 -#define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) P9 -#define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) P10 - -// The name of the class template implementing the action template. -#define GMOCK_ACTION_CLASS_(name, value_params)\ - GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) - -#define ACTION_TEMPLATE(name, template_params, value_params)\ - template \ - class GMOCK_ACTION_CLASS_(name, value_params) {\ - public:\ - explicit GMOCK_ACTION_CLASS_(name, value_params)\ - GMOCK_INTERNAL_INIT_##value_params {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - GMOCK_INTERNAL_DEFN_##value_params\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(\ - new gmock_Impl(GMOCK_INTERNAL_LIST_##value_params));\ - }\ - GMOCK_INTERNAL_DEFN_##value_params\ - private:\ - GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\ - };\ - template \ - inline GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ - GMOCK_INTERNAL_DECL_##value_params) {\ - return GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ - GMOCK_INTERNAL_LIST_##value_params);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl::\ - gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION(name)\ - class name##Action {\ - public:\ - name##Action() {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - gmock_Impl() {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl());\ - }\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##Action);\ - };\ - inline name##Action name() {\ - return name##Action();\ - }\ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##Action::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P(name, p0)\ - template \ - class name##ActionP {\ - public:\ - explicit name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - p0##_type p0;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl(p0));\ - }\ - p0##_type p0;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP);\ - };\ - template \ - inline name##ActionP name(p0##_type p0) {\ - return name##ActionP(p0);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##ActionP::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P2(name, p0, p1)\ - template \ - class name##ActionP2 {\ - public:\ - name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ - p1(gmock_p1) {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ - p1(gmock_p1) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl(p0, p1));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP2);\ - };\ - template \ - inline name##ActionP2 name(p0##_type p0, \ - p1##_type p1) {\ - return name##ActionP2(p0, p1);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##ActionP2::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P3(name, p0, p1, p2)\ - template \ - class name##ActionP3 {\ - public:\ - name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl(p0, p1, p2));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP3);\ - };\ - template \ - inline name##ActionP3 name(p0##_type p0, \ - p1##_type p1, p2##_type p2) {\ - return name##ActionP3(p0, p1, p2);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##ActionP3::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P4(name, p0, p1, p2, p3)\ - template \ - class name##ActionP4 {\ - public:\ - name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ - p2(gmock_p2), p3(gmock_p3) {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl(p0, p1, p2, p3));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP4);\ - };\ - template \ - inline name##ActionP4 name(p0##_type p0, p1##_type p1, p2##_type p2, \ - p3##_type p3) {\ - return name##ActionP4(p0, p1, \ - p2, p3);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##ActionP4::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P5(name, p0, p1, p2, p3, p4)\ - template \ - class name##ActionP5 {\ - public:\ - name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, \ - p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4) {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \ - p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP5);\ - };\ - template \ - inline name##ActionP5 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4) {\ - return name##ActionP5(p0, p1, p2, p3, p4);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##ActionP5::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\ - template \ - class name##ActionP6 {\ - public:\ - name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4, p5));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP6);\ - };\ - template \ - inline name##ActionP6 name(p0##_type p0, p1##_type p1, p2##_type p2, \ - p3##_type p3, p4##_type p4, p5##_type p5) {\ - return name##ActionP6(p0, p1, p2, p3, p4, p5);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##ActionP6::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\ - template \ - class name##ActionP7 {\ - public:\ - name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ - p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ - p6(gmock_p6) {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4, p5, \ - p6));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP7);\ - };\ - template \ - inline name##ActionP7 name(p0##_type p0, p1##_type p1, \ - p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ - p6##_type p6) {\ - return name##ActionP7(p0, p1, p2, p3, p4, p5, p6);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##ActionP7::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\ - template \ - class name##ActionP8 {\ - public:\ - name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, \ - p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ - p7(gmock_p7) {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \ - p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \ - p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4, p5, \ - p6, p7));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP8);\ - };\ - template \ - inline name##ActionP8 name(p0##_type p0, \ - p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ - p6##_type p6, p7##_type p7) {\ - return name##ActionP8(p0, p1, p2, p3, p4, p5, \ - p6, p7);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##ActionP8::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ - template \ - class name##ActionP9 {\ - public:\ - name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ - p8(gmock_p8) {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ - p7(gmock_p7), p8(gmock_p8) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP9);\ - };\ - template \ - inline name##ActionP9 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ - p8##_type p8) {\ - return name##ActionP9(p0, p1, p2, \ - p3, p4, p5, p6, p7, p8);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##ActionP9::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ - template \ - class name##ActionP10 {\ - public:\ - name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ - p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ - p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ - p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ - p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ - arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ - arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ - arg9_type arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - p9##_type p9;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8, p9));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - p9##_type p9;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP10);\ - };\ - template \ - inline name##ActionP10 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ - p9##_type p9) {\ - return name##ActionP10(p0, \ - p1, p2, p3, p4, p5, p6, p7, p8, p9);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - name##ActionP10::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -namespace testing { - - -// The ACTION*() macros trigger warning C4100 (unreferenced formal -// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in -// the macro definition, as the warnings are generated when the macro -// is expanded and macro expansion cannot contain #pragma. Therefore -// we suppress them here. -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -#endif - -// Various overloads for InvokeArgument(). -// -// The InvokeArgument(a1, a2, ..., a_k) action invokes the N-th -// (0-based) argument, which must be a k-ary callable, of the mock -// function, with arguments a1, a2, ..., a_k. -// -// Notes: -// -// 1. The arguments are passed by value by default. If you need to -// pass an argument by reference, wrap it inside ByRef(). For -// example, -// -// InvokeArgument<1>(5, string("Hello"), ByRef(foo)) -// -// passes 5 and string("Hello") by value, and passes foo by -// reference. -// -// 2. If the callable takes an argument by reference but ByRef() is -// not used, it will receive the reference to a copy of the value, -// instead of the original value. For example, when the 0-th -// argument of the mock function takes a const string&, the action -// -// InvokeArgument<0>(string("Hello")) -// -// makes a copy of the temporary string("Hello") object and passes a -// reference of the copy, instead of the original temporary object, -// to the callable. This makes it easy for a user to define an -// InvokeArgument action from temporary values and have it performed -// later. - -namespace internal { -namespace invoke_argument { - -// Appears in InvokeArgumentAdl's argument list to help avoid -// accidental calls to user functions of the same name. -struct AdlTag {}; - -// InvokeArgumentAdl - a helper for InvokeArgument. -// The basic overloads are provided here for generic functors. -// Overloads for other custom-callables are provided in the -// internal/custom/callback-actions.h header. - -template -R InvokeArgumentAdl(AdlTag, F f) { - return f(); -} -template -R InvokeArgumentAdl(AdlTag, F f, A1 a1) { - return f(a1); -} -template -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2) { - return f(a1, a2); -} -template -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3) { - return f(a1, a2, a3); -} -template -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4) { - return f(a1, a2, a3, a4); -} -template -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - return f(a1, a2, a3, a4, a5); -} -template -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - return f(a1, a2, a3, a4, a5, a6); -} -template -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, - A7 a7) { - return f(a1, a2, a3, a4, a5, a6, a7); -} -template -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, - A7 a7, A8 a8) { - return f(a1, a2, a3, a4, a5, a6, a7, a8); -} -template -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, - A7 a7, A8 a8, A9 a9) { - return f(a1, a2, a3, a4, a5, a6, a7, a8, a9); -} -template -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, - A7 a7, A8 a8, A9 a9, A10 a10) { - return f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); -} -} // namespace invoke_argument -} // namespace internal - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_0_VALUE_PARAMS()) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args)); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_1_VALUE_PARAMS(p0)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args), p0); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_2_VALUE_PARAMS(p0, p1)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_3_VALUE_PARAMS(p0, p1, p2)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4, p5); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4, p5, p6); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4, p5, p6, p7); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4, p5, p6, p7, p8); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); -} - -// Various overloads for ReturnNew(). -// -// The ReturnNew(a1, a2, ..., a_k) action returns a pointer to a new -// instance of type T, constructed on the heap with constructor arguments -// a1, a2, ..., and a_k. The caller assumes ownership of the returned value. -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_0_VALUE_PARAMS()) { - return new T(); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_1_VALUE_PARAMS(p0)) { - return new T(p0); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_2_VALUE_PARAMS(p0, p1)) { - return new T(p0, p1); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_3_VALUE_PARAMS(p0, p1, p2)) { - return new T(p0, p1, p2); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { - return new T(p0, p1, p2, p3); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { - return new T(p0, p1, p2, p3, p4); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { - return new T(p0, p1, p2, p3, p4, p5); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { - return new T(p0, p1, p2, p3, p4, p5, p6); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { - return new T(p0, p1, p2, p3, p4, p5, p6, p7); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { - return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { - return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); -} - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -} // namespace testing - -// Include any custom actions added by the local installation. -// We must include this header at the end to make sure it can use the -// declarations from this file. -#include "gmock/internal/custom/gmock-generated-actions.h" - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump deleted file mode 100644 index 66d9f9d551b..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +++ /dev/null @@ -1,794 +0,0 @@ -$$ -*- mode: c++; -*- -$$ This is a Pump source file. Please use Pump to convert it to -$$ gmock-generated-actions.h. -$$ -$var n = 10 $$ The maximum arity we support. -$$}} This meta comment fixes auto-indentation in editors. -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used variadic actions. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ - -#include "gmock/gmock-actions.h" -#include "gmock/internal/gmock-port.h" - -namespace testing { -namespace internal { - -// InvokeHelper knows how to unpack an N-tuple and invoke an N-ary -// function or method with the unpacked values, where F is a function -// type that takes N arguments. -template -class InvokeHelper; - - -$range i 0..n -$for i [[ -$range j 1..i -$var types = [[$for j [[, typename A$j]]]] -$var as = [[$for j, [[A$j]]]] -$var args = [[$if i==0 [[]] $else [[ args]]]] -$var gets = [[$for j, [[get<$(j - 1)>(args)]]]] -template -class InvokeHelper > { - public: - template - static R Invoke(Function function, const ::testing::tuple<$as>&$args) { - return function($gets); - } - - template - static R InvokeMethod(Class* obj_ptr, - MethodPtr method_ptr, - const ::testing::tuple<$as>&$args) { - return (obj_ptr->*method_ptr)($gets); - } -}; - - -]] -// An INTERNAL macro for extracting the type of a tuple field. It's -// subject to change without notice - DO NOT USE IN USER CODE! -#define GMOCK_FIELD_(Tuple, N) \ - typename ::testing::tuple_element::type - -$range i 1..n - -// SelectArgs::type is the -// type of an n-ary function whose i-th (1-based) argument type is the -// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple -// type, and whose return type is Result. For example, -// SelectArgs, 0, 3>::type -// is int(bool, long). -// -// SelectArgs::Select(args) -// returns the selected fields (k1, k2, ..., k_n) of args as a tuple. -// For example, -// SelectArgs, 2, 0>::Select( -// ::testing::make_tuple(true, 'a', 2.5)) -// returns tuple (2.5, true). -// -// The numbers in list k1, k2, ..., k_n must be >= 0, where n can be -// in the range [0, $n]. Duplicates are allowed and they don't have -// to be in an ascending or descending order. - -template -class SelectArgs { - public: - typedef Result type($for i, [[GMOCK_FIELD_(ArgumentTuple, k$i)]]); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& args) { - return SelectedArgs($for i, [[get(args)]]); - } -}; - - -$for i [[ -$range j 1..n -$range j1 1..i-1 -template -class SelectArgs { - public: - typedef Result type($for j1, [[GMOCK_FIELD_(ArgumentTuple, k$j1)]]); - typedef typename Function::ArgumentTuple SelectedArgs; - static SelectedArgs Select(const ArgumentTuple& [[]] -$if i == 1 [[/* args */]] $else [[args]]) { - return SelectedArgs($for j1, [[get(args)]]); - } -}; - - -]] -#undef GMOCK_FIELD_ - -$var ks = [[$for i, [[k$i]]]] - -// Implements the WithArgs action. -template -class WithArgsAction { - public: - explicit WithArgsAction(const InnerAction& action) : action_(action) {} - - template - operator Action() const { return MakeAction(new Impl(action_)); } - - private: - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - explicit Impl(const InnerAction& action) : action_(action) {} - - virtual Result Perform(const ArgumentTuple& args) { - return action_.Perform(SelectArgs::Select(args)); - } - - private: - typedef typename SelectArgs::type InnerFunctionType; - - Action action_; - }; - - const InnerAction action_; - - GTEST_DISALLOW_ASSIGN_(WithArgsAction); -}; - -// A macro from the ACTION* family (defined later in this file) -// defines an action that can be used in a mock function. Typically, -// these actions only care about a subset of the arguments of the mock -// function. For example, if such an action only uses the second -// argument, it can be used in any mock function that takes >= 2 -// arguments where the type of the second argument is compatible. -// -// Therefore, the action implementation must be prepared to take more -// arguments than it needs. The ExcessiveArg type is used to -// represent those excessive arguments. In order to keep the compiler -// error messages tractable, we define it in the testing namespace -// instead of testing::internal. However, this is an INTERNAL TYPE -// and subject to change without notice, so a user MUST NOT USE THIS -// TYPE DIRECTLY. -struct ExcessiveArg {}; - -// A helper class needed for implementing the ACTION* macros. -template -class ActionHelper { - public: -$range i 0..n -$for i - -[[ -$var template = [[$if i==0 [[]] $else [[ -$range j 0..i-1 - template <$for j, [[typename A$j]]> -]]]] -$range j 0..i-1 -$var As = [[$for j, [[A$j]]]] -$var as = [[$for j, [[get<$j>(args)]]]] -$range k 1..n-i -$var eas = [[$for k, [[ExcessiveArg()]]]] -$var arg_list = [[$if (i==0) | (i==n) [[$as$eas]] $else [[$as, $eas]]]] -$template - static Result Perform(Impl* impl, const ::testing::tuple<$As>& args) { - return impl->template gmock_PerformImpl<$As>(args, $arg_list); - } - -]] -}; - -} // namespace internal - -// Various overloads for Invoke(). - -// WithArgs(an_action) creates an action that passes -// the selected arguments of the mock function to an_action and -// performs it. It serves as an adaptor between actions with -// different argument lists. C++ doesn't support default arguments for -// function templates, so we have to overload it. - -$range i 1..n -$for i [[ -$range j 1..i -template <$for j [[int k$j, ]]typename InnerAction> -inline internal::WithArgsAction -WithArgs(const InnerAction& action) { - return internal::WithArgsAction(action); -} - - -]] -// Creates an action that does actions a1, a2, ..., sequentially in -// each invocation. -$range i 2..n -$for i [[ -$range j 2..i -$var types = [[$for j, [[typename Action$j]]]] -$var Aas = [[$for j [[, Action$j a$j]]]] - -template -$range k 1..i-1 - -inline $for k [[internal::DoBothAction]] - -DoAll(Action1 a1$Aas) { -$if i==2 [[ - - return internal::DoBothAction(a1, a2); -]] $else [[ -$range j2 2..i - - return DoAll(a1, DoAll($for j2, [[a$j2]])); -]] - -} - -]] - -} // namespace testing - -// The ACTION* family of macros can be used in a namespace scope to -// define custom actions easily. The syntax: -// -// ACTION(name) { statements; } -// -// will define an action with the given name that executes the -// statements. The value returned by the statements will be used as -// the return value of the action. Inside the statements, you can -// refer to the K-th (0-based) argument of the mock function by -// 'argK', and refer to its type by 'argK_type'. For example: -// -// ACTION(IncrementArg1) { -// arg1_type temp = arg1; -// return ++(*temp); -// } -// -// allows you to write -// -// ...WillOnce(IncrementArg1()); -// -// You can also refer to the entire argument tuple and its type by -// 'args' and 'args_type', and refer to the mock function type and its -// return type by 'function_type' and 'return_type'. -// -// Note that you don't need to specify the types of the mock function -// arguments. However rest assured that your code is still type-safe: -// you'll get a compiler error if *arg1 doesn't support the ++ -// operator, or if the type of ++(*arg1) isn't compatible with the -// mock function's return type, for example. -// -// Sometimes you'll want to parameterize the action. For that you can use -// another macro: -// -// ACTION_P(name, param_name) { statements; } -// -// For example: -// -// ACTION_P(Add, n) { return arg0 + n; } -// -// will allow you to write: -// -// ...WillOnce(Add(5)); -// -// Note that you don't need to provide the type of the parameter -// either. If you need to reference the type of a parameter named -// 'foo', you can write 'foo_type'. For example, in the body of -// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type -// of 'n'. -// -// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P$n to support -// multi-parameter actions. -// -// For the purpose of typing, you can view -// -// ACTION_Pk(Foo, p1, ..., pk) { ... } -// -// as shorthand for -// -// template -// FooActionPk Foo(p1_type p1, ..., pk_type pk) { ... } -// -// In particular, you can provide the template type arguments -// explicitly when invoking Foo(), as in Foo(5, false); -// although usually you can rely on the compiler to infer the types -// for you automatically. You can assign the result of expression -// Foo(p1, ..., pk) to a variable of type FooActionPk. This can be useful when composing actions. -// -// You can also overload actions with different numbers of parameters: -// -// ACTION_P(Plus, a) { ... } -// ACTION_P2(Plus, a, b) { ... } -// -// While it's tempting to always use the ACTION* macros when defining -// a new action, you should also consider implementing ActionInterface -// or using MakePolymorphicAction() instead, especially if you need to -// use the action a lot. While these approaches require more work, -// they give you more control on the types of the mock function -// arguments and the action parameters, which in general leads to -// better compiler error messages that pay off in the long run. They -// also allow overloading actions based on parameter types (as opposed -// to just based on the number of parameters). -// -// CAVEAT: -// -// ACTION*() can only be used in a namespace scope. The reason is -// that C++ doesn't yet allow function-local types to be used to -// instantiate templates. The up-coming C++0x standard will fix this. -// Once that's done, we'll consider supporting using ACTION*() inside -// a function. -// -// MORE INFORMATION: -// -// To learn more about using these macros, please search for 'ACTION' -// on http://code.google.com/p/googlemock/wiki/CookBook. - -$range i 0..n -$range k 0..n-1 - -// An internal macro needed for implementing ACTION*(). -#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ - const args_type& args GTEST_ATTRIBUTE_UNUSED_ -$for k [[, \ - arg$k[[]]_type arg$k GTEST_ATTRIBUTE_UNUSED_]] - - -// Sometimes you want to give an action explicit template parameters -// that cannot be inferred from its value parameters. ACTION() and -// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that -// and can be viewed as an extension to ACTION() and ACTION_P*(). -// -// The syntax: -// -// ACTION_TEMPLATE(ActionName, -// HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), -// AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } -// -// defines an action template that takes m explicit template -// parameters and n value parameters. name_i is the name of the i-th -// template parameter, and kind_i specifies whether it's a typename, -// an integral constant, or a template. p_i is the name of the i-th -// value parameter. -// -// Example: -// -// // DuplicateArg(output) converts the k-th argument of the mock -// // function to type T and copies it to *output. -// ACTION_TEMPLATE(DuplicateArg, -// HAS_2_TEMPLATE_PARAMS(int, k, typename, T), -// AND_1_VALUE_PARAMS(output)) { -// *output = T(::testing::get(args)); -// } -// ... -// int n; -// EXPECT_CALL(mock, Foo(_, _)) -// .WillOnce(DuplicateArg<1, unsigned char>(&n)); -// -// To create an instance of an action template, write: -// -// ActionName(v1, ..., v_n) -// -// where the ts are the template arguments and the vs are the value -// arguments. The value argument types are inferred by the compiler. -// If you want to explicitly specify the value argument types, you can -// provide additional template arguments: -// -// ActionName(v1, ..., v_n) -// -// where u_i is the desired type of v_i. -// -// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the -// number of value parameters, but not on the number of template -// parameters. Without the restriction, the meaning of the following -// is unclear: -// -// OverloadedAction(x); -// -// Are we using a single-template-parameter action where 'bool' refers -// to the type of x, or are we using a two-template-parameter action -// where the compiler is asked to infer the type of x? -// -// Implementation notes: -// -// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and -// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for -// implementing ACTION_TEMPLATE. The main trick we use is to create -// new macro invocations when expanding a macro. For example, we have -// -// #define ACTION_TEMPLATE(name, template_params, value_params) -// ... GMOCK_INTERNAL_DECL_##template_params ... -// -// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...) -// to expand to -// -// ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ... -// -// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the -// preprocessor will continue to expand it to -// -// ... typename T ... -// -// This technique conforms to the C++ standard and is portable. It -// allows us to implement action templates using O(N) code, where N is -// the maximum number of template/value parameters supported. Without -// using it, we'd have to devote O(N^2) amount of code to implement all -// combinations of m and n. - -// Declares the template parameters. - -$range j 1..n -$for j [[ -$range m 0..j-1 -#define GMOCK_INTERNAL_DECL_HAS_$j[[]] -_TEMPLATE_PARAMS($for m, [[kind$m, name$m]]) $for m, [[kind$m name$m]] - - -]] - -// Lists the template parameters. - -$for j [[ -$range m 0..j-1 -#define GMOCK_INTERNAL_LIST_HAS_$j[[]] -_TEMPLATE_PARAMS($for m, [[kind$m, name$m]]) $for m, [[name$m]] - - -]] - -// Declares the types of value parameters. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_DECL_TYPE_AND_$i[[]] -_VALUE_PARAMS($for j, [[p$j]]) $for j [[, typename p$j##_type]] - - -]] - -// Initializes the value parameters. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\ - ($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(gmock_p$j)]] - - -]] - -// Declares the fields for storing the value parameters. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_DEFN_AND_$i[[]] -_VALUE_PARAMS($for j, [[p$j]]) $for j [[p$j##_type p$j; ]] - - -]] - -// Lists the value parameters. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_LIST_AND_$i[[]] -_VALUE_PARAMS($for j, [[p$j]]) $for j, [[p$j]] - - -]] - -// Lists the value parameter types. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_LIST_TYPE_AND_$i[[]] -_VALUE_PARAMS($for j, [[p$j]]) $for j [[, p$j##_type]] - - -]] - -// Declares the value parameters. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_DECL_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]]) [[]] -$for j, [[p$j##_type p$j]] - - -]] - -// The suffix of the class template implementing the action template. -$for i [[ - - -$range j 0..i-1 -#define GMOCK_INTERNAL_COUNT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]]) [[]] -$if i==1 [[P]] $elif i>=2 [[P$i]] -]] - - -// The name of the class template implementing the action template. -#define GMOCK_ACTION_CLASS_(name, value_params)\ - GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) - -$range k 0..n-1 - -#define ACTION_TEMPLATE(name, template_params, value_params)\ - template \ - class GMOCK_ACTION_CLASS_(name, value_params) {\ - public:\ - explicit GMOCK_ACTION_CLASS_(name, value_params)\ - GMOCK_INTERNAL_INIT_##value_params {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template <$for k, [[typename arg$k[[]]_type]]>\ - return_type gmock_PerformImpl(const args_type& args[[]] -$for k [[, arg$k[[]]_type arg$k]]) const;\ - GMOCK_INTERNAL_DEFN_##value_params\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(\ - new gmock_Impl(GMOCK_INTERNAL_LIST_##value_params));\ - }\ - GMOCK_INTERNAL_DEFN_##value_params\ - private:\ - GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\ - };\ - template \ - inline GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ - GMOCK_INTERNAL_DECL_##value_params) {\ - return GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ - GMOCK_INTERNAL_LIST_##value_params);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl::\ - gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -$for i - -[[ -$var template = [[$if i==0 [[]] $else [[ -$range j 0..i-1 - - template <$for j, [[typename p$j##_type]]>\ -]]]] -$var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]] - $else [[P$i]]]]]] -$range j 0..i-1 -$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] -$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] -$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] -$var param_field_decls = [[$for j -[[ - - p$j##_type p$j;\ -]]]] -$var param_field_decls2 = [[$for j -[[ - - p$j##_type p$j;\ -]]]] -$var params = [[$for j, [[p$j]]]] -$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] -$var typename_arg_types = [[$for k, [[typename arg$k[[]]_type]]]] -$var arg_types_and_names = [[$for k, [[arg$k[[]]_type arg$k]]]] -$var macro_name = [[$if i==0 [[ACTION]] $elif i==1 [[ACTION_P]] - $else [[ACTION_P$i]]]] - -#define $macro_name(name$for j [[, p$j]])\$template - class $class_name {\ - public:\ - [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - [[$if i==1 [[explicit ]]]]gmock_Impl($ctor_param_list)$inits {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template <$typename_arg_types>\ - return_type gmock_PerformImpl(const args_type& args, [[]] -$arg_types_and_names) const;\$param_field_decls - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(new gmock_Impl($params));\ - }\$param_field_decls2 - private:\ - GTEST_DISALLOW_ASSIGN_($class_name);\ - };\$template - inline $class_name$param_types name($param_types_and_names) {\ - return $class_name$param_types($params);\ - }\$template - template \ - template <$typename_arg_types>\ - typename ::testing::internal::Function::Result\ - $class_name$param_types::gmock_Impl::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const -]] -$$ } // This meta comment fixes auto-indentation in Emacs. It won't -$$ // show up in the generated code. - - -namespace testing { - - -// The ACTION*() macros trigger warning C4100 (unreferenced formal -// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in -// the macro definition, as the warnings are generated when the macro -// is expanded and macro expansion cannot contain #pragma. Therefore -// we suppress them here. -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -#endif - -// Various overloads for InvokeArgument(). -// -// The InvokeArgument(a1, a2, ..., a_k) action invokes the N-th -// (0-based) argument, which must be a k-ary callable, of the mock -// function, with arguments a1, a2, ..., a_k. -// -// Notes: -// -// 1. The arguments are passed by value by default. If you need to -// pass an argument by reference, wrap it inside ByRef(). For -// example, -// -// InvokeArgument<1>(5, string("Hello"), ByRef(foo)) -// -// passes 5 and string("Hello") by value, and passes foo by -// reference. -// -// 2. If the callable takes an argument by reference but ByRef() is -// not used, it will receive the reference to a copy of the value, -// instead of the original value. For example, when the 0-th -// argument of the mock function takes a const string&, the action -// -// InvokeArgument<0>(string("Hello")) -// -// makes a copy of the temporary string("Hello") object and passes a -// reference of the copy, instead of the original temporary object, -// to the callable. This makes it easy for a user to define an -// InvokeArgument action from temporary values and have it performed -// later. - -namespace internal { -namespace invoke_argument { - -// Appears in InvokeArgumentAdl's argument list to help avoid -// accidental calls to user functions of the same name. -struct AdlTag {}; - -// InvokeArgumentAdl - a helper for InvokeArgument. -// The basic overloads are provided here for generic functors. -// Overloads for other custom-callables are provided in the -// internal/custom/callback-actions.h header. - -$range i 0..n -$for i -[[ -$range j 1..i - -template -R InvokeArgumentAdl(AdlTag, F f[[$for j [[, A$j a$j]]]]) { - return f([[$for j, [[a$j]]]]); -} -]] - -} // namespace invoke_argument -} // namespace internal - -$range i 0..n -$for i [[ -$range j 0..i-1 - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl( - internal::invoke_argument::AdlTag(), - ::testing::get(args)$for j [[, p$j]]); -} - -]] - -// Various overloads for ReturnNew(). -// -// The ReturnNew(a1, a2, ..., a_k) action returns a pointer to a new -// instance of type T, constructed on the heap with constructor arguments -// a1, a2, ..., and a_k. The caller assumes ownership of the returned value. -$range i 0..n -$for i [[ -$range j 0..i-1 -$var ps = [[$for j, [[p$j]]]] - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_$i[[]]_VALUE_PARAMS($ps)) { - return new T($ps); -} - -]] - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -} // namespace testing - -// Include any custom callback actions added by the local installation. -// We must include this header at the end to make sure it can use the -// declarations from this file. -#include "gmock/internal/custom/gmock-generated-actions.h" - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h deleted file mode 100644 index c098669c88e..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +++ /dev/null @@ -1,1254 +0,0 @@ -// This file was GENERATED by command: -// pump.py gmock-generated-function-mockers.h.pump -// DO NOT EDIT BY HAND!!! - -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements function mockers of various arities. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ - -#include "gmock/gmock-spec-builders.h" -#include "gmock/internal/gmock-internal-utils.h" - -#if GTEST_HAS_STD_FUNCTION_ -# include -#endif - -namespace testing { -namespace internal { - -template -class FunctionMockerBase; - -// Note: class FunctionMocker really belongs to the ::testing -// namespace. However if we define it in ::testing, MSVC will -// complain when classes in ::testing::internal declare it as a -// friend class template. To workaround this compiler bug, we define -// FunctionMocker in ::testing::internal and import it into ::testing. -template -class FunctionMocker; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With() { - return this->current_spec(); - } - - R Invoke() { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple()); - } -}; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(A1); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With(const Matcher& m1) { - this->current_spec().SetMatchers(::testing::make_tuple(m1)); - return this->current_spec(); - } - - R Invoke(A1 a1) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple(a1)); - } -}; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(A1, A2); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With(const Matcher& m1, const Matcher& m2) { - this->current_spec().SetMatchers(::testing::make_tuple(m1, m2)); - return this->current_spec(); - } - - R Invoke(A1 a1, A2 a2) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple(a1, a2)); - } -}; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(A1, A2, A3); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With(const Matcher& m1, const Matcher& m2, - const Matcher& m3) { - this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3)); - return this->current_spec(); - } - - R Invoke(A1 a1, A2 a2, A3 a3) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple(a1, a2, a3)); - } -}; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(A1, A2, A3, A4); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With(const Matcher& m1, const Matcher& m2, - const Matcher& m3, const Matcher& m4) { - this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4)); - return this->current_spec(); - } - - R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4)); - } -}; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(A1, A2, A3, A4, A5); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With(const Matcher& m1, const Matcher& m2, - const Matcher& m3, const Matcher& m4, const Matcher& m5) { - this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5)); - return this->current_spec(); - } - - R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5)); - } -}; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(A1, A2, A3, A4, A5, A6); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With(const Matcher& m1, const Matcher& m2, - const Matcher& m3, const Matcher& m4, const Matcher& m5, - const Matcher& m6) { - this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5, - m6)); - return this->current_spec(); - } - - R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6)); - } -}; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(A1, A2, A3, A4, A5, A6, A7); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With(const Matcher& m1, const Matcher& m2, - const Matcher& m3, const Matcher& m4, const Matcher& m5, - const Matcher& m6, const Matcher& m7) { - this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5, - m6, m7)); - return this->current_spec(); - } - - R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7)); - } -}; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(A1, A2, A3, A4, A5, A6, A7, A8); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With(const Matcher& m1, const Matcher& m2, - const Matcher& m3, const Matcher& m4, const Matcher& m5, - const Matcher& m6, const Matcher& m7, const Matcher& m8) { - this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5, - m6, m7, m8)); - return this->current_spec(); - } - - R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8)); - } -}; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With(const Matcher& m1, const Matcher& m2, - const Matcher& m3, const Matcher& m4, const Matcher& m5, - const Matcher& m6, const Matcher& m7, const Matcher& m8, - const Matcher& m9) { - this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5, - m6, m7, m8, m9)); - return this->current_spec(); - } - - R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9)); - } -}; - -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With(const Matcher& m1, const Matcher& m2, - const Matcher& m3, const Matcher& m4, const Matcher& m5, - const Matcher& m6, const Matcher& m7, const Matcher& m8, - const Matcher& m9, const Matcher& m10) { - this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5, - m6, m7, m8, m9, m10)); - return this->current_spec(); - } - - R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, - A10 a10) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9, - a10)); - } -}; - - -template -T& RemoveVolatileCast(T& v) { - return v; -} -template -T& RemoveVolatileCast(T volatile& v) { - return const_cast(v); -} - -} // namespace internal - -// The style guide prohibits "using" statements in a namespace scope -// inside a header file. However, the FunctionMocker class template -// is meant to be defined in the ::testing namespace. The following -// line is just a trick for working around a bug in MSVC 8.0, which -// cannot handle it if we define FunctionMocker in ::testing. -using internal::FunctionMocker; - -// GMOCK_RESULT_(tn, F) expands to the result type of function type F. -// We define this as a variadic macro in case F contains unprotected -// commas (the same reason that we use variadic macros in other places -// in this file). -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_RESULT_(tn, ...) \ - tn ::testing::internal::Function<__VA_ARGS__>::Result - -// The type of argument N of the given function type. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_ARG_(tn, N, ...) \ - tn ::testing::internal::Function<__VA_ARGS__>::Argument##N - -// The matcher type for argument N of the given function type. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_MATCHER_(tn, N, ...) \ - const ::testing::Matcher& - -// The variable for mocking the given method. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_MOCKER_(arity, Method) \ - GTEST_CONCAT_TOKEN_(gmock##arity##_##Method##_, __LINE__) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD0_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - ) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 0), \ - this_method_does_not_take_0_arguments); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(0, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(0, Method) \ - .Invoke(); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& gmock_##Method() qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(0, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(0, Method) \ - .With(); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD1_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 1), \ - this_method_does_not_take_1_argument); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(1, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(1, Method) \ - .Invoke(gmock_a1); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(1, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(1, Method) \ - .With(gmock_a1); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD2_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 2), \ - this_method_does_not_take_2_arguments); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(2, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(2, Method) \ - .Invoke(gmock_a1, gmock_a2); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(2, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(2, Method) \ - .With(gmock_a1, gmock_a2); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD3_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 3), \ - this_method_does_not_take_3_arguments); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(3, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(3, Method) \ - .Invoke(gmock_a1, gmock_a2, gmock_a3); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(3, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(3, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD4_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 4), \ - this_method_does_not_take_4_arguments); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(4, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(4, Method) \ - .Invoke(gmock_a1, gmock_a2, gmock_a3, gmock_a4); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(4, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(4, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD5_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 5), \ - this_method_does_not_take_5_arguments); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(5, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(5, Method) \ - .Invoke(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(5, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(5, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD6_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 6), \ - this_method_does_not_take_6_arguments); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(6, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(6, Method) \ - .Invoke(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(6, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(6, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD7_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 7), \ - this_method_does_not_take_7_arguments); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(7, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(7, Method) \ - .Invoke(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(7, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(7, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD8_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 8), \ - this_method_does_not_take_8_arguments); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(8, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(8, Method) \ - .Invoke(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(8, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(8, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD9_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \ - GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 9), \ - this_method_does_not_take_9_arguments); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(9, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(9, Method) \ - .Invoke(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ - GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(9, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(9, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD10_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \ - GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \ - GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ - == 10), \ - this_method_does_not_take_10_arguments); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(10, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(10, Method) \ - .Invoke(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, gmock_a10); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ - GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \ - GMOCK_MATCHER_(tn, 10, \ - __VA_ARGS__) gmock_a10) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(10, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this)); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_(10, Method) \ - .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, gmock_a10); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, Method) - -#define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__) -#define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__) -#define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__) -#define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__) -#define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__) -#define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__) -#define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__) -#define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__) -#define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__) -#define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__) -#define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__) - -#define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__) - -#define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__) - -#define MOCK_CONST_METHOD0_T(m, ...) \ - GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD1_T(m, ...) \ - GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD2_T(m, ...) \ - GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD3_T(m, ...) \ - GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD4_T(m, ...) \ - GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD5_T(m, ...) \ - GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD6_T(m, ...) \ - GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD7_T(m, ...) \ - GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD8_T(m, ...) \ - GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD9_T(m, ...) \ - GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD10_T(m, ...) \ - GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__) - -#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD0_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD1_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD2_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD3_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD4_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD5_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD6_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD7_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD8_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD9_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD10_(, , ct, m, __VA_ARGS__) - -#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__) - -#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__) - -#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__) - -#define MOCK_QUALIFIED_METHOD0(m, qualifiers, ...) \ - GMOCK_METHOD0_(, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD1(m, qualifiers, ...) \ - GMOCK_METHOD1_(, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD2(m, qualifiers, ...) \ - GMOCK_METHOD2_(, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD3(m, qualifiers, ...) \ - GMOCK_METHOD3_(, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD4(m, qualifiers, ...) \ - GMOCK_METHOD4_(, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD5(m, qualifiers, ...) \ - GMOCK_METHOD5_(, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD6(m, qualifiers, ...) \ - GMOCK_METHOD6_(, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD7(m, qualifiers, ...) \ - GMOCK_METHOD7_(, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD8(m, qualifiers, ...) \ - GMOCK_METHOD8_(, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD9(m, qualifiers, ...) \ - GMOCK_METHOD9_(, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD10(m, qualifiers, ...) \ - GMOCK_METHOD10_(, qualifiers, , m, __VA_ARGS__) - -#define MOCK_QUALIFIED_METHOD0_T(m, qualifiers, ...) \ - GMOCK_METHOD0_(typename, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD1_T(m, qualifiers, ...) \ - GMOCK_METHOD1_(typename, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD2_T(m, qualifiers, ...) \ - GMOCK_METHOD2_(typename, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD3_T(m, qualifiers, ...) \ - GMOCK_METHOD3_(typename, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD4_T(m, qualifiers, ...) \ - GMOCK_METHOD4_(typename, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD5_T(m, qualifiers, ...) \ - GMOCK_METHOD5_(typename, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD6_T(m, qualifiers, ...) \ - GMOCK_METHOD6_(typename, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD7_T(m, qualifiers, ...) \ - GMOCK_METHOD7_(typename, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD8_T(m, qualifiers, ...) \ - GMOCK_METHOD8_(typename, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD9_T(m, qualifiers, ...) \ - GMOCK_METHOD9_(typename, qualifiers, , m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD10_T(m, qualifiers, ...) \ - GMOCK_METHOD10_(typename, qualifiers, , m, __VA_ARGS__) - -#define MOCK_QUALIFIED_METHOD0_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD0_(, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD1_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD1_(, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD2_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD2_(, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD3_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD3_(, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD4_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD4_(, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD5_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD5_(, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD6_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD6_(, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD7_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD7_(, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD8_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD8_(, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD9_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD9_(, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD10_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD10_(, qualifiers, ct, m, __VA_ARGS__) - -#define MOCK_QUALIFIED_METHOD0_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD0_(typename, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD1_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD1_(typename, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD2_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD2_(typename, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD3_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD3_(typename, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD4_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD4_(typename, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD5_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD5_(typename, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD6_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD6_(typename, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD7_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD7_(typename, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD8_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD8_(typename, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD9_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD9_(typename, qualifiers, ct, m, __VA_ARGS__) -#define MOCK_QUALIFIED_METHOD10_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD10_(typename, qualifiers, ct, m, __VA_ARGS__) - - -// A MockFunction class has one mock method whose type is F. It is -// useful when you just want your test code to emit some messages and -// have Google Mock verify the right messages are sent (and perhaps at -// the right times). For example, if you are exercising code: -// -// Foo(1); -// Foo(2); -// Foo(3); -// -// and want to verify that Foo(1) and Foo(3) both invoke -// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write: -// -// TEST(FooTest, InvokesBarCorrectly) { -// MyMock mock; -// MockFunction check; -// { -// InSequence s; -// -// EXPECT_CALL(mock, Bar("a")); -// EXPECT_CALL(check, Call("1")); -// EXPECT_CALL(check, Call("2")); -// EXPECT_CALL(mock, Bar("a")); -// } -// Foo(1); -// check.Call("1"); -// Foo(2); -// check.Call("2"); -// Foo(3); -// } -// -// The expectation spec says that the first Bar("a") must happen -// before check point "1", the second Bar("a") must happen after check -// point "2", and nothing should happen between the two check -// points. The explicit check points make it easy to tell which -// Bar("a") is called by which call to Foo(). -// -// MockFunction can also be used to exercise code that accepts -// std::function callbacks. To do so, use AsStdFunction() method -// to create std::function proxy forwarding to original object's Call. -// Example: -// -// TEST(FooTest, RunsCallbackWithBarArgument) { -// MockFunction callback; -// EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1)); -// Foo(callback.AsStdFunction()); -// } -template -class MockFunction; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD0_T(Call, R()); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this]() -> R { - return this->Call(); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD1_T(Call, R(A0)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this](A0 a0) -> R { - return this->Call(a0); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD2_T(Call, R(A0, A1)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this](A0 a0, A1 a1) -> R { - return this->Call(a0, a1); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD3_T(Call, R(A0, A1, A2)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this](A0 a0, A1 a1, A2 a2) -> R { - return this->Call(a0, a1, a2); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD4_T(Call, R(A0, A1, A2, A3)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this](A0 a0, A1 a1, A2 a2, A3 a3) -> R { - return this->Call(a0, a1, a2, a3); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) -> R { - return this->Call(a0, a1, a2, a3, a4); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -> R { - return this->Call(a0, a1, a2, a3, a4, a5); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -> R { - return this->Call(a0, a1, a2, a3, a4, a5, a6); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -> R { - return this->Call(a0, a1, a2, a3, a4, a5, a6, a7); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, - A8 a8) -> R { - return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, - A8 a8, A9 a9) -> R { - return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump deleted file mode 100644 index 6092d96caa9..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +++ /dev/null @@ -1,339 +0,0 @@ -$$ -*- mode: c++; -*- -$$ This is a Pump source file. Please use Pump to convert it to -$$ gmock-generated-function-mockers.h. -$$ -$var n = 10 $$ The maximum arity we support. -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements function mockers of various arities. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ - -#include "gmock/gmock-spec-builders.h" -#include "gmock/internal/gmock-internal-utils.h" - -#if GTEST_HAS_STD_FUNCTION_ -# include -#endif - -namespace testing { -namespace internal { - -template -class FunctionMockerBase; - -// Note: class FunctionMocker really belongs to the ::testing -// namespace. However if we define it in ::testing, MSVC will -// complain when classes in ::testing::internal declare it as a -// friend class template. To workaround this compiler bug, we define -// FunctionMocker in ::testing::internal and import it into ::testing. -template -class FunctionMocker; - - -$range i 0..n -$for i [[ -$range j 1..i -$var typename_As = [[$for j [[, typename A$j]]]] -$var As = [[$for j, [[A$j]]]] -$var as = [[$for j, [[a$j]]]] -$var Aas = [[$for j, [[A$j a$j]]]] -$var ms = [[$for j, [[m$j]]]] -$var matchers = [[$for j, [[const Matcher& m$j]]]] -template -class FunctionMocker : public - internal::FunctionMockerBase { - public: - typedef R F($As); - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - MockSpec& With($matchers) { - -$if i >= 1 [[ - this->current_spec().SetMatchers(::testing::make_tuple($ms)); - -]] - return this->current_spec(); - } - - R Invoke($Aas) { - // Even though gcc and MSVC don't enforce it, 'this->' is required - // by the C++ standard [14.6.4] here, as the base class type is - // dependent on the template argument (and thus shouldn't be - // looked into when resolving InvokeWith). - return this->InvokeWith(ArgumentTuple($as)); - } -}; - - -]] - -template -T& RemoveVolatileCast(T& v) { - return v; -} -template -T& RemoveVolatileCast(T volatile& v) { - return const_cast(v); -} - -} // namespace internal - -// The style guide prohibits "using" statements in a namespace scope -// inside a header file. However, the FunctionMocker class template -// is meant to be defined in the ::testing namespace. The following -// line is just a trick for working around a bug in MSVC 8.0, which -// cannot handle it if we define FunctionMocker in ::testing. -using internal::FunctionMocker; - -// GMOCK_RESULT_(tn, F) expands to the result type of function type F. -// We define this as a variadic macro in case F contains unprotected -// commas (the same reason that we use variadic macros in other places -// in this file). -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_RESULT_(tn, ...) \ - tn ::testing::internal::Function<__VA_ARGS__>::Result - -// The type of argument N of the given function type. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_ARG_(tn, N, ...) \ - tn ::testing::internal::Function<__VA_ARGS__>::Argument##N - -// The matcher type for argument N of the given function type. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_MATCHER_(tn, N, ...) \ - const ::testing::Matcher& - -// The variable for mocking the given method. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_MOCKER_(arity, Method) \ - GTEST_CONCAT_TOKEN_(gmock##arity##_##Method##_, __LINE__) - -$for i [[ -$range j 1..i -$var arg_as = [[$for j, \ - [[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]] -$var as = [[$for j, [[gmock_a$j]]]] -$var matcher_as = [[$for j, \ - [[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]] -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD$i[[]]_(tn, qualifiers, ct, Method, ...) \ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - $arg_as) qualifiers { \ - GTEST_COMPILE_ASSERT_((::testing::tuple_size< \ - tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value == $i), \ - this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_($i, Method) \ - .SetOwnerAndName(& ::testing::internal::RemoveVolatileCast(*this), #Method); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_($i, Method) \ - .Invoke($as); \ - } \ - ::testing::MockSpec<__VA_ARGS__>& \ - gmock_##Method($matcher_as) qualifiers { \ - ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_($i, Method) \ - .RegisterOwner(& ::testing::internal::RemoveVolatileCast(*this); \ - return ::testing::internal::RemoveVolatileCast(*this) \ - .GMOCK_MOCKER_($i, Method) \ - .With($as); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, Method) - - -]] - - -$for i [[ -#define MOCK_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, , , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, const, , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_METHOD$i[[]]_T(m, ...) GMOCK_METHOD$i[[]]_(typename, , , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i[[]]_T(m, ...) \ - GMOCK_METHOD$i[[]]_(typename, const, , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(, , ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(, const, ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(typename, , ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(typename, const, ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_QUALIFIED_METHOD$i[[]](m, qualifiers, ...) \ - GMOCK_METHOD$i[[]]_(, qualifiers, , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_QUALIFIED_METHOD$i[[]]_T(m, qualifiers, ...) \ - GMOCK_METHOD$i[[]]_(typename, qualifiers, , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_QUALIFIED_METHOD$i[[]]_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD$i[[]]_(, qualifiers, ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_QUALIFIED_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, qualifiers, ...) \ - GMOCK_METHOD$i[[]]_(typename, qualifiers, ct, m, __VA_ARGS__) - -]] - - -// A MockFunction class has one mock method whose type is F. It is -// useful when you just want your test code to emit some messages and -// have Google Mock verify the right messages are sent (and perhaps at -// the right times). For example, if you are exercising code: -// -// Foo(1); -// Foo(2); -// Foo(3); -// -// and want to verify that Foo(1) and Foo(3) both invoke -// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write: -// -// TEST(FooTest, InvokesBarCorrectly) { -// MyMock mock; -// MockFunction check; -// { -// InSequence s; -// -// EXPECT_CALL(mock, Bar("a")); -// EXPECT_CALL(check, Call("1")); -// EXPECT_CALL(check, Call("2")); -// EXPECT_CALL(mock, Bar("a")); -// } -// Foo(1); -// check.Call("1"); -// Foo(2); -// check.Call("2"); -// Foo(3); -// } -// -// The expectation spec says that the first Bar("a") must happen -// before check point "1", the second Bar("a") must happen after check -// point "2", and nothing should happen between the two check -// points. The explicit check points make it easy to tell which -// Bar("a") is called by which call to Foo(). -// -// MockFunction can also be used to exercise code that accepts -// std::function callbacks. To do so, use AsStdFunction() method -// to create std::function proxy forwarding to original object's Call. -// Example: -// -// TEST(FooTest, RunsCallbackWithBarArgument) { -// MockFunction callback; -// EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1)); -// Foo(callback.AsStdFunction()); -// } -template -class MockFunction; - - -$for i [[ -$range j 0..i-1 -$var ArgTypes = [[$for j, [[A$j]]]] -$var ArgNames = [[$for j, [[a$j]]]] -$var ArgDecls = [[$for j, [[A$j a$j]]]] -template -class MockFunction { - public: - MockFunction() {} - - MOCK_METHOD$i[[]]_T(Call, R($ArgTypes)); - -#if GTEST_HAS_STD_FUNCTION_ - std::function AsStdFunction() { - return [this]($ArgDecls) -> R { - return this->Call($ArgNames); - }; - } -#endif // GTEST_HAS_STD_FUNCTION_ - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); -}; - - -]] -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-matchers.h b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-matchers.h deleted file mode 100644 index 57056fd91d2..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-matchers.h +++ /dev/null @@ -1,2179 +0,0 @@ -// This file was GENERATED by command: -// pump.py gmock-generated-matchers.h.pump -// DO NOT EDIT BY HAND!!! - -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used variadic matchers. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ - -#include -#include -#include -#include -#include "gmock/gmock-matchers.h" - -namespace testing { -namespace internal { - -// The type of the i-th (0-based) field of Tuple. -#define GMOCK_FIELD_TYPE_(Tuple, i) \ - typename ::testing::tuple_element::type - -// TupleFields is for selecting fields from a -// tuple of type Tuple. It has two members: -// -// type: a tuple type whose i-th field is the ki-th field of Tuple. -// GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple. -// -// For example, in class TupleFields, 2, 0>, we have: -// -// type is tuple, and -// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). - -template -class TupleFields; - -// This generic version is used when there are 10 selectors. -template -class TupleFields { - public: - typedef ::testing::tuple type; - static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t), - get(t), get(t), get(t), get(t), get(t)); - } -}; - -// The following specialization is used for 0 ~ 9 selectors. - -template -class TupleFields { - public: - typedef ::testing::tuple<> type; - static type GetSelectedFields(const Tuple& /* t */) { - return type(); - } -}; - -template -class TupleFields { - public: - typedef ::testing::tuple type; - static type GetSelectedFields(const Tuple& t) { - return type(get(t)); - } -}; - -template -class TupleFields { - public: - typedef ::testing::tuple type; - static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t)); - } -}; - -template -class TupleFields { - public: - typedef ::testing::tuple type; - static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t)); - } -}; - -template -class TupleFields { - public: - typedef ::testing::tuple type; - static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t)); - } -}; - -template -class TupleFields { - public: - typedef ::testing::tuple type; - static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t)); - } -}; - -template -class TupleFields { - public: - typedef ::testing::tuple type; - static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t), - get(t)); - } -}; - -template -class TupleFields { - public: - typedef ::testing::tuple type; - static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t), - get(t), get(t)); - } -}; - -template -class TupleFields { - public: - typedef ::testing::tuple type; - static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t), - get(t), get(t), get(t)); - } -}; - -template -class TupleFields { - public: - typedef ::testing::tuple type; - static type GetSelectedFields(const Tuple& t) { - return type(get(t), get(t), get(t), get(t), get(t), - get(t), get(t), get(t), get(t)); - } -}; - -#undef GMOCK_FIELD_TYPE_ - -// Implements the Args() matcher. -template -class ArgsMatcherImpl : public MatcherInterface { - public: - // ArgsTuple may have top-level const or reference modifiers. - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple; - typedef typename internal::TupleFields::type SelectedArgs; - typedef Matcher MonomorphicInnerMatcher; - - template - explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher) - : inner_matcher_(SafeMatcherCast(inner_matcher)) {} - - virtual bool MatchAndExplain(ArgsTuple args, - MatchResultListener* listener) const { - const SelectedArgs& selected_args = GetSelectedArgs(args); - if (!listener->IsInterested()) - return inner_matcher_.Matches(selected_args); - - PrintIndices(listener->stream()); - *listener << "are " << PrintToString(selected_args); - - StringMatchResultListener inner_listener; - const bool match = inner_matcher_.MatchAndExplain(selected_args, - &inner_listener); - PrintIfNotEmpty(inner_listener.str(), listener->stream()); - return match; - } - - virtual void DescribeTo(::std::ostream* os) const { - *os << "are a tuple "; - PrintIndices(os); - inner_matcher_.DescribeTo(os); - } - - virtual void DescribeNegationTo(::std::ostream* os) const { - *os << "are a tuple "; - PrintIndices(os); - inner_matcher_.DescribeNegationTo(os); - } - - private: - static SelectedArgs GetSelectedArgs(ArgsTuple args) { - return TupleFields::GetSelectedFields(args); - } - - // Prints the indices of the selected fields. - static void PrintIndices(::std::ostream* os) { - *os << "whose fields ("; - const int indices[10] = { k0, k1, k2, k3, k4, k5, k6, k7, k8, k9 }; - for (int i = 0; i < 10; i++) { - if (indices[i] < 0) - break; - - if (i >= 1) - *os << ", "; - - *os << "#" << indices[i]; - } - *os << ") "; - } - - const MonomorphicInnerMatcher inner_matcher_; - - GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl); -}; - -template -class ArgsMatcher { - public: - explicit ArgsMatcher(const InnerMatcher& inner_matcher) - : inner_matcher_(inner_matcher) {} - - template - operator Matcher() const { - return MakeMatcher(new ArgsMatcherImpl(inner_matcher_)); - } - - private: - const InnerMatcher inner_matcher_; - - GTEST_DISALLOW_ASSIGN_(ArgsMatcher); -}; - -// A set of metafunctions for computing the result type of AllOf. -// AllOf(m1, ..., mN) returns -// AllOfResultN::type. - -// Although AllOf isn't defined for one argument, AllOfResult1 is defined -// to simplify the implementation. -template -struct AllOfResult1 { - typedef M1 type; -}; - -template -struct AllOfResult2 { - typedef BothOfMatcher< - typename AllOfResult1::type, - typename AllOfResult1::type - > type; -}; - -template -struct AllOfResult3 { - typedef BothOfMatcher< - typename AllOfResult1::type, - typename AllOfResult2::type - > type; -}; - -template -struct AllOfResult4 { - typedef BothOfMatcher< - typename AllOfResult2::type, - typename AllOfResult2::type - > type; -}; - -template -struct AllOfResult5 { - typedef BothOfMatcher< - typename AllOfResult2::type, - typename AllOfResult3::type - > type; -}; - -template -struct AllOfResult6 { - typedef BothOfMatcher< - typename AllOfResult3::type, - typename AllOfResult3::type - > type; -}; - -template -struct AllOfResult7 { - typedef BothOfMatcher< - typename AllOfResult3::type, - typename AllOfResult4::type - > type; -}; - -template -struct AllOfResult8 { - typedef BothOfMatcher< - typename AllOfResult4::type, - typename AllOfResult4::type - > type; -}; - -template -struct AllOfResult9 { - typedef BothOfMatcher< - typename AllOfResult4::type, - typename AllOfResult5::type - > type; -}; - -template -struct AllOfResult10 { - typedef BothOfMatcher< - typename AllOfResult5::type, - typename AllOfResult5::type - > type; -}; - -// A set of metafunctions for computing the result type of AnyOf. -// AnyOf(m1, ..., mN) returns -// AnyOfResultN::type. - -// Although AnyOf isn't defined for one argument, AnyOfResult1 is defined -// to simplify the implementation. -template -struct AnyOfResult1 { - typedef M1 type; -}; - -template -struct AnyOfResult2 { - typedef EitherOfMatcher< - typename AnyOfResult1::type, - typename AnyOfResult1::type - > type; -}; - -template -struct AnyOfResult3 { - typedef EitherOfMatcher< - typename AnyOfResult1::type, - typename AnyOfResult2::type - > type; -}; - -template -struct AnyOfResult4 { - typedef EitherOfMatcher< - typename AnyOfResult2::type, - typename AnyOfResult2::type - > type; -}; - -template -struct AnyOfResult5 { - typedef EitherOfMatcher< - typename AnyOfResult2::type, - typename AnyOfResult3::type - > type; -}; - -template -struct AnyOfResult6 { - typedef EitherOfMatcher< - typename AnyOfResult3::type, - typename AnyOfResult3::type - > type; -}; - -template -struct AnyOfResult7 { - typedef EitherOfMatcher< - typename AnyOfResult3::type, - typename AnyOfResult4::type - > type; -}; - -template -struct AnyOfResult8 { - typedef EitherOfMatcher< - typename AnyOfResult4::type, - typename AnyOfResult4::type - > type; -}; - -template -struct AnyOfResult9 { - typedef EitherOfMatcher< - typename AnyOfResult4::type, - typename AnyOfResult5::type - > type; -}; - -template -struct AnyOfResult10 { - typedef EitherOfMatcher< - typename AnyOfResult5::type, - typename AnyOfResult5::type - > type; -}; - -} // namespace internal - -// Args(a_matcher) matches a tuple if the selected -// fields of it matches a_matcher. C++ doesn't support default -// arguments for function templates, so we have to overload it. -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -template -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - -// ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with -// n elements, where the i-th element in the container must -// match the i-th argument in the list. Each argument of -// ElementsAre() can be either a value or a matcher. We support up to -// 10 arguments. -// -// The use of DecayArray in the implementation allows ElementsAre() -// to accept string literals, whose type is const char[N], but we -// want to treat them as const char*. -// -// NOTE: Since ElementsAre() cares about the order of the elements, it -// must not be used with containers whose elements's order is -// undefined (e.g. hash_map). - -inline internal::ElementsAreMatcher< - ::testing::tuple<> > -ElementsAre() { - typedef ::testing::tuple<> Args; - return internal::ElementsAreMatcher(Args()); -} - -template -inline internal::ElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type> > -ElementsAre(const T1& e1) { - typedef ::testing::tuple< - typename internal::DecayArray::type> Args; - return internal::ElementsAreMatcher(Args(e1)); -} - -template -inline internal::ElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -ElementsAre(const T1& e1, const T2& e2) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::ElementsAreMatcher(Args(e1, e2)); -} - -template -inline internal::ElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -ElementsAre(const T1& e1, const T2& e2, const T3& e3) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::ElementsAreMatcher(Args(e1, e2, e3)); -} - -template -inline internal::ElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::ElementsAreMatcher(Args(e1, e2, e3, e4)); -} - -template -inline internal::ElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5)); -} - -template -inline internal::ElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5, const T6& e6) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5, e6)); -} - -template -inline internal::ElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5, const T6& e6, const T7& e7) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5, e6, e7)); -} - -template -inline internal::ElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5, const T6& e6, const T7& e7, const T8& e8) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5, e6, e7, - e8)); -} - -template -inline internal::ElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5, e6, e7, - e8, e9)); -} - -template -inline internal::ElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, - const T10& e10) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::ElementsAreMatcher(Args(e1, e2, e3, e4, e5, e6, e7, - e8, e9, e10)); -} - -// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension -// that matches n elements in any order. We support up to n=10 arguments. - -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple<> > -UnorderedElementsAre() { - typedef ::testing::tuple<> Args; - return internal::UnorderedElementsAreMatcher(Args()); -} - -template -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type> > -UnorderedElementsAre(const T1& e1) { - typedef ::testing::tuple< - typename internal::DecayArray::type> Args; - return internal::UnorderedElementsAreMatcher(Args(e1)); -} - -template -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -UnorderedElementsAre(const T1& e1, const T2& e2) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::UnorderedElementsAreMatcher(Args(e1, e2)); -} - -template -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3)); -} - -template -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4)); -} - -template -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5)); -} - -template -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5, const T6& e6) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5, - e6)); -} - -template -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5, const T6& e6, const T7& e7) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5, - e6, e7)); -} - -template -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5, const T6& e6, const T7& e7, const T8& e8) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5, - e6, e7, e8)); -} - -template -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5, - e6, e7, e8, e9)); -} - -template -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> > -UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, - const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, - const T10& e10) { - typedef ::testing::tuple< - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type, - typename internal::DecayArray::type> Args; - return internal::UnorderedElementsAreMatcher(Args(e1, e2, e3, e4, e5, - e6, e7, e8, e9, e10)); -} - -// AllOf(m1, m2, ..., mk) matches any value that matches all of the given -// sub-matchers. AllOf is called fully qualified to prevent ADL from firing. - -template -inline typename internal::AllOfResult2::type -AllOf(M1 m1, M2 m2) { - return typename internal::AllOfResult2::type( - m1, - m2); -} - -template -inline typename internal::AllOfResult3::type -AllOf(M1 m1, M2 m2, M3 m3) { - return typename internal::AllOfResult3::type( - m1, - ::testing::AllOf(m2, m3)); -} - -template -inline typename internal::AllOfResult4::type -AllOf(M1 m1, M2 m2, M3 m3, M4 m4) { - return typename internal::AllOfResult4::type( - ::testing::AllOf(m1, m2), - ::testing::AllOf(m3, m4)); -} - -template -inline typename internal::AllOfResult5::type -AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) { - return typename internal::AllOfResult5::type( - ::testing::AllOf(m1, m2), - ::testing::AllOf(m3, m4, m5)); -} - -template -inline typename internal::AllOfResult6::type -AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) { - return typename internal::AllOfResult6::type( - ::testing::AllOf(m1, m2, m3), - ::testing::AllOf(m4, m5, m6)); -} - -template -inline typename internal::AllOfResult7::type -AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) { - return typename internal::AllOfResult7::type( - ::testing::AllOf(m1, m2, m3), - ::testing::AllOf(m4, m5, m6, m7)); -} - -template -inline typename internal::AllOfResult8::type -AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) { - return typename internal::AllOfResult8::type( - ::testing::AllOf(m1, m2, m3, m4), - ::testing::AllOf(m5, m6, m7, m8)); -} - -template -inline typename internal::AllOfResult9::type -AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) { - return typename internal::AllOfResult9::type( - ::testing::AllOf(m1, m2, m3, m4), - ::testing::AllOf(m5, m6, m7, m8, m9)); -} - -template -inline typename internal::AllOfResult10::type -AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { - return typename internal::AllOfResult10::type( - ::testing::AllOf(m1, m2, m3, m4, m5), - ::testing::AllOf(m6, m7, m8, m9, m10)); -} - -// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given -// sub-matchers. AnyOf is called fully qualified to prevent ADL from firing. - -template -inline typename internal::AnyOfResult2::type -AnyOf(M1 m1, M2 m2) { - return typename internal::AnyOfResult2::type( - m1, - m2); -} - -template -inline typename internal::AnyOfResult3::type -AnyOf(M1 m1, M2 m2, M3 m3) { - return typename internal::AnyOfResult3::type( - m1, - ::testing::AnyOf(m2, m3)); -} - -template -inline typename internal::AnyOfResult4::type -AnyOf(M1 m1, M2 m2, M3 m3, M4 m4) { - return typename internal::AnyOfResult4::type( - ::testing::AnyOf(m1, m2), - ::testing::AnyOf(m3, m4)); -} - -template -inline typename internal::AnyOfResult5::type -AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) { - return typename internal::AnyOfResult5::type( - ::testing::AnyOf(m1, m2), - ::testing::AnyOf(m3, m4, m5)); -} - -template -inline typename internal::AnyOfResult6::type -AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) { - return typename internal::AnyOfResult6::type( - ::testing::AnyOf(m1, m2, m3), - ::testing::AnyOf(m4, m5, m6)); -} - -template -inline typename internal::AnyOfResult7::type -AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) { - return typename internal::AnyOfResult7::type( - ::testing::AnyOf(m1, m2, m3), - ::testing::AnyOf(m4, m5, m6, m7)); -} - -template -inline typename internal::AnyOfResult8::type -AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) { - return typename internal::AnyOfResult8::type( - ::testing::AnyOf(m1, m2, m3, m4), - ::testing::AnyOf(m5, m6, m7, m8)); -} - -template -inline typename internal::AnyOfResult9::type -AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) { - return typename internal::AnyOfResult9::type( - ::testing::AnyOf(m1, m2, m3, m4), - ::testing::AnyOf(m5, m6, m7, m8, m9)); -} - -template -inline typename internal::AnyOfResult10::type -AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { - return typename internal::AnyOfResult10::type( - ::testing::AnyOf(m1, m2, m3, m4, m5), - ::testing::AnyOf(m6, m7, m8, m9, m10)); -} - -} // namespace testing - - -// The MATCHER* family of macros can be used in a namespace scope to -// define custom matchers easily. -// -// Basic Usage -// =========== -// -// The syntax -// -// MATCHER(name, description_string) { statements; } -// -// defines a matcher with the given name that executes the statements, -// which must return a bool to indicate if the match succeeds. Inside -// the statements, you can refer to the value being matched by 'arg', -// and refer to its type by 'arg_type'. -// -// The description string documents what the matcher does, and is used -// to generate the failure message when the match fails. Since a -// MATCHER() is usually defined in a header file shared by multiple -// C++ source files, we require the description to be a C-string -// literal to avoid possible side effects. It can be empty, in which -// case we'll use the sequence of words in the matcher name as the -// description. -// -// For example: -// -// MATCHER(IsEven, "") { return (arg % 2) == 0; } -// -// allows you to write -// -// // Expects mock_foo.Bar(n) to be called where n is even. -// EXPECT_CALL(mock_foo, Bar(IsEven())); -// -// or, -// -// // Verifies that the value of some_expression is even. -// EXPECT_THAT(some_expression, IsEven()); -// -// If the above assertion fails, it will print something like: -// -// Value of: some_expression -// Expected: is even -// Actual: 7 -// -// where the description "is even" is automatically calculated from the -// matcher name IsEven. -// -// Argument Type -// ============= -// -// Note that the type of the value being matched (arg_type) is -// determined by the context in which you use the matcher and is -// supplied to you by the compiler, so you don't need to worry about -// declaring it (nor can you). This allows the matcher to be -// polymorphic. For example, IsEven() can be used to match any type -// where the value of "(arg % 2) == 0" can be implicitly converted to -// a bool. In the "Bar(IsEven())" example above, if method Bar() -// takes an int, 'arg_type' will be int; if it takes an unsigned long, -// 'arg_type' will be unsigned long; and so on. -// -// Parameterizing Matchers -// ======================= -// -// Sometimes you'll want to parameterize the matcher. For that you -// can use another macro: -// -// MATCHER_P(name, param_name, description_string) { statements; } -// -// For example: -// -// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } -// -// will allow you to write: -// -// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); -// -// which may lead to this message (assuming n is 10): -// -// Value of: Blah("a") -// Expected: has absolute value 10 -// Actual: -9 -// -// Note that both the matcher description and its parameter are -// printed, making the message human-friendly. -// -// In the matcher definition body, you can write 'foo_type' to -// reference the type of a parameter named 'foo'. For example, in the -// body of MATCHER_P(HasAbsoluteValue, value) above, you can write -// 'value_type' to refer to the type of 'value'. -// -// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P10 to -// support multi-parameter matchers. -// -// Describing Parameterized Matchers -// ================================= -// -// The last argument to MATCHER*() is a string-typed expression. The -// expression can reference all of the matcher's parameters and a -// special bool-typed variable named 'negation'. When 'negation' is -// false, the expression should evaluate to the matcher's description; -// otherwise it should evaluate to the description of the negation of -// the matcher. For example, -// -// using testing::PrintToString; -// -// MATCHER_P2(InClosedRange, low, hi, -// string(negation ? "is not" : "is") + " in range [" + -// PrintToString(low) + ", " + PrintToString(hi) + "]") { -// return low <= arg && arg <= hi; -// } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: is in range [4, 6] -// ... -// Expected: is not in range [2, 4] -// -// If you specify "" as the description, the failure message will -// contain the sequence of words in the matcher name followed by the -// parameter values printed as a tuple. For example, -// -// MATCHER_P2(InClosedRange, low, hi, "") { ... } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: in closed range (4, 6) -// ... -// Expected: not (in closed range (2, 4)) -// -// Types of Matcher Parameters -// =========================== -// -// For the purpose of typing, you can view -// -// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } -// -// as shorthand for -// -// template -// FooMatcherPk -// Foo(p1_type p1, ..., pk_type pk) { ... } -// -// When you write Foo(v1, ..., vk), the compiler infers the types of -// the parameters v1, ..., and vk for you. If you are not happy with -// the result of the type inference, you can specify the types by -// explicitly instantiating the template, as in Foo(5, -// false). As said earlier, you don't get to (or need to) specify -// 'arg_type' as that's determined by the context in which the matcher -// is used. You can assign the result of expression Foo(p1, ..., pk) -// to a variable of type FooMatcherPk. This -// can be useful when composing matchers. -// -// While you can instantiate a matcher template with reference types, -// passing the parameters by pointer usually makes your code more -// readable. If, however, you still want to pass a parameter by -// reference, be aware that in the failure message generated by the -// matcher you will see the value of the referenced object but not its -// address. -// -// Explaining Match Results -// ======================== -// -// Sometimes the matcher description alone isn't enough to explain why -// the match has failed or succeeded. For example, when expecting a -// long string, it can be very helpful to also print the diff between -// the expected string and the actual one. To achieve that, you can -// optionally stream additional information to a special variable -// named result_listener, whose type is a pointer to class -// MatchResultListener: -// -// MATCHER_P(EqualsLongString, str, "") { -// if (arg == str) return true; -// -// *result_listener << "the difference: " -/// << DiffStrings(str, arg); -// return false; -// } -// -// Overloading Matchers -// ==================== -// -// You can overload matchers with different numbers of parameters: -// -// MATCHER_P(Blah, a, description_string1) { ... } -// MATCHER_P2(Blah, a, b, description_string2) { ... } -// -// Caveats -// ======= -// -// When defining a new matcher, you should also consider implementing -// MatcherInterface or using MakePolymorphicMatcher(). These -// approaches require more work than the MATCHER* macros, but also -// give you more control on the types of the value being matched and -// the matcher parameters, which may leads to better compiler error -// messages when the matcher is used wrong. They also allow -// overloading matchers based on parameter types (as opposed to just -// based on the number of parameters). -// -// MATCHER*() can only be used in a namespace scope. The reason is -// that C++ doesn't yet allow function-local types to be used to -// instantiate templates. The up-coming C++0x standard will fix this. -// Once that's done, we'll consider supporting using MATCHER*() inside -// a function. -// -// More Information -// ================ -// -// To learn more about using these macros, please search for 'MATCHER' -// on http://code.google.com/p/googlemock/wiki/CookBook. - -#define MATCHER(name, description)\ - class name##Matcher {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - gmock_Impl()\ - {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple<>()));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl());\ - }\ - name##Matcher() {\ - }\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##Matcher);\ - };\ - inline name##Matcher name() {\ - return name##Matcher();\ - }\ - template \ - bool name##Matcher::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P(name, p0, description)\ - template \ - class name##MatcherP {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - explicit gmock_Impl(p0##_type gmock_p0)\ - : p0(gmock_p0) {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type p0;\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0)));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl(p0));\ - }\ - explicit name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\ - }\ - p0##_type p0;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##MatcherP);\ - };\ - template \ - inline name##MatcherP name(p0##_type p0) {\ - return name##MatcherP(p0);\ - }\ - template \ - template \ - bool name##MatcherP::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P2(name, p0, p1, description)\ - template \ - class name##MatcherP2 {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\ - : p0(gmock_p0), p1(gmock_p1) {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type p0;\ - p1##_type p1;\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1)));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl(p0, p1));\ - }\ - name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ - p1(gmock_p1) {\ - }\ - p0##_type p0;\ - p1##_type p1;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\ - };\ - template \ - inline name##MatcherP2 name(p0##_type p0, \ - p1##_type p1) {\ - return name##MatcherP2(p0, p1);\ - }\ - template \ - template \ - bool name##MatcherP2::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P3(name, p0, p1, p2, description)\ - template \ - class name##MatcherP3 {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\ - : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, \ - p2)));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl(p0, p1, p2));\ - }\ - name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\ - };\ - template \ - inline name##MatcherP3 name(p0##_type p0, \ - p1##_type p1, p2##_type p2) {\ - return name##MatcherP3(p0, p1, p2);\ - }\ - template \ - template \ - bool name##MatcherP3::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P4(name, p0, p1, p2, p3, description)\ - template \ - class name##MatcherP4 {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3)\ - : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3) {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3)));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl(p0, p1, p2, p3));\ - }\ - name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ - p2(gmock_p2), p3(gmock_p3) {\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\ - };\ - template \ - inline name##MatcherP4 name(p0##_type p0, p1##_type p1, p2##_type p2, \ - p3##_type p3) {\ - return name##MatcherP4(p0, \ - p1, p2, p3);\ - }\ - template \ - template \ - bool name##MatcherP4::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\ - template \ - class name##MatcherP5 {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4)\ - : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - p4(gmock_p4) {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3, p4)));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl(p0, p1, p2, p3, p4));\ - }\ - name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, \ - p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4) {\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\ - };\ - template \ - inline name##MatcherP5 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4) {\ - return name##MatcherP5(p0, p1, p2, p3, p4);\ - }\ - template \ - template \ - bool name##MatcherP5::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\ - template \ - class name##MatcherP6 {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\ - : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - p4(gmock_p4), p5(gmock_p5) {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3, p4, p5)));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl(p0, p1, p2, p3, p4, p5));\ - }\ - name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\ - };\ - template \ - inline name##MatcherP6 name(p0##_type p0, p1##_type p1, p2##_type p2, \ - p3##_type p3, p4##_type p4, p5##_type p5) {\ - return name##MatcherP6(p0, p1, p2, p3, p4, p5);\ - }\ - template \ - template \ - bool name##MatcherP6::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\ - template \ - class name##MatcherP7 {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6)\ - : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3, p4, p5, \ - p6)));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl(p0, p1, p2, p3, p4, p5, p6));\ - }\ - name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ - p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ - p6(gmock_p6) {\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\ - };\ - template \ - inline name##MatcherP7 name(p0##_type p0, p1##_type p1, \ - p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ - p6##_type p6) {\ - return name##MatcherP7(p0, p1, p2, p3, p4, p5, p6);\ - }\ - template \ - template \ - bool name##MatcherP7::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\ - template \ - class name##MatcherP8 {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7)\ - : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, \ - p3, p4, p5, p6, p7)));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl(p0, p1, p2, p3, p4, p5, p6, p7));\ - }\ - name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, \ - p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ - p7(gmock_p7) {\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\ - };\ - template \ - inline name##MatcherP8 name(p0##_type p0, \ - p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ - p6##_type p6, p7##_type p7) {\ - return name##MatcherP8(p0, p1, p2, p3, p4, p5, \ - p6, p7);\ - }\ - template \ - template \ - bool name##MatcherP8::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\ - template \ - class name##MatcherP9 {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\ - : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ - p8(gmock_p8) {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl(p0, p1, p2, p3, p4, p5, p6, p7, p8));\ - }\ - name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ - p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ - p8(gmock_p8) {\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\ - };\ - template \ - inline name##MatcherP9 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ - p8##_type p8) {\ - return name##MatcherP9(p0, p1, p2, \ - p3, p4, p5, p6, p7, p8);\ - }\ - template \ - template \ - bool name##MatcherP9::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)\ - template \ - class name##MatcherP10 {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ - p9##_type gmock_p9)\ - : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ - p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ - p8(gmock_p8), p9(gmock_p9) {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - p9##_type p9;\ - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\ - }\ - name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ - p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ - p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - p9##_type p9;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\ - };\ - template \ - inline name##MatcherP10 name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ - p9##_type p9) {\ - return name##MatcherP10(p0, \ - p1, p2, p3, p4, p5, p6, p7, p8, p9);\ - }\ - template \ - template \ - bool name##MatcherP10::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump deleted file mode 100644 index de30c2c92ba..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ /dev/null @@ -1,672 +0,0 @@ -$$ -*- mode: c++; -*- -$$ This is a Pump source file. Please use Pump to convert it to -$$ gmock-generated-actions.h. -$$ -$var n = 10 $$ The maximum arity we support. -$$ }} This line fixes auto-indentation of the following code in Emacs. -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used variadic matchers. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ - -#include -#include -#include -#include -#include "gmock/gmock-matchers.h" - -namespace testing { -namespace internal { - -$range i 0..n-1 - -// The type of the i-th (0-based) field of Tuple. -#define GMOCK_FIELD_TYPE_(Tuple, i) \ - typename ::testing::tuple_element::type - -// TupleFields is for selecting fields from a -// tuple of type Tuple. It has two members: -// -// type: a tuple type whose i-th field is the ki-th field of Tuple. -// GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple. -// -// For example, in class TupleFields, 2, 0>, we have: -// -// type is tuple, and -// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). - -template -class TupleFields; - -// This generic version is used when there are $n selectors. -template -class TupleFields { - public: - typedef ::testing::tuple<$for i, [[GMOCK_FIELD_TYPE_(Tuple, k$i)]]> type; - static type GetSelectedFields(const Tuple& t) { - return type($for i, [[get(t)]]); - } -}; - -// The following specialization is used for 0 ~ $(n-1) selectors. - -$for i [[ -$$ }}} -$range j 0..i-1 -$range k 0..n-1 - -template -class TupleFields { - public: - typedef ::testing::tuple<$for j, [[GMOCK_FIELD_TYPE_(Tuple, k$j)]]> type; - static type GetSelectedFields(const Tuple& $if i==0 [[/* t */]] $else [[t]]) { - return type($for j, [[get(t)]]); - } -}; - -]] - -#undef GMOCK_FIELD_TYPE_ - -// Implements the Args() matcher. - -$var ks = [[$for i, [[k$i]]]] -template -class ArgsMatcherImpl : public MatcherInterface { - public: - // ArgsTuple may have top-level const or reference modifiers. - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple; - typedef typename internal::TupleFields::type SelectedArgs; - typedef Matcher MonomorphicInnerMatcher; - - template - explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher) - : inner_matcher_(SafeMatcherCast(inner_matcher)) {} - - virtual bool MatchAndExplain(ArgsTuple args, - MatchResultListener* listener) const { - const SelectedArgs& selected_args = GetSelectedArgs(args); - if (!listener->IsInterested()) - return inner_matcher_.Matches(selected_args); - - PrintIndices(listener->stream()); - *listener << "are " << PrintToString(selected_args); - - StringMatchResultListener inner_listener; - const bool match = inner_matcher_.MatchAndExplain(selected_args, - &inner_listener); - PrintIfNotEmpty(inner_listener.str(), listener->stream()); - return match; - } - - virtual void DescribeTo(::std::ostream* os) const { - *os << "are a tuple "; - PrintIndices(os); - inner_matcher_.DescribeTo(os); - } - - virtual void DescribeNegationTo(::std::ostream* os) const { - *os << "are a tuple "; - PrintIndices(os); - inner_matcher_.DescribeNegationTo(os); - } - - private: - static SelectedArgs GetSelectedArgs(ArgsTuple args) { - return TupleFields::GetSelectedFields(args); - } - - // Prints the indices of the selected fields. - static void PrintIndices(::std::ostream* os) { - *os << "whose fields ("; - const int indices[$n] = { $ks }; - for (int i = 0; i < $n; i++) { - if (indices[i] < 0) - break; - - if (i >= 1) - *os << ", "; - - *os << "#" << indices[i]; - } - *os << ") "; - } - - const MonomorphicInnerMatcher inner_matcher_; - - GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl); -}; - -template -class ArgsMatcher { - public: - explicit ArgsMatcher(const InnerMatcher& inner_matcher) - : inner_matcher_(inner_matcher) {} - - template - operator Matcher() const { - return MakeMatcher(new ArgsMatcherImpl(inner_matcher_)); - } - - private: - const InnerMatcher inner_matcher_; - - GTEST_DISALLOW_ASSIGN_(ArgsMatcher); -}; - -// A set of metafunctions for computing the result type of AllOf. -// AllOf(m1, ..., mN) returns -// AllOfResultN::type. - -// Although AllOf isn't defined for one argument, AllOfResult1 is defined -// to simplify the implementation. -template -struct AllOfResult1 { - typedef M1 type; -}; - -$range i 1..n - -$range i 2..n -$for i [[ -$range j 2..i -$var m = i/2 -$range k 1..m -$range t m+1..i - -template -struct AllOfResult$i { - typedef BothOfMatcher< - typename AllOfResult$m<$for k, [[M$k]]>::type, - typename AllOfResult$(i-m)<$for t, [[M$t]]>::type - > type; -}; - -]] - -// A set of metafunctions for computing the result type of AnyOf. -// AnyOf(m1, ..., mN) returns -// AnyOfResultN::type. - -// Although AnyOf isn't defined for one argument, AnyOfResult1 is defined -// to simplify the implementation. -template -struct AnyOfResult1 { - typedef M1 type; -}; - -$range i 1..n - -$range i 2..n -$for i [[ -$range j 2..i -$var m = i/2 -$range k 1..m -$range t m+1..i - -template -struct AnyOfResult$i { - typedef EitherOfMatcher< - typename AnyOfResult$m<$for k, [[M$k]]>::type, - typename AnyOfResult$(i-m)<$for t, [[M$t]]>::type - > type; -}; - -]] - -} // namespace internal - -// Args(a_matcher) matches a tuple if the selected -// fields of it matches a_matcher. C++ doesn't support default -// arguments for function templates, so we have to overload it. - -$range i 0..n -$for i [[ -$range j 1..i -template <$for j [[int k$j, ]]typename InnerMatcher> -inline internal::ArgsMatcher -Args(const InnerMatcher& matcher) { - return internal::ArgsMatcher(matcher); -} - - -]] -// ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with -// n elements, where the i-th element in the container must -// match the i-th argument in the list. Each argument of -// ElementsAre() can be either a value or a matcher. We support up to -// $n arguments. -// -// The use of DecayArray in the implementation allows ElementsAre() -// to accept string literals, whose type is const char[N], but we -// want to treat them as const char*. -// -// NOTE: Since ElementsAre() cares about the order of the elements, it -// must not be used with containers whose elements's order is -// undefined (e.g. hash_map). - -$range i 0..n -$for i [[ - -$range j 1..i - -$if i>0 [[ - -template <$for j, [[typename T$j]]> -]] - -inline internal::ElementsAreMatcher< - ::testing::tuple< -$for j, [[ - - typename internal::DecayArray::type]]> > -ElementsAre($for j, [[const T$j& e$j]]) { - typedef ::testing::tuple< -$for j, [[ - - typename internal::DecayArray::type]]> Args; - return internal::ElementsAreMatcher(Args($for j, [[e$j]])); -} - -]] - -// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension -// that matches n elements in any order. We support up to n=$n arguments. - -$range i 0..n -$for i [[ - -$range j 1..i - -$if i>0 [[ - -template <$for j, [[typename T$j]]> -]] - -inline internal::UnorderedElementsAreMatcher< - ::testing::tuple< -$for j, [[ - - typename internal::DecayArray::type]]> > -UnorderedElementsAre($for j, [[const T$j& e$j]]) { - typedef ::testing::tuple< -$for j, [[ - - typename internal::DecayArray::type]]> Args; - return internal::UnorderedElementsAreMatcher(Args($for j, [[e$j]])); -} - -]] - -// AllOf(m1, m2, ..., mk) matches any value that matches all of the given -// sub-matchers. AllOf is called fully qualified to prevent ADL from firing. - -$range i 2..n -$for i [[ -$range j 1..i -$var m = i/2 -$range k 1..m -$range t m+1..i - -template <$for j, [[typename M$j]]> -inline typename internal::AllOfResult$i<$for j, [[M$j]]>::type -AllOf($for j, [[M$j m$j]]) { - return typename internal::AllOfResult$i<$for j, [[M$j]]>::type( - $if m == 1 [[m1]] $else [[::testing::AllOf($for k, [[m$k]])]], - $if m+1 == i [[m$i]] $else [[::testing::AllOf($for t, [[m$t]])]]); -} - -]] - -// AnyOf(m1, m2, ..., mk) matches any value that matches any of the given -// sub-matchers. AnyOf is called fully qualified to prevent ADL from firing. - -$range i 2..n -$for i [[ -$range j 1..i -$var m = i/2 -$range k 1..m -$range t m+1..i - -template <$for j, [[typename M$j]]> -inline typename internal::AnyOfResult$i<$for j, [[M$j]]>::type -AnyOf($for j, [[M$j m$j]]) { - return typename internal::AnyOfResult$i<$for j, [[M$j]]>::type( - $if m == 1 [[m1]] $else [[::testing::AnyOf($for k, [[m$k]])]], - $if m+1 == i [[m$i]] $else [[::testing::AnyOf($for t, [[m$t]])]]); -} - -]] - -} // namespace testing -$$ } // This Pump meta comment fixes auto-indentation in Emacs. It will not -$$ // show up in the generated code. - - -// The MATCHER* family of macros can be used in a namespace scope to -// define custom matchers easily. -// -// Basic Usage -// =========== -// -// The syntax -// -// MATCHER(name, description_string) { statements; } -// -// defines a matcher with the given name that executes the statements, -// which must return a bool to indicate if the match succeeds. Inside -// the statements, you can refer to the value being matched by 'arg', -// and refer to its type by 'arg_type'. -// -// The description string documents what the matcher does, and is used -// to generate the failure message when the match fails. Since a -// MATCHER() is usually defined in a header file shared by multiple -// C++ source files, we require the description to be a C-string -// literal to avoid possible side effects. It can be empty, in which -// case we'll use the sequence of words in the matcher name as the -// description. -// -// For example: -// -// MATCHER(IsEven, "") { return (arg % 2) == 0; } -// -// allows you to write -// -// // Expects mock_foo.Bar(n) to be called where n is even. -// EXPECT_CALL(mock_foo, Bar(IsEven())); -// -// or, -// -// // Verifies that the value of some_expression is even. -// EXPECT_THAT(some_expression, IsEven()); -// -// If the above assertion fails, it will print something like: -// -// Value of: some_expression -// Expected: is even -// Actual: 7 -// -// where the description "is even" is automatically calculated from the -// matcher name IsEven. -// -// Argument Type -// ============= -// -// Note that the type of the value being matched (arg_type) is -// determined by the context in which you use the matcher and is -// supplied to you by the compiler, so you don't need to worry about -// declaring it (nor can you). This allows the matcher to be -// polymorphic. For example, IsEven() can be used to match any type -// where the value of "(arg % 2) == 0" can be implicitly converted to -// a bool. In the "Bar(IsEven())" example above, if method Bar() -// takes an int, 'arg_type' will be int; if it takes an unsigned long, -// 'arg_type' will be unsigned long; and so on. -// -// Parameterizing Matchers -// ======================= -// -// Sometimes you'll want to parameterize the matcher. For that you -// can use another macro: -// -// MATCHER_P(name, param_name, description_string) { statements; } -// -// For example: -// -// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } -// -// will allow you to write: -// -// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); -// -// which may lead to this message (assuming n is 10): -// -// Value of: Blah("a") -// Expected: has absolute value 10 -// Actual: -9 -// -// Note that both the matcher description and its parameter are -// printed, making the message human-friendly. -// -// In the matcher definition body, you can write 'foo_type' to -// reference the type of a parameter named 'foo'. For example, in the -// body of MATCHER_P(HasAbsoluteValue, value) above, you can write -// 'value_type' to refer to the type of 'value'. -// -// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P$n to -// support multi-parameter matchers. -// -// Describing Parameterized Matchers -// ================================= -// -// The last argument to MATCHER*() is a string-typed expression. The -// expression can reference all of the matcher's parameters and a -// special bool-typed variable named 'negation'. When 'negation' is -// false, the expression should evaluate to the matcher's description; -// otherwise it should evaluate to the description of the negation of -// the matcher. For example, -// -// using testing::PrintToString; -// -// MATCHER_P2(InClosedRange, low, hi, -// string(negation ? "is not" : "is") + " in range [" + -// PrintToString(low) + ", " + PrintToString(hi) + "]") { -// return low <= arg && arg <= hi; -// } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: is in range [4, 6] -// ... -// Expected: is not in range [2, 4] -// -// If you specify "" as the description, the failure message will -// contain the sequence of words in the matcher name followed by the -// parameter values printed as a tuple. For example, -// -// MATCHER_P2(InClosedRange, low, hi, "") { ... } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: in closed range (4, 6) -// ... -// Expected: not (in closed range (2, 4)) -// -// Types of Matcher Parameters -// =========================== -// -// For the purpose of typing, you can view -// -// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } -// -// as shorthand for -// -// template -// FooMatcherPk -// Foo(p1_type p1, ..., pk_type pk) { ... } -// -// When you write Foo(v1, ..., vk), the compiler infers the types of -// the parameters v1, ..., and vk for you. If you are not happy with -// the result of the type inference, you can specify the types by -// explicitly instantiating the template, as in Foo(5, -// false). As said earlier, you don't get to (or need to) specify -// 'arg_type' as that's determined by the context in which the matcher -// is used. You can assign the result of expression Foo(p1, ..., pk) -// to a variable of type FooMatcherPk. This -// can be useful when composing matchers. -// -// While you can instantiate a matcher template with reference types, -// passing the parameters by pointer usually makes your code more -// readable. If, however, you still want to pass a parameter by -// reference, be aware that in the failure message generated by the -// matcher you will see the value of the referenced object but not its -// address. -// -// Explaining Match Results -// ======================== -// -// Sometimes the matcher description alone isn't enough to explain why -// the match has failed or succeeded. For example, when expecting a -// long string, it can be very helpful to also print the diff between -// the expected string and the actual one. To achieve that, you can -// optionally stream additional information to a special variable -// named result_listener, whose type is a pointer to class -// MatchResultListener: -// -// MATCHER_P(EqualsLongString, str, "") { -// if (arg == str) return true; -// -// *result_listener << "the difference: " -/// << DiffStrings(str, arg); -// return false; -// } -// -// Overloading Matchers -// ==================== -// -// You can overload matchers with different numbers of parameters: -// -// MATCHER_P(Blah, a, description_string1) { ... } -// MATCHER_P2(Blah, a, b, description_string2) { ... } -// -// Caveats -// ======= -// -// When defining a new matcher, you should also consider implementing -// MatcherInterface or using MakePolymorphicMatcher(). These -// approaches require more work than the MATCHER* macros, but also -// give you more control on the types of the value being matched and -// the matcher parameters, which may leads to better compiler error -// messages when the matcher is used wrong. They also allow -// overloading matchers based on parameter types (as opposed to just -// based on the number of parameters). -// -// MATCHER*() can only be used in a namespace scope. The reason is -// that C++ doesn't yet allow function-local types to be used to -// instantiate templates. The up-coming C++0x standard will fix this. -// Once that's done, we'll consider supporting using MATCHER*() inside -// a function. -// -// More Information -// ================ -// -// To learn more about using these macros, please search for 'MATCHER' -// on http://code.google.com/p/googlemock/wiki/CookBook. - -$range i 0..n -$for i - -[[ -$var macro_name = [[$if i==0 [[MATCHER]] $elif i==1 [[MATCHER_P]] - $else [[MATCHER_P$i]]]] -$var class_name = [[name##Matcher[[$if i==0 [[]] $elif i==1 [[P]] - $else [[P$i]]]]]] -$range j 0..i-1 -$var template = [[$if i==0 [[]] $else [[ - - template <$for j, [[typename p$j##_type]]>\ -]]]] -$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] -$var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] -$var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] -$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] -$var params = [[$for j, [[p$j]]]] -$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] -$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] -$var param_field_decls = [[$for j -[[ - - p$j##_type p$j;\ -]]]] -$var param_field_decls2 = [[$for j -[[ - - p$j##_type p$j;\ -]]]] - -#define $macro_name(name$for j [[, p$j]], description)\$template - class $class_name {\ - public:\ - template \ - class gmock_Impl : public ::testing::MatcherInterface {\ - public:\ - [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\ - $impl_inits {}\ - virtual bool MatchAndExplain(\ - arg_type arg, ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\$param_field_decls - private:\ - ::testing::internal::string FormatDescription(bool negation) const {\ - const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ - return gmock_description;\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ - }\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template \ - operator ::testing::Matcher() const {\ - return ::testing::Matcher(\ - new gmock_Impl($params));\ - }\ - [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {\ - }\$param_field_decls2 - private:\ - GTEST_DISALLOW_ASSIGN_($class_name);\ - };\$template - inline $class_name$param_types name($param_types_and_names) {\ - return $class_name$param_types($params);\ - }\$template - template \ - bool $class_name$param_types::gmock_Impl::MatchAndExplain(\ - arg_type arg, \ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const -]] - - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h deleted file mode 100644 index 4095f4d5bc7..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +++ /dev/null @@ -1,397 +0,0 @@ -// This file was GENERATED by command: -// pump.py gmock-generated-nice-strict.h.pump -// DO NOT EDIT BY HAND!!! - -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// Implements class templates NiceMock, NaggyMock, and StrictMock. -// -// Given a mock class MockFoo that is created using Google Mock, -// NiceMock is a subclass of MockFoo that allows -// uninteresting calls (i.e. calls to mock methods that have no -// EXPECT_CALL specs), NaggyMock is a subclass of MockFoo -// that prints a warning when an uninteresting call occurs, and -// StrictMock is a subclass of MockFoo that treats all -// uninteresting calls as errors. -// -// Currently a mock is naggy by default, so MockFoo and -// NaggyMock behave like the same. However, we will soon -// switch the default behavior of mocks to be nice, as that in general -// leads to more maintainable tests. When that happens, MockFoo will -// stop behaving like NaggyMock and start behaving like -// NiceMock. -// -// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of -// their respective base class, with up-to 10 arguments. Therefore -// you can write NiceMock(5, "a") to construct a nice mock -// where MockFoo has a constructor that accepts (int, const char*), -// for example. -// -// A known limitation is that NiceMock, NaggyMock, -// and StrictMock only works for mock methods defined using -// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class. -// If a mock method is defined in a base class of MockFoo, the "nice" -// or "strict" modifier may not affect it, depending on the compiler. -// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT -// supported. -// -// Another known limitation is that the constructors of the base mock -// cannot have arguments passed by non-const reference, which are -// banned by the Google C++ style guide anyway. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ - -#include "gmock/gmock-spec-builders.h" -#include "gmock/internal/gmock-port.h" - -namespace testing { - -template -class NiceMock : public MockClass { - public: - // We don't factor out the constructor body to a common method, as - // we have to avoid a possible clash with members of MockClass. - NiceMock() { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - - // C++ doesn't (yet) allow inheritance of constructors, so we have - // to define it for each arity. - template - explicit NiceMock(const A1& a1) : MockClass(a1) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - template - NiceMock(const A1& a1, const A2& a2) : MockClass(a1, a2) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NiceMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NiceMock(const A1& a1, const A2& a2, const A3& a3, - const A4& a4) : MockClass(a1, a2, a3, a4) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5) : MockClass(a1, a2, a3, a4, a5) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5, - a6, a7) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1, - a2, a3, a4, a5, a6, a7, a8) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7, const A8& a8, - const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, - const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_(this)); - } - - virtual ~NiceMock() { - ::testing::Mock::UnregisterCallReaction( - internal::ImplicitCast_(this)); - } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock); -}; - -template -class NaggyMock : public MockClass { - public: - // We don't factor out the constructor body to a common method, as - // we have to avoid a possible clash with members of MockClass. - NaggyMock() { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - - // C++ doesn't (yet) allow inheritance of constructors, so we have - // to define it for each arity. - template - explicit NaggyMock(const A1& a1) : MockClass(a1) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - template - NaggyMock(const A1& a1, const A2& a2) : MockClass(a1, a2) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NaggyMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NaggyMock(const A1& a1, const A2& a2, const A3& a3, - const A4& a4) : MockClass(a1, a2, a3, a4) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5) : MockClass(a1, a2, a3, a4, a5) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5, - a6, a7) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1, - a2, a3, a4, a5, a6, a7, a8) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7, const A8& a8, - const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, - const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_(this)); - } - - virtual ~NaggyMock() { - ::testing::Mock::UnregisterCallReaction( - internal::ImplicitCast_(this)); - } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock); -}; - -template -class StrictMock : public MockClass { - public: - // We don't factor out the constructor body to a common method, as - // we have to avoid a possible clash with members of MockClass. - StrictMock() { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - - // C++ doesn't (yet) allow inheritance of constructors, so we have - // to define it for each arity. - template - explicit StrictMock(const A1& a1) : MockClass(a1) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - template - StrictMock(const A1& a1, const A2& a2) : MockClass(a1, a2) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - StrictMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - StrictMock(const A1& a1, const A2& a2, const A3& a3, - const A4& a4) : MockClass(a1, a2, a3, a4) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5) : MockClass(a1, a2, a3, a4, a5) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5, - a6, a7) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1, - a2, a3, a4, a5, a6, a7, a8) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7, const A8& a8, - const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - - template - StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, - const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, - const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_(this)); - } - - virtual ~StrictMock() { - ::testing::Mock::UnregisterCallReaction( - internal::ImplicitCast_(this)); - } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock); -}; - -// The following specializations catch some (relatively more common) -// user errors of nesting nice and strict mocks. They do NOT catch -// all possible errors. - -// These specializations are declared but not defined, as NiceMock, -// NaggyMock, and StrictMock cannot be nested. - -template -class NiceMock >; -template -class NiceMock >; -template -class NiceMock >; - -template -class NaggyMock >; -template -class NaggyMock >; -template -class NaggyMock >; - -template -class StrictMock >; -template -class StrictMock >; -template -class StrictMock >; - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump deleted file mode 100644 index 3ee1ce7f309..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +++ /dev/null @@ -1,161 +0,0 @@ -$$ -*- mode: c++; -*- -$$ This is a Pump source file. Please use Pump to convert it to -$$ gmock-generated-nice-strict.h. -$$ -$var n = 10 $$ The maximum arity we support. -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// Implements class templates NiceMock, NaggyMock, and StrictMock. -// -// Given a mock class MockFoo that is created using Google Mock, -// NiceMock is a subclass of MockFoo that allows -// uninteresting calls (i.e. calls to mock methods that have no -// EXPECT_CALL specs), NaggyMock is a subclass of MockFoo -// that prints a warning when an uninteresting call occurs, and -// StrictMock is a subclass of MockFoo that treats all -// uninteresting calls as errors. -// -// Currently a mock is naggy by default, so MockFoo and -// NaggyMock behave like the same. However, we will soon -// switch the default behavior of mocks to be nice, as that in general -// leads to more maintainable tests. When that happens, MockFoo will -// stop behaving like NaggyMock and start behaving like -// NiceMock. -// -// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of -// their respective base class, with up-to $n arguments. Therefore -// you can write NiceMock(5, "a") to construct a nice mock -// where MockFoo has a constructor that accepts (int, const char*), -// for example. -// -// A known limitation is that NiceMock, NaggyMock, -// and StrictMock only works for mock methods defined using -// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class. -// If a mock method is defined in a base class of MockFoo, the "nice" -// or "strict" modifier may not affect it, depending on the compiler. -// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT -// supported. -// -// Another known limitation is that the constructors of the base mock -// cannot have arguments passed by non-const reference, which are -// banned by the Google C++ style guide anyway. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ - -#include "gmock/gmock-spec-builders.h" -#include "gmock/internal/gmock-port.h" - -namespace testing { - -$range kind 0..2 -$for kind [[ - -$var clazz=[[$if kind==0 [[NiceMock]] - $elif kind==1 [[NaggyMock]] - $else [[StrictMock]]]] - -$var method=[[$if kind==0 [[AllowUninterestingCalls]] - $elif kind==1 [[WarnUninterestingCalls]] - $else [[FailUninterestingCalls]]]] - -template -class $clazz : public MockClass { - public: - // We don't factor out the constructor body to a common method, as - // we have to avoid a possible clash with members of MockClass. - $clazz() { - ::testing::Mock::$method( - internal::ImplicitCast_(this)); - } - - // C++ doesn't (yet) allow inheritance of constructors, so we have - // to define it for each arity. - template - explicit $clazz(const A1& a1) : MockClass(a1) { - ::testing::Mock::$method( - internal::ImplicitCast_(this)); - } - -$range i 2..n -$for i [[ -$range j 1..i - template <$for j, [[typename A$j]]> - $clazz($for j, [[const A$j& a$j]]) : MockClass($for j, [[a$j]]) { - ::testing::Mock::$method( - internal::ImplicitCast_(this)); - } - - -]] - virtual ~$clazz() { - ::testing::Mock::UnregisterCallReaction( - internal::ImplicitCast_(this)); - } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_($clazz); -}; - -]] - -// The following specializations catch some (relatively more common) -// user errors of nesting nice and strict mocks. They do NOT catch -// all possible errors. - -// These specializations are declared but not defined, as NiceMock, -// NaggyMock, and StrictMock cannot be nested. - -template -class NiceMock >; -template -class NiceMock >; -template -class NiceMock >; - -template -class NaggyMock >; -template -class NaggyMock >; -template -class NaggyMock >; - -template -class StrictMock >; -template -class StrictMock >; -template -class StrictMock >; - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-matchers.h b/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-matchers.h deleted file mode 100644 index c446bf7d338..00000000000 --- a/inference-engine/tests/ie_test_utils/common_test_utils/gtest/googlemock/include/gmock/gmock-matchers.h +++ /dev/null @@ -1,4416 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used argument matchers. More -// matchers can be defined by the user implementing the -// MatcherInterface interface if necessary. - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ - -#include -#include -#include -#include -#include // NOLINT -#include -#include -#include -#include - -#include "gmock/internal/gmock-internal-utils.h" -#include "gmock/internal/gmock-port.h" -#include "gtest/gtest.h" - -#if GTEST_HAS_STD_INITIALIZER_LIST_ -# include // NOLINT -- must be after gtest.h -#endif - -namespace testing { - -// To implement a matcher Foo for type T, define: -// 1. a class FooMatcherImpl that implements the -// MatcherInterface interface, and -// 2. a factory function that creates a Matcher object from a -// FooMatcherImpl*. -// -// The two-level delegation design makes it possible to allow a user -// to write "v" instead of "Eq(v)" where a Matcher is expected, which -// is impossible if we pass matchers by pointers. It also eases -// ownership management as Matcher objects can now be copied like -// plain values. - -// MatchResultListener is an abstract class. Its << operator can be -// used by a matcher to explain why a value matches or doesn't match. -// -// TODO(wan@google.com): add method -// bool InterestedInWhy(bool result) const; -// to indicate whether the listener is interested in why the match -// result is 'result'. -class MatchResultListener { - public: - // Creates a listener object with the given underlying ostream. The - // listener does not own the ostream, and does not dereference it - // in the constructor or destructor. - explicit MatchResultListener(::std::ostream* os) : stream_(os) {} - virtual ~MatchResultListener() = 0; // Makes this class abstract. - - // Streams x to the underlying ostream; does nothing if the ostream - // is NULL. - template - MatchResultListener& operator<<(const T& x) { - if (stream_ != NULL) - *stream_ << x; - return *this; - } - - // Returns the underlying ostream. - ::std::ostream* stream() { return stream_; } - - // Returns true iff the listener is interested in an explanation of - // the match result. A matcher's MatchAndExplain() method can use - // this information to avoid generating the explanation when no one - // intends to hear it. - bool IsInterested() const { return stream_ != NULL; } - - private: - ::std::ostream* const stream_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener); -}; - -inline MatchResultListener::~MatchResultListener() { -} - -// An instance of a subclass of this knows how to describe itself as a -// matcher. -class MatcherDescriberInterface { - public: - virtual ~MatcherDescriberInterface() {} - - // Describes this matcher to an ostream. The function should print - // a verb phrase that describes the property a value matching this - // matcher should have. The subject of the verb phrase is the value - // being matched. For example, the DescribeTo() method of the Gt(7) - // matcher prints "is greater than 7". - virtual void DescribeTo(::std::ostream* os) const = 0; - - // Describes the negation of this matcher to an ostream. For - // example, if the description of this matcher is "is greater than - // 7", the negated description could be "is not greater than 7". - // You are not required to override this when implementing - // MatcherInterface, but it is highly advised so that your matcher - // can produce good error messages. - virtual void DescribeNegationTo(::std::ostream* os) const { - *os << "not ("; - DescribeTo(os); - *os << ")"; - } -}; - -// The implementation of a matcher. -template -class MatcherInterface : public MatcherDescriberInterface { - public: - // Returns true iff the matcher matches x; also explains the match - // result to 'listener' if necessary (see the next paragraph), in - // the form of a non-restrictive relative clause ("which ...", - // "whose ...", etc) that describes x. For example, the - // MatchAndExplain() method of the Pointee(...) matcher should - // generate an explanation like "which points to ...". - // - // Implementations of MatchAndExplain() should add an explanation of - // the match result *if and only if* they can provide additional - // information that's not already present (or not obvious) in the - // print-out of x and the matcher's description. Whether the match - // succeeds is not a factor in deciding whether an explanation is - // needed, as sometimes the caller needs to print a failure message - // when the match succeeds (e.g. when the matcher is used inside - // Not()). - // - // For example, a "has at least 10 elements" matcher should explain - // what the actual element count is, regardless of the match result, - // as it is useful information to the reader; on the other hand, an - // "is empty" matcher probably only needs to explain what the actual - // size is when the match fails, as it's redundant to say that the - // size is 0 when the value is already known to be empty. - // - // You should override this method when defining a new matcher. - // - // It's the responsibility of the caller (Google Mock) to guarantee - // that 'listener' is not NULL. This helps to simplify a matcher's - // implementation when it doesn't care about the performance, as it - // can talk to 'listener' without checking its validity first. - // However, in order to implement dummy listeners efficiently, - // listener->stream() may be NULL. - virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0; - - // Inherits these methods from MatcherDescriberInterface: - // virtual void DescribeTo(::std::ostream* os) const = 0; - // virtual void DescribeNegationTo(::std::ostream* os) const; -}; - -// A match result listener that stores the explanation in a string. -class StringMatchResultListener : public MatchResultListener { - public: - StringMatchResultListener() : MatchResultListener(&ss_) {} - - // Returns the explanation accumulated so far. - std::string str() const { return ss_.str(); } - - // Clears the explanation accumulated so far. - void Clear() { ss_.str(""); } - - private: - ::std::stringstream ss_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(StringMatchResultListener); -}; - -namespace internal { - -struct AnyEq { - template - bool operator()(const A& a, const B& b) const { return a == b; } -}; -struct AnyNe { - template - bool operator()(const A& a, const B& b) const { return a != b; } -}; -struct AnyLt { - template - bool operator()(const A& a, const B& b) const { return a < b; } -}; -struct AnyGt { - template - bool operator()(const A& a, const B& b) const { return a > b; } -}; -struct AnyLe { - template - bool operator()(const A& a, const B& b) const { return a <= b; } -}; -struct AnyGe { - template - bool operator()(const A& a, const B& b) const { return a >= b; } -}; - -// A match result listener that ignores the explanation. -class DummyMatchResultListener : public MatchResultListener { - public: - DummyMatchResultListener() : MatchResultListener(NULL) {} - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener); -}; - -// A match result listener that forwards the explanation to a given -// ostream. The difference between this and MatchResultListener is -// that the former is concrete. -class StreamMatchResultListener : public MatchResultListener { - public: - explicit StreamMatchResultListener(::std::ostream* os) - : MatchResultListener(os) {} - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener); -}; - -// An internal class for implementing Matcher, which will derive -// from it. We put functionalities common to all Matcher -// specializations here to avoid code duplication. -template -class MatcherBase { - public: - // Returns true iff the matcher matches x; also explains the match - // result to 'listener'. - bool MatchAndExplain(T x, MatchResultListener* listener) const { - return impl_->MatchAndExplain(x, listener); - } - - // Returns true iff this matcher matches x. - bool Matches(T x) const { - DummyMatchResultListener dummy; - return MatchAndExplain(x, &dummy); - } - - // Describes this matcher to an ostream. - void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } - - // Describes the negation of this matcher to an ostream. - void DescribeNegationTo(::std::ostream* os) const { - impl_->DescribeNegationTo(os); - } - - // Explains why x matches, or doesn't match, the matcher. - void ExplainMatchResultTo(T x, ::std::ostream* os) const { - StreamMatchResultListener listener(os); - MatchAndExplain(x, &listener); - } - - // Returns the describer for this matcher object; retains ownership - // of the describer, which is only guaranteed to be alive when - // this matcher object is alive. - const MatcherDescriberInterface* GetDescriber() const { - return impl_.get(); - } - - protected: - MatcherBase() {} - - // Constructs a matcher from its implementation. - explicit MatcherBase(const MatcherInterface* impl) - : impl_(impl) {} - - virtual ~MatcherBase() {} - - private: - // shared_ptr (util/gtl/shared_ptr.h) and linked_ptr have similar - // interfaces. The former dynamically allocates a chunk of memory - // to hold the reference count, while the latter tracks all - // references using a circular linked list without allocating - // memory. It has been observed that linked_ptr performs better in - // typical scenarios. However, shared_ptr can out-perform - // linked_ptr when there are many more uses of the copy constructor - // than the default constructor. - // - // If performance becomes a problem, we should see if using - // shared_ptr helps. - ::testing::internal::linked_ptr > impl_; -}; - -} // namespace internal - -// A Matcher is a copyable and IMMUTABLE (except by assignment) -// object that can check whether a value of type T matches. The -// implementation of Matcher is just a linked_ptr to const -// MatcherInterface, so copying is fairly cheap. Don't inherit -// from Matcher! -template -class Matcher : public internal::MatcherBase { - public: - // Constructs a null matcher. Needed for storing Matcher objects in STL - // containers. A default-constructed matcher is not yet initialized. You - // cannot use it until a valid value has been assigned to it. - explicit Matcher() {} // NOLINT - - // Constructs a matcher from its implementation. - explicit Matcher(const MatcherInterface* impl) - : internal::MatcherBase(impl) {} - - // Implicit constructor here allows people to write - // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes - Matcher(T value); // NOLINT -}; - -// The following two specializations allow the user to write str -// instead of Eq(str) and "foo" instead of Eq("foo") when a string -// matcher is expected. -template <> -class GTEST_API_ Matcher - : public internal::MatcherBase { - public: - Matcher() {} - - explicit Matcher(const MatcherInterface* impl) - : internal::MatcherBase(impl) {} - - // Allows the user to write str instead of Eq(str) sometimes, where - // str is a string object. - Matcher(const internal::string& s); // NOLINT - - // Allows the user to write "foo" instead of Eq("foo") sometimes. - Matcher(const char* s); // NOLINT -}; - -template <> -class GTEST_API_ Matcher - : public internal::MatcherBase { - public: - Matcher() {} - - explicit Matcher(const MatcherInterface* impl) - : internal::MatcherBase(impl) {} - - // Allows the user to write str instead of Eq(str) sometimes, where - // str is a string object. - Matcher(const internal::string& s); // NOLINT - - // Allows the user to write "foo" instead of Eq("foo") sometimes. - Matcher(const char* s); // NOLINT -}; - -#if GTEST_HAS_STRING_PIECE_ -// The following two specializations allow the user to write str -// instead of Eq(str) and "foo" instead of Eq("foo") when a StringPiece -// matcher is expected. -template <> -class GTEST_API_ Matcher - : public internal::MatcherBase { - public: - Matcher() {} - - explicit Matcher(const MatcherInterface* impl) - : internal::MatcherBase(impl) {} - - // Allows the user to write str instead of Eq(str) sometimes, where - // str is a string object. - Matcher(const internal::string& s); // NOLINT - - // Allows the user to write "foo" instead of Eq("foo") sometimes. - Matcher(const char* s); // NOLINT - - // Allows the user to pass StringPieces directly. - Matcher(StringPiece s); // NOLINT -}; - -template <> -class GTEST_API_ Matcher - : public internal::MatcherBase { - public: - Matcher() {} - - explicit Matcher(const MatcherInterface* impl) - : internal::MatcherBase(impl) {} - - // Allows the user to write str instead of Eq(str) sometimes, where - // str is a string object. - Matcher(const internal::string& s); // NOLINT - - // Allows the user to write "foo" instead of Eq("foo") sometimes. - Matcher(const char* s); // NOLINT - - // Allows the user to pass StringPieces directly. - Matcher(StringPiece s); // NOLINT -}; -#endif // GTEST_HAS_STRING_PIECE_ - -// The PolymorphicMatcher class template makes it easy to implement a -// polymorphic matcher (i.e. a matcher that can match values of more -// than one type, e.g. Eq(n) and NotNull()). -// -// To define a polymorphic matcher, a user should provide an Impl -// class that has a DescribeTo() method and a DescribeNegationTo() -// method, and define a member function (or member function template) -// -// bool MatchAndExplain(const Value& value, -// MatchResultListener* listener) const; -// -// See the definition of NotNull() for a complete example. -template -class PolymorphicMatcher { - public: - explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {} - - // Returns a mutable reference to the underlying matcher - // implementation object. - Impl& mutable_impl() { return impl_; } - - // Returns an immutable reference to the underlying matcher - // implementation object. - const Impl& impl() const { return impl_; } - - template - operator Matcher() const { - return Matcher(new MonomorphicImpl(impl_)); - } - - private: - template - class MonomorphicImpl : public MatcherInterface { - public: - explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} - - virtual void DescribeTo(::std::ostream* os) const { - impl_.DescribeTo(os); - } - - virtual void DescribeNegationTo(::std::ostream* os) const { - impl_.DescribeNegationTo(os); - } - - virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { - return impl_.MatchAndExplain(x, listener); - } - - private: - const Impl impl_; - - GTEST_DISALLOW_ASSIGN_(MonomorphicImpl); - }; - - Impl impl_; - - GTEST_DISALLOW_ASSIGN_(PolymorphicMatcher); -}; - -// Creates a matcher from its implementation. This is easier to use -// than the Matcher constructor as it doesn't require you to -// explicitly write the template argument, e.g. -// -// MakeMatcher(foo); -// vs -// Matcher(foo); -template -inline Matcher MakeMatcher(const MatcherInterface* impl) { - return Matcher(impl); -} - -// Creates a polymorphic matcher from its implementation. This is -// easier to use than the PolymorphicMatcher constructor as it -// doesn't require you to explicitly write the template argument, e.g. -// -// MakePolymorphicMatcher(foo); -// vs -// PolymorphicMatcher(foo); -template -inline PolymorphicMatcher MakePolymorphicMatcher(const Impl& impl) { - return PolymorphicMatcher(impl); -} - -// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION -// and MUST NOT BE USED IN USER CODE!!! -namespace internal { - -// The MatcherCastImpl class template is a helper for implementing -// MatcherCast(). We need this helper in order to partially -// specialize the implementation of MatcherCast() (C++ allows -// class/struct templates to be partially specialized, but not -// function templates.). - -// This general version is used when MatcherCast()'s argument is a -// polymorphic matcher (i.e. something that can be converted to a -// Matcher but is not one yet; for example, Eq(value)) or a value (for -// example, "hello"). -template -class MatcherCastImpl { - public: - static Matcher Cast(const M& polymorphic_matcher_or_value) { - // M can be a polymorhic matcher, in which case we want to use - // its conversion operator to create Matcher. Or it can be a value - // that should be passed to the Matcher's constructor. - // - // We can't call Matcher(polymorphic_matcher_or_value) when M is a - // polymorphic matcher because it'll be ambiguous if T has an implicit - // constructor from M (this usually happens when T has an implicit - // constructor from any type). - // - // It won't work to unconditionally implict_cast - // polymorphic_matcher_or_value to Matcher because it won't trigger - // a user-defined conversion from M to T if one exists (assuming M is - // a value). - return CastImpl( - polymorphic_matcher_or_value, - BooleanConstant< - internal::ImplicitlyConvertible >::value>()); - } - - private: - static Matcher CastImpl(const M& value, BooleanConstant) { - // M can't be implicitly converted to Matcher, so M isn't a polymorphic - // matcher. It must be a value then. Use direct initialization to create - // a matcher. - return Matcher(ImplicitCast_(value)); - } - - static Matcher CastImpl(const M& polymorphic_matcher_or_value, - BooleanConstant) { - // M is implicitly convertible to Matcher, which means that either - // M is a polymorhpic matcher or Matcher has an implicit constructor - // from M. In both cases using the implicit conversion will produce a - // matcher. - // - // Even if T has an implicit constructor from M, it won't be called because - // creating Matcher would require a chain of two user-defined conversions - // (first to create T from M and then to create Matcher from T). - return polymorphic_matcher_or_value; - } -}; - -// This more specialized version is used when MatcherCast()'s argument -// is already a Matcher. This only compiles when type T can be -// statically converted to type U. -template -class MatcherCastImpl > { - public: - static Matcher Cast(const Matcher& source_matcher) { - return Matcher(new Impl(source_matcher)); - } - - private: - class Impl : public MatcherInterface { - public: - explicit Impl(const Matcher& source_matcher) - : source_matcher_(source_matcher) {} - - // We delegate the matching logic to the source matcher. - virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { - return source_matcher_.MatchAndExplain(static_cast(x), listener); - } - - virtual void DescribeTo(::std::ostream* os) const { - source_matcher_.DescribeTo(os); - } - - virtual void DescribeNegationTo(::std::ostream* os) const { - source_matcher_.DescribeNegationTo(os); - } - - private: - const Matcher source_matcher_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; -}; - -// This even more specialized version is used for efficiently casting -// a matcher to its own type. -template -class MatcherCastImpl > { - public: - static Matcher Cast(const Matcher& matcher) { return matcher; } -}; - -} // namespace internal - -// In order to be safe and clear, casting between different matcher -// types is done explicitly via MatcherCast(m), which takes a -// matcher m and returns a Matcher. It compiles only when T can be -// statically converted to the argument type of m. -template -inline Matcher MatcherCast(const M& matcher) { - return internal::MatcherCastImpl::Cast(matcher); -} - -// Implements SafeMatcherCast(). -// -// We use an intermediate class to do the actual safe casting as Nokia's -// Symbian compiler cannot decide between -// template ... (M) and -// template ... (const Matcher&) -// for function templates but can for member function templates. -template -class SafeMatcherCastImpl { - public: - // This overload handles polymorphic matchers and values only since - // monomorphic matchers are handled by the next one. - template - static inline Matcher Cast(const M& polymorphic_matcher_or_value) { - return internal::MatcherCastImpl::Cast(polymorphic_matcher_or_value); - } - - // This overload handles monomorphic matchers. - // - // In general, if type T can be implicitly converted to type U, we can - // safely convert a Matcher to a Matcher (i.e. Matcher is - // contravariant): just keep a copy of the original Matcher, convert the - // argument from type T to U, and then pass it to the underlying Matcher. - // The only exception is when U is a reference and T is not, as the - // underlying Matcher may be interested in the argument's address, which - // is not preserved in the conversion from T to U. - template - static inline Matcher Cast(const Matcher& matcher) { - // Enforce that T can be implicitly converted to U. - GTEST_COMPILE_ASSERT_((internal::ImplicitlyConvertible::value), - T_must_be_implicitly_convertible_to_U); - // Enforce that we are not converting a non-reference type T to a reference - // type U. - GTEST_COMPILE_ASSERT_( - internal::is_reference::value || !internal::is_reference::value, - cannot_convert_non_reference_arg_to_reference); - // In case both T and U are arithmetic types, enforce that the - // conversion is not lossy. - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(T) RawT; - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(U) RawU; - const bool kTIsOther = GMOCK_KIND_OF_(RawT) == internal::kOther; - const bool kUIsOther = GMOCK_KIND_OF_(RawU) == internal::kOther; - GTEST_COMPILE_ASSERT_( - kTIsOther || kUIsOther || - (internal::LosslessArithmeticConvertible::value), - conversion_of_arithmetic_types_must_be_lossless); - return MatcherCast(matcher); - } -}; - -template -inline Matcher SafeMatcherCast(const M& polymorphic_matcher) { - return SafeMatcherCastImpl::Cast(polymorphic_matcher); -} - -// A() returns a matcher that matches any value of type T. -template -Matcher A(); - -// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION -// and MUST NOT BE USED IN USER CODE!!! -namespace internal { - -// If the explanation is not empty, prints it to the ostream. -inline void PrintIfNotEmpty(const std::string& explanation, - ::std::ostream* os) { - if (explanation != "" && os != NULL) { - *os << ", " << explanation; - } -} - -// Returns true if the given type name is easy to read by a human. -// This is used to decide whether printing the type of a value might -// be helpful. -inline bool IsReadableTypeName(const std::string& type_name) { - // We consider a type name readable if it's short or doesn't contain - // a template or function type. - return (type_name.length() <= 20 || - type_name.find_first_of("<(") == std::string::npos); -} - -// Matches the value against the given matcher, prints the value and explains -// the match result to the listener. Returns the match result. -// 'listener' must not be NULL. -// Value cannot be passed by const reference, because some matchers take a -// non-const argument. -template -bool MatchPrintAndExplain(Value& value, const Matcher& matcher, - MatchResultListener* listener) { - if (!listener->IsInterested()) { - // If the listener is not interested, we do not need to construct the - // inner explanation. - return matcher.Matches(value); - } - - StringMatchResultListener inner_listener; - const bool match = matcher.MatchAndExplain(value, &inner_listener); - - UniversalPrint(value, listener->stream()); -#if GTEST_HAS_RTTI - const std::string& type_name = GetTypeName(); - if (IsReadableTypeName(type_name)) - *listener->stream() << " (of type " << type_name << ")"; -#endif - PrintIfNotEmpty(inner_listener.str(), listener->stream()); - - return match; -} - -// An internal helper class for doing compile-time loop on a tuple's -// fields. -template -class TuplePrefix { - public: - // TuplePrefix::Matches(matcher_tuple, value_tuple) returns true - // iff the first N fields of matcher_tuple matches the first N - // fields of value_tuple, respectively. - template - static bool Matches(const MatcherTuple& matcher_tuple, - const ValueTuple& value_tuple) { - return TuplePrefix::Matches(matcher_tuple, value_tuple) - && get(matcher_tuple).Matches(get(value_tuple)); - } - - // TuplePrefix::ExplainMatchFailuresTo(matchers, values, os) - // describes failures in matching the first N fields of matchers - // against the first N fields of values. If there is no failure, - // nothing will be streamed to os. - template - static void ExplainMatchFailuresTo(const MatcherTuple& matchers, - const ValueTuple& values, - ::std::ostream* os) { - // First, describes failures in the first N - 1 fields. - TuplePrefix::ExplainMatchFailuresTo(matchers, values, os); - - // Then describes the failure (if any) in the (N - 1)-th (0-based) - // field. - typename tuple_element::type matcher = - get(matchers); - typedef typename tuple_element::type Value; - Value value = get(values); - StringMatchResultListener listener; - if (!matcher.MatchAndExplain(value, &listener)) { - // TODO(wan): include in the message the name of the parameter - // as used in MOCK_METHOD*() when possible. - *os << " Expected arg #" << N - 1 << ": "; - get(matchers).DescribeTo(os); - *os << "\n Actual: "; - // We remove the reference in type Value to prevent the - // universal printer from printing the address of value, which - // isn't interesting to the user most of the time. The - // matcher's MatchAndExplain() method handles the case when - // the address is interesting. - internal::UniversalPrint(value, os); - PrintIfNotEmpty(listener.str(), os); - *os << "\n"; - } - } -}; - -// The base case. -template <> -class TuplePrefix<0> { - public: - template - static bool Matches(const MatcherTuple& /* matcher_tuple */, - const ValueTuple& /* value_tuple */) { - return true; - } - - template - static void ExplainMatchFailuresTo(const MatcherTuple& /* matchers */, - const ValueTuple& /* values */, - ::std::ostream* /* os */) {} -}; - -// TupleMatches(matcher_tuple, value_tuple) returns true iff all -// matchers in matcher_tuple match the corresponding fields in -// value_tuple. It is a compiler error if matcher_tuple and -// value_tuple have different number of fields or incompatible field -// types. -template -bool TupleMatches(const MatcherTuple& matcher_tuple, - const ValueTuple& value_tuple) { - // Makes sure that matcher_tuple and value_tuple have the same - // number of fields. - GTEST_COMPILE_ASSERT_(tuple_size::value == - tuple_size::value, - matcher_and_value_have_different_numbers_of_fields); - return TuplePrefix::value>:: - Matches(matcher_tuple, value_tuple); -} - -// Describes failures in matching matchers against values. If there -// is no failure, nothing will be streamed to os. -template -void ExplainMatchFailureTupleTo(const MatcherTuple& matchers, - const ValueTuple& values, - ::std::ostream* os) { - TuplePrefix::value>::ExplainMatchFailuresTo( - matchers, values, os); -} - -// TransformTupleValues and its helper. -// -// TransformTupleValuesHelper hides the internal machinery that -// TransformTupleValues uses to implement a tuple traversal. -template -class TransformTupleValuesHelper { - private: - typedef ::testing::tuple_size TupleSize; - - public: - // For each member of tuple 't', taken in order, evaluates '*out++ = f(t)'. - // Returns the final value of 'out' in case the caller needs it. - static OutIter Run(Func f, const Tuple& t, OutIter out) { - return IterateOverTuple()(f, t, out); - } - - private: - template - struct IterateOverTuple { - OutIter operator() (Func f, const Tup& t, OutIter out) const { - *out++ = f(::testing::get(t)); - return IterateOverTuple()(f, t, out); - } - }; - template - struct IterateOverTuple { - OutIter operator() (Func /* f */, const Tup& /* t */, OutIter out) const { - return out; - } - }; -}; - -// Successively invokes 'f(element)' on each element of the tuple 't', -// appending each result to the 'out' iterator. Returns the final value -// of 'out'. -template -OutIter TransformTupleValues(Func f, const Tuple& t, OutIter out) { - return TransformTupleValuesHelper::Run(f, t, out); -} - -// Implements A(). -template -class AnyMatcherImpl : public MatcherInterface { - public: - virtual bool MatchAndExplain( - T /* x */, MatchResultListener* /* listener */) const { return true; } - virtual void DescribeTo(::std::ostream* os) const { *os << "is anything"; } - virtual void DescribeNegationTo(::std::ostream* os) const { - // This is mostly for completeness' safe, as it's not very useful - // to write Not(A()). However we cannot completely rule out - // such a possibility, and it doesn't hurt to be prepared. - *os << "never matches"; - } -}; - -// Implements _, a matcher that matches any value of any -// type. This is a polymorphic matcher, so we need a template type -// conversion operator to make it appearing as a Matcher for any -// type T. -class AnythingMatcher { - public: - template - operator Matcher() const { return A(); } -}; - -// Implements a matcher that compares a given value with a -// pre-supplied value using one of the ==, <=, <, etc, operators. The -// two values being compared don't have to have the same type. -// -// The matcher defined here is polymorphic (for example, Eq(5) can be -// used to match an int, a short, a double, etc). Therefore we use -// a template type conversion operator in the implementation. -// -// The following template definition assumes that the Rhs parameter is -// a "bare" type (i.e. neither 'const T' nor 'T&'). -template -class ComparisonBase { - public: - explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {} - template - operator Matcher() const { - return MakeMatcher(new Impl(rhs_)); - } - - private: - template - class Impl : public MatcherInterface { - public: - explicit Impl(const Rhs& rhs) : rhs_(rhs) {} - virtual bool MatchAndExplain( - Lhs lhs, MatchResultListener* /* listener */) const { - return Op()(lhs, rhs_); - } - virtual void DescribeTo(::std::ostream* os) const { - *os << D::Desc() << " "; - UniversalPrint(rhs_, os); - } - virtual void DescribeNegationTo(::std::ostream* os) const { - *os << D::NegatedDesc() << " "; - UniversalPrint(rhs_, os); - } - private: - Rhs rhs_; - GTEST_DISALLOW_ASSIGN_(Impl); - }; - Rhs rhs_; - GTEST_DISALLOW_ASSIGN_(ComparisonBase); -}; - -template -class EqMatcher : public ComparisonBase, Rhs, AnyEq> { - public: - explicit EqMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyEq>(rhs) { } - static const char* Desc() { return "is equal to"; } - static const char* NegatedDesc() { return "isn't equal to"; } -}; -template -class NeMatcher : public ComparisonBase, Rhs, AnyNe> { - public: - explicit NeMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyNe>(rhs) { } - static const char* Desc() { return "isn't equal to"; } - static const char* NegatedDesc() { return "is equal to"; } -}; -template -class LtMatcher : public ComparisonBase, Rhs, AnyLt> { - public: - explicit LtMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyLt>(rhs) { } - static const char* Desc() { return "is <"; } - static const char* NegatedDesc() { return "isn't <"; } -}; -template -class GtMatcher : public ComparisonBase, Rhs, AnyGt> { - public: - explicit GtMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyGt>(rhs) { } - static const char* Desc() { return "is >"; } - static const char* NegatedDesc() { return "isn't >"; } -}; -template -class LeMatcher : public ComparisonBase, Rhs, AnyLe> { - public: - explicit LeMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyLe>(rhs) { } - static const char* Desc() { return "is <="; } - static const char* NegatedDesc() { return "isn't <="; } -}; -template -class GeMatcher : public ComparisonBase, Rhs, AnyGe> { - public: - explicit GeMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyGe>(rhs) { } - static const char* Desc() { return "is >="; } - static const char* NegatedDesc() { return "isn't >="; } -}; - -// Implements the polymorphic IsNull() matcher, which matches any raw or smart -// pointer that is NULL. -class IsNullMatcher { - public: - template - bool MatchAndExplain(const Pointer& p, - MatchResultListener* /* listener */) const { -#if GTEST_LANG_CXX11 - return p == nullptr; -#else // GTEST_LANG_CXX11 - return GetRawPointer(p) == NULL; -#endif // GTEST_LANG_CXX11 - } - - void DescribeTo(::std::ostream* os) const { *os << "is NULL"; } - void DescribeNegationTo(::std::ostream* os) const { - *os << "isn't NULL"; - } -}; - -// Implements the polymorphic NotNull() matcher, which matches any raw or smart -// pointer that is not NULL. -class NotNullMatcher { - public: - template - bool MatchAndExplain(const Pointer& p, - MatchResultListener* /* listener */) const { -#if GTEST_LANG_CXX11 - return p != nullptr; -#else // GTEST_LANG_CXX11 - return GetRawPointer(p) != NULL; -#endif // GTEST_LANG_CXX11 - } - - void DescribeTo(::std::ostream* os) const { *os << "isn't NULL"; } - void DescribeNegationTo(::std::ostream* os) const { - *os << "is NULL"; - } -}; - -// Ref(variable) matches any argument that is a reference to -// 'variable'. This matcher is polymorphic as it can match any -// super type of the type of 'variable'. -// -// The RefMatcher template class implements Ref(variable). It can -// only be instantiated with a reference type. This prevents a user -// from mistakenly using Ref(x) to match a non-reference function -// argument. For example, the following will righteously cause a -// compiler error: -// -// int n; -// Matcher m1 = Ref(n); // This won't compile. -// Matcher m2 = Ref(n); // This will compile. -template -class RefMatcher; - -template -class RefMatcher { - // Google Mock is a generic framework and thus needs to support - // mocking any function types, including those that take non-const - // reference arguments. Therefore the template parameter T (and - // Super below) can be instantiated to either a const type or a - // non-const type. - public: - // RefMatcher() takes a T& instead of const T&, as we want the - // compiler to catch using Ref(const_value) as a matcher for a - // non-const reference. - explicit RefMatcher(T& x) : object_(x) {} // NOLINT - - template - operator Matcher() const { - // By passing object_ (type T&) to Impl(), which expects a Super&, - // we make sure that Super is a super type of T. In particular, - // this catches using Ref(const_value) as a matcher for a - // non-const reference, as you cannot implicitly convert a const - // reference to a non-const reference. - return MakeMatcher(new Impl(object_)); - } - - private: - template - class Impl : public MatcherInterface { - public: - explicit Impl(Super& x) : object_(x) {} // NOLINT - - // MatchAndExplain() takes a Super& (as opposed to const Super&) - // in order to match the interface MatcherInterface. - virtual bool MatchAndExplain( - Super& x, MatchResultListener* listener) const { - *listener << "which is located @" << static_cast(&x); - return &x == &object_; - } - - virtual void DescribeTo(::std::ostream* os) const { - *os << "references the variable "; - UniversalPrinter::Print(object_, os); - } - - virtual void DescribeNegationTo(::std::ostream* os) const { - *os << "does not reference the variable "; - UniversalPrinter::Print(object_, os); - } - - private: - const Super& object_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - T& object_; - - GTEST_DISALLOW_ASSIGN_(RefMatcher); -}; - -// Polymorphic helper functions for narrow and wide string matchers. -inline bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs) { - return String::CaseInsensitiveCStringEquals(lhs, rhs); -} - -inline bool CaseInsensitiveCStringEquals(const wchar_t* lhs, - const wchar_t* rhs) { - return String::CaseInsensitiveWideCStringEquals(lhs, rhs); -} - -// String comparison for narrow or wide strings that can have embedded NUL -// characters. -template -bool CaseInsensitiveStringEquals(const StringType& s1, - const StringType& s2) { - // Are the heads equal? - if (!CaseInsensitiveCStringEquals(s1.c_str(), s2.c_str())) { - return false; - } - - // Skip the equal heads. - const typename StringType::value_type nul = 0; - const size_t i1 = s1.find(nul), i2 = s2.find(nul); - - // Are we at the end of either s1 or s2? - if (i1 == StringType::npos || i2 == StringType::npos) { - return i1 == i2; - } - - // Are the tails equal? - return CaseInsensitiveStringEquals(s1.substr(i1 + 1), s2.substr(i2 + 1)); -} - -// String matchers. - -// Implements equality-based string matchers like StrEq, StrCaseNe, and etc. -template -class StrEqualityMatcher { - public: - StrEqualityMatcher(const StringType& str, bool expect_eq, - bool case_sensitive) - : string_(str), expect_eq_(expect_eq), case_sensitive_(case_sensitive) {} - - // Accepts pointer types, particularly: - // const char* - // char* - // const wchar_t* - // wchar_t* - template - bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { - if (s == NULL) { - return !expect_eq_; - } - return MatchAndExplain(StringType(s), listener); - } - - // Matches anything that can convert to StringType. - // - // This is a template, not just a plain function with const StringType&, - // because StringPiece has some interfering non-explicit constructors. - template - bool MatchAndExplain(const MatcheeStringType& s, - MatchResultListener* /* listener */) const { - const StringType& s2(s); - const bool eq = case_sensitive_ ? s2 == string_ : - CaseInsensitiveStringEquals(s2, string_); - return expect_eq_ == eq; - } - - void DescribeTo(::std::ostream* os) const { - DescribeToHelper(expect_eq_, os); - } - - void DescribeNegationTo(::std::ostream* os) const { - DescribeToHelper(!expect_eq_, os); - } - - private: - void DescribeToHelper(bool expect_eq, ::std::ostream* os) const { - *os << (expect_eq ? "is " : "isn't "); - *os << "equal to "; - if (!case_sensitive_) { - *os << "(ignoring case) "; - } - UniversalPrint(string_, os); - } - - const StringType string_; - const bool expect_eq_; - const bool case_sensitive_; - - GTEST_DISALLOW_ASSIGN_(StrEqualityMatcher); -}; - -// Implements the polymorphic HasSubstr(substring) matcher, which -// can be used as a Matcher as long as T can be converted to a -// string. -template -class HasSubstrMatcher { - public: - explicit HasSubstrMatcher(const StringType& substring) - : substring_(substring) {} - - // Accepts pointer types, particularly: - // const char* - // char* - // const wchar_t* - // wchar_t* - template - bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { - return s != NULL && MatchAndExplain(StringType(s), listener); - } - - // Matches anything that can convert to StringType. - // - // This is a template, not just a plain function with const StringType&, - // because StringPiece has some interfering non-explicit constructors. - template - bool MatchAndExplain(const MatcheeStringType& s, - MatchResultListener* /* listener */) const { - const StringType& s2(s); - return s2.find(substring_) != StringType::npos; - } - - // Describes what this matcher matches. - void DescribeTo(::std::ostream* os) const { - *os << "has substring "; - UniversalPrint(substring_, os); - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "has no substring "; - UniversalPrint(substring_, os); - } - - private: - const StringType substring_; - - GTEST_DISALLOW_ASSIGN_(HasSubstrMatcher); -}; - -// Implements the polymorphic StartsWith(substring) matcher, which -// can be used as a Matcher as long as T can be converted to a -// string. -template -class StartsWithMatcher { - public: - explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) { - } - - // Accepts pointer types, particularly: - // const char* - // char* - // const wchar_t* - // wchar_t* - template - bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { - return s != NULL && MatchAndExplain(StringType(s), listener); - } - - // Matches anything that can convert to StringType. - // - // This is a template, not just a plain function with const StringType&, - // because StringPiece has some interfering non-explicit constructors. - template - bool MatchAndExplain(const MatcheeStringType& s, - MatchResultListener* /* listener */) const { - const StringType& s2(s); - return s2.length() >= prefix_.length() && - s2.substr(0, prefix_.length()) == prefix_; - } - - void DescribeTo(::std::ostream* os) const { - *os << "starts with "; - UniversalPrint(prefix_, os); - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "doesn't start with "; - UniversalPrint(prefix_, os); - } - - private: - const StringType prefix_; - - GTEST_DISALLOW_ASSIGN_(StartsWithMatcher); -}; - -// Implements the polymorphic EndsWith(substring) matcher, which -// can be used as a Matcher as long as T can be converted to a -// string. -template -class EndsWithMatcher { - public: - explicit EndsWithMatcher(const StringType& suffix) : suffix_(suffix) {} - - // Accepts pointer types, particularly: - // const char* - // char* - // const wchar_t* - // wchar_t* - template - bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { - return s != NULL && MatchAndExplain(StringType(s), listener); - } - - // Matches anything that can convert to StringType. - // - // This is a template, not just a plain function with const StringType&, - // because StringPiece has some interfering non-explicit constructors. - template - bool MatchAndExplain(const MatcheeStringType& s, - MatchResultListener* /* listener */) const { - const StringType& s2(s); - return s2.length() >= suffix_.length() && - s2.substr(s2.length() - suffix_.length()) == suffix_; - } - - void DescribeTo(::std::ostream* os) const { - *os << "ends with "; - UniversalPrint(suffix_, os); - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "doesn't end with "; - UniversalPrint(suffix_, os); - } - - private: - const StringType suffix_; - - GTEST_DISALLOW_ASSIGN_(EndsWithMatcher); -}; - -// Implements polymorphic matchers MatchesRegex(regex) and -// ContainsRegex(regex), which can be used as a Matcher as long as -// T can be converted to a string. -class MatchesRegexMatcher { - public: - MatchesRegexMatcher(const RE* regex, bool full_match) - : regex_(regex), full_match_(full_match) {} - - // Accepts pointer types, particularly: - // const char* - // char* - // const wchar_t* - // wchar_t* - template - bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { - return s != NULL && MatchAndExplain(std::string(s), listener); - } - - // Matches anything that can convert to std::string. - // - // This is a template, not just a plain function with const std::string&, - // because StringPiece has some interfering non-explicit constructors. - template - bool MatchAndExplain(const MatcheeStringType& s, - MatchResultListener* /* listener */) const { - const std::string& s2(s); - return full_match_ ? RE::FullMatch(s2, *regex_) : - RE::PartialMatch(s2, *regex_); - } - - void DescribeTo(::std::ostream* os) const { - *os << (full_match_ ? "matches" : "contains") - << " regular expression "; - UniversalPrinter::Print(regex_->pattern(), os); - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "doesn't " << (full_match_ ? "match" : "contain") - << " regular expression "; - UniversalPrinter::Print(regex_->pattern(), os); - } - - private: - const internal::linked_ptr regex_; - const bool full_match_; - - GTEST_DISALLOW_ASSIGN_(MatchesRegexMatcher); -}; - -// Implements a matcher that compares the two fields of a 2-tuple -// using one of the ==, <=, <, etc, operators. The two fields being -// compared don't have to have the same type. -// -// The matcher defined here is polymorphic (for example, Eq() can be -// used to match a tuple, a tuple, -// etc). Therefore we use a template type conversion operator in the -// implementation. -template -class PairMatchBase { - public: - template - operator Matcher< ::testing::tuple >() const { - return MakeMatcher(new Impl< ::testing::tuple >); - } - template - operator Matcher&>() const { - return MakeMatcher(new Impl&>); - } - - private: - static ::std::ostream& GetDesc(::std::ostream& os) { // NOLINT - return os << D::Desc(); - } - - template - class Impl : public MatcherInterface { - public: - virtual bool MatchAndExplain( - Tuple args, - MatchResultListener* /* listener */) const { - return Op()(::testing::get<0>(args), ::testing::get<1>(args)); - } - virtual void DescribeTo(::std::ostream* os) const { - *os << "are " << GetDesc; - } - virtual void DescribeNegationTo(::std::ostream* os) const { - *os << "aren't " << GetDesc; - } - }; -}; - -class Eq2Matcher : public PairMatchBase { - public: - static const char* Desc() { return "an equal pair"; } -}; -class Ne2Matcher : public PairMatchBase { - public: - static const char* Desc() { return "an unequal pair"; } -}; -class Lt2Matcher : public PairMatchBase { - public: - static const char* Desc() { return "a pair where the first < the second"; } -}; -class Gt2Matcher : public PairMatchBase { - public: - static const char* Desc() { return "a pair where the first > the second"; } -}; -class Le2Matcher : public PairMatchBase { - public: - static const char* Desc() { return "a pair where the first <= the second"; } -}; -class Ge2Matcher : public PairMatchBase { - public: - static const char* Desc() { return "a pair where the first >= the second"; } -}; - -// Implements the Not(...) matcher for a particular argument type T. -// We do not nest it inside the NotMatcher class template, as that -// will prevent different instantiations of NotMatcher from sharing -// the same NotMatcherImpl class. -template -class NotMatcherImpl : public MatcherInterface { - public: - explicit NotMatcherImpl(const Matcher& matcher) - : matcher_(matcher) {} - - virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { - return !matcher_.MatchAndExplain(x, listener); - } - - virtual void DescribeTo(::std::ostream* os) const { - matcher_.DescribeNegationTo(os); - } - - virtual void DescribeNegationTo(::std::ostream* os) const { - matcher_.DescribeTo(os); - } - - private: - const Matcher matcher_; - - GTEST_DISALLOW_ASSIGN_(NotMatcherImpl); -}; - -// Implements the Not(m) matcher, which matches a value that doesn't -// match matcher m. -template -class NotMatcher { - public: - explicit NotMatcher(InnerMatcher matcher) : matcher_(matcher) {} - - // This template type conversion operator allows Not(m) to be used - // to match any type m can match. - template - operator Matcher() const { - return Matcher(new NotMatcherImpl(SafeMatcherCast(matcher_))); - } - - private: - InnerMatcher matcher_; - - GTEST_DISALLOW_ASSIGN_(NotMatcher); -}; - -// Implements the AllOf(m1, m2) matcher for a particular argument type -// T. We do not nest it inside the BothOfMatcher class template, as -// that will prevent different instantiations of BothOfMatcher from -// sharing the same BothOfMatcherImpl class. -template -class BothOfMatcherImpl : public MatcherInterface { - public: - BothOfMatcherImpl(const Matcher& matcher1, const Matcher& matcher2) - : matcher1_(matcher1), matcher2_(matcher2) {} - - virtual void DescribeTo(::std::ostream* os) const { - *os << "("; - matcher1_.DescribeTo(os); - *os << ") and ("; - matcher2_.DescribeTo(os); - *os << ")"; - } - - virtual void DescribeNegationTo(::std::ostream* os) const { - *os << "("; - matcher1_.DescribeNegationTo(os); - *os << ") or ("; - matcher2_.DescribeNegationTo(os); - *os << ")"; - } - - virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { - // If either matcher1_ or matcher2_ doesn't match x, we only need - // to explain why one of them fails. - StringMatchResultListener listener1; - if (!matcher1_.MatchAndExplain(x, &listener1)) { - *listener << listener1.str(); - return false; - } - - StringMatchResultListener listener2; - if (!matcher2_.MatchAndExplain(x, &listener2)) { - *listener << listener2.str(); - return false; - } - - // Otherwise we need to explain why *both* of them match. - const std::string s1 = listener1.str(); - const std::string s2 = listener2.str(); - - if (s1 == "") { - *listener << s2; - } else { - *listener << s1; - if (s2 != "") { - *listener << ", and " << s2; - } - } - return true; - } - - private: - const Matcher matcher1_; - const Matcher matcher2_; - - GTEST_DISALLOW_ASSIGN_(BothOfMatcherImpl); -}; - -#if GTEST_LANG_CXX11 -// MatcherList provides mechanisms for storing a variable number of matchers in -// a list structure (ListType) and creating a combining matcher from such a -// list. -// The template is defined recursively using the following template paramters: -// * kSize is the length of the MatcherList. -// * Head is the type of the first matcher of the list. -// * Tail denotes the types of the remaining matchers of the list. -template -struct MatcherList { - typedef MatcherList MatcherListTail; - typedef ::std::pair ListType; - - // BuildList stores variadic type values in a nested pair structure. - // Example: - // MatcherList<3, int, string, float>::BuildList(5, "foo", 2.0) will return - // the corresponding result of type pair>. - static ListType BuildList(const Head& matcher, const Tail&... tail) { - return ListType(matcher, MatcherListTail::BuildList(tail...)); - } - - // CreateMatcher creates a Matcher from a given list of matchers (built - // by BuildList()). CombiningMatcher is used to combine the matchers of the - // list. CombiningMatcher must implement MatcherInterface and have a - // constructor taking two Matchers as input. - template class CombiningMatcher> - static Matcher CreateMatcher(const ListType& matchers) { - return Matcher(new CombiningMatcher( - SafeMatcherCast(matchers.first), - MatcherListTail::template CreateMatcher( - matchers.second))); - } -}; - -// The following defines the base case for the recursive definition of -// MatcherList. -template -struct MatcherList<2, Matcher1, Matcher2> { - typedef ::std::pair ListType; - - static ListType BuildList(const Matcher1& matcher1, - const Matcher2& matcher2) { - return ::std::pair(matcher1, matcher2); - } - - template class CombiningMatcher> - static Matcher CreateMatcher(const ListType& matchers) { - return Matcher(new CombiningMatcher( - SafeMatcherCast(matchers.first), - SafeMatcherCast(matchers.second))); - } -}; - -// VariadicMatcher is used for the variadic implementation of -// AllOf(m_1, m_2, ...) and AnyOf(m_1, m_2, ...). -// CombiningMatcher is used to recursively combine the provided matchers -// (of type Args...). -template