summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiwoong Ha <kw1981.ha@samsung.com>2022-10-20 19:24:29 +0900
committerKiwoong Ha <kw1981.ha@samsung.com>2022-10-20 19:33:57 +0900
commit7ad403e7eb03d3bf9a47775176c7c041d1b77006 (patch)
treef9fc5107ab79eac6aa8c62714fdb08317cd30e2b
parent1cdf6edc1d76d77690c7e777b20147d1f253ccc6 (diff)
downloaddocker-launcher-7ad403e7eb03d3bf9a47775176c7c041d1b77006.tar.gz
docker-launcher-7ad403e7eb03d3bf9a47775176c7c041d1b77006.tar.bz2
docker-launcher-7ad403e7eb03d3bf9a47775176c7c041d1b77006.zip
Apply new initial source code of docker-launcheraccepted/tizen/unified/20221101.090301
Change-Id: I165ae1d0fae3c0df1a1fa7c668363a3d651881c1 Signed-off-by: Kiwoong Ha <kw1981.ha@samsung.com>
-rw-r--r--CMakeLists.txt50
-rw-r--r--LICENSE (renamed from LICENSE.APLv2)19
-rw-r--r--[-rwxr-xr-x]README.md98
-rwxr-xr-xdata/config/dockerd/dockerd_start.json6
-rwxr-xr-xdata/config/init/factory_init.json1
-rw-r--r--include/dockzen_types.h108
-rwxr-xr-xpackaging/docker-launcher-client.manifest5
-rwxr-xr-xpackaging/docker-launcher.manifest4
-rw-r--r--[-rwxr-xr-x]packaging/docker-launcher.service14
-rwxr-xr-xpackaging/docker-launcher.spec123
-rwxr-xr-xscripts/crash-forwarder.py167
-rwxr-xr-xsrc/CMakeLists.txt32
-rw-r--r--src/Config/Config.cpp482
-rw-r--r--src/Config/Config.h204
-rw-r--r--src/ContainerLifecycleManager.cpp410
-rw-r--r--src/ContainerLifecycleManager.h317
-rw-r--r--src/ContainerManager.cpp351
-rw-r--r--src/ContainerManager.h62
-rw-r--r--src/Controller/ContainerController.cpp12
-rw-r--r--src/Controller/ContainerController.h66
-rw-r--r--src/Controller/CurlRestInterface.cpp191
-rw-r--r--src/Controller/CurlRestInterface.h89
-rw-r--r--src/Controller/DockerController.cpp500
-rw-r--r--src/Controller/DockerController.h115
-rw-r--r--src/Controller/RestInterface.h173
-rw-r--r--src/DockerLauncher.cpp276
-rw-r--r--src/DockerLauncher.h50
-rw-r--r--src/Extension/CrashForward.cpp156
-rw-r--r--src/Extension/CrashForward.h50
-rw-r--r--src/Extension/Extension.cpp42
-rw-r--r--src/Extension/Extension.h58
-rw-r--r--src/Extension/Presets.cpp284
-rw-r--r--src/Extension/Presets.h92
-rw-r--r--src/Extension/Tizen.cpp105
-rw-r--r--src/Extension/Tizen.h38
-rw-r--r--src/Volumes/BlockDevice.cpp121
-rw-r--r--src/Volumes/BlockDevice.h46
-rw-r--r--src/Volumes/LoopDevice.cpp361
-rw-r--r--src/Volumes/LoopDevice.h69
-rw-r--r--src/Volumes/VolumeDriver.h41
-rw-r--r--src/Volumes/VolumeManager.cpp135
-rw-r--r--src/Volumes/VolumeManager.h51
-rw-r--r--src/Volumes/Volumes.cpp168
-rw-r--r--src/Volumes/Volumes.h32
-rw-r--r--src/docker-launcher.cpp58
-rw-r--r--src/dzl_device.c11
-rw-r--r--src/dzl_device.h16
-rw-r--r--src/dzl_dockercomm.c202
-rw-r--r--src/dzl_dockercomm.h109
-rwxr-xr-xsrc/dzl_dockerctl.c2206
-rw-r--r--src/dzl_dockerctl.h224
-rwxr-xr-xsrc/dzl_dockerform.c985
-rw-r--r--src/dzl_dockerform.h205
-rw-r--r--src/dzl_interface.c94
-rw-r--r--src/dzl_interface.h30
-rw-r--r--src/dzl_launcher.c33
-rwxr-xr-xsrc/dzl_lifecycle.c537
-rw-r--r--src/dzl_lifecycle.h82
-rw-r--r--src/dzl_server.c106
-rw-r--r--src/dzl_server.h45
-rwxr-xr-xsrc/dzl_setting.c465
-rw-r--r--src/dzl_setting.h91
-rw-r--r--src/include/Container.h30
-rw-r--r--src/include/Image.h31
-rw-r--r--src/include/Volume.h53
-rwxr-xr-xsrc/include/dzl_internal_types.h296
-rw-r--r--src/include/internal_macros.h16
-rw-r--r--src/include/internal_types.h137
-rwxr-xr-xsrc/lib/CMakeLists.txt21
-rwxr-xr-xsrc/lib/build.sh45
-rw-r--r--src/lib/install/amd64/lib/libdockzen.abin50102 -> 0 bytes
-rw-r--r--src/lib/install/amd64/lib/libjson-c.abin251020 -> 0 bytes
-rw-r--r--src/lib/install/amd64/lib/libjson-c.la41
l---------src/lib/install/amd64/lib/libjson-c.so1
l---------src/lib/install/amd64/lib/libjson-c.so.21
-rw-r--r--src/lib/install/amd64/lib/libjson-c.so.2.0.2bin148648 -> 0 bytes
-rwxr-xr-xsrc/lib/install/arm/include/curl/curl.h2553
-rwxr-xr-xsrc/lib/install/arm/include/curl/curlbuild.h198
-rwxr-xr-xsrc/lib/install/arm/include/curl/curlrules.h239
-rwxr-xr-xsrc/lib/install/arm/include/curl/curlver.h77
-rwxr-xr-xsrc/lib/install/arm/include/curl/easy.h102
-rwxr-xr-xsrc/lib/install/arm/include/curl/mprintf.h50
-rwxr-xr-xsrc/lib/install/arm/include/curl/multi.h439
-rwxr-xr-xsrc/lib/install/arm/include/curl/stdcheaders.h33
-rwxr-xr-xsrc/lib/install/arm/include/curl/system.h484
-rwxr-xr-xsrc/lib/install/arm/include/curl/typecheck-gcc.h668
-rwxr-xr-xsrc/lib/install/arm/lib/libcurl.abin523294 -> 0 bytes
-rwxr-xr-xsrc/lib/install/arm/lib/libcurl.la41
-rwxr-xr-xsrc/lib/install/arm/lib/libcurl.sobin353040 -> 0 bytes
-rwxr-xr-xsrc/lib/install/arm/lib/libcurl.so.4bin353040 -> 0 bytes
-rwxr-xr-xsrc/lib/install/arm/lib/libcurl.so.4.4.0bin353040 -> 0 bytes
-rw-r--r--src/lib/install/arm/lib/libdockzen.abin40330 -> 0 bytes
-rwxr-xr-xsrc/lib/install/arm/lib/libgmock.abin2570930 -> 0 bytes
-rwxr-xr-xsrc/lib/install/arm/lib/libgmock_main.abin2574978 -> 0 bytes
-rw-r--r--src/lib/install/arm/lib/libjson-c.abin164780 -> 0 bytes
-rw-r--r--src/lib/install/arm/lib/libjson-c.la41
l---------src/lib/install/arm/lib/libjson-c.so1
l---------src/lib/install/arm/lib/libjson-c.so.21
-rw-r--r--src/lib/install/arm/lib/libjson-c.so.2.0.2bin138296 -> 0 bytes
-rw-r--r--src/lib/install/arm/lib/libyaml.abin470308 -> 0 bytes
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-actions.h1205
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-cardinalities.h147
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-generated-actions.h2377
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-generated-actions.h.pump794
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-generated-function-mockers.h1095
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-generated-function-mockers.h.pump291
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-generated-matchers.h2179
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-generated-matchers.h.pump672
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-generated-nice-strict.h397
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-generated-nice-strict.h.pump161
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-matchers.h4397
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-more-actions.h246
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-more-matchers.h58
-rwxr-xr-xsrc/lib/install/include/gmock/gmock-spec-builders.h1850
-rwxr-xr-xsrc/lib/install/include/gmock/gmock.h94
-rwxr-xr-xsrc/lib/install/include/gmock/internal/custom/gmock-generated-actions.h8
-rwxr-xr-xsrc/lib/install/include/gmock/internal/custom/gmock-generated-actions.h.pump10
-rwxr-xr-xsrc/lib/install/include/gmock/internal/custom/gmock-matchers.h39
-rwxr-xr-xsrc/lib/install/include/gmock/internal/custom/gmock-port.h46
-rwxr-xr-xsrc/lib/install/include/gmock/internal/gmock-generated-internal-utils.h279
-rwxr-xr-xsrc/lib/install/include/gmock/internal/gmock-generated-internal-utils.h.pump136
-rwxr-xr-xsrc/lib/install/include/gmock/internal/gmock-internal-utils.h510
-rwxr-xr-xsrc/lib/install/include/gmock/internal/gmock-port.h91
-rwxr-xr-xsrc/lib/install/include/gtest/gtest-death-test.h294
-rwxr-xr-xsrc/lib/install/include/gtest/gtest-message.h250
-rwxr-xr-xsrc/lib/install/include/gtest/gtest-param-test.h1444
-rwxr-xr-xsrc/lib/install/include/gtest/gtest-param-test.h.pump510
-rwxr-xr-xsrc/lib/install/include/gtest/gtest-printers.h1006
-rwxr-xr-xsrc/lib/install/include/gtest/gtest-spi.h231
-rwxr-xr-xsrc/lib/install/include/gtest/gtest-test-part.h179
-rwxr-xr-xsrc/lib/install/include/gtest/gtest-typed-test.h264
-rwxr-xr-xsrc/lib/install/include/gtest/gtest.h2240
-rwxr-xr-xsrc/lib/install/include/gtest/gtest_pred_impl.h358
-rwxr-xr-xsrc/lib/install/include/gtest/gtest_prod.h58
-rwxr-xr-xsrc/lib/install/include/gtest/internal/custom/gtest-port.h72
-rwxr-xr-xsrc/lib/install/include/gtest/internal/custom/gtest-printers.h42
-rwxr-xr-xsrc/lib/install/include/gtest/internal/custom/gtest.h45
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-death-test-internal.h319
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-filepath.h206
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-internal.h1239
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-linked_ptr.h243
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-param-util-generated.h5146
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-param-util-generated.h.pump286
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-param-util.h730
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-port-arch.h95
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-port.h2591
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-string.h167
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-tuple.h1020
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-tuple.h.pump347
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-type-util.h3331
-rwxr-xr-xsrc/lib/install/include/gtest/internal/gtest-type-util.h.pump297
-rw-r--r--src/lib/install/include/json-c/arraylist.h56
-rw-r--r--src/lib/install/include/json-c/bits.h28
-rw-r--r--src/lib/install/include/json-c/debug.h71
-rw-r--r--src/lib/install/include/json-c/json.h34
-rw-r--r--src/lib/install/include/json-c/json_c_version.h22
-rw-r--r--src/lib/install/include/json-c/json_config.h4
-rw-r--r--src/lib/install/include/json-c/json_inttypes.h28
-rw-r--r--src/lib/install/include/json-c/json_object.h612
-rw-r--r--src/lib/install/include/json-c/json_object_iterator.h239
-rw-r--r--src/lib/install/include/json-c/json_object_private.h47
-rw-r--r--src/lib/install/include/json-c/json_tokener.h208
-rw-r--r--src/lib/install/include/json-c/json_util.h41
-rw-r--r--src/lib/install/include/json-c/linkhash.h292
-rw-r--r--src/lib/install/include/json-c/printbuf.h77
-rw-r--r--src/lib/install/include/json-c/random_seed.h25
-rw-r--r--src/lib/install/include/yaml/yaml.h1970
-rwxr-xr-xsrc/lib/ipc.c252
-rwxr-xr-xsrc/lib/ipc.h192
-rwxr-xr-xsrc/lib/ipc_client.c219
-rwxr-xr-xsrc/lib/ipc_client.h33
-rwxr-xr-xsrc/lib/ipc_config.h19
-rwxr-xr-xsrc/lib/json_util.c174
-rwxr-xr-xsrc/lib/json_util.h69
-rw-r--r--src/lib/test/CMakeLists.txt10
-rwxr-xr-xsrc/lib/test/build.sh40
-rwxr-xr-xsrc/lib/test/client.c150
-rwxr-xr-xsrc/lib/test/server.c321
-rwxr-xr-xsrc/lib/test/server_cb.c90
-rwxr-xr-xsrc/lib/test/testbin1400600 -> 0 bytes
-rwxr-xr-xsrc/lib/test/test-armbin1060860 -> 0 bytes
-rw-r--r--src/lib/yaml_util.c127
-rw-r--r--src/lib/yaml_util.h28
-rwxr-xr-xsrc/unittest/CMakeLists.txt24
-rwxr-xr-xsrc/unittest/beluga_launcher_test.c39
-rw-r--r--src/util/JsonTools.h151
-rw-r--r--src/util/JsonTools/Transform.hpp310
-rw-r--r--src/util/blkid.h84
-rw-r--r--src/util/error.h42
-rw-r--r--src/util/log.h52
-rw-r--r--src/util/system.cpp207
-rw-r--r--src/util/system.h154
-rw-r--r--src/util/util.h114
-rw-r--r--sysctl.d/99-docker-launcher.conf.in1
-rw-r--r--test/CMakeLists.txt28
-rw-r--r--test/Controller/CMakeLists.txt22
-rw-r--r--test/Controller/MockRestInterface.h22
-rw-r--r--test/Controller/container-controller-test.cpp31
-rw-r--r--test/Controller/curl-rest-interface-test.cpp123
-rw-r--r--test/Controller/docker-controller-test.DockerControllerTest.__generate_container_create_dataTest.approved.txt1
-rw-r--r--test/Controller/docker-controller-test.DockerControllerTest.__generate_image_build_dataTest.approved.txt1
-rw-r--r--test/Controller/docker-controller-test.cpp411
-rw-r--r--test/Controller/rest-interface-test.cpp125
-rw-r--r--test/Extension/CMakeLists.txt22
-rw-r--r--test/Extension/crash-forward-test.cpp104
-rw-r--r--test/Extension/extension-test.cpp49
-rw-r--r--test/Extension/presets-test.cpp136
-rw-r--r--test/Extension/tizen-test.cpp66
-rw-r--r--test/Volumes/CMakeLists.txt22
-rw-r--r--test/Volumes/MockVolume.h31
-rw-r--r--test/Volumes/blockdevice-test.cpp125
-rw-r--r--test/Volumes/loopdevice-test.cpp307
-rw-r--r--test/Volumes/volume-manager-test.cpp111
-rw-r--r--test/Volumes/volumes-ext-test.cpp130
-rw-r--r--test/container-lifecycle-manager-test.cpp112
-rw-r--r--test/container-manager-test.cpp100
-rw-r--r--test/docker-launcher-test.cpp191
-rw-r--r--test/googletest_approval_main.cpp2
-rw-r--r--test/lib/ApprovalTests.hpp1
-rw-r--r--test/lib/ApprovalTests.v.10.12.1.hpp6792
-rw-r--r--test/lib/CMakeLists.txt6
-rwxr-xr-xtest/run_test.sh17
-rw-r--r--test/testfiles/empty.json1
-rw-r--r--test/testfiles/invalid.json1
-rw-r--r--test/testfiles/lodev.imgbin0 -> 4194304 bytes
-rwxr-xr-xtest/testfiles/prepare.sh53
-rw-r--r--test/testfiles/rpi4/hal/etc/docker/devices.json34
-rw-r--r--test/testfiles/rpi4/opt/data/container/list/config-tizen-headed.json5
-rw-r--r--test/testfiles/rpi4/opt/data/container/tizen-headed/configs/seccomp-tizen.json842
-rw-r--r--test/testfiles/rpi4/opt/data/container/tizen-headed/configs/tizen-headed.json123
-rw-r--r--test/testfiles/rpi4/opt/data/container/tizen-headed/images/ramdisk.img1
-rw-r--r--[-rwxr-xr-x]test/testfiles/rpi4/opt/data/container/tizen-headed/tizen-init.tar (renamed from unittest/pre/beluga/setup-adaptor/images/beluga-agent.tar)bin12823552 -> 12421120 bytes
-rw-r--r--test/testfiles/system.testfile1
-rw-r--r--test/testfiles/testfile.txt1
-rw-r--r--test/testfiles/volume-test.json46
-rw-r--r--test/util/CMakeLists.txt22
-rw-r--r--test/util/blkid-test.cpp54
-rw-r--r--test/util/error-test.cpp28
-rw-r--r--test/util/jsontools-test.JsonToolsTest.parseFromFileTests.approved.txt5
-rw-r--r--test/util/jsontools-test.JsonToolsTest.parseFromStringTests.approved.txt5
-rw-r--r--test/util/jsontools-test.JsonToolsTest.writeToStringTests.approved.txt1
-rw-r--r--test/util/jsontools-test.cpp34
-rw-r--r--test/util/system-test.cpp153
-rw-r--r--test/util/system-test.systemTestSubProcess.executeTest.approved.txt2
-rw-r--r--test/util/system-test.systemTestSubProcess.pipeTest.approved.txt1
-rw-r--r--test/util/util-test.cpp79
-rw-r--r--tool/CMakeLists.txt20
-rw-r--r--tool/DockerLauncherCli.cpp155
-rw-r--r--tool/dockzen_launcher_cli.c374
-rw-r--r--tool/dockzen_launcher_json.c51
-rwxr-xr-xunit-test.sh11
-rwxr-xr-xunittest/CMakeLists.txt58
-rwxr-xr-xunittest/beluga-launcher_dzl_dockerctl.cpp64
-rwxr-xr-xunittest/beluga-launcher_dzl_dockerform.cpp291
-rwxr-xr-xunittest/beluga-launcher_dzl_interface.cpp18
-rwxr-xr-xunittest/beluga-launcher_dzl_lifecycle.cpp75
-rwxr-xr-xunittest/beluga-launcher_dzl_setting.cpp23
-rwxr-xr-xunittest/beluga-launcher_main.cpp13
-rwxr-xr-xunittest/dockzen_api/CMakeLists.txt54
-rw-r--r--unittest/dockzen_api/dzl_interface.cpp123
-rwxr-xr-xunittest/gtest-beluga-launcherbin1402168 -> 0 bytes
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/cert/SRnD+Web+Proxy.crt25
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/config/config.json1
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/config/set_eth_config.sh72
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/config/set_wifi_config.sh79
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/container/config-agent.yml15
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/container/config-service.yml14
-rwxr-xr-xunittest/pre/beluga/setup-adaptor/images/pharos-node-artik530.tarbin16043520 -> 0 bytes
-rwxr-xr-xunittest/pre/beluga/system/docker/dockerd_start.json6
-rwxr-xr-xunittest/pre/beluga/system/env/environment0
-rwxr-xr-xunittest/pre/beluga/system/env/factory_init.json1
-rwxr-xr-xunittest/pre/beluga/system/release/beluga-release2
-rwxr-xr-xunittest/pre/beluga/system/tools/agent_config.sh64
-rwxr-xr-xunittest/pre/beluga/system/tools/agent_reset.sh31
-rwxr-xr-xunittest/pre/beluga/system/tools/availables-dockerd/dockerd_start-default.json4
-rwxr-xr-xunittest/pre/beluga/system/tools/dockerd_start.jsonbin108 -> 0 bytes
-rwxr-xr-xunittest/pre/beluga/system/tools/dockzen_agent-default.json10
-rwxr-xr-xunittest/pre/beluga/system/tools/dockzen_agent-headed-iiot.json10
-rwxr-xr-xunittest/pre/beluga/system/tools/dockzen_agent-headed.json10
-rwxr-xr-xunittest/pre/beluga/system/tools/dockzen_agent-headless-iiot.json10
-rwxr-xr-xunittest/pre/beluga/system/tools/dockzen_agent-headless.json10
-rwxr-xr-xunittest/pre/test_condition.sh6
282 files changed, 17599 insertions, 58301 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90afbee..bad1ef5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,27 +1,41 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(docker-launcher C CXX)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+PROJECT(docker-launcher)
+
+OPTION(PLATFORM "build for Tizen platform" "linux")
+
+OPTION(BUILD_UNITTEST "Enable building unittest" ON)
+OPTION(BUILD_COVERAGE "Enable building with test coverage" ON)
+
+SET(EXTRA_CXXFLAGS "-Wall -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "-std=c++17 -fPIE -pie ${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
+
+IF(BUILD_COVERAGE)
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
+ENDIF(BUILD_COVERAGE)
+
+SET(DOCKER-LAUNCHER ${PROJECT_NAME})
INCLUDE(FindPkgConfig)
+find_package (Threads)
+SET(pkgs libcurl jsoncpp blkid mount libcap)
-SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+IF(PLATFORM STREQUAL "tizen")
+ ADD_DEFINITIONS( -DTIZEN )
+ SET(BUILD_PLATFORM_TIZEN)
+ SET(pkgs ${pkgs} dlog)
+ENDIF()
-SET(CLIENT ${PROJECT_NAME})
+pkg_check_modules(pkgs REQUIRED ${pkgs})
+INCLUDE_DIRECTORIES(${pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${pkgs_LIBRARY_DIRS})
+
+ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(tool)
+
+IF(BUILD_UNITTEST)
+ADD_SUBDIRECTORY(test)
+ENDIF(BUILD_UNITTEST)
CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-IF(NOT NONE_GBS_BUILD)
- ADD_DEFINITIONS( -DGBS_BUILD )
-ENDIF(NOT NONE_GBS_BUILD)
-
-ADD_SUBDIRECTORY(src/lib)
-ADD_SUBDIRECTORY(src)
-IF(BUILD_TESTS)
- ADD_SUBDIRECTORY(unittest)
- #ADD_SUBDIRECTORY(unittest/dockzen_api)
-ENDIF(BUILD_TESTS)
-#ADD_SUBDIRECTORY(src/docker/unittest)
-#ADD_SUBDIRECTORY(src/lib/test)
-#ADD_SUBDIRECTORY(src/unittest)
diff --git a/LICENSE.APLv2 b/LICENSE
index 26b7de6..9c8e20a 100644
--- a/LICENSE.APLv2
+++ b/LICENSE
@@ -1,8 +1,7 @@
-Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
Apache License
Version 2.0, January 2004
- http://www.apache.org/licenses/
+ https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
@@ -177,28 +176,16 @@ Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
END OF TERMS AND CONDITIONS
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
+ Copyright 2013-2017 Docker, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
diff --git a/README.md b/README.md
index dc15a83..6c28ab6 100755..100644
--- a/README.md
+++ b/README.md
@@ -1,96 +1,2 @@
-# dockzen-launcher
-> This is docker framework main manager which is installed into host-OS
-
-## Build with rpmbuild
-```
-dockzen-launcher$ rpmbuild arm
-dockzen-launcher$ rpmbuild amd64 (not completed)
-```
-
-## Build with gbs
-`dockzen-launcher$ gbs build -A armv7l --include-all`
-
-## Build in local PC (w/o install)
-### for arm
-`dockzen-launcher$ ./build.sh arm`
-link static execution binary.
-output files...
-<pre>
-build/arm/
-├── dockzen-launcher
-└── lib
- ├── libdockzen.a
- └── pkgconfig
- └── dockzen-launcher.pc
-build/include/
-└── dockzen
- ├── dockzen.h
- └── dockzen_types.h
-</pre>
-as using arm-linux-gnueabi-gcc command, plese install this if not exist  
-`$ sudo apt-get install gcc-arm-linux-gnueabi`
-### for amd64
-`dockzen-launcher$ ./build.sh`
-link dynamic execution binary.
-output files...
-<pre>
-build/amd64/
-├── dockzen-launcher
-└── lib
- ├── libdockzen.a
- └── pkgconfig
- └── dockzen-launcher.pc
-build/include/
-└── dockzen
- ├── dockzen.h
- └── dockzen_types.h
-</pre>
-You must install pre-defined curl library of Ver.7.54.1 in your PC.
-Please install https://github.com/dockzen/curl
-
-### for unit test
-In case of arm,<br>
-`dockzen-launcher$ ./build.sh -t arm`<br>
-output files...
-<pre>
-build/arm
-├── dockzen-launcher
-├── gtest-dockzen_api
-├── gtest-dockzen_launcher
-└── lib
- ├── libdockzen.a
- └── pkgconfig
- └── dockzen-launcher.pc
-</pre>
-In case of amd64,<br>
-`dockzen-launcher$ ./build.sh -t`<br>
-output files...
-<pre>
-build/amd64
-├── dockzen-launcher
-├── gtest-dockzen_api
-├── gtest-dockzen_launcher
-└── lib
- ├── libdockzen.a
- └── pkgconfig
- └── dockzen-launcher.pc
-</pre>
-You must install pre-defined gtest library of latest version in your PC.<br>
-Please install https://github.com/dockzen/googletest<br>
-<br>
-
-### Execution
-1. copy data file
-`sudo cp -rf data/config /etc/dockzen/`
-sudo is needed in host PC
-2. execute
-`sudo build/dockzen-launcher`
-sudo is needed in host PC as to access data file
-3. unit test<br>
-In case of arm, <br>
-`build/arm/gtest-dockzen_launcher` <br>
-`build/arm/gtest-dockzen_api` <br><br>
-In case of amd64, <br>
-`build/amd64/gtest-dockzen_launcher` <br>
-`build/amd64/gtest-dockzen_api` <br>
-
+# docker-launcher
+platform/core/system/docker-launcher
diff --git a/data/config/dockerd/dockerd_start.json b/data/config/dockerd/dockerd_start.json
deleted file mode 100755
index 8879151..0000000
--- a/data/config/dockerd/dockerd_start.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-"opt_cmd" : "-s overlay2 --data-root=/opt/beluga/var/lib/docker --userland-proxy=false -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375"
-}
-
-
-
diff --git a/data/config/init/factory_init.json b/data/config/init/factory_init.json
deleted file mode 100755
index c27e836..0000000
--- a/data/config/init/factory_init.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "worked": 0 } \ No newline at end of file
diff --git a/include/dockzen_types.h b/include/dockzen_types.h
deleted file mode 100644
index 3fb8b99..0000000
--- a/include/dockzen_types.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * @file dockzen_types.h
- * @brief Types of API for dockzen
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __DOCKZEN_TYPES_H__
-#define __DOCKZEN_TYPES_H__
-
-#define MAX_CONTAINER_NUM (10)
-
-/**
- * @brief This enum contains dockzen error information
- *
- * The dockzen_error_e indicates what error is happened
- *
- */
-typedef enum {
- DOCKZEN_ERROR_NONE = 0, /**< Successful */
- DOCKZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- DOCKZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- DOCKZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
- DOCKZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
-} dockzen_error_e;
-
-/**
- * @brief This enum contains dockzen update state and error information
- *
- * The dockzen_update_e indicates what is dockzen update state.
- *
- */
-typedef enum {
- DOCKZEN_UPDATE_STATE_STARTED = 0,
- DOCKZEN_UPDATE_STATE_DOWNLOADING,
- DOCKZEN_UPDATE_STATE_UPDATING,
- DOCKZEN_UPDATE_STATE_DONE,
- DOCKZEN_UPDATE_ERROR_UNKNOWN,
- DOCKZEN_UPDATE_ERROR_NOTSTART,
- DOCKZEN_UPDATE_ERROR_DOWNLOAD,
- DOCKZEN_UPDATE_ERROR_UPDATE
-} dockzen_update_e;
-
-
-/**
- * @struct containers_info_s
- * @brief This struct contains containers information
- *
- * The containers_info_s struct encapsulate count and container information in the one data
- *
- */
-typedef struct{
- int count; /**< the counts of containers info */
- struct {
- char * id; /**< Numeric ID which is managed by swam */
- char * name; /**< Container name from service */
- char * image_name; /**< Docker image name */
- char * status; /**< Container Status : */
- }container[MAX_CONTAINER_NUM]; /**< Max Count constraint */
-}containers_info_s;
-
-/**
- * @struct container_update_s
- * @brief This struct contains update parameters
- *
- * The container_update_s struct encapsulate container_name and image_name information in the one data
- *
- */
-typedef struct{
- char * container_name;
- char * image_name;
-}container_update_s;
-
-/**
- * @struct container_update_res_s
- * @brief This struct contains update response
- *
- * The container_update_res_s struct encapsulate container_name, image_name_pre, image_name_new and status in the one data
- *
- */
-typedef struct{
- char * container_name;
- char * image_name_prev;
- char * image_name_new;
- char * status;
-}container_update_res_s;
-
-/**
- * @struct container_update_cb_s
- * @brief This struct contains update callback parameters
- *
- * The container_update_cb_s struct encapsulate conainer_name, image_name and status in the one data
- *
- */
-typedef struct{
- char * container_name;
- char * image_name;
- char * status;
-}container_update_cb_s;
-
-typedef void (*container_update_cb) (container_update_cb_s *status, void * user_data);
-
-#endif /* __DOCKZEN_TYPES_H__ */
diff --git a/packaging/docker-launcher-client.manifest b/packaging/docker-launcher-client.manifest
deleted file mode 100755
index a76fdba..0000000
--- a/packaging/docker-launcher-client.manifest
+++ /dev/null
@@ -1,5 +0,0 @@
-<manifest>
- <request>
- <domain name="_" />
- </request>
-</manifest>
diff --git a/packaging/docker-launcher.manifest b/packaging/docker-launcher.manifest
index a76fdba..0480a33 100755
--- a/packaging/docker-launcher.manifest
+++ b/packaging/docker-launcher.manifest
@@ -2,4 +2,8 @@
<request>
<domain name="_" />
</request>
+
+ <assign>
+ <filesystem path="/usr/bin/crash-forwarder" label="System" exec_label="System::Privileged"/>
+ </assign>
</manifest>
diff --git a/packaging/docker-launcher.service b/packaging/docker-launcher.service
index c4eda56..6664daf 100755..100644
--- a/packaging/docker-launcher.service
+++ b/packaging/docker-launcher.service
@@ -1,16 +1,14 @@
[Unit]
-Description=docker manager Server Daemon
-### [workaround] It will be applied after completed seperating engine service
-### After=docker-engine.socket docker-engine.service
-After=docker-adaptor.service connman.service dbus.socket
+Description=Docker Launcher Daemon
+Requires=docker-engine.socket docker-engine.service deviced.service
+After=connman.service dbus.socket
[Service]
-EnvironmentFile=-/opt/beluga/system/env/environment
+User=system_fw
+Group=system_fw
SmackProcessLabel=System
ExecStart=/usr/bin/docker-launcher
-### [workaround] It will be applied after completed seperating engine service
-### Sockets=docker-engine.socket
-Restart=always
+Restart=no
RestartSec=0
[Install]
diff --git a/packaging/docker-launcher.spec b/packaging/docker-launcher.spec
index a52dd6f..bbdd3dd 100755
--- a/packaging/docker-launcher.spec
+++ b/packaging/docker-launcher.spec
@@ -1,118 +1,77 @@
-%define __usrdir /usr/lib/systemd/system
-
Name: docker-launcher
Summary: docker launcher
-Version: 0.7.0
+Version: 1
Release: 0
Group: System/Docker Framework
License: Apache-2.0
-ExclusiveArch: armv7l
+ExclusiveArch: armv7l aarch64
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.manifest
-Source3: %{name}.service
-Source4: %{name}-client.manifest
+Source2: %{name}.service
BuildRequires: cmake
-BuildRequires: boost-devel
-BuildRequires: gcc-c++
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: libcurl-devel
+# need by libcurl on aarch64
+BuildRequires: libopenssl1.1-devel
BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(capi-system-info)
-BuildRequires: pkgconfig(capi-system-system-settings)
-BuildRequires: pkgconfig(libcurl)
-BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(gmock)
-BuildRequires: pkgconfig(yaml-0.1)
-Requires: docker-engine
-Requires(post): /usr/bin/getent, /usr/sbin/useradd, /usr/sbin/groupadd
-Requires(post): /sbin/ldconfig, /usr/bin/systemctl
-Requires(postun): /sbin/ldconfig, /usr/bin/systemctl
+BuildRequires: jsoncpp-devel
+BuildRequires: libblkid-devel
+BuildRequires: libmount-devel
+BuildRequires: libcap-devel
+BuildRequires: pkgconfig(libtzplatform-config)
+
+# Ensure crash_worker user is available (created by security-config, package provides crash_worker-owned files)
+Requires: security-config
+Requires: jsoncpp
%description
docker launcher
-%package devel
-Summary: Docker launcher(devel)
-Group: System/Docker Framework
-Requires: %{name} = %{version}
-
-%description devel
-docker launcher development Kit
-
-%package client
-Summary: launcher client
-Group: System/Docker Framework
-Requires: %{name} = %{version}
-
-%description client
-docker launcher client programs
-
-
%prep
%setup -q
chmod g-w %_sourcedir/*
cp %{SOURCE1} ./%{name}.manifest
-cp %{SOURCE3} ./%{name}.service
-cp %{SOURCE4} ./%{name}-client.manifest
+cp %{SOURCE2} ./%{name}.service
%build
-TZ_VER_3=1
-
export LDFLAGS+="-Wl,--as-needed"
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%if "%{tests}" == "ON"
- %cmake . \
- -DBUILD_TESTS=%{tests}\
- -DMAJORVER=${MAJORVER}\
- -DFULLVER=%{version}\
- -DBIN_INSTALL_DIR:PATH=%{_bindir}
-%else
- %cmake . \
- -DBUILD_TESTS=OFF\
- -DMAJORVER=${MAJORVER}\
- -DFULLVER=%{version}\
- -DBIN_INSTALL_DIR:PATH=%{_bindir}
-%endif
+%cmake . \
+ -DPLATFORM=tizen \
+ -DMAJORVER=${MAJORVER}\
+ -DFULLVER=%{version}\
+ -DBIN_INSTALL_DIR:PATH=%{_bindir} \
+ -DBUILD_UNITTEST=OFF \
+ -DBUILD_COVERAGE=OFF
+
+%__make %{?_smp_mflags}
%install
%make_install
-mkdir -p %{buildroot}/usr/lib/systemd/system/multi-user.target.wants
-install -m 0644 %SOURCE3 %{buildroot}/usr/lib/systemd/system/docker-launcher.service
-ln -s ../docker-launcher.service %{buildroot}/usr/lib/systemd/system/multi-user.target.wants/
-mkdir -p %{buildroot}/opt/beluga/uc/
-mkdir -p %{buildroot}/etc/beluga/sc/
-mkdir -p %{buildroot}/opt/beluga/system/env/
-mkdir -p %{buildroot}/opt/beluga/system/docker/
-cp -a data/config/init/* %{buildroot}/opt/beluga/system/env/
-cp -a data/config/dockerd/* %{buildroot}/opt/beluga/system/docker/
-touch %{buildroot}/opt/beluga/system/env/environment
+mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+install -m 0644 %{name}.service %{buildroot}%{_unitdir}/docker-launcher.service
+ln -s ../%{name}.service %{buildroot}%{_unitdir}/multi-user.target.wants/
-%post
-/sbin/ldconfig
+install -m 750 ./scripts/crash-forwarder.py %{buildroot}%{_bindir}/crash-forwarder
+install -d %{buildroot}/usr/lib/sysctl.d
+install -m 644 ./sysctl.d/99-docker-launcher.conf.in %{buildroot}/usr/lib/sysctl.d/99-docker-launcher.conf
+install -d %{buildroot}%{TZ_SYS_DATA}/container
-%postun -p /sbin/ldconfig
+%post
+%postun
%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
%{_bindir}/docker-launcher*
-%if "%{tests}" == "ON"
- %{_bindir}/gtest-dockzen_api*
- %{_bindir}/gtest-dockzen_launcher*
-%endif
-%license LICENSE.APLv2
-/usr/lib/systemd/system/%{name}.service
-/usr/lib/systemd/system/multi-user.target.wants/%{name}.service
-/opt/beluga/*
-
-%dir /opt/beluga/uc/
-
-%files devel
-%manifest %{name}.manifest
-%defattr(-,root,root,-)
-%{_bindir}/docker-launcher*
+%{_bindir}/dlauncher*
+%license LICENSE
+%{_unitdir}/%{name}.service
+%{_unitdir}/multi-user.target.wants/%{name}.service
+%attr(0750,root,crash_worker) %{_bindir}/crash-forwarder
+/usr/lib/sysctl.d/99-docker-launcher.conf
%{_libdir}/pkgconfig/%{name}.pc
+%attr(0750,system_fw,system_fw) %{TZ_SYS_DATA}/container
diff --git a/scripts/crash-forwarder.py b/scripts/crash-forwarder.py
new file mode 100755
index 0000000..e9ee312
--- /dev/null
+++ b/scripts/crash-forwarder.py
@@ -0,0 +1,167 @@
+#!/usr/bin/python3
+
+import sys
+import argparse
+import json
+import subprocess
+
+ProgName = "crash-forwarder"
+
+
+def parse_args():
+ parser = argparse.ArgumentParser(
+ description="coredump forwarder for container",
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+ parser.add_argument("-p", "--pid",
+ help="PID of dumped process, as seen in the PID namespace in which the process resides")
+ parser.add_argument("-P", "--PID",
+ help="PID of dumped process, as seen in the initial PID namespace")
+ parser.add_argument("-i", "--tid",
+ help="TID of thread that triggered core dump, as seen in the PID namespace in which the thread resides")
+ parser.add_argument("-I", "--TID",
+ help="TID of thread that triggered core dump, as seen in the initial PID namespace")
+ parser.add_argument("-c", "--coresize",
+ help="Core file size soft resource limit of crashing process")
+ parser.add_argument("-d", "--dump",
+ help="Dump mode—same as value returned by prct")
+ parser.add_argument("-e", "--comm",
+ help="The process or thread's comm value, which typically is the same as the executable filename")
+ parser.add_argument("-E", "--exec",
+ help="Pathname of executable, with slashes ('/') replaced by exclamation marks ('!')")
+ parser.add_argument("-u", "--uid",
+ help="Numeric real UID of dumped process")
+ parser.add_argument("-g", "--gid",
+ help="Numeric real GID of dumped process")
+ parser.add_argument("-H", "--hostname",
+ help="Hostname")
+ parser.add_argument("-s", "--signal",
+ help="Number of signal causing dump")
+ parser.add_argument("-t", "--time",
+ help="Time of dump, expressed as seconds since the Epoch")
+ return parser.parse_args()
+
+
+def get_container_execute(info):
+ if info == None:
+ return []
+
+ type = info["type"]
+ cid = info["cid"]
+
+ if type == "docker":
+ return ["/usr/bin/docker", "exec", "-i", cid]
+
+ return []
+
+
+def get_container_info(args):
+ if args.PID == None or args.PID == args.pid:
+ return None
+
+ cgroup_hierarchy = None
+ with open("/proc/" + args.PID + "/cgroup") as f:
+ data = f.read().strip()
+ for line in data.split():
+ if line.startswith("1:name"):
+ cgroup_hierarchy = line.split(':')[-1].split('/')
+
+ if cgroup_hierarchy == None or not isinstance(cgroup_hierarchy, list):
+ return None
+
+ # cgroup_hierarchy[0] is empty
+ if not cgroup_hierarchy[1] in ["docker"]:
+ return None
+
+ engine = cgroup_hierarchy[1]
+ cid = cgroup_hierarchy[2]
+ info = {
+ "type": engine,
+ "cid": cid,
+ }
+
+ return info
+
+
+def find_core_pattern(info, core_pattern_configs):
+ if info != None:
+ cid = info["cid"]
+ if cid in core_pattern_configs.keys():
+ return core_pattern_configs[cid]
+
+ return core_pattern_configs["local"]
+
+
+def find_default_core_pattern_in_sysctl(default):
+ sysctl_list = subprocess.run(["/usr/lib/systemd/systemd-sysctl",
+ "--cat-config", "--no-pager"],
+ capture_output=True)
+ value = default
+
+ # sysctl output list is assumed to be in the processing order.
+ for line in sysctl_list.stdout.decode().splitlines():
+ if not line.startswith("kernel.core_pattern"):
+ continue
+
+ curr_value = line.split('=', 1)[1]
+
+ if curr_value.find(ProgName) > -1:
+ break
+ # Among the configuration lists, the above one of the currently executed core_pattern settings is used.
+ value = curr_value
+
+ [cmd, args] = value.split(maxsplit=1)
+
+ if not cmd.startswith('|'):
+ return [value, "", False]
+
+ return [cmd[1:], args, True]
+
+
+def convert_args(output_args, input_args):
+ out = output_args
+ out = out.replace(r"%p", input_args.pid)
+ out = out.replace(r"%P", input_args.PID)
+ out = out.replace(r"%i", input_args.tid)
+ out = out.replace(r"%I", input_args.TID)
+ out = out.replace(r"%c", input_args.coresize)
+ out = out.replace(r"%d", input_args.dump)
+ out = out.replace(r"%e", input_args.comm)
+ out = out.replace(r"%E", input_args.exec)
+ out = out.replace(r"%u", input_args.uid)
+ out = out.replace(r"%g", input_args.gid)
+ out = out.replace(r"%h", input_args.hostname)
+ out = out.replace(r"%s", input_args.signal)
+ out = out.replace(r"%t", input_args.time)
+ return out.split()
+
+
+def get_core_pattern_config():
+ config = {}
+
+ # TODO: communicate with docker-launcher
+ config_file = "/run/container/.core_patterns"
+ try:
+ with open(config_file) as f:
+ config = json.load(f)
+ except IOError:
+ print(config_file + " not found")
+
+ if not "local" in config or config["local"][1] == "":
+ # defaults for tizen
+ config["local"] = find_default_core_pattern_in_sysctl(
+ r"/usr/bin/crash-manager -E %E -p %p -u %u -g %g -s %s -t %t -i %i")
+
+ return config
+
+
+if __name__ == '__main__':
+ ProgName = sys.argv[0]
+ args = parse_args()
+ core_pattern_configs = get_core_pattern_config()
+ info = get_container_info(args)
+ core_pattern = find_core_pattern(info, core_pattern_configs)
+ command = get_container_execute(info) + [core_pattern[0]] + convert_args(
+ core_pattern[1], args)
+
+ subprocess.run(command, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1e48be7..0e12763 100755
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,25 +1,21 @@
LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/lib)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/util)
+SET(DOCKER_LAUNCHER "docker-launcher")
+FILE(GLOB DOCKER_LAUNCHER_SRCS docker-launcher.cpp)
-SET(DOCKER_LAUNCHER_SERVER "docker-launcher")
-FILE(GLOB DOCKER_LAUNCHER_SERVER_SRCS *.c lib/ipc.c lib/json_util.c lib/yaml_util.c)
+SET(DOCKER_LAUNCHER_STATIC "docker-launcher-static")
+FILE(GLOB DOCKER_LAUNCHER_STATIC_SRCS ContainerManager.cpp ContainerLifecycleManager.cpp DockerLauncher.cpp)
+FILE(GLOB CONTAINER_BACKEND_SRCS Config/*.cpp Controller/*.cpp Extension/*.cpp util/*.cpp Volumes/*.cpp)
-INCLUDE(FindPkgConfig)
+ADD_LIBRARY(${DOCKER_LAUNCHER_STATIC} STATIC ${DOCKER_LAUNCHER_STATIC_SRCS} ${CONTAINER_BACKEND_SRCS})
+TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER_STATIC} ${CMAKE_THREAD_LIBS_INIT} ${pkgs_LIBRARIES} ${pkgs_LDFLAGS})
-IF(NONE_GBS_BUILD)
- INCLUDE_DIRECTORIES(${LINK_LIB_INCLUDE})
- set(CMAKE_EXE_LINKER_FLAGS ${LINK_FLAG})
-ELSE(NONE_GBS_BUILD)
- pkg_check_modules(server_pkgs REQUIRED dlog glib-2.0 gio-2.0 libcurl json-c yaml-0.1)
-ENDIF(NONE_GBS_BUILD)
+IF(BUILD_COVERAGE)
+ TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER_STATIC} gcov --coverage)
+ENDIF(BUILD_COVERAGE)
-INCLUDE_DIRECTORIES(${server_pkgs_INCLUDE_DIRS})
-LINK_DIRECTORIES(${server_pkgs_LIBRARY_DIRS})
+ADD_EXECUTABLE(${DOCKER_LAUNCHER} ${DOCKER_LAUNCHER_SRCS})
+TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER} ${DOCKER_LAUNCHER_STATIC})
-
-ADD_EXECUTABLE(${DOCKER_LAUNCHER_SERVER} ${DOCKER_LAUNCHER_SERVER_SRCS})
-TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER_SERVER} ${server_pkgs_LIBRARIES} pthread curl json-c yaml)
-INSTALL(TARGETS ${DOCKER_LAUNCHER_SERVER} DESTINATION ${BIN_INSTALL_DIR})
+INSTALL(TARGETS ${DOCKER_LAUNCHER} DESTINATION ${BIN_INSTALL_DIR})
diff --git a/src/Config/Config.cpp b/src/Config/Config.cpp
new file mode 100644
index 0000000..f2c7aee
--- /dev/null
+++ b/src/Config/Config.cpp
@@ -0,0 +1,482 @@
+#include "Config.h"
+
+#include "util/JsonTools.h"
+#include "util/util.h"
+#include "util/system.h"
+#include "util/log.h"
+
+using namespace Config;
+
+CgroupPermission::CgroupPermission(std::string_view str)
+{
+ *this = std::string(str);
+}
+
+CgroupPermission::CgroupPermission(const CgroupPermissionType &perm)
+{
+ *this = perm;
+}
+
+CgroupPermission &CgroupPermission::operator=(const std::string &str)
+{
+ if (str.find("r") != std::string::npos || str.find("R") != std::string::npos)
+ r = true;
+ if (str.find("w") != std::string::npos || str.find("W") != std::string::npos)
+ w = true;
+ if (str.find("m") != std::string::npos || str.find("M") != std::string::npos)
+ m = true;
+
+ return *this;
+}
+CgroupPermission &CgroupPermission::operator=(const CgroupPermissionType &perm)
+{
+ r = perm & _R;
+ w = perm & _W;
+ m = perm & _M;
+
+ return *this;
+}
+
+std::string CgroupPermission::toString() const
+{
+ std::string ret;
+ if (r)
+ ret += "r";
+ if (w)
+ ret += "w";
+ if (m)
+ ret += "m";
+ return ret;
+}
+
+Device::Device(const std::filesystem::path &source, const std::filesystem::path &target, std::string_view perm)
+ : source(source), target(target), cgroupPermission(perm)
+{
+ if (!source.empty())
+ checkExists();
+}
+
+Device::Device(const std::filesystem::path &source, const std::filesystem::path &target, CgroupPermissionType perm)
+ : source(source), target(target), cgroupPermission(perm)
+{
+ if (!source.empty())
+ checkExists();
+}
+
+Device::Device(const Json::Value &val)
+{
+ switch (val.type()) {
+ case Json::ValueType::stringValue:
+ *this = Device(val.asString(), val.asString(), __defulatPermision);
+ break;
+ case Json::ValueType::objectValue:
+ *this = __constructFromJsonObject(val);
+ break;
+ case Json::ValueType::arrayValue:
+ *this = __constructFromJsonArray(val);
+ break;
+ default:
+ /* ignore */
+ break;
+ }
+}
+
+Device Device::__constructFromJsonObject(const Json::Value &val)
+{
+ Device ret;
+
+ if (!val.isMember("PathOnHost")) {
+ return Device();
+ }
+
+ const std::string &source = val["PathOnHost"].asString();
+ const std::string &target = val.isMember("PathInContainer") ? val["PathInContainer"].asString() : source;
+
+ if (val.isMember("CgroupPermissions")) {
+ ret = Device(source, target, val["CgroupPermissions"].asString());
+ } else {
+ ret = Device(source, target, __defulatPermision);
+ }
+
+ JsonTools::Transform::getJsonValue(ret.strict, val["Strict"]);
+
+ return ret;
+}
+
+Device Device::__constructFromJsonArray(const Json::Value &val)
+{
+ switch (val.size()) {
+ case 1:
+ return Device(val[0].asString(), val[0].asString(), __defulatPermision);
+ case 2:
+ return Device(val[0].asString(), val[1].asString(), __defulatPermision);
+ case 4:
+ if (val[3].isBool()) {
+ Device ret(val[0].asString(), val[1].asString(), val[2].asString());
+ ret.strict = val[3].asBool();
+ return ret;
+ }
+ [[fallthrough]];
+ case 3:
+ return Device(val[0].asString(), val[1].asString(), val[2].asString());
+ default:
+ _E("invalid array type device argument");
+ break;
+ }
+
+ return Device();
+}
+
+bool Device::checkExists()
+{
+ exists = std::filesystem::exists(target);
+ return exists;
+}
+
+Device Device::setStrictCheck(const Json::Value &val)
+{
+ Device ret(val);
+ if (!val.isMember("Strict")) {
+ ret.strict = true;
+ }
+
+ return ret;
+}
+
+DeviceCgroupRule::DeviceCgroupRule(DeviceType type, int major, int minor, CgroupPermissionType perm)
+ : type(type), major(major), minor(minor), permission(perm)
+{
+}
+
+DeviceCgroupRule::DeviceCgroupRule(std::string_view type, std::string_view major, std::string_view minor,
+ std::string_view perm)
+ : permission(perm)
+{
+ setType(std::string(type));
+ setMajor(std::string(major));
+ setMinor(std::string(minor));
+}
+
+DeviceCgroupRule::DeviceCgroupRule(std::string_view type, std::string_view major, std::string_view minor,
+ const CgroupPermissionType &perm)
+ : permission(perm)
+{
+ setType(std::string(type));
+ setMajor(std::string(major));
+ setMinor(std::string(minor));
+}
+
+DeviceCgroupRule::DeviceCgroupRule(const std::string &str)
+{
+ std::istringstream ss(str);
+ std::string arg;
+
+ std::getline(ss, arg, ' ');
+ setType(arg);
+ std::getline(ss, arg, ':');
+ setMajor(arg);
+ std::getline(ss, arg, ' ');
+ setMinor(arg);
+ std::getline(ss, arg);
+ this->permission = arg;
+}
+
+DeviceCgroupRule::DeviceCgroupRule(const Json::Value &val)
+{
+ switch (val.type()) {
+ case Json::ValueType::stringValue: {
+ *this = DeviceCgroupRule(val.asString());
+ break;
+ }
+ case Json::ValueType::arrayValue:
+ if (val.size() == 3) {
+ *this = DeviceCgroupRule(val[0].asString(), val[1].asString(), val[2].asString());
+ } else if (val.size() == 4) {
+ *this = DeviceCgroupRule(val[0].asString(), val[1].asString(), val[2].asString(), val[3].asString());
+ } else {
+ _E("invalid array type cgroup rules argument");
+ }
+ break;
+ default:
+ /* ignore */
+ break;
+ }
+}
+
+void DeviceCgroupRule::setType(const std::string &val)
+{
+ if (val == "c" || val == "C" || val == "char") {
+ this->type = DEV_CHAR;
+ } else if (val == "b" || val == "B" || val == "block") {
+ this->type = DEV_BLOCK;
+ }
+}
+void DeviceCgroupRule::setMajor(const std::string &val)
+{
+ if (val == "*") {
+ this->major = -1;
+ } else {
+ this->major = std::stoi(val);
+ }
+}
+void DeviceCgroupRule::setMinor(const std::string &val)
+{
+ if (val == "*") {
+ this->minor = -1;
+ } else {
+ this->minor = std::stoi(val);
+ }
+}
+std::string DeviceCgroupRule::toString() const
+{
+ std::string ret;
+ switch (this->type) {
+ case DEV_CHAR:
+ ret += "c";
+ break;
+ case DEV_BLOCK:
+ ret += "b";
+ break;
+ default:
+ return ret;
+ }
+ ret += " ";
+ if (major < 0) {
+ ret += "*";
+ } else {
+ ret += std::to_string(major);
+ }
+ ret += ":";
+ if (minor < 0) {
+ ret += "*";
+ } else {
+ ret += std::to_string(minor);
+ }
+
+ ret += " " + permission.toString();
+ return ret;
+}
+
+Mount::Mount(MountType type, const std::filesystem::path &source, const std::filesystem::path &target, bool ro)
+ : type(type), readOnly(ro), source(source), target(target)
+{
+}
+
+Bind::Bind() : Mount()
+{
+}
+
+Bind::Bind(const std::filesystem::path &src, const std::filesystem::path &target, bool ro)
+ : Mount(MNT_NONE, std::string(src), std::string(target), ro)
+{
+ if (source.has_root_path()) {
+ type = MNT_BIND;
+ } else {
+ type = MNT_VOLUME;
+ }
+}
+
+Bind::Bind(const std::string &val)
+{
+ std::vector<std::string> opts = util::string::regexSplit(val, ":");
+ switch (opts.size()) {
+ case 1:
+ *this = Bind(opts[0], opts[0], false);
+ break;
+ case 2:
+ *this = Bind(opts[0], opts[1], false);
+ break;
+ case 3:
+ *this = Bind(opts[0], opts[1], opts[2] == "ro");
+ break;
+ default:
+ /* ignore */
+ break;
+ }
+}
+
+std::string Bind::toString() const
+{
+ return source.string() + ":" + target.string() + ":" + (readOnly ? "ro" : "rw");
+}
+
+SharedConfigs::SharedConfigs(const Json::Value &value)
+{
+ if (value.empty())
+ return;
+
+ std::filesystem::path path = value.isMember("rootpath") ? value["rootpath"].asString() : ".";
+ if (path.is_relative()) {
+ std::filesystem::path cfgfile_path = value["configfile"].asString();
+ path = cfgfile_path.parent_path() / path;
+ }
+ this->rootPath = path;
+
+ JsonTools::Transform::getJsonValue(this->strictDeviceCheck, value["strictDeviceCheck"]);
+}
+
+ImageConfigs::ImageConfigs(const Json::Value &value, const std::string &name, std::shared_ptr<SharedConfigs> shared)
+{
+ if (value.empty())
+ return;
+
+ const std::filesystem::path &rootpath = shared ? shared->rootPath : std::filesystem::current_path();
+
+ _D("Get %s image configs", name.c_str());
+
+ JsonTools::Transform::getJsonObject<std::string, std::string>(this->args, value["args"]);
+ JsonTools::Transform::getJsonValue<std::filesystem::path>(this->dockerfile, value["dockerfile"]);
+ JsonTools::Transform::getJsonValue<std::filesystem::path>(this->context, value["context"],
+ convertBasePathForwarder(rootpath));
+ JsonTools::Transform::getJsonValue<std::filesystem::path>(this->imagedatafile, value["imagedatafile"],
+ convertBasePathForwarder(rootpath));
+
+ JsonTools::Transform::getJsonArray<util::system::Mount>(this->mounts, value["mount"], [&](const Json::Value &val) {
+ const auto &[src, dst] = util::string::split(val.asString(), ':');
+ return std::move(util::system::Mount(util::file::pathjoin(rootpath, src).string(),
+ util::file::pathjoin(rootpath / context.value(), dst).string()));
+ });
+
+ _D("End of get %s image configs", name.c_str());
+}
+
+ContainerConfigs::ContainerConfigs(const Json::Value &value, const std::string &name,
+ std::shared_ptr<SharedConfigs> shared)
+{
+ if (value.empty())
+ return;
+
+ std::string rootpath = shared ? shared->rootPath : "/";
+
+ _D("Get %s container configs", name.c_str());
+
+ JsonTools::Transform::getJsonValue<std::string>(this->port, value["port"]);
+ JsonTools::Transform::getJsonValue<std::string>(this->networkMode, value["NetworkMode"]);
+ JsonTools::Transform::getJsonValue<std::string>(this->cgroupnsMode, value["CgroupnsMode"]);
+ JsonTools::Transform::getJsonValue<bool>(this->privileged, value["Privileged"]);
+ JsonTools::Transform::getJsonValue<bool>(this->enable, value["enable"]);
+ JsonTools::Transform::getJsonValue<bool>(this->attachStdin, value["AttachStdin"]);
+ JsonTools::Transform::getJsonValue<bool>(this->openStdin, value["OpenStdin"]);
+ JsonTools::Transform::getJsonValue<bool>(this->tty, value["Tty"]);
+ JsonTools::Transform::getJsonValue<bool>(this->networkDisabled, value["NetworkDisabled"]);
+ JsonTools::Transform::getJsonValue<std::string>(this->macAddress, value["MacAddress"]);
+ JsonTools::Transform::getJsonArray<std::string>(this->environment, value["environment"]);
+ JsonTools::Transform::getJsonArray<std::string>(this->cmd, value["cmd"]);
+ JsonTools::Transform::getJsonValue<std::string>(this->entrypoint, value["Entrypoint"]);
+ JsonTools::Transform::getJsonObject<std::string, std::string>(this->labels, value["Labels"]);
+ this->mounts = value["Mounts"];
+ JsonTools::Transform::getJsonArray<Bind>(this->binds, value["Binds"]);
+ JsonTools::Transform::getJsonArray<Device>(
+ this->devices, value["Devices"],
+ (shared && shared->strictDeviceCheck) ? Device::setStrictCheck : JsonTools::Transform::simpleForwarder<Device>);
+ JsonTools::Transform::getJsonArray<DeviceCgroupRule>(this->deviceCgroupRules, value["DeviceCgroupRules"]);
+ JsonTools::Transform::getJsonArray<std::string>(this->capAdd, value["CapAdd"]);
+ JsonTools::Transform::getJsonArray<std::string>(this->capDrop, value["CapDrop"]);
+ JsonTools::Transform::getJsonValue<std::string>(this->securityOpt, value["SecurityOpt"],
+ convertBasePathForwarder(rootpath));
+
+ _D("End of get %s container configs", name.c_str());
+}
+
+ContainerConfigs &ContainerConfigs::__merge(ContainerConfigs &a, const ContainerConfigs &b, const bool overwrite)
+{
+#define MERGE_OPTION(_out, _in, _objs, _cond) \
+ do { \
+ if (_in._objs && (!_out._objs || _cond)) { \
+ _out._objs = _in._objs; \
+ } \
+ } while (0)
+
+#define MERGE_STRING(_out, _in, _objs, _cond) \
+ do { \
+ if (!_in._objs.empty() && (_out._objs.empty() || _cond)) { \
+ _out._objs = _in._objs; \
+ } \
+ } while (0)
+
+#define MERGE_ARRAY(_out, _in, _objs) \
+ do { \
+ _out._objs.insert(_out._objs.end(), _in._objs.begin(), _in._objs.end()); \
+ } while (0)
+
+#define MERGE_MAP(_out, _in, _objs, _cond) \
+ do { \
+ if (_cond) \
+ for (const auto &obj : _in._objs) { \
+ _out._objs[obj.first] = obj.second; \
+ } \
+ else \
+ _out._objs.insert(_in._objs.begin(), _in._objs.end()); \
+ } while (0)
+
+#define MERGE_SET(_out, _in, _objs) \
+ do { \
+ _out._objs.insert(_in._objs.begin(), _in._objs.end()); \
+ } while (0)
+
+ for (const auto &obj : b.mounts) {
+ a.mounts.append(obj);
+ }
+
+ MERGE_OPTION(a, b, port, overwrite);
+ MERGE_OPTION(a, b, networkMode, overwrite);
+ MERGE_OPTION(a, b, macAddress, overwrite);
+ MERGE_OPTION(a, b, cgroupnsMode, overwrite);
+ MERGE_OPTION(a, b, securityOpt, overwrite);
+
+ MERGE_ARRAY(a, b, binds);
+ MERGE_ARRAY(a, b, environment);
+ MERGE_ARRAY(a, b, cmd);
+ MERGE_ARRAY(a, b, devices);
+ MERGE_ARRAY(a, b, deviceCgroupRules);
+
+ MERGE_MAP(a, b, labels, overwrite);
+
+ MERGE_SET(a, b, capAdd);
+ MERGE_SET(a, b, capDrop);
+
+ return a;
+}
+
+ContainerConfigs ContainerConfigs::operator+(const ContainerConfigs &config) const
+{
+ ContainerConfigs ret = *this;
+ return __merge(ret, config);
+}
+
+ContainerConfigs &ContainerConfigs::append(const ContainerConfigs &config)
+{
+ return __merge(*this, config);
+}
+
+ContainerConfigs &ContainerConfigs::append(const Json::Value &value, std::shared_ptr<SharedConfigs> shared)
+{
+ if (value.empty()) {
+ return *this;
+ }
+
+ return __merge(*this, ContainerConfigs(value, "appended", shared));
+}
+
+Status ContainerListConfigs::loadList(const std::string &configPath, Json::Value &configList)
+{
+ std::filesystem::path p(configPath.c_str());
+ if (!std::filesystem::exists(p))
+ return STATUS_NOT_FOUND;
+
+ for (const auto &file : std::filesystem::directory_iterator(configPath)) {
+ if (std::filesystem::is_regular_file(file.symlink_status()) && file.path().extension() == ".json") {
+ Json::Value config;
+ if (!JsonTools::parseFromFile(file.path(), &config))
+ continue;
+
+ if (config.isMember("ContainerPath") && config.isMember("ContainerName") && config.isMember("Create"))
+ configList["ContainerConfig"].append(config);
+ }
+ }
+
+ if (configList.empty())
+ return STATUS_NOT_FOUND;
+
+ return STATUS_OK;
+}
diff --git a/src/Config/Config.h b/src/Config/Config.h
new file mode 100644
index 0000000..42fd993
--- /dev/null
+++ b/src/Config/Config.h
@@ -0,0 +1,204 @@
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#include <string>
+#include <vector>
+#include <set>
+#include <memory>
+#include <filesystem>
+#include <optional>
+
+#include <json/json.h>
+
+#include "util/system.h"
+#include "internal_types.h"
+
+namespace Config
+{
+ struct Fingerprint {
+ Fingerprint() = default;
+ bool empty() { return id.empty() || name.empty(); }
+
+ std::string getID(unsigned int length = 12) const { return id.substr(0, length - 1); }
+ std::string getFullID() const { return id; }
+ std::string getFullName() const { return name + (tag.empty() ? "" : ":" + tag); }
+
+ operator std::string() { return id; }
+
+ std::string id;
+ std::string name;
+ std::string tag = "latest";
+ };
+
+ struct CgroupPermission {
+ CgroupPermission() = default;
+ explicit CgroupPermission(std::string_view str);
+ explicit CgroupPermission(const CgroupPermissionType &perm);
+
+ CgroupPermission &operator=(const std::string &str);
+ CgroupPermission &operator=(const CgroupPermissionType &perm);
+
+ std::string toString() const;
+
+ bool r = false;
+ bool w = false;
+ bool m = false;
+ };
+
+ struct Device {
+ Device() = default;
+ /* Json:: Value can be converted from a string, so the variable type must be explicitly declared. */
+ explicit Device(const Json::Value &val);
+ explicit Device(const char *path) : Device(path, path, __defulatPermision) {}
+ explicit Device(const std::string &path) : Device(path, path, __defulatPermision) {}
+ Device(const std::filesystem::path &path, std::string_view perm) : Device(path, path, perm) {}
+ Device(const std::filesystem::path &path, CgroupPermissionType perm) : Device(path, path, perm) {}
+ Device(const std::filesystem::path &source, const std::filesystem::path &target, std::string_view perm);
+ Device(const std::filesystem::path &source, const std::filesystem::path &target, CgroupPermissionType perm);
+
+ operator bool() const { return !source.empty(); }
+
+ bool checkExists();
+ static Device setStrictCheck(const Json::Value &val);
+
+ std::filesystem::path source;
+ std::filesystem::path target;
+ CgroupPermission cgroupPermission;
+ bool strict = false;
+ bool exists = false;
+
+ private:
+ static Device __constructFromJsonObject(const Json::Value &val);
+ static Device __constructFromJsonArray(const Json::Value &val);
+
+ static constexpr CgroupPermissionType __defulatPermision = _RWM;
+ };
+
+ struct DeviceCgroupRule {
+ DeviceCgroupRule() = default;
+ /* Json:: Value can be converted from a string, so the variable type must be explicitly declared. */
+ explicit DeviceCgroupRule(const char *str) : DeviceCgroupRule(std::string(str)) {}
+ explicit DeviceCgroupRule(const std::string &str);
+ explicit DeviceCgroupRule(const Json::Value &val);
+ DeviceCgroupRule(DeviceType type, int major, int minor)
+ : DeviceCgroupRule(type, major, minor, __defulatPermision)
+ {
+ }
+ DeviceCgroupRule(std::string_view type, std::string_view major, std::string_view minor)
+ : DeviceCgroupRule(type, major, minor, __defulatPermision)
+ {
+ }
+ DeviceCgroupRule(DeviceType type, int major, int minor, CgroupPermissionType perm);
+ DeviceCgroupRule(std::string_view type, std::string_view major, std::string_view minor,
+ const CgroupPermissionType &perm);
+ DeviceCgroupRule(std::string_view type, std::string_view major, std::string_view minor, std::string_view perm);
+
+ operator bool() const { return type != DEV_NONE; }
+
+ void setType(const std::string &val);
+ void setMajor(const std::string &val);
+ void setMinor(const std::string &val);
+ std::string toString() const;
+
+ DeviceType type = DEV_NONE;
+ int major = 0;
+ int minor = 0;
+ CgroupPermission permission;
+
+ private:
+ static constexpr CgroupPermissionType __defulatPermision = _RWM;
+ };
+
+ struct Mount {
+ Mount() = default;
+ Mount(MountType type, const std::filesystem::path &source, const std::filesystem::path &target, bool ro);
+
+ MountType type = MNT_NONE;
+ bool readOnly = false;
+
+ std::filesystem::path source;
+ std::filesystem::path target;
+ };
+
+ struct Bind : public Mount {
+ Bind();
+ /* Json:: Value can be converted from a string, so the variable type must be explicitly declared. */
+ explicit Bind(const Json::Value &val) : Bind(val.asString()) {}
+ explicit Bind(const std::string &source);
+ explicit Bind(const char *source) : Bind(std::string(source)) {}
+ Bind(const std::filesystem::path &source, bool ro) : Bind(source, source, ro) {}
+ Bind(const std::filesystem::path &source, const std::filesystem::path &target, bool ro);
+
+ operator bool() const { return type != MNT_NONE; }
+
+ std::string toString() const;
+ };
+
+ struct SharedConfigs {
+ SharedConfigs() = default;
+ explicit SharedConfigs(const Json::Value &value);
+
+ std::filesystem::path rootPath;
+ bool strictDeviceCheck = false;
+ };
+
+ struct ImageConfigs {
+ ImageConfigs() = default;
+ explicit ImageConfigs(const Json::Value &value, const std::string &name,
+ std::shared_ptr<SharedConfigs> shared = nullptr);
+
+ std::map<std::string, std::string> args;
+ std::map<std::string, std::string> labels;
+ std::optional<std::filesystem::path> dockerfile;
+ std::optional<std::filesystem::path> context;
+
+ std::vector<util::system::Mount> mounts;
+ std::optional<std::filesystem::path> imagedatafile;
+ };
+
+ struct ContainerConfigs {
+ ContainerConfigs() = default;
+ explicit ContainerConfigs(const Json::Value &value, const std::string &name,
+ std::shared_ptr<SharedConfigs> shared = nullptr);
+
+ ContainerConfigs operator+(const ContainerConfigs &config) const;
+
+ ContainerConfigs &append(const ContainerConfigs &config);
+ ContainerConfigs &append(const Json::Value &value, std::shared_ptr<SharedConfigs> shared = nullptr);
+
+ Json::Value mounts;
+ std::vector<Bind> binds;
+ std::optional<std::string> port;
+ std::optional<std::string> networkMode;
+ std::optional<bool> privileged;
+ std::optional<bool> enable;
+ std::optional<bool> attachStdin;
+ std::optional<bool> openStdin;
+ std::optional<bool> tty;
+ std::optional<bool> networkDisabled;
+ std::vector<std::string> environment;
+ std::vector<std::string> cmd;
+ std::optional<std::string> macAddress;
+ std::optional<std::string> cgroupnsMode;
+ std::map<std::string, std::string> labels;
+ std::vector<Device> devices;
+ std::vector<DeviceCgroupRule> deviceCgroupRules;
+ std::optional<std::string> securityOpt;
+ std::set<std::string> capAdd;
+ std::set<std::string> capDrop;
+ std::optional<std::string> stopsignal;
+ std::optional<std::string> entrypoint;
+
+ private:
+ static ContainerConfigs &__merge(ContainerConfigs &a, const ContainerConfigs &b, const bool overwrite = false);
+ };
+
+ struct ContainerListConfigs {
+ ContainerListConfigs() = default;
+
+ static Status loadList(const std::string &configPath, Json::Value &configList);
+ };
+
+} // namespace Config
+
+#endif /* __CONFIG_H__ */ \ No newline at end of file
diff --git a/src/ContainerLifecycleManager.cpp b/src/ContainerLifecycleManager.cpp
new file mode 100644
index 0000000..17083b0
--- /dev/null
+++ b/src/ContainerLifecycleManager.cpp
@@ -0,0 +1,410 @@
+#include "ContainerLifecycleManager.h"
+
+#include "Extension/Extension.h"
+#include "util/JsonTools.h"
+#include "util/log.h"
+#include <cassert>
+
+Status ContainerState::buildContainerImage(Container *container)
+{
+ Status ret = STATUS_OK;
+ std::shared_ptr<Image> image = container->image;
+
+ if (ContainerController::getController(container->TYPE)->isImageExist(image) == STATUS_OK) {
+ _D("%s image is already exists", image->fingerprint.name.c_str());
+ } else {
+ for (auto &extcfg : container->extConfigs) {
+ if (extcfg->buildPre(container) == STATUS_FAIL) {
+ _W("extConfig build pre fail : %s", extcfg->desc.c_str());
+ }
+ }
+
+ if (!image->configs->imagedatafile) {
+ _D("build %s Image\n", image->fingerprint.name.c_str());
+ ret = ContainerController::getController(container->TYPE)->build(container);
+ } else {
+ _D("load %s Image\n", image->fingerprint.name.c_str());
+ ret = ContainerController::getController(container->TYPE)->load(container);
+ }
+
+ for (auto &extcfg : container->extConfigs) {
+ if (extcfg->buildPost(container) == STATUS_FAIL) {
+ _W("extConfig build post fail : %s", extcfg->desc.c_str());
+ }
+ }
+
+ if (ret != STATUS_OK) {
+ _E("failed build/load image");
+ }
+ }
+ return ret;
+}
+
+Status ContainerState::createContainer(Container *container)
+{
+ Status ret = STATUS_OK;
+ if (ContainerController::getController(container->TYPE)->isContainerExist(container) == STATUS_OK) {
+ if (ContainerController::getController(container->TYPE)->isContainerRunning(container) == STATUS_OK) {
+ _D("%s container is running", container->fingerprint.name.c_str());
+ if (stopContainer(container) == STATUS_FAIL)
+ return STATUS_FAIL;
+ }
+ if (destroyContainer(container) == STATUS_FAIL)
+ return STATUS_FAIL;
+ }
+
+ for (auto &extcfg : container->extConfigs) {
+ if (extcfg->createPre(container) == STATUS_FAIL) {
+ _W("extConfig create pre fail : %s", extcfg->desc.c_str());
+ }
+ }
+
+ _D("create %s Container", container->fingerprint.name.c_str());
+ ret = ContainerController::getController(container->TYPE)->create(container);
+
+ for (auto &extcfg : container->extConfigs) {
+ if (extcfg->createPost(container) == STATUS_FAIL) {
+ _W("extConfig create post fail : %s", extcfg->desc.c_str());
+ }
+ }
+
+ if (ret != STATUS_OK) {
+ _E("failed create container\n");
+ }
+
+ return ret;
+}
+
+Status ContainerState::startContainer(Container *container)
+{
+ Status ret = STATUS_FAIL;
+ for (auto &extcfg : container->extConfigs) {
+ if (extcfg->startPre(container) == STATUS_FAIL) {
+ _W("extConfig start pre fail : %s", extcfg->desc.c_str());
+ }
+ }
+
+ _D("start %s Container", container->fingerprint.name.c_str());
+ ret = ContainerController::getController(container->TYPE)->start(container);
+
+ for (auto &extcfg : container->extConfigs) {
+ if (extcfg->startPost(container) == STATUS_FAIL) {
+ _W("extConfig start post fail : %s", extcfg->desc.c_str());
+ }
+ }
+
+ if (ret != STATUS_OK) {
+ _E("failed start container\n");
+ }
+ return ret;
+}
+
+// WORKAROUND : until Lifecycle Manager applied
+Status ContainerState::waitContainer(Container *container)
+{
+ // TODO : using lifecycle manager
+ _D("wait %s Container", container->fingerprint.name.c_str());
+ return ContainerController::getController(container->TYPE)->wait(container);
+}
+
+Status ContainerState::stopContainer(Container *container)
+{
+ Status ret = STATUS_FAIL;
+ for (auto &extcfg : container->extConfigs) {
+ if (extcfg->stopPre(container) == STATUS_FAIL) {
+ _W("extConfig stop pre fail : %s", extcfg->desc.c_str());
+ }
+ }
+
+ _D("stop %s Container", container->fingerprint.name.c_str());
+ ret = ContainerController::getController(container->TYPE)->stop(container);
+
+ for (auto &extcfg : container->extConfigs) {
+ if (extcfg->stopPost(container) == STATUS_FAIL) {
+ _W("extConfig stop post fail : %s", extcfg->desc.c_str());
+ }
+ }
+
+ if (ret != STATUS_OK) {
+ _E("failed stop container\n");
+ }
+ return ret;
+}
+
+Status ContainerState::destroyContainer(Container *container)
+{
+ Status ret = STATUS_FAIL;
+ _D("destroy %s Container", container->fingerprint.name.c_str());
+ ret = ContainerController::getController(container->TYPE)->destroy(container);
+ if (ret != STATUS_OK) {
+ _E("failed destroy container");
+ }
+ return ret;
+}
+
+Status ContainerState::removeContainerImage(Container *container)
+{
+ Status ret = STATUS_FAIL;
+
+ if (!container->image) {
+ _W("conatiner has not image");
+ return STATUS_IGNORE;
+ }
+ if (container->image->configs == nullptr)
+ return STATUS_IGNORE;
+
+ _D("remove %s Image", container->image->fingerprint.name.c_str());
+ ret = ContainerController::getController(container->TYPE)->remove(container);
+ if (ret != STATUS_OK) {
+ _E("failed remove container");
+ }
+ return ret;
+}
+
+void RegisteredState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ containerLifecycleManager->setState<ImageBuildingState>();
+}
+
+void ImageBuildingState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ if (buildContainerImage(containerLifecycleManager->container.get()) == STATUS_OK)
+ containerLifecycleManager->setState<ImageBuildedState>();
+ else {
+ _D("Failed to build container image!");
+ containerLifecycleManager->setState<MachineFailedState>();
+ }
+}
+
+void ImageBuildedState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ containerLifecycleManager->setState<CreatingState>();
+}
+
+void CreatingState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ if (createContainer(containerLifecycleManager->container.get()) == STATUS_OK)
+ containerLifecycleManager->setState<CreatedState>();
+ else {
+ _D("Failed to create container!");
+ containerLifecycleManager->setState<MachineFailedState>();
+ }
+}
+
+void CreatedState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ containerLifecycleManager->setState<StartingState>();
+}
+
+void StartingState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ if (startContainer(containerLifecycleManager->container.get()) == STATUS_OK)
+ containerLifecycleManager->setState<RunningState>();
+ else {
+ _D("Failed to start container!");
+ containerLifecycleManager->setState<DestroyingState>();
+ }
+}
+
+void RestartingState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ containerLifecycleManager->containerStateControl = CONTAINER_STATE_CONTROL_RESTART;
+ containerLifecycleManager->setState<StoppingState>();
+}
+
+void RunningState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ if (!containerLifecycleManager->waitFuture.valid()) {
+ containerLifecycleManager->waitFuture =
+ std::async(&ContainerState::waitContainer, this, containerLifecycleManager->container.get());
+ }
+
+ if (containerLifecycleManager->waitFuture.wait_for(100ms) == std::future_status::ready) {
+ if (containerLifecycleManager->waitFuture.get() == STATUS_OK) {
+ _D("Container was suddenly stopped.");
+ containerLifecycleManager->setState<StoppedState>();
+ }
+ }
+}
+
+void StoppingState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ if (stopContainer(containerLifecycleManager->container.get()) == STATUS_OK) {
+ containerLifecycleManager->setState<StoppedState>();
+ } else {
+ _D("Failed to stop container!");
+ containerLifecycleManager->setState<MachineFailedState>();
+ }
+}
+
+void StoppedState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ if (containerLifecycleManager->waitFuture.valid()) {
+ if (containerLifecycleManager->waitFuture.get() == STATUS_OK)
+ _D("Container was successfully stopped.");
+ else
+ _D("Container was not stopped.");
+ }
+
+ // TODO: auto restart when stopped
+ if (containerLifecycleManager->containerStateControl == CONTAINER_STATE_CONTROL_RESTART) {
+ containerLifecycleManager->containerStateControl = CONTAINER_STATE_CONTROL_NONE;
+ containerLifecycleManager->setState<StartingState>();
+ } else if (containerLifecycleManager->containerStateControl == CONTAINER_STATE_CONTROL_DESTROY) {
+ containerLifecycleManager->containerStateControl = CONTAINER_STATE_CONTROL_NONE;
+ containerLifecycleManager->setState<DestroyingState>();
+ } else if (containerLifecycleManager->containerStateControl == CONTAINER_STATE_CONTROL_REMOVE_IMAGE ||
+ containerLifecycleManager->containerStateControl == CONTAINER_STATE_CONTROL_UPDATE) {
+ containerLifecycleManager->setState<DestroyingState>();
+ } else {
+ _D("Stopped container and will finish container lifecycle manager!");
+ containerLifecycleManager->setState<MachineFailedState>();
+ }
+}
+
+void DestroyingState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ if (destroyContainer(containerLifecycleManager->container.get()) == STATUS_OK)
+ containerLifecycleManager->setState<DestroyedState>();
+ else {
+ _D("Failed to destroy container!");
+ containerLifecycleManager->setState<MachineFailedState>();
+ }
+}
+
+void DestroyedState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ if (containerLifecycleManager->containerStateControl == CONTAINER_STATE_CONTROL_REMOVE_IMAGE) {
+ containerLifecycleManager->containerStateControl = CONTAINER_STATE_CONTROL_NONE;
+ containerLifecycleManager->setState<ImageRemovingState>();
+ } else if (containerLifecycleManager->containerStateControl == CONTAINER_STATE_CONTROL_UPDATE)
+ containerLifecycleManager->setState<ImageRemovingState>();
+ else {
+ _D("Destroyed container and will finish container lifecycle manager!");
+ containerLifecycleManager->setState<MachineFailedState>();
+ }
+}
+
+void ImageRemovingState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ if (removeContainerImage(containerLifecycleManager->container.get()) != STATUS_FAIL)
+ containerLifecycleManager->setState<ImageRemovedState>();
+ else {
+ _D("Failed to remove container image!");
+ containerLifecycleManager->setState<MachineFailedState>();
+ }
+}
+
+void ImageRemovedState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+ if (containerLifecycleManager->containerStateControl == CONTAINER_STATE_CONTROL_UPDATE) {
+ containerLifecycleManager->containerStateControl = CONTAINER_STATE_CONTROL_NONE;
+ containerLifecycleManager->setState<ImageBuildingState>();
+ } else {
+ _D("Removed container image and will finish container lifecycle manager!");
+ containerLifecycleManager->setState<MachineFailedState>();
+ }
+}
+
+void MachineFailedState::handleEvent(ContainerLifecycleManager *containerLifecycleManager)
+{
+}
+
+Container *ContainerLifecycleManager::getContainer()
+{
+ return container.get();
+}
+
+void ContainerLifecycleManager::ContainerStateMachine(void *args)
+{
+ assert(containerState);
+ while (containerState->getState() != STATE_MACHINE_FAILED)
+ containerState->handleEvent(this);
+ sendMessageToContainer(CONTAINER_LIFECYCLE_MANAGER_CONTROL_STOP);
+}
+
+void ContainerLifecycleManager::ControlMessageReceiver(void *args)
+{
+ while (containerLifecycleManagerStatus == CONTAINER_LIFECYCLE_MANAGER_STATUS_RUNNUNG) {
+ std::shared_ptr<ControlMessage> controlMessage;
+ {
+ std::unique_lock<std::mutex> messageLock(messageMutex);
+ while (messageQueue.empty())
+ messageConditionVariable.wait(messageLock);
+
+ controlMessage = messageQueue.front();
+ messageQueue.pop();
+ }
+
+ switch (controlMessage->id) {
+ case CONTAINER_CONTROL_STOP:
+ this->setState<StoppingState>();
+ break;
+ case CONTAINER_CONTROL_DESTROY:
+ containerStateControl = CONTAINER_STATE_CONTROL_DESTROY;
+ this->setState<StoppingState>();
+ break;
+ case CONTAINER_CONTROL_REMOVE_IMAGE:
+ containerStateControl = CONTAINER_STATE_CONTROL_REMOVE_IMAGE;
+ this->setState<StoppingState>();
+ break;
+ case CONTAINER_CONTROL_UPDATE:
+ containerStateControl = CONTAINER_STATE_CONTROL_UPDATE;
+ this->setState<StoppingState>();
+ break;
+ case CONTAINER_LIFECYCLE_MANAGER_CONTROL_STOP:
+ containerLifecycleManagerStatus = CONTAINER_LIFECYCLE_MANAGER_STATUS_STOPPED;
+ default:
+ break;
+ }
+ }
+}
+
+Status ContainerLifecycleManager::runContainerLifecycleManager()
+{
+ containerLifecycleManagerStatus = CONTAINER_LIFECYCLE_MANAGER_STATUS_RUNNUNG;
+ containerStateMachineThread =
+ std::make_unique<std::thread>(&ContainerLifecycleManager::ContainerStateMachine, this, nullptr);
+ controlMessageThread =
+ std::make_unique<std::thread>(&ContainerLifecycleManager::ControlMessageReceiver, this, nullptr);
+ return STATUS_OK;
+}
+
+Status ContainerLifecycleManager::sendMessageToContainer(ControlMessageID controlMessage)
+{
+ std::shared_ptr<ControlMessage> stopContainerMessage = std::make_shared<ControlMessage>(controlMessage);
+ std::unique_lock<std::mutex> messageLock(messageMutex);
+ messageQueue.push(stopContainerMessage);
+ messageConditionVariable.notify_one();
+ return STATUS_OK;
+}
+
+Status ContainerLifecycleManager::sendStopToContainer()
+{
+ return sendMessageToContainer(CONTAINER_CONTROL_STOP);
+}
+
+Status ContainerLifecycleManager::sendDestroyToContainer()
+{
+ return sendMessageToContainer(CONTAINER_CONTROL_DESTROY);
+}
+
+Status ContainerLifecycleManager::sendRemoveImageToContainer()
+{
+ return sendMessageToContainer(CONTAINER_CONTROL_REMOVE_IMAGE);
+}
+
+Status ContainerLifecycleManager::sendStopToLifecycleManager()
+{
+ return sendMessageToContainer(CONTAINER_LIFECYCLE_MANAGER_CONTROL_STOP);
+}
+
+void ContainerLifecycleManager::joinThreads()
+{
+ if (containerStateMachineThread && containerStateMachineThread->joinable())
+ containerStateMachineThread->join();
+ containerStateMachineThread = nullptr;
+ if (controlMessageThread && controlMessageThread->joinable())
+ controlMessageThread->join();
+ controlMessageThread = nullptr;
+}
diff --git a/src/ContainerLifecycleManager.h b/src/ContainerLifecycleManager.h
new file mode 100644
index 0000000..7952385
--- /dev/null
+++ b/src/ContainerLifecycleManager.h
@@ -0,0 +1,317 @@
+#ifndef __CONTAINER_LIFECYCLE_MANAGER_H__
+#define __CONTAINER_LIFECYCLE_MANAGER_H__
+
+#include "Container.h"
+#include "Controller/ContainerController.h"
+#include <queue>
+#include <mutex>
+#include <thread>
+#include <future>
+#include <condition_variable>
+#include "util/log.h"
+
+class ContainerLifecycleManager;
+
+class ContainerState
+{
+public:
+ State state;
+
+public:
+ ContainerState(State state) { this->state = state; }
+ virtual ~ContainerState() {}
+ State getState() { return state; }
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) = 0;
+ Status buildContainerImage(Container *container);
+ Status createContainer(Container *container);
+ Status startContainer(Container *container);
+ Status waitContainer(Container *container);
+ Status stopContainer(Container *container);
+ Status destroyContainer(Container *container);
+ Status removeContainerImage(Container *container);
+};
+
+class RegisteredState : public ContainerState
+{
+private:
+ RegisteredState() : ContainerState(STATE_REGISTERED) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static RegisteredState containerState;
+ return &containerState;
+ }
+ virtual ~RegisteredState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class ImageBuildingState : public ContainerState
+{
+private:
+ ImageBuildingState() : ContainerState(STATE_IMAGE_BUILDING) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static ImageBuildingState containerState;
+ return &containerState;
+ }
+ virtual ~ImageBuildingState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class ImageBuildedState : public ContainerState
+{
+private:
+ ImageBuildedState() : ContainerState(STATE_IMAGE_BUILDED) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static ImageBuildedState containerState;
+ return &containerState;
+ }
+ virtual ~ImageBuildedState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class CreatingState : public ContainerState
+{
+private:
+ CreatingState() : ContainerState(STATE_CREATING) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static CreatingState containerState;
+ return &containerState;
+ }
+ virtual ~CreatingState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class CreatedState : public ContainerState
+{
+private:
+ CreatedState() : ContainerState(STATE_CREATED) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static CreatedState containerState;
+ return &containerState;
+ }
+ virtual ~CreatedState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class StartingState : public ContainerState
+{
+private:
+ StartingState() : ContainerState(STATE_STARTING) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static StartingState containerState;
+ return &containerState;
+ }
+ virtual ~StartingState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class RestartingState : public ContainerState
+{
+private:
+ RestartingState() : ContainerState(STATE_RESTARTING) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static RestartingState containerState;
+ return &containerState;
+ }
+ virtual ~RestartingState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class RunningState : public ContainerState
+{
+private:
+ RunningState() : ContainerState(STATE_RUNNING) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static RunningState containerState;
+ return &containerState;
+ }
+ virtual ~RunningState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class StoppingState : public ContainerState
+{
+private:
+ StoppingState() : ContainerState(STATE_STOPPING) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static StoppingState containerState;
+ return &containerState;
+ }
+ virtual ~StoppingState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class StoppedState : public ContainerState
+{
+private:
+ StoppedState() : ContainerState(STATE_STOPPED) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static StoppedState containerState;
+ return &containerState;
+ }
+ virtual ~StoppedState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class DestroyingState : public ContainerState
+{
+private:
+ DestroyingState() : ContainerState(STATE_DESTROYING) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static DestroyingState containerState;
+ return &containerState;
+ }
+ virtual ~DestroyingState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class DestroyedState : public ContainerState
+{
+private:
+ DestroyedState() : ContainerState(STATE_DESTROYED) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static DestroyedState containerState;
+ return &containerState;
+ }
+ virtual ~DestroyedState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class ImageRemovingState : public ContainerState
+{
+private:
+ ImageRemovingState() : ContainerState(STATE_IMAGE_REMOVING) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static ImageRemovingState containerState;
+ return &containerState;
+ }
+ virtual ~ImageRemovingState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class ImageRemovedState : public ContainerState
+{
+private:
+ ImageRemovedState() : ContainerState(STATE_IMAGE_REMOVED) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static ImageRemovedState containerState;
+ return &containerState;
+ }
+ virtual ~ImageRemovedState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class MachineFailedState : public ContainerState
+{
+private:
+ MachineFailedState() : ContainerState(STATE_MACHINE_FAILED) {}
+
+public:
+ static ContainerState *getInstance()
+ {
+ static MachineFailedState containerState;
+ return &containerState;
+ }
+ virtual ~MachineFailedState() {}
+ virtual void handleEvent(ContainerLifecycleManager *containerLifecycleManager) override;
+};
+
+class ControlMessage
+{
+public:
+ ControlMessageID id;
+
+public:
+ ControlMessage(ControlMessageID id) { this->id = id; }
+};
+
+class ContainerLifecycleManager
+{
+public:
+ ContainerLifecycleManagerStatus containerLifecycleManagerStatus;
+ ContainerState *containerState;
+ ContainerStateControl containerStateControl;
+ std::unique_ptr<Container> container;
+
+ std::unique_ptr<std::thread> containerStateMachineThread;
+ std::unique_ptr<std::thread> controlMessageThread;
+ std::queue<std::shared_ptr<ControlMessage>> messageQueue;
+ std::mutex messageMutex;
+ std::condition_variable messageConditionVariable;
+
+ std::future<Status> waitFuture;
+
+public:
+ void ContainerStateMachine(void *args);
+ void ControlMessageReceiver(void *args);
+
+public:
+ ContainerLifecycleManager(std::unique_ptr<Container> container)
+ {
+ this->containerLifecycleManagerStatus = CONTAINER_LIFECYCLE_MANAGER_STATUS_READY;
+ this->containerStateControl = CONTAINER_STATE_CONTROL_NONE;
+ this->container = std::move(container);
+ setState<RegisteredState>();
+ }
+ ~ContainerLifecycleManager()
+ {
+ if (containerStateMachineThread && containerStateMachineThread->joinable())
+ containerStateMachineThread->join();
+ containerStateMachineThread = nullptr;
+ if (controlMessageThread && controlMessageThread->joinable())
+ controlMessageThread->join();
+ controlMessageThread = nullptr;
+ }
+ bool isRunning() { return containerLifecycleManagerStatus == CONTAINER_LIFECYCLE_MANAGER_STATUS_RUNNUNG; }
+ Status runContainerLifecycleManager();
+ Status sendMessageToContainer(ControlMessageID controlMessage);
+ Status sendStopToContainer();
+ Status sendDestroyToContainer();
+ Status sendRemoveImageToContainer();
+ Status sendStopToLifecycleManager();
+ void joinThreads();
+ Container *getContainer();
+ template <typename T> void setState() { this->containerState = T::getInstance(); }
+};
+
+#endif /* __CONTAINER_LIFECYCLE_MANAGER_H__ */
diff --git a/src/ContainerManager.cpp b/src/ContainerManager.cpp
new file mode 100644
index 0000000..c5f2075
--- /dev/null
+++ b/src/ContainerManager.cpp
@@ -0,0 +1,351 @@
+#include <map>
+#include <memory>
+#include <iostream>
+#include <fstream>
+#include <future>
+#include <filesystem>
+#include <sys/inotify.h>
+
+#include "internal_types.h"
+
+#include "ContainerManager.h"
+#include "Volumes/VolumeManager.h"
+
+#include "Controller/DockerController.h"
+
+#include "Extension/Extension.h"
+
+#include "util/error.h"
+#include "util/log.h"
+
+#include "util/JsonTools.h"
+
+std::filesystem::path ContainerManager::halDevicesPath = "/hal/etc/docker/devices.json";
+
+ContainerManager::ContainerManager()
+{
+ inotify_fd = 0;
+ inotify_wd = 0;
+ adaptorWatchControl = ADAPTOR_WATCH_CONTROL_NONE;
+}
+
+ContainerManager::~ContainerManager()
+{
+ __containerList.clear();
+}
+
+Status ContainerManager::validName(const std::string &name)
+{
+ if (name.empty()) {
+ throw std::invalid_argument("invalid container name");
+ }
+ return STATUS_OK;
+}
+
+Status ContainerManager::registry(const std::string &configfile, const std::string name)
+{
+ Status ret = STATUS_FAIL;
+
+ try {
+
+ _D("registry container name : %s", name.c_str());
+ _D("container config file path : %s", configfile.c_str());
+ std::ifstream fileChecker(configfile);
+ if (fileChecker.fail()) {
+ _E("%s is not exist", configfile.c_str());
+ return ret;
+ }
+
+ Json::Value root;
+ if (!JsonTools::parseFromFile(configfile, &root))
+ return STATUS_FAIL;
+ root["configfile"] = configfile;
+
+ std::shared_ptr<Config::SharedConfigs> sharedConfig = std::make_shared<Config::SharedConfigs>(root);
+ ret = VolumeManager::get()->registryFromConfigs(root, sharedConfig);
+
+ if (!root.isMember("services"))
+ return STATUS_FAIL;
+
+ for (Json::ValueConstIterator service = root["services"].begin(); service != root["services"].end();
+ ++service) {
+ const Json::Value &config = *service;
+
+ /* generate Container class */
+ std::unique_ptr<Container> container = std::make_unique<DockerContainer>();
+ {
+ container->fingerprint.name = service.name();
+ JsonTools::Transform::getJsonValue(container->startOnBoot, config["StartOnBoot"]);
+
+ container->containerConfig =
+ std::make_unique<Config::ContainerConfigs>(config, container->fingerprint.name, sharedConfig);
+
+ if (config["AppendHalDevices"].asBool()) {
+ Json::Value halDeviceConfigs;
+ if (!JsonTools::parseFromFile(halDevicesPath, &halDeviceConfigs))
+ _W("Failed to read device configs from hal - %s", halDevicesPath.c_str());
+ container->containerConfig->append(halDeviceConfigs, sharedConfig);
+ }
+ }
+
+ /* generate Image class */
+ {
+ std::shared_ptr<Image> image = std::make_shared<DockerImage>();
+ JsonTools::Transform::getJsonValue(image->fingerprint.name, config["ImageName"]);
+ image->configs =
+ std::make_unique<Config::ImageConfigs>(config["build"], image->fingerprint.name, sharedConfig);
+ container->image = image;
+ }
+
+ /* get extensions */
+ ret = Extension::Helper::readConfigs(container->extConfigs, config, sharedConfig);
+
+ container->sharedConfig = sharedConfig;
+
+ std::unique_ptr<ContainerLifecycleManager> containerLifecycleManager =
+ std::make_unique<ContainerLifecycleManager>(std::move(container));
+ __containerList.emplace(name, std::move(containerLifecycleManager));
+ }
+ }
+ catch_return(STATUS_FAIL);
+
+ return ret;
+}
+
+Status ContainerManager::registryContainers(Json::Value &configList)
+{
+ Status ret = STATUS_OK;
+ for (Json::ValueIterator it = configList["ContainerConfig"].begin(); it != configList["ContainerConfig"].end();
+ it++) {
+ if (__containerList.count((*it)["ContainerName"].asString()))
+ continue;
+ if (registry((*it)["ContainerPath"].asString(), (*it)["ContainerName"].asString()) != STATUS_OK) {
+ _E("Registry container (name: %s) failed!", (*it)["ContainerName"].asString().c_str());
+ ret = STATUS_FAIL;
+ }
+ }
+ return ret;
+}
+
+Status ContainerManager::unregistry(const std::string &name)
+{
+ /* TODO : status check */
+ std::size_t erased = __containerList.erase(name);
+ if (erased)
+ return STATUS_OK;
+ return STATUS_FAIL;
+}
+
+Status ContainerManager::unregistryContainers()
+{
+ __containerList.clear();
+ return STATUS_OK;
+}
+
+Status ContainerManager::findContainer(const std::string &name, Container *&container)
+{
+ if (name.empty()) {
+ throw std::invalid_argument("container name is null");
+ }
+
+ if (!__containerList.count(name)) {
+ return STATUS_NOT_FOUND;
+ }
+
+ container = __containerList[name].get()->getContainer();
+ return STATUS_OK;
+}
+
+Status ContainerManager::runContainers()
+{
+ Status ret = STATUS_OK;
+ for (auto const &it : __containerList) {
+ if (!it.second->isRunning())
+ ret = it.second->runContainerLifecycleManager();
+ }
+ return ret;
+}
+
+Status ContainerManager::handleRemovedAdaptor(const std::string &name)
+{
+ if (__containerList.count(name)) {
+ __containerList[name].get()->sendRemoveImageToContainer();
+ __containerList[name].get()->sendStopToLifecycleManager();
+ __containerList.erase(name);
+ return STATUS_OK;
+ }
+ return STATUS_NOT_FOUND;
+}
+
+Status ContainerManager::stopContainers()
+{
+ Status ret = STATUS_FAIL;
+ for (auto const &it : __containerList) {
+ ret = it.second->sendStopToContainer();
+ }
+ return ret;
+}
+
+Status ContainerManager::destroyContainers()
+{
+ Status ret = STATUS_FAIL;
+ for (auto const &it : __containerList) {
+ ret = it.second->sendDestroyToContainer();
+ }
+ return ret;
+}
+
+#define EVENT_SIZE (sizeof(struct inotify_event))
+#define BUF_LEN (32 * (EVENT_SIZE + 16))
+
+Status ContainerManager::initMonitoringInAdaptorList(const std::string &configPath)
+{
+ std::filesystem::path p(configPath.c_str());
+ std::filesystem::create_directories(p);
+
+ inotify_fd = inotify_init();
+ if (inotify_fd < 0) {
+ _D("inotify init failed.");
+ return STATUS_FAIL;
+ }
+ inotify_wd = inotify_add_watch(inotify_fd, configPath.c_str(), IN_MOVE | IN_DELETE);
+ if (inotify_wd < 0) {
+ _D("inotify add watch failed - %s.", configPath.c_str());
+ close(inotify_fd);
+ return STATUS_FAIL;
+ }
+
+ startAdaptorWatch();
+
+ _D("Start to monitor ContainerList in %s.", configPath.c_str());
+ return STATUS_OK;
+}
+
+AdaptorList ContainerManager::startMonitoringInAdaptorList()
+{
+ char buffer[BUF_LEN];
+ ssize_t length = 0;
+ unsigned long i = 0;
+ length = read(inotify_fd, buffer, BUF_LEN);
+ if (length < 0) {
+ _D("read event failed.");
+ return ADAPTOR_LIST_NONE;
+ }
+
+ unsigned long ulength = static_cast<unsigned long>(length);
+
+ if (ulength > BUF_LEN)
+ ulength = BUF_LEN;
+
+ while (i < ulength) {
+ struct inotify_event *event = (struct inotify_event *)&buffer[i];
+ if (!event->len)
+ break;
+
+ if (event->mask & IN_MOVED_TO) {
+ _D("Added new container in list folder.");
+ return ADAPTOR_LIST_CREATE;
+ } else if (event->mask & IN_DELETE || event->mask & IN_MOVED_FROM) {
+ _D("Removed a container from list folder.");
+ return ADAPTOR_LIST_DELETE;
+ }
+
+ if (std::numeric_limits<unsigned long>::max() - i < EVENT_SIZE + event->len)
+ break;
+ i += EVENT_SIZE + event->len;
+ }
+ return ADAPTOR_LIST_NONE;
+}
+
+Status ContainerManager::stopMonitoringInAdaptorList()
+{
+ if (inotify_wd && inotify_fd) {
+ inotify_rm_watch(inotify_fd, inotify_wd);
+ close(inotify_fd);
+ return STATUS_OK;
+ }
+ return STATUS_NOT_FOUND;
+}
+
+std::string ContainerManager::findRemovedAdaptorInAdaptorList(const std::string &configPath)
+{
+ Json::Value configList;
+ if (Config::ContainerListConfigs::loadList(configPath, configList) == STATUS_FAIL)
+ return "";
+
+ for (auto const &cit : __containerList) {
+ bool found = false;
+ for (Json::ValueIterator it = configList["ContainerConfig"].begin(); it != configList["ContainerConfig"].end();
+ it++) {
+ if (!cit.first.compare((*it)["ContainerName"].asString()))
+ found = true;
+ }
+ if (!found)
+ return cit.first;
+ }
+ return "";
+}
+
+Status ContainerManager::startContainersInAdaptorList(const std::string &configPath)
+{
+ Status ret = STATUS_OK;
+ Json::Value configList;
+ if (Config::ContainerListConfigs::loadList(configPath, configList) == STATUS_FAIL)
+ return STATUS_FAIL;
+ if (!configList.empty()) {
+ if (registryContainers(configList) == STATUS_FAIL)
+ return STATUS_FAIL;
+ }
+ if (runContainers() == STATUS_FAIL)
+ return STATUS_FAIL;
+ return ret;
+}
+
+Status ContainerManager::runContainerManager(const std::string &configPath)
+{
+ std::string rname;
+ if (startContainersInAdaptorList(configPath) != STATUS_OK)
+ return STATUS_FAIL;
+ if (initMonitoringInAdaptorList(configPath) != STATUS_OK)
+ return STATUS_FAIL;
+ while (adaptorWatchControl == ADAPTOR_WATCH_CONTROL_ON) {
+ AdaptorList response = startMonitoringInAdaptorList();
+ switch (response) {
+ case ADAPTOR_LIST_CREATE:
+ if (startContainersInAdaptorList(configPath) != STATUS_OK)
+ return STATUS_FAIL;
+ break;
+ case ADAPTOR_LIST_DELETE:
+ rname = findRemovedAdaptorInAdaptorList(configPath);
+ if (!rname.empty()) {
+ if (handleRemovedAdaptor(rname) != STATUS_OK)
+ return STATUS_NOT_FOUND;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ return STATUS_OK;
+}
+
+Status ContainerManager::joinThreads()
+{
+ // CLIDaemon thread will be added
+ for (auto const &it : __containerList) {
+ it.second->joinThreads();
+ }
+ return STATUS_OK;
+}
+
+Status ContainerManager::startAdaptorWatch()
+{
+ adaptorWatchControl = ADAPTOR_WATCH_CONTROL_ON;
+ return STATUS_OK;
+}
+
+Status ContainerManager::stopAdaptorWatch()
+{
+ adaptorWatchControl = ADAPTOR_WATCH_CONTROL_OFF;
+ return STATUS_OK;
+}
diff --git a/src/ContainerManager.h b/src/ContainerManager.h
new file mode 100644
index 0000000..ded860a
--- /dev/null
+++ b/src/ContainerManager.h
@@ -0,0 +1,62 @@
+#ifndef __CONTAINER_MANAGER_H__
+#define __CONTAINER_MANAGER_H__
+
+#include "json/json.h"
+#include <filesystem>
+#include <list>
+#include <map>
+#include <memory>
+#include <string>
+#include <thread>
+
+#include "Container.h"
+#include "ContainerLifecycleManager.h"
+#include "Controller/ContainerController.h"
+#include "internal_types.h"
+
+class ContainerManager
+{
+public:
+ friend class ContainerManagerTest;
+ friend class DockerControllerTest;
+ friend class ContainerLifecycleManagerTest;
+
+ ContainerManager();
+ ~ContainerManager();
+
+ AdaptorWatchControl adaptorWatchControl;
+ static std::filesystem::path halDevicesPath;
+
+ Status registry(const std::string &path, std::string name);
+ Status registryContainers(Json::Value &configList);
+ Status unregistry(const std::string &name);
+ Status unregistryContainers();
+
+ std::string findRemovedAdaptorInAdaptorList(const std::string &configPath);
+ Status startContainersInAdaptorList(const std::string &configPath);
+ Status runContainerManager(const std::string &configPath);
+ Status joinThreads();
+
+ Status getContainerList(std::string *list);
+
+ Status runContainers();
+ Status stopContainers();
+ Status destroyContainers();
+ Status handleRemovedAdaptor(const std::string &name);
+
+ Status initMonitoringInAdaptorList(const std::string &configPath);
+ AdaptorList startMonitoringInAdaptorList();
+ Status stopMonitoringInAdaptorList();
+
+ Status validName(const std::string &name);
+ Status findContainer(const std::string &name, Container *&container);
+
+ Status startAdaptorWatch();
+ Status stopAdaptorWatch();
+
+private:
+ std::map<std::string, std::unique_ptr<ContainerLifecycleManager>> __containerList;
+ int inotify_fd, inotify_wd;
+};
+
+#endif /* __CONTAINER_MANAGER_H__ */
diff --git a/src/Controller/ContainerController.cpp b/src/Controller/ContainerController.cpp
new file mode 100644
index 0000000..304aadb
--- /dev/null
+++ b/src/Controller/ContainerController.cpp
@@ -0,0 +1,12 @@
+#include "ContainerController.h"
+#include "DockerController.h"
+
+ContainerController *ContainerController::getController(ContainerType type)
+{
+ if (type == CONTAINER_TYPE_DOCKER) {
+ static DockerController instance;
+ return &instance;
+ }
+ static DummyController dummy;
+ return &dummy;
+}
diff --git a/src/Controller/ContainerController.h b/src/Controller/ContainerController.h
new file mode 100644
index 0000000..a97584e
--- /dev/null
+++ b/src/Controller/ContainerController.h
@@ -0,0 +1,66 @@
+#ifndef __CONTAINER_CONTROLLER_H__
+#define __CONTAINER_CONTROLLER_H__
+
+#include "Container.h"
+#include "internal_types.h"
+#include "json/json.h"
+
+class ContainerController
+{
+public:
+ friend class DockerControllerTest;
+ ContainerController(ContainerType type) : containerType(type), __initialized(STATUS_FAIL) {}
+ virtual ~ContainerController() = default;
+
+ static ContainerController *getController(ContainerType type);
+
+ Status initialized() const { return __initialized; }
+
+ virtual Status init(const Json::Value &config) = 0;
+ virtual std::string getImageList() = 0;
+ virtual std::string getContainerList() = 0;
+ virtual Status isImageExist(std::shared_ptr<Image> image) = 0;
+ virtual Status isContainerExist(Container *const container) = 0;
+ virtual Status isContainerRunning(Container *const container) = 0;
+ virtual Status build(Container *const container) = 0;
+ virtual Status load(Container *const container) = 0;
+ virtual Status remove(Container *const container) = 0;
+ virtual Status create(Container *const container) = 0;
+ virtual Status destroy(Container *const container) = 0;
+ virtual Status start(Container *const container) = 0;
+ virtual Status stop(Container *const container) = 0;
+ virtual Status wait(Container *const container) = 0;
+ virtual Status restart(Container *const container) = 0;
+ virtual Status update(Container *const container) = 0;
+
+protected:
+ const ContainerType containerType;
+ Status __initialized;
+};
+
+class DummyController : public ContainerController
+{
+public:
+ DummyController() : ContainerController(CONTAINER_TYPE_NONE) {}
+ virtual ~DummyController() {}
+
+public:
+ virtual Status init(const Json::Value &config) { return STATUS_NOT_IMPLEMENT; }
+ virtual std::string getImageList() { return ""; }
+ virtual std::string getContainerList() { return ""; }
+ virtual Status isImageExist(std::shared_ptr<Image> image) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status isContainerExist(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status isContainerRunning(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status build(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status load(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status remove(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status create(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status destroy(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status start(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status stop(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status wait(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status restart(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+ virtual Status update(Container *const container) { return STATUS_NOT_IMPLEMENT; }
+};
+
+#endif
diff --git a/src/Controller/CurlRestInterface.cpp b/src/Controller/CurlRestInterface.cpp
new file mode 100644
index 0000000..85ef3f6
--- /dev/null
+++ b/src/Controller/CurlRestInterface.cpp
@@ -0,0 +1,191 @@
+#include "CurlRestInterface.h"
+#include <cstring>
+#include "util/log.h"
+
+CurlHelper::~CurlHelper()
+{
+ if (headers) {
+ curl_slist_free_all(headers);
+ }
+ if (handle) {
+ curl_easy_reset(handle);
+ }
+}
+
+void CurlHelper::setURL(const std::string &url)
+{
+ if (url.empty())
+ return;
+
+ this->url = url;
+ __retCheck(curl_easy_setopt(handle, CURLOPT_URL, url.c_str()));
+}
+
+void CurlHelper::setUnixSocket(const std::string &socket)
+{
+ if (socket.empty())
+ return;
+
+ __retCheck(curl_easy_setopt(handle, CURLOPT_UNIX_SOCKET_PATH, socket.c_str()));
+}
+
+void CurlHelper::setTimeout(long time)
+{
+ if (time < 0) {
+ time = 0;
+ }
+ this->timeout = time;
+ __retCheck(curl_easy_setopt(handle, CURLOPT_TIMEOUT, this->timeout));
+}
+
+void CurlHelper::setRequest(const std::string &type)
+{
+ __retCheck(curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, type.c_str()));
+}
+
+void CurlHelper::setPostData(const std::string &contentType, std::pair<const void *, size_t> &postdata)
+{
+ auto &[data, size] = postdata;
+ __prepair_slist(contentType);
+ __retCheck(curl_easy_setopt(handle, CURLOPT_POST, 1L));
+ __retCheck(curl_easy_setopt(handle, CURLOPT_POSTFIELDS, data));
+ __retCheck(curl_easy_setopt(handle, (size >> 30) >= 2 ? CURLOPT_POSTFIELDSIZE_LARGE : CURLOPT_POSTFIELDSIZE, size));
+}
+
+void CurlHelper::setPostData(const std::string &contentType, std::ifstream *stream)
+{
+ __prepair_slist_chunked(contentType);
+ __retCheck(curl_easy_setopt(handle, CURLOPT_POST, 1L));
+ __retCheck(curl_easy_setopt(handle, CURLOPT_READDATA, stream));
+ __retCheck(curl_easy_setopt(handle, CURLOPT_READFUNCTION, __read_callback_ifstream));
+
+ stream->seekg(0, stream->beg);
+}
+
+void CurlHelper::setPostData(const std::string &contentType, FILE *pipe)
+{
+ __prepair_slist_chunked(contentType);
+ __retCheck(curl_easy_setopt(handle, CURLOPT_POST, 1L));
+ __retCheck(curl_easy_setopt(handle, CURLOPT_READDATA, pipe));
+ __retCheck(curl_easy_setopt(handle, CURLOPT_READFUNCTION, NULL)); // default curl readfunction is fread
+}
+
+ResponseMessage CurlHelper::perform()
+{
+ if (unlikely(!handle)) {
+ _E("curl handle is not initialized");
+ response.code = ResponseCode::REQUEST_FAILED;
+ return response;
+ }
+
+ __retCheck(curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, __write_callback));
+ __retCheck(curl_easy_setopt(handle, CURLOPT_WRITEDATA, &response.message));
+
+ _D("request URL : %s", url.c_str());
+
+ CURLcode code = curl_easy_perform(handle);
+ __retCheck(curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &response.code));
+
+ switch (code) {
+ case CURLE_OK:
+ /* Success */
+ break;
+ case CURLE_OPERATION_TIMEDOUT:
+ if (this->timeout > 0) {
+ /* Intentional operation and return code */
+ break;
+ }
+ /* Maybe, operation fail */
+ [[fallthrough]];
+ default:
+ _E("curl_easy_perform error(code %d)!!", code);
+ response.code = ResponseCode::REQUEST_FAILED;
+ break;
+ }
+
+ return response;
+}
+
+void CurlHelper::__prepair_slist(const std::string &headerStr)
+{
+ if (headers) {
+ curl_slist_free_all(headers);
+ }
+ headers = curl_slist_append(headers, headerStr.c_str());
+ __retCheck(curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers));
+}
+
+void CurlHelper::__prepair_slist_chunked(const std::string &headerStr)
+{
+ if (headers) {
+ curl_slist_free_all(headers);
+ }
+
+ headers = curl_slist_append(headers, headerStr.c_str());
+ headers = curl_slist_append(headers, HTTP_TRANSFER_ENCODING_CHUNCKED);
+ __retCheck(curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers));
+}
+
+size_t CurlHelper::__write_callback(void *contents, size_t size, size_t nmemb, void *userp)
+{
+ ((std::string *)userp)->append((char *)contents, size * nmemb);
+ return size * nmemb;
+}
+
+size_t CurlHelper::__read_callback_ifstream(char *dest, size_t size, size_t nmemb, void *userp)
+{
+ std::ifstream *file = reinterpret_cast<std::ifstream *>(userp);
+ size_t length = size * nmemb;
+ file->read(dest, length);
+ return file->gcount();
+}
+
+CurlRestInterface::CurlRestInterface(const std::string_view &serverAddr, const std::string_view &socketPath)
+ : RestInterface(serverAddr, socketPath), handle(nullptr), mutex()
+{
+ if (handle = curl_easy_init(); !handle) {
+ _E("curl init fail");
+ }
+}
+
+CurlRestInterface::~CurlRestInterface()
+{
+ if (handle) {
+ curl_easy_cleanup(handle);
+ handle = nullptr;
+ }
+}
+
+ResponseMessage CurlRestInterface::request_post(const RestURL &url, const void *data, size_t size,
+ const std::string_view &contentType, const long timeout)
+{
+ return __do_request_post<std::pair<const void *, size_t>>(url, {data, size}, contentType, timeout);
+}
+
+ResponseMessage CurlRestInterface::request_post(const RestURL &url, std::ifstream *stream,
+ const std::string_view &contentType, const long timeout)
+{
+ return __do_request_post(url, stream, contentType, timeout);
+}
+
+ResponseMessage CurlRestInterface::request_post(const RestURL &url, FILE *pipe, const std::string_view &contentType,
+ const long timeout)
+{
+ return __do_request_post(url, pipe, contentType, timeout);
+}
+
+ResponseMessage CurlRestInterface::request(const RestURL &url, const std::string_view &request, const long timeout)
+{
+ std::lock_guard<std::mutex> lock(mutex);
+
+ CurlHelper req(handle, serverAddr + url.toString(), socketPath);
+ try {
+ req.setRequest(std::string(request));
+ req.setTimeout(timeout);
+ } catch (std::exception &e) {
+ return ResponseMessage(ResponseCode::UNKNOWN, e.what());
+ } catch (...) {
+ return ResponseMessage(ResponseCode::UNKNOWN, "unknown error");
+ }
+ return req.perform();
+}
diff --git a/src/Controller/CurlRestInterface.h b/src/Controller/CurlRestInterface.h
new file mode 100644
index 0000000..acd17f5
--- /dev/null
+++ b/src/Controller/CurlRestInterface.h
@@ -0,0 +1,89 @@
+#ifndef __CURL_RESTINTERFACE_H__
+#define __CURL_RESTINTERFACE_H__
+
+#include <curl/curl.h>
+#include <memory>
+#include <mutex>
+#include "internal_types.h"
+#include "RestInterface.h"
+
+class CurlHelper
+{
+public:
+ CurlHelper(CURL *handle) : handle(handle), headers(nullptr) {}
+ CurlHelper(CURL *handle, const std::string &url) : CurlHelper(handle) { setURL(url); }
+ CurlHelper(CURL *handle, const std::string &url, const std::string &socket) : CurlHelper(handle, url)
+ {
+ setUnixSocket(socket);
+ }
+ ~CurlHelper();
+
+ void setURL(const std::string &url);
+ void setUnixSocket(const std::string &socket);
+ void setTimeout(long time);
+ void setRequest(const std::string &type);
+ void setPostData(const std::string &contentType, std::pair<const void *, size_t> &data);
+ void setPostData(const std::string &contentType, std::ifstream *stream);
+ void setPostData(const std::string &contentType, FILE *pipe);
+ ResponseMessage perform();
+
+private:
+ void __prepair_slist(const std::string &headerStr);
+ void __prepair_slist_chunked(const std::string &headerStr);
+ static size_t __write_callback(void *contents, size_t size, size_t nmemb, void *userp);
+ static size_t __read_callback_ifstream(char *dest, size_t size, size_t nmemb, void *userp);
+ static void inline __retCheck(CURLcode code)
+ {
+ if (unlikely(code != CURLE_OK))
+ throw std::runtime_error("libcurl internal error");
+ }
+
+public:
+ ResponseMessage response;
+
+private:
+ CURL *handle;
+ curl_slist *headers = nullptr;
+ std::string url;
+ long timeout = 0;
+};
+
+class CurlRestInterface : public RestInterface
+{
+public:
+ CurlRestInterface(const std::string_view &serverAddr, const std::string_view &socketPath);
+ ~CurlRestInterface();
+
+ virtual ResponseMessage request(const RestURL &url, const std::string_view &request, const long timeout) override;
+ virtual ResponseMessage request_post(const RestURL &url, const void *data, size_t size,
+ const std::string_view &contentType, const long timeout) override;
+ virtual ResponseMessage request_post(const RestURL &url, std::ifstream *stream, const std::string_view &contentType,
+ const long timeout) override;
+ virtual ResponseMessage request_post(const RestURL &url, FILE *pipe, const std::string_view &contentType,
+ const long timeout = -1) override;
+
+private:
+ template <typename T>
+ ResponseMessage __do_request_post(const RestURL &url, T data, const std::string_view &contentType,
+ const long timeout)
+ {
+ std::lock_guard<std::mutex> lock(mutex);
+
+ CurlHelper req(handle, serverAddr + url.toString(), socketPath);
+ try {
+ req.setPostData(std::string(contentType), data);
+ req.setTimeout(timeout);
+ } catch (std::exception &e) {
+ return ResponseMessage(ResponseCode::UNKNOWN, e.what());
+ } catch (...) {
+ return ResponseMessage(ResponseCode::UNKNOWN, "unknown error");
+ }
+
+ return req.perform();
+ }
+
+ CURL *handle;
+ std::mutex mutex;
+};
+
+#endif /* __CURL_RESTINTERFACE_H__ */
diff --git a/src/Controller/DockerController.cpp b/src/Controller/DockerController.cpp
new file mode 100644
index 0000000..90754d0
--- /dev/null
+++ b/src/Controller/DockerController.cpp
@@ -0,0 +1,500 @@
+#include <fstream>
+#include <iostream>
+
+#include "DockerController.h"
+
+#include "util/JsonTools.h"
+#include "util/error.h"
+
+static const RestURL ImageURL(DOCKER_URL_IMAGES);
+static const RestURL ContainerURL(DOCKER_URL_CONTAINERS);
+
+DockerController::DockerController()
+ : ContainerController(ContainerType::CONTAINER_TYPE_DOCKER), socketPath("/var/run/docker.sock"), apiVersion("v1.41")
+{
+}
+
+DockerController::~DockerController()
+{
+}
+
+Status DockerController::init(const Json::Value &config)
+{
+ if (config.isMember("docker")) {
+ const Json::Value &dockerConfig = config["docker"];
+ JsonTools::Transform::getJsonValue<std::string>(socketPath, dockerConfig["socketPath"]);
+ JsonTools::Transform::getJsonValue<std::string>(apiVersion, dockerConfig["apiVersion"]);
+ }
+
+ apiURL = "http://localhost/" + apiVersion;
+
+ restInterface = std::make_shared<CurlRestInterface>(apiURL, socketPath);
+ if (!restInterface) {
+ return STATUS_FAIL;
+ }
+ __initialized = STATUS_OK;
+
+ return STATUS_OK;
+}
+
+std::pair<Status, ResponseMessage> DockerController::__handle_result(std::function<ResponseMessage()> request_fn,
+ const char *funcname, unsigned int retry)
+{
+ Status ret = STATUS_OK;
+ ResponseMessage retMessage;
+
+ do {
+ retMessage = request_fn();
+ ret = RestInterface::check_response(retMessage);
+
+ } while (ret == STATUS_RETRY && retry--);
+
+ if (ret == STATUS_OK) {
+ _D("%s request ok", funcname);
+ } else {
+ _W("Failed to send request for %s: %s(Status: %d)", funcname, retMessage.message.c_str(), ret);
+ ret = STATUS_FAIL;
+ }
+ return {ret, retMessage};
+}
+
+std::string DockerController::getImageList()
+{
+ _D("Get images list");
+
+ RestURL url = ImageURL / "json";
+ url.appendQuery("all", "true");
+
+ const auto &[ret, retMessage] = __handle_result([&] { return getRestInterface()->request_get(url); }, __func__);
+ return retMessage.message;
+}
+
+std::string DockerController::getContainerList()
+{
+ _D("Get container list");
+
+ RestURL url = ContainerURL / "json";
+ url.appendQuery("all", "true");
+
+ const auto &[ret, retMessage] = __handle_result([&] { return getRestInterface()->request_get(url); }, __func__);
+ return retMessage.message;
+}
+
+Status DockerController::isImageExist(std::shared_ptr<Image> image)
+{
+ _D("Is image exist");
+
+ RestURL url = ImageURL / "json";
+ url.appendQuery("all", "true");
+
+ const auto &[ret, retMessage] = __handle_result([&] { return getRestInterface()->request_get(url); }, __func__);
+ if (ret != STATUS_OK)
+ return STATUS_FAIL;
+
+ std::string repoTags = image->fingerprint.getFullName();
+ Json::Value root;
+ JsonTools::parseFromString(retMessage.message, &root);
+
+ if (root.empty())
+ return STATUS_NOT_FOUND;
+
+ for (Json::ValueIterator it = root.begin(); it != root.end(); it++) {
+ if (!repoTags.compare((*it)["RepoTags"][0].asString())) {
+ return STATUS_OK;
+ }
+ }
+
+ return STATUS_NOT_FOUND;
+}
+
+Status DockerController::__is_container_exist(Container *const container, bool all)
+{
+ RestURL url = ContainerURL / "json";
+ if (all)
+ url.appendQuery("all", "true");
+
+ const auto &[ret, retMessage] = __handle_result([&] { return getRestInterface()->request_get(url); }, __func__);
+
+ if (ret != STATUS_OK)
+ return STATUS_FAIL;
+
+ std::string containerName = "/" + container->fingerprint.name;
+ Json::Value root;
+ JsonTools::parseFromString(retMessage.message, &root);
+
+ if (root.empty())
+ return STATUS_NOT_FOUND;
+
+ for (Json::ValueIterator it = root.begin(); it != root.end(); it++) {
+ if (!containerName.compare((*it)["Names"][0].asString())) {
+ container->fingerprint.id = (*it)["Id"].asString();
+ return STATUS_OK;
+ }
+ }
+
+ return STATUS_NOT_FOUND;
+}
+
+Status DockerController::isContainerRunning(Container *const container)
+{
+ _D("Is container running");
+ return DockerController::__is_container_exist(container, false);
+}
+
+Status DockerController::isContainerExist(Container *const container)
+{
+ _D("Is container exist");
+ return DockerController::__is_container_exist(container, true);
+}
+
+Status DockerController::__generate_image_build_data(Image *const image, RestURL &url)
+{
+ assert(image != nullptr);
+ /* A name and optional tag to apply to the image */
+ if (image->fingerprint.name.empty())
+ return STATUS_FAIL;
+
+ Config::ImageConfigs *configs = image->configs.get();
+ if (!configs)
+ return STATUS_FAIL;
+
+ url.appendQuery("t", image->fingerprint.getFullName());
+
+ /* Path within the build context to the Dockerfile */
+ if (configs->dockerfile)
+ url.appendQuery("dockerfile", configs->dockerfile->string());
+
+ /* JSON map of string pairs for build-time variables */
+ if (Json::Value val; JsonTools::Transform::setJsonObject(val, "", configs->args) == STATUS_OK) {
+ url.appendQuery("buildargs", JsonTools::writeToString(val));
+ }
+
+ return STATUS_OK;
+}
+
+Status DockerController::__build_from_file(std::shared_ptr<RestInterface> restIface, const RestURL &url,
+ const std::filesystem::path &context)
+{
+ _D("Build from %s", context.c_str());
+ std::ifstream ifs(context, std::ios_base::binary);
+ if (!ifs)
+ return STATUS_FAIL;
+
+ const auto &[ret, retMessage] =
+ __handle_result([&] { return restIface->request_post(url, &ifs, HTTP_CONTENT_TYPE_XTAR); }, __func__);
+
+ return ret;
+}
+
+Status DockerController::__build_from_directory(std::shared_ptr<RestInterface> restIface, const RestURL &url,
+ const std::filesystem::path &context,
+ std::vector<util::system::Mount> &mounts)
+{
+ _D("Build from %s", context.c_str());
+ util::system::subprocess execTar("tar", {"cf", "-", "--exclude=lost+found", "-C", context.string(), "."});
+
+ for (auto &mnt : mounts) {
+ mnt.mount();
+ }
+
+ FILE *pipe = execTar.open("r");
+ if (!pipe) {
+ return STATUS_FAIL;
+ }
+
+ const auto &[ret, retMessage] =
+ __handle_result([&] { return restIface->request_post(url, pipe, HTTP_CONTENT_TYPE_XTAR); }, __func__);
+
+ execTar.close();
+
+ for (auto &mnt : mounts) {
+ mnt.umount();
+ }
+ return ret;
+}
+
+Status DockerController::build(Container *const container)
+{
+ std::shared_ptr<Image> image = container->image;
+ assert(image != nullptr);
+
+ if (!image->configs->context) {
+ return STATUS_FAIL;
+ }
+
+ RestURL url("/build");
+ if (__generate_image_build_data(image.get(), url) != STATUS_OK) {
+ _E("Build image parameter is invalid");
+ return STATUS_FAIL;
+ }
+
+ Status ret = STATUS_FAIL;
+ std::filesystem::path &context = image->configs->context.value();
+ switch (std::filesystem::status(context).type()) {
+ case std::filesystem::file_type::regular:
+ ret = __build_from_file(getRestInterface(container), url, context);
+ break;
+ case std::filesystem::file_type::directory:
+ ret = __build_from_directory(getRestInterface(container), url, context, image->configs->mounts);
+ break;
+ default:
+ _E("%s is invalid", context.c_str());
+ return STATUS_FAIL;
+ }
+
+ _D("Build finish %s image", image->fingerprint.name.c_str());
+
+ return ret;
+}
+
+Status DockerController::load(Container *const container)
+{
+ std::shared_ptr<Image> image = container->image;
+ assert(image != nullptr);
+
+ if (!image->configs->imagedatafile) {
+ return STATUS_FAIL;
+ }
+
+ std::ifstream ifs(image->configs->imagedatafile.value(), std::ios_base::binary);
+ if (!ifs)
+ return STATUS_FAIL;
+
+ RestURL url = ImageURL / "load";
+ const auto &[ret, retMessage] = __handle_result(
+ [&] { return getRestInterface(container)->request_post(url, &ifs, HTTP_CONTENT_TYPE_XTAR); }, __func__);
+ return ret;
+}
+
+Status DockerController::__generate_container_create_device_data(Json::Value &config, const std::string &configname,
+ std::vector<Config::Device> &devices)
+{
+ if (devices.empty())
+ return STATUS_IGNORE;
+
+ Json::Value &devcfg = config[configname];
+ for (auto &obj : devices) {
+ /* check device existing before create */
+ /* TODO : Finally, if possible, check the device just before the start and change the container settings. */
+ if (!obj.strict && !obj.checkExists()) {
+ _W("%s is not existing. ignore device", obj.source.c_str());
+ continue;
+ }
+ Json::Value val;
+ val["PathOnHost"] = obj.source.string();
+ val["PathInContainer"] = obj.target.string();
+ val["CgroupPermissions"] = obj.cgroupPermission.toString();
+ devcfg.append(val);
+ }
+
+ return STATUS_OK;
+}
+
+Status DockerController::__generate_container_create_data(Container *const container, Json::Value &root)
+{
+ Config::ContainerConfigs *config = container->containerConfig.get();
+
+ /* The name of the image to use when creating the container */
+ JsonTools::Transform::setJsonValue(root["Image"], container->image->fingerprint.name);
+
+ /* Command to run specified as an array of strings */
+ JsonTools::Transform::setJsonArray(root, "Cmd", config->cmd);
+
+ /* The entry point for the container */
+ JsonTools::Transform::setJsonValue(root, "Entrypoint", config->entrypoint);
+
+ /* MAC address of the container */
+ JsonTools::Transform::setJsonValue(root, "MacAddress", config->macAddress);
+
+ /* User-defined key/value metadata */
+ JsonTools::Transform::setJsonObject(root, "Labels", config->labels);
+
+ /* A list of environment variables to set inside the containe */
+ JsonTools::Transform::setJsonArray(root, "Env", config->environment);
+
+ /* Whether to attach to stdin */
+ JsonTools::Transform::setJsonValue(root, "AttachStdin", config->attachStdin);
+
+ /* Open stdin */
+ JsonTools::Transform::setJsonValue(root, "OpenStdin", config->openStdin);
+
+ /* Attach standard streams to a TTY, including stdin if it is not closed */
+ JsonTools::Transform::setJsonValue(root, "Tty", config->tty);
+
+ /* Disable networking for the container */
+ JsonTools::Transform::setJsonValue(root, "NetworkDisabled", config->networkDisabled);
+
+ /* Signal to stop a container as a string or unsigned integer */
+ JsonTools::Transform::setJsonValue(root, "StopSignal", config->stopsignal);
+
+ /* set HostConfig */
+ {
+ Json::Value hostConfig;
+
+ /* A list of devices to add to the container */
+ __generate_container_create_device_data(hostConfig, "Devices", config->devices);
+
+ /* A list of cgroup rules to apply to the container */
+ JsonTools::Transform::setJsonArray(hostConfig, "deviceCgroupRules", config->deviceCgroupRules);
+
+ /* Cgroup namespace mode for the container */
+ JsonTools::Transform::setJsonValue(hostConfig, "CgroupnsMode", config->cgroupnsMode);
+
+ /* Network mode to use for this container */
+ JsonTools::Transform::setJsonValue(hostConfig, "NetworkMode", config->networkMode);
+
+ /* Specification for mounts to be added to the container */
+ JsonTools::Transform::setJsonValue(hostConfig, "Mounts", config->mounts);
+
+ /* A list of volume bindings for this container */
+ JsonTools::Transform::setJsonArray(hostConfig, "Binds", config->binds);
+
+ /* A list of kernel capabilities to add to the container */
+ JsonTools::Transform::setJsonArray(hostConfig, "CapAdd", config->capAdd);
+
+ /* A list of kernel capabilities to drop to the container */
+ JsonTools::Transform::setJsonArray(hostConfig, "CapDrop", config->capDrop);
+
+ /* Gives the container full access to the host */
+ JsonTools::Transform::setJsonValue(hostConfig, "Privileged", config->privileged);
+
+ /* A list of string values to customize labels for MLS systems, such as SELinux */
+ if (config->securityOpt) {
+ Json::Value security_opt;
+
+ _D("Read %s file", config->securityOpt->c_str());
+ if (JsonTools::parseFromFile(config->securityOpt.value(), &security_opt)) {
+ std::string secString = "seccomp=" + JsonTools::writeToString(security_opt);
+ hostConfig["SecurityOpt"].append(Json::Value(secString));
+ } else {
+ _W("securityOpt set failed");
+ }
+ }
+
+ root["HostConfig"] = hostConfig;
+ }
+
+ root["Env"].append("container=docker");
+
+ return STATUS_OK;
+}
+
+Status DockerController::create(Container *container)
+{
+ Json::Value config;
+ if (__generate_container_create_data(container, config) != STATUS_OK) {
+ _E("Create container parameter invalid");
+ return STATUS_FAIL;
+ }
+
+ RestURL url = ContainerURL / "create";
+ url.appendQuery("name", container->fingerprint.name);
+
+ const auto &[ret, retMessage] =
+ __handle_result([&] { return getRestInterface(container)->request_post(url, config); }, __func__);
+ if (ret == STATUS_OK) {
+ Json::Value val;
+ JsonTools::parseFromString(retMessage.message, &val);
+ container->fingerprint.id = val["Id"].asString();
+ }
+ return ret;
+}
+
+Status DockerController::start(Container *const container)
+{
+ if (container->fingerprint.name.empty()) {
+ _E("container name invalid");
+ return STATUS_FAIL;
+ }
+
+ RestURL url = ContainerURL / container->fingerprint.name / "start";
+
+ const auto &[ret, retMessage] =
+ __handle_result([&] { return getRestInterface(container)->request_post(url); }, __func__);
+
+ if (ret != STATUS_OK) {
+ if (retMessage.code != ResponseCode::NOT_MODIFIED)
+ return STATUS_FAIL;
+ _D("%s container already stared", container->fingerprint.name.c_str());
+ }
+
+ return ret;
+}
+
+Status DockerController::wait(Container *container)
+{
+ RestURL url = ContainerURL / container->fingerprint.name / "wait";
+ const auto &[ret, retMessage] =
+ __handle_result([&] { return getRestInterfaceForWait(container)->request_post(url); }, __func__, 0);
+
+ if (ret == STATUS_OK) {
+ Json::Value msg;
+ JsonTools::parseFromString(retMessage.message, &msg);
+ _D("Exit code : %d", msg["StatusCode"].asInt());
+ }
+
+ return ret;
+}
+
+Status DockerController::stop(Container *const container)
+{
+ RestURL url = ContainerURL / container->fingerprint.name / "stop";
+ const auto &[ret, retMessage] =
+ __handle_result([&] { return getRestInterface(container)->request_post(url); }, __func__);
+
+ if (ret != STATUS_OK) {
+ if (retMessage.code != ResponseCode::NOT_MODIFIED)
+ return STATUS_FAIL;
+ _W("%s container already stopped", container->fingerprint.name.c_str());
+ return STATUS_OK;
+ }
+
+ return ret;
+}
+
+Status DockerController::destroy(Container *const container)
+{
+ if (container->fingerprint.name.empty()) {
+ _E("container name invalid");
+ return STATUS_FAIL;
+ }
+
+ RestURL url = ContainerURL / container->fingerprint.name;
+ const auto &[ret, retMessage] =
+ __handle_result([&] { return getRestInterface(container)->request_delete(url); }, __func__);
+
+ return ret;
+}
+
+Status DockerController::remove(Container *const container)
+{
+ std::shared_ptr<Image> image = container->image;
+ assert(image != nullptr);
+
+ if (image->fingerprint.name.empty()) {
+ _E("remove image parameter invalid");
+ return STATUS_FAIL;
+ }
+
+ RestURL url = ImageURL / image->fingerprint.name;
+ const auto &[ret, retMessage] =
+ __handle_result([&] { return getRestInterface(container)->request_delete(url); }, __func__);
+
+ return ret;
+}
+
+Status DockerController::restart(Container *const container)
+{
+ Status ret;
+
+ ret = DockerController::stop(container);
+ if (ret != STATUS_OK)
+ return ret;
+
+ return DockerController::start(container);
+}
+
+Status DockerController::update(Container *const container)
+{
+ return STATUS_NOT_IMPLEMENT;
+}
diff --git a/src/Controller/DockerController.h b/src/Controller/DockerController.h
new file mode 100644
index 0000000..324a4ec
--- /dev/null
+++ b/src/Controller/DockerController.h
@@ -0,0 +1,115 @@
+#ifndef __DOCKER_CONTROLLER_H__
+#define __DOCKER_CONTROLLER_H__
+
+#include "Container.h"
+#include "ContainerController.h"
+#include "CurlRestInterface.h"
+#include "Image.h"
+#include <string>
+
+#include "internal_types.h"
+#include "util/system.h"
+
+#define DOCKER_DAEMON "dockerd"
+#define DOCKER_ENGINE_API_RETRY_MAX 120
+#define DOCKER_ENGINE_RETRY_MAX 5
+#define STATUS_MAX_NUM 13
+#define EVEVT_STATUS_MAX_NUM 4
+#define SERVER_RETRY_COUNT 2
+
+#define DOCKER_URL_IMAGES "/images"
+#define DOCKER_URL_CONTAINERS "/containers"
+
+class DockerContainer : public Container
+{
+public:
+ DockerContainer() : Container(CONTAINER_TYPE_DOCKER), restInterface(nullptr), restInterfaceForWait(nullptr) {}
+ ~DockerContainer() = default;
+
+public:
+ std::shared_ptr<RestInterface> restInterface;
+ std::shared_ptr<RestInterface> restInterfaceForWait;
+};
+
+class DockerImage : public Image
+{
+public:
+ DockerImage() : Image(CONTAINER_TYPE_DOCKER), restInterface(nullptr) {}
+ ~DockerImage() = default;
+
+public:
+ std::shared_ptr<RestInterface> restInterface;
+};
+
+class DockerController : public ContainerController
+{
+public:
+ friend class DockerControllerTest;
+ DockerController();
+ virtual ~DockerController();
+
+public:
+ virtual Status init(const Json::Value &config);
+ virtual std::string getImageList();
+ virtual std::string getContainerList();
+ virtual Status isImageExist(std::shared_ptr<Image> image);
+ virtual Status isContainerExist(Container *const container);
+ virtual Status isContainerRunning(Container *const container);
+ virtual Status build(Container *const container);
+ virtual Status load(Container *const container);
+ virtual Status remove(Container *const container);
+ virtual Status create(Container *const container);
+ virtual Status destroy(Container *const container);
+ virtual Status start(Container *const container);
+ virtual Status stop(Container *const container);
+ virtual Status wait(Container *const container);
+ virtual Status restart(Container *const container);
+ virtual Status update(Container *const container);
+
+ std::shared_ptr<RestInterface> getRestInterface(Container *container = nullptr)
+ {
+ std::shared_ptr<RestInterface> &restInterface =
+ container ? static_cast<DockerContainer *>(container)->restInterface : this->restInterface;
+
+ if (!restInterface) {
+ restInterface = std::make_shared<CurlRestInterface>(apiURL, socketPath);
+ }
+ return restInterface;
+ }
+
+ std::shared_ptr<RestInterface> getRestInterfaceForWait(Container *container)
+ {
+ std::shared_ptr<RestInterface> &restInterface = static_cast<DockerContainer *>(container)->restInterfaceForWait;
+
+ if (!restInterface) {
+ restInterface = std::make_shared<CurlRestInterface>(apiURL, socketPath);
+ }
+ return restInterface;
+ }
+
+ void setRestInterface(std::shared_ptr<RestInterface> restInterface) { this->restInterface = restInterface; }
+
+public:
+ std::string socketPath;
+ std::string apiURL;
+ std::string apiVersion;
+
+private:
+ std::shared_ptr<RestInterface> restInterface;
+
+private:
+ Status __is_container_exist(Container *const container, bool all);
+ Status __generate_image_build_data(Image *const container, RestURL &url);
+ Status __generate_container_create_device_data(Json::Value &config, const std::string &configname,
+ std::vector<Config::Device> &devices);
+ Status __generate_container_create_data(Container *const container, Json::Value &config);
+ Status __build_from_file(std::shared_ptr<RestInterface> restIface, const RestURL &url,
+ const std::filesystem::path &context);
+ Status __build_from_directory(std::shared_ptr<RestInterface> restIface, const RestURL &url,
+ const std::filesystem::path &context, std::vector<util::system::Mount> &mounts);
+
+ std::pair<Status, ResponseMessage> __handle_result(std::function<ResponseMessage()> request_fn,
+ const char *funcname, unsigned int retry = SERVER_RETRY_COUNT);
+};
+
+#endif /* __DOCKER_COMTROLLER_H__ */
diff --git a/src/Controller/RestInterface.h b/src/Controller/RestInterface.h
new file mode 100644
index 0000000..de538b0
--- /dev/null
+++ b/src/Controller/RestInterface.h
@@ -0,0 +1,173 @@
+#ifndef __REST_INTERFACE_H__
+#define __REST_INTERFACE_H__
+
+#include <iostream>
+#include <fstream>
+#include <memory>
+#include <map>
+
+#include <curl/curl.h>
+
+#include "internal_types.h"
+#include "util/log.h"
+#include "util/JsonTools.h"
+
+#define HTTP_CONTENT_TYPE_DEFAULT "Content-Type: Multipart/related"
+#define HTTP_CONTENT_TYPE_JSON "Content-Type: application/json"
+#define HTTP_CONTENT_TYPE_XTAR "Content-Type: application/x-tar"
+#define HTTP_TRANSFER_ENCODING_CHUNCKED "Transfer-Encoding: chunked"
+
+enum ResponseCode {
+ // Custom reponses
+ UNKNOWN = 0L,
+ REQUEST_FAILED = 1L,
+ // Information responses (100-199)
+ CONTINUE = 100L,
+ // Successful responses (200-299)
+ OK = 200L,
+ CREATED = 201L,
+ NO_CONTENT = 204L,
+ // Redirection messages (300-399)
+ MULTIPLE_CHOICE = 300L,
+ NOT_MODIFIED = 304L,
+ // Client error responses (400-499)
+ BAD_REQUEST = 400L,
+ FORBIDDEN = 403L,
+ NOT_FOUND = 404L,
+ REQUEST_TIMEOUT = 408L,
+ // Server error responses (500-599)
+ INTERNAL_SERVER_ERROR = 500L,
+};
+
+class ResponseMessage
+{
+public:
+ ResponseMessage() : code(ResponseCode::UNKNOWN) {}
+ ResponseMessage(long _code, std::string _message) : code(_code), message(_message) {}
+ bool isCustomResponse() const { return code < ResponseCode::CONTINUE; }
+ bool isServerErrorResponse() const { return code == ResponseCode::INTERNAL_SERVER_ERROR; }
+ bool isSuccessfulResponse() const { return code >= ResponseCode::OK && code < ResponseCode::MULTIPLE_CHOICE; }
+
+public:
+ long code;
+ std::string message;
+};
+
+class RestURL
+{
+public:
+ ~RestURL() = default;
+ RestURL() = default;
+ explicit RestURL(const std::string &url) : serverUrl(url) { __removeLastSlash(); }
+ RestURL &operator+=(const std::string &str)
+ {
+ serverUrl += str;
+ return *this;
+ }
+ const RestURL operator+(const std::string &str) const { return RestURL(*this) += str; }
+ RestURL &operator+=(const std::pair<std::string, std::string> &query)
+ {
+ appendQuery(query.first, query.second);
+ return *this;
+ }
+ const RestURL operator+(const std::pair<std::string, std::string> &query) const { return RestURL(*this) += query; }
+ RestURL &operator/=(const std::string &str)
+ {
+ appendUrl(str);
+ return *this;
+ }
+ const RestURL operator/(const std::string &str) const { return RestURL(*this) /= str; }
+ void appendUrl(const std::string &url)
+ {
+ if (unlikely(url.empty()))
+ return;
+ if (url[0] != '/') {
+ serverUrl += '/';
+ }
+ serverUrl += url;
+ __removeLastSlash();
+ }
+ void appendQuery(const std::string &query, const std::string &param) { queryParams.emplace(query, param); }
+ std::string toString() const
+ {
+ if (queryParams.empty()) {
+ return serverUrl;
+ }
+
+ std::string retString = serverUrl + "?";
+ for (const auto &[query, param] : queryParams) {
+ retString += query + "=" + param + "&";
+ }
+ retString.pop_back();
+
+ return retString;
+ }
+
+ std::string serverUrl;
+ std::map<std::string, std::string> queryParams;
+
+private:
+ void __removeLastSlash()
+ {
+ if (serverUrl[serverUrl.length() - 1] == '/') {
+ serverUrl.pop_back();
+ }
+ }
+};
+
+class RestInterface
+{
+public:
+ RestInterface(const std::string_view &serverAddr, const std::string_view &socketPath)
+ : serverAddr(serverAddr), socketPath(socketPath)
+ {
+ }
+ static Status check_response(const ResponseMessage &retMessage)
+ {
+ if (retMessage.isCustomResponse())
+ return STATUS_FAIL;
+ if (retMessage.isServerErrorResponse()) {
+ _D("Server has someting wrong");
+ return STATUS_RETRY;
+ }
+ if (!retMessage.isSuccessfulResponse()) {
+ Json::Value root;
+ JsonTools::parseFromString(retMessage.message, &root);
+ if (root.isObject())
+ _D("response code: %ld, data : %s", retMessage.code, root["message"].asString().c_str());
+ return STATUS_FAIL;
+ }
+
+ return STATUS_OK;
+ }
+ virtual ResponseMessage request(const RestURL &url, const std::string_view &request, const long timeout = -1) = 0;
+ virtual ResponseMessage request_get(const RestURL &url, const long timeout = -1)
+ {
+ return request(url, "GET", timeout);
+ }
+ virtual ResponseMessage request_post(const RestURL &url, const long timeout = -1)
+ {
+ return request(url, "POST", timeout);
+ }
+ virtual ResponseMessage request_post(const RestURL &url, const Json::Value &value, const long timeout = -1)
+ {
+ const std::string jsonString = JsonTools::writeToString(value);
+ return request_post(url, jsonString.c_str(), jsonString.size(), HTTP_CONTENT_TYPE_JSON);
+ }
+ virtual ResponseMessage request_post(const RestURL &url, const void *data, size_t size,
+ const std::string_view &contentType, const long timeout = -1) = 0;
+ virtual ResponseMessage request_post(const RestURL &url, std::ifstream *stream, const std::string_view &contentType,
+ const long timeout = -1) = 0;
+ virtual ResponseMessage request_post(const RestURL &url, FILE *pipe, const std::string_view &contentType,
+ const long timeout = -1) = 0;
+ virtual ResponseMessage request_delete(const RestURL &url, const long timeout = -1)
+ {
+ return request(url, "DELETE", timeout);
+ }
+
+protected:
+ const std::string serverAddr;
+ const std::string socketPath;
+};
+
+#endif /* __REST_INTERFACE_H__ */
diff --git a/src/DockerLauncher.cpp b/src/DockerLauncher.cpp
new file mode 100644
index 0000000..cdf4673
--- /dev/null
+++ b/src/DockerLauncher.cpp
@@ -0,0 +1,276 @@
+#include "DockerLauncher.h"
+#include "Volumes/VolumeManager.h"
+#include "util/JsonTools.h"
+#include "util/error.h"
+
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <unistd.h>
+
+std::filesystem::path DockerLauncher::launcherConfigPath = "/hal/etc/docker/launcher.json";
+std::filesystem::path DockerLauncher::containerListPath = "/opt/data/container/list";
+std::string DockerLauncher::cliSocketPath = "/var/run/docker_launcher.sock";
+
+DockerLauncher::DockerLauncher()
+{
+ cliServerControl = CLI_SERVER_CONTROL_NONE;
+}
+
+Status DockerLauncher::initialize()
+{
+ Json::Value configList, configLauncher;
+ if (!JsonTools::parseFromFile(launcherConfigPath, &configLauncher)) {
+ _W("could not load launcher config");
+ }
+
+ JsonTools::Transform::getJsonValue<std::filesystem::path>(containerListPath, configLauncher["ContainerList"]);
+
+ if (initControllers(configLauncher) != STATUS_OK)
+ return STATUS_FAIL;
+ if (VolumeManager::get()->initDrivers(configLauncher) != STATUS_OK)
+ return STATUS_FAIL;
+ return STATUS_OK;
+}
+
+Status DockerLauncher::initControllers(const Json::Value &config)
+{
+ try {
+ const Json::Value &controllerConfig = config.get("Controller", Json::Value());
+ ContainerController::getController(CONTAINER_TYPE_DOCKER)->init(controllerConfig);
+ }
+ catch_return(STATUS_FAIL);
+
+ return STATUS_OK;
+}
+
+Status DockerLauncher::run()
+{
+ this->runCLIDaemon();
+ containerManager->runContainerManager(containerListPath);
+ containerManager->joinThreads();
+ return STATUS_OK;
+}
+
+Status DockerLauncher::__parseCommand(const std::string &commandName, CLICommandType &cmd)
+{
+ if (!__CLICmdTable.count(commandName))
+ return STATUS_NOT_FOUND;
+
+ cmd = __CLICmdTable[commandName];
+ return STATUS_OK;
+}
+
+Status DockerLauncher::__stopContainer(Container *container)
+{
+ Status ret = STATUS_FAIL;
+ for (auto &extcfg : container->extConfigs) {
+ if (extcfg->stopPre(container) == STATUS_FAIL) {
+ _W("extConfig stop pre fail : %s", extcfg->desc.c_str());
+ }
+ }
+
+ _D("stop %s Container", container->fingerprint.name.c_str());
+ ret = ContainerController::getController(container->TYPE)->stop(container);
+
+ for (auto &extcfg : container->extConfigs) {
+ if (extcfg->stopPost(container) == STATUS_FAIL) {
+ _W("extConfig stop post fail : %s", extcfg->desc.c_str());
+ }
+ }
+
+ if (ret != STATUS_OK) {
+ _E("failed stop container\n");
+ }
+ return ret;
+}
+
+Status DockerLauncher::__purgeContainer(Container *container)
+{
+ std::shared_ptr<Image> image = container->image;
+ std::string msg = "";
+ if (ContainerController::getController(CONTAINER_TYPE_DOCKER)->isContainerRunning(container) == STATUS_OK) {
+ if (__stopContainer(container) == STATUS_FAIL)
+ return STATUS_FAIL;
+ }
+ if (ContainerController::getController(CONTAINER_TYPE_DOCKER)->isContainerExist(container) == STATUS_OK) {
+ if (ContainerController::getController(CONTAINER_TYPE_DOCKER)->destroy(container) == STATUS_FAIL)
+ return STATUS_FAIL;
+ }
+ if (ContainerController::getController(CONTAINER_TYPE_DOCKER)->isImageExist(image) == STATUS_OK) {
+ if (ContainerController::getController(CONTAINER_TYPE_DOCKER)->remove(container) == STATUS_FAIL)
+
+ return STATUS_FAIL;
+ }
+ return STATUS_OK;
+}
+
+std::string DockerLauncher::executeCLI(const std::string &commandName, const std::string &containerName)
+{
+ Status ret = STATUS_FAIL;
+ std::string msg = "";
+
+ CLICommandType cmd;
+ std::string containerList;
+ Container *container = nullptr;
+
+ ret = __parseCommand(commandName, cmd);
+ if (ret != STATUS_OK) {
+ msg = commandName + " command doesn't exists";
+ return msg;
+ }
+
+ if (cmd == CLI_CMD_IMAGE_INFO) {
+ _D("(CLI) image info");
+ msg = ContainerController::getController(CONTAINER_TYPE_DOCKER)->getImageList();
+ } else if (cmd == CLI_CMD_CONTAINER_INFO) {
+ _D("(CLI) container info");
+ msg = ContainerController::getController(CONTAINER_TYPE_DOCKER)->getContainerList();
+ } else {
+ containerManager->validName(containerName);
+ if (containerManager->findContainer(containerName, container) != STATUS_OK) {
+ msg = containerName + " container is not registered";
+ return msg;
+ }
+
+ switch (cmd) {
+ case CLI_CMD_IMAGE_BUILD:
+ _D("(CLI) image build");
+ ret = ContainerController::getController(CONTAINER_TYPE_DOCKER)->build(container);
+ break;
+ case CLI_CMD_IMAGE_LOAD:
+ _D("(CLI) image load");
+ ret = ContainerController::getController(CONTAINER_TYPE_DOCKER)->load(container);
+ break;
+ case CLI_CMD_CONTAINER_CREATE:
+ _D("(CLI) container create");
+ ret = ContainerController::getController(CONTAINER_TYPE_DOCKER)->create(container);
+ break;
+ case CLI_CMD_CONTAINER_START:
+ _D("(CLI) container start");
+ ret = ContainerController::getController(CONTAINER_TYPE_DOCKER)->start(container);
+ break;
+ case CLI_CMD_CONTAINER_STOP:
+ _D("(CLI) container stop");
+ ret = __stopContainer(container);
+ break;
+ case CLI_CMD_CONTAINER_RUNNING:
+ _D("(CLI) is container running");
+ ret = ContainerController::getController(CONTAINER_TYPE_DOCKER)->isContainerRunning(container);
+ if (ret == STATUS_OK)
+ msg = containerName + " is running";
+ else
+ msg = containerName + " is not running";
+ break;
+ case CLI_CMD_CONTAINER_PURGE:
+ _D("(CLI) container purge");
+ ret = __purgeContainer(container);
+ break;
+ case CLI_CMD_CONTAINER_UPDATE:
+ _D("(CLI) container update api is not implement");
+ ret = STATUS_NOT_IMPLEMENT;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (msg.empty()) {
+ if (ret != STATUS_OK) {
+ msg = commandName + " command failed";
+ } else {
+ msg = commandName + " command ok";
+ }
+ }
+ return msg;
+}
+
+void DockerLauncher::dockerCliServer(void *args)
+{
+ int server_socket;
+ int client_socket;
+ ssize_t read_len;
+ socklen_t client_addr_size;
+
+ struct sockaddr_un server_addr;
+ struct sockaddr_un client_addr;
+
+ char buff_rcv[BUF_SIZE];
+ std::string ret = " ";
+ Json::Value root;
+
+ if (!access(cliSocketPath.c_str(), F_OK))
+ unlink(cliSocketPath.c_str());
+
+ server_socket = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (server_socket == -1) {
+ _E("dlauncher socket error!\n");
+ return;
+ }
+
+ memset(&server_addr, 0, sizeof(server_addr));
+ server_addr.sun_family = AF_UNIX;
+ strncpy(server_addr.sun_path, cliSocketPath.c_str(), cliSocketPath.size());
+
+ if (bind(server_socket, (struct sockaddr *)&server_addr, sizeof(server_addr)) == -1) {
+ _E("dlauncher socket bind error!\n");
+ close(server_socket);
+ return;
+ }
+
+ do {
+ if (listen(server_socket, 5) == -1) {
+ _E("client listen error! \n");
+ break;
+ }
+
+ client_addr_size = sizeof(client_addr);
+ client_socket = accept(server_socket, (struct sockaddr *)&client_addr, &client_addr_size);
+ if (client_socket == -1) {
+ _E("accept failed!\n");
+ break;
+ }
+
+ read_len = read(client_socket, buff_rcv, BUF_SIZE - 1);
+ if (read_len <= 0) {
+ _E("Client msg read error");
+ close(client_socket);
+ continue;
+ }
+ buff_rcv[(unsigned int)read_len] = '\0';
+ std::string cmd(buff_rcv);
+ JsonTools::parseFromString(cmd, &root);
+ ret = executeCLI(root["func"].asCString(), root["param"].asCString());
+
+ if (write(client_socket, ret.c_str(), ret.length() + 1) <= 0) {
+ _E("Ack msg write error");
+ close(client_socket);
+ break;
+ }
+
+ close(client_socket);
+ } while (cliServerControl == CLI_SERVER_CONTROL_RUN);
+ close(server_socket);
+}
+
+Status DockerLauncher::runCLIDaemon()
+{
+ cliServerControl = CLI_SERVER_CONTROL_RUN;
+ dockerLaucherCliThread = std::make_unique<std::thread>(&DockerLauncher::dockerCliServer, this, nullptr);
+ return STATUS_OK;
+}
+
+Status DockerLauncher::stopCLIDaemon()
+{
+ cliServerControl = CLI_SERVER_CONTROL_STOP;
+ return STATUS_OK;
+}
+
+Status DockerLauncher::finalize()
+{
+ containerManager->destroyContainers();
+ containerManager->joinThreads();
+ containerManager->stopAdaptorWatch();
+ stopCLIDaemon();
+ return STATUS_OK;
+}
diff --git a/src/DockerLauncher.h b/src/DockerLauncher.h
new file mode 100644
index 0000000..91ab8fe
--- /dev/null
+++ b/src/DockerLauncher.h
@@ -0,0 +1,50 @@
+#ifndef __DOCKER_LAUNCHER_H__
+#define __DOCKER_LAUNCHER_H__
+
+#include "ContainerManager.h"
+#include "json/json.h"
+
+#define BUF_SIZE 4096
+
+class DockerLauncher
+{
+public:
+ DockerLauncher();
+ ~DockerLauncher() {}
+
+ Status initialize();
+ Status initControllers(const Json::Value &config);
+ Status run();
+ std::string executeCLI(const std::string &cmd, const std::string &name);
+ void dockerCliServer(void *args);
+ Status runCLIDaemon();
+ Status stopCLIDaemon();
+ Status finalize();
+
+public:
+ CLIServerControl cliServerControl;
+ static std::filesystem::path launcherConfigPath;
+ static std::filesystem::path containerListPath;
+ static std::string cliSocketPath;
+ std::unique_ptr<std::thread> dockerLaucherCliThread;
+ std::unique_ptr<ContainerManager> containerManager = std::make_unique<ContainerManager>();
+
+private:
+ Status __parseCommand(const std::string &commandName, CLICommandType &cmd);
+ Status __stopContainer(Container *container);
+ Status __purgeContainer(Container *container);
+ std::map<std::string, CLICommandType> __CLICmdTable = {
+ {"image_info", CLI_CMD_IMAGE_INFO},
+ {"container_info", CLI_CMD_CONTAINER_INFO},
+ {"build", CLI_CMD_IMAGE_BUILD},
+ {"load", CLI_CMD_IMAGE_LOAD},
+ {"create", CLI_CMD_CONTAINER_CREATE},
+ {"start", CLI_CMD_CONTAINER_START},
+ {"stop", CLI_CMD_CONTAINER_STOP},
+ {"purge", CLI_CMD_CONTAINER_PURGE},
+ {"is_running", CLI_CMD_CONTAINER_RUNNING},
+ {"update", CLI_CMD_CONTAINER_UPDATE},
+ };
+};
+
+#endif /* __DOCKER_LAUNCHER_H__ */
diff --git a/src/Extension/CrashForward.cpp b/src/Extension/CrashForward.cpp
new file mode 100644
index 0000000..45f866b
--- /dev/null
+++ b/src/Extension/CrashForward.cpp
@@ -0,0 +1,156 @@
+#include "Container.h"
+
+#include "Extension.h"
+#include "Extension/CrashForward.h"
+
+#include "util/util.h"
+#include "util/system.h"
+#include "util/JsonTools.h"
+#include "util/log.h"
+#include "util/error.h"
+
+using namespace Extension;
+#define OPT_NAME "crash_forward"
+
+static const std::filesystem::path core_pattern_configs = "/run/container/.core_patterns";
+
+CrashForward::CrashForward()
+{
+ desc = "CrashForward";
+}
+
+static bool __patternIsExecutable(std::string &cmd)
+{
+ if (cmd[0] != '|') {
+ return false;
+ }
+
+ cmd.erase(0, 1);
+ return true;
+}
+
+Status CrashForward::setConfig(const Json::Value &config)
+{
+ if (unlikely(config.empty())) {
+ return STATUS_IGNORE;
+ }
+
+ if (!config.isMember(OPT_NAME)) {
+ return STATUS_IGNORE;
+ }
+
+ const Json::Value &item = config[OPT_NAME];
+
+ switch (item.type()) {
+ case Json::ValueType::stringValue: {
+ const std::string &str = item.asString();
+ std::tie(cmd, args) = util::string::split(str, ' ');
+ break;
+ }
+ case Json::ValueType::arrayValue: {
+ cmd = item[0].asString();
+ args = item[1].asString();
+ break;
+ }
+ case Json::ValueType::objectValue: {
+ cmd = item["cmd"].asString();
+ args = item["args"].asString();
+ break;
+ }
+ default:
+ _E("invalid args");
+ break;
+ }
+
+ exec = __patternIsExecutable(cmd);
+
+ return STATUS_OK;
+}
+
+CrashForward::Manager &CrashForward::Manager::get()
+{
+ static CrashForward::Manager manager;
+ return manager;
+}
+
+Status CrashForward::Manager::prepare()
+{
+ if (std::error_code error; !std::filesystem::create_directories(core_pattern_configs.parent_path(), error)) {
+ _D("%s", error.message().c_str());
+ }
+
+ return STATUS_OK;
+}
+
+Status CrashForward::Manager::cleanup()
+{
+ std::filesystem::remove(core_pattern_configs);
+ return STATUS_OK;
+}
+
+Status CrashForward::Manager::writeToConfig(const std::string &path)
+{
+ Json::Value root;
+
+ for (const auto &[cid, pattern] : activated) {
+ root[cid].append(pattern->cmd);
+ root[cid].append(pattern->args);
+ root[cid].append(pattern->exec);
+ }
+
+ Json::StreamWriterBuilder builder;
+ builder["commentStyle"] = "None";
+ builder["indentation"] = " ";
+
+ /* TODO : Execption control */
+ std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
+ std::ofstream jsonFile(path);
+ writer->write(root, &jsonFile);
+
+ return STATUS_OK;
+}
+
+Status CrashForward::Manager::registry(const std::string &cid, const CrashForward *crash_forward)
+{
+ std::lock_guard<std::mutex> lk(lock);
+ if (activated.empty()) {
+ prepare();
+ }
+
+ if (unlikely(activated.count(cid) != 0)) {
+ _W("%s container is already set crash forwarding. ignoring", cid.c_str());
+ return STATUS_IGNORE;
+ }
+
+ activated.emplace(cid, crash_forward);
+ writeToConfig(core_pattern_configs);
+
+ _D("%s crash wrapper registered", cid.c_str());
+
+ return STATUS_OK;
+}
+
+Status CrashForward::Manager::unregistry(const std::string &cid)
+{
+ std::lock_guard<std::mutex> lk(lock);
+ activated.erase(cid);
+ writeToConfig(core_pattern_configs);
+
+ _D("%s crash wrapper unregistered", cid.c_str());
+
+ if (activated.empty()) {
+ cleanup();
+ }
+
+ return STATUS_OK;
+}
+
+Status CrashForward::startPost(Container *const container)
+{
+ return Manager::get().registry(container->fingerprint.getFullID(), this);
+}
+
+Status CrashForward::stopPost(Container *const container)
+{
+ return Manager::get().unregistry(container->fingerprint.getFullID());
+}
diff --git a/src/Extension/CrashForward.h b/src/Extension/CrashForward.h
new file mode 100644
index 0000000..1c5e39b
--- /dev/null
+++ b/src/Extension/CrashForward.h
@@ -0,0 +1,50 @@
+#ifndef __EXTENSION_CRASHFORWARD_H__
+#define __EXTENSION_CRASHFORWARD_H__
+
+#include "Extension/Extension.h"
+#include "Config/Config.h"
+#include <string>
+#include <filesystem>
+#include <map>
+#include <mutex>
+
+#include "internal_types.h"
+
+namespace Extension
+{
+ class CrashForward : public Interface
+ {
+ class Manager
+ {
+ public:
+ static Manager &get();
+ Status prepare();
+ Status cleanup();
+ Status writeToConfig(const std::string &path);
+
+ Status registry(const std::string &cid, const CrashForward *core_pattern);
+ Status unregistry(const std::string &cid);
+
+ private:
+ std::map<std::string, const CrashForward *> activated;
+ std::mutex lock;
+ };
+
+ public:
+ CrashForward();
+ ~CrashForward() = default;
+
+ virtual Status setConfig(const Json::Value &config) override;
+ virtual Status startPost(Container *const container) override;
+ virtual Status stopPost(Container *const container) override;
+
+ std::string cmd;
+ std::string args;
+ bool exec = false;
+
+ private:
+ Status __getConfig(const Json::Value &value);
+ };
+}; // namespace Extension
+
+#endif /* __EXTENSION_CRASHFORWARD_H__ */
diff --git a/src/Extension/Extension.cpp b/src/Extension/Extension.cpp
new file mode 100644
index 0000000..fd0bc89
--- /dev/null
+++ b/src/Extension/Extension.cpp
@@ -0,0 +1,42 @@
+#include "Extension.h"
+
+#include "Extension/Presets.h"
+#include "Extension/CrashForward.h"
+#include "Volumes/Volumes.h"
+#include "Extension/Tizen.h"
+
+#include <memory>
+
+#include "Config/Config.h"
+
+using namespace Extension;
+
+template <typename T> static inline Status emplaceConfig(ExtensionSet &exts, const Json::Value &config)
+{
+ std::shared_ptr<Interface> cfg = std::make_shared<T>();
+ if (Status ret = cfg->setConfig(config); ret != STATUS_OK) {
+ return ret;
+ }
+ exts.push_back(cfg);
+ return STATUS_OK;
+}
+
+Status Helper::readConfigs(ExtensionSet &exts, const Json::Value &value,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig)
+{
+ const char *optname = "ExtConfigs";
+
+ if (value.empty()) {
+ return STATUS_IGNORE;
+ }
+
+ const Json::Value &config = value[optname];
+
+ /* It will be called in the order in which it is registered */
+ emplaceConfig<CrashForward>(exts, config);
+ emplaceConfig<Volumes>(exts, config);
+ emplaceConfig<Tizen>(exts, config);
+ emplaceConfig<Presets>(exts, config);
+
+ return STATUS_OK;
+}
diff --git a/src/Extension/Extension.h b/src/Extension/Extension.h
new file mode 100644
index 0000000..868cccd
--- /dev/null
+++ b/src/Extension/Extension.h
@@ -0,0 +1,58 @@
+#ifndef __EXTENSION_INTERFACE_H__
+#define __EXTENSION_INTERFACE_H__
+
+#include <string>
+#include <memory>
+#include <vector>
+#include <json/json.h>
+
+#include "internal_types.h"
+#include "Config/Config.h"
+
+class Container;
+
+namespace Extension
+{
+
+ class Interface
+ {
+ public:
+ virtual ~Interface() = default;
+
+ virtual Status setConfig(const Json::Value &config) = 0;
+ virtual Json::Value generateCreateOptions() { return Json::Value(); }
+
+ virtual Status buildPre(Container *const container) { return STATUS_IGNORE; }
+
+ virtual Status buildPost(Container *const container) { return STATUS_IGNORE; }
+
+ virtual Status createPre(Container *const container) { return STATUS_IGNORE; }
+
+ virtual Status createPost(Container *const container) { return STATUS_IGNORE; }
+
+ virtual Status startPre(Container *const container) { return STATUS_IGNORE; }
+
+ virtual Status startPost(Container *const container) { return STATUS_IGNORE; }
+
+ virtual Status stopPre(Container *const container) { return STATUS_IGNORE; }
+
+ virtual Status stopPost(Container *const container) { return STATUS_IGNORE; }
+
+ protected:
+ Interface() = default;
+
+ public:
+ std::string desc;
+ };
+
+ typedef std::vector<std::shared_ptr<Interface>> ExtensionSet;
+
+ class Helper
+ {
+ public:
+ static Status readConfigs(ExtensionSet &exts, const Json::Value &config,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig);
+ };
+}; // namespace Extension
+
+#endif /* __EXTENSION_INTERFACE_H__ */
diff --git a/src/Extension/Presets.cpp b/src/Extension/Presets.cpp
new file mode 100644
index 0000000..e3f08e4
--- /dev/null
+++ b/src/Extension/Presets.cpp
@@ -0,0 +1,284 @@
+#include "Container.h"
+#include "Config/Config.h"
+#include "Extension/Extension.h"
+#include "Extension/Presets.h"
+
+#include <regex>
+
+#include "util/util.h"
+#include "util/JsonTools.h"
+#include "util/log.h"
+#include "util/error.h"
+
+using namespace Extension;
+
+Presets::Presets()
+{
+ desc = "presets";
+}
+
+Status Presets::setConfig(const Json::Value &config)
+{
+ /* cleanup configs */
+ inittype = INIT_DEFAULT;
+ forward.ttys = false;
+ forward.input = FWD_NONE;
+ forward.usb = FWD_NONE;
+ forward.audio = FWD_NONE;
+ forward.dbus = FWD_NONE;
+ forward.storage.clear();
+
+ if (config.isMember("ttys")) {
+ forward.ttys = config["ttys"].isBool() ? config["ttys"].asBool() : false;
+ }
+
+ if (config.isMember("input")) {
+ forward.input = __getForwardType(config["input"].asString(), forward.input);
+ }
+
+ if (config.isMember("usb")) {
+ forward.usb = __getForwardType(config["usb"].asString(), forward.usb);
+ }
+
+ if (config.isMember("audio")) {
+ forward.audio = __getForwardType(config["audio"].asString(), forward.audio);
+ }
+
+ if (config.isMember("dbus")) {
+ forward.dbus = __getForwardType(config["dbus"].asString(), forward.dbus);
+ }
+
+ if (config.isMember("init")) {
+ std::string init = config["init"].asString();
+ if (init == "ramdisk") {
+ if (config.isMember("ramdisk")) {
+ inittype = INIT_RAMDISK;
+ ramdisk.fwd_path = config["ramdisk"].get("fwd_path", "/host").asString();
+ }
+ } else if (init == "rootfs") {
+ inittype = INIT_ROOTFS;
+ }
+ }
+
+ if (config.isMember("storage")) {
+ for (const auto &disk : config["storage"].getMemberNames()) {
+ forward.storage.emplace(disk, __getForwardType(config["storage"][disk].asString()));
+ }
+ }
+
+ return STATUS_OK;
+}
+
+void Presets::__appendBindTargetPrefixPath(Config::Bind &bind, const std::filesystem::path &prefix)
+{
+ const auto first_dir = ++bind.target.begin();
+ if (*first_dir == "dev" || *first_dir == "sys" || *first_dir == "proc") {
+ return;
+ }
+
+ bind.target = util::file::pathjoin(prefix, bind.target);
+}
+
+Config::DeviceCgroupRule Presets::__genDeviceCgroupRule(const std::string &str, CgroupPermissionType perm)
+{
+ /* TODO : currently, this method is hardcoded. need to get device number from /proc/devices */
+ Config::DeviceCgroupRule rule;
+
+ if (str == "tty" || str == "ttyS") {
+ rule.type = DEV_CHAR;
+ rule.major = 4;
+ rule.minor = -1;
+ } else if (str == "/dev/tty" || str == "/dev/console" || str == "/dev/ptmx") {
+ rule.type = DEV_CHAR;
+ rule.major = 5;
+ rule.minor = -1;
+ } else if (str == "vcs") {
+ rule.type = DEV_CHAR;
+ rule.major = 7;
+ rule.minor = -1;
+ } else if (str == "input") {
+ rule.type = DEV_CHAR;
+ rule.major = 13;
+ rule.minor = -1;
+ } else if (str == "usb_device") {
+ rule.type = DEV_CHAR;
+ rule.major = 189;
+ rule.minor = -1;
+ }
+
+ rule.permission = perm;
+
+ return rule;
+}
+
+Status Presets::__genenv_ttys(Config::ContainerConfigs *config)
+{
+ if (!forward.ttys) {
+ return STATUS_IGNORE;
+ }
+
+ for (unsigned int i = ttys.start; i <= ttys.end; i++) {
+ config->devices.push_back(Config::Device("/dev/tty" + std::to_string(i)));
+ }
+
+ for (unsigned int i = vcs.start; i <= vcs.end; i++) {
+ config->devices.push_back(Config::Device((i == 0) ? "/dev/vcs" : "/dev/vcs" + std::to_string(i)));
+ config->devices.push_back(Config::Device((i == 0) ? "/dev/vcsa" : "/dev/vcsa" + std::to_string(i)));
+ }
+
+ /* systemd needs all minor permision */
+ config->deviceCgroupRules.push_back(__genDeviceCgroupRule("tty", _RW));
+ config->deviceCgroupRules.push_back(__genDeviceCgroupRule("/dev/tty", _RW));
+ config->deviceCgroupRules.push_back(__genDeviceCgroupRule("vcs", _RW));
+
+ return STATUS_OK;
+}
+
+Status Presets::__genenv_input(Config::ContainerConfigs *config)
+{
+ switch (forward.input) {
+ case FWD_HOST:
+ config->binds.push_back(Config::Bind("/dev/input"));
+ config->deviceCgroupRules.push_back(__genDeviceCgroupRule("input", _RW));
+ break;
+ default:
+ break;
+ }
+
+ return STATUS_OK;
+}
+
+Status Presets::__genenv_usb(Config::ContainerConfigs *config)
+{
+ switch (forward.usb) {
+ case FWD_HOST:
+ config->binds.push_back(Config::Bind("/dev/bus/usb"));
+ config->binds.push_back(Config::Bind("/dev/usb-funcs"));
+ config->deviceCgroupRules.push_back(__genDeviceCgroupRule("usb_device", _RWM));
+ break;
+ default:
+ break;
+ }
+
+ return STATUS_OK;
+}
+
+Status Presets::__genenv_audio(Config::ContainerConfigs *config)
+{
+ switch (forward.audio) {
+ case FWD_HOST:
+ config->devices.push_back(Config::Device("/dev/snd"));
+ break;
+ default:
+ break;
+ }
+
+ return STATUS_OK;
+}
+
+Status Presets::__genenv_dbus(Config::ContainerConfigs *config)
+{
+ const std::string system_bus_socket = "/run/dbus/system_bus_socket";
+
+ switch (forward.dbus) {
+ case FWD_HOST:
+ config->binds.push_back(Config::Bind(system_bus_socket));
+ break;
+ case FWD_MIXED:
+ config->binds.push_back(Config::Bind(system_bus_socket, "/run/host/dbus/system_bus_socket", false));
+ break;
+ default:
+ break;
+ }
+
+ return STATUS_OK;
+}
+
+Status Presets::__genenv_storage_from_usb(Config::ContainerConfigs *config)
+{
+ /*
+ * TODO :
+ * to find storage from the usb bus, use the tizen API
+ * Currently, we find /dev/disk directly for quick implementation
+ */
+ for (auto const &disk_id : std::filesystem::directory_iterator("/dev/disk/by-id")) {
+ if (disk_id.path().filename().string().find("usb", 0) != 0) {
+ continue;
+ }
+ if (!disk_id.is_symlink()) {
+ continue;
+ }
+ std::filesystem::path devpath = "/dev/disk/by-id" / std::filesystem::read_symlink(disk_id);
+ config->devices.push_back(Config::Device(devpath.lexically_normal()));
+ }
+
+ return STATUS_OK;
+}
+
+Status Presets::__genenv_storage_from_dev(const std::string &device, Config::ContainerConfigs *config)
+{
+ std::regex re_partition("(sd.*[1-9])|(mmcblk[0-9]p[0-9].*)");
+ std::regex re_disk("(sd(\\D))|mmcblk[0-9]");
+ std::smatch match;
+
+ if (std::regex_match(device, re_partition)) {
+ config->devices.push_back(Config::Device("/dev/" + device));
+ } else if (std::regex_match(device, match, re_disk)) {
+ for (auto const &devnode : std::filesystem::directory_iterator("/dev")) {
+ if (!devnode.is_block_file()) {
+ continue;
+ }
+ if (devnode.path().filename().string().find(match.str()) == std::string::npos) {
+ continue;
+ }
+ config->devices.push_back(Config::Device("/dev/" + device));
+ }
+ } else {
+ _E("%s storage is invalid disk type", device.c_str());
+ return STATUS_FAIL;
+ }
+
+ return STATUS_OK;
+}
+
+Status Presets::__genenv_storage(Config::ContainerConfigs *config)
+{
+ for (const auto &disk : forward.storage) {
+ switch (disk.second) {
+ case FWD_HOST:
+ if (disk.first == "usb") {
+ __genenv_storage_from_usb(config);
+ } else {
+ __genenv_storage_from_dev(disk.first, config);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+Status Presets::__generateCreateOptions(Config::ContainerConfigs *config)
+{
+ __genenv_ttys(config);
+ __genenv_input(config);
+ __genenv_usb(config);
+ __genenv_audio(config);
+ __genenv_dbus(config);
+ __genenv_storage(config);
+
+ if (inittype == INIT_RAMDISK && !ramdisk.fwd_path.empty()) {
+ for (auto &bind : config->binds) {
+ __appendBindTargetPrefixPath(bind, ramdisk.fwd_path);
+ }
+ }
+
+ return STATUS_OK;
+}
+
+Status Presets::createPre(Container *const container)
+{
+ return __generateCreateOptions(container->containerConfig.get());
+}
diff --git a/src/Extension/Presets.h b/src/Extension/Presets.h
new file mode 100644
index 0000000..700bf86
--- /dev/null
+++ b/src/Extension/Presets.h
@@ -0,0 +1,92 @@
+#ifndef __EXTENSION_PRESETS_H__
+#define __EXTENSION_PRESETS_H__
+
+#include "Extension.h"
+#include "Config/Config.h"
+
+#include <vector>
+#include <map>
+#include <string>
+#include <filesystem>
+
+namespace Extension
+{
+ class Presets : public Interface
+ {
+ typedef enum InitType {
+ INIT_DEFAULT,
+ INIT_ROOTFS,
+ INIT_RAMDISK,
+ INIT_OTHER,
+ } InitType;
+ typedef enum ForwardType {
+ FWD_NONE,
+ FWD_HOST,
+ FWD_PRIVATE,
+ FWD_MIXED,
+ } ForwardType;
+
+ public:
+ Presets();
+ ~Presets() = default;
+
+ virtual Status setConfig(const Json::Value &config) override;
+ virtual Status createPre(Container *const container) override;
+
+ private:
+ Status __generateCreateOptions(Config::ContainerConfigs *config);
+
+ static inline ForwardType __getForwardType(const std::string &str, ForwardType def = FWD_NONE)
+ {
+ if (str == "host") {
+ return FWD_HOST;
+ }
+ if (str == "private") {
+ return FWD_PRIVATE;
+ }
+ if (str == "mixed") {
+ return FWD_MIXED;
+ }
+ return def;
+ }
+
+ void __appendBindTargetPrefixPath(Config::Bind &bind, const std::filesystem::path &prefix);
+
+ Config::DeviceCgroupRule __genDeviceCgroupRule(const std::string &str, CgroupPermissionType perm);
+ Status __genenv_ttys(Config::ContainerConfigs *config);
+ Status __genenv_input(Config::ContainerConfigs *config);
+ Status __genenv_usb(Config::ContainerConfigs *config);
+ Status __genenv_audio(Config::ContainerConfigs *config);
+ Status __genenv_dbus(Config::ContainerConfigs *config);
+ Status __genenv_storage(Config::ContainerConfigs *config);
+ static Status __genenv_storage_from_usb(Config::ContainerConfigs *config);
+ static Status __genenv_storage_from_dev(const std::string &device, Config::ContainerConfigs *config);
+
+ public:
+ InitType inittype = INIT_DEFAULT;
+ struct {
+ std::filesystem::path fwd_path;
+ } ramdisk;
+
+ struct {
+ bool ttys = false;
+ ForwardType input = FWD_NONE;
+ ForwardType usb = FWD_NONE;
+ ForwardType audio = FWD_NONE;
+ ForwardType dbus = FWD_NONE;
+ std::map<std::string, ForwardType> storage;
+ } forward;
+
+ struct {
+ unsigned int start = 0;
+ unsigned int end = 6;
+ } ttys;
+ struct {
+ unsigned int start = 0;
+ unsigned int end = 6;
+ } vcs;
+ };
+
+}; // namespace Extension
+
+#endif /* __EXTENSION_PRESETS_H__ */
diff --git a/src/Extension/Tizen.cpp b/src/Extension/Tizen.cpp
new file mode 100644
index 0000000..5f37a38
--- /dev/null
+++ b/src/Extension/Tizen.cpp
@@ -0,0 +1,105 @@
+#include <iostream>
+#include <fstream>
+#include <signal.h>
+
+#include "Container.h"
+
+#include "Extension.h"
+#include "Extension/Tizen.h"
+
+#include "util/system.h"
+#include "util/JsonTools.h"
+#include "util/log.h"
+#include "util/error.h"
+
+using namespace Extension;
+#define OPT_NAME "tizen"
+
+static std::vector<std::string> defaultCapabilities = {
+ "AUDIT_CONTROL", "AUDIT_READ", "CHOWN", "DAC_OVERRIDE", "DAC_READ_SEARCH", "FOWNER", "FSETID",
+ "IPC_LOCK", "KILL", "LEASE", "LINUX_IMMUTABLE", "MAC_ADMIN", "MAC_OVERRIDE", "NET_ADMIN",
+ "NET_BIND_SERVICE", "NET_BROADCAST", "NET_RAW", "SETGID", "SETUID", "SYSLOG", "SYS_ADMIN",
+ "SYS_CHROOT", "SYS_MODULE", "SYS_NICE", "SYS_PTRACE", "SYS_RAWIO", "SYS_RESOURCE", "SYS_TIME",
+ "SYS_TTY_CONFIG"};
+
+Tizen::Tizen()
+{
+ desc = "tizen";
+}
+
+Status Tizen::setConfig(const Json::Value &config)
+{
+ if (unlikely(config.empty())) {
+ return STATUS_IGNORE;
+ }
+
+ if (!config.isMember(OPT_NAME)) {
+ return STATUS_IGNORE;
+ }
+
+ Json::Value items = config[OPT_NAME];
+ if (!items.isObject()) {
+ _D("Extension: using default config");
+ return STATUS_OK;
+ }
+
+ if (items.isMember("logger")) {
+ __loggerConfig = LoggerConfig(items["logger"]);
+ }
+
+ return STATUS_OK;
+}
+
+Tizen::LoggerConfig::LoggerConfig(const Json::Value &opt) : use_host(true)
+{
+ if (opt.isBool()) {
+ use_host = opt.asBool();
+ return;
+ }
+
+ if (opt.isString()) {
+ if (opt.asString() == "host") {
+ use_host = true;
+ } else {
+ use_host = false;
+ }
+
+ return;
+ }
+
+ /* TODO : other types */
+}
+
+Status Tizen::__generateCreateOptions(Config::ContainerConfigs *config)
+{
+ // need for logger
+ config->devices.push_back(Config::Device("/dev/kmsg"));
+ if (__loggerConfig.use_host) {
+ config->devices.push_back(Config::Device("/dev/log_main"));
+ config->devices.push_back(Config::Device("/dev/log_events"));
+ config->devices.push_back(Config::Device("/dev/log_radio"));
+ config->devices.push_back(Config::Device("/dev/log_system"));
+ }
+
+ // TODO: get needs capabilities from system image service files
+ for (const auto &cap : defaultCapabilities) {
+ config->capAdd.insert(cap);
+ }
+
+ // need for systemd
+ config->deviceCgroupRules.push_back(Config::DeviceCgroupRule(DEV_CHAR, 0, 0));
+ config->deviceCgroupRules.push_back(Config::DeviceCgroupRule(DEV_BLOCK, 0, 0));
+ config->deviceCgroupRules.push_back(Config::DeviceCgroupRule(DEV_BLOCK, -1, -1, _R));
+ config->stopsignal = "SIGRTMIN+4"; // systemd recognizes it as poweroff
+
+ // need for init.container
+ config->environment.push_back("TCON_UDEV=true");
+ config->environment.push_back("TCON_SYSTEMD_CGROUP=legacy");
+
+ return STATUS_OK;
+}
+
+Status Tizen::createPre(Container *const container)
+{
+ return __generateCreateOptions(container->containerConfig.get());
+}
diff --git a/src/Extension/Tizen.h b/src/Extension/Tizen.h
new file mode 100644
index 0000000..a2c92ea
--- /dev/null
+++ b/src/Extension/Tizen.h
@@ -0,0 +1,38 @@
+#ifndef __EXTENSION_TIZEN_H__
+#define __EXTENSION_TIZEN_H__
+
+#include "Extension/Extension.h"
+#include "Config/Config.h"
+#include <vector>
+#include <string>
+#include <set>
+#include <mutex>
+
+namespace Extension
+{
+ class Tizen : public Interface
+ {
+
+ public:
+ Tizen();
+ ~Tizen() = default;
+
+ virtual Status setConfig(const Json::Value &config) override;
+ virtual Status createPre(Container *const container) override;
+
+ private:
+ Status __generateCreateOptions(Config::ContainerConfigs *config);
+
+ private:
+ struct LoggerConfig {
+ LoggerConfig() = default;
+ LoggerConfig(const Json::Value &opt);
+
+ bool use_host = true;
+ };
+
+ LoggerConfig __loggerConfig;
+ };
+}; // namespace Extension
+
+#endif /* __EXTENSION_TIZEN_H__ */
diff --git a/src/Volumes/BlockDevice.cpp b/src/Volumes/BlockDevice.cpp
new file mode 100644
index 0000000..ff8b6ed
--- /dev/null
+++ b/src/Volumes/BlockDevice.cpp
@@ -0,0 +1,121 @@
+#include <vector>
+#include <string>
+#include <mutex>
+
+#include "Volume.h"
+#include "Volumes/BlockDevice.h"
+
+#include "util/util.h"
+#include "util/system.h"
+#include "util/JsonTools.h"
+#include "util/error.h"
+#include "util/log.h"
+
+BlkdevVolume::BlkdevVolume(const std::string &drvname) : Volume(drvname)
+{
+ __control = VOLUME_CONTROL_DEVICE;
+}
+
+BlkdevDriver::BlkdevDriver(const std::string &drvname, const Json::Value &config) : VolumeDriver(drvname)
+{
+}
+
+Status BlkdevVolume::setConfigs(const Json::Value &value)
+{
+ if (value.size() <= 0) {
+ _E("Blkdev Volume requires driver opts");
+ return STATUS_NOT_FOUND;
+ }
+
+ Json::Value::Members opts = value.getMemberNames();
+ for (const auto &opt : opts) {
+ if (opt == "hostMountPoint") {
+ hostMountPoint = value[opt].asString();
+ continue;
+ }
+ _W("(%s = %s) is invalid BlkDev option", opt.c_str(), JsonTools::writeToString(value[opt]).c_str());
+ }
+
+ return STATUS_OK;
+}
+
+std::shared_ptr<Volume> BlkdevDriver::createVolume(const Json::Value &value,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig)
+{
+ std::shared_ptr<BlkdevVolume> volume = std::make_shared<BlkdevVolume>(drvname);
+ volume->setSharedConfig(sharedConfig);
+ Status ret = volume->setConfigs(value);
+ return ret == STATUS_OK ? volume : nullptr;
+}
+
+std::string BlkdevDriver::__get_mount_source(const std::filesystem::path &mntptr)
+{
+ // TODO: It is currently used as a shell command, but it should be changed to cpp code.
+
+ std::vector<std::string> args = {"--noheadings", "--output", "SOURCE", "--mountpoint", mntptr.c_str()};
+ std::string result;
+ util::system::subprocess("/usr/bin/findmnt", args).execute(result);
+
+ return util::string::trim(result);
+}
+
+Status BlkdevDriver::prepare(std::shared_ptr<Volume> &vol)
+{
+ if (typeid(*vol) != typeid(BlkdevVolume)) {
+ return STATUS_FAIL;
+ }
+
+ if (vol->prepared()) {
+ return STATUS_OK;
+ }
+
+ std::lock_guard<std::mutex> lock(vol->mutex);
+ std::shared_ptr<BlkdevVolume> blkdev = std::static_pointer_cast<BlkdevVolume>(vol);
+
+ if (!blkdev->hostMountPoint.empty()) {
+ std::string src = __get_mount_source(blkdev->hostMountPoint);
+ if (!src.empty() || !(src == "")) {
+ blkdev->source = src;
+ }
+ }
+ blkdev->target = blkdev->source;
+
+ blkdev->__control = VOLUME_CONTROL_DEVICE;
+ blkdev->__prepared = true;
+
+ return STATUS_OK;
+}
+
+Status BlkdevDriver::setup(std::shared_ptr<Volume> &vol)
+{
+ if (typeid(*vol) != typeid(BlkdevVolume)) {
+ return STATUS_FAIL;
+ }
+
+ if (vol->avail()) {
+ return STATUS_OK;
+ }
+
+ prepare(vol);
+
+ std::lock_guard<std::mutex> lock(vol->mutex);
+ std::shared_ptr<BlkdevVolume> blkdev = std::static_pointer_cast<BlkdevVolume>(vol);
+ blkdev->__available = true;
+
+ return STATUS_OK;
+}
+
+Status BlkdevDriver::cleanup(std::shared_ptr<Volume> &vol)
+{
+ if (typeid(*vol) != typeid(BlkdevVolume)) {
+ return STATUS_FAIL;
+ }
+
+ std::lock_guard<std::mutex> lock(vol->mutex);
+ std::shared_ptr<BlkdevVolume> blkdev = std::static_pointer_cast<BlkdevVolume>(vol);
+
+ // nothing
+
+ blkdev->__available = false;
+ return STATUS_OK;
+}
diff --git a/src/Volumes/BlockDevice.h b/src/Volumes/BlockDevice.h
new file mode 100644
index 0000000..193969b
--- /dev/null
+++ b/src/Volumes/BlockDevice.h
@@ -0,0 +1,46 @@
+#ifndef __BLOCK_DEVICE_H__
+#define __BLOCK_DEVICE_H__
+
+#include <string>
+#include <filesystem>
+
+#include "internal_types.h"
+#include "Volume.h"
+#include "VolumeDriver.h"
+
+#define BLKDEV_DRVNAME "blkdev"
+
+class BlkdevDriver : public VolumeDriver
+{
+ friend class BlkdevDriverTest;
+
+public:
+ BlkdevDriver(const std::string &drvname, const Json::Value &config);
+ ~BlkdevDriver() = default;
+
+ virtual std::shared_ptr<Volume> createVolume(const Json::Value &value,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig) override;
+ virtual Status prepare(std::shared_ptr<Volume> &vol) override;
+ virtual Status setup(std::shared_ptr<Volume> &vol) override;
+ virtual Status cleanup(std::shared_ptr<Volume> &vol) override;
+
+private:
+ std::string __get_mount_source(const std::filesystem::path &mntptr);
+};
+
+class BlkdevVolume : public Volume
+{
+ friend class BlkdevDriver;
+ friend class BlkdevDriverTest;
+
+public:
+ BlkdevVolume(const std::string &drvname = BLKDEV_DRVNAME);
+ ~BlkdevVolume() = default;
+
+ virtual Status setConfigs(const Json::Value &value) override;
+
+private:
+ std::filesystem::path hostMountPoint;
+};
+
+#endif /*__BLOCK_DEVICE_H__ */
diff --git a/src/Volumes/LoopDevice.cpp b/src/Volumes/LoopDevice.cpp
new file mode 100644
index 0000000..633618f
--- /dev/null
+++ b/src/Volumes/LoopDevice.cpp
@@ -0,0 +1,361 @@
+#include <vector>
+#include <string>
+#include <mutex>
+#include <memory>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <json/json.h>
+
+#include "Volume.h"
+#include "Volumes/LoopDevice.h"
+
+#include "util/util.h"
+#include "util/system.h"
+#include "util/blkid.h"
+#include "util/JsonTools.h"
+#include "util/error.h"
+#include "util/log.h"
+
+#ifdef TIZEN
+#define CMD_E2LABEL "/usr/sbin/e2label"
+#define CMD_BTRFS "/usr/sbin/btrfs"
+#define CMD_F2FSLABEL "/usr/sbin/f2fslabel"
+#define CMD_LOSETUP "/usr/sbin/losetup_ori"
+#else
+#define CMD_E2LABEL "/bin/e2label"
+#define CMD_BTRFS "/bin/btrfs"
+#define CMD_F2FSLABEL "/bin/f2fslabel"
+#define CMD_LOSETUP "/bin/losetup"
+#endif
+
+LoopdevVolume::LoopdevVolume(const std::string &drvname) : Volume(drvname)
+{
+ __control = VOLUME_CONTROL_DEVICE;
+}
+
+Status LoopdevVolume::setConfigs(const Json::Value &value)
+{
+ if (value.size() <= 0) {
+ _E("Loopdev Volume requires driver opts");
+ return STATUS_NOT_FOUND;
+ }
+
+ Json::Value::Members opts = value.getMemberNames();
+ for (const auto &opt : opts) {
+ if (opt == "label" && value[opt].isString()) {
+ label = value[opt].asString();
+ continue;
+ }
+ if (opt == "file" && value[opt].isString()) {
+ file = util::file::pathjoin(__sharedConfig ? __sharedConfig->rootPath : std::filesystem::current_path(),
+ value[opt].asString());
+ continue;
+ }
+ if (opt == "size") {
+ if (value[opt].isUInt()) {
+ sizeBytes = util::convert::alignSize(value[opt].asUInt(), 512);
+ } else if (value[opt].isString()) {
+ sizeBytes = util::convert::byteSize(value[opt].asString(), 512);
+ }
+ if (sizeBytes == 0) {
+ sizeBytes.reset();
+ }
+ continue;
+ }
+ if (opt == "device_index" && value[opt].isUInt()) {
+ index = value[opt].asUInt();
+ continue;
+ }
+ _W("(%s = %s) is invalid LoopDev option", opt.c_str(), JsonTools::writeToString(value[opt]).c_str());
+ }
+
+ return STATUS_OK;
+}
+
+LoopdevDriver::LoopdevDriver(const std::string &drvname, const Json::Value &config)
+ : VolumeDriver(drvname), __loopdev_major(7), __loopdev_distance(1), __make_devices()
+{
+ if (config.isMember("loopdev")) {
+ const Json::Value &lodevConfig = config["loopdev"];
+ JsonTools::Transform::getJsonValue<int>(__loopdev_distance, lodevConfig["node_minor_dist"]);
+ }
+}
+
+LoopdevDriver::~LoopdevDriver()
+{
+ for (auto &dev : __make_devices) {
+ if (!std::filesystem::exists(dev)) {
+ continue;
+ }
+ if (__attached_devices.count(dev)) {
+ __lodev_detach(dev);
+ }
+ std::filesystem::remove(dev);
+ }
+}
+
+std::shared_ptr<Volume> LoopdevDriver::createVolume(const Json::Value &value,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig)
+{
+ std::shared_ptr<LoopdevVolume> volume = std::make_shared<LoopdevVolume>(drvname);
+ volume->setSharedConfig(sharedConfig);
+ Status ret = volume->setConfigs(value);
+ return ret == STATUS_OK ? volume : nullptr;
+}
+
+Status LoopdevDriver::__resize(const std::filesystem::path &file, const uintmax_t sizeBytes)
+{
+ if (!std::filesystem::exists(file) || sizeBytes == 0) {
+ return STATUS_FAIL;
+ }
+
+ uintmax_t current_size = std::filesystem::file_size(file);
+
+ std::error_code code;
+ std::filesystem::resize_file(file, sizeBytes, code);
+ _D("resize %s:(%ju->%ju), %s", file.c_str(), current_size, sizeBytes, code.message().c_str());
+
+ current_size = std::filesystem::file_size(file);
+
+ return current_size == sizeBytes ? STATUS_OK : STATUS_FAIL;
+}
+
+Status LoopdevDriver::__change_label(const std::filesystem::path &file, const std::string &label)
+{
+ util::blkID blk = util::blkID(file);
+ if (!blk.valid()) {
+ return STATUS_FAIL;
+ }
+
+ std::string orig_label = blk.getLabel();
+
+ // TODO: It is currently used as a shell command, but it should be changed to cpp code.
+ switch (blk.getType()) {
+ case FS_TYPE_BTRFS:
+ util::system::subprocess(CMD_BTRFS, {"filesystem", "label", file, label}).execute();
+ break;
+ case FS_TYPE_F2FS:
+ util::system::subprocess(CMD_F2FSLABEL, {file, label}).execute();
+ break;
+ case FS_TYPE_EXT4:
+ [[fallthrough]];
+ default:
+ util::system::subprocess(CMD_E2LABEL, {file, label}).execute();
+ break;
+ }
+
+ blk.refresh();
+ if (blk.getLabel() != label) {
+ _E("label change failed");
+ return STATUS_FAIL;
+ }
+
+ _D("change label %s:(%s->%s)", file.c_str(), orig_label.c_str(), label.c_str());
+
+ return STATUS_OK;
+}
+
+#include <regex>
+bool LoopdevDriver::__lodev_is_attached(const std::filesystem::path &dev, std::string *file)
+{
+ if (dev.empty()) {
+ return false;
+ }
+
+ std::string result;
+ if (util::system::subprocess(CMD_LOSETUP, {dev.string()}).execute(result) != 0) {
+ return false;
+ }
+
+ std::smatch attached;
+ try {
+ std::regex re("\\(.*\\)");
+ if (!std::regex_search(result, attached, re)) {
+ return false;
+ }
+ } catch (...) {
+ return false;
+ }
+
+ if (file) {
+ *file = attached.str().substr(1, attached.size() - 1);
+ }
+
+ return true;
+}
+
+Status LoopdevDriver::__lodev_attach(const std::filesystem::path &dev, const std::filesystem::path &file)
+{
+ if (__attached_devices.count(dev)) {
+ _E("already attached device %s > %s", dev.c_str(), file.c_str());
+ return STATUS_IGNORE;
+ }
+
+ if (std::string attached; __lodev_is_attached(dev, &attached)) {
+ if (file == attached) {
+ _E("already attached device %s > %s", dev.c_str(), file.c_str());
+ return STATUS_IGNORE;
+ }
+ _W("other file attached %s > %s, try deatch", dev.c_str(), attached.c_str());
+ if (__lodev_detach(dev) == STATUS_FAIL)
+ return STATUS_FAIL;
+ }
+
+ if (!std::filesystem::exists(dev) || !std::filesystem::exists(file)) {
+ _E("%s or %s is not existing", dev.c_str(), file.c_str());
+ return STATUS_FAIL;
+ }
+
+ if (!std::filesystem::is_block_file(std::filesystem::is_symlink(dev) ? std::filesystem::read_symlink(dev) : dev)) {
+ _E("%s is invalid", dev.c_str());
+ return STATUS_FAIL;
+ }
+
+ // TODO: It is currently used as a shell command, but it should be changed to cpp code.
+ if (std::string result; util::system::subprocess(CMD_LOSETUP, {dev, file}).execute(result) != 0) {
+ _W("losetup attach failed %s:%s > %s", dev.c_str(), file.c_str(), result.c_str());
+ return STATUS_FAIL;
+ }
+
+ _D("losetup attach %s:%s", dev.c_str(), file.c_str());
+ __attached_devices.insert(dev);
+ return STATUS_OK;
+}
+
+Status LoopdevDriver::__lodev_detach(const std::filesystem::path &dev)
+{
+ if (!__attached_devices.count(dev) && !__lodev_is_attached(dev)) {
+ return STATUS_IGNORE;
+ }
+
+ // TODO: It is currently used as a shell command, but it should be changed to cpp code.
+ std::string result;
+ if (std::string result; util::system::subprocess(CMD_LOSETUP, {"-d", dev}).execute(result) != 0) {
+ _W("losetup detach failed %s > %s", dev.c_str(), result.c_str());
+ return STATUS_FAIL;
+ }
+
+ _D("losetup detach %s", dev.c_str());
+ __attached_devices.erase(dev);
+
+ return STATUS_OK;
+}
+
+std::string LoopdevDriver::__next_lodev()
+{
+ std::string next_lodev;
+ util::system::subprocess(CMD_LOSETUP, "-f").execute(next_lodev);
+ return util::string::trim(next_lodev);
+}
+
+Status LoopdevDriver::prepare(std::shared_ptr<Volume> &vol)
+{
+ if (typeid(*vol) != typeid(LoopdevVolume)) {
+ return STATUS_FAIL;
+ }
+
+ std::lock_guard<std::mutex> lock(vol->mutex);
+ std::shared_ptr<LoopdevVolume> lodev = std::static_pointer_cast<LoopdevVolume>(vol);
+ if (!lodev->valid()) {
+ _E("%s file not found", lodev->file.c_str());
+ return STATUS_FAIL;
+ }
+
+ if (lodev->index.has_value()) {
+ lodev->source = "/dev/loop" + std::to_string(lodev->index.value());
+ lodev->target = lodev->source;
+ } else {
+ lodev->source = lodev->file.lexically_normal().string() + ".loop";
+ lodev->target = "/dev/loop-"s + lodev->file.stem().string();
+ }
+
+ lodev->__prepared = true;
+ return STATUS_OK;
+}
+
+Status LoopdevDriver::__create_symlink(std::shared_ptr<LoopdevVolume> lodev)
+{
+ assert(lodev);
+
+ std::filesystem::path &source = lodev->source;
+ if (std::filesystem::exists(source)) {
+ if (!std::filesystem::is_symlink(source)) {
+ _E("unknown %s file is already exists", source.c_str());
+ return STATUS_FAIL;
+ }
+
+ // cleanup lodev
+ __lodev_detach(source);
+
+ if (std::error_code ec; !std::filesystem::remove(source, ec)) {
+ _E("old %s cleanup failed: %s", source.c_str(), ec.message().c_str());
+ return STATUS_FAIL;
+ }
+ }
+
+ std::error_code ec;
+ std::filesystem::create_symlink(__next_lodev(), lodev->source, ec);
+ if (ec) {
+ _E("create %s symlink failed: %s", lodev->source.c_str(), ec.message().c_str());
+ return STATUS_FAIL;
+ }
+
+ __make_devices.insert(lodev->source);
+ return STATUS_OK;
+}
+
+Status LoopdevDriver::setup(std::shared_ptr<Volume> &vol)
+{
+ if (typeid(*vol) != typeid(LoopdevVolume)) {
+ return STATUS_FAIL;
+ }
+
+ std::lock_guard<std::mutex> lock(vol->mutex);
+ std::shared_ptr<LoopdevVolume> lodev = std::static_pointer_cast<LoopdevVolume>(vol);
+
+ if (lodev->label.has_value() && util::blkID(lodev->file).getLabel() != lodev->label.value()) {
+ __change_label(lodev->file, lodev->label.value());
+ }
+
+ if (lodev->sizeBytes.has_value() && lodev->sizeBytes.value() > std::filesystem::file_size(lodev->file)) {
+ __resize(lodev->file, lodev->sizeBytes.value());
+ }
+
+ {
+ std::lock_guard<std::mutex> lk(__lock);
+ if (!lodev->index.has_value()) {
+ if (__create_symlink(lodev) != STATUS_OK) {
+ return STATUS_FAIL;
+ }
+ }
+
+ if (__lodev_attach(lodev->source, lodev->file) != STATUS_OK) {
+ return STATUS_FAIL;
+ }
+ }
+
+ lodev->__available = true;
+ return STATUS_OK;
+}
+
+Status LoopdevDriver::cleanup(std::shared_ptr<Volume> &vol)
+{
+ if (typeid(*vol) != typeid(LoopdevVolume)) {
+ return STATUS_FAIL;
+ }
+
+ std::lock_guard<std::mutex> lock(vol->mutex);
+ std::shared_ptr<LoopdevVolume> lodev = std::static_pointer_cast<LoopdevVolume>(vol);
+ if (lodev->refcount() > 0) {
+ return STATUS_IGNORE;
+ }
+
+ __lodev_detach(lodev->source);
+ lodev->__available = false;
+
+ if (__make_devices.erase(lodev->source)) {
+ std::filesystem::remove(lodev->source);
+ }
+
+ return STATUS_OK;
+}
diff --git a/src/Volumes/LoopDevice.h b/src/Volumes/LoopDevice.h
new file mode 100644
index 0000000..1736a9b
--- /dev/null
+++ b/src/Volumes/LoopDevice.h
@@ -0,0 +1,69 @@
+#ifndef __LOOP_DEVICE_H__
+#define __LOOP_DEVICE_H__
+
+#include <memory>
+#include <set>
+#include <filesystem>
+#include <optional>
+#include <mutex>
+#include <json/json.h>
+
+#include "internal_types.h"
+#include "Volume.h"
+#include "VolumeDriver.h"
+
+#define LOOPDEV_DRVNAME "loopdev"
+class LoopdevVolume;
+
+class LoopdevDriver : public VolumeDriver
+{
+ friend class LoopdevDriverTest;
+
+public:
+ LoopdevDriver(const std::string &drvname, const Json::Value &config);
+ ~LoopdevDriver();
+
+ virtual std::shared_ptr<Volume> createVolume(const Json::Value &opts,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig) override;
+ virtual Status prepare(std::shared_ptr<Volume> &vol) override;
+ virtual Status setup(std::shared_ptr<Volume> &vol) override;
+ virtual Status cleanup(std::shared_ptr<Volume> &vol) override;
+
+private:
+ int __loopdev_major; // linux kernel loopdev major
+ int __loopdev_distance;
+
+ Status __resize(const std::filesystem::path &file, const uintmax_t sizeBytes);
+ Status __change_label(const std::filesystem::path &file, const std::string &label);
+ static bool __lodev_is_attached(const std::filesystem::path &dev, std::string *file = nullptr);
+ Status __lodev_attach(const std::filesystem::path &dev, const std::filesystem::path &file);
+ Status __lodev_detach(const std::filesystem::path &dev);
+ Status __create_symlink(std::shared_ptr<LoopdevVolume> lodev);
+ std::string __next_lodev();
+
+ std::set<std::filesystem::path> __make_devices;
+ std::set<std::filesystem::path> __attached_devices;
+
+ std::mutex __lock;
+};
+
+class LoopdevVolume : public Volume
+{
+ friend class LoopdevDriver;
+ friend class LoopdevDriverTest;
+
+public:
+ LoopdevVolume(const std::string &drvname = LOOPDEV_DRVNAME);
+ ~LoopdevVolume() = default;
+
+ virtual Status setConfigs(const Json::Value &value) override;
+ bool valid() const { return !file.empty() && std::filesystem::is_regular_file(file); }
+
+private:
+ std::filesystem::path file;
+ std::optional<std::string> label;
+ std::optional<uintmax_t> sizeBytes;
+ std::optional<int> index;
+};
+
+#endif /*__BLOCK_DEVICE_H__ */
diff --git a/src/Volumes/VolumeDriver.h b/src/Volumes/VolumeDriver.h
new file mode 100644
index 0000000..798251e
--- /dev/null
+++ b/src/Volumes/VolumeDriver.h
@@ -0,0 +1,41 @@
+#ifndef __VOLUME_DRIVER_H__
+#define __VOLUME_DRIVER_H__
+
+#include <string>
+#include <map>
+#include <memory>
+#include <json/json.h>
+
+#include "internal_types.h"
+#include "Volume.h"
+#include "Config/Config.h"
+
+#include "util/JsonTools.h"
+
+class VolumeDriver
+{
+public:
+ VolumeDriver(const std::string &name = "dummy") : drvname(name) {}
+ virtual ~VolumeDriver() = default;
+
+ std::shared_ptr<Volume> createVolume(const std::string &jsonstr,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig = nullptr)
+ {
+ Json::Value root;
+ if (JsonTools::parseFromString(jsonstr, &root) == false) {
+ return nullptr;
+ }
+ return createVolume(root, sharedConfig);
+ }
+
+public:
+ virtual std::shared_ptr<Volume> createVolume(const Json::Value &value,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig) = 0;
+ virtual Status prepare(std::shared_ptr<Volume> &vol) = 0;
+ virtual Status setup(std::shared_ptr<Volume> &vol) = 0;
+ virtual Status cleanup(std::shared_ptr<Volume> &vol) = 0;
+
+ const std::string drvname;
+};
+
+#endif /*__VOLUME_DRIVER_H__ */
diff --git a/src/Volumes/VolumeManager.cpp b/src/Volumes/VolumeManager.cpp
new file mode 100644
index 0000000..cf3f32a
--- /dev/null
+++ b/src/Volumes/VolumeManager.cpp
@@ -0,0 +1,135 @@
+#include "Volume.h"
+#include <map>
+#include <memory>
+
+#include "VolumeManager.h"
+
+#include "Volumes/VolumeDriver.h"
+#include "Volumes/LoopDevice.h"
+#include "Volumes/BlockDevice.h"
+
+#include "util/system.h"
+#include "util/JsonTools.h"
+#include "util/log.h"
+#include "util/error.h"
+
+std::unique_ptr<VolumeManager> VolumeManager::__instance = nullptr;
+
+VolumeManager::VolumeManager()
+{
+ ;
+}
+
+VolumeManager::~VolumeManager()
+{
+ ;
+}
+
+VolumeManager *VolumeManager::get()
+{
+ if (unlikely(__instance.get() == nullptr)) {
+ __instance = std::make_unique<VolumeManager>();
+ }
+ return __instance.get();
+}
+
+Status VolumeManager::initDrivers(const Json::Value &config)
+{
+ const Json::Value &volumeConfig = config.get("VolumeManager", Json::Value());
+
+ registryDriver<BlkdevDriver>(BLKDEV_DRVNAME, volumeConfig);
+ registryDriver<LoopdevDriver>(LOOPDEV_DRVNAME, volumeConfig);
+
+ return STATUS_OK;
+}
+
+std::shared_ptr<Volume> VolumeManager::getVolume(const std::string &name)
+{
+ std::lock_guard<std::mutex> lock(__mutex.volume);
+ const auto it = __volumes.find(name);
+ if (it == __volumes.end()) {
+ return nullptr;
+ }
+ return it->second;
+}
+
+VolumeDriver *VolumeManager::getDriver(const std::string &name)
+{
+ std::lock_guard<std::mutex> lock(__mutex.driver);
+ const auto &it = __drivers.find(name);
+ if (it == __drivers.end()) {
+ return nullptr;
+ }
+
+ return it->second.get();
+}
+
+std::shared_ptr<Volume> VolumeManager::__makeVolume(const std::string &name, const Json::Value &conf,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig)
+{
+ if (unlikely(!conf.isMember("driver"))) {
+ _E("volume %s is not had driver field. ignoring", name.c_str());
+ return nullptr;
+ }
+
+ std::string drvname = conf["driver"].asString();
+ VolumeDriver *driver = getDriver(drvname);
+ if (unlikely(driver == nullptr)) {
+ _E("volume %s's driver %s not found. ignoring", name.c_str(), drvname.c_str());
+ return nullptr;
+ }
+
+ return driver->createVolume(conf.isMember("driver_opts") ? conf["driver_opts"] : Json::Value(), sharedConfig);
+}
+
+Status VolumeManager::registryFromConfigs(const Json::Value &value, std::shared_ptr<Config::SharedConfigs> sharedConfig)
+{
+ const char *optname = "volumes";
+
+ if (value.empty()) {
+ return STATUS_IGNORE;
+ }
+
+ if (!value.isMember(optname)) {
+ return STATUS_NOT_FOUND;
+ }
+
+ const Json::Value &conf = value[optname];
+
+ Json::Value::Members volume_names = conf.getMemberNames();
+ for (const auto &name : volume_names) {
+ std::shared_ptr<Volume> volume = getVolume(name);
+ if (unlikely(volume != nullptr)) {
+ _E("volume %s is duplicated. ignoring", name.c_str());
+ continue;
+ }
+
+ volume = __makeVolume(name, conf[name], sharedConfig);
+ if (unlikely(volume == nullptr)) {
+ _E("volume %s generate failed", name.c_str());
+ continue;
+ }
+
+ __volumes.emplace(name, volume);
+ }
+
+ return STATUS_OK;
+}
+
+Status VolumeManager::registryFromConfigFile(const std::string &file)
+{
+ Json::Value root;
+
+ if (unlikely(!JsonTools::parseFromFile(file, &root))) {
+ return STATUS_FAIL;
+ }
+
+ return registryFromConfigs(root, nullptr);
+}
+
+Status VolumeManager::unregistry(const std::string &name)
+{
+ std::lock_guard<std::mutex> lock(__mutex.volume);
+ __volumes.erase(name);
+ return STATUS_OK;
+}
diff --git a/src/Volumes/VolumeManager.h b/src/Volumes/VolumeManager.h
new file mode 100644
index 0000000..a0aea9a
--- /dev/null
+++ b/src/Volumes/VolumeManager.h
@@ -0,0 +1,51 @@
+#ifndef __VOLUME_MANAGER_H__
+#define __VOLUME_MANAGER_H__
+
+#include <memory>
+#include <string>
+#include <map>
+#include <list>
+#include <mutex>
+
+#include "internal_types.h"
+#include "Config/Config.h"
+#include "Volume.h"
+#include "Volumes/VolumeDriver.h"
+
+#include "json/json.h"
+
+class VolumeManager
+{
+public:
+ VolumeManager();
+ ~VolumeManager();
+
+ static VolumeManager *get();
+
+ Status initDrivers(const Json::Value &config);
+ VolumeDriver *getDriver(const std::string &name);
+ template <typename T> void registryDriver(const char *drvname, const Json::Value &config)
+ {
+ std::lock_guard<std::mutex> lock(__mutex.driver);
+ __drivers.emplace(drvname, std::make_unique<T>(drvname, config));
+ }
+
+ std::shared_ptr<Volume> getVolume(const std::string &name);
+ Status registryFromConfigs(const Json::Value &jsonconf, std::shared_ptr<Config::SharedConfigs> sharedConfig);
+ Status registryFromConfigFile(const std::string &file);
+ Status unregistry(const std::string &name);
+
+private:
+ std::shared_ptr<Volume> __makeVolume(const std::string &name, const Json::Value &jsonconf,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig);
+ static std::unique_ptr<VolumeManager> __instance;
+ std::map<std::string, std::shared_ptr<Volume>> __volumes;
+ std::map<std::string, std::unique_ptr<VolumeDriver>> __drivers;
+
+ struct {
+ std::mutex volume;
+ std::mutex driver;
+ } __mutex;
+};
+
+#endif /* __VOLUME_MANAGER_H__ */
diff --git a/src/Volumes/Volumes.cpp b/src/Volumes/Volumes.cpp
new file mode 100644
index 0000000..3b4a396
--- /dev/null
+++ b/src/Volumes/Volumes.cpp
@@ -0,0 +1,168 @@
+#include "Container.h"
+
+#include "Volumes/VolumeManager.h"
+#include "Volume.h"
+
+#include "Extension/Extension.h"
+#include "Volumes/Volumes.h"
+
+#include "util/system.h"
+#include "util/JsonTools.h"
+#include "util/log.h"
+#include "util/error.h"
+
+using namespace Extension;
+#define OPT_NAME "volumes"
+
+Volumes::Volumes()
+{
+ desc = "volumes";
+}
+
+Status Volumes::setConfig(const Json::Value &config)
+{
+ if (unlikely(config.empty())) {
+ return STATUS_IGNORE;
+ }
+
+ if (!config.isMember(OPT_NAME)) {
+ return STATUS_IGNORE;
+ }
+
+ if (unlikely(!config[OPT_NAME].isArray())) {
+ return STATUS_FAIL;
+ }
+
+ for (const auto &it : config[OPT_NAME]) {
+ if (it.isString()) {
+ __items.emplace_back(it.asString());
+ }
+ }
+
+ return !__items.empty() ? STATUS_OK : STATUS_IGNORE;
+}
+
+Status Volumes::__generateCreateOptions(Config::ContainerConfigs *config)
+{
+ VolumeManager *manager = VolumeManager::get();
+
+ for (const std::string &vol_id : __items) {
+ std::shared_ptr<Volume> volume = manager->getVolume(vol_id);
+ if (!volume) {
+ _E("volume [%s] not found", vol_id.c_str());
+ continue;
+ }
+ std::lock_guard<std::mutex> lock(volume->mutex);
+
+ VolumeControlType type = volume->getControlType();
+ switch (type) {
+ case VOLUME_CONTROL_DEVICE: {
+ Config::Device dev(volume->source, volume->target, _RWM);
+ dev.strict = true;
+ config->devices.push_back(dev);
+ break;
+ }
+ default: {
+ _E("volume control type 0x%x is not implemented", type);
+ }
+ }
+ }
+
+ return STATUS_OK;
+}
+
+Status Volumes::createPre(Container *const container)
+{
+ if (__items.empty()) {
+ return STATUS_IGNORE;
+ }
+
+ Status ret = STATUS_OK;
+ for (const std::string &vol_id : __items) {
+ std::shared_ptr<Volume> volume = VolumeManager::get()->getVolume(vol_id);
+ if (!volume) {
+ _W("not found volume : %s", vol_id.c_str());
+ continue;
+ }
+ VolumeDriver *driver = VolumeManager::get()->getDriver(volume->getDriverName());
+ if (unlikely(driver->prepare(volume) == STATUS_FAIL)) {
+ _E("prepare %s volume failed", vol_id.c_str());
+ ret = STATUS_FAIL;
+ continue;
+ }
+ }
+
+ if (ret != STATUS_OK) {
+ return ret;
+ }
+
+ return __generateCreateOptions(container->containerConfig.get());
+}
+
+Status Volumes::startPre(Container *const container)
+{
+ if (__items.empty()) {
+ return STATUS_IGNORE;
+ }
+
+ Status ret = STATUS_OK;
+ for (const std::string &vol_id : __items) {
+ std::shared_ptr<Volume> volume = VolumeManager::get()->getVolume(vol_id);
+ if (!volume) {
+ _W("not found volume : %s", vol_id.c_str());
+ continue;
+ }
+ VolumeDriver *driver = VolumeManager::get()->getDriver(volume->getDriverName());
+ if (unlikely(volume->avail())) {
+ _W("already volume %s setup, ignore", vol_id.c_str());
+ continue;
+ }
+
+ if (unlikely(!volume->prepared())) {
+ if (unlikely(driver->prepare(volume) == STATUS_FAIL)) {
+ _E("prepare %s volume failed", vol_id.c_str());
+ ret = STATUS_FAIL;
+ continue;
+ }
+ }
+
+ if (unlikely(driver->setup(volume) == STATUS_FAIL)) {
+ _E("setup %s volume failed", vol_id.c_str());
+ ret = STATUS_FAIL;
+ continue;
+ }
+ }
+
+ return ret;
+}
+
+Status Volumes::stopPost(Container *const container)
+{
+ if (__items.empty()) {
+ return STATUS_IGNORE;
+ }
+
+ Status ret = STATUS_OK;
+ for (const std::string &vol_id : __items) {
+ std::shared_ptr<Volume> volume = VolumeManager::get()->getVolume(vol_id);
+ if (!volume) {
+ _W("not found volume : %s", vol_id.c_str());
+ continue;
+ }
+ VolumeDriver *driver = VolumeManager::get()->getDriver(volume->getDriverName());
+ if (unlikely(!volume->prepared())) {
+ if (unlikely(driver->prepare(volume) == STATUS_FAIL)) {
+ _E("prepare %s volume failed", vol_id.c_str());
+ ret = STATUS_FAIL;
+ continue;
+ }
+ }
+ if (unlikely(driver->cleanup(volume) == STATUS_FAIL)) {
+ _E("cleanup %s volume failed", vol_id.c_str());
+ ret = STATUS_FAIL;
+ continue;
+ }
+ }
+
+ return ret;
+}
diff --git a/src/Volumes/Volumes.h b/src/Volumes/Volumes.h
new file mode 100644
index 0000000..3f6833e
--- /dev/null
+++ b/src/Volumes/Volumes.h
@@ -0,0 +1,32 @@
+#ifndef __EXTENSION_VOLUMES_H__
+#define __EXTENSION_VOLUMES_H__
+
+#include "Extension/Extension.h"
+#include "Config/Config.h"
+#include <vector>
+#include <string>
+
+namespace Extension
+{
+ class Volumes : public Interface
+ {
+ public:
+ Volumes();
+ ~Volumes() = default;
+
+ virtual Status setConfig(const Json::Value &config) override;
+
+ virtual Status createPre(Container *const container) override;
+ virtual Status startPre(Container *const container) override;
+ virtual Status stopPost(Container *const container) override;
+
+ private:
+ Status __generateCreateOptions(Config::ContainerConfigs *config);
+
+ private:
+ std::vector<std::string> __items;
+ };
+
+}; // namespace Extension
+
+#endif /* __EXTCONFIG_VOLUME_H__ */
diff --git a/src/docker-launcher.cpp b/src/docker-launcher.cpp
new file mode 100644
index 0000000..536098e
--- /dev/null
+++ b/src/docker-launcher.cpp
@@ -0,0 +1,58 @@
+#include <exception>
+#include <stdexcept>
+#include <memory>
+#include <thread>
+
+#include <fcntl.h>
+#include <signal.h>
+
+#include "internal_types.h"
+#include "DockerLauncher.h"
+#include "ContainerManager.h"
+#include "Volumes/VolumeManager.h"
+
+#include "util/error.h"
+#include "util/log.h"
+
+std::unique_ptr<DockerLauncher> dockerLauncher = std::make_unique<DockerLauncher>();
+
+/* WORKAROUND : It's temporary. More advanced implementation is needed. */
+void sig_handler(int handle)
+{
+ _W("Catch signal!");
+ dockerLauncher->finalize();
+ _W("exit!");
+ exit(0);
+}
+
+int main()
+{
+ int ret = 0;
+ bool crashed = false;
+
+ try {
+ ret = dockerLauncher->initialize();
+
+ signal(SIGHUP, sig_handler);
+ signal(SIGINT, sig_handler);
+ signal(SIGTERM, sig_handler);
+
+ ret = dockerLauncher->run();
+ ret = dockerLauncher->finalize();
+ } catch (std::exception &e) {
+ __print_exception(e);
+ crashed = true;
+ } catch (...) {
+ _E("Caught unknown exception");
+ }
+
+ try {
+ if (crashed) {
+ dockerLauncher->finalize();
+ }
+ } catch (...) {
+ _E("fail stop container with exceptions");
+ }
+
+ return ret;
+}
diff --git a/src/dzl_device.c b/src/dzl_device.c
deleted file mode 100644
index d686542..0000000
--- a/src/dzl_device.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @file dzl_device.c
- * @brief Implemention of getting system info and system functionalities
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
diff --git a/src/dzl_device.h b/src/dzl_device.h
deleted file mode 100644
index e136bf3..0000000
--- a/src/dzl_device.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @file dzl_device.h
- * @brief Implemention of getting system info and system functionalities
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __DZL_DEVICE_H__
-#define __DZL_DEVICE_H__
-
-#endif /* __DZL_DEVICE_H__ */
diff --git a/src/dzl_dockercomm.c b/src/dzl_dockercomm.c
deleted file mode 100644
index f21e370..0000000
--- a/src/dzl_dockercomm.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/**
- * @file DockerComm.c
- * @brief Connection to Docker engine with connection tool
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "dzl_dockercomm.h"
-
-/**
- * @fn static void __malloc_fail()
- * @brief This function to print error malloc fail
- * @return void
- */
-static void __malloc_fail(void)
-{
- fprintf(stderr, "ERROR: Failed to allocate memory.");
- exit(-1);
-}
-
-/**
- * @fn static size_t __write_function(void *data, size_t size, size_t nmemb, void *buffer)
- * @brief This function to be called when it receives message from curl request
- * @param *data [out] message from callback
- * @param size [out] size of message buffer
- * @param nmeb [out] block of message
- * @param *buffer [out] user buffer
- * @return size_t the size of allocation
- */
-static size_t __write_function(void *data, size_t size, size_t nmemb, void *buffer)
-{
- size_t realsize = size * nmemb;
- struct buffer *mem = (struct buffer *)buffer;
-
- mem->data = realloc(mem->data, mem->size + realsize + 1);
- if (mem->data == NULL)
- __malloc_fail();
-
- memcpy(&(mem->data[mem->size]), data, realsize);
- mem->size += realsize;
- mem->data[mem->size] = 0;
-
- return realsize;
-}
-
-/**
- * @fn static void __init_buffer(DOCKER *client)
- * @brief This function to init buffer
- * @param *client [in] DOCKER structure to init
- * @return void
- */
-static void __init_buffer(DOCKER * client)
-{
- client->buffer->data = (char *)malloc(1);
- client->buffer->size = 0;
-}
-
-/**
- * @fn void __init_curl(DOCKER *client)
- * @brief This function to init curl options
- * @param *client [in] DOCKER structure
- * @return void
- */
-static void __init_curl(DOCKER * client)
-{
- curl_easy_setopt(client->curl, CURLOPT_UNIX_SOCKET_PATH, DOCKER_SOCKET);
- curl_easy_setopt(client->curl, CURLOPT_WRITEFUNCTION, __write_function);
- curl_easy_setopt(client->curl, CURLOPT_WRITEDATA, client->buffer);
-}
-
-/**
- * @fn static CURLcode ___curl_perform(DOCKER *client, char *url)
- * @brief This function to perform curl request
- * @param *client [in] DOCKER structure
- * @param *url [in] destination to request using curl
- * @return CURLcode result of curl request
- */
-static CURLcode ___curl_perform(DOCKER * client, char *url)
-{
- CURLcode response;
-
- __init_buffer(client);
- curl_easy_setopt(client->curl, CURLOPT_URL, url);
- response = curl_easy_perform(client->curl);
- curl_easy_reset(client->curl);
- return response;
-}
-
-DOCKER *dockercomm_docker_init(void)
-{
- DOCKER *client = NULL;
-
- client = (DOCKER *) malloc(sizeof(struct docker));
- if (client != NULL) {
- client->buffer = (struct buffer *)malloc(sizeof(struct buffer));
- if (client->buffer != NULL) {
- client->curl = curl_easy_init();
- if (client->curl) {
- __init_curl(client);
- return client;
- } else {
- _E("ERROR curl_easy_init");
- free(client->buffer);
- }
- } else {
- _E("ERROR malloc at client->buffer");
- }
- free(client);
- }
-
- return NULL;
-}
-
-int dockercomm_docker_destroy(DOCKER * client)
-{
- if (client != NULL) {
- curl_easy_cleanup(client->curl);
- if (client->buffer != NULL) {
- if (client->buffer->data != NULL)
- free(client->buffer->data);
- free(client->buffer);
- }
- free(client);
- client = NULL;
- }
-
- return 0;
-}
-
-char *dockercomm_docker_buffer(DOCKER * client)
-{
- return client->buffer->data;
-}
-
-CURLcode dockercomm_docker_post(DOCKER * client, char *url, char *data, int datalen, char *contentType)
-{
- struct curl_slist *headers = NULL;
- CURLcode response;
-
- __init_curl(client);
-
- headers = curl_slist_append(headers, contentType);
- curl_easy_setopt(client->curl, CURLOPT_HTTPHEADER, headers);
- curl_easy_setopt(client->curl, CURLOPT_POSTFIELDS, (void *)data);
- curl_easy_setopt(client->curl, CURLOPT_POSTFIELDSIZE, datalen);
-
- response = ___curl_perform(client, url);
- curl_slist_free_all(headers);
-
- return response;
-}
-
-CURLcode dockercomm_docker_post_with_only_parameter(DOCKER * client, char *url, char *parameter)
-{
-
- CURLcode response;
-
- curl_easy_setopt(client->curl, CURLOPT_POSTFIELDS, parameter);
-
- response = ___curl_perform(client, url);
-
- return response;
-}
-
-CURLcode dockercomm_docker_get(DOCKER * client, char *url)
-{
- __init_curl(client);
-
- return ___curl_perform(client, url);
-}
-
-CURLcode dockercomm_docker_get_chunked_data(DOCKER * client, char *url, docker_event_cb callback)
-{
- CURLcode response;
-
- _D("call dockercomm_docker_get_chunked_data");
- curl_easy_setopt(client->curl, CURLOPT_UNIX_SOCKET_PATH, DOCKER_SOCKET);
- curl_easy_setopt(client->curl, CURLOPT_WRITEFUNCTION, callback);
- curl_easy_setopt(client->curl, CURLOPT_WRITEDATA, client->buffer);
-
- __init_buffer(client);
-
- curl_easy_setopt(client->curl, CURLOPT_URL, url);
- response = curl_easy_perform(client->curl);
-
- curl_easy_reset(client->curl);
- _D("end dockercomm_docker_get_chunked_data");
-
- return response;
-}
diff --git a/src/dzl_dockercomm.h b/src/dzl_dockercomm.h
deleted file mode 100644
index f6394e0..0000000
--- a/src/dzl_dockercomm.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * @file dzl_dockercomm.h
- * @brief Connection to Docker engine with connection tool
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __DOCKERCOMM_H__
-#define __DOCKERCOMM_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <curl/curl.h>
-#define DOCKER_SOCKET "/var/run/docker.sock"
-
-/**
- * @struct buffer
- * @brief This struct contains buffer information
- *
- * The buffer struct encapsulate the data and size in the one data
- *
- */
- struct buffer {
- char *data;
- size_t size;
- };
-
-/**
- * @struct docker
- * @brief This struct contains buffer and curl information
- *
- * The docker struct encapsulate *curl and *buffer in the one data
- *
- */
- struct docker {
- CURL *curl;
- struct buffer *buffer;
- };
-
- typedef struct docker DOCKER;
-
-/**
- * @fn DOCKER *dockercomm_docker_init(void)
- * @brief This function to init for docker structure and curl
- * @return DOCKER* DOCKER structure
- */
- DOCKER *dockercomm_docker_init(void);
-/**
- * @fn int dockercomm_docker_destroy(DOCKER *docker_client)
- * @brief This function to destroy for docker structure and clean up curl
- * @return int result of function
- */
- int dockercomm_docker_destroy(DOCKER * docker_client);
-/**
- * @fn char *dockercomm_docker_buffer(DOCKER *docker_client)
- * @brief This function to return buffer from DOCKER structure
- * @brief This function to return buffer from DOCKER structure
- * @param *docker_client [in] allocated DOCKER struture
- * @return char* return buffer from DOCKER structure
- */
- char *dockercomm_docker_buffer(DOCKER * docker_client);
-/**
- * @fn CURLcode dockercomm_docker_post(DOCKER *client, char *url, char *data, int datalen, char *contentType)
- * @brief This function to request POST with body data
- * @param *docker_client [in] allocated DOCKER struture
- * @param *url [in] request url
- * @param *data [in] request body
- * @param datalen [in] size of request body
- * @param *contentType [in] request header content type
- * @return CURLcode return curl request
- */
- CURLcode dockercomm_docker_post(DOCKER * client, char *url, char *data, int datalen, char *contentType);
-/**
- * @fn CURLcode dockercomm_docker_get(DOCKER *docker_client, char *url)
- * @brief This function to request Get
- * @param *docker_client [in] allocated DOCKER struture
- * @param *url [in] request url
- * @return CURLcode return curl request
- */
- CURLcode dockercomm_docker_get(DOCKER * docker_client, char *url);
-/**
- * @fn CURLcode dockercomm_docker_get_chunked_data(DOCKER *client, char *url, docker_event_cb callback)
- * @brief This function to request Get chunked data
- * @param *docker_client [in] allocated DOCKER struture
- * @param *url [in] request url
- * @param callback [inout] response chunked data
- * @return CURLcode return curl request
- */
- CURLcode dockercomm_docker_get_chunked_data(DOCKER * client, char *url, docker_event_cb callback);
-/**
- * @fn CURLcode dockercomm_docker_post_with_only_parameter(DOCKER *docker_client, char *url, char *parameter)
- * @brief This function to request POST with body data
- * @param *docker_client [in] allocated DOCKER struture
- * @param *url [in] request url
- * @param *parameter [in] request parameter in uri
- * @return CURLcode return curl request
- */
- CURLcode dockercomm_docker_post_with_only_parameter(DOCKER * client, char *url, char *parameter);
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DOCKERCOMM_H__ */
diff --git a/src/dzl_dockerctl.c b/src/dzl_dockerctl.c
deleted file mode 100755
index 5318b03..0000000
--- a/src/dzl_dockerctl.c
+++ /dev/null
@@ -1,2206 +0,0 @@
-/**
- * @file DZL_DockerCtl.c
- * @brief Impelemetation of docker-egnine interfaces.
- * Control for life cycle of dockzen including dockerd and swarm.
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include <errno.h>
-
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "dzl_dockerctl.h"
-#include "dzl_setting.h"
-#include "dzl_dockercomm.h"
-#include "dzl_dockerform.h"
-
-#include "dzl_dockerctl.h"
-
-#define PRE_INSTALLED_CONTAINER_PATH "/opt/beluga/container/"
-#define MAX_WAIT_INTERVAL 150
-
-#define DOCKER_SERVICE_UPDATE "for i in $(docker service ls --format \"{{.Name}}\") ; do echo Name=$i ; docker ps --format \"{{.Image}}\" | grep $(docker service ls --filter name=$i --format \"{{.Image}}\") && echo \"skip\" || docker service update --force --detach=false --env-add UPDATE=0 $i ; done"
-#define MAXLINE 1024
-#define LOG_BUF_LEN 2048
-#define GET_HTTP_PROXY_CMD "source /opt/beluga/system/env/environment && echo $HTTP_PROXY"
-#define GET_HTTPS_PROXY_CMD "source /opt/beluga/system/env/environment && echo $HTTPS_PROXY"
-
-dzl_dockerctl_status_table astSeviceStatusTbl[STATUS_MAX_NUM] = {
- {"new", CONTAINER_STATUS_CREATED},
- {"allocated", CONTAINER_STATUS_CREATED},
- {"pending", CONTAINER_STATUS_CREATED},
- {"assigned", CONTAINER_STATUS_CREATED},
- {"accepted", CONTAINER_STATUS_CREATED},
- {"preparing", CONTAINER_STATUS_CREATED},
- {"ready", CONTAINER_STATUS_CREATED},
- {"starting", CONTAINER_STATUS_CREATED},
- {"running", CONTAINER_STATUS_RUNNING},
- {"complete", CONTAINER_STATUS_EXITED},
- {"shutdown", CONTAINER_STATUS_EXITED},
- {"failed", CONTAINER_STATUS_EXITED},
- {"rejected", CONTAINER_STATUS_EXITED}
-};
-
-dzl_dockerctl_status_table astEventStatusTbl[EVEVT_STATUS_MAX_NUM] = {
- {"create", CONTAINER_STATUS_CREATED},
- {"start", CONTAINER_STATUS_RUNNING},
- {"die", CONTAINER_STATUS_EXITED},
- {"destroy", CONTAINER_STATUS_REMOVED}
-};
-
-status_monitor_cb dzl_dockerctl_callback;
-int dzl_dockerctl_msg_queue_id;
-dzl_dockerctl_status_init_e initialize_dzl_dockerctl_flag;
-
-/**
- * @fn static int __get_dzl_dockerctl_msg_queue_id(void)
- * @brief This function to get message queue id
- * @return int id of msg queue
- */
-static int __get_dzl_dockerctl_msg_queue_id(void)
-{
- return dzl_dockerctl_msg_queue_id;
-}
-
-/**
- * @fn static int __get_dzl_dockerctl_initialized(void)
- * @brief This function to get flag of docker interface initialized
- * if docker interface initialized, it would return 1
- * @return int value of initialized value
- */
-static dzl_dockerctl_status_init_e __get_dzl_dockerctl_initialized(void)
-{
- return initialize_dzl_dockerctl_flag;
-}
-
-/**
- * @fn __register_dzl_dockerctl_callback(status_monitor_cb handler)
- * @brief This function to be registered callback function
- * @param handler [in] callback function
- * @return void
- */
-static docker_status_e __register_dzl_dockerctl_callback(status_monitor_cb handler)
-{
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
-
- if (DZL_DOCKERCTL_STATUS_INITIALIZED == __get_dzl_dockerctl_initialized())
- dzl_dockerctl_callback = handler;
- else
- ret = DOCKER_STATUS_UNKNOWN;
-
- return ret;
-}
-
-/**
- * @fn static int __interface_send_message(dzl_dockerctl_msgq_buf_s *msg_buf)
- * @brief This function to send message to deal with
- * @param *msg_buf [in] message buffer
- * @return int return of function
- */
-static int __interface_send_message(dzl_dockerctl_msgq_buf_s * msg_buf)
-{
- int msgqid;
- int msg_size;
-
- msg_buf->mtype = DOCKER_INTERFACE_QID;
- msg_size = sizeof(dzl_dockerctl_msgq_buf_s) - sizeof(msg_buf->mtype);
-
- msgqid = __get_dzl_dockerctl_msg_queue_id();
- _D("msgqid:%d", msgqid);
-
- if (msgsnd(msgqid, msg_buf, msg_size, 0) == -1) {
- _E("msgsnd error(%d)", errno);
- return -1;
- }
-
- return 0;
-}
-
-/**
- * @fn static size_t __read_docker_event_callback(void *data, size_t size, size_t nmemb, void *buffer)
- * @brief This function to be called when it receives callback
- * @param *data [out] message from callback
- * @param size [out] size of message buffer
- * @param nmeb [out] block of message
- * @param *buffer [out] user buffer
- * @return size_t the size of allocation
- */
-static size_t __read_docker_event_callback(char *data, size_t size, size_t nmemb, void *buffer)
-{
- size_t realsize = size * nmemb;
- struct buffer *mem = (struct buffer *)buffer;
- int size_data = 0;
- dzl_dockerctl_msgq_buf_s msg_buf;
- char *p = NULL;
-
- _D("call __read_callback");
- _D("size[%d] [%s]", (unsigned int)strlen(data), data);
- size_data = strlen(data);
-
- p = (char *)malloc(sizeof(char) * size_data + 1);
- if (p == NULL) {
- _D("mallock fail");
- return -1;
- }
-
- p[size_data] = 0;
- memcpy(p, data, size_data + 1);
- msg_buf.event_data = p;
- msg_buf.cmd = DZL_DOCKERCTL_CONTAINER_STATUS_CHANGE;
- __interface_send_message(&msg_buf);
-
- if (mem != NULL)
- free(NULL);
-
- return realsize;
-}
-
-/**
- * @fn static int __get_services_info(dzl_dockerctl_ServicesInfo *pstServicesInfo)
- * @brief This function to get services information from docker engine
- * @param *pstServicesInfo [inout] services information
- * @return int return of function
- */
-static int __get_services_info(dzl_dockerctl_ServicesInfo * pstServicesInfo)
-{
- DOCKER *services = NULL;
- CURLcode response;
- char retUrl[256] = { 0, };
- int ret = DOCKER_STATUS_NO_ERROR;
-
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_SERVICES, retUrl, sizeof(retUrl)))
- return DOCKER_STATUS_UNKNOWN;
-
- services = dockercomm_docker_init();
-
- if (services) {
- response = dockercomm_docker_get(services, retUrl);
-
- if (response != CURLE_OK) {
- _D("docker curl response error!!\n");
- dockercomm_docker_destroy(services);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(services))) {
- ret = dockerform_generate_servicesinfo(dockercomm_docker_buffer(services), pstServicesInfo);
- if (ret == DOCKER_STATUS_NO_ERROR) {
- _D("services request ok !!! [%d]", ret);
- } else {
- dockercomm_docker_destroy(services);
- if (pstServicesInfo->pstServices != NULL) {
- free(pstServicesInfo->pstServices);
- pstServicesInfo->pstServices = NULL;
- }
-
- return ret;
- }
- } else {
- _D("service fail !!!");
- _D("%s", dockercomm_docker_buffer(services));
- ret = DOCKER_STATUS_SERVICE_FAIL;
- }
-
- dockercomm_docker_destroy(services);
- } else {
- _D("getServicesInfo alloc fail");
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- _D("getServicesInfo return OK");
-
- return ret;
-}
-
-/**
- * @fn static int __get_tasks_Info(dzl_dockerctl_TasksInfo *pstTasksInfo)
- * @brief This function to get tasks information from docker engine
- * @param *pstTasksInfo [inout] tasks information
- * @return int return of function
- */
-static int __get_tasks_Info(dzl_dockerctl_TasksInfo * pstTasksInfo)
-{
- DOCKER *tasks = NULL;
- CURLcode response;
- char retUrl[256] = { 0, };
- int ret = DOCKER_STATUS_NO_ERROR;
-
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_TASKS, retUrl, sizeof(retUrl)))
- return DOCKER_STATUS_UNKNOWN;
-
- tasks = dockercomm_docker_init();
-
- if (tasks) {
- response = dockercomm_docker_get(tasks, retUrl);
-
- if (response != CURLE_OK) {
- _D("docker curl response error!!\n");
- dockercomm_docker_destroy(tasks);
- return DOCKER_STATUS_SERVICE_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(tasks))) {
- ret = dockerform_generate_tasksinfo(dockercomm_docker_buffer(tasks), pstTasksInfo);
- if (ret == DOCKER_STATUS_NO_ERROR) {
- _D("tasks request ok !!! [%d]", ret);
- } else {
- dockercomm_docker_destroy(tasks);
- if (pstTasksInfo->pstTasks != NULL) {
- free(pstTasksInfo->pstTasks);
- pstTasksInfo->pstTasks = NULL;
- }
-
- return ret;
- }
- } else {
- _D("tasks fail !!!");
- _D("%s", dockercomm_docker_buffer(tasks));
- ret = DOCKER_STATUS_SERVICE_FAIL;
- }
-
- dockercomm_docker_destroy(tasks);
- } else {
- _D("getTasksInfo alloc fail");
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- return ret;
-}
-
-/**
- * @fn static int __copy_ContainersInfo(dzl_dockerctl_ServicesInfo *pstServicesInfo, dzl_dockerctl_TasksInfo *pstTasksInfo, containers_info_s *pstContainersInfo)
- * @brief This function to copy containers info from services inf and tasksinfo
- * @param *pstServicesInfo [inout] services information
- * @param *pstTasksInfo [inout] tasks information
- * @param *pstContainersInfo [inout] containers information
- * @return int return of function
- */
-static int __copy_ContainersInfo(dzl_dockerctl_ServicesInfo * pstServicesInfo, dzl_dockerctl_TasksInfo * pstTasksInfo, containers_info_s * pstContainersInfo)
-{
- int taskIdx = 0;
- int index = 0;
- int attr_len = 0;
- int ret = DOCKER_STATUS_NO_ERROR;
-
- // clear containers_info_s structure values into ZERO
- memset(pstContainersInfo, 0x0, sizeof(containers_info_s));
-
- if (pstServicesInfo == NULL || pstTasksInfo == NULL)
- return DOCKER_STATUS_UNKNOWN;
-
- _D("Count of Service [%d]", pstServicesInfo->count);
- _D("Count of Task [%d]", pstTasksInfo->count);
-
- if (pstServicesInfo->count != pstTasksInfo->count) {
- _D("count is wrong");
- return DOCKER_STATUS_UNKNOWN;
- }
-
- pstContainersInfo->count = pstServicesInfo->count;
-
- for (index = 0; index < pstContainersInfo->count; index++) {
- attr_len = strlen(pstServicesInfo->pstServices[index].id);
- if (attr_len > 0) {
- pstContainersInfo->container[index].id = (char *)malloc((attr_len + 1) * sizeof(char));
- if (pstContainersInfo->container[index].id != NULL) {
- memset(pstContainersInfo->container[index].id, 0x00, (attr_len + 1) * sizeof(char));
- memcpy(pstContainersInfo->container[index].id, pstServicesInfo->pstServices[index].id, (attr_len + 1));
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
- }
- attr_len = strlen(pstServicesInfo->pstServices[index].name);
- if (attr_len > 0) {
- pstContainersInfo->container[index].name = (char *)malloc((attr_len + 1) * sizeof(char));
- if (pstContainersInfo->container[index].name != NULL) {
- memset(pstContainersInfo->container[index].name, 0x00, (attr_len + 1) * sizeof(char));
- memcpy(pstContainersInfo->container[index].name, pstServicesInfo->pstServices[index].name, (attr_len + 1));
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
- }
- attr_len = strlen(pstServicesInfo->pstServices[index].imageName);
- if (attr_len > 0) {
- pstContainersInfo->container[index].image_name = (char *)malloc((attr_len + 1) * sizeof(char));
- if (pstContainersInfo->container[index].image_name) {
- memset(pstContainersInfo->container[index].image_name, 0x00, (attr_len + 1) * sizeof(char));
- memcpy(pstContainersInfo->container[index].image_name, pstServicesInfo->pstServices[index].imageName, (attr_len + 1));
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
- }
- }
-
- for (index = 0; index < pstContainersInfo->count; index++) {
- for (taskIdx = 0; taskIdx < pstTasksInfo->count; taskIdx++) {
- _D("C[%s]", pstContainersInfo->container[index].id);
- _D("T[%s]", pstTasksInfo->pstTasks[taskIdx].id);
- if (!strncmp(pstContainersInfo->container[index].id, pstTasksInfo->pstTasks[taskIdx].id, strlen(pstContainersInfo->container[index].id))) {
- attr_len = strlen(pstTasksInfo->pstTasks[taskIdx].status);
- if (attr_len > 0) {
- pstContainersInfo->container[index].status = (char *)malloc((attr_len + 1) * sizeof(char));
- if (pstContainersInfo->container[index].status) {
- memset(pstContainersInfo->container[index].status, 0x00, attr_len + 1);
- memcpy(pstContainersInfo->container[index].status, pstTasksInfo->pstTasks[taskIdx].status, (attr_len + 1));
- break;
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
- }
- }
- }
- }
-
- return ret;
-}
-
-/**
- * @fn static int __leave_swarm(void)
- * @brief This function to leave swarm
- * If swarm state error, it has to be left and re-init in order to set up swarm mode
- * @return int return of function
- */
-static int __leave_swarm(void)
-{
- DOCKER *docker;
- CURLcode response;
- char retUrl[256] = { 0, };
- int ret = DOCKER_STATUS_NO_ERROR;
-
- docker = dockercomm_docker_init();
-
- if (docker) {
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_SWARM_LEAVE, retUrl, sizeof(retUrl))) {
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_UNKNOWN;
- }
-
- _D("url[%s]", retUrl);
- response = dockercomm_docker_post_with_only_parameter(docker, retUrl, DOCKER_URL_SWARM_LEAVE_PARAMETER);
- if (response != CURLE_OK) {
- _D("docker curl error!!");
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
- //In case of swarm, there is two cases, inactive or error
- //In case of inactive, it will not be worked for 'leave' but error case it has to leave at least once
- _D("swarm leave !!!");
-
- dockercomm_docker_destroy(docker);
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- return ret;
-}
-
-/**
- * @fn static int __init_swarm(void)
- * @brief This function to init swarm
- * If swarm state error, it has to be left and re-init in order to set up swarm mode
- * @return int return of function
- */
-static int __init_swarm(void)
-{
- DOCKER *docker;
- char *buf = NULL;
- int buf_size = 0;
- CURLcode response;
- char retUrl[256] = { 0, };
- int ret = DOCKER_STATUS_NO_ERROR;
-
- docker = dockercomm_docker_init();
-
- if (docker) {
- buf_size = dockerform_generate_swarm_init(&buf);
- if (buf != NULL) {
- _D("swarm data = %s", buf);
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_SWARM_INIT, retUrl, sizeof(retUrl))) {
- dockercomm_docker_destroy(docker);
- free(buf);
- buf = NULL;
- return DOCKER_STATUS_UNKNOWN;
- }
-
- response = dockercomm_docker_post(docker, retUrl, buf, buf_size, CURL_CONTENT_TYPE_JSON);
- free(buf);
- buf = NULL;
-
- if (response != CURLE_OK) {
- _D("docker curl error!!");
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(docker))) {
- _D("swarm init !!!");
- } else {
- _D(dockercomm_docker_buffer(docker));
- _D("swarm init error !!!");
- ret = DOCKER_STATUS_SERVICE_FAIL;
- }
-
- dockercomm_docker_destroy(docker);
- } else {
- _D("buf NULL !!!");
- ret = DOCKER_STATUS_UNKNOWN;
- }
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- return ret;
-}
-
-/**
- * @fn static int __check_swarm_service(void)
- * @brief This function to check swarm services
- * Whether swarm is ready or not, it will check, if it is not ready, it would be left and re-init
- * @return int return of function
- */
-static int __check_swarm_service(void)
-{
- DOCKER *docker;
- CURLcode response;
- char retUrl[256] = { 0, };
- int ret = DOCKER_STATUS_NO_ERROR;
-
- docker = dockercomm_docker_init();
-
- if (docker) {
-
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_SWARM, retUrl, sizeof(retUrl))) {
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_UNKNOWN;
- }
-
- response = dockercomm_docker_get(docker, retUrl);
- if (response != CURLE_OK) {
- _D("docker curl error!!");
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(docker))) {
- _D("Swarm is already init");
- } else {
- _D("Swarm has to be R-initialized");
- _D("%s", dockercomm_docker_buffer(docker));
- if (DOCKER_STATUS_NO_ERROR == __leave_swarm()) {
- if (DOCKER_STATUS_NO_ERROR == __init_swarm()) {
- _D("Swarm init OK");
- } else {
- _E("Swarm init Fail");
- ret = DOCKER_STATUS_SERVICE_FAIL;
- }
- } else {
- _E("Swarm leave error");
- ret = DOCKER_STATUS_SERVICE_FAIL;
- }
- }
-
- dockercomm_docker_destroy(docker);
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- return ret;
-}
-
-/**
- * @fn static int dzl_dockerctl_enable_swarm_service(void)
- * @brief This function to enable swarm services
- * Wrapper function to include swarm check / leave / init
- * @return int return of function
- */
-int dzl_dockerctl_enable_swarm_service(void)
-{
- int ret = DOCKER_STATUS_NO_ERROR;
-
- ret = __check_swarm_service();
- _D("check swarm [%d]", ret);
-
- return ret;
-}
-
-/**
- * @fn static int __CLI_command(char *cmd, int get_output, char **ret_buf)
- * @brief This function to run command for daemon
- * @param *cmd [in] command to run
- * @param get_output [in] the way to get ouput of the command
- * @param * ret_buf [in] output of the command
- * @return int return of function
- */
-static docker_status_e __CLI_command(char *cmd, int get_output, char **ret_buf)
-{
- FILE *stream = NULL;
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
- int index = 0;
- int ch = 0;
- char *buf = NULL;
-
- if (strlen(cmd) > 0) {
- stream = popen(cmd, "r");
- if (stream != NULL) {
- switch (get_output) {
- case 0: /* no message */
- //_D("cmd[%s] no output message !!", cmd);
- break;
- case 1: /* to get a specific string */
- //_D("get a specific string");
- buf = (char *)malloc(MAXLINE * sizeof(char));
- if (buf != NULL) {
- memset(buf, 0x0, MAXLINE * sizeof(char));
- while ((index < MAXLINE) && ((ch = getc(stream)) != EOF) && (ch != '\n') && (ch != 13/* charage return */))
- buf[index++] = ch;
- //_D("buf:%s(%d)", buf, index);
- }
- break;
- case 2: /* to get logs */
- //_D("get logs");
- buf = (char *)malloc(LOG_BUF_LEN * sizeof(char));
- if (buf != NULL) {
- memset(buf, 0x0, LOG_BUF_LEN * sizeof(char));
- while ((index < LOG_BUF_LEN) && ((ch = getc(stream)) != EOF))
- buf[index++] = ch;
- //_D("buf:%s(%d)", buf, index);
- }
- break;
- default:
- _E("no output message !!");
- break;
- }
- pclose(stream);
- } else {
- _E("popen error !!!");
- }
- } else
- ret = DOCKER_STATUS_INVALID_PARAM;
-
- if (buf)
- *ret_buf = buf;
-
- return ret;
-}
-
-/**
- * @fn static int __check_dockerd_state(void)
- * @brief This function to check docker engine state
- * @return int return of docker engine state
- */
-static int __check_dockerd_state(void)
-{
- CURLcode response;
- DOCKER *docker;
- char retUrl[256] = { 0, };
- int ret = DOCKER_STATUS_NO_ERROR;
-
- _D("check docker daemon !!!");
-
- docker = dockercomm_docker_init();
-
- if (docker) {
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_PING, retUrl, sizeof(retUrl))) {
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_UNKNOWN;
- }
-
- response = dockercomm_docker_get(docker, retUrl);
-
- if (response != CURLE_OK) {
- _E("curl Error!!");
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- _D("__check_dockerd_state = %s", dockercomm_docker_buffer(docker));
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(docker))) {
- _D("engine ok [%s]", dockercomm_docker_buffer(docker));
- } else {
- _E("Engine Fail");
- _E("%s", dockercomm_docker_buffer(docker));
- ret = DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- dockercomm_docker_destroy(docker);
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- return ret;
-}
-
-/**
- * @fn static int __check_docker_engine_binary(char *path)
- * @brief This function to check whether docker engine binary is exist or not
- * @param *path [in] dpath of docker engine binary
- * @return int result of function
- */
-static int __check_docker_engine_binary(char *path)
-{
- char daemon[256] = { 0, };
- int ret = 0;
-
- snprintf(daemon, sizeof(daemon), "%s/%s", path, DOCKER_DAEMON);
-
- ret = access(daemon, 0);
-
- if (ret != 0) {
- _D("no exists docker file");
- return -1;
- }
-
- _D("__check_docker_engine_binary ret[%d]", ret);
- return ret;
-}
-
-/**
- * @fn static int __which_number(char *s)
- * @brief This function to convert string value to int in range of number type(0-9)
- * @param *s [in] number string
- * @return int converted number from string
- */
-static int __which_number(char *s)
-{
- int len, i;
- len = strlen(s);
-
- for (i = 0; i < len; i++)
- if ((s[i] < '0' || s[i] > '9'))
- return -1;
-
- return atoi(s);
-}
-
-/**
- * @fn static int __get_process_pid(char *str)
- * @brief This function to get process id of docker engine
- * @param *str [in] string of finding daemon
- * @return int process id or -1 if it is not existed
- */
-static int __get_process_pid(char *str)
-{
- char cmd[100] = { 0, };
- char *ret_str = NULL;
- int pid = -1;
- int ret = 0;
-
- snprintf(cmd, sizeof(cmd), "pgrep -f %s", str);
- //_D("get_process_pid cmd = [%s](%d)", cmd, strlen(cmd));
- ret = __CLI_command(cmd, 1, &ret_str);
- if (ret_str != NULL) {
- pid = atoi(ret_str);
- free(ret_str);
- }
- return pid;
-}
-
-/**
- * @fn static int __get_status_pid(int pid)
- * @brief This function to get pid status
- * @param pid [in] pid number
- * @return int status of pid, 0(alive), -1(not exist)
- */
-static int __get_status_pid(int pid)
-{
- char path[100] = { 0, };
- FILE *fp;
-
- snprintf(path, 100, "/proc/%d/status", pid);
-
- fp = fopen(path, "r");
- if (fp == NULL) {
- _E("proc error !!");
- return -1;
- }
-
- fclose(fp);
-
- return 0;
-}
-
-static char *__generate_dockerd_env(void)
-{
- char *proxy_cmd = NULL;
- char *ret_str = NULL;
- char http_proxy[512] = { 0, };
- char https_proxy[512] = { 0, };
- int cmd_len = 0;
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
-
- // get http_proxy and https_proxy
- ret = __CLI_command(GET_HTTP_PROXY_CMD, 1, &ret_str);
- if (ret_str != NULL) {
- if (strlen(ret_str) > 0) {
- snprintf(http_proxy, sizeof(http_proxy), "http_proxy=\"http://%s\"", ret_str);
- cmd_len += strlen(http_proxy);
- }
- free(ret_str);
- ret_str = NULL;
- }
- ret = __CLI_command(GET_HTTPS_PROXY_CMD, 1, &ret_str);
- if (ret_str != NULL) {
- if (strlen(ret_str) > 0) {
- snprintf(https_proxy, sizeof(https_proxy), "https_proxy=\"http://%s\"", ret_str);
- cmd_len += strlen(https_proxy);
- }
- free(ret_str);
- ret_str = NULL;
- }
-
- if (cmd_len > 0) {
- proxy_cmd = (char *)malloc((cmd_len + 2) * sizeof(char));
- if (proxy_cmd != NULL) {
- snprintf(proxy_cmd, cmd_len + 2, "%s %s", http_proxy, https_proxy);
- //_D("proxy_cmd = [%s](%d)", proxy_cmd, strlen(proxy_cmd));
- }
- }
-
- return proxy_cmd;
-}
-
-/**
- * @fn static docker_status_e __start_dockerd(docker_control_info_s *ctl_docker_p)
- * @brief This function to start docker engine through cli command
- * @param *ctl_docker_p [in] path and options for docker engine to run
- * @return docker_status_e return of function
- */
-static docker_status_e __start_dockerd(docker_control_info_s * ctl_docker_p)
-{
- char command[512] = { 0, };
- char dockerd_cmd[256] = { 0, };
- int pid = 0;
- int index = 0;
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
- char *proxy_cmd = NULL;
- /*
- This function has to do a few things to get things done.
- 1) Whether docker engine is alive or not
- 1) Whether binary is existed or not
- 2) daemon is created or not
- 3) retry
- */
-
- ret = __check_dockerd_state();
- if (ret == DOCKER_STATUS_NO_ERROR) {
- _D("already started dockerd");
- return ret;
- }
-
- if (0 != __check_docker_engine_binary(ctl_docker_p->path)) {
- _E("Not exists docker file");
- return DOCKER_STATUS_ENGINE_FAIL;
- }
-
- memset(dockerd_cmd, 0x00, sizeof(dockerd_cmd));
- if (dockerform_genetate_docker_cmd(ctl_docker_p, DOCKER_DAEMON, dockerd_cmd, sizeof(dockerd_cmd))) {
- _E("dockerform generate docker cmd has a problem");
- return DOCKER_STATUS_UNKNOWN;
- }
-
- /* get environments for docker daemon */
- proxy_cmd = __generate_dockerd_env();
- if (proxy_cmd != NULL) {
- snprintf(command, sizeof(command), "%s %s", proxy_cmd, dockerd_cmd);
- free(proxy_cmd);
- } else {
- snprintf(command, sizeof(command), "%s", dockerd_cmd);
- }
- _D("start dockerd command : [%s]", command);
-
- ret = __CLI_command(command, 0, NULL);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _D("__CLI_command ret[%d]", ret);
- return ret;
- }
-
- /* Check docker daemon is alive or not
- Even though dockerd is okay, but pricoess id or status will not be opened, because of wrong parameter
- */
- for (index = 0; index < DOCKER_ENGINE_RETRY_MAX; index++) {
- pid = __get_process_pid(DOCKER_DAEMON);
- if (pid == -1) {
- _E("dockerd process is not exist");
- ret = DOCKER_STATUS_ENGINE_FAIL;
- } else {
- if (-1 == __get_status_pid(pid)) {
- _E("docker process is removed");
- return DOCKER_STATUS_ENGINE_FAIL;
- } else {
- sleep(2);
- ret = DOCKER_STATUS_NO_ERROR;
- break;
- }
- }
- sleep(1);
- }
-
- // if launcher is restarted while container is running, we should update docker service.
- if (ret == DOCKER_STATUS_NO_ERROR) {
- _D("docker service update ~~~~~~~~~~~");
- ret = __CLI_command(DOCKER_SERVICE_UPDATE, 0, NULL);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _D("__CLI_command ret[%d]", ret);
- return ret;
- }
- }
-
- return ret;
-}
-
-/**
- * @fn static int __load_image(char *filename)
- * @brief This function to request loading image according to source of image
- * @param *image [in] whole name of file
- * @return int result of function
- */
-
-static int __load_image(char *filename)
-{
- DOCKER *docker;
- char retUrl[256] = { 0, };
- char *post_data = NULL;
- int post_data_size = 0;
- CURLcode response;
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
-
- if (strlen(filename) > 0) {
- docker = dockercomm_docker_init();
- post_data_size = dockerform_generate_imageload_file(filename, &post_data);
-
- if (docker) {
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_IMAGE_LOAD, retUrl, sizeof(retUrl))) {
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_UNKNOWN;
- }
-
- _D("url[%s], filename[%s]", retUrl, filename);
- response = dockercomm_docker_post(docker, retUrl, post_data, post_data_size, CURL_CONTENT_TYPE_TAR);
- if (post_data != NULL) {
- free(post_data);
- post_data = NULL;
- }
-
- if (response != CURLE_OK) {
- _E("docker daemon error!!");
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(docker))) {
- _D("load image request ok");
- } else {
- _E("Engine fail");
- _E("%s", dockercomm_docker_buffer(docker));
- ret = DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- dockercomm_docker_destroy(docker);
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
- } else {
- ret = DOCKER_STATUS_INVALID_PARAM;
- _D("load image parameter invalid");
- }
-
- if (post_data != NULL)
- free(post_data);
-
- _D("End of load image");
- return ret;
-}
-
-/**
- * @fn static int __pull_image(char *image)
- * @brief This function to request pulling image according to source of image
- * @param *image [in] whole name of image
- * @return int result of function
- */
-static int __pull_image(char *image)
-{
- DOCKER *docker;
- char retUrl[256] = { 0, };
- char imageName[256] = { 0, };
- CURLcode response;
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
-
- if (strlen(image) > 0) {
- docker = dockercomm_docker_init();
-
- if (docker) {
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_IMAGE_CREATE, retUrl, sizeof(retUrl))) {
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_UNKNOWN;
- }
-
- snprintf(imageName, sizeof(imageName), "fromImage=%s", image);
- _D("url[%s], imageName[%s]", retUrl, imageName);
- response = dockercomm_docker_post_with_only_parameter(docker, retUrl, imageName);
-
- if (response != CURLE_OK) {
- _E("docker daemon error!!");
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(docker))) {
- _D("pull image request ok");
- } else {
- _E("Engine fail");
- _E("%s", dockercomm_docker_buffer(docker));
- ret = DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- dockercomm_docker_destroy(docker);
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
- } else {
- ret = DOCKER_STATUS_INVALID_PARAM;
- _D(" pull image parameter invalid");
- }
-
- _D("End of pull image");
- return ret;
-}
-
-/**
- * @fn static int __start_containers(container_create_info_s *info)
- * @brief This function to request starting containers with create parameters
- * @param *image [in] creation parameters for container
- * @return int result of function
- */
-static int __start_containers(container_create_info_s * info)
-{
- char *ret_buf = NULL;
- int ret_buf_size = 0;
- char retUrl[256] = { 0, };
- CURLcode response;
- DOCKER *docker;
- int ret = DOCKER_STATUS_NO_ERROR;
-
- _D("Start container starts");
- ret_buf_size = dockerform_generate_imagecreate_data(info, &ret_buf);
-
- if (ret_buf != NULL) {
- docker = dockercomm_docker_init();
- if (docker != NULL) {
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_SERVICE_CREATE, retUrl, sizeof(retUrl))) {
- free(ret_buf);
- ret_buf = NULL;
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_UNKNOWN;
- }
-
- response = dockercomm_docker_post(docker, retUrl, ret_buf, ret_buf_size, CURL_CONTENT_TYPE_JSON);
-
- free(ret_buf);
- ret_buf = NULL;
-
- if (response != CURLE_OK) {
- _E("docker daemon error!!");
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(docker))) {
- _D("Engine ok");
- } else {
- _E("Engine fail");
- _E("%s", dockercomm_docker_buffer(docker));
- ret = DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- dockercomm_docker_destroy(docker);
- } else {
- free(ret_buf);
- ret_buf = NULL;
- ret = DOCKER_STATUS_UNKNOWN;
- }
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- return ret;
-}
-
-/**
- * @fn static int __check_service_with_name(char *name, dzl_dockerctl_serviceinfo_s *service_info)
- * @brief This function to check service based on name
- * @param *name [in] name of service
- * @param *service_info [inout] structure of service to fill information
- * @return int result of function
- */
-static int __check_service_with_name(char *name, dzl_dockerctl_serviceinfo_s * service_info)
-{
- CURLcode response;
- DOCKER *docker;
- char requestUrl[256] = { 0, };
- char retUrl[256] = { 0, };
- int ret = DOCKER_STATUS_NO_ERROR;
-
- _D("__check_service_with_name !!!\n");
-
- if (strlen(name) == 0)
- return DOCKER_STATUS_INVALID_PARAM;
-
- _D("container check = [%s] \n", name);
-
- docker = dockercomm_docker_init();
-
- if (docker) {
- snprintf(requestUrl, (strlen(DOCKER_URL_SERVICES) + strlen(name) + 2), "%s/%s", DOCKER_URL_SERVICES, name);
- _D("requestUrl = %s", requestUrl);
-
- if (dockerform_generate_url(DOCKER_API_VERSION, requestUrl, retUrl, sizeof(retUrl))) {
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_UNKNOWN;
- }
-
- response = dockercomm_docker_get(docker, retUrl);
-
- if (response != CURLE_OK) {
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(docker))) {
- _D("service ok");
- ret = dockerform_generate_service_withid_info(dockercomm_docker_buffer(docker), service_info);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- dockercomm_docker_destroy(docker);
- return ret;
- }
- } else {
- _E("Engine Fail");
- ret = DOCKER_STATUS_ENGINE_API_FAIL;
- _D("%s", dockercomm_docker_buffer(docker));
- }
-
- dockercomm_docker_destroy(docker);
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- return ret;
-}
-
-/**
- * @fn static container_status_e __find_service_status(char *status)
- * @brief This function to find status according to astServiceStatusTbl
- * Docker engine provides various status, but dockzen doesn't need to use all
- * In case of service, it will retur service status, but has to be matched with own conainer status
- * @param *status [in] raw status
- * @return int converted container status from table
- */
-static container_status_e __find_service_status(char *status)
-{
- int index = 0;
-
- for (index = 0; index < STATUS_MAX_NUM; index++) {
- if (!strncmp(status, astSeviceStatusTbl[index].task_status, strlen(status)))
- return astSeviceStatusTbl[index].status;
- }
-
- return -1;
-}
-
-/**
- * @fn static container_status_e __find_event_container_status(char *status)
- * @brief This function to find status according to astEventStatusTbl
- * Docker engine provides various status, but dockzen doesn't need to use all
- * In case of event, it will returb container status, but has to be matched with own container status
- * @param *status [in] raw status
- * @return int converted container status from table
- */
-static container_status_e __find_event_container_status(char *status)
-{
- int index = 0;
-
- for (index = 0; index < EVEVT_STATUS_MAX_NUM; index++) {
- if (!strncmp(status, astEventStatusTbl[index].task_status, strlen(status)))
- return astEventStatusTbl[index].status;
- }
-
- return -1;
-}
-
-/**
- * @fn static container_status_e __check_status_task_with_name(char *container_name, char *service_id, dzl_dockerctl_TasksInfo *tasks_info_p)
- * @brief This function to request for checking task based on name
- * @param *container_name [in] container name
- * @param *service_id [in] service id
- * @param *tasks_info_p [in] task information
- * @return int container status
- */
-static container_status_e __check_status_task_with_name(char *container_name, char *service_id, dzl_dockerctl_TasksInfo * tasks_info_p)
-{
- int index = 0;
- int attr_len = 0;
- container_status_e status = CONTAINER_STATUS_UNKNOWN;
-
- if ((container_name == NULL || service_id == NULL) || tasks_info_p == NULL) {
- _D("__check_status_task_with_name Invalid params");
- return -1;
- }
-
- _D("ID[%s]", service_id);
-
- for (index = 0; index < tasks_info_p->count; index++) {
- _D("T[%s]", tasks_info_p->pstTasks[index].id);
- if (!strncmp(service_id, tasks_info_p->pstTasks[index].id, strlen(service_id))) {
- attr_len = strlen(tasks_info_p->pstTasks[index].status);
- if (attr_len > 0) {
- status = __find_service_status(tasks_info_p->pstTasks[index].status);
- if (status != -1) {
- _D("__check_status_task_with_name status [%d]", status);
- return status;
- }
- }
- break;
- }
- }
-
- return status;
-}
-
-/**
- * @fn static int __update_image(dzl_dockerctl_serviceinfo_s *service_info, char *image)
- * @brief This function to request for updating of image
- * @param *service_info [in] service information to generate update info
- * @param *image [in] image name to update
- * @return int result of function
- */
-static int __update_image(dzl_dockerctl_serviceinfo_s * service_info, char *image)
-{
- CURLcode response;
- DOCKER *docker;
- char *post_data = NULL;
- int post_data_size = 0;
- char updateName[256] = { 0, };
- char retUrl[256] = { 0, };
- int ret = DOCKER_STATUS_NO_ERROR;
-
- docker = dockercomm_docker_init();
-
- if (docker) {
- post_data_size = dockerform_generate_updateinfo(service_info, image, &post_data);
-
- if (post_data != NULL) {
- _D("service ID[%s]", service_info->id);
- _D("service Version[%d]", service_info->version);
-
- snprintf(updateName, sizeof(updateName), "%s/%s/update?registryAuthFrom=spec&version=%d", DOCKER_URL_SERVICES, service_info->id, service_info->version);
-
- if (dockerform_generate_url(DOCKER_API_VERSION, updateName, retUrl, sizeof(retUrl))) {
- free(post_data);
- post_data = NULL;
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_UNKNOWN;
- }
-
- response = dockercomm_docker_post(docker, retUrl, post_data, post_data_size, CURL_CONTENT_TYPE_JSON);
- free(post_data);
-
- if (response != CURLE_OK) {
- _E("curl Error!!\n");
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(docker))) {
- _D("update request ok");
- } else {
- ret = DOCKER_STATUS_ENGINE_API_FAIL;
- _E("Engine Fail");
- _E("%s", dockercomm_docker_buffer(docker));
- }
-
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- dockercomm_docker_destroy(docker);
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- return ret;
-}
-
-/**
- * @fn static int __request_monitor_events(docker_event_cb callback)
- * @brief This function to request monitor events and register callback function to be triggered
- * @param callback [in] callback function
- * @return int result of function
- */
-static int __request_monitor_events(docker_event_cb callback)
-{
- DOCKER *docker;
- CURLcode response;
- char retUrl[256] = { 0, };
- char filter[256] = { 0, };
- char opt_filter[100] = "filters={\"type\":{\"container\":true}}";
- int ret = DOCKER_STATUS_NO_ERROR;
-
- docker = dockercomm_docker_init();
-
- _D("start monitor event");
- if (docker) {
- snprintf(filter, sizeof(filter), "%s?%s", DOCKER_URL_EVENTS, opt_filter);
- if (dockerform_generate_url(DOCKER_API_VERSION, filter, retUrl, sizeof(retUrl))) {
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_UNKNOWN;
- }
-
- _D("url[%s]", retUrl);
- response = dockercomm_docker_get_chunked_data(docker, retUrl, callback);
- _D("finish event from curl");
-
- if (response != CURLE_OK) {
- _E("curl Error!!\n");
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- dockercomm_docker_destroy(docker);
- }
-
- _D("end monitor event");
-
- return ret;
-}
-
-/**
- * @fn static int __initialzie_docker_api(void)
- * @brief This function to check docker engine api, it will check maximum 30 sec
- * @return int result of function
- */
-static int __initialzie_docker_api(void)
-{
- int index = 0;
- int ret = DOCKER_STATUS_NO_ERROR;
-
- for (index = 0; index < DOCKER_ENGINE_API_RETRY_MAX; index++) {
- ret = __check_dockerd_state();
- if (ret == DOCKER_STATUS_NO_ERROR) {
- break;
- } else if (ret == DOCKER_STATUS_UNKNOWN) {
- ret = DOCKER_STATUS_UNKNOWN;
- _D("__check_dockerd_state unknown [%d]", ret);
- break;
- } else {
- ret = DOCKER_STATUS_ENGINE_API_FAIL;
- _D("__check_dockerd_state [%d]", ret);
- }
- sleep(1);
- }
-
- return ret;
-}
-
-/**
- * @fn static void __interface_server_loop(void)
- * @brief This function to run main loop for interface server
- * It will be dealt with command
- * @return void
- */
-static void *__interface_server_loop(void *pv)
-{
- docker_status_e ret = 0;
- int msgqid = 0;
- int msg_size = 0;
- int docker_status = 0;
- int container_status = 0;
- dzl_dockerctl_msgq_buf_s msg_buf;
- dzl_dockerctl_Task task_info = { 0, };
-
- _D("__interface_server_loop start\n");
-
- msgqid = __get_dzl_dockerctl_msg_queue_id();
- if (0 == msgqid) {
- _D("msgqid is zero");
- return NULL;
- }
-
- msg_size = sizeof(dzl_dockerctl_msgq_buf_s) - sizeof(msg_buf.mtype);
-
- while (1) {
- if (msgrcv(msgqid, &msg_buf, msg_size, 0, 0) == -1)
- _E("msgrcv error(%d)", errno);
-
- switch (msg_buf.cmd) {
- case DZL_DOCKERCTL_DOCKER_START:
- _D("DZL_DOCKERCTL_DOCKER_START");
- ret = dzl_dockerctl_enable_swarm_service();
- _D("swarm return ret[%d]", ret);
- docker_status = ret;
- dzl_dockerctl_callback(SM_TYPE_DOCKER_STATUS, &docker_status, NULL);
- break;
- case DZL_DOCKERCTL_CONTAINER_STATUS_CHANGE:
- _D("DZL_DOCKERCTL_CONTAINER_STATUS_CHANGE");
- char *p = msg_buf.event_data;
-
- if (!dockerform_parse_container_info(p, &task_info)) {
- container_status = __find_event_container_status(task_info.status);
- if (-1 != container_status) {
- _D("container_name:%s", task_info.id);
- _D("container_status:%d", container_status);
- _D("callback from docker interface");
- dzl_dockerctl_callback(SM_TYPE_CONTAINER_STATUS, task_info.id, &container_status); // service name, status
- }
- }
- if (p != NULL)
- free(p);
- break;
- case DZL_DOCKERCTL_DOCKER_STATUS_CHANGE:
- _D("DZL_DOCKERCTL_DOCKER_STATUS_CHANGE");
- docker_status = __check_dockerd_state();
- _D("docker_status ret[%d]", ret);
- dzl_dockerctl_callback(SM_TYPE_DOCKER_STATUS, &docker_status, NULL);
- break;
- default:
- break;
- }
- }
-
- pthread_exit((void *)0);
- return NULL;
-}
-
-/**
- * @fn static void __interface_event_loop(void)
- * @brief This function to run event loop for checking event from docker engine
- * It will be dealt with events
- * @return void
- */
-static void *__interface_event_loop(void *pv)
-{
- int ret = 0;
- int docker_status;
- dzl_dockerctl_msgq_buf_s msg_buf;
-
- _D("__interface_event_loop start\n");
-
- // In case of dockzen f/w is ready, it will be triggered to return f/w is idle
- docker_status = __initialzie_docker_api();
- msg_buf.cmd = DZL_DOCKERCTL_DOCKER_START;
- msg_buf.docker_status = docker_status;
-
- __interface_send_message(&msg_buf);
- if (docker_status != DOCKER_STATUS_NO_ERROR) {
- _E("__interface_event_loop error");
- pthread_exit((void *)0);
- return NULL;
- }
-
- /* In case of running time, check event from daemon.
- It will be waited before disconnection the request and send message to notify engine stauts.
- Because when the __request_monitor_events is finished which means docker daemon is not able to return
- If the messge is sent, it whould be retry to start monitoring but the same message will not be triggered
- */
- while (1) {
- _D("start monitor events");
- ret = __request_monitor_events(__read_docker_event_callback);
- _D("__monitor_events ret[%d]", ret);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- msg_buf.cmd = DZL_DOCKERCTL_DOCKER_STATUS_CHANGE;
- msg_buf.docker_status = ret;
- __interface_send_message(&msg_buf);
- }
-
- sleep(1);
- }
-
- pthread_exit((void *)0);
- return NULL;
-}
-
-/**
- * @fn static docker_status_e __init_interface_server(void)
- * @brief This function to init interface server
- * check docker engine api server and create thread/message queue
- * If interface server is initialized, initialize_docker_if_flag will be set as 1
- * @return docker_status_e result of function
- */
-static docker_status_e __init_interface_server(void)
-{
- pthread_t p_thread;
- pthread_t p_event_thread;
-
- _D("__init_interface_server");
-
- if (DZL_DOCKERCTL_STATUS_INITIALIZED == __get_dzl_dockerctl_initialized()) {
- _W("Already initialized");
- return DOCKER_STATUS_NO_ERROR;
- }
-
- dzl_dockerctl_msg_queue_id = msgget((key_t) DOCKER_INTERFACE_QID, IPC_CREAT | 0666);
-
- _D("docker if queue %d", dzl_dockerctl_msg_queue_id);
- if (pthread_create(&p_thread, NULL, &__interface_server_loop, "dockzenif") < 0) {
- _E("__init_interface_server main create error");
- return DOCKER_STATUS_UNKNOWN;
- }
-
- if (pthread_create(&p_event_thread, NULL, &__interface_event_loop, "dockzenev") < 0) {
- _E("__init_interface_server event_thread create error");
- return DOCKER_STATUS_UNKNOWN;
- }
-
- initialize_dzl_dockerctl_flag = DZL_DOCKERCTL_STATUS_INITIALIZED;
-
- return DOCKER_STATUS_NO_ERROR;
-}
-
-/**
- * @fn static int __update_task_history_1()
- * @brief This function to set task history as 1
- * Set up the history of swarm task as 1, dockzen refers to the lastest task
- * If swarm is ready, call this function to set up
- * @return int result of function
- */
-static docker_status_e __update_task_history_1(void)
-{
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
- ret = __CLI_command("docker swarm update --task-history-limit 1", 0, NULL);
-
- return ret;
-}
-
-static int __get_dockerd_path(char **dockerd_path)
-{
- FILE *stream = NULL;
- char buf[128] = { 0, };
- char cmd[128] = { 0, };
-
- snprintf(cmd, sizeof(cmd), "type %s | sed -e 's;^.* ;;' | sed -e 's/\\/%s//g'", DOCKER_DAEMON, DOCKER_DAEMON);
- stream = popen(cmd, "r");
-
- if (stream == NULL) {
- _D("popen failed");
- return DOCKER_STATUS_UNKNOWN;
- } else {
- fgets(buf, 128, stream);
-
- *dockerd_path = (char *)malloc(strlen(buf) + 1);
- memset(*dockerd_path, 0x00, strlen(buf) + 1);
- if (strlen(buf) > 0)
- strncpy(*dockerd_path, buf, strlen(buf) - 1); // "-1" means that last charactor of "/n" is removed
- _D("docker daemon path: %s(%d)", *dockerd_path, (unsigned int)strlen(buf));
- }
- pclose(stream);
- return DOCKER_STATUS_NO_ERROR;
-}
-
-static void __destory_dockerd_memory(docker_control_info_s * ctl_docker_p)
-{
- if (ctl_docker_p != NULL) {
- if (ctl_docker_p->path != NULL)
- free(ctl_docker_p->path);
-
- free(ctl_docker_p);
- }
-
-}
-
-/**
- * @fn static int __send_message(sm_msgq_buf_s *msg_buf)
- * @brief This function to send message
- * @param *msg_buf [in] sm_sgq_buf structure to send message
- * @return int result of function
- */
-static int __send_message(sm_msgq_buf_s * msg_buf)
-{
- int msgqid;
- int msg_size;
-
- msg_buf->mtype = STATEMACHINE_QID;
- msg_size = sizeof(sm_msgq_buf_s) - sizeof(msg_buf->mtype);
- msgqid = msgget((key_t) STATEMACHINE_QID, IPC_CREAT | 0666);
- _D("msgqid:%d", msgqid);
-
- if (msgsnd(msgqid, msg_buf, msg_size, 0) == -1) {
- _E("msgsnd error(%d)", errno);
- return -1;
- }
- return 0;
-}
-
-static docker_status_e __docker_interface_load_image(char *filename)
-{
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
-
- if (access(filename, F_OK) == -1) {
- _D("no pre-installed image");
- return DOCKER_STATUS_INVALID_PARAM;
- }
-
- ret = __check_dockerd_state();
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("Docker Engine error");
- return ret;
- }
-
- ret = __load_image(filename);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("load image error[%d]", ret);
- return ret;
- }
-
- return ret;
-}
-
-/*
-* load user containers from tar archive
-*/
-int dzl_dockerctl_pre_installed_container_load(void)
-{
- int count, i, ret = -1;
- char file_name[FILE_PATH_MAX] = { 0, };
-
- count = dzl_setting_get_pre_installed_file_cnt();
- if (count == 0) {
- _E("there is no pre_installed container archive file");
- } else {
- _D("pre_installed image count : %d", count);
- for (i = 0; i < count; i++) {
- memset(file_name, 0x00, sizeof(file_name));
- ret = dzl_setting_get_pre_installed_filename(i, file_name);
- if (ret == 0) {
- _D("pre_installed_file_list[%d] : %s", i, file_name);
- if (__docker_interface_load_image(file_name) == DOCKER_STATUS_NO_ERROR)
- _D("image {%s} load success", file_name);
- else
- _E("image {%s} load fail", file_name);
- } else
- _E("dzl_setting_get_pre_installed_filename error!!!");
- }
- _D("pre_installed image loading completed!!!!");
- }
- return DOCKER_STATUS_NO_ERROR;
-}
-
-docker_status_e docker_interface_start(char *dockerd_opt_cmd, status_monitor_cb callback)
-{
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
- docker_control_info_s *ctl_docker_p = NULL;
- initialize_dzl_dockerctl_flag = DZL_DOCKERCTL_STATUS_NOT_READY;
-
- ctl_docker_p = (docker_control_info_s *) malloc(sizeof(docker_control_info_s));
- if (ctl_docker_p == NULL) {
- _E("alloc fail for ctl_docker_p");
- return DOCKER_STATUS_UNKNOWN;
- }
-
- memset(ctl_docker_p, 0x00, sizeof(docker_control_info_s));
-
- __get_dockerd_path(&ctl_docker_p->path);
- ctl_docker_p->opt_cmd = dockerd_opt_cmd;
-
- _D("ctl_docker_p->path: %s", ctl_docker_p->path);
- _D("ctl_docker_p->opt_cmd: %s", ctl_docker_p->opt_cmd);
-
- /* Check docker daemon state first, if dockerd is already run, skip to run dockerd check interface server
- Here is steps
- 1) start daemon
- 2) interface server
- 3) register callback
- 4) update task history to maintain only 1 container according to service
- */
- do {
- ret = __start_dockerd(ctl_docker_p);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("__start_dockerd ret [%d]", ret);
- break;
- }
-
- ret = __init_interface_server();
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("__init_interface_server ret [%d]", ret);
- break;
- }
-
- ret = __register_dzl_dockerctl_callback(callback);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("__init_interface_server ret [%d]", ret);
- break;
- }
- /*
- update docker swarm option. default task history is et to 10.
- as to simplify the parsing of containers info, we should set it as 1
- during processing, if more than 1, error will be occured.
- */
- ret = __update_task_history_1();
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("__update_task_history_1 ret [%d]", ret);
- break;
- }
- } while (0);
-
- __destory_dockerd_memory(ctl_docker_p);
- return ret;
-}
-
-docker_status_e docker_interface_pull_image(char *image)
-{
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
-
- if (strlen(image) == 0)
- return DOCKER_STATUS_INVALID_PARAM;
-
- ret = __check_dockerd_state();
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("Docker Engine error");
- return ret;
- }
-
- ret = __pull_image(image);
- _D("pull Image State[%d]", ret);
-
- return ret;
-}
-
-docker_status_e docker_interface_create_container(container_create_info_s * create_info_p)
-{
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
-
- ret = __check_dockerd_state();
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("Docker Engine error");
- return ret;
- }
-
- ret = __start_containers(create_info_p);
- _D("start service State[%d]", ret);
-
- return ret;
-}
-
-docker_status_e docker_interface_containers_info(containers_info_s * info_p)
-{
- dzl_dockerctl_TasksInfo stTasksInfo = { 0, };
- dzl_dockerctl_ServicesInfo stServicesInfo = { 0, };
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
- int structCnt = 0;
- int index;
-
- ret = __check_dockerd_state();
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("Docker Engine error");
- return ret;
- }
-
- _D("__get_services_info start");
- ret = __get_services_info(&stServicesInfo);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("__get_services_info error [%d]", ret);
- if (stServicesInfo.pstServices != NULL)
- free(stServicesInfo.pstServices);
- return ret;
- }
-
- _D("__get_tasks_Info start");
- ret = __get_tasks_Info(&stTasksInfo);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _E("__get_tasks_Info error [%d]", ret);
- if (stServicesInfo.pstServices != NULL)
- free(stServicesInfo.pstServices);
- if (stTasksInfo.pstTasks != NULL)
- free(stTasksInfo.pstTasks);
- return ret;
- }
-
- structCnt = stServicesInfo.count;
-
- // service and tasks structure generated
- if (__copy_ContainersInfo(&stServicesInfo, &stTasksInfo, info_p)) {
- for (index = 0; index < structCnt; index++) {
- if (info_p->container[index].id != NULL)
- free(info_p->container[index].id);
- if (info_p->container[index].name != NULL)
- free(info_p->container[index].name);
- if (info_p->container[index].image_name != NULL)
- free(info_p->container[index].image_name);
- if (info_p->container[index].status != NULL)
- free(info_p->container[index].status);
- }
- if (stServicesInfo.pstServices != NULL)
- free(stServicesInfo.pstServices);
- if (stTasksInfo.pstTasks != NULL)
- free(stTasksInfo.pstTasks);
-
- return DOCKER_STATUS_UNKNOWN;
- }
-
- if (stServicesInfo.pstServices != NULL)
- free(stServicesInfo.pstServices);
- if (stTasksInfo.pstTasks != NULL)
- free(stTasksInfo.pstTasks);
-
- for (int index = 0; index < info_p->count; index++) {
- _D("dzl_dockerctl Container[%d] ID = [%s]", index, info_p->container[index].id);
- _D("dzl_dockerctl Container[%d] Name = [%s]", index, info_p->container[index].name);
- _D("dzl_dockerctl Container[%d] ImageName = [%s]", index, info_p->container[index].image_name);
- _D("dzl_dockerctl Container[%d] Status = [%s]", index, info_p->container[index].status);
- }
-
- _D("return containerInfo");
- return ret;
-}
-
-docker_status_e docker_interface_update_container(container_update_s * update_info_p)
-{
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
- dzl_dockerctl_serviceinfo_s serviceInfo = { 0, };
-
- if (strlen(update_info_p->container_name) == 0 || strlen(update_info_p->image_name) == 0) {
- _D("Invalid Update Params");
- return DOCKER_STATUS_INVALID_PARAM;
- }
-
- _D("container[%s]", update_info_p->container_name);
- _D("image[%s]", update_info_p->image_name);
-
- ret = __check_dockerd_state();
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _D("Docker Engine error");
- return ret;
- }
-
- ret = __check_service_with_name(update_info_p->container_name, &serviceInfo);
- _D("check service with name [%d]", ret);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- if (serviceInfo.id != NULL)
- free(serviceInfo.id);
- if (serviceInfo.spec_config != NULL)
- free(serviceInfo.spec_config);
- return ret;
- }
-
- ret = __update_image(&serviceInfo, update_info_p->image_name);
-
- if (serviceInfo.id != NULL)
- free(serviceInfo.id);
- if (serviceInfo.spec_config != NULL)
- free(serviceInfo.spec_config);
- _D("docker_interface_update_container ret [%d]", ret);
-
- return ret;
-}
-
-container_status_e docker_interface_get_container_state(char *container_name)
-{
- container_status_e ret = CONTAINER_STATUS_UNKNOWN;
- dzl_dockerctl_TasksInfo stTasksInfo = { 0, };
- dzl_dockerctl_serviceinfo_s serviceInfo = { 0, };
-
- if (strlen(container_name) == 0) {
- _D("container name is invalid");
- return CONTAINER_STATUS_UNKNOWN;
- }
-
- _D("__check_service_with_name start");
- if (__check_service_with_name(container_name, &serviceInfo)) {
- _E("docker_interface_get_container_state error");
- if (serviceInfo.id != NULL)
- free(serviceInfo.id);
- if (serviceInfo.spec_config != NULL)
- free(serviceInfo.spec_config);
-
- return CONTAINER_STATUS_UNKNOWN;
- }
-
- _D("__get_tasks_Info start");
- if (__get_tasks_Info(&stTasksInfo)) {
- _E("__get_tasks_Info error");
- if (serviceInfo.id != NULL)
- free(serviceInfo.id);
- if (serviceInfo.spec_config != NULL)
- free(serviceInfo.spec_config);
- if (stTasksInfo.pstTasks != NULL)
- free(stTasksInfo.pstTasks);
-
- return CONTAINER_STATUS_UNKNOWN;
- }
-
- _D("__check_status_task_with_name start");
- ret = __check_status_task_with_name(container_name, serviceInfo.id, &stTasksInfo);
-
- _D("__check_status_task_with_name ret[%d]", ret);
-
- return ret;
-}
-
-docker_status_e docker_interface_get_docker_state(void)
-{
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
-
- ret = __check_dockerd_state();
-
- _D("Docker Engine Status [%d]", ret);
-
- return ret;
-}
-
-///-------- [workaround]
-docker_status_e dzl_docker_get_network_status(void)
-{
- DOCKER *networks = NULL;
- CURLcode response;
- dzl_dockerctl_NetworksInfo stNetworksInfo = { 0, };
- char retUrl[256] = { 0, };
- int ret = DOCKER_STATUS_NO_ERROR;
-
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_NETWORKS, retUrl, sizeof(retUrl)))
- return DOCKER_STATUS_UNKNOWN;
-
- networks = dockercomm_docker_init();
-
- if (networks) {
- response = dockercomm_docker_get(networks, retUrl);
- if (response != CURLE_OK) {
- _D("docker curl response error!!\n");
- dockercomm_docker_destroy(networks);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(networks))) {
- _D("docker_get_network data = %s", dockercomm_docker_buffer(networks));
- ret = dockerform_generate_networksinfo(dockercomm_docker_buffer(networks), &stNetworksInfo);
- if (ret == DOCKER_STATUS_NO_ERROR) {
- _D("services request ok !!! [%d]", ret);
- if (stNetworksInfo.gatewayflag == 0)
- ret = DOCKER_STATUS_NETWORK_BRIDGE_FAIL;
-
- } else {
- dockercomm_docker_destroy(networks);
- return ret;
- }
- } else {
- _D("network fail !!!");
- _D("%s", dockercomm_docker_buffer(networks));
- ret = DOCKER_STATUS_SERVICE_FAIL;
- }
-
- dockercomm_docker_destroy(networks);
- } else {
- _D("getServicesInfo alloc fail");
- ret = DOCKER_STATUS_UNKNOWN;
- }
-
- return ret;
-}
-
-int dzl_dockerctl_engine_stop(void)
-{
- int pid = 0;
- char command[128] = { 0, };
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
-
-// [workaround] It will be modified after completed seperating engine service
-#if 0
- memset(command, 0x00, sizeof(command));
- snprintf(command, strlen("systemctl restart docker-engine") + 1, "systemctl restart docker-engine");
- _D("engine restart command : %s", command);
- ret = __CLI_command(command);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _D("__CLI_command ret[%d]", ret);
- return ret;
- }
-#endif
-
-// [workaround] It will be modified after completed seperating engine service
- // kill docker daemon
- pid = __get_process_pid(DOCKER_DAEMON);
- if (pid == -1) {
- _E("dockerd process is not exist");
- ret = DOCKER_STATUS_ENGINE_FAIL;
- } else {
- memset(command, 0x00, sizeof(command));
- snprintf(command, sizeof(command), "kill -9 %d", pid);
- _D("engine kill command : %s", command);
- ret = __CLI_command(command, 0, NULL);
- if (ret != DOCKER_STATUS_NO_ERROR) {
- _D("__CLI_command ret[%d]", ret);
- return ret;
- }
- }
-
- return ret;
-}
-
-////
-//--- Control for life cycle of dockzen including dockerd and swarm.
-
-int dzl_dockerctl_docker_start(void)
-{
- int ret = 0;
- char *dockerd_opt_cmd = NULL;
-
- ret = dzl_setting_get_docker_info(&dockerd_opt_cmd);
- if (dockerd_opt_cmd == NULL) {
- _D("NULL point access: dockerd_opt_cmd is NULL");
- return -1;
- }
- _D("dockerd_opt_cmd(%s)", dockerd_opt_cmd);
-
- ret = docker_interface_start(dockerd_opt_cmd, dzl_mon_status_monitor_cb);
- _D("docker_interface_start returned, ret = %d", ret);
-
-// [workaround] It will be modified after completed seperating engine service
-// Currently, docker daemon initializing is not completed at INIT state
-// So, network_check routine is moved to IDLE state
-#if 0
- // check network bridge of docker
- ret = dzl_docker_get_network_status();
- _D("dzl_docker_get_network_status returned, ret = %d", ret);
-#endif
-
- if (!dockerd_opt_cmd)
- free(dockerd_opt_cmd);
- return ret;
-}
-
-int dzl_dockerctl_set_factory_init_done(int flag)
-{
- return dzl_setting_set_factory_init_done(flag);
-}
-
-int dzl_dockerctl_get_factory_init_done(void)
-{
- return dzl_setting_get_factory_init_done();
-}
-
-int __search_image(char *repoTag)
-{
- DOCKER *docker;
- CURLcode response;
- char retUrl[256] = { 0, };
- docker_status_e ret = DOCKER_STATUS_NO_ERROR;
-
- if (strlen(repoTag) > 0) {
- docker = dockercomm_docker_init();
- if (docker) {
- if (dockerform_generate_url(DOCKER_API_VERSION, DOCKER_URL_IMAGES, retUrl, sizeof(retUrl))) {
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_UNKNOWN;
- }
-
- _D("url[%s], repoTag[%s]", retUrl, repoTag);
- response = dockercomm_docker_get(docker, retUrl);
- if (response != CURLE_OK) {
- _E("docker daemon error!!");
- dockercomm_docker_destroy(docker);
- return DOCKER_STATUS_ENGINE_API_FAIL;
- }
-
- if (DOCKER_STATUS_NO_ERROR == dockerform_check_response(dockercomm_docker_buffer(docker))) {
- ret = dockerform_generate_image_with_repotag_info(dockercomm_docker_buffer(docker), repoTag);
- } else {
- _E("Engine fail");
- _E("%s", dockercomm_docker_buffer(docker));
- ret = DOCKER_STATUS_ENGINE_API_FAIL;
- }
- dockercomm_docker_destroy(docker);
- } else {
- ret = DOCKER_STATUS_UNKNOWN;
- }
- } else {
- ret = DOCKER_STATUS_INVALID_PARAM;
- }
-
- return ret;
-}
-
-int dzl_dockerctl_system_agent_init(void)
-{
- int ret;
- char imageName[256] = { 0 };
- int image_pull_ret = DOCKER_STATUS_UNKNOWN;
- int image_create_ret = DOCKER_STATUS_UNKNOWN;
- container_create_info_s *create_info_p = NULL;
-
- ret = dzl_setting_get_system_agent_info(&create_info_p);
-
- if (ret == 0) {
- _D("create_info_s.name(%s)", create_info_p->name);
- _D("create_info_s.image(%s)", create_info_p->image);
- _D("create_info_s.entry_cmd(%s)", create_info_p->entry_cmd);
- _D("create_info_s.volume(%s)", create_info_p->volume);
- _D("create_info_s.port(%s)", create_info_p->port);
- _D("create_info_s.net_mode(%s)", create_info_p->net_mode);
- _D("create_info_s.privileged(%d)", create_info_p->privileged);
- _D("create_info_s.enable(%d)", create_info_p->enable);
- _D("create_info_s.environment(%s)", create_info_p->environment);
-
- // There is a issue at Docker bridge network initialzing: TPLDOCKER-305, Docker can't start container with network bridge error
- // So, load image have to be enabled after RECOVERY applied: DOCKER_STATUS_NETWORK_BRIDGE_FAIL
-
- /* v1.8.4 changed, pre_installed files are from wizard tool,
- creating service of agent and service will be executed from Launcher. */
-#if 0
- if (__docker_interface_load_image(imageName) == DOCKER_STATUS_NO_ERROR) {
- image_pull_ret = DOCKER_STATUS_NO_ERROR;
- _D("image load success!!!!!");
- /* agent container need to be remained */
- //remove(imageName);
- } else {
- image_pull_ret = docker_interface_pull_image(create_info_p->image);
- _D("image load failed!!!!!");
- }
-#endif
-
- /* NEED TO CHECK IMAGE IS EXISTED OR NOT */
- if (__search_image(create_info_p->image) == 0) {
- _D("already exist [%s] image!!!", create_info_p->image);
- image_pull_ret = DOCKER_STATUS_NO_ERROR;
- } else
- image_pull_ret = docker_interface_pull_image(create_info_p->image);
-
- if (image_pull_ret == DOCKER_STATUS_NO_ERROR) {
- image_create_ret = docker_interface_create_container(create_info_p);
- if (image_create_ret != DOCKER_STATUS_NO_ERROR)
- _E("docker_interface_create_container error (%d)", image_create_ret);
- } else
- _E("docker_interface_pull_image error (%d)", image_pull_ret);
- } else {
- _E("docker_setting_get_agent_info failed (%d)", ret);
- _E("there will be no agent container");
- }
-
- // free create_info_p pointer
- free(create_info_p);
- return image_pull_ret;
-}
-
-//-- monitoring function
-int dzl_mon_get_containers_info(containers_info_s * containers_info_h)
-{
- int ret = 0;
- int index = 0;
- int structCnt = 0;
-
- _D("dzl_mon_get_containers_info");
-
- ret = docker_interface_containers_info(containers_info_h);
-
- if (!ret) {
- structCnt = containers_info_h->count;
- _D("containers_info_h->count = %d", containers_info_h->count);
- for (index = 0; index < structCnt; index++) {
- _D("container[%d] id = %s", index, containers_info_h->container[index].id);
- _D("container[%d] name = %s", index, containers_info_h->container[index].name);
- _D("container[%d] image_name = %s", index, containers_info_h->container[index].image_name);
- _D("container[%d] status = %s", index, containers_info_h->container[index].status);
- }
- } else {
- _D("dzl_mon_get_containers_info ret[%d]", ret);
- return -1;
- }
-
- return 0;
-}
-
-void dzl_mon_status_monitor_cb(status_monitor_type_e status, void *param1, void *param2)
-{
- char *container_name = NULL;
- int docker_status = DOCKER_STATUS_UNKNOWN;
- int container_status = CONTAINER_STATUS_UNKNOWN;
- sm_msgq_buf_s msg_buf = { 0, };
-
- switch (status) {
- case SM_TYPE_DOCKER_STATUS:
- _D("status_monitor_cb: docker-engine status changed");
- docker_status = *(int *)param1;
- msg_buf.sm_type = status;
- msg_buf.docker_status = docker_status;
- _D("docker_status:%d", msg_buf.docker_status);
- __send_message(&msg_buf);
- break;
- case SM_TYPE_CONTAINER_STATUS:
- _D("status_monitor_cb: container status changed");
- container_status = *(int *)param2;
- msg_buf.sm_type = status;
- if (param1 != NULL) {
- container_name = (char *)malloc(sizeof(char) * (strlen(param1) + 1));
- memset(container_name, 0x00, (strlen(param1) + 1));
- strncpy(container_name, param1, strlen(param1) + 1);
- msg_buf.docker_status = DOCKER_STATUS_NO_ERROR; /* SM_TYPE_CONTAINER_STATUS callback is called when only docker_status is SM_TYPE_CONTAINER_STATUS */
- msg_buf.container_info.container_name = container_name;
- msg_buf.container_info.container_status = container_status;
- _D("container_name:%s", msg_buf.container_info.container_name);
- _D("container_status:%d", msg_buf.container_info.container_status);
- } else {
- /* TO DO: how to notify to docker-interface like this error */
- _E("invalid param, param1(%p)", param1);
- }
- __send_message(&msg_buf);
- break;
- default:
- _W("Not supported SM_TYPE");
- break;
- }
-}
-
-//-- update function
-int dzl_update_update_container(container_update_s container_update, container_update_res_s * container_update_res)
-{
- int ret = 0;
- int index = 0;
- containers_info_s containers_info_h = { 0, };
-
- _D("dzl_update_update_container");
-
-// container_update_res = (container_update_res_s *)malloc(sizeof(container_update_res_s));
- container_update_res->container_name = (char *)malloc(sizeof(char) * (strlen(container_update.container_name) + 1));
- strncpy(container_update_res->container_name, container_update.container_name, strlen(container_update.container_name) + 1);
- container_update_res->image_name_new = (char *)malloc(sizeof(char) * (strlen(container_update.image_name) + 1));
- strncpy(container_update_res->image_name_new, container_update.image_name, strlen(container_update.image_name) + 1);
-
- ret = docker_interface_containers_info(&containers_info_h);
- if (!ret) {
- for (index = 0; index < containers_info_h.count; index++) {
- if (strncmp(container_update_res->container_name, containers_info_h.container[index].name, strlen(containers_info_h.container[index].name)) == 0) {
- container_update_res->image_name_prev = (char *)malloc(sizeof(char) * (strlen(containers_info_h.container[index].image_name) + 1));
- strncpy(container_update_res->image_name_prev, containers_info_h.container[index].image_name, strlen(containers_info_h.container[index].image_name) + 1);
- break;
- }
- }
- }
-
- _D("container_update.container_name:%s", container_update.container_name);
- _D("container_update.image_name:%s", container_update.image_name);
-
- ret = docker_interface_update_container(&container_update);
- _D("docker_interface_update_container, return = %d", ret);
-
- if (ret == 0) {
- container_update_res->status = (char *)malloc(sizeof(char) * (strlen("DOCKZEN_UPDATE_STATE_STARTED") + 1));
- memset(container_update_res->status, 0x00, sizeof(char) * (strlen("DOCKZEN_UPDATE_STATE_STARTED") + 1));
- strncpy(container_update_res->status, "DOCKZEN_UPDATE_STATE_STARTED", strlen("DOCKZEN_UPDATE_STATE_STARTED") + 1);
-
- _D("container_update_res->container_name : %s", container_update_res->container_name);
- _D("container_update_res->image_name_prev : %s", container_update_res->image_name_prev);
- _D("container_update_res->image_name_new : %s", container_update_res->image_name_new);
- _D("container_update_res->status : %s", container_update_res->status);
- }
- return 0;
-}
diff --git a/src/dzl_dockerctl.h b/src/dzl_dockerctl.h
deleted file mode 100644
index d8ffba8..0000000
--- a/src/dzl_dockerctl.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/**
- * @file dzl_dockerctl.h
- * @brief Impelemetation of docker-egnine interfaces
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __DZL_DOCKERCTL_H__
-#define __DZL_DOCKERCTL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define DOCKER_API_VERSION "v1.30"
-#define DOCKER_DAEMON "dockerd"
-#define DOCKER_ENGINE_API_RETRY_MAX 120
-#define DOCKER_ENGINE_RETRY_MAX 5
-#define STATUS_MAX_NUM 13
-#define EVEVT_STATUS_MAX_NUM 4
-
-#define DOCKER_URL_SERVICES "/services"
-#define DOCKER_URL_TASKS "/tasks"
-#define DOCKER_URL_SWARM_LEAVE "/swarm/leave"
-#define DOCKER_URL_SWARM_LEAVE_PARAMETER "force=true"
-#define DOCKER_URL_SWARM_INIT "/swarm/init"
-#define DOCKER_URL_SWARM "/swarm"
-#define DOCKER_URL_PING "/_ping"
-#define DOCKER_URL_IMAGE_LOAD "/images/load"
-#define DOCKER_URL_IMAGE_CREATE "/images/create"
-#define DOCKER_URL_SERVICE_CREATE "/services/create"
-#define DOCKER_URL_EVENTS "/events"
-#define DOCKER_URL_NETWORKS "/networks/bridge"
-#define DOCKER_URL_IMAGES "/images/json"
-
-#define CURL_CONTENT_TYPE_JSON "Content-Type: application/json"
-#define CURL_CONTENT_TYPE_TAR "Content-Type: application/x-tar"
-
-/**
- * @brief This enum contains docker interface command type
- *
- * The dzl_dockerctl_cmd_type_e indicates what command is set
- *
- */
- typedef enum {
- DZL_DOCKERCTL_DOCKER_START = 0x10,
- DZL_DOCKERCTL_DOCKER_STATUS_CHANGE = 0x11,
- DZL_DOCKERCTL_CONTAINER_STATUS_CHANGE = 0x12,
- DZL_DOCKERCTL_CONTAINER_LIST_CHANGE = 0x13,
- } dzl_dockerctl_cmd_type_e;
-
-/**
- * @brief This enum contains status of docker interface initialize
- *
- * The dzl_dockerctl_status_init_e indicates what command is set
- *
- */
- typedef enum {
- DZL_DOCKERCTL_STATUS_NOT_READY = 1,
- DZL_DOCKERCTL_STATUS_INITIALIZED = 2,
- DZL_DOCKERCTL_STATUS_UNKNOWN = 3,
- } dzl_dockerctl_status_init_e;
-/**
- * @struct dzl_dockerctl_status_table
- * @brief This struct contains status of container to convert
- *
- * The dzl_dockerctl_status_table encapsulate the *task_status and status in the one data
- *
- */
- typedef struct {
- char *task_status;
- container_status_e status;
- } dzl_dockerctl_status_table;
-
-/**
- * @struct dzl_dockerctl_msgq_buf_s
- * @brief This struct contains message queue information
- *
- * The dzl_dockerctl_msgq_buf_s encapsulate the mtype, *event_data, cmd, docker_status and container_status in the one data
- *
- */
- typedef struct {
- long mtype;
- char *event_data;
- dzl_dockerctl_cmd_type_e cmd;
- docker_status_e docker_status;
- container_status_e container_status;
- } dzl_dockerctl_msgq_buf_s;
-
-/**
- * @fn docker_status_e docker_interface_start(char *dockerd_opt_cmd, status_monitor_cb callback)
- * @brief This function to start docker engine with command
- * @param *dockerd_opt_cmd [in] dockerd option command to start docker damone
- * @param callback [inout] callback function to trigger when it is ready or changed
- * @return docker_status_e result of function
- */
- docker_status_e docker_interface_start(char *dockerd_opt_cmd, status_monitor_cb callback);
-/**
- * @fn docker_status_e docker_interface_pull_image(char *image)
- * @brief This function to pull docker image based on imagename
- * @param *image [in] whole image name in order to pull from hub
- * @return docker_status_e result of function
- */
- docker_status_e docker_interface_pull_image(char *image);
-/**
- * @fn docker_interface_create_container(container_create_info_s *create_info_p)
- * @brief This function to create container based on options of container
- * @param *create_info_p [in] options of container
- * @return docker_status_e result of function
- */
- docker_status_e docker_interface_create_container(container_create_info_s * create_info_p);
-/**
- * @fn docker_interface_containers_info(containers_info_s *info_p)
- * @brief This function to get containers infomation
- * @param *info_p [out] fill containers infomation which are created
- * @return docker_status_e result of function
- */
- docker_status_e docker_interface_containers_info(containers_info_s * info_p);
-/**
- * @fn docker_interface_update_container(container_update_s *update_info_p)
- * @brief This function to update container with update info
- * @param *update_info_p [in] update information
- * @return docker_status_e result of function
- */
- docker_status_e docker_interface_update_container(container_update_s * update_info_p);
-/**
- * @fn docker_interface_get_container_state(char *container_name)
- * @brief This function to get container state according to container name
- * @param *container_name [in] name that you want to get current state of container
- * @return container_status_e status of container
- */
- container_status_e docker_interface_get_container_state(char *container_name);
-/**
- * @fn docker_status_e docker_interface_get_docker_state(void)
- * @brief This function to get docker engine state
- * @return docker_status_e status of docker engine
- */
- docker_status_e docker_interface_get_docker_state(void);
-
-/**
- * @fn int dzl_dockerctl_docker_start(void)
- * @brief This function to start docker engine
- * @return int result of function
- */
- int dzl_dockerctl_docker_start(void);
-/**
- * @fn int dzl_dockerctl_system_agent_init(void)
- * @brief This function to init agent service
- * @return int result of function
- */
- int dzl_dockerctl_system_agent_init(void);
-
-/**
- * @fn int dzl_dockerctl_get_factory_init_done(void)
- * @brief This function to get config of factory init value
- * @return int result of function
- */
- int dzl_dockerctl_get_factory_init_done(void);
-/**
- * @fn int dzl_dockerctl_set_factory_init_done(int flag)
- * @brief This function to get config of factory init value
- * @param flag [in] set init flag in config of factory
- * @return int result of function
- */
- int dzl_dockerctl_set_factory_init_done(int flag);
-
-// monitoring function
-/**
- * @fn int dzl_mon_get_containers_info(containers_info_s *containers_info_h)
- * @brief This function to get containers info
- * @param containers_info_h [out] fill containers info
- * @return int return of function
- */
- int dzl_mon_get_containers_info(containers_info_s * containers_info_h);
-
-/**
- * @fn void dzl_mon_status_monitor_cb(status_monitor_type_e status, void* param1, void* param2)
- * @brief callback function to check status
- * @param status [out] type of status
- * @param *param1 [out] param 1 for callback
- * @param *param2 [out] param 2 for callback
- * @return void
- */
- void dzl_mon_status_monitor_cb(status_monitor_type_e status, void *param1, void *param2);
-
-//-- update function
-/**
- * @fn int dzl_update_update_container(container_update_s container_update, container_update_res_s *container_update_res)
- * @brief this function to update container
- * @param container_update [in] information for container in order to update
- * @param *container_update_res [out] response of update
- * @return int result of fucntion
- */
- int dzl_update_update_container(container_update_s container_update, container_update_res_s * container_update_res);
-/**
- * @fn int dzl_dockerctl_engine_stop(void)
- * @brief This function to stop docker engine
- * @return int result of function
- */
- int dzl_dockerctl_engine_stop(void);
-/**
- * @fn int dzl_docker_get_network_status(void)
- * @brief This function to restart docker engine
- * @return int result of function
- */
- docker_status_e dzl_docker_get_network_status(void);
-/**
- * @fn void dzl_dockerctl_pre_installed_container_load(void)
- * @brief This function to load pre_installed containers
- * @return int result of function
- */
- int dzl_dockerctl_pre_installed_container_load(void);
-
- int dzl_dockerctl_enable_swarm_service(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DZL_DOCKERCTL__ */
diff --git a/src/dzl_dockerform.c b/src/dzl_dockerform.c
deleted file mode 100755
index f534cb3..0000000
--- a/src/dzl_dockerform.c
+++ /dev/null
@@ -1,985 +0,0 @@
-/**
- * @file DockerForm.c
- * @brief Formatting of request/response parameters
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "dzl_dockerform.h"
-#include "json_util.h"
-
-int dockerform_generate_url(char *version, char *url, char *newUrl, int urlSize)
-{
- if (newUrl == NULL)
- return DOCKZEN_ERROR_INVALID_PARAMETER;
-
- snprintf(newUrl, urlSize, "http://%s%s", version, url);
-
- return DOCKER_STATUS_NO_ERROR;
-}
-
-int dockerform_genetate_docker_cmd(docker_control_info_s * dockerCtl, char *daemonName, char *cmd, int cmdSize)
-{
- char opt_cmd[256] = { 0, };
-
- if (!strlen(dockerCtl->path))
- return DOCKZEN_ERROR_INVALID_PARAMETER;
- else
- snprintf(cmd, cmdSize, "%s/%s", dockerCtl->path, daemonName);
-
- if (strlen(dockerCtl->opt_cmd)) {
- snprintf(opt_cmd, sizeof(opt_cmd), " %s", dockerCtl->opt_cmd);
- strncat(cmd, opt_cmd, cmdSize - strlen(cmd) - 1);
- }
-
- strncat(cmd, " &", cmdSize - strlen(cmd) - 1);
-
- _D("command = [%s]", cmd);
-
- return DOCKER_STATUS_NO_ERROR;
-}
-
-int dockerform_check_response(char *message)
-{
- struct json_object *inputObj, *bodyObj;
- const char *data = NULL;
- enum json_type type;
- int ret = DOCKER_STATUS_NO_ERROR;
-
- inputObj = json_tokener_parse(message);
- type = json_object_get_type(inputObj);
-
- if (type == json_type_object) {
- if (json_object_object_get_ex(inputObj, "message", &bodyObj)) {
- // Error : 404 no such swarm or 500 server error or 503 node is not part of a swarm
- data = json_object_to_json_string_ext(bodyObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
- _D("bodyObj= %s", data);
- ret = 1;
- } else {
- _D("message obj is not exist");
- }
- }
-
- json_object_put(inputObj);
-
- return ret;
-}
-
-char *dockerform_json_getStringfromObj(json_object * inputObj, char *key)
-{
- const char *buf = NULL;
- char *ret_buf = NULL;
- json_object *elementObj = NULL;
- int i = 0, j = 0;
-
- if (json_object_object_get_ex(inputObj, key, &elementObj)) {
- buf = json_object_to_json_string_ext(elementObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
- ret_buf = malloc(strlen(buf) - 1);
- if (ret_buf != NULL) {
- memset(ret_buf, 0x00, strlen(buf) - 1); // "<-- exclude
- for (i = 1, j = 0; i < strlen(buf) - 1; i++) { // "\ <-- exclude
- if (buf[i] == '\\')
- continue;
- ret_buf[j++] = buf[i];
- }
- } else {
- return NULL;
- }
- } else {
- return NULL;
- }
-
- _D("ret_buf [%s]", ret_buf);
- return ret_buf;
-}
-
-/**
- * @fn static int __parse_portinfo(char *info, port_info_s *port)
- * @brief This function to parse port info from info string
- * @param *info [in] string of port
- * @param *port [out] fill port information
- * @return int result of function
- */
-static int __parse_portinfo(char *info, port_info_s * port)
-{
- char *context = NULL;
- char *ptr = strtok_r(info, ":", &context);
- if (ptr == NULL)
- return -1;
-
- port->targetport = atoi(ptr);
- _D("targetport = %d", port->targetport);
-
- ptr = strtok_r(NULL, "", &context);
- if (ptr == NULL)
- return -1;
-
- port->publishedport = atoi(ptr);
- _D("publishedport = %d", port->publishedport);
-
- return 0;
-}
-
-/**
- * @fn static int __generate_portinfo(char *info, dockform_port_info_s *portinfo)
- * @brief This function to parse port info from info string
- * @param *info [in] string of port
- * @param *portinfo [out] ports infomation
- * @return int result of function
- */
-static int __generate_portinfo(char *info, dockform_port_info_s * portinfo)
-{
- char *ptr = NULL;
- char *ptrNew = NULL;
- char *sArr[256] = { 0, };
- char portCopy[256] = { 0, };
- int index = 0;
- char *next_ptr;
-
- if (info == NULL)
- return DOCKER_STATUS_UNKNOWN;
-
- strncpy(portCopy, info, strlen(info) + 1);
-
- ptr = portCopy;
- ptrNew = strtok_r(ptr, ",", &next_ptr);
- index = 0;
- while (ptrNew != NULL) {
- sArr[index] = ptrNew;
- index++;
- ptrNew = strtok_r(NULL, ",", &next_ptr);
- }
-
- _D("Port Count [%d]", index);
-
- portinfo->count = index;
- portinfo->port_info_h = (port_info_s *) malloc(portinfo->count * sizeof(port_info_s));
-
- if (portinfo->port_info_h == NULL)
- return DOCKER_STATUS_UNKNOWN;
-
- for (index = 0; index < portinfo->count; index++) {
- if (__parse_portinfo(sArr[index], &portinfo->port_info_h[index])) {
- _D("broken");
- free(portinfo->port_info_h);
- portinfo->port_info_h = NULL;
- return DOCKER_STATUS_UNKNOWN;
- }
- }
-
- return DOCKER_STATUS_NO_ERROR;
-}
-
-/**
- * @fn static int __parse_volumeinfo(char *info, volume_info_s *volume)
- * @brief This function to parse volume info from info string
- * @param *info [in] string of volume
- * @param *volume [out] fill volume information
- * @return int result of function
- */
-static int __parse_volumeinfo(char *info, volume_info_s * volume)
-{
- char *context = NULL;
- char *ptr = strtok_r(info, ":", &context);
- if (ptr == NULL)
- return -1;
-
- memcpy(volume->source, ptr, strlen(ptr) + 1);
- _D("%s", volume->source);
- ptr = strtok_r(NULL, ":", &context);
- if (ptr == NULL)
- return -1;
-
- memcpy(volume->target, ptr, strlen(ptr) + 1);
- _D("%s", volume->target);
- //Target
- ptr = strtok_r(NULL, "", &context);
- if (ptr == NULL)
- return -1;
-
- if (!strcmp(ptr, "RW") || !strcmp(ptr, "rw"))
- volume->read_only = 0;
- else
- volume->read_only = 1;
-
- _D("readonly : %d", volume->read_only);
- return 0;
-}
-
-/**
- * @fn static int __generate_volumeinfo(char *info, dockform_volume_info_s *volumeinfo)
- * @brief This function to parse volume info from info string
- * @param *info [in] string of volume
- * @param *volumeinfo [out] volumes infomation
- * @return int result of function
- */
-static int __generate_volumeinfo(char *info, dockform_volume_info_s * volumeinfo)
-{
- char *ptr = NULL;
- char *ptrNew = NULL;
- char *sArr[256] = { 0, };
- char volumeCopy[256] = { 0, };
- int index = 0;
- char *next_ptr;
-
- if (info == NULL)
- return DOCKER_STATUS_UNKNOWN;
-
- strncpy(volumeCopy, info, strlen(info) + 1);
-
- ptr = volumeCopy;
- ptrNew = strtok_r(ptr, ",", &next_ptr);
- index = 0;
- while (ptrNew != NULL) {
- sArr[index] = ptrNew;
- index++;
- ptrNew = strtok_r(NULL, ",", &next_ptr);
- }
-
- _D("Volume Count [%d]", index);
-
- volumeinfo->count = index;
- volumeinfo->volume_info_h = (volume_info_s *) malloc(volumeinfo->count * sizeof(volume_info_s));
-
- if (volumeinfo->volume_info_h == NULL)
- return DOCKER_STATUS_UNKNOWN;
-
- for (index = 0; index < volumeinfo->count; index++) {
- if (__parse_volumeinfo(sArr[index], &volumeinfo->volume_info_h[index])) {
- _D("broken");
- free(volumeinfo->volume_info_h);
- volumeinfo->volume_info_h = NULL;
- return DOCKER_STATUS_UNKNOWN;
- }
- }
-
- return DOCKER_STATUS_NO_ERROR;
-}
-
-/**
- * @fn static int __generate_environmentInfo(char *info, dockform_environment_info_s *environmentInfo)
- * @brief This function to parse environment info from info string
- * @param *info [in] string of environment
- * @param *environmentInfo [out] environments infomation
- * @return int result of function
- */
-static int __generate_environmentInfo(char *info, dockform_environment_info_s * environmentInfo)
-{
- char *ptr = NULL;
- char *ptrNew = NULL;
- char *sArr[256] = { 0, };
- char environmentCopy[256] = { 0, };
- int index = 0;
- char *next_ptr;
- int env_len = 0;
-
- if (info == NULL)
- return DOCKER_STATUS_UNKNOWN;
-
- strncpy(environmentCopy, info, strlen(info) + 1);
-
- ptr = environmentCopy;
- ptrNew = strtok_r(ptr, ",", &next_ptr);
- index = 0;
- while (ptrNew != NULL) {
- sArr[index] = ptrNew;
- index++;
- ptrNew = strtok_r(NULL, ",", &next_ptr);
- }
-
- _D("Environment Count [%d]", index);
-
- environmentInfo->count = index;
- environmentInfo->env = (environment_info_s *) malloc(environmentInfo->count * sizeof(environment_info_s));
-
- if (environmentInfo->env == NULL)
- return DOCKER_STATUS_UNKNOWN;
-
- for (index = 0; index < environmentInfo->count; index++) {
- env_len = sizeof(environmentInfo->env[index].environment);
-
- if (!strncpy(&environmentInfo->env[index].environment, sArr[index], env_len - 1)) {
- _D("broken");
- free(environmentInfo->env);
- environmentInfo->env = NULL;
- return DOCKER_STATUS_UNKNOWN;
- }
- environmentInfo->env[index].environment[env_len - 1] = '\0';
- }
-
- return DOCKER_STATUS_NO_ERROR;
-}
-
-/**
- * @fn static int __create_directory(char *path, mode_t mode)
- * @brief This function to create a directory
- * @param *source [in] string of directory full path
- * @param mode_t [in] mode
- * @return int result of function
- */
-static int __create_directory(char *path, mode_t mode)
-{
- int len = 0;
- char *tmp = path;
- char tmp_path[128] = { 0, };
-
- if (path == NULL)
- return -1;
-
- while ((tmp = strchr(tmp, '/')) != NULL) {
- len = tmp - path;
- tmp++;
- if (len == 0)
- continue;
-
- strncpy(tmp_path, path, len);
- tmp_path[len] = 0x00;
-
- if (access(tmp_path, 0) != 0) {
- if (mkdir(tmp_path, mode) == -1) {
- _E("mkdir error: %s", tmp_path);
- return -1;
- } else
- _D("created: %s", tmp_path);
- } else
- _W("already exist: %s", tmp_path);
- }
-
- return mkdir(path, mode);
-}
-
-/**
- * @fn static int __check_validation_source_volumeinfo(char *source)
- * @brief This function to check source is existing
- * @param *source [in] string of source
- * @param *mode [in] mode
- * @return int result of function
- */
-static int __check_validation_source_volumeinfo(char *source, int readonly)
-{
- int ret = 0;
- mode_t mode;
-
- ret = access(source, 0);
- if (ret != 0) {
- _D("no exists: %s", source);
- if (readonly == 1)
- mode = 0755;
- else
- mode = 0777;
-
- if ((ret = __create_directory(source, mode)) != 0)
- _D("failed create source directory: %s", source);
- else
- _D("created source directory: %s", source);
- } else
- _D("already exist: %s", source);
- return ret;
-}
-
-int dockerform_generate_imagecreate_data(container_create_info_s * createInfo, char **ret_buf)
-{
- struct json_object *newObj, *nullObj, *replicatedObj, *replicasObj, *taskObj, *containerObj, *endpointspecObj;
- struct json_object *argsObj, *mntArrayObj, *mntObj, *resourObj, *updateObj;
- const char *buf = NULL;
- int buf_len = 0;
- int mntArrayCnt = 0;
- int i = 0;
- dockform_volume_info_s stVolumeInfo = { 0, };
- dockform_port_info_s stPortInfo = { 0, };
- dockform_environment_info_s stEnvironmentInfo = { 0, };
-
- newObj = json_object_new_object();
- nullObj = json_object_new_object();
- replicatedObj = json_object_new_object();
- taskObj = json_object_new_object();
- containerObj = json_object_new_object();
- argsObj = json_object_new_array();
- mntArrayObj = json_object_new_array();
- resourObj = json_object_new_object();
- updateObj = json_object_new_object();
- replicasObj = json_object_new_object();
- endpointspecObj = json_object_new_object();
-
- json_object_object_add(replicasObj, "Replicas", json_object_new_int(1));
- json_object_object_add(replicatedObj, "Replicated", replicasObj);
-
- json_object_object_add(newObj, "Mode", replicatedObj);
- if (createInfo->name)
- json_object_object_add(newObj, "Name", json_object_new_string(createInfo->name));
-
- if (createInfo->entry_cmd)
- json_object_array_add(argsObj, json_object_new_string(createInfo->entry_cmd));
-
- json_object_object_add(containerObj, "Args", argsObj);
- json_object_object_add(containerObj, "DNSConfig", nullObj);
- if (createInfo->image)
- json_object_object_add(containerObj, "Image", json_object_new_string(createInfo->image));
-
- /* NetworkMode and Privileged are added manually */
- if (createInfo->net_mode)
- json_object_object_add(containerObj, "NetworkMode", json_object_new_string(createInfo->net_mode));
-
- if (createInfo->privileged)
- json_object_object_add(containerObj, "Privileged", json_object_new_boolean((json_bool) 1));
- else
- json_object_object_add(containerObj, "Privileged", json_object_new_boolean((json_bool) 0));
-
- memset(&stVolumeInfo, 0x00, sizeof(stVolumeInfo));
- if (createInfo->volume) {
- if (!__generate_volumeinfo(createInfo->volume, &stVolumeInfo)) {
- mntArrayCnt = stVolumeInfo.count;
- _D("volumeinfo: arryacnt[%d]", mntArrayCnt);
- for (i = 0; i < mntArrayCnt; i++) {
- mntObj = json_object_new_object();
- json_object_object_add(mntObj, "Type", json_object_new_string("bind"));
- if (stVolumeInfo.volume_info_h[i].read_only)
- json_object_object_add(mntObj, "ReadOnly", json_object_new_boolean((json_bool) 1));
- else
- json_object_object_add(mntObj, "ReadOnly", json_object_new_boolean((json_bool) 0));
-
- json_object_object_add(mntObj, "Source", json_object_new_string(stVolumeInfo.volume_info_h[i].source));
- json_object_object_add(mntObj, "Target", json_object_new_string(stVolumeInfo.volume_info_h[i].target));
- json_object_array_add(mntArrayObj, mntObj);
-
- if (__check_validation_source_volumeinfo(stVolumeInfo.volume_info_h[i].source, stVolumeInfo.volume_info_h[i].read_only) != 0)
- _D("there is no source, could not be mounted: %s", stVolumeInfo.volume_info_h[i].source);
- }
-
- if (stVolumeInfo.volume_info_h != NULL)
- free(stVolumeInfo.volume_info_h);
-
- } else
- _E("Volume Error");
- }
- json_object_object_add(containerObj, "Mounts", mntArrayObj);
-
- mntArrayObj = json_object_new_array();
- memset(&stEnvironmentInfo, 0x00, sizeof(stEnvironmentInfo));
- if (createInfo->environment) {
- if (!__generate_environmentInfo(createInfo->environment, &stEnvironmentInfo)) {
- mntArrayCnt = stEnvironmentInfo.count;
- _D("stEnvironmentInfo: arryacnt[%d]", mntArrayCnt);
- for (i = 0; i < mntArrayCnt; i++) {
- _D("stEnvironmentInfo.env[%d].environment : %s", i, stEnvironmentInfo.env[i].environment);
- json_object_array_add(mntArrayObj, json_object_new_string(stEnvironmentInfo.env[i].environment));
- }
- }
- }
- json_object_object_add(containerObj, "Env", mntArrayObj);
-
- json_object_object_add(taskObj, "ContainerSpec", containerObj);
-
- mntArrayObj = json_object_new_array();
- if (createInfo->port) {
- memset(&stPortInfo, 0x00, sizeof(stPortInfo));
- if (!__generate_portinfo(createInfo->port, &stPortInfo)) {
- mntArrayCnt = stPortInfo.count;
- _D("portinfo: arryacnt[%d]", mntArrayCnt);
- for (i = 0; i < mntArrayCnt; i++) {
- mntObj = json_object_new_object();
- json_object_object_add(mntObj, "Protocol", json_object_new_string("tcp"));
- json_object_object_add(mntObj, "PublishMode", json_object_new_string("host"));
- json_object_object_add(mntObj, "TargetPort", json_object_new_int(stPortInfo.port_info_h[i].targetport));
- json_object_object_add(mntObj, "PublishedPort", json_object_new_int(stPortInfo.port_info_h[i].publishedport));
- json_object_array_add(mntArrayObj, mntObj);
- }
- if (stPortInfo.port_info_h != NULL)
- free(stPortInfo.port_info_h);
- } else
- _E("Port Error");
- }
- json_object_object_add(endpointspecObj, "Ports", mntArrayObj);
- json_object_object_add(newObj, "EndpointSpec", endpointspecObj);
-
- json_object_object_add(taskObj, "ForceUpdate", json_object_new_int(0));
- json_object_object_add(taskObj, "Placement", nullObj);
-
- json_object_object_add(resourObj, "Limits", nullObj);
- json_object_object_add(resourObj, "Reservations", nullObj);
-
- json_object_object_add(taskObj, "Resources", resourObj);
- json_object_object_add(taskObj, "RestartPolicy", nullObj);
-
- json_object_object_add(newObj, "TaskTemplate", taskObj);
-
- json_object_object_add(updateObj, "FailureAction", json_object_new_string("pause"));
- json_object_object_add(updateObj, "MaxFailureRatio", json_object_new_int(0));
- json_object_object_add(updateObj, "Parallelism", json_object_new_int(1));
-
- json_object_object_add(newObj, "UpdateConfig", updateObj);
-
- buf = json_object_to_json_string_ext(newObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
- *ret_buf = (char *)malloc(strlen(buf) + 1);
- buf_len = strlen(buf);
- if (*ret_buf != NULL) {
- memset(*ret_buf, 0x00, strlen(buf) + 1);
- memcpy(*ret_buf, buf, strlen(buf) + 1);
- }
- _D("service create json:[%s]", *ret_buf);
-
- json_object_put(newObj);
-
- return buf_len;
-}
-
-int dockerform_generate_swarm_init(char **ret_buf)
-{
- struct json_object *newObj = NULL; //new json object
- struct json_object *specObj = NULL; // spec json object
- struct json_object *encryptionObj = NULL; // EncryptionConfig data json object
- struct json_object *nullObj = NULL; // null data json object {}
- struct json_object *raftObj = NULL; //Raft data json object
- struct json_object *taskHistoryObj = NULL;
- const char *buf = NULL;
- int buf_len = 0;
-
- specObj = json_object_new_object();
- nullObj = json_object_new_object();
- encryptionObj = json_object_new_object();
- raftObj = json_object_new_object();
- newObj = json_object_new_object();
- taskHistoryObj = json_object_new_object();
-
- json_object_object_add(encryptionObj, "AutoLockManagers", json_object_new_boolean((json_bool) 0));
-
- json_object_object_add(raftObj, "ElectionTick", json_object_new_int(0));
- json_object_object_add(raftObj, "HeartbeatTick", json_object_new_int(0));
-
- json_object_object_add(specObj, "CAConfig", nullObj);
- json_object_object_add(specObj, "Dispatcher", nullObj);
- json_object_object_add(specObj, "EncryptionConfig", encryptionObj);
- json_object_object_add(taskHistoryObj, "TaskHistoryRetentionLimit", json_object_new_int(1));
- json_object_object_add(specObj, "Orchestration", taskHistoryObj);
- json_object_object_add(specObj, "Raft", raftObj);
- json_object_object_add(specObj, "TaskDefaults", nullObj);
-
- // setup the 127.0.0.1 to initialize without network connection
- json_object_object_add(newObj, "AdvertiseAddr", json_object_new_string("127.0.0.1"));
- json_object_object_add(newObj, "AutoLockManagers", json_object_new_boolean((json_bool) 0));
- json_object_object_add(newObj, "ForceNewCluster", json_object_new_boolean((json_bool) 0));
- json_object_object_add(newObj, "ListenAddr", json_object_new_string("0.0.0.0:2377"));
- json_object_object_add(newObj, "Spec", specObj);
-
- _D("newObj = %s", json_object_to_json_string_ext(newObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY));
-
- buf = json_object_to_json_string_ext(newObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
-
- *ret_buf = (char *)malloc(strlen(buf) + 1);
- buf_len = strlen(buf);
- if (*ret_buf != NULL) {
- memset(*ret_buf, 0x00, strlen(buf) + 1);
- memcpy(*ret_buf, buf, strlen(buf) + 1);
- }
-
- json_object_put(newObj);
-
- return buf_len;
-}
-
-int dockerform_generate_networksinfo(char *data, dzl_dockerctl_NetworksInfo * pstNetworkInfo)
-{
- struct json_object *networkObj = NULL;
- struct json_object *specObj = NULL;
- int index = 0;
- int network_cnt = 0;
- enum json_type type;
- char *id = NULL;
- char *name = NULL;
- char *gateway = NULL;
-
- _D("dockform_generate_networksinfo call");
-
- networkObj = json_tokener_parse(data);
-
- id = dockerform_json_getStringfromObj(networkObj, "Id");
- if (id != NULL) {
- _D("id[%s] len[%d]", id, (unsigned int)strlen(id));
- if (strlen(id) > 0)
- memcpy(pstNetworkInfo->id, id, strlen(id) + 1);
- free(id);
- id = NULL;
- }
- name = dockerform_json_getStringfromObj(networkObj, "Name");
- if (name != NULL) {
- _D("id[%s] len[%d]", name, (unsigned int)strlen(name));
- if (strlen(name) > 0)
- memcpy(pstNetworkInfo->name, name, strlen(name) + 1);
- free(name);
- name = NULL;
- }
-
- if (json_object_object_get_ex(networkObj, "IPAM", &specObj)) {
- struct json_object *configtempObj, *configArrayObj;
- if (json_object_get_type(specObj) == json_type_object) {
- if (json_object_object_get_ex(specObj, "Config", &configtempObj)) {
- if (json_object_get_type(configtempObj) == json_type_array) {
- configArrayObj = json_object_array_get_idx(configtempObj, 0);
- gateway = dockerform_json_getStringfromObj(configArrayObj, "Gateway");
- if (gateway != NULL) {
- _D("docker network Geteway !!!!");
- pstNetworkInfo->gatewayflag = 1;
- free(gateway);
- gateway = NULL;
- }
- }
- }
- }
- }
-
- _D("dockerform_generate_networksinfo end");
- return DOCKER_STATUS_NO_ERROR;
-}
-
-int dockerform_generate_servicesinfo(char *data, dzl_dockerctl_ServicesInfo * pstServicesInfo)
-{
- struct json_object *serviceObj = NULL, *inputArrayObj = NULL;
- int index = 0;
- int service_cnt = 0;
- enum json_type type;
-
- _D("dockform_generate_servicesinfo call");
-
- serviceObj = json_tokener_parse(data);
- type = json_object_get_type(serviceObj);
- if (type == json_type_array) {
- service_cnt = json_object_array_length(serviceObj);
- if (service_cnt == 0)
- return DOCKER_STATUS_UNKNOWN;
- }
-
- _D("cnt : [%d]", service_cnt);
-
- pstServicesInfo->pstServices = (dzl_dockerctl_Service *) malloc(service_cnt * sizeof(dzl_dockerctl_Service));
- if (pstServicesInfo->pstServices == NULL)
- return DOCKER_STATUS_UNKNOWN;
- memset(pstServicesInfo->pstServices, 0x00, service_cnt * sizeof(dzl_dockerctl_Service));
-
- pstServicesInfo->count = service_cnt;
-
- index = 0;
-
- while (index < service_cnt) {
- struct json_object *specObj;
- char *id = NULL;
- char *name = NULL;
- char *image = NULL;
-
- inputArrayObj = json_object_array_get_idx(serviceObj, index);
- id = dockerform_json_getStringfromObj(inputArrayObj, "ID");
- if (id != NULL) {
- _D("id[%s] len[%d]", id, (unsigned int)strlen(id));
- if (strlen(id) > 0)
- memcpy(pstServicesInfo->pstServices[index].id, id, strlen(id) + 1);
- free(id);
- id = NULL;
- }
-
- if (json_object_object_get_ex(inputArrayObj, "Spec", &specObj)) {
- struct json_object *tasktempObj, *containerSpecObj;
-
- if (json_object_get_type(specObj) == json_type_object) {
-
- name = dockerform_json_getStringfromObj(specObj, "Name");
- if (name != NULL) {
- if (strlen(name) > 0)
- memcpy(pstServicesInfo->pstServices[index].name, name, strlen(name) + 1);
-
- free(name);
- name = NULL;
- }
-
- if (json_object_object_get_ex(specObj, "TaskTemplate", &tasktempObj)) {
- if (json_object_object_get_ex(tasktempObj, "ContainerSpec", &containerSpecObj)) {
- image = dockerform_json_getStringfromObj(containerSpecObj, "Image");
- if (image != NULL) {
- if (strlen(image) > 0)
- memcpy(pstServicesInfo->pstServices[index].imageName, image, strlen(image) + 1);
-
- free(image);
- image = NULL;
- }
- }
- }
- }
- }
-
- index++;
- }
-
- _D("dockform_generate_servicesinfo end");
- return DOCKER_STATUS_NO_ERROR;
-}
-
-int dockerform_generate_image_with_repotag_info(char *data, char *repoTag)
-{
- int i, j;
- int index = 0;
- char *buf = NULL;
- char *compare_buf = NULL;
- int imageCnt;
- struct json_object *imageObj = NULL;
- struct json_object *imageElementObj = NULL;
- struct json_object *imageRepoTagObj = NULL;
-
- if (!repoTag)
- return DOCKER_STATUS_INVALID_PARAM;
-
- imageObj = json_tokener_parse(data);
- imageCnt = json_object_array_length(imageObj);
-
- _D("Image count [%d]", imageCnt);
-
- while (index < imageCnt) {
- imageElementObj = json_object_array_get_idx(imageObj, index);
- if (json_object_object_get_ex(imageElementObj, "RepoTags", &imageRepoTagObj)) {
- buf = json_object_to_json_string_ext(imageRepoTagObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
- compare_buf = malloc(strlen(buf) + 1);
- if (compare_buf != NULL) {
- memset(compare_buf, 0x00, strlen(buf) + 1);
- for (i = 0, j = 0; i < strlen(buf); i++) {
- if (buf[i] == '\\')
- continue;
- else
- compare_buf[j++] = buf[i];
- }
- _D("[%d]RepoTags: %s", index, compare_buf);
-
- if (strstr(compare_buf, repoTag)) {
- free(compare_buf);
- return DOCKER_STATUS_NO_ERROR;
- }
- }
- }
- index++;
- }
- free(compare_buf);
- return DOCKER_STATUS_UNKNOWN;
-}
-
-int dockerform_generate_tasksinfo(char *data, dzl_dockerctl_TasksInfo * pstTasksInfo)
-{
- struct json_object *taskObj = NULL;
- struct json_object *inputTaskArrayObj = NULL;
- struct json_object *taskServiceIDObj = NULL, *taskStateObj = NULL;
- char *id = NULL;
- int task_cnt = 0;
- int index = 0;
-
- taskObj = json_tokener_parse(data);
- task_cnt = json_object_array_length(taskObj);
-
- _D("Task count [%d]", task_cnt);
-
- pstTasksInfo->count = task_cnt;
- pstTasksInfo->pstTasks = (dzl_dockerctl_Task *) malloc(task_cnt * sizeof(dzl_dockerctl_Task));
- if (pstTasksInfo->pstTasks == NULL)
- return DOCKER_STATUS_UNKNOWN;
-
- memset(pstTasksInfo->pstTasks, 0x00, task_cnt * sizeof(dzl_dockerctl_Task));
- index = 0;
- while (index < task_cnt) {
- char *status = NULL;
- inputTaskArrayObj = json_object_array_get_idx(taskObj, index);
- if (json_object_object_get_ex(inputTaskArrayObj, "ServiceID", &taskServiceIDObj)) {
- id = dockerform_json_getStringfromObj(inputTaskArrayObj, "ServiceID");
- if (json_object_object_get_ex(inputTaskArrayObj, "DesiredState", &taskStateObj)) {
- status = dockerform_json_getStringfromObj(inputTaskArrayObj, "DesiredState");
-
- if (status != NULL && id != NULL) {
- if (strlen(id) > 0)
- memcpy(pstTasksInfo->pstTasks[index].id, id, strlen(id) + 1);
-
- if (strlen(status) > 0)
- memcpy(pstTasksInfo->pstTasks[index].status, status, strlen(status) + 1);
- }
-
- if (status != NULL) {
- free(status);
- status = NULL;
- }
- }
-
- if (id != NULL) {
- free(id);
- id = NULL;
- }
- }
-
- index++;
- }
-
- return DOCKER_STATUS_NO_ERROR;
-}
-
-int dockerform_generate_service_withid_info(char *data, dzl_dockerctl_serviceinfo_s * info)
-{
- char *specConfig = NULL;
- char *id = NULL;
- char *version_data = NULL;
- int version = 0;
-
- _D("data[%s]", data);
- specConfig = json_getObject(data, "Spec");
- id = json_getString(data, "ID");
-
- if (id != NULL) {
- _D("id[%s]", id);
- info->id = (char *)malloc(sizeof(char) * (strlen(id) + 1));
- if (info->id != NULL) {
- memset(info->id, 0x00, sizeof(char) * (strlen(id) + 1));
- memcpy(info->id, id, strlen(id) + 1);
- }
- }
-
- if (specConfig != NULL) {
- _D("specConfig[%s]", specConfig);
- info->spec_config = (char *)malloc(sizeof(char) * (strlen(specConfig) + 1));
- if (info->spec_config != NULL) {
- memset(info->spec_config, 0x00, sizeof(char) * (strlen(specConfig) + 1));
- memcpy(info->spec_config, specConfig, strlen(specConfig) + 1);
- }
- }
-
- version_data = json_getObject(data, "Version");
- if (version_data != NULL) {
- _D("version_data[%s]", version_data);
- version = json_getNumber(version_data, "Index");
- info->version = version;
- }
-
- if (specConfig != NULL)
- free(specConfig);
- if (id != NULL)
- free(id);
- if (version_data != NULL)
- free(version_data);
-
- return DOCKER_STATUS_NO_ERROR;
-}
-
-int dockerform_generate_updateinfo(dzl_dockerctl_serviceinfo_s * service_info, char *imageName, char **ret_buf)
-{
- struct json_object *inputObj, *taskObj, *containerObj;
- const char *buf = NULL;
- int buf_len = 0;
- int i, j;
- char imageNamebuf[256];
-
- inputObj = json_tokener_parse(service_info->spec_config);
-
- //------------- image name : xx.xxx.xx.xx.xx\/xxxx <-- \ remove
- j = 0;
- for (i = 0; i < strlen(imageName); i++) {
- if (imageName[i] == '\\')
- continue;
-
- imageNamebuf[j++] = imageName[i];
- }
- imageNamebuf[j] = '\0';
-
- _D("spec_config = %s", service_info->spec_config);
- _D("imageNamebuf = %s", imageNamebuf);
-
- if (json_object_object_get_ex(inputObj, "TaskTemplate", &taskObj)) {
- if (json_object_object_get_ex(taskObj, "ContainerSpec", &containerObj)) {
- json_object_object_del(containerObj, "Image");
- json_object_object_add(containerObj, "Image", json_object_new_string(imageNamebuf));
- buf = json_object_to_json_string_ext(inputObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
- *ret_buf = (char *)malloc(strlen(buf) + 1);
- buf_len = strlen(buf);
- if (*ret_buf != NULL) {
- memset(*ret_buf, 0x00, strlen(buf) + 1);
- memcpy(*ret_buf, buf, strlen(buf) + 1);
- }
- _D("buf = %s", buf);
- }
- }
-
- json_object_put(inputObj);
-
- return buf_len;
-}
-
-int dockerform_parse_container_info(char *data, dzl_dockerctl_Task * task_info)
-{
- struct json_object *eventObj = NULL;
- struct json_object *actorObj = NULL;
- struct json_object *attributeObj = NULL;
- char *name = NULL;
- char *status = NULL;
-
- eventObj = json_tokener_parse(data);
-
- if (eventObj != NULL) {
- status = dockerform_json_getStringfromObj(eventObj, "Action");
- if (status != NULL) {
- memcpy(task_info->status, status, strlen(status) + 1);
- if (status != NULL) {
- free(status);
- status = NULL;
- }
- }
- if (json_object_object_get_ex(eventObj, "Actor", &actorObj)) {
- if (json_object_object_get_ex(actorObj, "Attributes", &attributeObj)) {
- name = dockerform_json_getStringfromObj(attributeObj, "com.docker.swarm.service.name");
- if (name != NULL) {
- memcpy(task_info->id, name, strlen(name) + 1);
- if (name != NULL) {
- free(name);
- name = NULL;
- }
- }
- }
- }
- } else {
- _D("eventObj is null");
- return -1;
- }
-
- _D("dockerform_parse_container_info end");
-
- return 0;
-}
-
-int dockerform_generate_imageload_file(char *filename, char **ret_buf)
-{
- FILE *fd;
- int filelen = 0;
- struct stat st;
- int readlen;
-
- fd = fopen(filename, "rb"); // open the file in binary mode
- if (stat(filename, &st) == 0) {
- filelen = st.st_size;
- _D("filelen(%d)", filelen);
- *ret_buf = (char *)malloc(sizeof(char) * (filelen + 1));
- memset(*ret_buf, 0x00, filelen + 1);
- readlen = fread(*ret_buf, filelen, 1, fd); // read in the entire file
- if (readlen != filelen) {
- if (ferror(fd))
- _E("Error reading %s", filename);
- else if (feof(fd))
- _D("EOF found %s", filename);
- } else
- _D("readlen (%d)", readlen);
- } else
- _E("too large file");
-
- fclose(fd);
-
- return filelen;
-}
diff --git a/src/dzl_dockerform.h b/src/dzl_dockerform.h
deleted file mode 100644
index 05b1a2f..0000000
--- a/src/dzl_dockerform.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- * @file dzl_dockerform.h
- * @brief Formatting of request/response parameters
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __DOCKERFORM_H__
-#define __DOCKERFORM_H__
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @struct volume_info_s
- * @brief This struct contains volume information
- *
- * The volume_info_s encapsulate the read_only, source and target in the one data
- *
- */
- typedef struct {
- int read_only;
- char source[128];
- char target[128];
- } volume_info_s;
-
-/**
- * @struct dockform_volume_info_s
- * @brief This struct contains count and point of volume_info_s
- *
- * The dockform_volume_info_s encapsulate the count and *volume_info_h in the one data
- *
- */
- typedef struct {
- int count;
- volume_info_s *volume_info_h;
- } dockform_volume_info_s;
-
-/**
- * @struct port_info_s
- * @brief This struct contains port information
- *
- * The volume_info_s is consists
- * targetport : the port inside the container
- * publishedport : the port on the swarm hosts
- *
- */
- typedef struct {
- int targetport;
- int publishedport;
- } port_info_s;
-
-/**
- * @struct dockform_port_info_s
- * @brief This struct contains count and point of port_info_s
- *
- * The dockform_volume_info_s the count and *volume_info_h in the one data
- *
- */
- typedef struct {
- int count;
- port_info_s *port_info_h;
- } dockform_port_info_s;
-
-/**
- * @struct environment_info_s
- * @brief This struct contains environment information
- *
- * The environment_info_s encapsulate the environment in the one data
- *
- */
- typedef struct {
- char environment[256];
- } environment_info_s;
-
-/**
- * @struct dockform_environment_info_s
- * @brief This struct contains count and point of environment
- *
- * The dockform_environment_info_s the count and *environment_info_s in the one data
- *
- */
- typedef struct {
- int count;
- environment_info_s *env;
- } dockform_environment_info_s;
-
-/**
- * @fn int dockerform_generate_url(char *version, char *url, int urlSize)
- * @brief This function to generate request url
- * @param *version [in] docker engine api version
- * @param *url [in] request url
- * @param *newUrl [out] generated url
- * @param urlSize [in] input url buffer size
- * @return int result of function
- */
- int dockerform_generate_url(char *version, char *url, char *newUrl, int urlSize);
-/**
- * @fn int dockerform_genetate_docker_cmd(docker_control_info_s *dockerCtl, char *daemonName, char *cmd)
- * @brief This function to generate docker command to start docker engine
- * @param *dockerCtl [in] Option value
- * @param *daemonName [in] daemon name
- * @param *cmd [out] whole command
- * @param cmdSize [in] input cmd buffer size
- * @return int result of function
- */
- int dockerform_genetate_docker_cmd(docker_control_info_s * dockerCtl, char *daemonName, char *cmd, int cmdSize);
-/**
- * @fn int dockerform_check_response(char *message)
- * @brief This function to check response whether it is error or not
- * @param *message [in] response string
- * @return int result of function
- */
- int dockerform_check_response(char *message);
-/**
- * @fn int dockerform_generate_imagecreate_data(container_create_info_s *createInfo, char **ret_buf)
- * @brief This function to generate body data for creating container request
- * @param *createInfo [in] information of container
- * @param **char [out] body json
- * @return int length of body json
- */
- int dockerform_generate_imagecreate_data(container_create_info_s * createInfo, char **ret_buf);
-/**
- * @fn int dockerform_generate_swarm_init(char **ret_buf)
- * @brief This function to generate data for request of swarm init
- * @param **char [out] body json
- * @return int length of body json
- */
- int dockerform_generate_swarm_init(char **ret_buf);
-/**
- * @fn int dockerform_generate_networksinfo(char *data, dzl_dockerctl_NetworksInfo * pstNetworkInfo)
- * @brief This function to parse and generate network info
- * @param *data [in] response data
- * @param *pstNetworkInfo [out] fill networks info accoroding to dzl_dockerctl_NetworksInfo structure
- * @return int result of function
- */
- int dockerform_generate_networksinfo(char *data, dzl_dockerctl_NetworksInfo * pstNetworkInfo);
-/**
- * @fn int dockerform_generate_servicesinfo(char *data, dzl_dockerctl_ServicesInfo *pstServicesInfo)
- * @brief This function to parse and generate services info
- * @param *data [in] response data
- * @param *pstServiceInfo [out] fill services info accoroding to dzl_dockerctl_ServicesInfo structure
- * @return int result of function
- */
- int dockerform_generate_servicesinfo(char *data, dzl_dockerctl_ServicesInfo * pstServicesInfo);
-/**
- * @fn int dockerform_generate_tasksinfo(char *data, dzl_dockerctl_TasksInfo *pstTasksInfo)
- * @brief This function to parse and generate tasks info
- * @param *data [in] response data
- * @param *pstTasksInfo [out] fill tasks info accoroding to dzl_dockerctl_TasksInfo structure
- * @return int result of function
- */
- int dockerform_generate_tasksinfo(char *data, dzl_dockerctl_TasksInfo * pstTasksInfo);
-/**
- * @fn int dockerform_generate_service_withid_info(char *data, dzl_dockerctl_serviceinfo_s *info)
- * @brief This function to parse and generate service info based on id
- * @param *data [in] response data
- * @param *info [out] fill service info accoroding to dzl_dockerctl_serviceinfo_s structure
- * @return int result of function
- */
- int dockerform_generate_service_withid_info(char *data, dzl_dockerctl_serviceinfo_s * info);
-/**
- * @fn int dockerform_generate_updateinfo(dzl_dockerctl_serviceinfo_s *service_info, char * imageName, char **ret_buf)
- * @brief This function to generate data for update request
- * @param *service_info [in] service info
- * @param **char [out] body json
- * @return int length of body json
- */
- int dockerform_generate_updateinfo(dzl_dockerctl_serviceinfo_s * service_info, char *imageName, char **ret_buf);
-/**
- * @fn int dockerform_parse_container_info(char *data, dzl_dockerctl_Task *task_info)
- * @brief This function to parse container info
- * @param *data [in] response data
- * @param *task_iinfo [out] task info from response data
- * @return int result of function
- */
- int dockerform_parse_container_info(char *data, dzl_dockerctl_Task * task_info);
-/**
- * @fn int dockerform_generate_imageload_file(char *filename)
- * @brief This function to generate data from file input
- * @param *filename [in] file name
- * @param **char [out] body data of file stream
- * @return int length of body data
- */
- int dockerform_generate_imageload_file(char *filename, char **ret_buf);
-/**
- * @fn int dockerform_generate_image_with_repotag_info(char *data, char *repoTag)
- * @brief This function to find image repoTag is exist
- * @param char *data [in] data
- * @param char *repoTag [in] image name to find
- * @return int result of function
- */
- int dockerform_generate_image_with_repotag_info(char *data, char *repoTag);
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DOCKERFORM_H__ */
diff --git a/src/dzl_interface.c b/src/dzl_interface.c
deleted file mode 100644
index 856d528..0000000
--- a/src/dzl_interface.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * @file dzl_interface.c
- * @brief API interface server
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "json_util.h"
-#include "dzl_interface.h"
-#include "dzl_lifecycle.h"
-
-#include <sys/socket.h>
-
-#define MAXLINE 1024
-#define SERVER "/var/run/beluga_launcher_notify.sock"
-
-int dzl_interface_init(void)
-{
- int sockfd;
- int clilen;
- struct sockaddr_un clientaddr, serveraddr;
- sa_interface_cmd_e rev_cmd;
- int ret = 0;
-
- _D("start_server");
- sockfd = socket(AF_UNIX, SOCK_DGRAM, 0);
- if (sockfd < 0) {
- _E("socket error : ");
- return -1;
- }
- unlink(SERVER);
-
- bzero(&serveraddr, sizeof(serveraddr));
- serveraddr.sun_family = AF_UNIX;
- strncpy(serveraddr.sun_path, SERVER, sizeof(serveraddr.sun_path) - 1);
- serveraddr.sun_path[sizeof(serveraddr.sun_path) - 1] = '\0';
-
- _D("bind socket(%d) (%s)", sockfd, SERVER);
- if (bind(sockfd, (struct sockaddr *)&serveraddr, sizeof(serveraddr)) < 0) {
- _E("bind error : ");
- close(sockfd);
- return -1;
- }
- clilen = sizeof(clientaddr);
-
- while (1) {
- _D("waiting for message~~~");
- if (recvfrom(sockfd, (void *)&rev_cmd, sizeof(rev_cmd), 0, (struct sockaddr *)&clientaddr, (socklen_t *) & clilen) < 0)
- _E("Error receiving msg");
- _D("rev_cmd : %d", rev_cmd);
-
- switch (rev_cmd) {
- case SA_START_LAUNCHER_SVC:
- _D("set lifecycle init");
- dzl_lifecycle_state_init();
- break;
- case SA_RESTART_DOCKERD:
- _D("restart docker engine");
- dzl_lifecycle_restart_dockerd();
- break;
- case SA_STOP_DOCKERD:
- _D("stop docker engine");
- dzl_lifecycle_stop_dockerd();
- break;
- default:
- _D("command is not support !!");
- break;
- }
- _D("send_result : %d", ret);
- if (sendto(sockfd, (void *)&ret, sizeof(ret), 0, (struct sockaddr *)&clientaddr, clilen) < 0)
- _E("Error sending msg");
- }
- close(sockfd);
-
- return 0;
-}
diff --git a/src/dzl_interface.h b/src/dzl_interface.h
deleted file mode 100644
index c413cbe..0000000
--- a/src/dzl_interface.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * @file dzl_interface.h
- * @brief API interface server
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __DZL_INTERFACE_H__
-#define __DZL_INTERFACE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @fn int dzl_interface_init(void)
- * @brief this function to init api server
- * @return int result of fucntion
- */
- int dzl_interface_init(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DZL_INTERFACE_H__ */
diff --git a/src/dzl_launcher.c b/src/dzl_launcher.c
deleted file mode 100644
index a6c321e..0000000
--- a/src/dzl_launcher.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
-* @file dzl_launcher.c
-* @brief Main module, management of state machine
-
-* Copyright (c) 2017 Samsung Electronics Co., Ltd.
-* This software is the confidential and proprietary information
-* of Samsung Electronics, Inc. ("Confidential Information"). You
-* shall not disclose such Confidential Information and shall use
-* it only in accordance with the terms of the license agreement
-* you entered into with Samsung.
-*/
-
-#include <stdio.h>
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "dzl_lifecycle.h"
-#include "dzl_interface.h"
-
-
-int main(int argc, char *argv[])
-{
- printf("[dzl_launcher] Dockzen-launcher start!!!\n");
- _D("dzl_lifecycle_start");
-
- if (dzl_lifecycle_start() != 0)
- _E("beluga launcher life cycle failed");
-
- _D("dzl_interface_init");
- if (dzl_interface_init() != 0)
- _E("beluga launcher interface init failed");
-
- return 0;
-}
diff --git a/src/dzl_lifecycle.c b/src/dzl_lifecycle.c
deleted file mode 100755
index 78aca22..0000000
--- a/src/dzl_lifecycle.c
+++ /dev/null
@@ -1,537 +0,0 @@
-/**
- * @file DZL_Lifecycle.c
- * @brief Management for life cycle of container and services from docker
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <pthread.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "dzl_lifecycle.h"
-#include "dzl_dockerctl.h"
-
-int dockzenlauncher_state = STATEMACHINE_END;
-sm_containers_list_s sm_containers_list;
-
-#define MAX_WAIT_INTERVAL 150
-#define MAX_RETRY_CNT 1
-
-static pthread_t timer_thread;
-static int timer_started;
-static int timer_cnt;
-
-int __update_sm_containers_list(char *container_name, int status)
-{
- int index;
- int matched = 0;
-
- if (container_name == NULL) {
- _E("NULL pointer access error");
- return -1;
- }
-
- for (index = 0; index < sm_containers_list.count; index++) {
- if (strncmp(sm_containers_list.container[index].container_name, container_name, strlen(container_name)) == 0) {
- sm_containers_list.container[index].status = status;
- matched = 1;
- }
- }
-
- if (matched == 0) { /* need to add */
- index = sm_containers_list.count;
- sm_containers_list.count++;
- sm_containers_list.container[index].container_name = (char *)malloc(sizeof(char) * (strlen(container_name) + 1));
- strncpy(sm_containers_list.container[index].container_name, container_name, strlen(container_name) + 1);
- sm_containers_list.container[index].status = status;
- }
-
- free(container_name);
- return 0;
-}
-
-int __initialize_sm_containers_list(void)
-{
- int ret;
- int index = 0;
- containers_info_s *containers_info_h = NULL;
-
- _D("__initialize_current_containers_info");
-
- containers_info_h = (containers_info_s *) malloc(sizeof(containers_info_s));
- ret = dzl_mon_get_containers_info(containers_info_h);
-
- if (ret != 0 || containers_info_h == NULL) {
- _E("NULL pointer access error");
- return -1;
- }
-
- sm_containers_list.count = containers_info_h->count;
- for (index = 0; index < containers_info_h->count; index++) {
- sm_containers_list.container[index].container_name = (char *)malloc(sizeof(char) * (strlen(containers_info_h->container[index].name) + 1));
- strncpy(sm_containers_list.container[index].container_name, containers_info_h->container[index].name, strlen(containers_info_h->container[index].name) + 1);
- sm_containers_list.container[index].status = CONTAINER_STATUS_UNKNOWN;
- }
- return 0;
-}
-
-/* check containers' current status,
-and if there is a NOT-RUNNING container, state machine have to monitor */
-int __check_containers_list(void)
-{
- int index;
-
- for (index = 0; index < sm_containers_list.count; index++) {
- if (sm_containers_list.container[index].status != CONTAINER_STATUS_RUNNING)
- return -1;
- }
- return 0;
-}
-
-int __display_sm_containers_list(void)
-{
- int index;
-
- _D("--------------------------");
- for (index = 0; index < sm_containers_list.count; index++)
- _D("[%d]. %s (status:%d)", index, sm_containers_list.container[index].container_name, sm_containers_list.container[index].status);
- _D("--------------------------");
-
- return 0;
-}
-
-/**
- * @fn static state_machine_e __get_current_state(void)
- * @brief This function to get state of machine
- * @return state_machine_e state of state machine
- */
-static state_machine_e __get_current_state(void)
-{
- return dockzenlauncher_state;
-}
-
-/**
- * @fn static void __set_changed_state(state_machine_e state)
- * @brief This function to set state of machine
- * @return void
- */
-static void __set_changed_state(state_machine_e state)
-{
- dockzenlauncher_state = state;
-}
-
-/**
- * @fn static int __send_message(sm_msgq_buf_s *msg_buf)
- * @brief This function to send message
- * @param *msg_buf [in] message structure to send
- * @return in result of function
- */
-static int __send_message(sm_msgq_buf_s * msg_buf)
-{
- int msgqid;
- int msg_size;
-
- msg_buf->mtype = STATEMACHINE_QID;
- msg_size = sizeof(sm_msgq_buf_s) - sizeof(msg_buf->mtype);
- msgqid = msgget((key_t) STATEMACHINE_QID, IPC_CREAT | 0666);
- _D("msgqid:0x%d", msgqid);
-
- if (msgsnd(msgqid, msg_buf, msg_size, 0) == -1) {
- _E("msgsnd error(%d)", errno);
- return -1;
- }
- return 0;
-}
-
-/**
- * @fn static void __timer(int *internal_state)
- * @brief This function to set timer
- * @param *arg [in] internal state of sm
- * @return void *
- */
-static void *__timer(void *arg)
-{
- sm_msgq_buf_s msg_buf = { 0, };
- int *internal_state = (int *)arg;
-
- pthread_detach(pthread_self());
- pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
-
- while (1) {
- _D("timer_cnt(%d)", timer_cnt);
- if (timer_cnt-- <= 0)
- break;
- sleep(1);
- }
-
- timer_started = 0;
-
- _D("TO DO: state machine mode change, IDLE --> RECOVERY");
- __set_changed_state(STATEMACHINE_RECOVERY);
- msg_buf.sm_type = SM_TYPE_CHECK_STATUS;
- msg_buf.docker_status = DOCKER_STATUS_INIT_FAIL;
- __send_message(&msg_buf);
-
- pthread_exit((void *)0);
-
- return NULL;
-}
-
-/**
- * @fn static void __exit_timer(void)
- * @brief This function to exit timer
- * @return void
- */
-static void __exit_timer(void)
-{
- if (timer_started == 1) {
- if ((pthread_cancel(timer_thread) != 0)) {
- _E("pthread_cancel error(%d)", errno);
- } else {
- _D("__timer exited");
- timer_started = 0;
- }
- }
-}
-
-/**
- * @fn static int __start_timer(int internal_state)
- * @brief This function to start timer
- It timer starts, theread would be created
- * @param internal_state [in] internal state of sm
- * @return int result of function
- */
-static int __start_timer(int internal_state)
-{
- if (timer_started == 1) {
- _D("reset timer_cnt");
- timer_cnt = MAX_WAIT_INTERVAL;
- } else {
- _D("__timer stared");
- timer_started = 1;
- timer_cnt = MAX_WAIT_INTERVAL;
-
- if (pthread_create(&timer_thread, NULL, &__timer, &internal_state) < 0) {
- _E("thread create error");
- return -1;
- }
- }
- return 0;
-}
-
-/**
- * @fn static int dzl_lifecycle_init_factory_service(void)
- * @brief This function to init service according to flag of init
- * @return int result of function
- */
-int dzl_lifecycle_init_factory_service(void)
-{
- int ret = DOCKER_STATUS_NO_ERROR;
- int factory_init_flag = 1;
-
- // check network bridge of docker
- ret = dzl_docker_get_network_status();
- _D("dzl_docker_get_network_status returned, ret = %d", ret);
-
- if (ret != DOCKER_STATUS_NO_ERROR)
- return ret;
- else
- __exit_timer();
-
- factory_init_flag = dzl_dockerctl_get_factory_init_done();
- _D("1. factory_init_flag:(%d)", factory_init_flag);
-
- if (factory_init_flag == 0) {
- dzl_dockerctl_pre_installed_container_load();
-
- ret = dzl_dockerctl_system_agent_init();
- if (ret != DOCKER_STATUS_NO_ERROR)
- return ret;
-
- dzl_dockerctl_set_factory_init_done(TRUE);
- }
- _D("2. factory_init_flag:(%d)", dzl_dockerctl_get_factory_init_done());
- _D("dzl_dockerctl_system_agent_init, ret:%d", ret);
-
- return ret;
-}
-
-/**
- * @fn int __recovery_state(int internal_state)
- * @brief This function to check state of recovery, accoring to the state, it will recovery
- * @param internal_state [in] internal state of sm
- * @return int result of function
- */
-static int __recovery_state(int internal_state)
-{
- static int retry_value[DOCKER_STATUS_MAX] = { 0, };
- int ret = DOCKER_STATUS_NO_ERROR;
- int i;
-
- switch (internal_state) {
- case DOCKER_STATUS_NETWORK_BRIDGE_FAIL: /* docker bridge fail */
- case DOCKER_STATUS_INIT_FAIL: /* docker engine init fail */
- if (retry_value[internal_state] < MAX_RETRY_CNT) {
- dzl_dockerctl_engine_stop();
- __set_changed_state(STATEMACHINE_INIT);
- _D("__ recovery retry!!!");
- retry_value[internal_state]++;
- ret = DOCKER_STATUS_STARTED;
- }
- break;
- default:
- break;
- }
-
- _D("__recovery_State!!!, internal_state(%d)", internal_state);
- for (i = 0; i < DOCKER_STATUS_MAX; i++)
- _D("trial cnt of internal state(%d): [%d]", i, retry_value[i]);
-
- return ret;
-}
-
-/**
- * @fn int __check_state_machine_state(int internal_state)
- * @brief This function to check state of sm, accoring to the state, it will send message
- * @param internal_state [in] internal state of sm
- * @return int result of function
- */
-static int __check_state_machine_state(int internal_state)
-{
- sm_msgq_buf_s msg_buf = { 0, };
-
- _D("check state machine: current_state(%d), internal_state(%d)", __get_current_state(), internal_state);
- switch (__get_current_state()) {
- case STATEMACHINE_INIT:
- switch (internal_state) {
- case DOCKER_STATUS_NO_ERROR: /* Successful */
- _D("DOCKER_STATUS_NO_ERROR");
- __set_changed_state(STATEMACHINE_IDLE);
- msg_buf.docker_status = internal_state;
- __send_message(&msg_buf);
- break;
- case DOCKER_STATUS_STARTED: /* docker daemon Started */
-// [workaround] It will be modified after completed seperating engine service
-// Currently, this case is from DOCKER_STATUS_NETWORK_BRIDGE_FAIL
-// So, after previous daemon kill, re-enterance INIT state is need.
- msg_buf.docker_status = internal_state;
- __send_message(&msg_buf);
- break;
- case DOCKER_STATUS_ENGINE_FAIL: /* docker engine error */
- case DOCKER_STATUS_ENGINE_API_FAIL: /* docker engine api error */
- case DOCKER_STATUS_SERVICE_FAIL: /* service start error */
- case DOCKER_STATUS_INVALID_PARAM: /* parameter invalid */
- case DOCKER_STATUS_UNKNOWN: /* unknown error */
- __set_changed_state(STATEMACHINE_RECOVERY);
- break;
- default:
- break;
- }
- break;
- case STATEMACHINE_IDLE:
- switch (internal_state) {
- case DOCKER_STATUS_NO_ERROR:
- /* expire timer
- state : IDLE, and started timer
- condition : docker_status is OK */
- __exit_timer();
- break;
- case DOCKER_STATUS_STARTED:
- case DOCKER_STATUS_ENGINE_FAIL:
- case DOCKER_STATUS_ENGINE_API_FAIL:
- case DOCKER_STATUS_SERVICE_FAIL:
- case DOCKER_STATUS_INVALID_PARAM:
- case DOCKER_STATUS_UNKNOWN:
- /* start timer,
- state : IDLE
- condition : docker_status has ERROR */
- __start_timer(internal_state);
- break;
- case DOCKER_STATUS_NETWORK_BRIDGE_FAIL: /* docker network bridge error */
- case DOCKER_STATUS_INIT_FAIL: /* docker engine init fail */
- /* expire timer
- state : IDLE, and NETWORK_BRIDGE_FAIL
- state machine will be changed INIT */
- __exit_timer();
- __set_changed_state(STATEMACHINE_RECOVERY);
- msg_buf.docker_status = internal_state;
- __send_message(&msg_buf);
- break;
- default:
- break;
- }
- break;
- case STATEMACHINE_RECOVERY:
- case STATEMACHINE_FAILED:
- default:
- _D("TO DO: need to define behavior at current state");
- break;
- }
- return 0;
-}
-
-/**
- * @fn int __state_machine_check(void)
- * @brief This function to check state machine
- * @return int result of function
- */
-static int __state_machine_check(void)
-{
- int ret;
- int msgqid;
- int msg_size;
- int docker_status;
- int container_status;
- int event_type;
- char *container_name = NULL;
- sm_msgq_buf_s msg_buf = { 0, };
-
- msg_size = sizeof(sm_msgq_buf_s) - sizeof(msg_buf.mtype);
- msgqid = msgget((key_t) STATEMACHINE_QID, IPC_CREAT | 0666);
-
- while (1) {
- if (msgrcv(msgqid, &msg_buf, msg_size, 0, 0) == -1)
- _E("msgrcv error(%d)", errno);
-
- event_type = msg_buf.sm_type;
- docker_status = msg_buf.docker_status;
-
- if (event_type == SM_TYPE_CONTAINER_STATUS) {
- if (msg_buf.container_info.container_name != NULL) {
- docker_status = msg_buf.docker_status;
- container_name = (char *)malloc(sizeof(char) * (strlen(msg_buf.container_info.container_name) + 1));
- memset(container_name, 0x00, (strlen(msg_buf.container_info.container_name) + 1));
- strncpy(container_name, msg_buf.container_info.container_name, strlen(msg_buf.container_info.container_name) + 1);
- free(msg_buf.container_info.container_name);
- container_status = msg_buf.container_info.container_status;
- _D("msgrcv: event(%d), container_name(%s), container_status(%d)", event_type, container_name, container_status);
- /* update current container status from SM_TYPE_CONTAINER_STATUS event */
- __update_sm_containers_list(container_name, container_status);
- __display_sm_containers_list();
- }
- }
-
- _D("__get_current_state(%d), docker_status(%d)", __get_current_state(), docker_status);
- ret = docker_status;
- switch (__get_current_state()) {
- case STATEMACHINE_INIT:
- _D("STATEMACHINE_INIT");
- if (docker_status != DOCKER_STATUS_NO_ERROR)
- ret = dzl_dockerctl_docker_start();
- break;
- case STATEMACHINE_IDLE:
- _D("STATEMACHINE_IDLE");
- if (docker_status == DOCKER_STATUS_NO_ERROR)
- ret = dzl_lifecycle_init_factory_service();
- break;
- case STATEMACHINE_RECOVERY:
- _D("STATEMACHINE_RECOVERY");
- ret = __recovery_state(docker_status);
- break;
- case STATEMACHINE_FAILED:
- _D("STATEMACHINE_FAILED");
- break;
- default:
- break;
- }
-
- __check_state_machine_state(ret);
- }
- return 0;
-}
-
-/**
- * @fn static void __state_mainloop(void)
- * @brief This function to start state mainloop
- * @return void
- */
-static void *__state_mainloop(void *arg)
-{
- pthread_detach(pthread_self());
-
- _D("__state_mainloop start");
-
- __state_machine_check();
-
- pthread_exit((void *)0);
-
- return NULL;
-}
-
-void dzl_lifecycle_state_init(void)
-{
- sm_msgq_buf_s msg_buf = { 0, };
-
- __set_changed_state(STATEMACHINE_INIT);
-
- msg_buf.docker_status = DOCKER_STATUS_UNKNOWN;
- msg_buf.container_info.container_status = CONTAINER_STATUS_UNKNOWN;
- __send_message(&msg_buf);
-}
-
-void dzl_lifecycle_restart_dockerd(void)
-{
- sm_msgq_buf_s msg_buf = { 0, };
-
- _D("dzl_dockerctl_docker_stop");
- dzl_dockerctl_engine_stop();
-
- _D("__set_changed_state : STATEMACHINE_INIT");
- __set_changed_state(STATEMACHINE_INIT);
- msg_buf.docker_status = DOCKER_STATUS_UNKNOWN;
- msg_buf.container_info.container_status = CONTAINER_STATUS_UNKNOWN;
- __send_message(&msg_buf);
-}
-
-void dzl_lifecycle_stop_dockerd(void)
-{
- sm_msgq_buf_s msg_buf = { 0, };
-
- _D("dzl_dockerctl_docker_stop");
- dzl_dockerctl_engine_stop();
-
-/*
- __set_changed_state(DOCKER_STATUS_INIT_FAIL);
- msg_buf.docker_status = DOCKER_STATUS_UNKNOWN;
- msg_buf.container_info.container_status = CONTAINER_STATUS_UNKNOWN;
- __send_message(&msg_buf);
-*/
-}
-
-int dzl_lifecycle_start(void)
-{
- pthread_t state_thread;
-
- _D("dzl_lifecycle_start");
-
- if (pthread_create(&state_thread, NULL, &__state_mainloop, (void *)NULL) < 0) {
- _E("__state_mainloop thread create error");
- return -1;
- }
-
- return 0;
-}
-
-state_machine_e dzl_lifecycle_get_current_state(void)
-{
- return __get_current_state();
-}
-
-void dzl_lifecycle_set_state(state_machine_e state)
-{
- __set_changed_state(state);
-}
diff --git a/src/dzl_lifecycle.h b/src/dzl_lifecycle.h
deleted file mode 100644
index 8b91fbc..0000000
--- a/src/dzl_lifecycle.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * @file dzl_lifecycle.h
- * @brief Management for life cycle of container and services from docker
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __DZL_LIFECYCLE_H__
-#define __DZL_LIFECYCLE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief This enum contains stats machine information
- *
- * The state_machine_e indicates what is state of state machine
- *
- */
- typedef enum {
- STATEMACHINE_INIT = 0,
- /**< initialize docker daemon */
- STATEMACHINE_IDLE, /**< factory init, monitoring docker and container */
- STATEMACHINE_RECOVERY,
- /**< recovery docker daemon */
- STATEMACHINE_FAILED,/**< waiting user action */
- STATEMACHINE_END,
- } state_machine_e;
-
-/**
- * @fn int dzl_lifecycle_start(void)
- * @brief This function to start state machine
- * @return int return function result
- */
- int dzl_lifecycle_start(void);
-/**
- * @fn void dzl_lifecycle_state_init(void)
- * @brief This function to start state machine
- * @return void
- */
- void dzl_lifecycle_state_init(void);
-/**
- * @fn state_machine_e dzl_lifecycle_get_current_state(void)
- * @brief This function to get current state of state-machine
- * @return state_machine_e return state of sm
- */
- state_machine_e dzl_lifecycle_get_current_state(void);
-/**
- * @fn dzl_lifecycle_set_state(state_machine_e state)
- * @brief This function to set state for state-machine
- * @param state [in] machine state that you want to set
- */
- void dzl_lifecycle_set_state(state_machine_e state);
-/**
- * @fn dzl_lifecycle_restart_dockerd(void)
- * @brief This function to restart docker engine
- * @param void
- */
- void dzl_lifecycle_restart_dockerd(void);
-/**
- * @fn dzl_lifecycle_stop_dockerd(void)
- * @brief This function to stop docker engine
- * @param void
- */
- void dzl_lifecycle_stop_dockerd(void);
-/**
- * @fn dzl_lifecycle_init_factory_service(void)
- * @brief This function to init factory reset
- * @param void
- */
- int dzl_lifecycle_init_factory_service(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DZL_LIFECYCLE_H__ */
diff --git a/src/dzl_server.c b/src/dzl_server.c
deleted file mode 100644
index 94b32d6..0000000
--- a/src/dzl_server.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
-* @file dzl_server.c
-* @brief server part using ipc methods
-
-* Copyright (c) 2017 Samsung Electronics Co., Ltd.
-* This software is the confidential and proprietary information
-* of Samsung Electronics, Inc. ("Confidential Information"). You
-* shall not disclose such Confidential Information and shall use
-* it only in accordance with the terms of the license agreement
-* you entered into with Samsung.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include "ipc.h"
-#include "dzl_server.h"
-#include "ipc_config.h"
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-
-int IPC_StartServer(char *(*pFunc) (char *, int))
-{
- SOCKET_HANDLE handle;
-
- int ret = 0;
- char *buf = NULL;
- int msgSize = 0;
- char *ret_buf = NULL;
-
- _D("dzl_server start");
- ret = IPC_OpenServerConnection(SERVER, &handle);
- _D("IPC_OpenServerConnection ret=%d", ret);
-
- if (ret >= 0) {
- while (1) {
- if (IPC_ClientAccept(&handle) != -1) {
- ret = IPC_GetMessage(&handle, &msgSize);
- _D("<<Server>> msgSize = %d", msgSize);
- if (msgSize > 0) {
- buf = (char *)malloc(msgSize + 1);
- if (buf == NULL) {
- _D("dzl_server buff is null!!");
- IPC_OpenServerClose(&handle);
- IPC_SocketOpenClientClose(&handle);
- return -1;
- }
- memset(buf, 0x00, msgSize + 1);
- IPC_RecvMessage(&handle, buf, msgSize);
- _D("<<Server>> recvData = %s", buf);
-
- /* Server mainloop */
- ret_buf = pFunc(buf, strlen(buf));
- _D("<<Server>> sendData = %s", ret_buf);
- if (ret_buf != NULL) {
- IPC_SendMessage(&handle, ret_buf, strlen(ret_buf));
- free(ret_buf);
- }
- if (buf != NULL)
- free(buf);
- }
- }
- }
- ret = IPC_OpenServerClose(&handle);
-
- } else {
- _E("<<Server>> server open error !!");
- return -1;
- }
- _D("<<Server>> close");
- return 0;
-}
-
-int IPC_RegisterCallback(char *data, int size)
-{
- SOCKET_HANDLE * handle = NULL;
- if (data == NULL) {
- printf("<<Server>> SendMessage empty!!!\n");
- return -1;
- }
- handle = (SOCKET_HANDLE *) malloc(sizeof(struct _IPC_SOCKET_HANDLE_s));
- if (handle == NULL)
- return -1;
-
- if (IPC_OpenClientConnection(EVENT_SERVER, handle) >= 0) {
- if (handle->client_h >= 0) {
- printf("Server>> Send Message data = %s, size = %d\n", data, size);
- IPC_SendMessage(handle, data, strlen(data));
- IPC_OpenClientClose(handle);
- } else
- _E("<<Server>> handle->client_h error !!");
- } else {
- printf("<<Server>> notify server connection error!!\n");
- if (handle->client_h >= 0) {
- IPC_OpenClientClose(handle);
- if (handle != NULL)
- free(handle);
- return -1;
- } else
- _E("<<Server>> handle->client_h error !!");
- }
- if (handle != NULL)
- free(handle);
- return 0;
-}
diff --git a/src/dzl_server.h b/src/dzl_server.h
deleted file mode 100644
index 3a8b2ab..0000000
--- a/src/dzl_server.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
-* @file dzl_server.h
-* @brief server part using ipc methods
-
-* Copyright (c) 2017 Samsung Electronics Co., Ltd.
-* This software is the confidential and proprietary information
-* of Samsung Electronics, Inc. ("Confidential Information"). You
-* shall not disclose such Confidential Information and shall use
-* it only in accordance with the terms of the license agreement
-* you entered into with Samsung.
-*/
-
-#ifndef __DZL_SERVER_H__
-#define __DZL_SERVER_H__
-
-#ifdef __cplusplus
-extern "C" {
-
-#endif /*
-*/
-
-/**
-* @fn int IPC_StartServer(char *(*pFunc)(char *, int))
-* @brief this function to start IPC server
-* @param *(*pFunc)(char *, int) [in] function pointer
-* @return int result of function
-*/
-int IPC_StartServer(char *(*pFunc) (char *, int));
-
-/**
-* @fn int IPC_RegisterCallback(char *data, int size)
-* @brief this function to register callback through IPC
-* @param *data [in] callback function and params data
-* @param *size [in] size of data
-* @return int function return
-*/
-int IPC_RegisterCallback(char *data, int size);
-
-
-#ifdef __cplusplus
-}
-#endif /*
-*/
-
-#endif /* __DZL_SERVER_H__ */
diff --git a/src/dzl_setting.c b/src/dzl_setting.c
deleted file mode 100755
index 8696eb0..0000000
--- a/src/dzl_setting.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/**
- * @file DZL_Setting.c
- * @brief Generation of configuration for docker and images
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include "dockzen_types.h"
-#include "json_util.h"
-#include "dzl_internal_types.h"
-#include "dzl_setting.h"
-#include "yaml_util.h"
-
-#define FACTORY_INIT_FLAG_FILE "/opt/beluga/system/env/factory_init.json"
-#define DOCKER_DAEMON_CONFIG_FILE "/opt/beluga/system/docker/dockerd_start.json"
-
-#define SYSTEM_AGENT_CONFIG_FILE "/opt/beluga/setup-adaptor/container/config-agent.yml"
-#define SERVICE_AGENT_CONFIG_FILE "/opt/beluga/setup-adaptor/container/config-service.yml"
-
-#define PRE_INSTALLED_FILE_PATH "/opt/beluga/setup-adaptor/images/"
-
-#define SERVICE_AGENT_REPO_FILE "/etc/beluga/sc/service_agent.json"
-
-static char (*pre_installed_file_list)[FILE_PATH_MAX];
-
-/**
- * @fn static int __get_info_from_json(char *file_name, container_create_info_s *container_create_info_h)
- * @brief This function to get container creation parameters from file of json
- * @param *file_name [in] json file name
- * @param *container_create_info_h [inout] fill container creation parameters
- * @return int result of function
- */
-static int __get_info_from_json(char *file_name, container_create_info_s * container_create_info_h)
-{
- char *json_data = NULL;
- int read_len = 0;
- int fd = 0;
- int len = 0;
-
- fd = open(file_name, O_RDONLY);
- if (fd >= 0) {
- len = lseek(fd, 0L, SEEK_END) - 1;
- if (lseek(fd, 0L, SEEK_SET) < 0) {
- _E("find beginning of file returns error");
- close(fd);
- return -1;
- } else {
- json_data = (char *)malloc(len + 1);
- if (json_data) {
- memset(json_data, 0x00, len + 1);
-
- read_len = read(fd, json_data, len);
- if (read_len > 0 && read_len <= len) {
- container_create_info_h->name = json_getString(json_data, "name");
- container_create_info_h->image = json_getString(json_data, "image");
- container_create_info_h->entry_cmd = json_getString(json_data, "entry_cmd");
- container_create_info_h->volume = json_getString(json_data, "volume");
- container_create_info_h->port = json_getString(json_data, "port");
- container_create_info_h->net_mode = json_getString(json_data, "net_mode");
- container_create_info_h->privileged = json_getNumber(json_data, "privileged");
- container_create_info_h->enable = json_getNumber(json_data, "enable");
- }
-
- free(json_data);
- }
- }
- close(fd);
- } else {
- _E("config file can't be opened");
- return -1;
- }
-
- return 0;
-}
-
-static int __get_info_from_yaml(char *file_name, container_create_info_s * container_create_info_h)
-{
- char *container_name = NULL;
- char *image = NULL;
- char *volume = NULL;
- char *port = NULL;
- char *net_mode = NULL;
- char *privileged = NULL;
- char *enable = NULL;
- char *environment = NULL;
-
- if (!yaml_getContents(file_name, "image", &image))
- container_create_info_h->image = image;
-
- if (!yaml_getContents(file_name, "port", &port))
- container_create_info_h->port = port;
-
- if (!yaml_getContents(file_name, "container_name", &container_name))
- container_create_info_h->name = container_name;
-
- if (!yaml_getContents(file_name, "net_mode", &net_mode))
- container_create_info_h->net_mode = net_mode;
-
- if (!yaml_getContents(file_name, "volumes", &volume))
- container_create_info_h->volume = volume;
-
- if (!yaml_getContents(file_name, "privileged", &privileged)) {
- if (privileged) {
- if (!strcmp(privileged, "true"))
- container_create_info_h->privileged = 1;
- else
- container_create_info_h->privileged = 0;
- }
- }
- if (!yaml_getContents(file_name, "enable", &enable)) {
- if (enable) {
- if (!strcmp(enable, "true"))
- container_create_info_h->enable = 1;
- else
- container_create_info_h->enable = 0;
- }
- }
- if (!yaml_getContents(file_name, "environment", &environment))
- container_create_info_h->environment = environment;
-
- return 0;
-}
-
-static int __get_image_repo(char *file_name, image_load_info_s * load_info_p)
-{
- char *json_data = NULL;
- int read_len = 0;
- int fd = 0;
- int len = 0;
- int ret = 0;
-
- fd = open(file_name, O_RDONLY);
- if (fd >= 0) {
- len = lseek(fd, 0L, SEEK_END) - 1;
- if (lseek(fd, 0L, SEEK_SET) < 0) {
- ret = -1;
- _E("find beginning of file returns error");
- } else {
- json_data = (char *)malloc(len + 1);
- if (json_data) {
- memset(json_data, 0x00, len + 1);
- read_len = read(fd, json_data, len);
- if (read_len > 0 && read_len <= len) {
- load_info_p->name = json_getString(json_data, "name");
- load_info_p->image_repo = json_getString(json_data, "image_repo");
- }
- free(json_data);
- }
- }
- close(fd);
- } else {
- _E("file open error");
- ret = -1;
- }
- return ret;
-}
-
-/**
- * @fn static int __get_config_info(container_create_info_s *create_info_p, char *file_name)
- * @brief This function to get config info from file
- * @param *create_info_p [inout] fill container creation parameters
- * @param *file_name [in] json file name
- * @return int result of function
- */
-static int __get_config_info(container_create_info_s * create_info_p, char *file_name)
-{
-
- // it is based from json config file
-/*
- if (__get_info_from_json(file_name, create_info_p) < 0) {
- _D("__get_config_json failed\n");
- return -1;
- }
-*/
- // it is base from yaml config file
- if (__get_info_from_yaml(file_name, create_info_p) < 0) {
- _D("__get_info_from_yaml failed\n");
- return -1;
- }
-
- return 0;
-}
-
-int dzl_setting_get_docker_info(char **dockerd_opt_cmd)
-{
- int fd = 0;
- int len = 0;
- char *json_data = NULL;
- int read_len = 0;
-
- fd = open(DOCKER_DAEMON_CONFIG_FILE, O_RDONLY);
- if (fd >= 0) {
- len = lseek(fd, 0L, SEEK_END) - 1;
- if (lseek(fd, 0L, SEEK_SET) < 0) {
- _E("find beginning of file returns error");
- close(fd);
- return -1;
- } else {
- json_data = (char *)malloc(len + 1);
- if (json_data != NULL) {
- memset(json_data, 0x00, len + 1);
- read_len = read(fd, json_data, len);
- if (read_len > 0 && read_len <= len) {
- *dockerd_opt_cmd = json_getString(json_data, "opt_cmd");
- _D("dockerd_opt_cmd: %s(%p)", *dockerd_opt_cmd, *dockerd_opt_cmd);
- }
- free(json_data);
- }
- }
- close(fd);
- } else {
- _E("file open error");
- return -1;
- }
-
- return 0;
-}
-
-int dzl_setting_set_factory_init_done(int flag)
-{
- int fd = 0;
- const char *buf = NULL;
- char *ret_buf = NULL;
- struct json_object *newObj = NULL;
-
- newObj = json_object_new_object();
- json_object_object_add(newObj, "worked", json_object_new_int(flag));
- buf = json_object_to_json_string(newObj);
-
- ret_buf = (char *)malloc(strlen(buf) + 1);
- if (ret_buf == NULL) {
- _D("malloc failed");
- return -1;
- }
-
- memset(ret_buf, 0x00, strlen(buf));
- memcpy(ret_buf, buf, strlen(buf) + 1);
-
- json_object_put(newObj);
-
- _D("ret_buf:%s", ret_buf);
-
- fd = open(FACTORY_INIT_FLAG_FILE, O_WRONLY | O_CREAT, 0644);
- if (fd >= 0) {
- write(fd, ret_buf, strlen(ret_buf));
- close(fd);
- } else {
- _E("file open error");
- free(ret_buf);
- return -1;
- }
-
- if (ret_buf != NULL)
- free(ret_buf);
- return 0;
-}
-
-int dzl_setting_get_factory_init_done(void)
-{
- char *json_data = NULL;
- int read_len = 0;
- int fd = 0;
- int len = 0;
- int flag = 0;
-
- if (access(FACTORY_INIT_FLAG_FILE, 0) != 0) {
- _D("there is no factory init config file, generate factory init config file.");
- flag = 0;
- if (dzl_setting_set_factory_init_done(flag) < 0)
- _D("Failed to create file of factory init.");
- } else {
- fd = open(FACTORY_INIT_FLAG_FILE, O_RDONLY);
- if (fd >= 0) {
- len = lseek(fd, 0L, SEEK_END);
- if (lseek(fd, 0L, SEEK_SET) < 0) {
- _E("find beginning of file returns error");
- close(fd);
- return -1;
- } else {
- json_data = (char *)malloc(len + 1);
- if (json_data != NULL) {
- memset(json_data, 0x00, len + 1);
- read_len = read(fd, json_data, len);
- if (read_len > 0 && read_len <= len)
- flag = json_getNumber(json_data, "worked");
- free(json_data);
- }
- }
- close(fd);
- } else {
- _E("file open error");
- return -1;
- }
- }
- return flag;
-}
-
-/*
-* get the information of agent container for creating service
-*/
-int dzl_setting_get_system_agent_info(container_create_info_s ** create_info_p)
-{
- int ret;
-
- *create_info_p = malloc(sizeof(container_create_info_s));
- memset(*create_info_p, 0x00, sizeof(container_create_info_s));
-
- if (access(SYSTEM_AGENT_CONFIG_FILE, 0) != 0) {
- _D("there is no config file, agent service will not created");
- return -1;
- }
-
- ret = __get_config_info(*create_info_p, SYSTEM_AGENT_CONFIG_FILE);
- if (ret != 0) {
- _D("ret:DOCKER_STATUS_UNKNOWN --> exit for user recovery");
- return -1;
- }
- return 0;
-}
-
-/*
-* get the information of agent container for creating service
-*/
-int dzl_setting_get_service_agent_info(container_create_info_s ** create_info_p)
-{
- int ret;
-
- _D("dzl_setting_get_service_agent_info");
-
- *create_info_p = malloc(sizeof(container_create_info_s));
- memset(*create_info_p, 0x00, sizeof(container_create_info_s));
-
- if (access(SERVICE_AGENT_CONFIG_FILE, 0) != 0) {
- _D("there is no config file, agent service will not created");
- return -1;
- }
-
- ret = __get_config_info(*create_info_p, SERVICE_AGENT_CONFIG_FILE);
- if (ret != 0) {
- _D("ret:DOCKER_STATUS_UNKNOWN --> exit for user recovery");
- return -1;
- }
- return 0;
-}
-
-/*
-* get the information of service container for loading image
-*/
-int dzl_setting_get_image_load_info(image_load_info_s ** load_info_p)
-{
- int ret;
-
- *load_info_p = malloc(sizeof(image_load_info_s));
- memset(*load_info_p, 0x00, sizeof(image_load_info_s));
-
- if (access(SERVICE_AGENT_REPO_FILE, 0) != 0) {
- _D("there is no service agent repo file");
- return -1;
- }
-
- if (__get_image_repo(SERVICE_AGENT_REPO_FILE, *load_info_p) != 0) {
- _D("get repo information from json failed");
- return -2;
- }
- return 0;
-}
-
-/*
-* get the lists of pre_installed container list as the count of return(int)
-*/
-char (*__get_pre_installed_file_list(void))[FILE_PATH_MAX] {
- DIR *dir;
- int validCnt = 0;
- char *find = NULL;
- char validFileName[FILE_PATH_MAX] = { 0, };
- static char name_buf[FILE_CNT_MAX][FILE_PATH_MAX] = { 0, };
- int file_name_len = 0;
- struct dirent entry = { 0, };
- struct dirent *result = NULL;
- int ret = 0;
-
- dir = opendir(PRE_INSTALLED_FILE_PATH);
- if (dir == NULL) {
- _D("%s folder is empty!!!, Nothing to load", PRE_INSTALLED_FILE_PATH);
- return NULL;
- }
-
- while ((ret = readdir_r(dir, &entry, &result)) == 0 && result != NULL) {
- if (entry.d_name[0] != '.') {
- find = strchr(entry.d_name, '.');
- if (find && strncmp(find, ".tar", 4) == 0) {
- memset(validFileName, 0x00, sizeof(validFileName));
- file_name_len = strlen(PRE_INSTALLED_FILE_PATH) + strlen(entry.d_name) + 1;
- if (file_name_len >= FILE_PATH_MAX)
- _E("ERROR: file path too long(%d), need to check validation", file_name_len);
- else {
- snprintf(validFileName, file_name_len, "%s%s", PRE_INSTALLED_FILE_PATH, entry.d_name);
- strncpy(name_buf[validCnt], validFileName, FILE_PATH_MAX - 1);
- name_buf[validCnt][FILE_PATH_MAX - 1] = '\0';
- _D("name_buf[%d] : %s", validCnt, name_buf[validCnt]);
- validCnt++;
- }
- }
- }
- }
-
- closedir(dir);
- return name_buf;
-}
-
-/*
-* this function to get count of pre_installed files
-*/
-int dzl_setting_get_pre_installed_file_cnt(void)
-{
- int index = 0;
- char *file_name = NULL;
-
- pre_installed_file_list = __get_pre_installed_file_list();
- if (pre_installed_file_list != NULL) {
- do {
- if (pre_installed_file_list[index][0] == 0)
- break;
- else {
- file_name = pre_installed_file_list[index];
- _D(">>> file : {%s}", file_name);
- index++;
- }
- } while (1);
- }
- return index;
-}
-
-/*
-* this function to get file name of pre_installed files
-*/
-int dzl_setting_get_pre_installed_filename(int index, char file_name[])
-{
- if ((pre_installed_file_list != NULL) && (pre_installed_file_list[index][0] != NULL)) {
- _D("pre_installed_file_list[%d]: %s", index, pre_installed_file_list[index]);
- strncpy(file_name, pre_installed_file_list[index], FILE_PATH_MAX - 1);
- file_name[FILE_PATH_MAX - 1] = '\0';
- _D("file_name(%s)", file_name);
- return 0;
- } else {
- _D("there is no file with [%d] index", index);
- return -1;
- }
-}
diff --git a/src/dzl_setting.h b/src/dzl_setting.h
deleted file mode 100644
index 5ec95f6..0000000
--- a/src/dzl_setting.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * @file dzl_setting.h
- * @brief Generation of configuration for docker and images
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __DZL_SETTING_H__
-#define __DZL_SETTING_H__
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FILE_CNT_MAX 10
-#define FILE_PATH_MAX 1024
-
-/**
- * @fn int dzl_setting_get_docker_info(char **dockerd_opt_cmd)
- * @brief this function to get docker info
- * @param **dockerd_opt_cmd [out] option for docker engine
- * @return int result of fucntion
- */
- int dzl_setting_get_docker_info(char **dockerd_opt_cmd);
-/**
- * @fn int dzl_setting_get_system_agent_info(container_create_info_s **create_info_p)
- * @brief this function to get agent config info
- * @param *create_info_p [out] agent service info from config
- * @return int result of fucntion
- */
- int dzl_setting_get_system_agent_info(container_create_info_s ** create_info_p);
-/**
- * @fn int dzl_setting_get_service_agent_info(container_create_info_s **create_info_p)
- * @brief this function to get agent config info
- * @param *create_info_p [out] agent service info from config
- * @return int result of fucntion
- */
- int dzl_setting_get_service_agent_info(container_create_info_s ** create_info_p);
-/**
- * @fn dzl_setting_get_image_load_info(image_load_info_s **load_info_p)
- * @brief this function to get loading config info
- * @param *load_info_p [out] loading info from config
- * @return int result of fucntion
- */
- int dzl_setting_get_image_load_info(image_load_info_s ** load_info_p);
-/**
- * @fn int dzl_setting_get_service_lists(container_create_info_s **lists)
- * @brief this function to get service list
- * @param **lists [out] services lists from config
- * @return int result of fucntion
- */
- int dzl_setting_get_service_lists(container_create_info_s ** lists);
-/**
- * @fn int dzl_setting_get_factory_init_done(void)
- * @brief callback function to check status
- * @return int result of fucntion
- */
- int dzl_setting_get_factory_init_done(void);
-/**
- * @fn int dzl_setting_set_factory_init_done(int flag)
- * @brief this function to set factory init
- * @param flag [in] value for setting factory init
- * @return int result of fucntion
- */
- int dzl_setting_set_factory_init_done(int flag);
-/**
- * @fn int dzl_setting_get_pre_installed_file_cnt(void)
- * @brief this function to get count of pre_installed files
- * @return int result of fucntion
- */
- int dzl_setting_get_pre_installed_file_cnt(void);
-/**
- * @fn int dzl_setting_get_pre_installed_filename(int index, char file_name[])
- * @brief this function to get file name of pre_installed files
- * @param int [in] index of file
- * @param char[] [out] file name of index
- * @return int result of fucntion
- */
- int dzl_setting_get_pre_installed_filename(int index, char file_name[]);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DZL_SETTING_H__ */
diff --git a/src/include/Container.h b/src/include/Container.h
new file mode 100644
index 0000000..42ba78e
--- /dev/null
+++ b/src/include/Container.h
@@ -0,0 +1,30 @@
+#ifndef __CONTAINER_H__
+#define __CONTAINER_H__
+
+#include <memory>
+
+#include "Image.h"
+#include "Config/Config.h"
+#include "Extension/Extension.h"
+
+#include "internal_types.h"
+
+class Container
+{
+public:
+ Container(const ContainerType type) : TYPE(type), startOnBoot(false) {}
+ virtual ~Container() = default;
+
+public:
+ const ContainerType TYPE;
+ Config::Fingerprint fingerprint;
+ bool startOnBoot;
+
+ std::shared_ptr<Image> image;
+
+ std::unique_ptr<Config::ContainerConfigs> containerConfig;
+ std::shared_ptr<Config::SharedConfigs> sharedConfig;
+ Extension::ExtensionSet extConfigs;
+};
+
+#endif /* __CONTAINER_H__ */
diff --git a/src/include/Image.h b/src/include/Image.h
new file mode 100644
index 0000000..494b122
--- /dev/null
+++ b/src/include/Image.h
@@ -0,0 +1,31 @@
+#ifndef __IMAGE_H__
+#define __IMAGE_H__
+
+#include <memory>
+#include <mutex>
+#include <set>
+
+#include "Config/Config.h"
+#include "Extension/Extension.h"
+
+#include "internal_types.h"
+
+class Container;
+
+class Image
+{
+public:
+public:
+ Image(const ContainerType type) : TYPE(type) {}
+ ~Image() = default;
+
+public:
+ const ContainerType TYPE;
+ Config::Fingerprint fingerprint;
+ std::mutex lock;
+
+ std::unique_ptr<Config::ImageConfigs> configs;
+ std::set<std::weak_ptr<Container>> containers;
+};
+
+#endif /* __IMAGE_H__ */
diff --git a/src/include/Volume.h b/src/include/Volume.h
new file mode 100644
index 0000000..9f5bfd0
--- /dev/null
+++ b/src/include/Volume.h
@@ -0,0 +1,53 @@
+#ifndef __VOLUME_H__
+#define __VOLUME_H__
+
+#include <string>
+#include <memory>
+#include <mutex>
+#include <set>
+#include <atomic>
+#include <filesystem>
+#include <json/json.h>
+
+#include "internal_types.h"
+#include "Config/Config.h"
+
+class Volume
+{
+public:
+ Volume(const std::string &drv = "dummy")
+ : source(), target(), mutex(), __available(false), __prepared(false), __control(VOLUME_CONTROL_INVALID),
+ __driver(drv), __containers(), __sharedConfig()
+ {
+ }
+ ~Volume() = default;
+
+ bool avail() const { return __available; }
+ bool prepared() const { return __prepared; }
+ int refcount() const { return __containers.size(); }
+
+ const std::string getDriverName() const { return __driver; }
+ VolumeControlType getControlType() const { return __control; }
+
+ virtual Status setConfigs(const Json::Value &value) { return STATUS_NOT_IMPLEMENT; }
+ void setSharedConfig(std::shared_ptr<Config::SharedConfigs> sharedConfig) { __sharedConfig = sharedConfig; }
+
+ void attachContainer(const std::string &containerName) { __containers.emplace(containerName); }
+ void detachContainer(const std::string &containerName) { __containers.erase(containerName); }
+
+public:
+ std::filesystem::path source;
+ std::filesystem::path target;
+ std::mutex mutex;
+
+protected:
+ std::atomic_bool __available;
+ std::atomic_bool __prepared;
+ VolumeControlType __control;
+ const std::string __driver;
+ std::set<std::string> __containers;
+
+ std::shared_ptr<Config::SharedConfigs> __sharedConfig;
+};
+
+#endif /* __VOLUME_H__ */
diff --git a/src/include/dzl_internal_types.h b/src/include/dzl_internal_types.h
deleted file mode 100755
index d9eff5d..0000000
--- a/src/include/dzl_internal_types.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/**
- * @file dzl_internal_types.h
- * @brief Definition for debugging and internal struct and enum
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __DZL_INTERNAL_TYPES_H__
-#define __DZL_INTERNAL_TYPES_H__
-
-#include <string.h>
-
-#if defined(GBS_BUILD)
-#include <dlog.h>
-#endif
-
-#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "docker-launcher"
-
-#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
-
-#if defined(GBS_BUILD)
-//#if !defined(_D)
-#define _D(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __FUNCTION__, __LINE__, ##arg)
-//#endif
-
-#if !defined(_W)
-#define _W(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __FUNCTION__ , __LINE__, ##arg)
-#endif
-
-#if !defined(_E)
-#define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __FUNCTION__ , __LINE__, ##arg)
-#endif
-#else // DGBS_BUILD
-
-#define RST "\033[0m"
-#define RED "\033[0;31m"
-#define IRED "\033[1;91m"
-
-#define _D(fmt, ...) printf(RST "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __FUNCTION__ , __LINE__, ##__VA_ARGS__)
-#define _W(fmt, ...) printf(RED "%s: %s[%d]\t " #fmt RST "\n", __FILENAME__, __FUNCTION__ , __LINE__, ##__VA_ARGS__)
-#define _E(fmt, ...) printf(IRED "%s: %s[%d]\t " #fmt RST "\n", __FILENAME__, __FUNCTION__ , __LINE__, ##__VA_ARGS__)
-
-#endif // DGBS_BUILD
-
-#define STATEMACHINE_QID 0x00000001
-#define DOCKER_INTERFACE_QID 0x00000002
-
-/**
- * @brief This enum contains docker status
- *
- * The docker_status_e indicates what is status of docker interface
- *
- */
-typedef enum {
- DOCKER_STATUS_NO_ERROR = 0, /**< Successful */
- DOCKER_STATUS_STARTED, /**< docker daemon Started */
- DOCKER_STATUS_ENGINE_FAIL, /**< docker engine error */
- DOCKER_STATUS_ENGINE_API_FAIL, /**< docker engine api error */
- DOCKER_STATUS_SERVICE_FAIL, /**< service start error */
- DOCKER_STATUS_INVALID_PARAM, /**< parameter invalid */
- DOCKER_STATUS_NETWORK_BRIDGE_FAIL, /**< network bridge error */
- DOCKER_STATUS_INIT_FAIL, /**< docker engine init fail */
- DOCKER_STATUS_UNKNOWN, /**< unknown error */
- DOCKER_STATUS_MAX
-} docker_status_e;
-
-/**
- * @brief This enum contains container status
- *
- * The container_status_e indicates what is status of container
- *
- */
-typedef enum {
- CONTAINER_STATUS_UNKNOWN = 0, /**< unknown status */
- CONTAINER_STATUS_CREATED, /**< container status is created */
- CONTAINER_STATUS_RUNNING, /**< container status is running */
- CONTAINER_STATUS_STOP, /**< container status is stopped */
- CONTAINER_STATUS_EXITED, /**< container status is exited */
- CONTAINER_STATUS_REMOVED, /**< container is removed */
-} container_status_e;
-
-/**
- * @struct docker_control_info_s
- * @brief This struct contains docker control parameters
- *
- * The docker_control_info_s struct encapsulate *path and *opt_cmd in the one data
- *
- */
-typedef struct {
- char *path;
- char *opt_cmd;
-} docker_control_info_s;
-
-/**
- * @struct mount_info_s
- * @brief This struct contains mount information
- *
- * The mount_info_s struct encapsulate read_only, *source, and *target in the one data
- *
- */
-typedef struct {
- int read_only;
- char *source;
- char *target;
-} mount_info_s;
-
-/**
- * @struct container_create_info_s
- * @brief This struct contains creation parameters for container
- *
- * The container_create_info_s struct encapsulate name, image, entry_cmd, volume, port, net_mode, privileged, environment and enable in the one data
- *
- */
-typedef struct {
- char *name; /**< container name */
- char *image; /**< image name */
- char *entry_cmd; /**< container initialization argument */
- char *port; /**< published port info */
- char *volume; /**< volume mount info count */
- char *net_mode; /**< host mode or bridge mode */
- int privileged; /**< run as privileged mode */
- int enable; /**< enable launching */
- char *environment; /**< container environment */
-} container_create_info_s;
-
-/**
- * @struct image_load_info_s
- * @brief This struct load parameters for pre-installed image
- *
- * The image_load_info_s struct encapsulate name, image in the one data
- *
- */
-typedef struct {
- char *name; /**< tar archive name */
- char *image_repo; /**< image repo */
-} image_load_info_s;
-
-/**
- * @struct dzl_dockerctl_Task
- * @brief This struct contains task information
- *
- * The dzl_dockerctl_Task struct encapsulate id and status in the one data
- *
- */
-typedef struct {
- char id[256];
- char status[256];
-} dzl_dockerctl_Task;
-
-/**
- * @struct dzl_dockerctl_TasksInfo
- * @brief This struct contains count and point of dzl_dockerctl_Task
- *
- * The dzl_dockerctl_TasksInfo struct encapsulate count and *pstTasks in the one data
- *
- */
-typedef struct {
- int count;
- dzl_dockerctl_Task *pstTasks;
-} dzl_dockerctl_TasksInfo;
-
-/**
- * @struct dzl_dockerctl_NetworksInfo
- * @brief This struct contains name and id and gatewayflag
- */
-typedef struct {
- char name[256];
- char id[256];
- int gatewayflag;
-} dzl_dockerctl_NetworksInfo;
-
-/**
- * @struct dzl_dockerctl_Service
- * @brief This struct contains service information
- *
- * The dzl_dockerctl_Service struct encapsulate id, name and imageName in the one data
- *
- */
-typedef struct {
- char id[256];
- char name[256];
- char imageName[256];
-} dzl_dockerctl_Service;
-
-/**
- * @struct dzl_dockerctl_ServicesInfo
- * @brief This struct contains count and point of dzl_dockerctl_Service
- *
- * The dzl_dockerctl_ServicesInfo struct encapsulate count and *pstServices in the one data
- *
- */
-typedef struct {
- int count;
- dzl_dockerctl_Service *pstServices;
-} dzl_dockerctl_ServicesInfo;
-
-/**
- * @struct dzl_dockerctl_serviceinfo_s
- * @brief This struct contains service info to reuse in dockerform
- *
- * The dzl_dockerctl_serviceinfo_s struct encapsulate spec_config, id and version in the one data
- *
- */
-typedef struct {
- char *spec_config;
- char *id;
- int version;
-} dzl_dockerctl_serviceinfo_s;
-
-/**
- * @brief This enum contains monitor type
- *
- * The status_monitor_type_e indicates what is the type of status
- *
- */
-typedef enum {
- SM_TYPE_DOCKER_STATUS = 0, /**< docker-engine status changed */
- SM_TYPE_CONTAINER_STATUS, /**< container status chagned */
- SM_TYPE_CHECK_STATUS, /**< check SM state */
- SM_TYPE_END,
-} status_monitor_type_e;
-
-/**
- * @struct sm_containers_list_s
- * @brief This struct contains count and containers information maximum MAX_CONTAINER_NUM
- *
- * The sm_containers_list_s struct encapsulate count and container in the one data
- *
- */
-typedef struct {
- int count; /**< the counts of containers info */
- struct {
- char *container_name; /**< Container name from service */
- container_status_e status; /**< Container Status : */
- } container[MAX_CONTAINER_NUM]; /**< Max Count constraint */
-} sm_containers_list_s;
-
-/**
- * @struct sm_msgq_buf_s
- * @brief This struct message information in dzl
- *
- * The sm_msgq_buf_s struct encapsulate mytpe, sm_type, docker_status and container_info in the one data
- *
- */
-typedef struct {
- long mtype; /**< message type */
- status_monitor_type_e sm_type; /**< event type */
- docker_status_e docker_status; /**< docker daemon status */
- struct {
- char *container_name; /**< container name from callback event */
- container_status_e container_status; /**< status of container_name */
- } container_info;
-} sm_msgq_buf_s;
-
-
-typedef enum {
- SA_START_LAUNCHER_SVC = 0, /**< start launcher service */
- SA_RESTART_DOCKERD, /**< restart docker engine */
- SA_STOP_DOCKERD, /**< stop docker engine */
- SA_CMD_UNKNOWN
-} sa_interface_cmd_e;
-
-/**
- * @brief This type is definition of status monitor callback
- *
- * The status_monitor_cb includes status, param1 and param2 in the one data
- *
- */
-typedef void (*status_monitor_cb) (status_monitor_type_e status, void *param1, void *param2);
-/**
- * @brief This type is definition of event callback
- *
- * The docker_event_cb includes data,size, nmemb and buffer in the one data
- *
- */
-typedef size_t(*docker_event_cb) (char *data, size_t size, size_t nmemb, void *buffer);
-
-#endif /* __DZL_INTERNAL_TYPES_H__ */
diff --git a/src/include/internal_macros.h b/src/include/internal_macros.h
new file mode 100644
index 0000000..3d33573
--- /dev/null
+++ b/src/include/internal_macros.h
@@ -0,0 +1,16 @@
+#ifndef __INTERNAL_MACROS_H__
+#define __INTERNAL_MACROS_H__
+
+#if __cplusplus >= 201703L
+#define CPP17
+#endif
+
+#if __cplusplus >= 201402L
+#define CPP14
+#endif
+
+#if __cplusplus >= 201103L
+#define CPP11
+#endif
+
+#endif /* __INTERNAL_MACROS_H__ */ \ No newline at end of file
diff --git a/src/include/internal_types.h b/src/include/internal_types.h
new file mode 100644
index 0000000..9aa6ab2
--- /dev/null
+++ b/src/include/internal_types.h
@@ -0,0 +1,137 @@
+#ifndef __INTERNAL_TYPES_H__
+#define __INTERNAL_TYPES_H__
+
+#include <stdint.h>
+#include <unistd.h>
+
+using namespace std::literals;
+
+typedef enum {
+ STATUS_FAIL = 0,
+ STATUS_OK = 1,
+ STATUS_IGNORE = 2,
+ STATUS_NOT_FOUND = 3,
+ STATUS_RETRY = 4,
+ STATUS_NOT_IMPLEMENT,
+} Status;
+
+typedef enum {
+ CONTAINER_TYPE_NONE,
+ CONTAINER_TYPE_DOCKER,
+ CONTAINER_TYPE_LXC,
+ CONTAINER_TYPE_ETC,
+} ContainerType;
+
+typedef enum VolumeControlType {
+ VOLUME_CONTROL_INVALID,
+ VOLUME_CONTROL_UNPROCESSED,
+ VOLUME_CONTROL_DEVICE,
+ VOLUME_CONTROL_BIND,
+ VOLUME_CONTROL_TMPFS,
+} VolumeControlType;
+
+typedef enum FilesystemType {
+ FS_TYPE_UNKNOWN,
+ FS_TYPE_EXT4,
+ FS_TYPE_BTRFS,
+ FS_TYPE_F2FS,
+ FS_TYPE_SQUASHFS,
+} FilesystemType;
+
+typedef enum CLICommandType {
+ CLI_CMD_NONE,
+ CLI_CMD_IMAGE_INFO,
+ CLI_CMD_CONTAINER_INFO,
+ CLI_CMD_IMAGE_BUILD,
+ CLI_CMD_IMAGE_LOAD,
+ CLI_CMD_CONTAINER_CREATE,
+ CLI_CMD_CONTAINER_START,
+ CLI_CMD_CONTAINER_STOP,
+ CLI_CMD_CONTAINER_PURGE,
+ CLI_CMD_CONTAINER_RUNNING,
+ CLI_CMD_CONTAINER_UPDATE,
+ CLI_CMD_END,
+} CLICommandType;
+
+typedef enum CLIServerControl {
+ CLI_SERVER_CONTROL_NONE,
+ CLI_SERVER_CONTROL_RUN,
+ CLI_SERVER_CONTROL_STOP,
+} CLIServerControl;
+
+typedef enum State {
+ STATE_REGISTERED = 0,
+ STATE_IMAGE_BUILDING,
+ STATE_IMAGE_BUILDED,
+ STATE_CREATING,
+ STATE_CREATED,
+ STATE_STARTING,
+ STATE_RESTARTING,
+ STATE_RUNNING,
+ STATE_STOPPING,
+ STATE_STOPPED,
+ STATE_DESTROYING,
+ STATE_DESTROYED,
+ STATE_IMAGE_REMOVING,
+ STATE_IMAGE_REMOVED,
+ STATE_MACHINE_FAILED,
+} State;
+
+typedef enum ContainerStateControl {
+ CONTAINER_STATE_CONTROL_NONE,
+ CONTAINER_STATE_CONTROL_RESTART,
+ CONTAINER_STATE_CONTROL_UPDATE,
+ CONTAINER_STATE_CONTROL_DESTROY,
+ CONTAINER_STATE_CONTROL_REMOVE_IMAGE,
+} ContainerStateControl;
+
+typedef enum ContainerLifecycleManagerStatus {
+ CONTAINER_LIFECYCLE_MANAGER_STATUS_READY,
+ CONTAINER_LIFECYCLE_MANAGER_STATUS_RUNNUNG,
+ CONTAINER_LIFECYCLE_MANAGER_STATUS_STOPPED,
+} ContainerLifecycleManagerStatus;
+
+typedef enum ControlMessageID {
+ CONTAINER_CONTROL_STOP,
+ CONTAINER_CONTROL_DESTROY,
+ CONTAINER_CONTROL_REMOVE_IMAGE,
+ CONTAINER_CONTROL_UPDATE,
+ CONTAINER_LIFECYCLE_MANAGER_CONTROL_STOP,
+} ControlMessageID;
+
+typedef enum CgroupPermissionType {
+ _None,
+ _R = (1 << 0),
+ _W = (1 << 1),
+ _M = (1 << 2),
+ _RW = _R | _W,
+ _RM = _R | _M,
+ _WM = _W | _M,
+ _RWM = _R | _W | _M,
+} CgroupPermissionType;
+
+typedef enum DeviceType {
+ DEV_NONE,
+ DEV_CHAR = 'c',
+ DEV_BLOCK = 'b',
+} DeviceType;
+
+typedef enum MountType {
+ MNT_NONE,
+ MNT_BIND,
+ MNT_VOLUME,
+ MNT_TMPFS,
+} MountType;
+
+typedef enum AdaptorList {
+ ADAPTOR_LIST_NONE = 0,
+ ADAPTOR_LIST_CREATE,
+ ADAPTOR_LIST_DELETE,
+} AdaptorList;
+
+typedef enum AdaptorWatchControl {
+ ADAPTOR_WATCH_CONTROL_NONE,
+ ADAPTOR_WATCH_CONTROL_ON,
+ ADAPTOR_WATCH_CONTROL_OFF,
+} AdaptorWatchControl;
+#endif /* __INTERNAL_TYPES_H__ */
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
deleted file mode 100755
index 13ce340..0000000
--- a/src/lib/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-SET(LIBDOCKZEN "dockzen")
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/)
-FILE(GLOB LIBDOCKZEN_SRCS *.c ${CMAKE_SOURCE_DIR}/src/json_util.c)
-
-IF(NONE_GBS_BUILD)
- INCLUDE_DIRECTORIES(${LINK_LIB_INCLUDE})
-ELSE(NONE_GBS_BUILD)
- INCLUDE(FindPkgConfig)
- PKG_SEARCH_MODULE(JSONC json-c json)
- IF(JSONC_FOUND)
- ADD_DEFINITIONS(-DJSONC)
- INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
- ENDIF(JSONC_FOUND)
-ENDIF(NONE_GBS_BUILD)
-
-ADD_LIBRARY(${LIBDOCKZEN} STATIC ${LIBDOCKZEN_SRCS})
-
-IF(NONE_GBS_BUILD)
- INSTALL(TARGETS ${LIBDOCKZEN} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
- INSTALL(FILES ../../include/dockzen_types.h DESTINATION ${LIB_INSTALL_INCLUDE})
-ENDIF(NONE_GBS_BUILD) \ No newline at end of file
diff --git a/src/lib/build.sh b/src/lib/build.sh
deleted file mode 100755
index c328c80..0000000
--- a/src/lib/build.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /bin/sh
-set -e
-
-# NOTE
-# build script for cli interface with cross-compile environment
-# for arm : ./build.sh arm
-# for amd64 : ./build.sh
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LIBRARY_NAME="libdockzen.a"
-
-TYPES_INCLUDE="../../include"
-DOCKZEN_LIB_INCLUDE="install/include/beluga/"
-JSON_LIB_INCLUDE="install/include/json-c/"
-# build
-#JSON_LIB_PATH=`whereis json-c | awk -F' ' '{print $2}'`
-if [ "$1" = "arm" ]; then
- echo "****************************"
- echo "Target Binary arch is ARM"
- echo "****************************"
-
- DOCKZEN_LIB="install/arm/lib/"
- arm-linux-gnueabi-gcc-4.7 -static -g -c *.c -I$JSON_LIB_INCLUDE -I$TYPES_INCLUDE
-else
- echo "****************************"
- echo "Target Binary arch is amd64"
- echo "****************************"
-
- DOCKZEN_LIB="install/amd64/lib/"
- gcc -static -g -c *.c -I$JSON_LIB_INCLUDE -I$TYPES_INCLUDE
-fi
-ar rc $LIBRARY_NAME *.o
-echo "\033[1;96mbuilt successfully... \033[0m"
-file *.o
-
-echo "\033[1;96minstall successfully... \033[0m"
-echo "OUTPUT library : $DOCKZEN_LIB"
-echo "OUTPUT header : $DOCKZEN_LIB_INCLUDE"
-ls -Al $DOCKZEN_LIB
-
-
-# install to local directory
-mkdir -p $DOCKZEN_LIB
-mkdir -p $DOCKZEN_LIB_INCLUDE
-mv $LIBRARY_NAME $DOCKZEN_LIB
-cp $TYPES_INCLUDE/*.h $DOCKZEN_LIB_INCLUDE
diff --git a/src/lib/install/amd64/lib/libdockzen.a b/src/lib/install/amd64/lib/libdockzen.a
deleted file mode 100644
index 5680aad..0000000
--- a/src/lib/install/amd64/lib/libdockzen.a
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/amd64/lib/libjson-c.a b/src/lib/install/amd64/lib/libjson-c.a
deleted file mode 100644
index dbd17ac..0000000
--- a/src/lib/install/amd64/lib/libjson-c.a
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/amd64/lib/libjson-c.la b/src/lib/install/amd64/lib/libjson-c.la
deleted file mode 100644
index dfc08ac..0000000
--- a/src/lib/install/amd64/lib/libjson-c.la
+++ /dev/null
@@ -1,41 +0,0 @@
-# libjson-c.la - a libtool library file
-# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='libjson-c.so.2'
-
-# Names of this library.
-library_names='libjson-c.so.2.0.2 libjson-c.so.2 libjson-c.so'
-
-# The name of the static archive.
-old_library='libjson-c.a'
-
-# Linker flags that cannot go in dependency_libs.
-inherited_linker_flags=''
-
-# Libraries that this one depends upon.
-dependency_libs=''
-
-# Names of additional weak libraries provided by this library
-weak_library_names=''
-
-# Version information for libjson-c.
-current=2
-age=0
-revision=2
-
-# Is this an already installed library?
-installed=yes
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/home/jiehwan/playground/dockerfw/git/json-c/install/amd64/lib'
diff --git a/src/lib/install/amd64/lib/libjson-c.so b/src/lib/install/amd64/lib/libjson-c.so
deleted file mode 120000
index 9942e8f..0000000
--- a/src/lib/install/amd64/lib/libjson-c.so
+++ /dev/null
@@ -1 +0,0 @@
-libjson-c.so.2.0.2 \ No newline at end of file
diff --git a/src/lib/install/amd64/lib/libjson-c.so.2 b/src/lib/install/amd64/lib/libjson-c.so.2
deleted file mode 120000
index 9942e8f..0000000
--- a/src/lib/install/amd64/lib/libjson-c.so.2
+++ /dev/null
@@ -1 +0,0 @@
-libjson-c.so.2.0.2 \ No newline at end of file
diff --git a/src/lib/install/amd64/lib/libjson-c.so.2.0.2 b/src/lib/install/amd64/lib/libjson-c.so.2.0.2
deleted file mode 100644
index 5e13361..0000000
--- a/src/lib/install/amd64/lib/libjson-c.so.2.0.2
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/arm/include/curl/curl.h b/src/lib/install/arm/include/curl/curl.h
deleted file mode 100755
index ddba98c..0000000
--- a/src/lib/install/arm/include/curl/curl.h
+++ /dev/null
@@ -1,2553 +0,0 @@
-#ifndef __CURL_CURL_H
-#define __CURL_CURL_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-/*
- * If you have libcurl problems, all docs and details are found here:
- * https://curl.haxx.se/libcurl/
- *
- * curl-library mailing list subscription and unsubscription web interface:
- * https://cool.haxx.se/mailman/listinfo/curl-library/
- */
-
-#ifdef CURL_NO_OLDIES
-#define CURL_STRICTER
-#endif
-
-#include "curlver.h" /* libcurl version defines */
-#include "system.h" /* determine things run-time */
-#include "curlbuild.h" /* libcurl build definitions */
-#include "curlrules.h" /* libcurl rules enforcement */
-
-/*
- * Define WIN32 when build target is Win32 API
- */
-
-#if (defined(_WIN32) || defined(__WIN32__)) && \
- !defined(WIN32) && !defined(__SYMBIAN32__)
-#define WIN32
-#endif
-
-#include <stdio.h>
-#include <limits.h>
-
-#if defined(__FreeBSD__) && (__FreeBSD__ >= 2)
-/* Needed for __FreeBSD_version symbol definition */
-#include <osreldate.h>
-#endif
-
-/* The include stuff here below is mainly for time_t! */
-#include <sys/types.h>
-#include <time.h>
-
-#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
-#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || \
- defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H))
-/* The check above prevents the winsock2 inclusion if winsock.h already was
- included, since they can't co-exist without problems */
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#endif
-#endif
-
-/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
- libc5-based Linux systems. Only include it on systems that are known to
- require it! */
-#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
- defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
- defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
- (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))
-#include <sys/select.h>
-#endif
-
-#if !defined(WIN32) && !defined(_WIN32_WCE)
-#include <sys/socket.h>
-#endif
-
-#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
-#include <sys/time.h>
-#endif
-
-#ifdef __BEOS__
-#include <support/SupportDefs.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
-typedef struct Curl_easy CURL;
-typedef struct Curl_share CURLSH;
-#else
-typedef void CURL;
-typedef void CURLSH;
-#endif
-
-/*
- * libcurl external API function linkage decorations.
- */
-
-#ifdef CURL_STATICLIB
-# define CURL_EXTERN
-#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
-# if defined(BUILDING_LIBCURL)
-# define CURL_EXTERN __declspec(dllexport)
-# else
-# define CURL_EXTERN __declspec(dllimport)
-# endif
-#elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS)
-# define CURL_EXTERN CURL_EXTERN_SYMBOL
-#else
-# define CURL_EXTERN
-#endif
-
-#ifndef curl_socket_typedef
-/* socket typedef */
-#if defined(WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H)
-typedef SOCKET curl_socket_t;
-#define CURL_SOCKET_BAD INVALID_SOCKET
-#else
-typedef int curl_socket_t;
-#define CURL_SOCKET_BAD -1
-#endif
-#define curl_socket_typedef
-#endif /* curl_socket_typedef */
-
-struct curl_httppost {
- struct curl_httppost *next; /* next entry in the list */
- char *name; /* pointer to allocated name */
- long namelength; /* length of name length */
- char *contents; /* pointer to allocated data contents */
- long contentslength; /* length of contents field, see also
- CURL_HTTPPOST_LARGE */
- char *buffer; /* pointer to allocated buffer contents */
- long bufferlength; /* length of buffer field */
- char *contenttype; /* Content-Type */
- struct curl_slist *contentheader; /* list of extra headers for this form */
- struct curl_httppost *more; /* if one field name has more than one
- file, this link should link to following
- files */
- long flags; /* as defined below */
-
-/* specified content is a file name */
-#define CURL_HTTPPOST_FILENAME (1<<0)
-/* specified content is a file name */
-#define CURL_HTTPPOST_READFILE (1<<1)
-/* name is only stored pointer do not free in formfree */
-#define CURL_HTTPPOST_PTRNAME (1<<2)
-/* contents is only stored pointer do not free in formfree */
-#define CURL_HTTPPOST_PTRCONTENTS (1<<3)
-/* upload file from buffer */
-#define CURL_HTTPPOST_BUFFER (1<<4)
-/* upload file from pointer contents */
-#define CURL_HTTPPOST_PTRBUFFER (1<<5)
-/* upload file contents by using the regular read callback to get the data and
- pass the given pointer as custom pointer */
-#define CURL_HTTPPOST_CALLBACK (1<<6)
-/* use size in 'contentlen', added in 7.46.0 */
-#define CURL_HTTPPOST_LARGE (1<<7)
-
- char *showfilename; /* The file name to show. If not set, the
- actual file name will be used (if this
- is a file part) */
- void *userp; /* custom pointer used for
- HTTPPOST_CALLBACK posts */
- curl_off_t contentlen; /* alternative length of contents
- field. Used if CURL_HTTPPOST_LARGE is
- set. Added in 7.46.0 */
-};
-
-/* This is the CURLOPT_PROGRESSFUNCTION callback proto. It is now considered
- deprecated but was the only choice up until 7.31.0 */
-typedef int (*curl_progress_callback)(void *clientp,
- double dltotal,
- double dlnow,
- double ultotal,
- double ulnow);
-
-/* This is the CURLOPT_XFERINFOFUNCTION callback proto. It was introduced in
- 7.32.0, it avoids floating point and provides more detailed information. */
-typedef int (*curl_xferinfo_callback)(void *clientp,
- curl_off_t dltotal,
- curl_off_t dlnow,
- curl_off_t ultotal,
- curl_off_t ulnow);
-
-#ifndef CURL_MAX_READ_SIZE
- /* The maximum receive buffer size configurable via CURLOPT_BUFFERSIZE. */
-#define CURL_MAX_READ_SIZE 524288
-#endif
-
-#ifndef CURL_MAX_WRITE_SIZE
- /* Tests have proven that 20K is a very bad buffer size for uploads on
- Windows, while 16K for some odd reason performed a lot better.
- We do the ifndef check to allow this value to easier be changed at build
- time for those who feel adventurous. The practical minimum is about
- 400 bytes since libcurl uses a buffer of this size as a scratch area
- (unrelated to network send operations). */
-#define CURL_MAX_WRITE_SIZE 16384
-#endif
-
-#ifndef CURL_MAX_HTTP_HEADER
-/* The only reason to have a max limit for this is to avoid the risk of a bad
- server feeding libcurl with a never-ending header that will cause reallocs
- infinitely */
-#define CURL_MAX_HTTP_HEADER (100*1024)
-#endif
-
-/* This is a magic return code for the write callback that, when returned,
- will signal libcurl to pause receiving on the current transfer. */
-#define CURL_WRITEFUNC_PAUSE 0x10000001
-
-typedef size_t (*curl_write_callback)(char *buffer,
- size_t size,
- size_t nitems,
- void *outstream);
-
-
-
-/* enumeration of file types */
-typedef enum {
- CURLFILETYPE_FILE = 0,
- CURLFILETYPE_DIRECTORY,
- CURLFILETYPE_SYMLINK,
- CURLFILETYPE_DEVICE_BLOCK,
- CURLFILETYPE_DEVICE_CHAR,
- CURLFILETYPE_NAMEDPIPE,
- CURLFILETYPE_SOCKET,
- CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */
-
- CURLFILETYPE_UNKNOWN /* should never occur */
-} curlfiletype;
-
-#define CURLFINFOFLAG_KNOWN_FILENAME (1<<0)
-#define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1)
-#define CURLFINFOFLAG_KNOWN_TIME (1<<2)
-#define CURLFINFOFLAG_KNOWN_PERM (1<<3)
-#define CURLFINFOFLAG_KNOWN_UID (1<<4)
-#define CURLFINFOFLAG_KNOWN_GID (1<<5)
-#define CURLFINFOFLAG_KNOWN_SIZE (1<<6)
-#define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7)
-
-/* Content of this structure depends on information which is known and is
- achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man
- page for callbacks returning this structure -- some fields are mandatory,
- some others are optional. The FLAG field has special meaning. */
-struct curl_fileinfo {
- char *filename;
- curlfiletype filetype;
- time_t time;
- unsigned int perm;
- int uid;
- int gid;
- curl_off_t size;
- long int hardlinks;
-
- struct {
- /* If some of these fields is not NULL, it is a pointer to b_data. */
- char *time;
- char *perm;
- char *user;
- char *group;
- char *target; /* pointer to the target filename of a symlink */
- } strings;
-
- unsigned int flags;
-
- /* used internally */
- char *b_data;
- size_t b_size;
- size_t b_used;
-};
-
-/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */
-#define CURL_CHUNK_BGN_FUNC_OK 0
-#define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */
-#define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */
-
-/* if splitting of data transfer is enabled, this callback is called before
- download of an individual chunk started. Note that parameter "remains" works
- only for FTP wildcard downloading (for now), otherwise is not used */
-typedef long (*curl_chunk_bgn_callback)(const void *transfer_info,
- void *ptr,
- int remains);
-
-/* return codes for CURLOPT_CHUNK_END_FUNCTION */
-#define CURL_CHUNK_END_FUNC_OK 0
-#define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */
-
-/* If splitting of data transfer is enabled this callback is called after
- download of an individual chunk finished.
- Note! After this callback was set then it have to be called FOR ALL chunks.
- Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.
- This is the reason why we don't need "transfer_info" parameter in this
- callback and we are not interested in "remains" parameter too. */
-typedef long (*curl_chunk_end_callback)(void *ptr);
-
-/* return codes for FNMATCHFUNCTION */
-#define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */
-#define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */
-#define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */
-
-/* callback type for wildcard downloading pattern matching. If the
- string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */
-typedef int (*curl_fnmatch_callback)(void *ptr,
- const char *pattern,
- const char *string);
-
-/* These are the return codes for the seek callbacks */
-#define CURL_SEEKFUNC_OK 0
-#define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */
-#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so
- libcurl might try other means instead */
-typedef int (*curl_seek_callback)(void *instream,
- curl_off_t offset,
- int origin); /* 'whence' */
-
-/* This is a return code for the read callback that, when returned, will
- signal libcurl to immediately abort the current transfer. */
-#define CURL_READFUNC_ABORT 0x10000000
-/* This is a return code for the read callback that, when returned, will
- signal libcurl to pause sending data on the current transfer. */
-#define CURL_READFUNC_PAUSE 0x10000001
-
-typedef size_t (*curl_read_callback)(char *buffer,
- size_t size,
- size_t nitems,
- void *instream);
-
-typedef enum {
- CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
- CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */
- CURLSOCKTYPE_LAST /* never use */
-} curlsocktype;
-
-/* The return code from the sockopt_callback can signal information back
- to libcurl: */
-#define CURL_SOCKOPT_OK 0
-#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return
- CURLE_ABORTED_BY_CALLBACK */
-#define CURL_SOCKOPT_ALREADY_CONNECTED 2
-
-typedef int (*curl_sockopt_callback)(void *clientp,
- curl_socket_t curlfd,
- curlsocktype purpose);
-
-struct curl_sockaddr {
- int family;
- int socktype;
- int protocol;
- unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it
- turned really ugly and painful on the systems that
- lack this type */
- struct sockaddr addr;
-};
-
-typedef curl_socket_t
-(*curl_opensocket_callback)(void *clientp,
- curlsocktype purpose,
- struct curl_sockaddr *address);
-
-typedef int
-(*curl_closesocket_callback)(void *clientp, curl_socket_t item);
-
-typedef enum {
- CURLIOE_OK, /* I/O operation successful */
- CURLIOE_UNKNOWNCMD, /* command was unknown to callback */
- CURLIOE_FAILRESTART, /* failed to restart the read */
- CURLIOE_LAST /* never use */
-} curlioerr;
-
-typedef enum {
- CURLIOCMD_NOP, /* no operation */
- CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
- CURLIOCMD_LAST /* never use */
-} curliocmd;
-
-typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
- int cmd,
- void *clientp);
-
-#ifndef CURL_DID_MEMORY_FUNC_TYPEDEFS
-/*
- * The following typedef's are signatures of malloc, free, realloc, strdup and
- * calloc respectively. Function pointers of these types can be passed to the
- * curl_global_init_mem() function to set user defined memory management
- * callback routines.
- */
-typedef void *(*curl_malloc_callback)(size_t size);
-typedef void (*curl_free_callback)(void *ptr);
-typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
-typedef char *(*curl_strdup_callback)(const char *str);
-typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
-
-#define CURL_DID_MEMORY_FUNC_TYPEDEFS
-#endif
-
-/* the kind of data that is passed to information_callback*/
-typedef enum {
- CURLINFO_TEXT = 0,
- CURLINFO_HEADER_IN, /* 1 */
- CURLINFO_HEADER_OUT, /* 2 */
- CURLINFO_DATA_IN, /* 3 */
- CURLINFO_DATA_OUT, /* 4 */
- CURLINFO_SSL_DATA_IN, /* 5 */
- CURLINFO_SSL_DATA_OUT, /* 6 */
- CURLINFO_END
-} curl_infotype;
-
-typedef int (*curl_debug_callback)
- (CURL *handle, /* the handle/transfer this concerns */
- curl_infotype type, /* what kind of data */
- char *data, /* points to the data */
- size_t size, /* size of the data pointed to */
- void *userptr); /* whatever the user please */
-
-/* All possible error codes from all sorts of curl functions. Future versions
- may return other values, stay prepared.
-
- Always add new return codes last. Never *EVER* remove any. The return
- codes must remain the same!
- */
-
-typedef enum {
- CURLE_OK = 0,
- CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
- CURLE_FAILED_INIT, /* 2 */
- CURLE_URL_MALFORMAT, /* 3 */
- CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for
- 7.17.0, reused in April 2011 for 7.21.5] */
- CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
- CURLE_COULDNT_RESOLVE_HOST, /* 6 */
- CURLE_COULDNT_CONNECT, /* 7 */
- CURLE_WEIRD_SERVER_REPLY, /* 8 */
- CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
- due to lack of access - when login fails
- this is not returned. */
- CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for
- 7.15.4, reused in Dec 2011 for 7.24.0]*/
- CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
- CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server
- [was obsoleted in August 2007 for 7.17.0,
- reused in Dec 2011 for 7.24.0]*/
- CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
- CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
- CURLE_FTP_CANT_GET_HOST, /* 15 */
- CURLE_HTTP2, /* 16 - A problem in the http2 framing layer.
- [was obsoleted in August 2007 for 7.17.0,
- reused in July 2014 for 7.38.0] */
- CURLE_FTP_COULDNT_SET_TYPE, /* 17 */
- CURLE_PARTIAL_FILE, /* 18 */
- CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
- CURLE_OBSOLETE20, /* 20 - NOT USED */
- CURLE_QUOTE_ERROR, /* 21 - quote command failure */
- CURLE_HTTP_RETURNED_ERROR, /* 22 */
- CURLE_WRITE_ERROR, /* 23 */
- CURLE_OBSOLETE24, /* 24 - NOT USED */
- CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */
- CURLE_READ_ERROR, /* 26 - couldn't open/read from file */
- CURLE_OUT_OF_MEMORY, /* 27 */
- /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
- instead of a memory allocation error if CURL_DOES_CONVERSIONS
- is defined
- */
- CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */
- CURLE_OBSOLETE29, /* 29 - NOT USED */
- CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
- CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
- CURLE_OBSOLETE32, /* 32 - NOT USED */
- CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
- CURLE_HTTP_POST_ERROR, /* 34 */
- CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
- CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
- CURLE_FILE_COULDNT_READ_FILE, /* 37 */
- CURLE_LDAP_CANNOT_BIND, /* 38 */
- CURLE_LDAP_SEARCH_FAILED, /* 39 */
- CURLE_OBSOLETE40, /* 40 - NOT USED */
- CURLE_FUNCTION_NOT_FOUND, /* 41 - NOT USED starting with 7.53.0 */
- CURLE_ABORTED_BY_CALLBACK, /* 42 */
- CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
- CURLE_OBSOLETE44, /* 44 - NOT USED */
- CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
- CURLE_OBSOLETE46, /* 46 - NOT USED */
- CURLE_TOO_MANY_REDIRECTS, /* 47 - catch endless re-direct loops */
- CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */
- CURLE_TELNET_OPTION_SYNTAX, /* 49 - Malformed telnet option */
- CURLE_OBSOLETE50, /* 50 - NOT USED */
- CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
- wasn't verified fine */
- CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
- CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
- CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
- default */
- CURLE_SEND_ERROR, /* 55 - failed sending network data */
- CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
- CURLE_OBSOLETE57, /* 57 - NOT IN USE */
- CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
- CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
- CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
- CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */
- CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
- CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
- CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
- CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
- that failed */
- CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
- CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
- accepted and we failed to login */
- CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
- CURLE_TFTP_PERM, /* 69 - permission problem on server */
- CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */
- CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
- CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
- CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */
- CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
- CURLE_CONV_FAILED, /* 75 - conversion failed */
- CURLE_CONV_REQD, /* 76 - caller must register conversion
- callbacks using curl_easy_setopt options
- CURLOPT_CONV_FROM_NETWORK_FUNCTION,
- CURLOPT_CONV_TO_NETWORK_FUNCTION, and
- CURLOPT_CONV_FROM_UTF8_FUNCTION */
- CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing
- or wrong format */
- CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */
- CURLE_SSH, /* 79 - error from the SSH layer, somewhat
- generic so the error message will be of
- interest when this has happened */
-
- CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL
- connection */
- CURLE_AGAIN, /* 81 - socket is not ready for send/recv,
- wait till it's ready and try again (Added
- in 7.18.2) */
- CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or
- wrong format (Added in 7.19.0) */
- CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in
- 7.19.0) */
- CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */
- CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */
- CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */
- CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */
- CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */
- CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the
- session will be queued */
- CURLE_SSL_PINNEDPUBKEYNOTMATCH, /* 90 - specified pinned public key did not
- match */
- CURLE_SSL_INVALIDCERTSTATUS, /* 91 - invalid certificate status */
- CURLE_HTTP2_STREAM, /* 92 - stream error in HTTP/2 framing layer
- */
- CURL_LAST /* never use! */
-} CURLcode;
-
-#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
- the obsolete stuff removed! */
-
-/* Previously obsolete error code re-used in 7.38.0 */
-#define CURLE_OBSOLETE16 CURLE_HTTP2
-
-/* Previously obsolete error codes re-used in 7.24.0 */
-#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED
-#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT
-
-/* compatibility with older names */
-#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING
-#define CURLE_FTP_WEIRD_SERVER_REPLY CURLE_WEIRD_SERVER_REPLY
-
-/* The following were added in 7.21.5, April 2011 */
-#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION
-
-/* The following were added in 7.17.1 */
-/* These are scheduled to disappear by 2009 */
-#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
-
-/* The following were added in 7.17.0 */
-/* These are scheduled to disappear by 2009 */
-#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */
-#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
-#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
-#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
-#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
-#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
-#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
-#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
-#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
-#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
-#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
-#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
-#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN
-
-#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
-#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
-#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
-#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
-#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
-#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
-#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
-
-/* The following were added earlier */
-
-#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
-
-#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
-#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
-#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
-
-#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
-#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
-
-/* This was the error code 50 in 7.7.3 and a few earlier versions, this
- is no longer used by libcurl but is instead #defined here only to not
- make programs break */
-#define CURLE_ALREADY_COMPLETE 99999
-
-/* Provide defines for really old option names */
-#define CURLOPT_FILE CURLOPT_WRITEDATA /* name changed in 7.9.7 */
-#define CURLOPT_INFILE CURLOPT_READDATA /* name changed in 7.9.7 */
-#define CURLOPT_WRITEHEADER CURLOPT_HEADERDATA
-
-/* Since long deprecated options with no code in the lib that does anything
- with them. */
-#define CURLOPT_WRITEINFO CURLOPT_OBSOLETE40
-#define CURLOPT_CLOSEPOLICY CURLOPT_OBSOLETE72
-
-#endif /*!CURL_NO_OLDIES*/
-
-/* This prototype applies to all conversion callbacks */
-typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
-
-typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
- void *ssl_ctx, /* actually an
- OpenSSL SSL_CTX */
- void *userptr);
-
-typedef enum {
- CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use
- CONNECT HTTP/1.1 */
- CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT
- HTTP/1.0 */
- CURLPROXY_HTTPS = 2, /* added in 7.52.0 */
- CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
- in 7.10 */
- CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
- CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
- CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the
- host name rather than the IP address. added
- in 7.18.0 */
-} curl_proxytype; /* this enum was added in 7.10 */
-
-/*
- * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:
- *
- * CURLAUTH_NONE - No HTTP authentication
- * CURLAUTH_BASIC - HTTP Basic authentication (default)
- * CURLAUTH_DIGEST - HTTP Digest authentication
- * CURLAUTH_NEGOTIATE - HTTP Negotiate (SPNEGO) authentication
- * CURLAUTH_GSSNEGOTIATE - Alias for CURLAUTH_NEGOTIATE (deprecated)
- * CURLAUTH_NTLM - HTTP NTLM authentication
- * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour
- * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper
- * CURLAUTH_ONLY - Use together with a single other type to force no
- * authentication or just that single type
- * CURLAUTH_ANY - All fine types set
- * CURLAUTH_ANYSAFE - All fine types except Basic
- */
-
-#define CURLAUTH_NONE ((unsigned long)0)
-#define CURLAUTH_BASIC (((unsigned long)1)<<0)
-#define CURLAUTH_DIGEST (((unsigned long)1)<<1)
-#define CURLAUTH_NEGOTIATE (((unsigned long)1)<<2)
-/* Deprecated since the advent of CURLAUTH_NEGOTIATE */
-#define CURLAUTH_GSSNEGOTIATE CURLAUTH_NEGOTIATE
-#define CURLAUTH_NTLM (((unsigned long)1)<<3)
-#define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4)
-#define CURLAUTH_NTLM_WB (((unsigned long)1)<<5)
-#define CURLAUTH_ONLY (((unsigned long)1)<<31)
-#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)
-#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
-
-#define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */
-#define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */
-#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
-#define CURLSSH_AUTH_PASSWORD (1<<1) /* password */
-#define CURLSSH_AUTH_HOST (1<<2) /* host key files */
-#define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */
-#define CURLSSH_AUTH_AGENT (1<<4) /* agent (ssh-agent, pageant...) */
-#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
-
-#define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */
-#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */
-#define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */
-
-#define CURL_ERROR_SIZE 256
-
-enum curl_khtype {
- CURLKHTYPE_UNKNOWN,
- CURLKHTYPE_RSA1,
- CURLKHTYPE_RSA,
- CURLKHTYPE_DSS
-};
-
-struct curl_khkey {
- const char *key; /* points to a zero-terminated string encoded with base64
- if len is zero, otherwise to the "raw" data */
- size_t len;
- enum curl_khtype keytype;
-};
-
-/* this is the set of return values expected from the curl_sshkeycallback
- callback */
-enum curl_khstat {
- CURLKHSTAT_FINE_ADD_TO_FILE,
- CURLKHSTAT_FINE,
- CURLKHSTAT_REJECT, /* reject the connection, return an error */
- CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so
- this causes a CURLE_DEFER error but otherwise the
- connection will be left intact etc */
- CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */
-};
-
-/* this is the set of status codes pass in to the callback */
-enum curl_khmatch {
- CURLKHMATCH_OK, /* match */
- CURLKHMATCH_MISMATCH, /* host found, key mismatch! */
- CURLKHMATCH_MISSING, /* no matching host/key found */
- CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */
-};
-
-typedef int
- (*curl_sshkeycallback) (CURL *easy, /* easy handle */
- const struct curl_khkey *knownkey, /* known */
- const struct curl_khkey *foundkey, /* found */
- enum curl_khmatch, /* libcurl's view on the keys */
- void *clientp); /* custom pointer passed from app */
-
-/* parameter for the CURLOPT_USE_SSL option */
-typedef enum {
- CURLUSESSL_NONE, /* do not attempt to use SSL */
- CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */
- CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
- CURLUSESSL_ALL, /* SSL for all communication or fail */
- CURLUSESSL_LAST /* not an option, never use */
-} curl_usessl;
-
-/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */
-
-/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the
- name of improving interoperability with older servers. Some SSL libraries
- have introduced work-arounds for this flaw but those work-arounds sometimes
- make the SSL communication fail. To regain functionality with those broken
- servers, a user can this way allow the vulnerability back. */
-#define CURLSSLOPT_ALLOW_BEAST (1<<0)
-
-/* - NO_REVOKE tells libcurl to disable certificate revocation checks for those
- SSL backends where such behavior is present. */
-#define CURLSSLOPT_NO_REVOKE (1<<1)
-
-#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
- the obsolete stuff removed! */
-
-/* Backwards compatibility with older names */
-/* These are scheduled to disappear by 2009 */
-
-#define CURLFTPSSL_NONE CURLUSESSL_NONE
-#define CURLFTPSSL_TRY CURLUSESSL_TRY
-#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
-#define CURLFTPSSL_ALL CURLUSESSL_ALL
-#define CURLFTPSSL_LAST CURLUSESSL_LAST
-#define curl_ftpssl curl_usessl
-#endif /*!CURL_NO_OLDIES*/
-
-/* parameter for the CURLOPT_FTP_SSL_CCC option */
-typedef enum {
- CURLFTPSSL_CCC_NONE, /* do not send CCC */
- CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
- CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */
- CURLFTPSSL_CCC_LAST /* not an option, never use */
-} curl_ftpccc;
-
-/* parameter for the CURLOPT_FTPSSLAUTH option */
-typedef enum {
- CURLFTPAUTH_DEFAULT, /* let libcurl decide */
- CURLFTPAUTH_SSL, /* use "AUTH SSL" */
- CURLFTPAUTH_TLS, /* use "AUTH TLS" */
- CURLFTPAUTH_LAST /* not an option, never use */
-} curl_ftpauth;
-
-/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
-typedef enum {
- CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */
- CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD
- again if MKD succeeded, for SFTP this does
- similar magic */
- CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
- again even if MKD failed! */
- CURLFTP_CREATE_DIR_LAST /* not an option, never use */
-} curl_ftpcreatedir;
-
-/* parameter for the CURLOPT_FTP_FILEMETHOD option */
-typedef enum {
- CURLFTPMETHOD_DEFAULT, /* let libcurl pick */
- CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */
- CURLFTPMETHOD_NOCWD, /* no CWD at all */
- CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
- CURLFTPMETHOD_LAST /* not an option, never use */
-} curl_ftpmethod;
-
-/* bitmask defines for CURLOPT_HEADEROPT */
-#define CURLHEADER_UNIFIED 0
-#define CURLHEADER_SEPARATE (1<<0)
-
-/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
-#define CURLPROTO_HTTP (1<<0)
-#define CURLPROTO_HTTPS (1<<1)
-#define CURLPROTO_FTP (1<<2)
-#define CURLPROTO_FTPS (1<<3)
-#define CURLPROTO_SCP (1<<4)
-#define CURLPROTO_SFTP (1<<5)
-#define CURLPROTO_TELNET (1<<6)
-#define CURLPROTO_LDAP (1<<7)
-#define CURLPROTO_LDAPS (1<<8)
-#define CURLPROTO_DICT (1<<9)
-#define CURLPROTO_FILE (1<<10)
-#define CURLPROTO_TFTP (1<<11)
-#define CURLPROTO_IMAP (1<<12)
-#define CURLPROTO_IMAPS (1<<13)
-#define CURLPROTO_POP3 (1<<14)
-#define CURLPROTO_POP3S (1<<15)
-#define CURLPROTO_SMTP (1<<16)
-#define CURLPROTO_SMTPS (1<<17)
-#define CURLPROTO_RTSP (1<<18)
-#define CURLPROTO_RTMP (1<<19)
-#define CURLPROTO_RTMPT (1<<20)
-#define CURLPROTO_RTMPE (1<<21)
-#define CURLPROTO_RTMPTE (1<<22)
-#define CURLPROTO_RTMPS (1<<23)
-#define CURLPROTO_RTMPTS (1<<24)
-#define CURLPROTO_GOPHER (1<<25)
-#define CURLPROTO_SMB (1<<26)
-#define CURLPROTO_SMBS (1<<27)
-#define CURLPROTO_ALL (~0) /* enable everything */
-
-/* long may be 32 or 64 bits, but we should never depend on anything else
- but 32 */
-#define CURLOPTTYPE_LONG 0
-#define CURLOPTTYPE_OBJECTPOINT 10000
-#define CURLOPTTYPE_STRINGPOINT 10000
-#define CURLOPTTYPE_FUNCTIONPOINT 20000
-#define CURLOPTTYPE_OFF_T 30000
-
-/* *STRINGPOINT is an alias for OBJECTPOINT to allow tools to extract the
- string options from the header file */
-
-/* name is uppercase CURLOPT_<name>,
- type is one of the defined CURLOPTTYPE_<type>
- number is unique identifier */
-#ifdef CINIT
-#undef CINIT
-#endif
-
-#ifdef CURL_ISOCPP
-#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu
-#else
-/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
-#define LONG CURLOPTTYPE_LONG
-#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
-#define STRINGPOINT CURLOPTTYPE_OBJECTPOINT
-#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
-#define OFF_T CURLOPTTYPE_OFF_T
-#define CINIT(name,type,number) CURLOPT_/**/name = type + number
-#endif
-
-/*
- * This macro-mania below setups the CURLOPT_[what] enum, to be used with
- * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
- * word.
- */
-
-typedef enum {
- /* This is the FILE * or void * the regular output should be written to. */
- CINIT(WRITEDATA, OBJECTPOINT, 1),
-
- /* The full URL to get/put */
- CINIT(URL, STRINGPOINT, 2),
-
- /* Port number to connect to, if other than default. */
- CINIT(PORT, LONG, 3),
-
- /* Name of proxy to use. */
- CINIT(PROXY, STRINGPOINT, 4),
-
- /* "user:password;options" to use when fetching. */
- CINIT(USERPWD, STRINGPOINT, 5),
-
- /* "user:password" to use with proxy. */
- CINIT(PROXYUSERPWD, STRINGPOINT, 6),
-
- /* Range to get, specified as an ASCII string. */
- CINIT(RANGE, STRINGPOINT, 7),
-
- /* not used */
-
- /* Specified file stream to upload from (use as input): */
- CINIT(READDATA, OBJECTPOINT, 9),
-
- /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
- * bytes big. If this is not used, error messages go to stderr instead: */
- CINIT(ERRORBUFFER, OBJECTPOINT, 10),
-
- /* Function that will be called to store the output (instead of fwrite). The
- * parameters will use fwrite() syntax, make sure to follow them. */
- CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
-
- /* Function that will be called to read the input (instead of fread). The
- * parameters will use fread() syntax, make sure to follow them. */
- CINIT(READFUNCTION, FUNCTIONPOINT, 12),
-
- /* Time-out the read operation after this amount of seconds */
- CINIT(TIMEOUT, LONG, 13),
-
- /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
- * how large the file being sent really is. That allows better error
- * checking and better verifies that the upload was successful. -1 means
- * unknown size.
- *
- * For large file support, there is also a _LARGE version of the key
- * which takes an off_t type, allowing platforms with larger off_t
- * sizes to handle larger files. See below for INFILESIZE_LARGE.
- */
- CINIT(INFILESIZE, LONG, 14),
-
- /* POST static input fields. */
- CINIT(POSTFIELDS, OBJECTPOINT, 15),
-
- /* Set the referrer page (needed by some CGIs) */
- CINIT(REFERER, STRINGPOINT, 16),
-
- /* Set the FTP PORT string (interface name, named or numerical IP address)
- Use i.e '-' to use default address. */
- CINIT(FTPPORT, STRINGPOINT, 17),
-
- /* Set the User-Agent string (examined by some CGIs) */
- CINIT(USERAGENT, STRINGPOINT, 18),
-
- /* If the download receives less than "low speed limit" bytes/second
- * during "low speed time" seconds, the operations is aborted.
- * You could i.e if you have a pretty high speed connection, abort if
- * it is less than 2000 bytes/sec during 20 seconds.
- */
-
- /* Set the "low speed limit" */
- CINIT(LOW_SPEED_LIMIT, LONG, 19),
-
- /* Set the "low speed time" */
- CINIT(LOW_SPEED_TIME, LONG, 20),
-
- /* Set the continuation offset.
- *
- * Note there is also a _LARGE version of this key which uses
- * off_t types, allowing for large file offsets on platforms which
- * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
- */
- CINIT(RESUME_FROM, LONG, 21),
-
- /* Set cookie in request: */
- CINIT(COOKIE, STRINGPOINT, 22),
-
- /* This points to a linked list of headers, struct curl_slist kind. This
- list is also used for RTSP (in spite of its name) */
- CINIT(HTTPHEADER, OBJECTPOINT, 23),
-
- /* This points to a linked list of post entries, struct curl_httppost */
- CINIT(HTTPPOST, OBJECTPOINT, 24),
-
- /* name of the file keeping your private SSL-certificate */
- CINIT(SSLCERT, STRINGPOINT, 25),
-
- /* password for the SSL or SSH private key */
- CINIT(KEYPASSWD, STRINGPOINT, 26),
-
- /* send TYPE parameter? */
- CINIT(CRLF, LONG, 27),
-
- /* send linked-list of QUOTE commands */
- CINIT(QUOTE, OBJECTPOINT, 28),
-
- /* send FILE * or void * to store headers to, if you use a callback it
- is simply passed to the callback unmodified */
- CINIT(HEADERDATA, OBJECTPOINT, 29),
-
- /* point to a file to read the initial cookies from, also enables
- "cookie awareness" */
- CINIT(COOKIEFILE, STRINGPOINT, 31),
-
- /* What version to specifically try to use.
- See CURL_SSLVERSION defines below. */
- CINIT(SSLVERSION, LONG, 32),
-
- /* What kind of HTTP time condition to use, see defines */
- CINIT(TIMECONDITION, LONG, 33),
-
- /* Time to use with the above condition. Specified in number of seconds
- since 1 Jan 1970 */
- CINIT(TIMEVALUE, LONG, 34),
-
- /* 35 = OBSOLETE */
-
- /* Custom request, for customizing the get command like
- HTTP: DELETE, TRACE and others
- FTP: to use a different list command
- */
- CINIT(CUSTOMREQUEST, STRINGPOINT, 36),
-
- /* FILE handle to use instead of stderr */
- CINIT(STDERR, OBJECTPOINT, 37),
-
- /* 38 is not used */
-
- /* send linked-list of post-transfer QUOTE commands */
- CINIT(POSTQUOTE, OBJECTPOINT, 39),
-
- CINIT(OBSOLETE40, OBJECTPOINT, 40), /* OBSOLETE, do not use! */
-
- CINIT(VERBOSE, LONG, 41), /* talk a lot */
- CINIT(HEADER, LONG, 42), /* throw the header out too */
- CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
- CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
- CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 400 */
- CINIT(UPLOAD, LONG, 46), /* this is an upload */
- CINIT(POST, LONG, 47), /* HTTP POST method */
- CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */
-
- CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */
-
- /* Specify whether to read the user+password from the .netrc or the URL.
- * This must be one of the CURL_NETRC_* enums below. */
- CINIT(NETRC, LONG, 51),
-
- CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
-
- CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
- CINIT(PUT, LONG, 54), /* HTTP PUT */
-
- /* 55 = OBSOLETE */
-
- /* DEPRECATED
- * Function that will be called instead of the internal progress display
- * function. This function should be defined as the curl_progress_callback
- * prototype defines. */
- CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
-
- /* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION
- callbacks */
- CINIT(PROGRESSDATA, OBJECTPOINT, 57),
-#define CURLOPT_XFERINFODATA CURLOPT_PROGRESSDATA
-
- /* We want the referrer field set automatically when following locations */
- CINIT(AUTOREFERER, LONG, 58),
-
- /* Port of the proxy, can be set in the proxy string as well with:
- "[host]:[port]" */
- CINIT(PROXYPORT, LONG, 59),
-
- /* size of the POST input data, if strlen() is not good to use */
- CINIT(POSTFIELDSIZE, LONG, 60),
-
- /* tunnel non-http operations through a HTTP proxy */
- CINIT(HTTPPROXYTUNNEL, LONG, 61),
-
- /* Set the interface string to use as outgoing network interface */
- CINIT(INTERFACE, STRINGPOINT, 62),
-
- /* Set the krb4/5 security level, this also enables krb4/5 awareness. This
- * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
- * is set but doesn't match one of these, 'private' will be used. */
- CINIT(KRBLEVEL, STRINGPOINT, 63),
-
- /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
- CINIT(SSL_VERIFYPEER, LONG, 64),
-
- /* The CApath or CAfile used to validate the peer certificate
- this option is used only if SSL_VERIFYPEER is true */
- CINIT(CAINFO, STRINGPOINT, 65),
-
- /* 66 = OBSOLETE */
- /* 67 = OBSOLETE */
-
- /* Maximum number of http redirects to follow */
- CINIT(MAXREDIRS, LONG, 68),
-
- /* Pass a long set to 1 to get the date of the requested document (if
- possible)! Pass a zero to shut it off. */
- CINIT(FILETIME, LONG, 69),
-
- /* This points to a linked list of telnet options */
- CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
-
- /* Max amount of cached alive connections */
- CINIT(MAXCONNECTS, LONG, 71),
-
- CINIT(OBSOLETE72, LONG, 72), /* OBSOLETE, do not use! */
-
- /* 73 = OBSOLETE */
-
- /* Set to explicitly use a new connection for the upcoming transfer.
- Do not use this unless you're absolutely sure of this, as it makes the
- operation slower and is less friendly for the network. */
- CINIT(FRESH_CONNECT, LONG, 74),
-
- /* Set to explicitly forbid the upcoming transfer's connection to be re-used
- when done. Do not use this unless you're absolutely sure of this, as it
- makes the operation slower and is less friendly for the network. */
- CINIT(FORBID_REUSE, LONG, 75),
-
- /* Set to a file name that contains random data for libcurl to use to
- seed the random engine when doing SSL connects. */
- CINIT(RANDOM_FILE, STRINGPOINT, 76),
-
- /* Set to the Entropy Gathering Daemon socket pathname */
- CINIT(EGDSOCKET, STRINGPOINT, 77),
-
- /* Time-out connect operations after this amount of seconds, if connects are
- OK within this time, then fine... This only aborts the connect phase. */
- CINIT(CONNECTTIMEOUT, LONG, 78),
-
- /* Function that will be called to store headers (instead of fwrite). The
- * parameters will use fwrite() syntax, make sure to follow them. */
- CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
-
- /* Set this to force the HTTP request to get back to GET. Only really usable
- if POST, PUT or a custom request have been used first.
- */
- CINIT(HTTPGET, LONG, 80),
-
- /* Set if we should verify the Common name from the peer certificate in ssl
- * handshake, set 1 to check existence, 2 to ensure that it matches the
- * provided hostname. */
- CINIT(SSL_VERIFYHOST, LONG, 81),
-
- /* Specify which file name to write all known cookies in after completed
- operation. Set file name to "-" (dash) to make it go to stdout. */
- CINIT(COOKIEJAR, STRINGPOINT, 82),
-
- /* Specify which SSL ciphers to use */
- CINIT(SSL_CIPHER_LIST, STRINGPOINT, 83),
-
- /* Specify which HTTP version to use! This must be set to one of the
- CURL_HTTP_VERSION* enums set below. */
- CINIT(HTTP_VERSION, LONG, 84),
-
- /* Specifically switch on or off the FTP engine's use of the EPSV command. By
- default, that one will always be attempted before the more traditional
- PASV command. */
- CINIT(FTP_USE_EPSV, LONG, 85),
-
- /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
- CINIT(SSLCERTTYPE, STRINGPOINT, 86),
-
- /* name of the file keeping your private SSL-key */
- CINIT(SSLKEY, STRINGPOINT, 87),
-
- /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
- CINIT(SSLKEYTYPE, STRINGPOINT, 88),
-
- /* crypto engine for the SSL-sub system */
- CINIT(SSLENGINE, STRINGPOINT, 89),
-
- /* set the crypto engine for the SSL-sub system as default
- the param has no meaning...
- */
- CINIT(SSLENGINE_DEFAULT, LONG, 90),
-
- /* Non-zero value means to use the global dns cache */
- CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */
-
- /* DNS cache timeout */
- CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
-
- /* send linked-list of pre-transfer QUOTE commands */
- CINIT(PREQUOTE, OBJECTPOINT, 93),
-
- /* set the debug function */
- CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
-
- /* set the data for the debug function */
- CINIT(DEBUGDATA, OBJECTPOINT, 95),
-
- /* mark this as start of a cookie session */
- CINIT(COOKIESESSION, LONG, 96),
-
- /* The CApath directory used to validate the peer certificate
- this option is used only if SSL_VERIFYPEER is true */
- CINIT(CAPATH, STRINGPOINT, 97),
-
- /* Instruct libcurl to use a smaller receive buffer */
- CINIT(BUFFERSIZE, LONG, 98),
-
- /* Instruct libcurl to not use any signal/alarm handlers, even when using
- timeouts. This option is useful for multi-threaded applications.
- See libcurl-the-guide for more background information. */
- CINIT(NOSIGNAL, LONG, 99),
-
- /* Provide a CURLShare for mutexing non-ts data */
- CINIT(SHARE, OBJECTPOINT, 100),
-
- /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
- CURLPROXY_HTTPS, CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and
- CURLPROXY_SOCKS5. */
- CINIT(PROXYTYPE, LONG, 101),
-
- /* Set the Accept-Encoding string. Use this to tell a server you would like
- the response to be compressed. Before 7.21.6, this was known as
- CURLOPT_ENCODING */
- CINIT(ACCEPT_ENCODING, STRINGPOINT, 102),
-
- /* Set pointer to private data */
- CINIT(PRIVATE, OBJECTPOINT, 103),
-
- /* Set aliases for HTTP 200 in the HTTP Response header */
- CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
-
- /* Continue to send authentication (user+password) when following locations,
- even when hostname changed. This can potentially send off the name
- and password to whatever host the server decides. */
- CINIT(UNRESTRICTED_AUTH, LONG, 105),
-
- /* Specifically switch on or off the FTP engine's use of the EPRT command (
- it also disables the LPRT attempt). By default, those ones will always be
- attempted before the good old traditional PORT command. */
- CINIT(FTP_USE_EPRT, LONG, 106),
-
- /* Set this to a bitmask value to enable the particular authentications
- methods you like. Use this in combination with CURLOPT_USERPWD.
- Note that setting multiple bits may cause extra network round-trips. */
- CINIT(HTTPAUTH, LONG, 107),
-
- /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
- in second argument. The function must be matching the
- curl_ssl_ctx_callback proto. */
- CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
-
- /* Set the userdata for the ssl context callback function's third
- argument */
- CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
-
- /* FTP Option that causes missing dirs to be created on the remote server.
- In 7.19.4 we introduced the convenience enums for this option using the
- CURLFTP_CREATE_DIR prefix.
- */
- CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
-
- /* Set this to a bitmask value to enable the particular authentications
- methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
- Note that setting multiple bits may cause extra network round-trips. */
- CINIT(PROXYAUTH, LONG, 111),
-
- /* FTP option that changes the timeout, in seconds, associated with
- getting a response. This is different from transfer timeout time and
- essentially places a demand on the FTP server to acknowledge commands
- in a timely manner. */
- CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
-#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT
-
- /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
- tell libcurl to resolve names to those IP versions only. This only has
- affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
- CINIT(IPRESOLVE, LONG, 113),
-
- /* Set this option to limit the size of a file that will be downloaded from
- an HTTP or FTP server.
-
- Note there is also _LARGE version which adds large file support for
- platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
- CINIT(MAXFILESIZE, LONG, 114),
-
- /* See the comment for INFILESIZE above, but in short, specifies
- * the size of the file being uploaded. -1 means unknown.
- */
- CINIT(INFILESIZE_LARGE, OFF_T, 115),
-
- /* Sets the continuation offset. There is also a LONG version of this;
- * look above for RESUME_FROM.
- */
- CINIT(RESUME_FROM_LARGE, OFF_T, 116),
-
- /* Sets the maximum size of data that will be downloaded from
- * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
- */
- CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
-
- /* Set this option to the file name of your .netrc file you want libcurl
- to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
- a poor attempt to find the user's home directory and check for a .netrc
- file in there. */
- CINIT(NETRC_FILE, STRINGPOINT, 118),
-
- /* Enable SSL/TLS for FTP, pick one of:
- CURLUSESSL_TRY - try using SSL, proceed anyway otherwise
- CURLUSESSL_CONTROL - SSL for the control connection or fail
- CURLUSESSL_ALL - SSL for all communication or fail
- */
- CINIT(USE_SSL, LONG, 119),
-
- /* The _LARGE version of the standard POSTFIELDSIZE option */
- CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
-
- /* Enable/disable the TCP Nagle algorithm */
- CINIT(TCP_NODELAY, LONG, 121),
-
- /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
- /* 123 OBSOLETE. Gone in 7.16.0 */
- /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
- /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
- /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
- /* 127 OBSOLETE. Gone in 7.16.0 */
- /* 128 OBSOLETE. Gone in 7.16.0 */
-
- /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
- can be used to change libcurl's default action which is to first try
- "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
- response has been received.
-
- Available parameters are:
- CURLFTPAUTH_DEFAULT - let libcurl decide
- CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
- CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
- */
- CINIT(FTPSSLAUTH, LONG, 129),
-
- CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
- CINIT(IOCTLDATA, OBJECTPOINT, 131),
-
- /* 132 OBSOLETE. Gone in 7.16.0 */
- /* 133 OBSOLETE. Gone in 7.16.0 */
-
- /* zero terminated string for pass on to the FTP server when asked for
- "account" info */
- CINIT(FTP_ACCOUNT, STRINGPOINT, 134),
-
- /* feed cookie into cookie engine */
- CINIT(COOKIELIST, STRINGPOINT, 135),
-
- /* ignore Content-Length */
- CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
-
- /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
- response. Typically used for FTP-SSL purposes but is not restricted to
- that. libcurl will then instead use the same IP address it used for the
- control connection. */
- CINIT(FTP_SKIP_PASV_IP, LONG, 137),
-
- /* Select "file method" to use when doing FTP, see the curl_ftpmethod
- above. */
- CINIT(FTP_FILEMETHOD, LONG, 138),
-
- /* Local port number to bind the socket to */
- CINIT(LOCALPORT, LONG, 139),
-
- /* Number of ports to try, including the first one set with LOCALPORT.
- Thus, setting it to 1 will make no additional attempts but the first.
- */
- CINIT(LOCALPORTRANGE, LONG, 140),
-
- /* no transfer, set up connection and let application use the socket by
- extracting it with CURLINFO_LASTSOCKET */
- CINIT(CONNECT_ONLY, LONG, 141),
-
- /* Function that will be called to convert from the
- network encoding (instead of using the iconv calls in libcurl) */
- CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
-
- /* Function that will be called to convert to the
- network encoding (instead of using the iconv calls in libcurl) */
- CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
-
- /* Function that will be called to convert from UTF8
- (instead of using the iconv calls in libcurl)
- Note that this is used only for SSL certificate processing */
- CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
-
- /* if the connection proceeds too quickly then need to slow it down */
- /* limit-rate: maximum number of bytes per second to send or receive */
- CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
- CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
-
- /* Pointer to command string to send if USER/PASS fails. */
- CINIT(FTP_ALTERNATIVE_TO_USER, STRINGPOINT, 147),
-
- /* callback function for setting socket options */
- CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
- CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
-
- /* set to 0 to disable session ID re-use for this transfer, default is
- enabled (== 1) */
- CINIT(SSL_SESSIONID_CACHE, LONG, 150),
-
- /* allowed SSH authentication methods */
- CINIT(SSH_AUTH_TYPES, LONG, 151),
-
- /* Used by scp/sftp to do public/private key authentication */
- CINIT(SSH_PUBLIC_KEYFILE, STRINGPOINT, 152),
- CINIT(SSH_PRIVATE_KEYFILE, STRINGPOINT, 153),
-
- /* Send CCC (Clear Command Channel) after authentication */
- CINIT(FTP_SSL_CCC, LONG, 154),
-
- /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
- CINIT(TIMEOUT_MS, LONG, 155),
- CINIT(CONNECTTIMEOUT_MS, LONG, 156),
-
- /* set to zero to disable the libcurl's decoding and thus pass the raw body
- data to the application even when it is encoded/compressed */
- CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
- CINIT(HTTP_CONTENT_DECODING, LONG, 158),
-
- /* Permission used when creating new files and directories on the remote
- server for protocols that support it, SFTP/SCP/FILE */
- CINIT(NEW_FILE_PERMS, LONG, 159),
- CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
-
- /* Set the behaviour of POST when redirecting. Values must be set to one
- of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
- CINIT(POSTREDIR, LONG, 161),
-
- /* used by scp/sftp to verify the host's public key */
- CINIT(SSH_HOST_PUBLIC_KEY_MD5, STRINGPOINT, 162),
-
- /* Callback function for opening socket (instead of socket(2)). Optionally,
- callback is able change the address or refuse to connect returning
- CURL_SOCKET_BAD. The callback should have type
- curl_opensocket_callback */
- CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
- CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
-
- /* POST volatile input fields. */
- CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
-
- /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
- CINIT(PROXY_TRANSFER_MODE, LONG, 166),
-
- /* Callback function for seeking in the input stream */
- CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
- CINIT(SEEKDATA, OBJECTPOINT, 168),
-
- /* CRL file */
- CINIT(CRLFILE, STRINGPOINT, 169),
-
- /* Issuer certificate */
- CINIT(ISSUERCERT, STRINGPOINT, 170),
-
- /* (IPv6) Address scope */
- CINIT(ADDRESS_SCOPE, LONG, 171),
-
- /* Collect certificate chain info and allow it to get retrievable with
- CURLINFO_CERTINFO after the transfer is complete. */
- CINIT(CERTINFO, LONG, 172),
-
- /* "name" and "pwd" to use when fetching. */
- CINIT(USERNAME, STRINGPOINT, 173),
- CINIT(PASSWORD, STRINGPOINT, 174),
-
- /* "name" and "pwd" to use with Proxy when fetching. */
- CINIT(PROXYUSERNAME, STRINGPOINT, 175),
- CINIT(PROXYPASSWORD, STRINGPOINT, 176),
-
- /* Comma separated list of hostnames defining no-proxy zones. These should
- match both hostnames directly, and hostnames within a domain. For
- example, local.com will match local.com and www.local.com, but NOT
- notlocal.com or www.notlocal.com. For compatibility with other
- implementations of this, .local.com will be considered to be the same as
- local.com. A single * is the only valid wildcard, and effectively
- disables the use of proxy. */
- CINIT(NOPROXY, STRINGPOINT, 177),
-
- /* block size for TFTP transfers */
- CINIT(TFTP_BLKSIZE, LONG, 178),
-
- /* Socks Service */
- CINIT(SOCKS5_GSSAPI_SERVICE, STRINGPOINT, 179), /* DEPRECATED, do not use! */
-
- /* Socks Service */
- CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
-
- /* set the bitmask for the protocols that are allowed to be used for the
- transfer, which thus helps the app which takes URLs from users or other
- external inputs and want to restrict what protocol(s) to deal
- with. Defaults to CURLPROTO_ALL. */
- CINIT(PROTOCOLS, LONG, 181),
-
- /* set the bitmask for the protocols that libcurl is allowed to follow to,
- as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
- to be set in both bitmasks to be allowed to get redirected to. Defaults
- to all protocols except FILE and SCP. */
- CINIT(REDIR_PROTOCOLS, LONG, 182),
-
- /* set the SSH knownhost file name to use */
- CINIT(SSH_KNOWNHOSTS, STRINGPOINT, 183),
-
- /* set the SSH host key callback, must point to a curl_sshkeycallback
- function */
- CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),
-
- /* set the SSH host key callback custom pointer */
- CINIT(SSH_KEYDATA, OBJECTPOINT, 185),
-
- /* set the SMTP mail originator */
- CINIT(MAIL_FROM, STRINGPOINT, 186),
-
- /* set the list of SMTP mail receiver(s) */
- CINIT(MAIL_RCPT, OBJECTPOINT, 187),
-
- /* FTP: send PRET before PASV */
- CINIT(FTP_USE_PRET, LONG, 188),
-
- /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */
- CINIT(RTSP_REQUEST, LONG, 189),
-
- /* The RTSP session identifier */
- CINIT(RTSP_SESSION_ID, STRINGPOINT, 190),
-
- /* The RTSP stream URI */
- CINIT(RTSP_STREAM_URI, STRINGPOINT, 191),
-
- /* The Transport: header to use in RTSP requests */
- CINIT(RTSP_TRANSPORT, STRINGPOINT, 192),
-
- /* Manually initialize the client RTSP CSeq for this handle */
- CINIT(RTSP_CLIENT_CSEQ, LONG, 193),
-
- /* Manually initialize the server RTSP CSeq for this handle */
- CINIT(RTSP_SERVER_CSEQ, LONG, 194),
-
- /* The stream to pass to INTERLEAVEFUNCTION. */
- CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),
-
- /* Let the application define a custom write method for RTP data */
- CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),
-
- /* Turn on wildcard matching */
- CINIT(WILDCARDMATCH, LONG, 197),
-
- /* Directory matching callback called before downloading of an
- individual file (chunk) started */
- CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),
-
- /* Directory matching callback called after the file (chunk)
- was downloaded, or skipped */
- CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),
-
- /* Change match (fnmatch-like) callback for wildcard matching */
- CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),
-
- /* Let the application define custom chunk data pointer */
- CINIT(CHUNK_DATA, OBJECTPOINT, 201),
-
- /* FNMATCH_FUNCTION user pointer */
- CINIT(FNMATCH_DATA, OBJECTPOINT, 202),
-
- /* send linked-list of name:port:address sets */
- CINIT(RESOLVE, OBJECTPOINT, 203),
-
- /* Set a username for authenticated TLS */
- CINIT(TLSAUTH_USERNAME, STRINGPOINT, 204),
-
- /* Set a password for authenticated TLS */
- CINIT(TLSAUTH_PASSWORD, STRINGPOINT, 205),
-
- /* Set authentication type for authenticated TLS */
- CINIT(TLSAUTH_TYPE, STRINGPOINT, 206),
-
- /* Set to 1 to enable the "TE:" header in HTTP requests to ask for
- compressed transfer-encoded responses. Set to 0 to disable the use of TE:
- in outgoing requests. The current default is 0, but it might change in a
- future libcurl release.
-
- libcurl will ask for the compressed methods it knows of, and if that
- isn't any, it will not ask for transfer-encoding at all even if this
- option is set to 1.
-
- */
- CINIT(TRANSFER_ENCODING, LONG, 207),
-
- /* Callback function for closing socket (instead of close(2)). The callback
- should have type curl_closesocket_callback */
- CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
- CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),
-
- /* allow GSSAPI credential delegation */
- CINIT(GSSAPI_DELEGATION, LONG, 210),
-
- /* Set the name servers to use for DNS resolution */
- CINIT(DNS_SERVERS, STRINGPOINT, 211),
-
- /* Time-out accept operations (currently for FTP only) after this amount
- of milliseconds. */
- CINIT(ACCEPTTIMEOUT_MS, LONG, 212),
-
- /* Set TCP keepalive */
- CINIT(TCP_KEEPALIVE, LONG, 213),
-
- /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */
- CINIT(TCP_KEEPIDLE, LONG, 214),
- CINIT(TCP_KEEPINTVL, LONG, 215),
-
- /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */
- CINIT(SSL_OPTIONS, LONG, 216),
-
- /* Set the SMTP auth originator */
- CINIT(MAIL_AUTH, STRINGPOINT, 217),
-
- /* Enable/disable SASL initial response */
- CINIT(SASL_IR, LONG, 218),
-
- /* Function that will be called instead of the internal progress display
- * function. This function should be defined as the curl_xferinfo_callback
- * prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */
- CINIT(XFERINFOFUNCTION, FUNCTIONPOINT, 219),
-
- /* The XOAUTH2 bearer token */
- CINIT(XOAUTH2_BEARER, STRINGPOINT, 220),
-
- /* Set the interface string to use as outgoing network
- * interface for DNS requests.
- * Only supported by the c-ares DNS backend */
- CINIT(DNS_INTERFACE, STRINGPOINT, 221),
-
- /* Set the local IPv4 address to use for outgoing DNS requests.
- * Only supported by the c-ares DNS backend */
- CINIT(DNS_LOCAL_IP4, STRINGPOINT, 222),
-
- /* Set the local IPv4 address to use for outgoing DNS requests.
- * Only supported by the c-ares DNS backend */
- CINIT(DNS_LOCAL_IP6, STRINGPOINT, 223),
-
- /* Set authentication options directly */
- CINIT(LOGIN_OPTIONS, STRINGPOINT, 224),
-
- /* Enable/disable TLS NPN extension (http2 over ssl might fail without) */
- CINIT(SSL_ENABLE_NPN, LONG, 225),
-
- /* Enable/disable TLS ALPN extension (http2 over ssl might fail without) */
- CINIT(SSL_ENABLE_ALPN, LONG, 226),
-
- /* Time to wait for a response to a HTTP request containing an
- * Expect: 100-continue header before sending the data anyway. */
- CINIT(EXPECT_100_TIMEOUT_MS, LONG, 227),
-
- /* This points to a linked list of headers used for proxy requests only,
- struct curl_slist kind */
- CINIT(PROXYHEADER, OBJECTPOINT, 228),
-
- /* Pass in a bitmask of "header options" */
- CINIT(HEADEROPT, LONG, 229),
-
- /* The public key in DER form used to validate the peer public key
- this option is used only if SSL_VERIFYPEER is true */
- CINIT(PINNEDPUBLICKEY, STRINGPOINT, 230),
-
- /* Path to Unix domain socket */
- CINIT(UNIX_SOCKET_PATH, STRINGPOINT, 231),
-
- /* Set if we should verify the certificate status. */
- CINIT(SSL_VERIFYSTATUS, LONG, 232),
-
- /* Set if we should enable TLS false start. */
- CINIT(SSL_FALSESTART, LONG, 233),
-
- /* Do not squash dot-dot sequences */
- CINIT(PATH_AS_IS, LONG, 234),
-
- /* Proxy Service Name */
- CINIT(PROXY_SERVICE_NAME, STRINGPOINT, 235),
-
- /* Service Name */
- CINIT(SERVICE_NAME, STRINGPOINT, 236),
-
- /* Wait/don't wait for pipe/mutex to clarify */
- CINIT(PIPEWAIT, LONG, 237),
-
- /* Set the protocol used when curl is given a URL without a protocol */
- CINIT(DEFAULT_PROTOCOL, STRINGPOINT, 238),
-
- /* Set stream weight, 1 - 256 (default is 16) */
- CINIT(STREAM_WEIGHT, LONG, 239),
-
- /* Set stream dependency on another CURL handle */
- CINIT(STREAM_DEPENDS, OBJECTPOINT, 240),
-
- /* Set E-xclusive stream dependency on another CURL handle */
- CINIT(STREAM_DEPENDS_E, OBJECTPOINT, 241),
-
- /* Do not send any tftp option requests to the server */
- CINIT(TFTP_NO_OPTIONS, LONG, 242),
-
- /* Linked-list of host:port:connect-to-host:connect-to-port,
- overrides the URL's host:port (only for the network layer) */
- CINIT(CONNECT_TO, OBJECTPOINT, 243),
-
- /* Set TCP Fast Open */
- CINIT(TCP_FASTOPEN, LONG, 244),
-
- /* Continue to send data if the server responds early with an
- * HTTP status code >= 300 */
- CINIT(KEEP_SENDING_ON_ERROR, LONG, 245),
-
- /* The CApath or CAfile used to validate the proxy certificate
- this option is used only if PROXY_SSL_VERIFYPEER is true */
- CINIT(PROXY_CAINFO, STRINGPOINT, 246),
-
- /* The CApath directory used to validate the proxy certificate
- this option is used only if PROXY_SSL_VERIFYPEER is true */
- CINIT(PROXY_CAPATH, STRINGPOINT, 247),
-
- /* Set if we should verify the proxy in ssl handshake,
- set 1 to verify. */
- CINIT(PROXY_SSL_VERIFYPEER, LONG, 248),
-
- /* Set if we should verify the Common name from the proxy certificate in ssl
- * handshake, set 1 to check existence, 2 to ensure that it matches
- * the provided hostname. */
- CINIT(PROXY_SSL_VERIFYHOST, LONG, 249),
-
- /* What version to specifically try to use for proxy.
- See CURL_SSLVERSION defines below. */
- CINIT(PROXY_SSLVERSION, LONG, 250),
-
- /* Set a username for authenticated TLS for proxy */
- CINIT(PROXY_TLSAUTH_USERNAME, STRINGPOINT, 251),
-
- /* Set a password for authenticated TLS for proxy */
- CINIT(PROXY_TLSAUTH_PASSWORD, STRINGPOINT, 252),
-
- /* Set authentication type for authenticated TLS for proxy */
- CINIT(PROXY_TLSAUTH_TYPE, STRINGPOINT, 253),
-
- /* name of the file keeping your private SSL-certificate for proxy */
- CINIT(PROXY_SSLCERT, STRINGPOINT, 254),
-
- /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") for
- proxy */
- CINIT(PROXY_SSLCERTTYPE, STRINGPOINT, 255),
-
- /* name of the file keeping your private SSL-key for proxy */
- CINIT(PROXY_SSLKEY, STRINGPOINT, 256),
-
- /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") for
- proxy */
- CINIT(PROXY_SSLKEYTYPE, STRINGPOINT, 257),
-
- /* password for the SSL private key for proxy */
- CINIT(PROXY_KEYPASSWD, STRINGPOINT, 258),
-
- /* Specify which SSL ciphers to use for proxy */
- CINIT(PROXY_SSL_CIPHER_LIST, STRINGPOINT, 259),
-
- /* CRL file for proxy */
- CINIT(PROXY_CRLFILE, STRINGPOINT, 260),
-
- /* Enable/disable specific SSL features with a bitmask for proxy, see
- CURLSSLOPT_* */
- CINIT(PROXY_SSL_OPTIONS, LONG, 261),
-
- /* Name of pre proxy to use. */
- CINIT(PRE_PROXY, STRINGPOINT, 262),
-
- /* The public key in DER form used to validate the proxy public key
- this option is used only if PROXY_SSL_VERIFYPEER is true */
- CINIT(PROXY_PINNEDPUBLICKEY, STRINGPOINT, 263),
-
- /* Path to an abstract Unix domain socket */
- CINIT(ABSTRACT_UNIX_SOCKET, STRINGPOINT, 264),
-
- /* Suppress proxy CONNECT response headers from user callbacks */
- CINIT(SUPPRESS_CONNECT_HEADERS, LONG, 265),
-
- CURLOPT_LASTENTRY /* the last unused */
-} CURLoption;
-
-#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
- the obsolete stuff removed! */
-
-/* Backwards compatibility with older names */
-/* These are scheduled to disappear by 2011 */
-
-/* This was added in version 7.19.1 */
-#define CURLOPT_POST301 CURLOPT_POSTREDIR
-
-/* These are scheduled to disappear by 2009 */
-
-/* The following were added in 7.17.0 */
-#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
-#define CURLOPT_FTPAPPEND CURLOPT_APPEND
-#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
-#define CURLOPT_FTP_SSL CURLOPT_USE_SSL
-
-/* The following were added earlier */
-
-#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
-#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
-
-#else
-/* This is set if CURL_NO_OLDIES is defined at compile-time */
-#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
-#endif
-
-
- /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
- name resolves addresses using more than one IP protocol version, this
- option might be handy to force libcurl to use a specific IP version. */
-#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
- versions that your system allows */
-#define CURL_IPRESOLVE_V4 1 /* resolve to IPv4 addresses */
-#define CURL_IPRESOLVE_V6 2 /* resolve to IPv6 addresses */
-
- /* three convenient "aliases" that follow the name scheme better */
-#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER
-
- /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
-enum {
- CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
- like the library to choose the best possible
- for us! */
- CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
- CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
- CURL_HTTP_VERSION_2_0, /* please use HTTP 2 in the request */
- CURL_HTTP_VERSION_2TLS, /* use version 2 for HTTPS, version 1.1 for HTTP */
- CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE, /* please use HTTP 2 without HTTP/1.1
- Upgrade */
-
- CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
-};
-
-/* Convenience definition simple because the name of the version is HTTP/2 and
- not 2.0. The 2_0 version of the enum name was set while the version was
- still planned to be 2.0 and we stick to it for compatibility. */
-#define CURL_HTTP_VERSION_2 CURL_HTTP_VERSION_2_0
-
-/*
- * Public API enums for RTSP requests
- */
-enum {
- CURL_RTSPREQ_NONE, /* first in list */
- CURL_RTSPREQ_OPTIONS,
- CURL_RTSPREQ_DESCRIBE,
- CURL_RTSPREQ_ANNOUNCE,
- CURL_RTSPREQ_SETUP,
- CURL_RTSPREQ_PLAY,
- CURL_RTSPREQ_PAUSE,
- CURL_RTSPREQ_TEARDOWN,
- CURL_RTSPREQ_GET_PARAMETER,
- CURL_RTSPREQ_SET_PARAMETER,
- CURL_RTSPREQ_RECORD,
- CURL_RTSPREQ_RECEIVE,
- CURL_RTSPREQ_LAST /* last in list */
-};
-
- /* These enums are for use with the CURLOPT_NETRC option. */
-enum CURL_NETRC_OPTION {
- CURL_NETRC_IGNORED, /* The .netrc will never be read.
- * This is the default. */
- CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
- * to one in the .netrc. */
- CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
- * Unless one is set programmatically, the .netrc
- * will be queried. */
- CURL_NETRC_LAST
-};
-
-enum {
- CURL_SSLVERSION_DEFAULT,
- CURL_SSLVERSION_TLSv1, /* TLS 1.x */
- CURL_SSLVERSION_SSLv2,
- CURL_SSLVERSION_SSLv3,
- CURL_SSLVERSION_TLSv1_0,
- CURL_SSLVERSION_TLSv1_1,
- CURL_SSLVERSION_TLSv1_2,
- CURL_SSLVERSION_TLSv1_3,
-
- CURL_SSLVERSION_LAST /* never use, keep last */
-};
-
-enum {
- CURL_SSLVERSION_MAX_NONE = 0,
- CURL_SSLVERSION_MAX_DEFAULT = (CURL_SSLVERSION_TLSv1 << 16),
- CURL_SSLVERSION_MAX_TLSv1_0 = (CURL_SSLVERSION_TLSv1_0 << 16),
- CURL_SSLVERSION_MAX_TLSv1_1 = (CURL_SSLVERSION_TLSv1_1 << 16),
- CURL_SSLVERSION_MAX_TLSv1_2 = (CURL_SSLVERSION_TLSv1_2 << 16),
- CURL_SSLVERSION_MAX_TLSv1_3 = (CURL_SSLVERSION_TLSv1_3 << 16),
-
- /* never use, keep last */
- CURL_SSLVERSION_MAX_LAST = (CURL_SSLVERSION_LAST << 16)
-};
-
-enum CURL_TLSAUTH {
- CURL_TLSAUTH_NONE,
- CURL_TLSAUTH_SRP,
- CURL_TLSAUTH_LAST /* never use, keep last */
-};
-
-/* symbols to use with CURLOPT_POSTREDIR.
- CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303
- can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302
- | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */
-
-#define CURL_REDIR_GET_ALL 0
-#define CURL_REDIR_POST_301 1
-#define CURL_REDIR_POST_302 2
-#define CURL_REDIR_POST_303 4
-#define CURL_REDIR_POST_ALL \
- (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)
-
-typedef enum {
- CURL_TIMECOND_NONE,
-
- CURL_TIMECOND_IFMODSINCE,
- CURL_TIMECOND_IFUNMODSINCE,
- CURL_TIMECOND_LASTMOD,
-
- CURL_TIMECOND_LAST
-} curl_TimeCond;
-
-
-/* curl_strequal() and curl_strnequal() are subject for removal in a future
- libcurl, see lib/README.curlx for details
-
- !checksrc! disable SPACEBEFOREPAREN 2
-*/
-CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
-CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
-
-/* name is uppercase CURLFORM_<name> */
-#ifdef CFINIT
-#undef CFINIT
-#endif
-
-#ifdef CURL_ISOCPP
-#define CFINIT(name) CURLFORM_ ## name
-#else
-/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
-#define CFINIT(name) CURLFORM_/**/name
-#endif
-
-typedef enum {
- CFINIT(NOTHING), /********* the first one is unused ************/
-
- /* */
- CFINIT(COPYNAME),
- CFINIT(PTRNAME),
- CFINIT(NAMELENGTH),
- CFINIT(COPYCONTENTS),
- CFINIT(PTRCONTENTS),
- CFINIT(CONTENTSLENGTH),
- CFINIT(FILECONTENT),
- CFINIT(ARRAY),
- CFINIT(OBSOLETE),
- CFINIT(FILE),
-
- CFINIT(BUFFER),
- CFINIT(BUFFERPTR),
- CFINIT(BUFFERLENGTH),
-
- CFINIT(CONTENTTYPE),
- CFINIT(CONTENTHEADER),
- CFINIT(FILENAME),
- CFINIT(END),
- CFINIT(OBSOLETE2),
-
- CFINIT(STREAM),
- CFINIT(CONTENTLEN), /* added in 7.46.0, provide a curl_off_t length */
-
- CURLFORM_LASTENTRY /* the last unused */
-} CURLformoption;
-
-#undef CFINIT /* done */
-
-/* structure to be used as parameter for CURLFORM_ARRAY */
-struct curl_forms {
- CURLformoption option;
- const char *value;
-};
-
-/* use this for multipart formpost building */
-/* Returns code for curl_formadd()
- *
- * Returns:
- * CURL_FORMADD_OK on success
- * CURL_FORMADD_MEMORY if the FormInfo allocation fails
- * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
- * CURL_FORMADD_NULL if a null pointer was given for a char
- * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
- * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
- * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
- * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated
- * CURL_FORMADD_MEMORY if some allocation for string copying failed.
- * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
- *
- ***************************************************************************/
-typedef enum {
- CURL_FORMADD_OK, /* first, no error */
-
- CURL_FORMADD_MEMORY,
- CURL_FORMADD_OPTION_TWICE,
- CURL_FORMADD_NULL,
- CURL_FORMADD_UNKNOWN_OPTION,
- CURL_FORMADD_INCOMPLETE,
- CURL_FORMADD_ILLEGAL_ARRAY,
- CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
-
- CURL_FORMADD_LAST /* last */
-} CURLFORMcode;
-
-/*
- * NAME curl_formadd()
- *
- * DESCRIPTION
- *
- * Pretty advanced function for building multi-part formposts. Each invoke
- * adds one part that together construct a full post. Then use
- * CURLOPT_HTTPPOST to send it off to libcurl.
- */
-CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
- struct curl_httppost **last_post,
- ...);
-
-/*
- * callback function for curl_formget()
- * The void *arg pointer will be the one passed as second argument to
- * curl_formget().
- * The character buffer passed to it must not be freed.
- * Should return the buffer length passed to it as the argument "len" on
- * success.
- */
-typedef size_t (*curl_formget_callback)(void *arg, const char *buf,
- size_t len);
-
-/*
- * NAME curl_formget()
- *
- * DESCRIPTION
- *
- * Serialize a curl_httppost struct built with curl_formadd().
- * Accepts a void pointer as second argument which will be passed to
- * the curl_formget_callback function.
- * Returns 0 on success.
- */
-CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
- curl_formget_callback append);
-/*
- * NAME curl_formfree()
- *
- * DESCRIPTION
- *
- * Free a multipart formpost previously built with curl_formadd().
- */
-CURL_EXTERN void curl_formfree(struct curl_httppost *form);
-
-/*
- * NAME curl_getenv()
- *
- * DESCRIPTION
- *
- * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
- * complete. DEPRECATED - see lib/README.curlx
- */
-CURL_EXTERN char *curl_getenv(const char *variable);
-
-/*
- * NAME curl_version()
- *
- * DESCRIPTION
- *
- * Returns a static ascii string of the libcurl version.
- */
-CURL_EXTERN char *curl_version(void);
-
-/*
- * NAME curl_easy_escape()
- *
- * DESCRIPTION
- *
- * Escapes URL strings (converts all letters consider illegal in URLs to their
- * %XX versions). This function returns a new allocated string or NULL if an
- * error occurred.
- */
-CURL_EXTERN char *curl_easy_escape(CURL *handle,
- const char *string,
- int length);
-
-/* the previous version: */
-CURL_EXTERN char *curl_escape(const char *string,
- int length);
-
-
-/*
- * NAME curl_easy_unescape()
- *
- * DESCRIPTION
- *
- * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
- * versions). This function returns a new allocated string or NULL if an error
- * occurred.
- * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
- * converted into the host encoding.
- */
-CURL_EXTERN char *curl_easy_unescape(CURL *handle,
- const char *string,
- int length,
- int *outlength);
-
-/* the previous version */
-CURL_EXTERN char *curl_unescape(const char *string,
- int length);
-
-/*
- * NAME curl_free()
- *
- * DESCRIPTION
- *
- * Provided for de-allocation in the same translation unit that did the
- * allocation. Added in libcurl 7.10
- */
-CURL_EXTERN void curl_free(void *p);
-
-/*
- * NAME curl_global_init()
- *
- * DESCRIPTION
- *
- * curl_global_init() should be invoked exactly once for each application that
- * uses libcurl and before any call of other libcurl functions.
- *
- * This function is not thread-safe!
- */
-CURL_EXTERN CURLcode curl_global_init(long flags);
-
-/*
- * NAME curl_global_init_mem()
- *
- * DESCRIPTION
- *
- * curl_global_init() or curl_global_init_mem() should be invoked exactly once
- * for each application that uses libcurl. This function can be used to
- * initialize libcurl and set user defined memory management callback
- * functions. Users can implement memory management routines to check for
- * memory leaks, check for mis-use of the curl library etc. User registered
- * callback routines with be invoked by this library instead of the system
- * memory management routines like malloc, free etc.
- */
-CURL_EXTERN CURLcode curl_global_init_mem(long flags,
- curl_malloc_callback m,
- curl_free_callback f,
- curl_realloc_callback r,
- curl_strdup_callback s,
- curl_calloc_callback c);
-
-/*
- * NAME curl_global_cleanup()
- *
- * DESCRIPTION
- *
- * curl_global_cleanup() should be invoked exactly once for each application
- * that uses libcurl
- */
-CURL_EXTERN void curl_global_cleanup(void);
-
-/* linked-list structure for the CURLOPT_QUOTE option (and other) */
-struct curl_slist {
- char *data;
- struct curl_slist *next;
-};
-
-/*
- * NAME curl_slist_append()
- *
- * DESCRIPTION
- *
- * Appends a string to a linked list. If no list exists, it will be created
- * first. Returns the new list, after appending.
- */
-CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
- const char *);
-
-/*
- * NAME curl_slist_free_all()
- *
- * DESCRIPTION
- *
- * free a previously built curl_slist.
- */
-CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
-
-/*
- * NAME curl_getdate()
- *
- * DESCRIPTION
- *
- * Returns the time, in seconds since 1 Jan 1970 of the time string given in
- * the first argument. The time argument in the second parameter is unused
- * and should be set to NULL.
- */
-CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
-
-/* info about the certificate chain, only for OpenSSL builds. Asked
- for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
-struct curl_certinfo {
- int num_of_certs; /* number of certificates with information */
- struct curl_slist **certinfo; /* for each index in this array, there's a
- linked list with textual information in the
- format "name: value" */
-};
-
-/* enum for the different supported SSL backends */
-typedef enum {
- CURLSSLBACKEND_NONE = 0,
- CURLSSLBACKEND_OPENSSL = 1,
- CURLSSLBACKEND_GNUTLS = 2,
- CURLSSLBACKEND_NSS = 3,
- CURLSSLBACKEND_OBSOLETE4 = 4, /* Was QSOSSL. */
- CURLSSLBACKEND_GSKIT = 5,
- CURLSSLBACKEND_POLARSSL = 6,
- CURLSSLBACKEND_CYASSL = 7,
- CURLSSLBACKEND_SCHANNEL = 8,
- CURLSSLBACKEND_DARWINSSL = 9,
- CURLSSLBACKEND_AXTLS = 10,
- CURLSSLBACKEND_MBEDTLS = 11
-} curl_sslbackend;
-
-/* aliases for library clones and renames */
-#define CURLSSLBACKEND_LIBRESSL 1
-#define CURLSSLBACKEND_BORINGSSL 1
-#define CURLSSLBACKEND_WOLFSSL 6
-
-/* Information about the SSL library used and the respective internal SSL
- handle, which can be used to obtain further information regarding the
- connection. Asked for with CURLINFO_TLS_SSL_PTR or CURLINFO_TLS_SESSION. */
-struct curl_tlssessioninfo {
- curl_sslbackend backend;
- void *internals;
-};
-
-#define CURLINFO_STRING 0x100000
-#define CURLINFO_LONG 0x200000
-#define CURLINFO_DOUBLE 0x300000
-#define CURLINFO_SLIST 0x400000
-#define CURLINFO_PTR 0x400000 /* same as SLIST */
-#define CURLINFO_SOCKET 0x500000
-#define CURLINFO_MASK 0x0fffff
-#define CURLINFO_TYPEMASK 0xf00000
-
-typedef enum {
- CURLINFO_NONE, /* first, never use this */
- CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1,
- CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2,
- CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3,
- CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4,
- CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5,
- CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
- CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
- CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,
- CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9,
- CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10,
- CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11,
- CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12,
- CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
- CURLINFO_FILETIME = CURLINFO_LONG + 14,
- CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
- CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
- CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
- CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18,
- CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19,
- CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20,
- CURLINFO_PRIVATE = CURLINFO_STRING + 21,
- CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22,
- CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
- CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
- CURLINFO_OS_ERRNO = CURLINFO_LONG + 25,
- CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26,
- CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27,
- CURLINFO_COOKIELIST = CURLINFO_SLIST + 28,
- CURLINFO_LASTSOCKET = CURLINFO_LONG + 29,
- CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30,
- CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31,
- CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32,
- CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33,
- CURLINFO_CERTINFO = CURLINFO_PTR + 34,
- CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35,
- CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36,
- CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37,
- CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38,
- CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39,
- CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40,
- CURLINFO_LOCAL_IP = CURLINFO_STRING + 41,
- CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42,
- CURLINFO_TLS_SESSION = CURLINFO_PTR + 43,
- CURLINFO_ACTIVESOCKET = CURLINFO_SOCKET + 44,
- CURLINFO_TLS_SSL_PTR = CURLINFO_PTR + 45,
- CURLINFO_HTTP_VERSION = CURLINFO_LONG + 46,
- CURLINFO_PROXY_SSL_VERIFYRESULT = CURLINFO_LONG + 47,
- CURLINFO_PROTOCOL = CURLINFO_LONG + 48,
- CURLINFO_SCHEME = CURLINFO_STRING + 49,
- /* Fill in new entries below here! */
-
- CURLINFO_LASTONE = 49
-} CURLINFO;
-
-/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
- CURLINFO_HTTP_CODE */
-#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
-
-typedef enum {
- CURLCLOSEPOLICY_NONE, /* first, never use this */
-
- CURLCLOSEPOLICY_OLDEST,
- CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
- CURLCLOSEPOLICY_LEAST_TRAFFIC,
- CURLCLOSEPOLICY_SLOWEST,
- CURLCLOSEPOLICY_CALLBACK,
-
- CURLCLOSEPOLICY_LAST /* last, never use this */
-} curl_closepolicy;
-
-#define CURL_GLOBAL_SSL (1<<0)
-#define CURL_GLOBAL_WIN32 (1<<1)
-#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
-#define CURL_GLOBAL_NOTHING 0
-#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
-#define CURL_GLOBAL_ACK_EINTR (1<<2)
-
-
-/*****************************************************************************
- * Setup defines, protos etc for the sharing stuff.
- */
-
-/* Different data locks for a single share */
-typedef enum {
- CURL_LOCK_DATA_NONE = 0,
- /* CURL_LOCK_DATA_SHARE is used internally to say that
- * the locking is just made to change the internal state of the share
- * itself.
- */
- CURL_LOCK_DATA_SHARE,
- CURL_LOCK_DATA_COOKIE,
- CURL_LOCK_DATA_DNS,
- CURL_LOCK_DATA_SSL_SESSION,
- CURL_LOCK_DATA_CONNECT,
- CURL_LOCK_DATA_LAST
-} curl_lock_data;
-
-/* Different lock access types */
-typedef enum {
- CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */
- CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
- CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
- CURL_LOCK_ACCESS_LAST /* never use */
-} curl_lock_access;
-
-typedef void (*curl_lock_function)(CURL *handle,
- curl_lock_data data,
- curl_lock_access locktype,
- void *userptr);
-typedef void (*curl_unlock_function)(CURL *handle,
- curl_lock_data data,
- void *userptr);
-
-
-typedef enum {
- CURLSHE_OK, /* all is fine */
- CURLSHE_BAD_OPTION, /* 1 */
- CURLSHE_IN_USE, /* 2 */
- CURLSHE_INVALID, /* 3 */
- CURLSHE_NOMEM, /* 4 out of memory */
- CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */
- CURLSHE_LAST /* never use */
-} CURLSHcode;
-
-typedef enum {
- CURLSHOPT_NONE, /* don't use */
- CURLSHOPT_SHARE, /* specify a data type to share */
- CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
- CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */
- CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
- CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock
- callback functions */
- CURLSHOPT_LAST /* never use */
-} CURLSHoption;
-
-CURL_EXTERN CURLSH *curl_share_init(void);
-CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
-CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
-
-/****************************************************************************
- * Structures for querying information about the curl library at runtime.
- */
-
-typedef enum {
- CURLVERSION_FIRST,
- CURLVERSION_SECOND,
- CURLVERSION_THIRD,
- CURLVERSION_FOURTH,
- CURLVERSION_LAST /* never actually use this */
-} CURLversion;
-
-/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
- basically all programs ever that want to get version information. It is
- meant to be a built-in version number for what kind of struct the caller
- expects. If the struct ever changes, we redefine the NOW to another enum
- from above. */
-#define CURLVERSION_NOW CURLVERSION_FOURTH
-
-typedef struct {
- CURLversion age; /* age of the returned struct */
- const char *version; /* LIBCURL_VERSION */
- unsigned int version_num; /* LIBCURL_VERSION_NUM */
- const char *host; /* OS/host/cpu/machine when configured */
- int features; /* bitmask, see defines below */
- const char *ssl_version; /* human readable string */
- long ssl_version_num; /* not used anymore, always 0 */
- const char *libz_version; /* human readable string */
- /* protocols is terminated by an entry with a NULL protoname */
- const char * const *protocols;
-
- /* The fields below this were added in CURLVERSION_SECOND */
- const char *ares;
- int ares_num;
-
- /* This field was added in CURLVERSION_THIRD */
- const char *libidn;
-
- /* These field were added in CURLVERSION_FOURTH */
-
- /* Same as '_libiconv_version' if built with HAVE_ICONV */
- int iconv_ver_num;
-
- const char *libssh_version; /* human readable string */
-
-} curl_version_info_data;
-
-#define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
-#define CURL_VERSION_KERBEROS4 (1<<1) /* Kerberos V4 auth is supported
- (deprecated) */
-#define CURL_VERSION_SSL (1<<2) /* SSL options are present */
-#define CURL_VERSION_LIBZ (1<<3) /* libz features are present */
-#define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */
-#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth is supported
- (deprecated) */
-#define CURL_VERSION_DEBUG (1<<6) /* Built with debug capabilities */
-#define CURL_VERSION_ASYNCHDNS (1<<7) /* Asynchronous DNS resolves */
-#define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth is supported */
-#define CURL_VERSION_LARGEFILE (1<<9) /* Supports files larger than 2GB */
-#define CURL_VERSION_IDN (1<<10) /* Internationized Domain Names are
- supported */
-#define CURL_VERSION_SSPI (1<<11) /* Built against Windows SSPI */
-#define CURL_VERSION_CONV (1<<12) /* Character conversions supported */
-#define CURL_VERSION_CURLDEBUG (1<<13) /* Debug memory tracking supported */
-#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */
-#define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegation to winbind helper
- is supported */
-#define CURL_VERSION_HTTP2 (1<<16) /* HTTP2 support built-in */
-#define CURL_VERSION_GSSAPI (1<<17) /* Built against a GSS-API library */
-#define CURL_VERSION_KERBEROS5 (1<<18) /* Kerberos V5 auth is supported */
-#define CURL_VERSION_UNIX_SOCKETS (1<<19) /* Unix domain sockets support */
-#define CURL_VERSION_PSL (1<<20) /* Mozilla's Public Suffix List, used
- for cookie domain verification */
-#define CURL_VERSION_HTTPS_PROXY (1<<21) /* HTTPS-proxy support built-in */
-
- /*
- * NAME curl_version_info()
- *
- * DESCRIPTION
- *
- * This function returns a pointer to a static copy of the version info
- * struct. See above.
- */
-CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
-
-/*
- * NAME curl_easy_strerror()
- *
- * DESCRIPTION
- *
- * The curl_easy_strerror function may be used to turn a CURLcode value
- * into the equivalent human readable error string. This is useful
- * for printing meaningful error messages.
- */
-CURL_EXTERN const char *curl_easy_strerror(CURLcode);
-
-/*
- * NAME curl_share_strerror()
- *
- * DESCRIPTION
- *
- * The curl_share_strerror function may be used to turn a CURLSHcode value
- * into the equivalent human readable error string. This is useful
- * for printing meaningful error messages.
- */
-CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
-
-/*
- * NAME curl_easy_pause()
- *
- * DESCRIPTION
- *
- * The curl_easy_pause function pauses or unpauses transfers. Select the new
- * state by setting the bitmask, use the convenience defines below.
- *
- */
-CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
-
-#define CURLPAUSE_RECV (1<<0)
-#define CURLPAUSE_RECV_CONT (0)
-
-#define CURLPAUSE_SEND (1<<2)
-#define CURLPAUSE_SEND_CONT (0)
-
-#define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND)
-#define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
-
-#ifdef __cplusplus
-}
-#endif
-
-/* unfortunately, the easy.h and multi.h include files need options and info
- stuff before they can be included! */
-#include "easy.h" /* nothing in curl is fun without the easy stuff */
-#include "multi.h"
-
-/* the typechecker doesn't work in C++ (yet) */
-#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
- ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
- !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
-#include "typecheck-gcc.h"
-#else
-#if defined(__STDC__) && (__STDC__ >= 1)
-/* This preprocessor magic that replaces a call with the exact same call is
- only done to make sure application authors pass exactly three arguments
- to these functions. */
-#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
-#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
-#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
-#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
-#endif /* __STDC__ >= 1 */
-#endif /* gcc >= 4.3 && !__cplusplus */
-
-#endif /* __CURL_CURL_H */
diff --git a/src/lib/install/arm/include/curl/curlbuild.h b/src/lib/install/arm/include/curl/curlbuild.h
deleted file mode 100755
index 8228e44..0000000
--- a/src/lib/install/arm/include/curl/curlbuild.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/* include/curl/curlbuild.h. Generated from curlbuild.h.in by configure. */
-#ifndef __CURL_CURLBUILD_H
-#define __CURL_CURLBUILD_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-/* ================================================================ */
-/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
-/* ================================================================ */
-
-/*
- * NOTE 1:
- * -------
- *
- * Nothing in this file is intended to be modified or adjusted by the
- * curl library user nor by the curl library builder.
- *
- * If you think that something actually needs to be changed, adjusted
- * or fixed in this file, then, report it on the libcurl development
- * mailing list: https://cool.haxx.se/mailman/listinfo/curl-library/
- *
- * This header file shall only export symbols which are 'curl' or 'CURL'
- * prefixed, otherwise public name space would be polluted.
- *
- * NOTE 2:
- * -------
- *
- * Right now you might be staring at file include/curl/curlbuild.h.in or
- * at file include/curl/curlbuild.h, this is due to the following reason:
- *
- * On systems capable of running the configure script, the configure process
- * will overwrite the distributed include/curl/curlbuild.h file with one that
- * is suitable and specific to the library being configured and built, which
- * is generated from the include/curl/curlbuild.h.in template file.
- *
- */
-
-/* ================================================================ */
-/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
-/* ================================================================ */
-
-#ifdef CURL_SIZEOF_LONG
-#error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h"
- Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
-#endif
-
-#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
-#error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
- Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined
-#endif
-
-#ifdef CURL_SIZEOF_CURL_SOCKLEN_T
-#error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
- Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined
-#endif
-
-#ifdef CURL_TYPEOF_CURL_OFF_T
-#error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
- Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
-#endif
-
-#ifdef CURL_FORMAT_CURL_OFF_T
-#error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h"
- Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined
-#endif
-
-#ifdef CURL_FORMAT_CURL_OFF_TU
-#error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h"
- Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined
-#endif
-
-#ifdef CURL_FORMAT_OFF_T
-#error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
- Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined
-#endif
-
-#ifdef CURL_SIZEOF_CURL_OFF_T
-#error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
- Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined
-#endif
-
-#ifdef CURL_SUFFIX_CURL_OFF_T
-#error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h"
- Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined
-#endif
-
-#ifdef CURL_SUFFIX_CURL_OFF_TU
-#error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h"
- Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined
-#endif
-
-/* ================================================================ */
-/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
-/* ================================================================ */
-
-/* Configure process defines this to 1 when it finds out that system */
-/* header file ws2tcpip.h must be included by the external interface. */
-/* #undef CURL_PULL_WS2TCPIP_H */
-#ifdef CURL_PULL_WS2TCPIP_H
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# endif
-# include <windows.h>
-# include <winsock2.h>
-# include <ws2tcpip.h>
-#endif
-
-/* Configure process defines this to 1 when it finds out that system */
-/* header file sys/types.h must be included by the external interface. */
-#define CURL_PULL_SYS_TYPES_H 1
-#ifdef CURL_PULL_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-/* Configure process defines this to 1 when it finds out that system */
-/* header file stdint.h must be included by the external interface. */
-#define CURL_PULL_STDINT_H 1
-#ifdef CURL_PULL_STDINT_H
-# include <stdint.h>
-#endif
-
-/* Configure process defines this to 1 when it finds out that system */
-/* header file inttypes.h must be included by the external interface. */
-#define CURL_PULL_INTTYPES_H 1
-#ifdef CURL_PULL_INTTYPES_H
-# include <inttypes.h>
-#endif
-
-/* Configure process defines this to 1 when it finds out that system */
-/* header file sys/socket.h must be included by the external interface. */
-#define CURL_PULL_SYS_SOCKET_H 1
-#ifdef CURL_PULL_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-
-/* Configure process defines this to 1 when it finds out that system */
-/* header file sys/poll.h must be included by the external interface. */
-/* #undef CURL_PULL_SYS_POLL_H */
-#ifdef CURL_PULL_SYS_POLL_H
-# include <sys/poll.h>
-#endif
-
-/* The size of `long', as computed by sizeof. */
-#define CURL_SIZEOF_LONG 4
-
-/* Integral data type used for curl_socklen_t. */
-#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
-
-/* The size of `curl_socklen_t', as computed by sizeof. */
-#define CURL_SIZEOF_CURL_SOCKLEN_T 4
-
-/* Data type definition of curl_socklen_t. */
-typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
-
-/* Signed integral data type used for curl_off_t. */
-#define CURL_TYPEOF_CURL_OFF_T int64_t
-
-/* Data type definition of curl_off_t. */
-typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
-
-/* curl_off_t formatting string directive without "%" conversion specifier. */
-#define CURL_FORMAT_CURL_OFF_T "lld"
-
-/* unsigned curl_off_t formatting string without "%" conversion specifier. */
-#define CURL_FORMAT_CURL_OFF_TU "llu"
-
-/* curl_off_t formatting string directive with "%" conversion specifier. */
-#define CURL_FORMAT_OFF_T "%lld"
-
-/* The size of `curl_off_t', as computed by sizeof. */
-#define CURL_SIZEOF_CURL_OFF_T 8
-
-/* curl_off_t constant suffix. */
-#define CURL_SUFFIX_CURL_OFF_T LL
-
-/* unsigned curl_off_t constant suffix. */
-#define CURL_SUFFIX_CURL_OFF_TU ULL
-
-#endif /* __CURL_CURLBUILD_H */
diff --git a/src/lib/install/arm/include/curl/curlrules.h b/src/lib/install/arm/include/curl/curlrules.h
deleted file mode 100755
index 0abd9f7..0000000
--- a/src/lib/install/arm/include/curl/curlrules.h
+++ /dev/null
@@ -1,239 +0,0 @@
-#ifndef __CURL_CURLRULES_H
-#define __CURL_CURLRULES_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-/* ================================================================ */
-/* COMPILE TIME SANITY CHECKS */
-/* ================================================================ */
-
-/*
- * NOTE 1:
- * -------
- *
- * All checks done in this file are intentionally placed in a public
- * header file which is pulled by curl/curl.h when an application is
- * being built using an already built libcurl library. Additionally
- * this file is also included and used when building the library.
- *
- * If compilation fails on this file it is certainly sure that the
- * problem is elsewhere. It could be a problem in the curlbuild.h
- * header file, or simply that you are using different compilation
- * settings than those used to build the library.
- *
- * Nothing in this file is intended to be modified or adjusted by the
- * curl library user nor by the curl library builder.
- *
- * Do not deactivate any check, these are done to make sure that the
- * library is properly built and used.
- *
- * You can find further help on the libcurl development mailing list:
- * https://cool.haxx.se/mailman/listinfo/curl-library/
- *
- * NOTE 2
- * ------
- *
- * Some of the following compile time checks are based on the fact
- * that the dimension of a constant array can not be a negative one.
- * In this way if the compile time verification fails, the compilation
- * will fail issuing an error. The error description wording is compiler
- * dependent but it will be quite similar to one of the following:
- *
- * "negative subscript or subscript is too large"
- * "array must have at least one element"
- * "-1 is an illegal array size"
- * "size of array is negative"
- *
- * If you are building an application which tries to use an already
- * built libcurl library and you are getting this kind of errors on
- * this file, it is a clear indication that there is a mismatch between
- * how the library was built and how you are trying to use it for your
- * application. Your already compiled or binary library provider is the
- * only one who can give you the details you need to properly use it.
- */
-
-/*
- * Verify that some macros are actually defined.
- */
-
-#ifndef CURL_SIZEOF_LONG
-# error "CURL_SIZEOF_LONG definition is missing!"
- Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing
-#endif
-
-#ifndef CURL_TYPEOF_CURL_SOCKLEN_T
-# error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!"
- Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing
-#endif
-
-#ifndef CURL_SIZEOF_CURL_SOCKLEN_T
-# error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!"
- Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing
-#endif
-
-#ifndef CURL_TYPEOF_CURL_OFF_T
-# error "CURL_TYPEOF_CURL_OFF_T definition is missing!"
- Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing
-#endif
-
-#ifndef CURL_FORMAT_CURL_OFF_T
-# error "CURL_FORMAT_CURL_OFF_T definition is missing!"
- Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing
-#endif
-
-#ifndef CURL_FORMAT_CURL_OFF_TU
-# error "CURL_FORMAT_CURL_OFF_TU definition is missing!"
- Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing
-#endif
-
-#ifndef CURL_SIZEOF_CURL_OFF_T
-# error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
- Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
-#endif
-
-#ifndef CURL_SUFFIX_CURL_OFF_T
-# error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
- Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing
-#endif
-
-#ifndef CURL_SUFFIX_CURL_OFF_TU
-# error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
- Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing
-#endif
-
-/*
- * Macros private to this header file.
- */
-
-#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
-
-#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
-
-/*
- * Verify that the size previously defined and expected for long
- * is the same as the one reported by sizeof() at compile time.
- */
-
-typedef char
- __curl_rule_01__
- [CurlchkszEQ(long, CURL_SIZEOF_LONG)];
-
-/*
- * Verify that the size previously defined and expected for
- * curl_off_t is actually the the same as the one reported
- * by sizeof() at compile time.
- */
-
-typedef char
- __curl_rule_02__
- [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];
-
-/*
- * Verify at compile time that the size of curl_off_t as reported
- * by sizeof() is greater or equal than the one reported for long
- * for the current compilation.
- */
-
-typedef char
- __curl_rule_03__
- [CurlchkszGE(curl_off_t, long)];
-
-/*
- * Verify that the size previously defined and expected for
- * curl_socklen_t is actually the the same as the one reported
- * by sizeof() at compile time.
- */
-
-typedef char
- __curl_rule_04__
- [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];
-
-/*
- * Verify at compile time that the size of curl_socklen_t as reported
- * by sizeof() is greater or equal than the one reported for int for
- * the current compilation.
- */
-
-typedef char
- __curl_rule_05__
- [CurlchkszGE(curl_socklen_t, int)];
-
-/* ================================================================ */
-/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */
-/* ================================================================ */
-
-/*
- * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
- * these to be visible and exported by the external libcurl interface API,
- * while also making them visible to the library internals, simply including
- * curl_setup.h, without actually needing to include curl.h internally.
- * If some day this section would grow big enough, all this should be moved
- * to its own header file.
- */
-
-/*
- * Figure out if we can use the ## preprocessor operator, which is supported
- * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
- * or __cplusplus so we need to carefully check for them too.
- */
-
-#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
- defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
- defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
- defined(__ILEC400__)
- /* This compiler is believed to have an ISO compatible preprocessor */
-#define CURL_ISOCPP
-#else
- /* This compiler is believed NOT to have an ISO compatible preprocessor */
-#undef CURL_ISOCPP
-#endif
-
-/*
- * Macros for minimum-width signed and unsigned curl_off_t integer constants.
- */
-
-#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
-# define __CURL_OFF_T_C_HLPR2(x) x
-# define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
-# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
- __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
-# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
- __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
-#else
-# ifdef CURL_ISOCPP
-# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
-# else
-# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
-# endif
-# define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
-# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
-# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
-#endif
-
-/*
- * Get rid of macros private to this header file.
- */
-
-#undef CurlchkszEQ
-#undef CurlchkszGE
-
-#endif /* __CURL_CURLRULES_H */
diff --git a/src/lib/install/arm/include/curl/curlver.h b/src/lib/install/arm/include/curl/curlver.h
deleted file mode 100755
index 227571c..0000000
--- a/src/lib/install/arm/include/curl/curlver.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef __CURL_CURLVER_H
-#define __CURL_CURLVER_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-/* This header file contains nothing but libcurl version info, generated by
- a script at release-time. This was made its own header file in 7.11.2 */
-
-/* This is the global package copyright */
-#define LIBCURL_COPYRIGHT "1996 - 2017 Daniel Stenberg, <daniel@haxx.se>."
-
-/* This is the version number of the libcurl package from which this header
- file origins: */
-#define LIBCURL_VERSION "7.54.1-DEV"
-
-/* The numeric version number is also available "in parts" by using these
- defines: */
-#define LIBCURL_VERSION_MAJOR 7
-#define LIBCURL_VERSION_MINOR 54
-#define LIBCURL_VERSION_PATCH 1
-
-/* This is the numeric version of the libcurl version number, meant for easier
- parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
- always follow this syntax:
-
- 0xXXYYZZ
-
- Where XX, YY and ZZ are the main version, release and patch numbers in
- hexadecimal (using 8 bits each). All three numbers are always represented
- using two digits. 1.2 would appear as "0x010200" while version 9.11.7
- appears as "0x090b07".
-
- This 6-digit (24 bits) hexadecimal number does not show pre-release number,
- and it is always a greater number in a more recent release. It makes
- comparisons with greater than and less than work.
-
- Note: This define is the full hex number and _does not_ use the
- CURL_VERSION_BITS() macro since curl's own configure script greps for it
- and needs it to contain the full number.
-*/
-#define LIBCURL_VERSION_NUM 0x073601
-
-/*
- * This is the date and time when the full source package was created. The
- * timestamp is not stored in git, as the timestamp is properly set in the
- * tarballs by the maketgz script.
- *
- * The format of the date follows this template:
- *
- * "2007-11-23"
- */
-#define LIBCURL_TIMESTAMP "[unreleased]"
-
-#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
-#define CURL_AT_LEAST_VERSION(x,y,z) \
- (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
-
-#endif /* __CURL_CURLVER_H */
diff --git a/src/lib/install/arm/include/curl/easy.h b/src/lib/install/arm/include/curl/easy.h
deleted file mode 100755
index 752c504..0000000
--- a/src/lib/install/arm/include/curl/easy.h
+++ /dev/null
@@ -1,102 +0,0 @@
-#ifndef __CURL_EASY_H
-#define __CURL_EASY_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-CURL_EXTERN CURL *curl_easy_init(void);
-CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
-CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
-CURL_EXTERN void curl_easy_cleanup(CURL *curl);
-
-/*
- * NAME curl_easy_getinfo()
- *
- * DESCRIPTION
- *
- * Request internal information from the curl session with this function. The
- * third argument MUST be a pointer to a long, a pointer to a char * or a
- * pointer to a double (as the documentation describes elsewhere). The data
- * pointed to will be filled in accordingly and can be relied upon only if the
- * function returns CURLE_OK. This function is intended to get used *AFTER* a
- * performed transfer, all results from this function are undefined until the
- * transfer is completed.
- */
-CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
-
-
-/*
- * NAME curl_easy_duphandle()
- *
- * DESCRIPTION
- *
- * Creates a new curl session handle with the same options set for the handle
- * passed in. Duplicating a handle could only be a matter of cloning data and
- * options, internal state info and things like persistent connections cannot
- * be transferred. It is useful in multithreaded applications when you can run
- * curl_easy_duphandle() for each new thread to avoid a series of identical
- * curl_easy_setopt() invokes in every thread.
- */
-CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl);
-
-/*
- * NAME curl_easy_reset()
- *
- * DESCRIPTION
- *
- * Re-initializes a CURL handle to the default values. This puts back the
- * handle to the same state as it was in when it was just created.
- *
- * It does keep: live connections, the Session ID cache, the DNS cache and the
- * cookies.
- */
-CURL_EXTERN void curl_easy_reset(CURL *curl);
-
-/*
- * NAME curl_easy_recv()
- *
- * DESCRIPTION
- *
- * Receives data from the connected socket. Use after successful
- * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
- */
-CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
- size_t *n);
-
-/*
- * NAME curl_easy_send()
- *
- * DESCRIPTION
- *
- * Sends data over the connected socket. Use after successful
- * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
- */
-CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
- size_t buflen, size_t *n);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/arm/include/curl/mprintf.h b/src/lib/install/arm/include/curl/mprintf.h
deleted file mode 100755
index e20f546..0000000
--- a/src/lib/install/arm/include/curl/mprintf.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef __CURL_MPRINTF_H
-#define __CURL_MPRINTF_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-#include <stdarg.h>
-#include <stdio.h> /* needed for FILE */
-#include "curl.h" /* for CURL_EXTERN */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-CURL_EXTERN int curl_mprintf(const char *format, ...);
-CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
-CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
-CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
- const char *format, ...);
-CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
-CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
-CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
-CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
- const char *format, va_list args);
-CURL_EXTERN char *curl_maprintf(const char *format, ...);
-CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CURL_MPRINTF_H */
diff --git a/src/lib/install/arm/include/curl/multi.h b/src/lib/install/arm/include/curl/multi.h
deleted file mode 100755
index f93e511..0000000
--- a/src/lib/install/arm/include/curl/multi.h
+++ /dev/null
@@ -1,439 +0,0 @@
-#ifndef __CURL_MULTI_H
-#define __CURL_MULTI_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-/*
- This is an "external" header file. Don't give away any internals here!
-
- GOALS
-
- o Enable a "pull" interface. The application that uses libcurl decides where
- and when to ask libcurl to get/send data.
-
- o Enable multiple simultaneous transfers in the same thread without making it
- complicated for the application.
-
- o Enable the application to select() on its own file descriptors and curl's
- file descriptors simultaneous easily.
-
-*/
-
-/*
- * This header file should not really need to include "curl.h" since curl.h
- * itself includes this file and we expect user applications to do #include
- * <curl/curl.h> without the need for especially including multi.h.
- *
- * For some reason we added this include here at one point, and rather than to
- * break existing (wrongly written) libcurl applications, we leave it as-is
- * but with this warning attached.
- */
-#include "curl.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
-typedef struct Curl_multi CURLM;
-#else
-typedef void CURLM;
-#endif
-
-typedef enum {
- CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
- curl_multi_socket*() soon */
- CURLM_OK,
- CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
- CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
- CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
- CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
- CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
- CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
- CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was
- attempted to get added - again */
- CURLM_LAST
-} CURLMcode;
-
-/* just to make code nicer when using curl_multi_socket() you can now check
- for CURLM_CALL_MULTI_SOCKET too in the same style it works for
- curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
-#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
-
-/* bitmask bits for CURLMOPT_PIPELINING */
-#define CURLPIPE_NOTHING 0L
-#define CURLPIPE_HTTP1 1L
-#define CURLPIPE_MULTIPLEX 2L
-
-typedef enum {
- CURLMSG_NONE, /* first, not used */
- CURLMSG_DONE, /* This easy handle has completed. 'result' contains
- the CURLcode of the transfer */
- CURLMSG_LAST /* last, not used */
-} CURLMSG;
-
-struct CURLMsg {
- CURLMSG msg; /* what this message means */
- CURL *easy_handle; /* the handle it concerns */
- union {
- void *whatever; /* message-specific data */
- CURLcode result; /* return code for transfer */
- } data;
-};
-typedef struct CURLMsg CURLMsg;
-
-/* Based on poll(2) structure and values.
- * We don't use pollfd and POLL* constants explicitly
- * to cover platforms without poll(). */
-#define CURL_WAIT_POLLIN 0x0001
-#define CURL_WAIT_POLLPRI 0x0002
-#define CURL_WAIT_POLLOUT 0x0004
-
-struct curl_waitfd {
- curl_socket_t fd;
- short events;
- short revents; /* not supported yet */
-};
-
-/*
- * Name: curl_multi_init()
- *
- * Desc: inititalize multi-style curl usage
- *
- * Returns: a new CURLM handle to use in all 'curl_multi' functions.
- */
-CURL_EXTERN CURLM *curl_multi_init(void);
-
-/*
- * Name: curl_multi_add_handle()
- *
- * Desc: add a standard curl handle to the multi stack
- *
- * Returns: CURLMcode type, general multi error code.
- */
-CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
- CURL *curl_handle);
-
- /*
- * Name: curl_multi_remove_handle()
- *
- * Desc: removes a curl handle from the multi stack again
- *
- * Returns: CURLMcode type, general multi error code.
- */
-CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
- CURL *curl_handle);
-
- /*
- * Name: curl_multi_fdset()
- *
- * Desc: Ask curl for its fd_set sets. The app can use these to select() or
- * poll() on. We want curl_multi_perform() called as soon as one of
- * them are ready.
- *
- * Returns: CURLMcode type, general multi error code.
- */
-CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
- fd_set *read_fd_set,
- fd_set *write_fd_set,
- fd_set *exc_fd_set,
- int *max_fd);
-
-/*
- * Name: curl_multi_wait()
- *
- * Desc: Poll on all fds within a CURLM set as well as any
- * additional fds passed to the function.
- *
- * Returns: CURLMcode type, general multi error code.
- */
-CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
- struct curl_waitfd extra_fds[],
- unsigned int extra_nfds,
- int timeout_ms,
- int *ret);
-
- /*
- * Name: curl_multi_perform()
- *
- * Desc: When the app thinks there's data available for curl it calls this
- * function to read/write whatever there is right now. This returns
- * as soon as the reads and writes are done. This function does not
- * require that there actually is data available for reading or that
- * data can be written, it can be called just in case. It returns
- * the number of handles that still transfer data in the second
- * argument's integer-pointer.
- *
- * Returns: CURLMcode type, general multi error code. *NOTE* that this only
- * returns errors etc regarding the whole multi stack. There might
- * still have occurred problems on invidual transfers even when this
- * returns OK.
- */
-CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
- int *running_handles);
-
- /*
- * Name: curl_multi_cleanup()
- *
- * Desc: Cleans up and removes a whole multi stack. It does not free or
- * touch any individual easy handles in any way. We need to define
- * in what state those handles will be if this function is called
- * in the middle of a transfer.
- *
- * Returns: CURLMcode type, general multi error code.
- */
-CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
-
-/*
- * Name: curl_multi_info_read()
- *
- * Desc: Ask the multi handle if there's any messages/informationals from
- * the individual transfers. Messages include informationals such as
- * error code from the transfer or just the fact that a transfer is
- * completed. More details on these should be written down as well.
- *
- * Repeated calls to this function will return a new struct each
- * time, until a special "end of msgs" struct is returned as a signal
- * that there is no more to get at this point.
- *
- * The data the returned pointer points to will not survive calling
- * curl_multi_cleanup().
- *
- * The 'CURLMsg' struct is meant to be very simple and only contain
- * very basic information. If more involved information is wanted,
- * we will provide the particular "transfer handle" in that struct
- * and that should/could/would be used in subsequent
- * curl_easy_getinfo() calls (or similar). The point being that we
- * must never expose complex structs to applications, as then we'll
- * undoubtably get backwards compatibility problems in the future.
- *
- * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
- * of structs. It also writes the number of messages left in the
- * queue (after this read) in the integer the second argument points
- * to.
- */
-CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
- int *msgs_in_queue);
-
-/*
- * Name: curl_multi_strerror()
- *
- * Desc: The curl_multi_strerror function may be used to turn a CURLMcode
- * value into the equivalent human readable error string. This is
- * useful for printing meaningful error messages.
- *
- * Returns: A pointer to a zero-terminated error message.
- */
-CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
-
-/*
- * Name: curl_multi_socket() and
- * curl_multi_socket_all()
- *
- * Desc: An alternative version of curl_multi_perform() that allows the
- * application to pass in one of the file descriptors that have been
- * detected to have "action" on them and let libcurl perform.
- * See man page for details.
- */
-#define CURL_POLL_NONE 0
-#define CURL_POLL_IN 1
-#define CURL_POLL_OUT 2
-#define CURL_POLL_INOUT 3
-#define CURL_POLL_REMOVE 4
-
-#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
-
-#define CURL_CSELECT_IN 0x01
-#define CURL_CSELECT_OUT 0x02
-#define CURL_CSELECT_ERR 0x04
-
-typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
- curl_socket_t s, /* socket */
- int what, /* see above */
- void *userp, /* private callback
- pointer */
- void *socketp); /* private socket
- pointer */
-/*
- * Name: curl_multi_timer_callback
- *
- * Desc: Called by libcurl whenever the library detects a change in the
- * maximum number of milliseconds the app is allowed to wait before
- * curl_multi_socket() or curl_multi_perform() must be called
- * (to allow libcurl's timed events to take place).
- *
- * Returns: The callback should return zero.
- */
-typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
- long timeout_ms, /* see above */
- void *userp); /* private callback
- pointer */
-
-CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
- int *running_handles);
-
-CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
- curl_socket_t s,
- int ev_bitmask,
- int *running_handles);
-
-CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
- int *running_handles);
-
-#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
-/* This macro below was added in 7.16.3 to push users who recompile to use
- the new curl_multi_socket_action() instead of the old curl_multi_socket()
-*/
-#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
-#endif
-
-/*
- * Name: curl_multi_timeout()
- *
- * Desc: Returns the maximum number of milliseconds the app is allowed to
- * wait before curl_multi_socket() or curl_multi_perform() must be
- * called (to allow libcurl's timed events to take place).
- *
- * Returns: CURLM error code.
- */
-CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
- long *milliseconds);
-
-#undef CINIT /* re-using the same name as in curl.h */
-
-#ifdef CURL_ISOCPP
-#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num
-#else
-/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
-#define LONG CURLOPTTYPE_LONG
-#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
-#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
-#define OFF_T CURLOPTTYPE_OFF_T
-#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
-#endif
-
-typedef enum {
- /* This is the socket callback function pointer */
- CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
-
- /* This is the argument passed to the socket callback */
- CINIT(SOCKETDATA, OBJECTPOINT, 2),
-
- /* set to 1 to enable pipelining for this multi handle */
- CINIT(PIPELINING, LONG, 3),
-
- /* This is the timer callback function pointer */
- CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
-
- /* This is the argument passed to the timer callback */
- CINIT(TIMERDATA, OBJECTPOINT, 5),
-
- /* maximum number of entries in the connection cache */
- CINIT(MAXCONNECTS, LONG, 6),
-
- /* maximum number of (pipelining) connections to one host */
- CINIT(MAX_HOST_CONNECTIONS, LONG, 7),
-
- /* maximum number of requests in a pipeline */
- CINIT(MAX_PIPELINE_LENGTH, LONG, 8),
-
- /* a connection with a content-length longer than this
- will not be considered for pipelining */
- CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9),
-
- /* a connection with a chunk length longer than this
- will not be considered for pipelining */
- CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10),
-
- /* a list of site names(+port) that are blacklisted from
- pipelining */
- CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),
-
- /* a list of server types that are blacklisted from
- pipelining */
- CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
-
- /* maximum number of open connections in total */
- CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
-
- /* This is the server push callback function pointer */
- CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14),
-
- /* This is the argument passed to the server push callback */
- CINIT(PUSHDATA, OBJECTPOINT, 15),
-
- CURLMOPT_LASTENTRY /* the last unused */
-} CURLMoption;
-
-
-/*
- * Name: curl_multi_setopt()
- *
- * Desc: Sets options for the multi handle.
- *
- * Returns: CURLM error code.
- */
-CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
- CURLMoption option, ...);
-
-
-/*
- * Name: curl_multi_assign()
- *
- * Desc: This function sets an association in the multi handle between the
- * given socket and a private pointer of the application. This is
- * (only) useful for curl_multi_socket uses.
- *
- * Returns: CURLM error code.
- */
-CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
- curl_socket_t sockfd, void *sockp);
-
-
-/*
- * Name: curl_push_callback
- *
- * Desc: This callback gets called when a new stream is being pushed by the
- * server. It approves or denies the new stream.
- *
- * Returns: CURL_PUSH_OK or CURL_PUSH_DENY.
- */
-#define CURL_PUSH_OK 0
-#define CURL_PUSH_DENY 1
-
-struct curl_pushheaders; /* forward declaration only */
-
-CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
- size_t num);
-CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
- const char *name);
-
-typedef int (*curl_push_callback)(CURL *parent,
- CURL *easy,
- size_t num_headers,
- struct curl_pushheaders *headers,
- void *userp);
-
-#ifdef __cplusplus
-} /* end of extern "C" */
-#endif
-
-#endif
diff --git a/src/lib/install/arm/include/curl/stdcheaders.h b/src/lib/install/arm/include/curl/stdcheaders.h
deleted file mode 100755
index 027b6f4..0000000
--- a/src/lib/install/arm/include/curl/stdcheaders.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef __STDC_HEADERS_H
-#define __STDC_HEADERS_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-#include <sys/types.h>
-
-size_t fread(void *, size_t, size_t, FILE *);
-size_t fwrite(const void *, size_t, size_t, FILE *);
-
-int strcasecmp(const char *, const char *);
-int strncasecmp(const char *, const char *, size_t);
-
-#endif /* __STDC_HEADERS_H */
diff --git a/src/lib/install/arm/include/curl/system.h b/src/lib/install/arm/include/curl/system.h
deleted file mode 100755
index ed3a55c..0000000
--- a/src/lib/install/arm/include/curl/system.h
+++ /dev/null
@@ -1,484 +0,0 @@
-#ifndef __CURL_SYSTEM_H
-#define __CURL_SYSTEM_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-/*
- * This header is supposed to eventually replace curlbuild.h. This little one
- * is still learning. During the experimental phase, this header files
- * defines symbols using the prefixes CURLSYS_ or curlsys_. When we feel
- * confident enough, we replace curlbuild.h with this file and rename all
- * prefixes to CURL_ and curl_.
- */
-
-/*
- * Try to keep one section per platform, compiler and architecture, otherwise,
- * if an existing section is reused for a different one and later on the
- * original is adjusted, probably the piggybacking one can be adversely
- * changed.
- *
- * In order to differentiate between platforms/compilers/architectures use
- * only compiler built in predefined preprocessor symbols.
- *
- * curl_off_t
- * ----------
- *
- * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
- * wide signed integral data type. The width of this data type must remain
- * constant and independent of any possible large file support settings.
- *
- * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
- * wide signed integral data type if there is no 64-bit type.
- *
- * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
- * only be violated if off_t is the only 64-bit data type available and the
- * size of off_t is independent of large file support settings. Keep your
- * build on the safe side avoiding an off_t gating. If you have a 64-bit
- * off_t then take for sure that another 64-bit data type exists, dig deeper
- * and you will find it.
- *
- */
-
-#if defined(__DJGPP__) || defined(__GO32__)
-# if defined(__DJGPP__) && (__DJGPP__ > 1)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# else
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# endif
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__SALFORDC__)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__BORLANDC__)
-# if (__BORLANDC__ < 0x520)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# else
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T __int64
-# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
-# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T i64
-# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
-# endif
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__TURBOC__)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__WATCOMC__)
-# if defined(__386__)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T __int64
-# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
-# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T i64
-# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
-# else
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# endif
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__POCC__)
-# if (__POCC__ < 280)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# elif defined(_MSC_VER)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T __int64
-# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
-# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T i64
-# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
-# else
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# endif
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__LCC__)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__SYMBIAN32__)
-# if defined(__EABI__) /* Treat all ARM compilers equally */
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# elif defined(__CW32__)
-# pragma longlong on
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# elif defined(__VC32__)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T __int64
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# endif
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T unsigned int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__MWERKS__)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(_WIN32_WCE)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T __int64
-# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
-# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T i64
-# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__MINGW32__)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
-# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-# define CURLSYS_PULL_SYS_TYPES_H 1
-# define CURLSYS_PULL_WS2TCPIP_H 1
-
-#elif defined(__VMS)
-# if defined(__VAX)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# else
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# endif
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T unsigned int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__OS400__)
-# if defined(__ILEC400__)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-# define CURLSYS_PULL_SYS_TYPES_H 1
-# define CURLSYS_PULL_SYS_SOCKET_H 1
-# endif
-
-#elif defined(__MVS__)
-# if defined(__IBMC__) || defined(__IBMCPP__)
-# if defined(_ILP32)
-# define CURLSYS_SIZEOF_LONG 4
-# elif defined(_LP64)
-# define CURLSYS_SIZEOF_LONG 8
-# endif
-# if defined(_LONG_LONG)
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# elif defined(_LP64)
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# else
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# endif
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-# define CURLSYS_PULL_SYS_TYPES_H 1
-# define CURLSYS_PULL_SYS_SOCKET_H 1
-# endif
-
-#elif defined(__370__)
-# if defined(__IBMC__) || defined(__IBMCPP__)
-# if defined(_ILP32)
-# define CURLSYS_SIZEOF_LONG 4
-# elif defined(_LP64)
-# define CURLSYS_SIZEOF_LONG 8
-# endif
-# if defined(_LONG_LONG)
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# elif defined(_LP64)
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# else
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# endif
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-# define CURLSYS_PULL_SYS_TYPES_H 1
-# define CURLSYS_PULL_SYS_SOCKET_H 1
-# endif
-
-#elif defined(TPF)
-# define CURLSYS_SIZEOF_LONG 8
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-#elif defined(__TINYC__) /* also known as tcc */
-
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
-# define CURLSYS_PULL_SYS_TYPES_H 1
-# define CURLSYS_PULL_SYS_SOCKET_H 1
-
-/* ===================================== */
-/* KEEP MSVC THE PENULTIMATE ENTRY */
-/* ===================================== */
-
-#elif defined(_MSC_VER)
-# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T __int64
-# define CURLSYS_FORMAT_CURL_OFF_T "I64d"
-# define CURLSYS_FORMAT_CURL_OFF_TU "I64u"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T i64
-# define CURLSYS_SUFFIX_CURL_OFF_TU ui64
-# else
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# endif
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-
-/* ===================================== */
-/* KEEP GENERIC GCC THE LAST ENTRY */
-/* ===================================== */
-
-#elif defined(__GNUC__)
-# if !defined(__LP64__) && (defined(__ILP32__) || \
- defined(__i386__) || defined(__ppc__) || defined(__arm__) || \
- defined(__sparc__) || defined(__mips__) || defined(__sh__))
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long long
-# define CURLSYS_FORMAT_CURL_OFF_T "lld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "llu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T LL
-# define CURLSYS_SUFFIX_CURL_OFF_TU ULL
-# elif defined(__LP64__) || \
- defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__)
-# define CURLSYS_SIZEOF_LONG 8
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SIZEOF_CURL_OFF_T 8
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# endif
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T socklen_t
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-# define CURLSYS_PULL_SYS_TYPES_H 1
-# define CURLSYS_PULL_SYS_SOCKET_H 1
-
-#else
-/* generic "safe guess" on old 32 bit style */
-# define CURLSYS_SIZEOF_LONG 4
-# define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
-# define CURLSYS_SIZEOF_CURL_OFF_T 4
-# define CURLSYS_TYPEOF_CURL_OFF_T long
-# define CURLSYS_FORMAT_CURL_OFF_T "ld"
-# define CURLSYS_FORMAT_CURL_OFF_TU "lu"
-# define CURLSYS_SUFFIX_CURL_OFF_T L
-# define CURLSYS_SUFFIX_CURL_OFF_TU UL
-# define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
-#endif
-
-/* CURLSYS_PULL_WS2TCPIP_H is defined above when inclusion of header file */
-/* ws2tcpip.h is required here to properly make type definitions below. */
-#ifdef CURLSYS_PULL_WS2TCPIP_H
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# endif
-# include <windows.h>
-# include <winsock2.h>
-# include <ws2tcpip.h>
-#endif
-
-/* CURLSYS_PULL_SYS_TYPES_H is defined above when inclusion of header file */
-/* sys/types.h is required here to properly make type definitions below. */
-#ifdef CURLSYS_PULL_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-/* CURLSYS_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
-/* sys/socket.h is required here to properly make type definitions below. */
-#ifdef CURLSYS_PULL_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-
-/* Data type definition of curl_socklen_t. */
-#ifdef CURLSYS_TYPEOF_CURL_SOCKLEN_T
- typedef CURLSYS_TYPEOF_CURL_SOCKLEN_T curlsys_socklen_t;
-#endif
-
-/* Data type definition of curl_off_t. */
-
-#ifdef CURLSYS_TYPEOF_CURL_OFF_T
- typedef CURLSYS_TYPEOF_CURL_OFF_T curlsys_off_t;
-#endif
-
-#endif /* __CURL_SYSTEM_H */
-
diff --git a/src/lib/install/arm/include/curl/typecheck-gcc.h b/src/lib/install/arm/include/curl/typecheck-gcc.h
deleted file mode 100755
index 10b5de2..0000000
--- a/src/lib/install/arm/include/curl/typecheck-gcc.h
+++ /dev/null
@@ -1,668 +0,0 @@
-#ifndef __CURL_TYPECHECK_GCC_H
-#define __CURL_TYPECHECK_GCC_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-/* wraps curl_easy_setopt() with typechecking */
-
-/* To add a new kind of warning, add an
- * if(_curl_is_sometype_option(_curl_opt))
- * if(!_curl_is_sometype(value))
- * _curl_easy_setopt_err_sometype();
- * block and define _curl_is_sometype_option, _curl_is_sometype and
- * _curl_easy_setopt_err_sometype below
- *
- * NOTE: We use two nested 'if' statements here instead of the && operator, in
- * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
- * when compiling with -Wlogical-op.
- *
- * To add an option that uses the same type as an existing option, you'll just
- * need to extend the appropriate _curl_*_option macro
- */
-#define curl_easy_setopt(handle, option, value) \
-__extension__ ({ \
- __typeof__(option) _curl_opt = option; \
- if(__builtin_constant_p(_curl_opt)) { \
- if(_curl_is_long_option(_curl_opt)) \
- if(!_curl_is_long(value)) \
- _curl_easy_setopt_err_long(); \
- if(_curl_is_off_t_option(_curl_opt)) \
- if(!_curl_is_off_t(value)) \
- _curl_easy_setopt_err_curl_off_t(); \
- if(_curl_is_string_option(_curl_opt)) \
- if(!_curl_is_string(value)) \
- _curl_easy_setopt_err_string(); \
- if(_curl_is_write_cb_option(_curl_opt)) \
- if(!_curl_is_write_cb(value)) \
- _curl_easy_setopt_err_write_callback(); \
- if((_curl_opt) == CURLOPT_READFUNCTION) \
- if(!_curl_is_read_cb(value)) \
- _curl_easy_setopt_err_read_cb(); \
- if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
- if(!_curl_is_ioctl_cb(value)) \
- _curl_easy_setopt_err_ioctl_cb(); \
- if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
- if(!_curl_is_sockopt_cb(value)) \
- _curl_easy_setopt_err_sockopt_cb(); \
- if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
- if(!_curl_is_opensocket_cb(value)) \
- _curl_easy_setopt_err_opensocket_cb(); \
- if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
- if(!_curl_is_progress_cb(value)) \
- _curl_easy_setopt_err_progress_cb(); \
- if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
- if(!_curl_is_debug_cb(value)) \
- _curl_easy_setopt_err_debug_cb(); \
- if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
- if(!_curl_is_ssl_ctx_cb(value)) \
- _curl_easy_setopt_err_ssl_ctx_cb(); \
- if(_curl_is_conv_cb_option(_curl_opt)) \
- if(!_curl_is_conv_cb(value)) \
- _curl_easy_setopt_err_conv_cb(); \
- if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
- if(!_curl_is_seek_cb(value)) \
- _curl_easy_setopt_err_seek_cb(); \
- if(_curl_is_cb_data_option(_curl_opt)) \
- if(!_curl_is_cb_data(value)) \
- _curl_easy_setopt_err_cb_data(); \
- if((_curl_opt) == CURLOPT_ERRORBUFFER) \
- if(!_curl_is_error_buffer(value)) \
- _curl_easy_setopt_err_error_buffer(); \
- if((_curl_opt) == CURLOPT_STDERR) \
- if(!_curl_is_FILE(value)) \
- _curl_easy_setopt_err_FILE(); \
- if(_curl_is_postfields_option(_curl_opt)) \
- if(!_curl_is_postfields(value)) \
- _curl_easy_setopt_err_postfields(); \
- if((_curl_opt) == CURLOPT_HTTPPOST) \
- if(!_curl_is_arr((value), struct curl_httppost)) \
- _curl_easy_setopt_err_curl_httpost(); \
- if(_curl_is_slist_option(_curl_opt)) \
- if(!_curl_is_arr((value), struct curl_slist)) \
- _curl_easy_setopt_err_curl_slist(); \
- if((_curl_opt) == CURLOPT_SHARE) \
- if(!_curl_is_ptr((value), CURLSH)) \
- _curl_easy_setopt_err_CURLSH(); \
- } \
- curl_easy_setopt(handle, _curl_opt, value); \
-})
-
-/* wraps curl_easy_getinfo() with typechecking */
-/* FIXME: don't allow const pointers */
-#define curl_easy_getinfo(handle, info, arg) \
-__extension__ ({ \
- __typeof__(info) _curl_info = info; \
- if(__builtin_constant_p(_curl_info)) { \
- if(_curl_is_string_info(_curl_info)) \
- if(!_curl_is_arr((arg), char *)) \
- _curl_easy_getinfo_err_string(); \
- if(_curl_is_long_info(_curl_info)) \
- if(!_curl_is_arr((arg), long)) \
- _curl_easy_getinfo_err_long(); \
- if(_curl_is_double_info(_curl_info)) \
- if(!_curl_is_arr((arg), double)) \
- _curl_easy_getinfo_err_double(); \
- if(_curl_is_slist_info(_curl_info)) \
- if(!_curl_is_arr((arg), struct curl_slist *)) \
- _curl_easy_getinfo_err_curl_slist(); \
- if(_curl_is_tlssessioninfo_info(_curl_info)) \
- if(!_curl_is_arr((arg), struct curl_tlssessioninfo *)) \
- _curl_easy_getinfo_err_curl_tlssesssioninfo(); \
- if(_curl_is_certinfo_info(_curl_info)) \
- if(!_curl_is_arr((arg), struct curl_certinfo *)) \
- _curl_easy_getinfo_err_curl_certinfo(); \
- if(_curl_is_socket_info(_curl_info)) \
- if(!_curl_is_arr((arg), curl_socket_t)) \
- _curl_easy_getinfo_err_curl_socket(); \
- } \
- curl_easy_getinfo(handle, _curl_info, arg); \
-})
-
-/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
- * for now just make sure that the functions are called with three
- * arguments
- */
-#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
-#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
-
-
-/* the actual warnings, triggered by calling the _curl_easy_setopt_err*
- * functions */
-
-/* To define a new warning, use _CURL_WARNING(identifier, "message") */
-#define _CURL_WARNING(id, message) \
- static void __attribute__((__warning__(message))) \
- __attribute__((__unused__)) __attribute__((__noinline__)) \
- id(void) { __asm__(""); }
-
-_CURL_WARNING(_curl_easy_setopt_err_long,
- "curl_easy_setopt expects a long argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
- "curl_easy_setopt expects a curl_off_t argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_string,
- "curl_easy_setopt expects a "
- "string ('char *' or char[]) argument for this option"
- )
-_CURL_WARNING(_curl_easy_setopt_err_write_callback,
- "curl_easy_setopt expects a curl_write_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_read_cb,
- "curl_easy_setopt expects a curl_read_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
- "curl_easy_setopt expects a curl_ioctl_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
- "curl_easy_setopt expects a curl_sockopt_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
- "curl_easy_setopt expects a "
- "curl_opensocket_callback argument for this option"
- )
-_CURL_WARNING(_curl_easy_setopt_err_progress_cb,
- "curl_easy_setopt expects a curl_progress_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_debug_cb,
- "curl_easy_setopt expects a curl_debug_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
- "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_conv_cb,
- "curl_easy_setopt expects a curl_conv_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_seek_cb,
- "curl_easy_setopt expects a curl_seek_callback argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_cb_data,
- "curl_easy_setopt expects a "
- "private data pointer as argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_error_buffer,
- "curl_easy_setopt expects a "
- "char buffer of CURL_ERROR_SIZE as argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_FILE,
- "curl_easy_setopt expects a 'FILE *' argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_postfields,
- "curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
- "curl_easy_setopt expects a 'struct curl_httppost *' "
- "argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_curl_slist,
- "curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
-_CURL_WARNING(_curl_easy_setopt_err_CURLSH,
- "curl_easy_setopt expects a CURLSH* argument for this option")
-
-_CURL_WARNING(_curl_easy_getinfo_err_string,
- "curl_easy_getinfo expects a pointer to 'char *' for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_long,
- "curl_easy_getinfo expects a pointer to long for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_double,
- "curl_easy_getinfo expects a pointer to double for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
- "curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
- "curl_easy_getinfo expects a pointer to "
- "'struct curl_tlssessioninfo *' for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_curl_certinfo,
- "curl_easy_getinfo expects a pointer to "
- "'struct curl_certinfo *' for this info")
-_CURL_WARNING(_curl_easy_getinfo_err_curl_socket,
- "curl_easy_getinfo expects a pointer to curl_socket_t for this info")
-
-/* groups of curl_easy_setops options that take the same type of argument */
-
-/* To add a new option to one of the groups, just add
- * (option) == CURLOPT_SOMETHING
- * to the or-expression. If the option takes a long or curl_off_t, you don't
- * have to do anything
- */
-
-/* evaluates to true if option takes a long argument */
-#define _curl_is_long_option(option) \
- (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
-
-#define _curl_is_off_t_option(option) \
- ((option) > CURLOPTTYPE_OFF_T)
-
-/* evaluates to true if option takes a char* argument */
-#define _curl_is_string_option(option) \
- ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
- (option) == CURLOPT_ACCEPT_ENCODING || \
- (option) == CURLOPT_CAINFO || \
- (option) == CURLOPT_CAPATH || \
- (option) == CURLOPT_COOKIE || \
- (option) == CURLOPT_COOKIEFILE || \
- (option) == CURLOPT_COOKIEJAR || \
- (option) == CURLOPT_COOKIELIST || \
- (option) == CURLOPT_CRLFILE || \
- (option) == CURLOPT_CUSTOMREQUEST || \
- (option) == CURLOPT_DEFAULT_PROTOCOL || \
- (option) == CURLOPT_DNS_INTERFACE || \
- (option) == CURLOPT_DNS_LOCAL_IP4 || \
- (option) == CURLOPT_DNS_LOCAL_IP6 || \
- (option) == CURLOPT_DNS_SERVERS || \
- (option) == CURLOPT_EGDSOCKET || \
- (option) == CURLOPT_FTPPORT || \
- (option) == CURLOPT_FTP_ACCOUNT || \
- (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
- (option) == CURLOPT_INTERFACE || \
- (option) == CURLOPT_ISSUERCERT || \
- (option) == CURLOPT_KEYPASSWD || \
- (option) == CURLOPT_KRBLEVEL || \
- (option) == CURLOPT_LOGIN_OPTIONS || \
- (option) == CURLOPT_MAIL_AUTH || \
- (option) == CURLOPT_MAIL_FROM || \
- (option) == CURLOPT_NETRC_FILE || \
- (option) == CURLOPT_NOPROXY || \
- (option) == CURLOPT_PASSWORD || \
- (option) == CURLOPT_PINNEDPUBLICKEY || \
- (option) == CURLOPT_PRE_PROXY || \
- (option) == CURLOPT_PROXY || \
- (option) == CURLOPT_PROXYPASSWORD || \
- (option) == CURLOPT_PROXYUSERNAME || \
- (option) == CURLOPT_PROXYUSERPWD || \
- (option) == CURLOPT_PROXY_CAINFO || \
- (option) == CURLOPT_PROXY_CAPATH || \
- (option) == CURLOPT_PROXY_CRLFILE || \
- (option) == CURLOPT_PROXY_KEYPASSWD || \
- (option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
- (option) == CURLOPT_PROXY_SERVICE_NAME || \
- (option) == CURLOPT_PROXY_SSLCERT || \
- (option) == CURLOPT_PROXY_SSLCERTTYPE || \
- (option) == CURLOPT_PROXY_SSLKEY || \
- (option) == CURLOPT_PROXY_SSLKEYTYPE || \
- (option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \
- (option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \
- (option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \
- (option) == CURLOPT_PROXY_TLSAUTH_TYPE || \
- (option) == CURLOPT_RANDOM_FILE || \
- (option) == CURLOPT_RANGE || \
- (option) == CURLOPT_REFERER || \
- (option) == CURLOPT_RTSP_SESSION_ID || \
- (option) == CURLOPT_RTSP_STREAM_URI || \
- (option) == CURLOPT_RTSP_TRANSPORT || \
- (option) == CURLOPT_SERVICE_NAME || \
- (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
- (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
- (option) == CURLOPT_SSH_KNOWNHOSTS || \
- (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
- (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
- (option) == CURLOPT_SSLCERT || \
- (option) == CURLOPT_SSLCERTTYPE || \
- (option) == CURLOPT_SSLENGINE || \
- (option) == CURLOPT_SSLKEY || \
- (option) == CURLOPT_SSLKEYTYPE || \
- (option) == CURLOPT_SSL_CIPHER_LIST || \
- (option) == CURLOPT_TLSAUTH_PASSWORD || \
- (option) == CURLOPT_TLSAUTH_TYPE || \
- (option) == CURLOPT_TLSAUTH_USERNAME || \
- (option) == CURLOPT_UNIX_SOCKET_PATH || \
- (option) == CURLOPT_URL || \
- (option) == CURLOPT_USERAGENT || \
- (option) == CURLOPT_USERNAME || \
- (option) == CURLOPT_USERPWD || \
- (option) == CURLOPT_XOAUTH2_BEARER || \
- 0)
-
-/* evaluates to true if option takes a curl_write_callback argument */
-#define _curl_is_write_cb_option(option) \
- ((option) == CURLOPT_HEADERFUNCTION || \
- (option) == CURLOPT_WRITEFUNCTION)
-
-/* evaluates to true if option takes a curl_conv_callback argument */
-#define _curl_is_conv_cb_option(option) \
- ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
- (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
- (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
-
-/* evaluates to true if option takes a data argument to pass to a callback */
-#define _curl_is_cb_data_option(option) \
- ((option) == CURLOPT_CHUNK_DATA || \
- (option) == CURLOPT_CLOSESOCKETDATA || \
- (option) == CURLOPT_DEBUGDATA || \
- (option) == CURLOPT_FNMATCH_DATA || \
- (option) == CURLOPT_HEADERDATA || \
- (option) == CURLOPT_INTERLEAVEDATA || \
- (option) == CURLOPT_IOCTLDATA || \
- (option) == CURLOPT_OPENSOCKETDATA || \
- (option) == CURLOPT_PRIVATE || \
- (option) == CURLOPT_PROGRESSDATA || \
- (option) == CURLOPT_READDATA || \
- (option) == CURLOPT_SEEKDATA || \
- (option) == CURLOPT_SOCKOPTDATA || \
- (option) == CURLOPT_SSH_KEYDATA || \
- (option) == CURLOPT_SSL_CTX_DATA || \
- (option) == CURLOPT_WRITEDATA || \
- 0)
-
-/* evaluates to true if option takes a POST data argument (void* or char*) */
-#define _curl_is_postfields_option(option) \
- ((option) == CURLOPT_POSTFIELDS || \
- (option) == CURLOPT_COPYPOSTFIELDS || \
- 0)
-
-/* evaluates to true if option takes a struct curl_slist * argument */
-#define _curl_is_slist_option(option) \
- ((option) == CURLOPT_HTTP200ALIASES || \
- (option) == CURLOPT_HTTPHEADER || \
- (option) == CURLOPT_MAIL_RCPT || \
- (option) == CURLOPT_POSTQUOTE || \
- (option) == CURLOPT_PREQUOTE || \
- (option) == CURLOPT_PROXYHEADER || \
- (option) == CURLOPT_QUOTE || \
- (option) == CURLOPT_RESOLVE || \
- (option) == CURLOPT_TELNETOPTIONS || \
- 0)
-
-/* groups of curl_easy_getinfo infos that take the same type of argument */
-
-/* evaluates to true if info expects a pointer to char * argument */
-#define _curl_is_string_info(info) \
- (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
-
-/* evaluates to true if info expects a pointer to long argument */
-#define _curl_is_long_info(info) \
- (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
-
-/* evaluates to true if info expects a pointer to double argument */
-#define _curl_is_double_info(info) \
- (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
-
-/* true if info expects a pointer to struct curl_slist * argument */
-#define _curl_is_slist_info(info) \
- (((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
-
-/* true if info expects a pointer to struct curl_tlssessioninfo * argument */
-#define _curl_is_tlssessioninfo_info(info) \
- (((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
-
-/* true if info expects a pointer to struct curl_certinfo * argument */
-#define _curl_is_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
-
-/* true if info expects a pointer to struct curl_socket_t argument */
-#define _curl_is_socket_info(info) \
- (CURLINFO_SOCKET < (info))
-
-
-/* typecheck helpers -- check whether given expression has requested type*/
-
-/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
- * otherwise define a new macro. Search for __builtin_types_compatible_p
- * in the GCC manual.
- * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
- * the actual expression passed to the curl_easy_setopt macro. This
- * means that you can only apply the sizeof and __typeof__ operators, no
- * == or whatsoever.
- */
-
-/* XXX: should evaluate to true iff expr is a pointer */
-#define _curl_is_any_ptr(expr) \
- (sizeof(expr) == sizeof(void *))
-
-/* evaluates to true if expr is NULL */
-/* XXX: must not evaluate expr, so this check is not accurate */
-#define _curl_is_NULL(expr) \
- (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
-
-/* evaluates to true if expr is type*, const type* or NULL */
-#define _curl_is_ptr(expr, type) \
- (_curl_is_NULL(expr) || \
- __builtin_types_compatible_p(__typeof__(expr), type *) || \
- __builtin_types_compatible_p(__typeof__(expr), const type *))
-
-/* evaluates to true if expr is one of type[], type*, NULL or const type* */
-#define _curl_is_arr(expr, type) \
- (_curl_is_ptr((expr), type) || \
- __builtin_types_compatible_p(__typeof__(expr), type []))
-
-/* evaluates to true if expr is a string */
-#define _curl_is_string(expr) \
- (_curl_is_arr((expr), char) || \
- _curl_is_arr((expr), signed char) || \
- _curl_is_arr((expr), unsigned char))
-
-/* evaluates to true if expr is a long (no matter the signedness)
- * XXX: for now, int is also accepted (and therefore short and char, which
- * are promoted to int when passed to a variadic function) */
-#define _curl_is_long(expr) \
- (__builtin_types_compatible_p(__typeof__(expr), long) || \
- __builtin_types_compatible_p(__typeof__(expr), signed long) || \
- __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
- __builtin_types_compatible_p(__typeof__(expr), int) || \
- __builtin_types_compatible_p(__typeof__(expr), signed int) || \
- __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
- __builtin_types_compatible_p(__typeof__(expr), short) || \
- __builtin_types_compatible_p(__typeof__(expr), signed short) || \
- __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
- __builtin_types_compatible_p(__typeof__(expr), char) || \
- __builtin_types_compatible_p(__typeof__(expr), signed char) || \
- __builtin_types_compatible_p(__typeof__(expr), unsigned char))
-
-/* evaluates to true if expr is of type curl_off_t */
-#define _curl_is_off_t(expr) \
- (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
-
-/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
-/* XXX: also check size of an char[] array? */
-#define _curl_is_error_buffer(expr) \
- (_curl_is_NULL(expr) || \
- __builtin_types_compatible_p(__typeof__(expr), char *) || \
- __builtin_types_compatible_p(__typeof__(expr), char[]))
-
-/* evaluates to true if expr is of type (const) void* or (const) FILE* */
-#if 0
-#define _curl_is_cb_data(expr) \
- (_curl_is_ptr((expr), void) || \
- _curl_is_ptr((expr), FILE))
-#else /* be less strict */
-#define _curl_is_cb_data(expr) \
- _curl_is_any_ptr(expr)
-#endif
-
-/* evaluates to true if expr is of type FILE* */
-#define _curl_is_FILE(expr) \
- (_curl_is_NULL(expr) || \
- (__builtin_types_compatible_p(__typeof__(expr), FILE *)))
-
-/* evaluates to true if expr can be passed as POST data (void* or char*) */
-#define _curl_is_postfields(expr) \
- (_curl_is_ptr((expr), void) || \
- _curl_is_arr((expr), char))
-
-/* FIXME: the whole callback checking is messy...
- * The idea is to tolerate char vs. void and const vs. not const
- * pointers in arguments at least
- */
-/* helper: __builtin_types_compatible_p distinguishes between functions and
- * function pointers, hide it */
-#define _curl_callback_compatible(func, type) \
- (__builtin_types_compatible_p(__typeof__(func), type) || \
- __builtin_types_compatible_p(__typeof__(func) *, type))
-
-/* evaluates to true if expr is of type curl_read_callback or "similar" */
-#define _curl_is_read_cb(expr) \
- (_curl_is_NULL(expr) || \
- _curl_callback_compatible((expr), __typeof__(fread) *) || \
- _curl_callback_compatible((expr), curl_read_callback) || \
- _curl_callback_compatible((expr), _curl_read_callback1) || \
- _curl_callback_compatible((expr), _curl_read_callback2) || \
- _curl_callback_compatible((expr), _curl_read_callback3) || \
- _curl_callback_compatible((expr), _curl_read_callback4) || \
- _curl_callback_compatible((expr), _curl_read_callback5) || \
- _curl_callback_compatible((expr), _curl_read_callback6))
-typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
-typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
-typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
-typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *);
-typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
-typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
-
-/* evaluates to true if expr is of type curl_write_callback or "similar" */
-#define _curl_is_write_cb(expr) \
- (_curl_is_read_cb(expr) || \
- _curl_callback_compatible((expr), __typeof__(fwrite) *) || \
- _curl_callback_compatible((expr), curl_write_callback) || \
- _curl_callback_compatible((expr), _curl_write_callback1) || \
- _curl_callback_compatible((expr), _curl_write_callback2) || \
- _curl_callback_compatible((expr), _curl_write_callback3) || \
- _curl_callback_compatible((expr), _curl_write_callback4) || \
- _curl_callback_compatible((expr), _curl_write_callback5) || \
- _curl_callback_compatible((expr), _curl_write_callback6))
-typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
-typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
- const void *);
-typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *);
-typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *);
-typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
- const void *);
-typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
-
-/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
-#define _curl_is_ioctl_cb(expr) \
- (_curl_is_NULL(expr) || \
- _curl_callback_compatible((expr), curl_ioctl_callback) || \
- _curl_callback_compatible((expr), _curl_ioctl_callback1) || \
- _curl_callback_compatible((expr), _curl_ioctl_callback2) || \
- _curl_callback_compatible((expr), _curl_ioctl_callback3) || \
- _curl_callback_compatible((expr), _curl_ioctl_callback4))
-typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
-typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
-typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
-typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
-
-/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
-#define _curl_is_sockopt_cb(expr) \
- (_curl_is_NULL(expr) || \
- _curl_callback_compatible((expr), curl_sockopt_callback) || \
- _curl_callback_compatible((expr), _curl_sockopt_callback1) || \
- _curl_callback_compatible((expr), _curl_sockopt_callback2))
-typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
-typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
- curlsocktype);
-
-/* evaluates to true if expr is of type curl_opensocket_callback or
- "similar" */
-#define _curl_is_opensocket_cb(expr) \
- (_curl_is_NULL(expr) || \
- _curl_callback_compatible((expr), curl_opensocket_callback) || \
- _curl_callback_compatible((expr), _curl_opensocket_callback1) || \
- _curl_callback_compatible((expr), _curl_opensocket_callback2) || \
- _curl_callback_compatible((expr), _curl_opensocket_callback3) || \
- _curl_callback_compatible((expr), _curl_opensocket_callback4))
-typedef curl_socket_t (*_curl_opensocket_callback1)
- (void *, curlsocktype, struct curl_sockaddr *);
-typedef curl_socket_t (*_curl_opensocket_callback2)
- (void *, curlsocktype, const struct curl_sockaddr *);
-typedef curl_socket_t (*_curl_opensocket_callback3)
- (const void *, curlsocktype, struct curl_sockaddr *);
-typedef curl_socket_t (*_curl_opensocket_callback4)
- (const void *, curlsocktype, const struct curl_sockaddr *);
-
-/* evaluates to true if expr is of type curl_progress_callback or "similar" */
-#define _curl_is_progress_cb(expr) \
- (_curl_is_NULL(expr) || \
- _curl_callback_compatible((expr), curl_progress_callback) || \
- _curl_callback_compatible((expr), _curl_progress_callback1) || \
- _curl_callback_compatible((expr), _curl_progress_callback2))
-typedef int (*_curl_progress_callback1)(void *,
- double, double, double, double);
-typedef int (*_curl_progress_callback2)(const void *,
- double, double, double, double);
-
-/* evaluates to true if expr is of type curl_debug_callback or "similar" */
-#define _curl_is_debug_cb(expr) \
- (_curl_is_NULL(expr) || \
- _curl_callback_compatible((expr), curl_debug_callback) || \
- _curl_callback_compatible((expr), _curl_debug_callback1) || \
- _curl_callback_compatible((expr), _curl_debug_callback2) || \
- _curl_callback_compatible((expr), _curl_debug_callback3) || \
- _curl_callback_compatible((expr), _curl_debug_callback4) || \
- _curl_callback_compatible((expr), _curl_debug_callback5) || \
- _curl_callback_compatible((expr), _curl_debug_callback6) || \
- _curl_callback_compatible((expr), _curl_debug_callback7) || \
- _curl_callback_compatible((expr), _curl_debug_callback8))
-typedef int (*_curl_debug_callback1) (CURL *,
- curl_infotype, char *, size_t, void *);
-typedef int (*_curl_debug_callback2) (CURL *,
- curl_infotype, char *, size_t, const void *);
-typedef int (*_curl_debug_callback3) (CURL *,
- curl_infotype, const char *, size_t, void *);
-typedef int (*_curl_debug_callback4) (CURL *,
- curl_infotype, const char *, size_t, const void *);
-typedef int (*_curl_debug_callback5) (CURL *,
- curl_infotype, unsigned char *, size_t, void *);
-typedef int (*_curl_debug_callback6) (CURL *,
- curl_infotype, unsigned char *, size_t, const void *);
-typedef int (*_curl_debug_callback7) (CURL *,
- curl_infotype, const unsigned char *, size_t, void *);
-typedef int (*_curl_debug_callback8) (CURL *,
- curl_infotype, const unsigned char *, size_t, const void *);
-
-/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
-/* this is getting even messier... */
-#define _curl_is_ssl_ctx_cb(expr) \
- (_curl_is_NULL(expr) || \
- _curl_callback_compatible((expr), curl_ssl_ctx_callback) || \
- _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \
- _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \
- _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \
- _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \
- _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \
- _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \
- _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \
- _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
-typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
-typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
-typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
-typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
- const void *);
-#ifdef HEADER_SSL_H
-/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
- * this will of course break if we're included before OpenSSL headers...
- */
-typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
-typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
-typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
-typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
- const void *);
-#else
-typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
-typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
-typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
-typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
-#endif
-
-/* evaluates to true if expr is of type curl_conv_callback or "similar" */
-#define _curl_is_conv_cb(expr) \
- (_curl_is_NULL(expr) || \
- _curl_callback_compatible((expr), curl_conv_callback) || \
- _curl_callback_compatible((expr), _curl_conv_callback1) || \
- _curl_callback_compatible((expr), _curl_conv_callback2) || \
- _curl_callback_compatible((expr), _curl_conv_callback3) || \
- _curl_callback_compatible((expr), _curl_conv_callback4))
-typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
-typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
-typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
-typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
-
-/* evaluates to true if expr is of type curl_seek_callback or "similar" */
-#define _curl_is_seek_cb(expr) \
- (_curl_is_NULL(expr) || \
- _curl_callback_compatible((expr), curl_seek_callback) || \
- _curl_callback_compatible((expr), _curl_seek_callback1) || \
- _curl_callback_compatible((expr), _curl_seek_callback2))
-typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
-typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
-
-
-#endif /* __CURL_TYPECHECK_GCC_H */
diff --git a/src/lib/install/arm/lib/libcurl.a b/src/lib/install/arm/lib/libcurl.a
deleted file mode 100755
index 514f8e7..0000000
--- a/src/lib/install/arm/lib/libcurl.a
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/arm/lib/libcurl.la b/src/lib/install/arm/lib/libcurl.la
deleted file mode 100755
index ed98ed5..0000000
--- a/src/lib/install/arm/lib/libcurl.la
+++ /dev/null
@@ -1,41 +0,0 @@
-# libcurl.la - a libtool library file
-# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname=''
-
-# Names of this library.
-library_names=''
-
-# The name of the static archive.
-old_library='libcurl.a'
-
-# Linker flags that cannot go in dependency_libs.
-inherited_linker_flags=''
-
-# Libraries that this one depends upon.
-dependency_libs=''
-
-# Names of additional weak libraries provided by this library
-weak_library_names=''
-
-# Version information for libcurl.
-current=8
-age=4
-revision=0
-
-# Is this an already installed library?
-installed=yes
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/home/jiehwan/playground/dockerfw/src-git/curl/install/arm/lib'
diff --git a/src/lib/install/arm/lib/libcurl.so b/src/lib/install/arm/lib/libcurl.so
deleted file mode 100755
index 8482a0e..0000000
--- a/src/lib/install/arm/lib/libcurl.so
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/arm/lib/libcurl.so.4 b/src/lib/install/arm/lib/libcurl.so.4
deleted file mode 100755
index 8482a0e..0000000
--- a/src/lib/install/arm/lib/libcurl.so.4
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/arm/lib/libcurl.so.4.4.0 b/src/lib/install/arm/lib/libcurl.so.4.4.0
deleted file mode 100755
index 8482a0e..0000000
--- a/src/lib/install/arm/lib/libcurl.so.4.4.0
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/arm/lib/libdockzen.a b/src/lib/install/arm/lib/libdockzen.a
deleted file mode 100644
index 5f6f8a6..0000000
--- a/src/lib/install/arm/lib/libdockzen.a
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/arm/lib/libgmock.a b/src/lib/install/arm/lib/libgmock.a
deleted file mode 100755
index 7119ef6..0000000
--- a/src/lib/install/arm/lib/libgmock.a
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/arm/lib/libgmock_main.a b/src/lib/install/arm/lib/libgmock_main.a
deleted file mode 100755
index 08c3962..0000000
--- a/src/lib/install/arm/lib/libgmock_main.a
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/arm/lib/libjson-c.a b/src/lib/install/arm/lib/libjson-c.a
deleted file mode 100644
index 476a050..0000000
--- a/src/lib/install/arm/lib/libjson-c.a
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/arm/lib/libjson-c.la b/src/lib/install/arm/lib/libjson-c.la
deleted file mode 100644
index ae202f1..0000000
--- a/src/lib/install/arm/lib/libjson-c.la
+++ /dev/null
@@ -1,41 +0,0 @@
-# libjson-c.la - a libtool library file
-# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='libjson-c.so.2'
-
-# Names of this library.
-library_names='libjson-c.so.2.0.2 libjson-c.so.2 libjson-c.so'
-
-# The name of the static archive.
-old_library='libjson-c.a'
-
-# Linker flags that cannot go in dependency_libs.
-inherited_linker_flags=''
-
-# Libraries that this one depends upon.
-dependency_libs=''
-
-# Names of additional weak libraries provided by this library
-weak_library_names=''
-
-# Version information for libjson-c.
-current=2
-age=0
-revision=2
-
-# Is this an already installed library?
-installed=yes
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/home/jiehwan/playground/dockerfw/git/json-c/install/arm/lib'
diff --git a/src/lib/install/arm/lib/libjson-c.so b/src/lib/install/arm/lib/libjson-c.so
deleted file mode 120000
index 9942e8f..0000000
--- a/src/lib/install/arm/lib/libjson-c.so
+++ /dev/null
@@ -1 +0,0 @@
-libjson-c.so.2.0.2 \ No newline at end of file
diff --git a/src/lib/install/arm/lib/libjson-c.so.2 b/src/lib/install/arm/lib/libjson-c.so.2
deleted file mode 120000
index 9942e8f..0000000
--- a/src/lib/install/arm/lib/libjson-c.so.2
+++ /dev/null
@@ -1 +0,0 @@
-libjson-c.so.2.0.2 \ No newline at end of file
diff --git a/src/lib/install/arm/lib/libjson-c.so.2.0.2 b/src/lib/install/arm/lib/libjson-c.so.2.0.2
deleted file mode 100644
index bed4fce..0000000
--- a/src/lib/install/arm/lib/libjson-c.so.2.0.2
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/arm/lib/libyaml.a b/src/lib/install/arm/lib/libyaml.a
deleted file mode 100644
index 5e6299a..0000000
--- a/src/lib/install/arm/lib/libyaml.a
+++ /dev/null
Binary files differ
diff --git a/src/lib/install/include/gmock/gmock-actions.h b/src/lib/install/include/gmock/gmock-actions.h
deleted file mode 100755
index b3f654a..0000000
--- a/src/lib/install/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 <errno.h>
-#endif
-
-#include <algorithm>
-#include <string>
-
-#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 <type_traits>
-#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 <typename F1, typename F2>
-class ActionAdaptor;
-
-// BuiltInDefaultValueGetter<T, true>::Get() returns a
-// default-constructed T value. BuiltInDefaultValueGetter<T,
-// false>::Get() crashes with an error.
-//
-// This primary template is used when kDefaultConstructible is true.
-template <typename T, bool kDefaultConstructible>
-struct BuiltInDefaultValueGetter {
- static T Get() { return T(); }
-};
-template <typename T>
-struct BuiltInDefaultValueGetter<T, false> {
- static T Get() {
- Assert(false, __FILE__, __LINE__,
- "Default action undefined for the function return type.");
- return internal::Invalid<T>();
- // The above statement will never be reached, but is required in
- // order for this function to compile.
- }
-};
-
-// BuiltInDefaultValue<T>::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 <typename T>
-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<T>::value;
- }
-
- static T Get() {
- return BuiltInDefaultValueGetter<
- T, ::std::is_default_constructible<T>::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<T, false>::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 <typename T>
-class BuiltInDefaultValue<const T> {
- public:
- static bool Exists() { return BuiltInDefaultValue<T>::Exists(); }
- static T Get() { return BuiltInDefaultValue<T>::Get(); }
-};
-
-// This partial specialization defines the default values for pointer
-// types.
-template <typename T>
-class BuiltInDefaultValue<T*> {
- 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<type> { \
- 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<T> 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<T>::Set(foo);
-template <typename T>
-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<T>::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<T>::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 <typename T>
-class DefaultValue<T&> {
- 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<T&>::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<T&>::Get() : *address_;
- }
-
- private:
- static T* address_;
-};
-
-// This specialization allows DefaultValue<void>::Get() to
-// compile.
-template <>
-class DefaultValue<void> {
- public:
- static bool Exists() { return true; }
- static void Get() {}
-};
-
-// Points to the user-set default value for type T.
-template <typename T>
-typename DefaultValue<T>::ValueProducer* DefaultValue<T>::producer_ = NULL;
-
-// Points to the user-set default value for type T&.
-template <typename T>
-T* DefaultValue<T&>::address_ = NULL;
-
-// Implement this interface to define an action for function type F.
-template <typename F>
-class ActionInterface {
- public:
- typedef typename internal::Function<F>::Result Result;
- typedef typename internal::Function<F>::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<F> 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<T> is just a
-// linked_ptr to const ActionInterface<T>, so copying is fairly cheap.
-// Don't inherit from Action!
-//
-// You can view an object implementing ActionInterface<F> as a
-// concrete action (including its current state), and an Action<F>
-// object as a handle to it.
-template <typename F>
-class Action {
- public:
- typedef typename internal::Function<F>::Result Result;
- typedef typename internal::Function<F>::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<F>* impl) : impl_(impl) {}
-
- // Copy constructor.
- Action(const Action& action) : impl_(action.impl_) {}
-
- // This constructor allows us to turn an Action<Func> object into an
- // Action<F>, 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 <typename Func>
- explicit Action(const Action<Func>& 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<F> 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 <typename F1, typename F2>
- friend class internal::ActionAdaptor;
-
- internal::linked_ptr<ActionInterface<F> > 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 <typename Result, typename ArgumentTuple>
-// Result Perform(const ArgumentTuple& args) const {
-// // Processes the arguments and returns a result, using
-// // tr1::get<N>(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<N>(value) for
-// complete examples.
-template <typename Impl>
-class PolymorphicAction {
- public:
- explicit PolymorphicAction(const Impl& impl) : impl_(impl) {}
-
- template <typename F>
- operator Action<F>() const {
- return Action<F>(new MonomorphicImpl<F>(impl_));
- }
-
- private:
- template <typename F>
- class MonomorphicImpl : public ActionInterface<F> {
- public:
- typedef typename internal::Function<F>::Result Result;
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
-
- virtual Result Perform(const ArgumentTuple& args) {
- return impl_.template Perform<Result>(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 <typename F>
-Action<F> MakeAction(ActionInterface<F>* impl) {
- return Action<F>(impl);
-}
-
-// Creates a polymorphic action from its implementation. This is
-// easier to use than the PolymorphicAction<Impl> constructor as it
-// doesn't require you to explicitly write the template argument, e.g.
-//
-// MakePolymorphicAction(foo);
-// vs
-// PolymorphicAction<TypeOfFoo>(foo);
-template <typename Impl>
-inline PolymorphicAction<Impl> MakePolymorphicAction(const Impl& impl) {
- return PolymorphicAction<Impl>(impl);
-}
-
-namespace internal {
-
-// Allows an Action<F2> object to pose as an Action<F1>, as long as F2
-// and F1 are compatible.
-template <typename F1, typename F2>
-class ActionAdaptor : public ActionInterface<F1> {
- public:
- typedef typename internal::Function<F1>::Result Result;
- typedef typename internal::Function<F1>::ArgumentTuple ArgumentTuple;
-
- explicit ActionAdaptor(const Action<F2>& from) : impl_(from.impl_) {}
-
- virtual Result Perform(const ArgumentTuple& args) {
- return impl_->Perform(args);
- }
-
- private:
- const internal::linked_ptr<ActionInterface<F2> > 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 <typename T>
-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<F>::Result when this action is cast to Action<F> 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<T(U)> is a
-// good place for that.
-//
-template <typename R>
-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 <typename F>
- operator Action<F>() 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<F>::Result Result;
- GTEST_COMPILE_ASSERT_(
- !is_reference<Result>::value,
- use_ReturnRef_instead_of_Return_to_return_a_reference);
- return Action<F>(new Impl<R, F>(value_));
- }
-
- private:
- // Implements the Return(x) action for a particular function type F.
- template <typename R_, typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
- // The implicit cast is necessary when Result has more than one
- // single-argument constructor (e.g. Result is std::vector<int>) 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<R>& value)
- : value_before_cast_(*value),
- value_(ImplicitCast_<Result>(value_before_cast_)) {}
-
- virtual Result Perform(const ArgumentTuple&) { return value_; }
-
- private:
- GTEST_COMPILE_ASSERT_(!is_reference<Result>::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 <typename R_, typename F>
- class Impl<ByMoveWrapper<R_>, F> : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
- explicit Impl(const linked_ptr<R>& 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<R> wrapper_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- const linked_ptr<R> 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 <typename Result, typename ArgumentTuple>
- static Result Perform(const ArgumentTuple&) {
-#if GTEST_LANG_CXX11
- return nullptr;
-#else
- GTEST_COMPILE_ASSERT_(internal::is_pointer<Result>::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 <typename Result, typename ArgumentTuple>
- static void Perform(const ArgumentTuple&) {
- CompileAssertTypesEqual<void, Result>();
- }
-};
-
-// 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 <typename T>
-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 <typename F>
- operator Action<F>() const {
- typedef typename Function<F>::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<Result>::value,
- use_Return_instead_of_ReturnRef_to_return_a_value);
- return Action<F>(new Impl<F>(ref_));
- }
-
- private:
- // Implements the ReturnRef(x) action for a particular function type F.
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::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 <typename T>
-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 <typename F>
- operator Action<F>() const {
- typedef typename Function<F>::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<Result>::value,
- use_Return_instead_of_ReturnRefOfCopy_to_return_a_value);
- return Action<F>(new Impl<F>(value_));
- }
-
- private:
- // Implements the ReturnRefOfCopy(x) action for a particular function type F.
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::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 <typename F>
- operator Action<F>() const { return Action<F>(NULL); }
-};
-
-// Implements the Assign action to set a given pointer referent to a
-// particular value.
-template <typename T1, typename T2>
-class AssignAction {
- public:
- AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {}
-
- template <typename Result, typename ArgumentTuple>
- 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 <typename T>
-class SetErrnoAndReturnAction {
- public:
- SetErrnoAndReturnAction(int errno_value, T result)
- : errno_(errno_value),
- result_(result) {}
- template <typename Result, typename ArgumentTuple>
- 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<N>(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 <size_t N, typename A, bool kIsProto>
-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 <typename Result, typename ArgumentTuple>
- void Perform(const ArgumentTuple& args) const {
- CompileAssertTypesEqual<void, Result>();
- *::testing::get<N>(args) = value_;
- }
-
- private:
- const A value_;
-
- GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction);
-};
-
-template <size_t N, typename Proto>
-class SetArgumentPointeeAction<N, Proto, true> {
- 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 <typename Result, typename ArgumentTuple>
- void Perform(const ArgumentTuple& args) const {
- CompileAssertTypesEqual<void, Result>();
- ::testing::get<N>(args)->CopyFrom(*proto_);
- }
-
- private:
- const internal::linked_ptr<Proto> 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<F> as long as f's type is compatible with F (i.e. f can be
-// assigned to a tr1::function<F>).
-template <typename FunctionImpl>
-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 <typename Result, typename ArgumentTuple>
- 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 Class, typename MethodPtr>
-class InvokeMethodWithoutArgsAction {
- public:
- InvokeMethodWithoutArgsAction(Class* obj_ptr, MethodPtr method_ptr)
- : obj_ptr_(obj_ptr), method_ptr_(method_ptr) {}
-
- template <typename Result, typename ArgumentTuple>
- 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 <typename A>
-class IgnoreResultAction {
- public:
- explicit IgnoreResultAction(const A& action) : action_(action) {}
-
- template <typename F>
- operator Action<F>() 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<F>::Result Result;
-
- // Asserts at compile time that F returns void.
- CompileAssertTypesEqual<void, Result>();
-
- return Action<F>(new Impl<F>(action_));
- }
-
- private:
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename internal::Function<F>::Result Result;
- typedef typename internal::Function<F>::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<F>::MakeResultIgnoredValue
- OriginalFunction;
-
- const Action<OriginalFunction> action_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- const A action_;
-
- GTEST_DISALLOW_ASSIGN_(IgnoreResultAction);
-};
-
-// A ReferenceWrapper<T> 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<T> can be copied and can survive template type
-// inference. This is used to support by-reference arguments in the
-// InvokeArgument<N>(...) action. The idea was from "reference
-// wrappers" in tr1, which we don't have in our source tree yet.
-template <typename T>
-class ReferenceWrapper {
- public:
- // Constructs a ReferenceWrapper<T> object from a T&.
- explicit ReferenceWrapper(T& l_value) : pointer_(&l_value) {} // NOLINT
-
- // Allows a ReferenceWrapper<T> 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 <typename T>
-void PrintTo(const ReferenceWrapper<T>& ref, ::std::ostream* os) {
- T& value = ref;
- UniversalPrinter<T&>::Print(value, os);
-}
-
-// Does two actions sequentially. Used for implementing the DoAll(a1,
-// a2, ...) action.
-template <typename Action1, typename Action2>
-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 <typename F>
- operator Action<F>() const {
- return Action<F>(new Impl<F>(action1_, action2_));
- }
-
- private:
- // Implements the DoAll(...) action for a particular function type F.
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
- typedef typename Function<F>::MakeResultVoid VoidResult;
-
- Impl(const Action<VoidResult>& action1, const Action<F>& action2)
- : action1_(action1), action2_(action2) {}
-
- virtual Result Perform(const ArgumentTuple& args) {
- action1_.Perform(args);
- return action2_.Perform(args);
- }
-
- private:
- const Action<VoidResult> action1_;
- const Action<F> 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);
-// }
-// ...
-// EXEPCT_CALL(mock, Foo("abc", _, _))
-// .WillOnce(Invoke(DistanceToOriginWithLabel));
-// EXEPCT_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);
-// }
-// ...
-// EXEPCT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin));
-// EXEPCT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin));
-typedef internal::IgnoredValue Unused;
-
-// This constructor allows us to turn an Action<From> object into an
-// Action<To>, 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 <typename To>
-template <typename From>
-Action<To>::Action(const Action<From>& from)
- : impl_(new internal::ActionAdaptor<To, From>(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 <typename R>
-internal::ReturnAction<R> Return(R value) {
- return internal::ReturnAction<R>(internal::move(value));
-}
-
-// Creates an action that returns NULL.
-inline PolymorphicAction<internal::ReturnNullAction> ReturnNull() {
- return MakePolymorphicAction(internal::ReturnNullAction());
-}
-
-// Creates an action that returns from a void function.
-inline PolymorphicAction<internal::ReturnVoidAction> Return() {
- return MakePolymorphicAction(internal::ReturnVoidAction());
-}
-
-// Creates an action that returns the reference to a variable.
-template <typename R>
-inline internal::ReturnRefAction<R> ReturnRef(R& x) { // NOLINT
- return internal::ReturnRefAction<R>(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 <typename R>
-inline internal::ReturnRefOfCopyAction<R> ReturnRefOfCopy(const R& x) {
- return internal::ReturnRefOfCopyAction<R>(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 <typename R>
-internal::ByMoveWrapper<R> ByMove(R x) {
- return internal::ByMoveWrapper<R>(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 <size_t N, typename T>
-PolymorphicAction<
- internal::SetArgumentPointeeAction<
- N, T, internal::IsAProtocolMessage<T>::value> >
-SetArgPointee(const T& x) {
- return MakePolymorphicAction(internal::SetArgumentPointeeAction<
- N, T, internal::IsAProtocolMessage<T>::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 <size_t N>
-PolymorphicAction<
- internal::SetArgumentPointeeAction<N, const char*, false> >
-SetArgPointee(const char* p) {
- return MakePolymorphicAction(internal::SetArgumentPointeeAction<
- N, const char*, false>(p));
-}
-
-template <size_t N>
-PolymorphicAction<
- internal::SetArgumentPointeeAction<N, const wchar_t*, false> >
-SetArgPointee(const wchar_t* p) {
- return MakePolymorphicAction(internal::SetArgumentPointeeAction<
- N, const wchar_t*, false>(p));
-}
-#endif
-
-// The following version is DEPRECATED.
-template <size_t N, typename T>
-PolymorphicAction<
- internal::SetArgumentPointeeAction<
- N, T, internal::IsAProtocolMessage<T>::value> >
-SetArgumentPointee(const T& x) {
- return MakePolymorphicAction(internal::SetArgumentPointeeAction<
- N, T, internal::IsAProtocolMessage<T>::value>(x));
-}
-
-// Creates an action that sets a pointer referent to a given value.
-template <typename T1, typename T2>
-PolymorphicAction<internal::AssignAction<T1, T2> > Assign(T1* ptr, T2 val) {
- return MakePolymorphicAction(internal::AssignAction<T1, T2>(ptr, val));
-}
-
-#if !GTEST_OS_WINDOWS_MOBILE
-
-// Creates an action that sets errno and returns the appropriate error.
-template <typename T>
-PolymorphicAction<internal::SetErrnoAndReturnAction<T> >
-SetErrnoAndReturn(int errval, T result) {
- return MakePolymorphicAction(
- internal::SetErrnoAndReturnAction<T>(errval, result));
-}
-
-#endif // !GTEST_OS_WINDOWS_MOBILE
-
-// Various overloads for InvokeWithoutArgs().
-
-// Creates an action that invokes 'function_impl' with no argument.
-template <typename FunctionImpl>
-PolymorphicAction<internal::InvokeWithoutArgsAction<FunctionImpl> >
-InvokeWithoutArgs(FunctionImpl function_impl) {
- return MakePolymorphicAction(
- internal::InvokeWithoutArgsAction<FunctionImpl>(function_impl));
-}
-
-// Creates an action that invokes the given method on the given object
-// with no argument.
-template <class Class, typename MethodPtr>
-PolymorphicAction<internal::InvokeMethodWithoutArgsAction<Class, MethodPtr> >
-InvokeWithoutArgs(Class* obj_ptr, MethodPtr method_ptr) {
- return MakePolymorphicAction(
- internal::InvokeMethodWithoutArgsAction<Class, MethodPtr>(
- 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 <typename A>
-inline internal::IgnoreResultAction<A> IgnoreResult(const A& an_action) {
- return internal::IgnoreResultAction<A>(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<const Base>(derived)
-template <typename T>
-inline internal::ReferenceWrapper<T> ByRef(T& l_value) { // NOLINT
- return internal::ReferenceWrapper<T>(l_value);
-}
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
diff --git a/src/lib/install/include/gmock/gmock-cardinalities.h b/src/lib/install/include/gmock/gmock-cardinalities.h
deleted file mode 100755
index fc315f9..0000000
--- a/src/lib/install/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 <limits.h>
-#include <ostream> // 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<const CardinalityInterface> 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/src/lib/install/include/gmock/gmock-generated-actions.h b/src/lib/install/include/gmock/gmock-generated-actions.h
deleted file mode 100755
index b5a889c..0000000
--- a/src/lib/install/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<F> 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 <typename Result, typename ArgumentTuple>
-class InvokeHelper;
-
-template <typename R>
-class InvokeHelper<R, ::testing::tuple<> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<>&) {
- return function();
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<>&) {
- return (obj_ptr->*method_ptr)();
- }
-};
-
-template <typename R, typename A1>
-class InvokeHelper<R, ::testing::tuple<A1> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<A1>& args) {
- return function(get<0>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<A1>& args) {
- return (obj_ptr->*method_ptr)(get<0>(args));
- }
-};
-
-template <typename R, typename A1, typename A2>
-class InvokeHelper<R, ::testing::tuple<A1, A2> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<A1, A2>& args) {
- return function(get<0>(args), get<1>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<A1, A2>& args) {
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3>
-class InvokeHelper<R, ::testing::tuple<A1, A2, A3> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<A1, A2, A3>& args) {
- return function(get<0>(args), get<1>(args), get<2>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<A1, A2, A3>& args) {
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
- get<2>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4>
-class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<A1, A2, A3,
- A4>& args) {
- return function(get<0>(args), get<1>(args), get<2>(args),
- get<3>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<A1, A2, A3, A4>& args) {
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
- get<2>(args), get<3>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5>
-class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4,
- A5>& args) {
- return function(get<0>(args), get<1>(args), get<2>(args),
- get<3>(args), get<4>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<A1, A2, A3, A4, A5>& args) {
- return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
- get<2>(args), get<3>(args), get<4>(args));
- }
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6>
-class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
- A6>& args) {
- return function(get<0>(args), get<1>(args), get<2>(args),
- get<3>(args), get<4>(args), get<5>(args));
- }
-
- template <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<A1, A2, A3, A4, A5, A6>& 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 <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7>
-class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
- A6, A7>& 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 <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<A1, A2, A3, A4, A5, A6,
- A7>& 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 <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8>
-class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
- A6, A7, A8>& 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 <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7,
- A8>& 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 <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9>
-class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
- A6, A7, A8, A9>& 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 <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
- A9>& 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 <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9,
- typename A10>
-class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
- A10> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
- A6, A7, A8, A9, A10>& 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 <class Class, typename MethodPtr>
- static R InvokeMethod(Class* obj_ptr,
- MethodPtr method_ptr,
- const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
- A9, A10>& 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<N, Tuple>::type
-
-// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::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<int, ::testing::tuple<bool, char, double, long>, 0, 3>::type
-// is int(bool, long).
-//
-// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
-// returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
-// For example,
-// SelectArgs<int, tuple<bool, char, double>, 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 <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5, int k6, int k7, int k8, int k9, int k10>
-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<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
- get<k8>(args), get<k9>(args), get<k10>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple>
-class SelectArgs<Result, ArgumentTuple,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef Result type();
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& /* args */) {
- return SelectedArgs();
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1>
-class SelectArgs<Result, ArgumentTuple,
- k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs(get<k1>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs(get<k1>(args), get<k2>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> {
- public:
- typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
- GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
- GMOCK_FIELD_(ArgumentTuple, k4));
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> {
- 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<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5, int k6>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> {
- 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<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args), get<k6>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5, int k6, int k7>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> {
- 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<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5, int k6, int k7, int k8>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> {
- 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<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
- get<k8>(args));
- }
-};
-
-template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
- int k4, int k5, int k6, int k7, int k8, int k9>
-class SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> {
- 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<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
- get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
- get<k8>(args), get<k9>(args));
- }
-};
-
-#undef GMOCK_FIELD_
-
-// Implements the WithArgs action.
-template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1,
- int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
- int k9 = -1, int k10 = -1>
-class WithArgsAction {
- public:
- explicit WithArgsAction(const InnerAction& action) : action_(action) {}
-
- template <typename F>
- operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
-
- private:
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
- explicit Impl(const InnerAction& action) : action_(action) {}
-
- virtual Result Perform(const ArgumentTuple& args) {
- return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4,
- k5, k6, k7, k8, k9, k10>::Select(args));
- }
-
- private:
- typedef typename SelectArgs<Result, ArgumentTuple,
- k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType;
-
- Action<InnerFunctionType> 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 <typename Result, class Impl>
-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 <typename A0>
- static Result Perform(Impl* impl, const ::testing::tuple<A0>& args) {
- return impl->template gmock_PerformImpl<A0>(args, get<0>(args),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1>
- static Result Perform(Impl* impl, const ::testing::tuple<A0, A1>& args) {
- return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args),
- get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2>
- static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2>& args) {
- return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args),
- get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3>
- static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2,
- A3>& args) {
- return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args),
- get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3, typename A4>
- static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3,
- A4>& args) {
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args,
- get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
- ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3, typename A4,
- typename A5>
- static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
- A5>& args) {
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args,
- get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
- get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
- ExcessiveArg());
- }
-
- template <typename A0, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6>
- static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
- A5, A6>& args) {
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(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 <typename A0, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7>
- static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
- A5, A6, A7>& args) {
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6,
- A7>(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 <typename A0, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8>
- static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
- A5, A6, A7, A8>& args) {
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7,
- A8>(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 <typename A0, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9>
- static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
- A5, A6, A7, A8, A9>& args) {
- return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8,
- A9>(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<N1, N2, ..., Nk>(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 <int k1, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1>(action);
-}
-
-template <int k1, int k2, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2>(action);
-}
-
-template <int k1, int k2, int k3, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3>(action);
-}
-
-template <int k1, int k2, int k3, int k4, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
- typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6,
- k7>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7,
- k8>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- int k9, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
- k9>(action);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- int k9, int k10, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
- k9, k10>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
- k9, k10>(action);
-}
-
-// Creates an action that does actions a1, a2, ..., sequentially in
-// each invocation.
-template <typename Action1, typename Action2>
-inline internal::DoBothAction<Action1, Action2>
-DoAll(Action1 a1, Action2 a2) {
- return internal::DoBothAction<Action1, Action2>(a1, a2);
-}
-
-template <typename Action1, typename Action2, typename Action3>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- Action3> >
-DoAll(Action1 a1, Action2 a2, Action3 a3) {
- return DoAll(a1, DoAll(a2, a3));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, Action4> > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) {
- return DoAll(a1, DoAll(a2, a3, a4));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- Action5> > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) {
- return DoAll(a1, DoAll(a2, a3, a4, a5));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5, typename Action6>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- internal::DoBothAction<Action5, Action6> > > > >
-DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) {
- return DoAll(a1, DoAll(a2, a3, a4, a5, a6));
-}
-
-template <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5, typename Action6, typename Action7>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- internal::DoBothAction<Action5, internal::DoBothAction<Action6,
- Action7> > > > > >
-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 <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5, typename Action6, typename Action7,
- typename Action8>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- internal::DoBothAction<Action5, internal::DoBothAction<Action6,
- internal::DoBothAction<Action7, Action8> > > > > > >
-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 <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5, typename Action6, typename Action7,
- typename Action8, typename Action9>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- internal::DoBothAction<Action5, internal::DoBothAction<Action6,
- internal::DoBothAction<Action7, internal::DoBothAction<Action8,
- Action9> > > > > > > >
-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 <typename Action1, typename Action2, typename Action3,
- typename Action4, typename Action5, typename Action6, typename Action7,
- typename Action8, typename Action9, typename Action10>
-inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
- internal::DoBothAction<Action3, internal::DoBothAction<Action4,
- internal::DoBothAction<Action5, internal::DoBothAction<Action6,
- internal::DoBothAction<Action7, internal::DoBothAction<Action8,
- internal::DoBothAction<Action9, Action10> > > > > > > > >
-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 <typename p1_type, ..., typename pk_type>
-// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
-//
-// In particular, you can provide the template type arguments
-// explicitly when invoking Foo(), as in Foo<long, bool>(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<p1_type, ...,
-// pk_type>. 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<k, T>(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<k>(args));
-// }
-// ...
-// int n;
-// EXPECT_CALL(mock, Foo(_, _))
-// .WillOnce(DuplicateArg<1, unsigned char>(&n));
-//
-// To create an instance of an action template, write:
-//
-// ActionName<t1, ..., t_m>(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<t1, ..., t_m, u1, ..., u_k>(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<int, bool>(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 <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- class GMOCK_ACTION_CLASS_(name, value_params) {\
- public:\
- explicit GMOCK_ACTION_CLASS_(name, value_params)\
- GMOCK_INTERNAL_INIT_##value_params {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(\
- new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
- }\
- GMOCK_INTERNAL_DEFN_##value_params\
- private:\
- GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
- };\
- template <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- 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 <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- GMOCK_ACTION_CLASS_(name, value_params)<\
- GMOCK_INTERNAL_LIST_##template_params\
- GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
- gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION(name)\
- class name##Action {\
- public:\
- name##Action() {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- gmock_Impl() {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>());\
- }\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##Action);\
- };\
- inline name##Action name() {\
- return name##Action();\
- }\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##Action::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P(name, p0)\
- template <typename p0##_type>\
- class name##ActionP {\
- public:\
- explicit name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0));\
- }\
- p0##_type p0;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP);\
- };\
- template <typename p0##_type>\
- inline name##ActionP<p0##_type> name(p0##_type p0) {\
- return name##ActionP<p0##_type>(p0);\
- }\
- template <typename p0##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P2(name, p0, p1)\
- template <typename p0##_type, typename p1##_type>\
- class name##ActionP2 {\
- public:\
- name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
- p1(gmock_p1) {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP2);\
- };\
- template <typename p0##_type, typename p1##_type>\
- inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
- p1##_type p1) {\
- return name##ActionP2<p0##_type, p1##_type>(p0, p1);\
- }\
- template <typename p0##_type, typename p1##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P3(name, p0, p1, p2)\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- 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 <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP3);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
- p1##_type p1, p2##_type p2) {\
- return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP3<p0##_type, p1##_type, \
- p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P4(name, p0, p1, p2, p3)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- 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 <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
- }\
- p0##_type p0;\
- p1##_type p1;\
- p2##_type p2;\
- p3##_type p3;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##ActionP4);\
- };\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- inline name##ActionP4<p0##_type, p1##_type, p2##_type, \
- p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
- p3##_type p3) {\
- return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \
- p2, p3);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP4<p0##_type, p1##_type, p2##_type, \
- p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P5(name, p0, p1, p2, p3, p4)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- 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 <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
- p4##_type p4) {\
- return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type>(p0, p1, p2, p3, p4);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- 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 <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
- p3##_type p3, p4##_type p4, p5##_type p5) {\
- return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- 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 <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type> 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- 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 <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type> 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
- p6, p7);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, \
- p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\
- GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
-
-#define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\
- template <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>\
- 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 <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(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 <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>\
- inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, \
- p8##_type> 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
- p3, p4, p5, p6, p7, p8);\
- }\
- template <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>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, p7##_type, \
- p8##_type>::gmock_Impl<F>::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 <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>\
- 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 <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- Perform(this, args);\
- }\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>(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 <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>\
- inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
- p9##_type> 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
- p1, p2, p3, p4, p5, p6, p7, p8, p9);\
- }\
- template <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>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, p7##_type, p8##_type, \
- p9##_type>::gmock_Impl<F>::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<N>().
-//
-// The InvokeArgument<N>(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 <typename R, typename F>
-R InvokeArgumentAdl(AdlTag, F f) {
- return f();
-}
-template <typename R, typename F, typename A1>
-R InvokeArgumentAdl(AdlTag, F f, A1 a1) {
- return f(a1);
-}
-template <typename R, typename F, typename A1, typename A2>
-R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2) {
- return f(a1, a2);
-}
-template <typename R, typename F, typename A1, typename A2, typename A3>
-R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3) {
- return f(a1, a2, a3);
-}
-template <typename R, typename F, typename A1, typename A2, typename A3,
- typename A4>
-R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4) {
- return f(a1, a2, a3, a4);
-}
-template <typename R, typename F, typename A1, typename A2, typename A3,
- typename A4, typename A5>
-R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
- return f(a1, a2, a3, a4, a5);
-}
-template <typename R, typename F, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6>
-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 <typename R, typename F, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7>
-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 <typename R, typename F, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7, typename A8>
-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 <typename R, typename F, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7, typename A8,
- typename A9>
-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 <typename R, typename F, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7, typename A8,
- typename A9, typename A10>
-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<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(args));
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_1_VALUE_PARAMS(p0)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(args), p0);
-}
-
-ACTION_TEMPLATE(InvokeArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_2_VALUE_PARAMS(p0, p1)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(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<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(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<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(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<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(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<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(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<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(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<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(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<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(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<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
-}
-
-// Various overloads for ReturnNew<T>().
-//
-// The ReturnNew<T>(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/src/lib/install/include/gmock/gmock-generated-actions.h.pump b/src/lib/install/include/gmock/gmock-generated-actions.h.pump
deleted file mode 100755
index 66d9f9d..0000000
--- a/src/lib/install/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<F> 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 <typename Result, typename ArgumentTuple>
-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 <typename R$types>
-class InvokeHelper<R, ::testing::tuple<$as> > {
- public:
- template <typename Function>
- static R Invoke(Function function, const ::testing::tuple<$as>&$args) {
- return function($gets);
- }
-
- template <class Class, typename MethodPtr>
- 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<N, Tuple>::type
-
-$range i 1..n
-
-// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::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<int, ::testing::tuple<bool, char, double, long>, 0, 3>::type
-// is int(bool, long).
-//
-// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
-// returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
-// For example,
-// SelectArgs<int, tuple<bool, char, double>, 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 <typename Result, typename ArgumentTuple, $for i, [[int k$i]]>
-class SelectArgs {
- public:
- typedef Result type($for i, [[GMOCK_FIELD_(ArgumentTuple, k$i)]]);
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& args) {
- return SelectedArgs($for i, [[get<k$i>(args)]]);
- }
-};
-
-
-$for i [[
-$range j 1..n
-$range j1 1..i-1
-template <typename Result, typename ArgumentTuple$for j1[[, int k$j1]]>
-class SelectArgs<Result, ArgumentTuple,
- $for j, [[$if j <= i-1 [[k$j]] $else [[-1]]]]> {
- public:
- typedef Result type($for j1, [[GMOCK_FIELD_(ArgumentTuple, k$j1)]]);
- typedef typename Function<type>::ArgumentTuple SelectedArgs;
- static SelectedArgs Select(const ArgumentTuple& [[]]
-$if i == 1 [[/* args */]] $else [[args]]) {
- return SelectedArgs($for j1, [[get<k$j1>(args)]]);
- }
-};
-
-
-]]
-#undef GMOCK_FIELD_
-
-$var ks = [[$for i, [[k$i]]]]
-
-// Implements the WithArgs action.
-template <typename InnerAction, $for i, [[int k$i = -1]]>
-class WithArgsAction {
- public:
- explicit WithArgsAction(const InnerAction& action) : action_(action) {}
-
- template <typename F>
- operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
-
- private:
- template <typename F>
- class Impl : public ActionInterface<F> {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
-
- explicit Impl(const InnerAction& action) : action_(action) {}
-
- virtual Result Perform(const ArgumentTuple& args) {
- return action_.Perform(SelectArgs<Result, ArgumentTuple, $ks>::Select(args));
- }
-
- private:
- typedef typename SelectArgs<Result, ArgumentTuple,
- $ks>::type InnerFunctionType;
-
- Action<InnerFunctionType> 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 <typename Result, class Impl>
-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<N1, N2, ..., Nk>(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<InnerAction$for j [[, k$j]]>
-WithArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction$for j [[, k$j]]>(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 <typename Action1, $types>
-$range k 1..i-1
-
-inline $for k [[internal::DoBothAction<Action$k, ]]Action$i$for k [[>]]
-
-DoAll(Action1 a1$Aas) {
-$if i==2 [[
-
- return internal::DoBothAction<Action1, Action2>(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 <typename p1_type, ..., typename pk_type>
-// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
-//
-// In particular, you can provide the template type arguments
-// explicitly when invoking Foo(), as in Foo<long, bool>(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<p1_type, ...,
-// pk_type>. 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<k, T>(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<k>(args));
-// }
-// ...
-// int n;
-// EXPECT_CALL(mock, Foo(_, _))
-// .WillOnce(DuplicateArg<1, unsigned char>(&n));
-//
-// To create an instance of an action template, write:
-//
-// ActionName<t1, ..., t_m>(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<t1, ..., t_m, u1, ..., u_k>(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<int, bool>(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 <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- class GMOCK_ACTION_CLASS_(name, value_params) {\
- public:\
- explicit GMOCK_ACTION_CLASS_(name, value_params)\
- GMOCK_INTERNAL_INIT_##value_params {}\
- template <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::ArgumentTuple\
- args_type;\
- explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
- virtual return_type Perform(const args_type& args) {\
- return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(\
- new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
- }\
- GMOCK_INTERNAL_DEFN_##value_params\
- private:\
- GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
- };\
- template <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- 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 <GMOCK_INTERNAL_DECL_##template_params\
- GMOCK_INTERNAL_DECL_TYPE_##value_params>\
- template <typename F>\
- template <typename arg0_type, typename arg1_type, typename arg2_type, \
- typename arg3_type, typename arg4_type, typename arg5_type, \
- typename arg6_type, typename arg7_type, typename arg8_type, \
- typename arg9_type>\
- typename ::testing::internal::Function<F>::Result\
- GMOCK_ACTION_CLASS_(name, value_params)<\
- GMOCK_INTERNAL_LIST_##template_params\
- GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
- 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 <typename F>\
- class gmock_Impl : public ::testing::ActionInterface<F> {\
- public:\
- typedef F function_type;\
- typedef typename ::testing::internal::Function<F>::Result return_type;\
- typedef typename ::testing::internal::Function<F>::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<return_type, gmock_Impl>::\
- 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 <typename F> operator ::testing::Action<F>() const {\
- return ::testing::Action<F>(new gmock_Impl<F>($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 <typename F>\
- template <$typename_arg_types>\
- typename ::testing::internal::Function<F>::Result\
- $class_name$param_types::gmock_Impl<F>::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<N>().
-//
-// The InvokeArgument<N>(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 <typename R, typename F[[$for j [[, typename A$j]]]]>
-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<return_type>(
- internal::invoke_argument::AdlTag(),
- ::testing::get<k>(args)$for j [[, p$j]]);
-}
-
-]]
-
-// Various overloads for ReturnNew<T>().
-//
-// The ReturnNew<T>(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/src/lib/install/include/gmock/gmock-generated-function-mockers.h b/src/lib/install/include/gmock/gmock-generated-function-mockers.h
deleted file mode 100755
index 4fa5ca9..0000000
--- a/src/lib/install/include/gmock/gmock-generated-function-mockers.h
+++ /dev/null
@@ -1,1095 +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 <functional>
-#endif
-
-namespace testing {
-namespace internal {
-
-template <typename F>
-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 <typename F>
-class FunctionMocker;
-
-template <typename R>
-class FunctionMocker<R()> : public
- internal::FunctionMockerBase<R()> {
- public:
- typedef R F();
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& 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 <typename R, typename A1>
-class FunctionMocker<R(A1)> : public
- internal::FunctionMockerBase<R(A1)> {
- public:
- typedef R F(A1);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& 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 <typename R, typename A1, typename A2>
-class FunctionMocker<R(A1, A2)> : public
- internal::FunctionMockerBase<R(A1, A2)> {
- public:
- typedef R F(A1, A2);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& 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 <typename R, typename A1, typename A2, typename A3>
-class FunctionMocker<R(A1, A2, A3)> : public
- internal::FunctionMockerBase<R(A1, A2, A3)> {
- public:
- typedef R F(A1, A2, A3);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& 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 <typename R, typename A1, typename A2, typename A3, typename A4>
-class FunctionMocker<R(A1, A2, A3, A4)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4)> {
- public:
- typedef R F(A1, A2, A3, A4);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& 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 <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5>
-class FunctionMocker<R(A1, A2, A3, A4, A5)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5)> {
- public:
- typedef R F(A1, A2, A3, A4, A5);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& 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 <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> {
- public:
- typedef R F(A1, A2, A3, A4, A5, A6);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
- const Matcher<A6>& 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 <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7)> {
- public:
- typedef R F(A1, A2, A3, A4, A5, A6, A7);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
- const Matcher<A6>& m6, const Matcher<A7>& 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 <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
- public:
- typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
- const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& 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 <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
- public:
- typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
- const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
- const Matcher<A9>& 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 <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9,
- typename A10>
-class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
- internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> {
- public:
- typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
- const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
- const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
- const Matcher<A9>& m9, const Matcher<A10>& 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));
- }
-};
-
-} // 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<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
-
-// The variable for mocking the given method.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_MOCKER_(arity, constness, Method) \
- GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- ) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 0), \
- this_method_does_not_take_0_arguments); \
- GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method() constness { \
- GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(0, constness, Method).With(); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 1), \
- this_method_does_not_take_1_argument); \
- GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
- GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD2_(tn, constness, 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) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 2), \
- this_method_does_not_take_2_arguments); \
- GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(2, constness, 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) constness { \
- GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD3_(tn, constness, 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) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 3), \
- this_method_does_not_take_3_arguments); \
- GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(3, constness, 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) constness { \
- GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD4_(tn, constness, 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) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 4), \
- this_method_does_not_take_4_arguments); \
- GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(4, constness, 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) constness { \
- GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD5_(tn, constness, 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) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 5), \
- this_method_does_not_take_5_arguments); \
- GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(5, constness, 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) constness { \
- GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD6_(tn, constness, 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) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 6), \
- this_method_does_not_take_6_arguments); \
- GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(6, constness, 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) constness { \
- GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD7_(tn, constness, 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) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 7), \
- this_method_does_not_take_7_arguments); \
- GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(7, constness, 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) constness { \
- GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \
- gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD8_(tn, constness, 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) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 8), \
- this_method_does_not_take_8_arguments); \
- GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(8, constness, 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) constness { \
- GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(8, constness, 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, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD9_(tn, constness, 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) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 9), \
- this_method_does_not_take_9_arguments); \
- GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(9, constness, 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) constness { \
- GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(9, constness, 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, constness, \
- Method)
-
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_METHOD10_(tn, constness, 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) constness { \
- GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
- tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
- == 10), \
- this_method_does_not_take_10_arguments); \
- GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_(10, constness, 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) constness { \
- GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_(10, constness, 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, constness, \
- 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__)
-
-// A MockFunction<F> 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<void(string check_point_name)> 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<F> can also be used to exercise code that accepts
-// std::function<F> callbacks. To do so, use AsStdFunction() method
-// to create std::function proxy forwarding to original object's Call.
-// Example:
-//
-// TEST(FooTest, RunsCallbackWithBarArgument) {
-// MockFunction<int(string)> callback;
-// EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
-// Foo(callback.AsStdFunction());
-// }
-template <typename F>
-class MockFunction;
-
-template <typename R>
-class MockFunction<R()> {
- public:
- MockFunction() {}
-
- MOCK_METHOD0_T(Call, R());
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R()> AsStdFunction() {
- return [this]() -> R {
- return this->Call();
- };
- }
-#endif // GTEST_HAS_STD_FUNCTION_
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0>
-class MockFunction<R(A0)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD1_T(Call, R(A0));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R(A0)> AsStdFunction() {
- return [this](A0 a0) -> R {
- return this->Call(a0);
- };
- }
-#endif // GTEST_HAS_STD_FUNCTION_
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
-};
-
-template <typename R, typename A0, typename A1>
-class MockFunction<R(A0, A1)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD2_T(Call, R(A0, A1));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R(A0, A1)> 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 <typename R, typename A0, typename A1, typename A2>
-class MockFunction<R(A0, A1, A2)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD3_T(Call, R(A0, A1, A2));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R(A0, A1, A2)> 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 <typename R, typename A0, typename A1, typename A2, typename A3>
-class MockFunction<R(A0, A1, A2, A3)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R(A0, A1, A2, A3)> 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 <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4>
-class MockFunction<R(A0, A1, A2, A3, A4)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R(A0, A1, A2, A3, A4)> 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 <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4, typename A5>
-class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R(A0, A1, A2, A3, A4, A5)> 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 <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R(A0, A1, A2, A3, A4, A5, A6)> 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 <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R(A0, A1, A2, A3, A4, A5, A6, A7)> 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 <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7, typename A8>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> 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 <typename R, typename A0, typename A1, typename A2, typename A3,
- typename A4, typename A5, typename A6, typename A7, typename A8,
- typename A9>
-class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> 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/src/lib/install/include/gmock/gmock-generated-function-mockers.h.pump b/src/lib/install/include/gmock/gmock-generated-function-mockers.h.pump
deleted file mode 100755
index 811502d..0000000
--- a/src/lib/install/include/gmock/gmock-generated-function-mockers.h.pump
+++ /dev/null
@@ -1,291 +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 <functional>
-#endif
-
-namespace testing {
-namespace internal {
-
-template <typename F>
-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 <typename F>
-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<A$j>& m$j]]]]
-template <typename R$typename_As>
-class FunctionMocker<R($As)> : public
- internal::FunctionMockerBase<R($As)> {
- public:
- typedef R F($As);
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
-
- MockSpec<F>& 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));
- }
-};
-
-
-]]
-} // 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<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
-
-// The variable for mocking the given method.
-// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
-#define GMOCK_MOCKER_(arity, constness, Method) \
- GTEST_CONCAT_TOKEN_(gmock##constness##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, constness, ct, Method, ...) \
- GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
- $arg_as) constness { \
- 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]]]]); \
- GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \
- return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \
- } \
- ::testing::MockSpec<__VA_ARGS__>& \
- gmock_##Method($matcher_as) constness { \
- GMOCK_MOCKER_($i, constness, Method).RegisterOwner(this); \
- return GMOCK_MOCKER_($i, constness, Method).With($as); \
- } \
- mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, constness, 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__)
-
-]]
-
-// A MockFunction<F> 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<void(string check_point_name)> 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<F> can also be used to exercise code that accepts
-// std::function<F> callbacks. To do so, use AsStdFunction() method
-// to create std::function proxy forwarding to original object's Call.
-// Example:
-//
-// TEST(FooTest, RunsCallbackWithBarArgument) {
-// MockFunction<int(string)> callback;
-// EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
-// Foo(callback.AsStdFunction());
-// }
-template <typename F>
-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 <typename R$for j [[, typename A$j]]>
-class MockFunction<R($ArgTypes)> {
- public:
- MockFunction() {}
-
- MOCK_METHOD$i[[]]_T(Call, R($ArgTypes));
-
-#if GTEST_HAS_STD_FUNCTION_
- std::function<R($ArgTypes)> 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/src/lib/install/include/gmock/gmock-generated-matchers.h b/src/lib/install/include/gmock/gmock-generated-matchers.h
deleted file mode 100755
index 57056fd..0000000
--- a/src/lib/install/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 <iterator>
-#include <sstream>
-#include <string>
-#include <vector>
-#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<i, Tuple>::type
-
-// TupleFields<Tuple, k0, ..., kn> 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<tuple<bool, char, int>, 2, 0>, we have:
-//
-// type is tuple<int, bool>, and
-// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true).
-
-template <class Tuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
- int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
- int k9 = -1>
-class TupleFields;
-
-// This generic version is used when there are 10 selectors.
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
- int k7, int k8, int k9>
-class TupleFields {
- public:
- typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
- GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
- GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8),
- GMOCK_FIELD_TYPE_(Tuple, k9)> type;
- static type GetSelectedFields(const Tuple& t) {
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
- get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t), get<k9>(t));
- }
-};
-
-// The following specialization is used for 0 ~ 9 selectors.
-
-template <class Tuple>
-class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef ::testing::tuple<> type;
- static type GetSelectedFields(const Tuple& /* t */) {
- return type();
- }
-};
-
-template <class Tuple, int k0>
-class TupleFields<Tuple, k0, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0)> type;
- static type GetSelectedFields(const Tuple& t) {
- return type(get<k0>(t));
- }
-};
-
-template <class Tuple, int k0, int k1>
-class TupleFields<Tuple, k0, k1, -1, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1)> type;
- static type GetSelectedFields(const Tuple& t) {
- return type(get<k0>(t), get<k1>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2>
-class TupleFields<Tuple, k0, k1, k2, -1, -1, -1, -1, -1, -1, -1> {
- public:
- typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2)> type;
- static type GetSelectedFields(const Tuple& t) {
- return type(get<k0>(t), get<k1>(t), get<k2>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3>
-class TupleFields<Tuple, k0, k1, k2, k3, -1, -1, -1, -1, -1, -1> {
- public:
- typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3)> type;
- static type GetSelectedFields(const Tuple& t) {
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, -1, -1, -1, -1, -1> {
- public:
- typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4)> type;
- static type GetSelectedFields(const Tuple& t) {
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, -1, -1, -1, -1> {
- public:
- typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
- GMOCK_FIELD_TYPE_(Tuple, k5)> type;
- static type GetSelectedFields(const Tuple& t) {
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
- get<k5>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, -1, -1, -1> {
- public:
- typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
- GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6)> type;
- static type GetSelectedFields(const Tuple& t) {
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
- get<k5>(t), get<k6>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
- int k7>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, -1, -1> {
- public:
- typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
- GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
- GMOCK_FIELD_TYPE_(Tuple, k7)> type;
- static type GetSelectedFields(const Tuple& t) {
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
- get<k5>(t), get<k6>(t), get<k7>(t));
- }
-};
-
-template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6,
- int k7, int k8>
-class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, -1> {
- public:
- typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0),
- GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2),
- GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4),
- GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6),
- GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8)> type;
- static type GetSelectedFields(const Tuple& t) {
- return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t),
- get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t));
- }
-};
-
-#undef GMOCK_FIELD_TYPE_
-
-// Implements the Args() matcher.
-template <class ArgsTuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1,
- int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
- int k9 = -1>
-class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
- public:
- // ArgsTuple may have top-level const or reference modifiers.
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple;
- typedef typename internal::TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5,
- k6, k7, k8, k9>::type SelectedArgs;
- typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher;
-
- template <typename InnerMatcher>
- explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher)
- : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(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<RawArgsTuple, k0, k1, k2, k3, k4, k5, k6, k7, k8,
- k9>::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 InnerMatcher, int k0 = -1, int k1 = -1, int k2 = -1,
- int k3 = -1, int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1,
- int k8 = -1, int k9 = -1>
-class ArgsMatcher {
- public:
- explicit ArgsMatcher(const InnerMatcher& inner_matcher)
- : inner_matcher_(inner_matcher) {}
-
- template <typename ArgsTuple>
- operator Matcher<ArgsTuple>() const {
- return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k0, k1, k2, k3, k4, k5,
- k6, k7, k8, k9>(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<decltype(m1), ..., decltype(mN)>::type.
-
-// Although AllOf isn't defined for one argument, AllOfResult1 is defined
-// to simplify the implementation.
-template <typename M1>
-struct AllOfResult1 {
- typedef M1 type;
-};
-
-template <typename M1, typename M2>
-struct AllOfResult2 {
- typedef BothOfMatcher<
- typename AllOfResult1<M1>::type,
- typename AllOfResult1<M2>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3>
-struct AllOfResult3 {
- typedef BothOfMatcher<
- typename AllOfResult1<M1>::type,
- typename AllOfResult2<M2, M3>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4>
-struct AllOfResult4 {
- typedef BothOfMatcher<
- typename AllOfResult2<M1, M2>::type,
- typename AllOfResult2<M3, M4>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5>
-struct AllOfResult5 {
- typedef BothOfMatcher<
- typename AllOfResult2<M1, M2>::type,
- typename AllOfResult3<M3, M4, M5>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6>
-struct AllOfResult6 {
- typedef BothOfMatcher<
- typename AllOfResult3<M1, M2, M3>::type,
- typename AllOfResult3<M4, M5, M6>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7>
-struct AllOfResult7 {
- typedef BothOfMatcher<
- typename AllOfResult3<M1, M2, M3>::type,
- typename AllOfResult4<M4, M5, M6, M7>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8>
-struct AllOfResult8 {
- typedef BothOfMatcher<
- typename AllOfResult4<M1, M2, M3, M4>::type,
- typename AllOfResult4<M5, M6, M7, M8>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9>
-struct AllOfResult9 {
- typedef BothOfMatcher<
- typename AllOfResult4<M1, M2, M3, M4>::type,
- typename AllOfResult5<M5, M6, M7, M8, M9>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9, typename M10>
-struct AllOfResult10 {
- typedef BothOfMatcher<
- typename AllOfResult5<M1, M2, M3, M4, M5>::type,
- typename AllOfResult5<M6, M7, M8, M9, M10>::type
- > type;
-};
-
-// A set of metafunctions for computing the result type of AnyOf.
-// AnyOf(m1, ..., mN) returns
-// AnyOfResultN<decltype(m1), ..., decltype(mN)>::type.
-
-// Although AnyOf isn't defined for one argument, AnyOfResult1 is defined
-// to simplify the implementation.
-template <typename M1>
-struct AnyOfResult1 {
- typedef M1 type;
-};
-
-template <typename M1, typename M2>
-struct AnyOfResult2 {
- typedef EitherOfMatcher<
- typename AnyOfResult1<M1>::type,
- typename AnyOfResult1<M2>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3>
-struct AnyOfResult3 {
- typedef EitherOfMatcher<
- typename AnyOfResult1<M1>::type,
- typename AnyOfResult2<M2, M3>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4>
-struct AnyOfResult4 {
- typedef EitherOfMatcher<
- typename AnyOfResult2<M1, M2>::type,
- typename AnyOfResult2<M3, M4>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5>
-struct AnyOfResult5 {
- typedef EitherOfMatcher<
- typename AnyOfResult2<M1, M2>::type,
- typename AnyOfResult3<M3, M4, M5>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6>
-struct AnyOfResult6 {
- typedef EitherOfMatcher<
- typename AnyOfResult3<M1, M2, M3>::type,
- typename AnyOfResult3<M4, M5, M6>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7>
-struct AnyOfResult7 {
- typedef EitherOfMatcher<
- typename AnyOfResult3<M1, M2, M3>::type,
- typename AnyOfResult4<M4, M5, M6, M7>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8>
-struct AnyOfResult8 {
- typedef EitherOfMatcher<
- typename AnyOfResult4<M1, M2, M3, M4>::type,
- typename AnyOfResult4<M5, M6, M7, M8>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9>
-struct AnyOfResult9 {
- typedef EitherOfMatcher<
- typename AnyOfResult4<M1, M2, M3, M4>::type,
- typename AnyOfResult5<M5, M6, M7, M8, M9>::type
- > type;
-};
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9, typename M10>
-struct AnyOfResult10 {
- typedef EitherOfMatcher<
- typename AnyOfResult5<M1, M2, M3, M4, M5>::type,
- typename AnyOfResult5<M6, M7, M8, M9, M10>::type
- > type;
-};
-
-} // namespace internal
-
-// Args<N1, N2, ..., Nk>(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 <typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher>(matcher);
-}
-
-template <int k1, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1>(matcher);
-}
-
-template <int k1, int k2, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2>(matcher);
-}
-
-template <int k1, int k2, int k3, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
- typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6,
- k7>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7,
- k8>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- int k9, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8,
- k9>(matcher);
-}
-
-template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
- int k9, int k10, typename InnerMatcher>
-inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9,
- k10>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8,
- k9, k10>(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>(Args());
-}
-
-template <typename T1>
-inline internal::ElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type> >
-ElementsAre(const T1& e1) {
- typedef ::testing::tuple<
- typename internal::DecayArray<T1>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1));
-}
-
-template <typename T1, typename T2>
-inline internal::ElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type> >
-ElementsAre(const T1& e1, const T2& e2) {
- typedef ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2));
-}
-
-template <typename T1, typename T2, typename T3>
-inline internal::ElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3) {
- typedef ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3));
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-inline internal::ElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) {
- typedef ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-inline internal::ElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type> >
-ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5) {
- typedef ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-inline internal::ElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::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<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-inline internal::ElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::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<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-inline internal::ElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::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<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7,
- e8));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-inline internal::ElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::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<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type> Args;
- return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7,
- e8, e9));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-inline internal::ElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type,
- typename internal::DecayArray<T10>::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<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type,
- typename internal::DecayArray<T10>::type> Args;
- return internal::ElementsAreMatcher<Args>(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>(Args());
-}
-
-template <typename T1>
-inline internal::UnorderedElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type> >
-UnorderedElementsAre(const T1& e1) {
- typedef ::testing::tuple<
- typename internal::DecayArray<T1>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1));
-}
-
-template <typename T1, typename T2>
-inline internal::UnorderedElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2) {
- typedef ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2));
-}
-
-template <typename T1, typename T2, typename T3>
-inline internal::UnorderedElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3) {
- typedef ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3));
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-inline internal::UnorderedElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) {
- typedef ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-inline internal::UnorderedElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type> >
-UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
- const T5& e5) {
- typedef ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-inline internal::UnorderedElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::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<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
- e6));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-inline internal::UnorderedElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::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<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
- e6, e7));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-inline internal::UnorderedElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::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<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
- e6, e7, e8));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-inline internal::UnorderedElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::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<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5,
- e6, e7, e8, e9));
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-inline internal::UnorderedElementsAreMatcher<
- ::testing::tuple<
- typename internal::DecayArray<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type,
- typename internal::DecayArray<T10>::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<T1>::type,
- typename internal::DecayArray<T2>::type,
- typename internal::DecayArray<T3>::type,
- typename internal::DecayArray<T4>::type,
- typename internal::DecayArray<T5>::type,
- typename internal::DecayArray<T6>::type,
- typename internal::DecayArray<T7>::type,
- typename internal::DecayArray<T8>::type,
- typename internal::DecayArray<T9>::type,
- typename internal::DecayArray<T10>::type> Args;
- return internal::UnorderedElementsAreMatcher<Args>(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 <typename M1, typename M2>
-inline typename internal::AllOfResult2<M1, M2>::type
-AllOf(M1 m1, M2 m2) {
- return typename internal::AllOfResult2<M1, M2>::type(
- m1,
- m2);
-}
-
-template <typename M1, typename M2, typename M3>
-inline typename internal::AllOfResult3<M1, M2, M3>::type
-AllOf(M1 m1, M2 m2, M3 m3) {
- return typename internal::AllOfResult3<M1, M2, M3>::type(
- m1,
- ::testing::AllOf(m2, m3));
-}
-
-template <typename M1, typename M2, typename M3, typename M4>
-inline typename internal::AllOfResult4<M1, M2, M3, M4>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4) {
- return typename internal::AllOfResult4<M1, M2, M3, M4>::type(
- ::testing::AllOf(m1, m2),
- ::testing::AllOf(m3, m4));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5>
-inline typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) {
- return typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type(
- ::testing::AllOf(m1, m2),
- ::testing::AllOf(m3, m4, m5));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6>
-inline typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) {
- return typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type(
- ::testing::AllOf(m1, m2, m3),
- ::testing::AllOf(m4, m5, m6));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7>
-inline typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) {
- return typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type(
- ::testing::AllOf(m1, m2, m3),
- ::testing::AllOf(m4, m5, m6, m7));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8>
-inline typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) {
- return typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type(
- ::testing::AllOf(m1, m2, m3, m4),
- ::testing::AllOf(m5, m6, m7, m8));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9>
-inline typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>::type
-AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) {
- return typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8,
- M9>::type(
- ::testing::AllOf(m1, m2, m3, m4),
- ::testing::AllOf(m5, m6, m7, m8, m9));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9, typename M10>
-inline typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
- M10>::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<M1, M2, M3, M4, M5, M6, M7, M8, M9,
- M10>::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 <typename M1, typename M2>
-inline typename internal::AnyOfResult2<M1, M2>::type
-AnyOf(M1 m1, M2 m2) {
- return typename internal::AnyOfResult2<M1, M2>::type(
- m1,
- m2);
-}
-
-template <typename M1, typename M2, typename M3>
-inline typename internal::AnyOfResult3<M1, M2, M3>::type
-AnyOf(M1 m1, M2 m2, M3 m3) {
- return typename internal::AnyOfResult3<M1, M2, M3>::type(
- m1,
- ::testing::AnyOf(m2, m3));
-}
-
-template <typename M1, typename M2, typename M3, typename M4>
-inline typename internal::AnyOfResult4<M1, M2, M3, M4>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4) {
- return typename internal::AnyOfResult4<M1, M2, M3, M4>::type(
- ::testing::AnyOf(m1, m2),
- ::testing::AnyOf(m3, m4));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5>
-inline typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) {
- return typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type(
- ::testing::AnyOf(m1, m2),
- ::testing::AnyOf(m3, m4, m5));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6>
-inline typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) {
- return typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type(
- ::testing::AnyOf(m1, m2, m3),
- ::testing::AnyOf(m4, m5, m6));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7>
-inline typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) {
- return typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type(
- ::testing::AnyOf(m1, m2, m3),
- ::testing::AnyOf(m4, m5, m6, m7));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8>
-inline typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) {
- return typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type(
- ::testing::AnyOf(m1, m2, m3, m4),
- ::testing::AnyOf(m5, m6, m7, m8));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9>
-inline typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>::type
-AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) {
- return typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8,
- M9>::type(
- ::testing::AnyOf(m1, m2, m3, m4),
- ::testing::AnyOf(m5, m6, m7, m8, m9));
-}
-
-template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9, typename M10>
-inline typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9,
- M10>::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<M1, M2, M3, M4, M5, M6, M7, M8, M9,
- M10>::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 <typename p1_type, ..., typename pk_type>
-// FooMatcherPk<p1_type, ..., pk_type>
-// 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<long, bool>(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<p1_type, ..., pk_type>. 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 <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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 <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>());\
- }\
- name##Matcher() {\
- }\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##Matcher);\
- };\
- inline name##Matcher name() {\
- return name##Matcher();\
- }\
- template <typename arg_type>\
- bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P(name, p0, description)\
- template <typename p0##_type>\
- class name##MatcherP {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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##_type>(p0)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(p0));\
- }\
- explicit name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\
- }\
- p0##_type p0;\
- private:\
- GTEST_DISALLOW_ASSIGN_(name##MatcherP);\
- };\
- template <typename p0##_type>\
- inline name##MatcherP<p0##_type> name(p0##_type p0) {\
- return name##MatcherP<p0##_type>(p0);\
- }\
- template <typename p0##_type>\
- template <typename arg_type>\
- bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P2(name, p0, p1, description)\
- template <typename p0##_type, typename p1##_type>\
- class name##MatcherP2 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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##_type, p1##_type>(p0, p1)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(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 <typename p0##_type, typename p1##_type>\
- inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \
- p1##_type p1) {\
- return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\
- }\
- template <typename p0##_type, typename p1##_type>\
- template <typename arg_type>\
- bool name##MatcherP2<p0##_type, \
- p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P3(name, p0, p1, p2, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- class name##MatcherP3 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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##_type, p1##_type, p2##_type>(p0, p1, \
- p2)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(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 <typename p0##_type, typename p1##_type, typename p2##_type>\
- inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
- p1##_type p1, p2##_type p2) {\
- return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type>\
- template <typename arg_type>\
- bool name##MatcherP3<p0##_type, p1##_type, \
- p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P4(name, p0, p1, p2, p3, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- class name##MatcherP4 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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##_type, p1##_type, p2##_type, \
- p3##_type>(p0, p1, p2, p3)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- inline name##MatcherP4<p0##_type, p1##_type, p2##_type, \
- p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
- p3##_type p3) {\
- return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \
- p1, p2, p3);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type>\
- template <typename arg_type>\
- bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \
- p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- class name##MatcherP5 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type>(p0, p1, p2, p3, p4)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- inline name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
- p4##_type p4) {\
- return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type>(p0, p1, p2, p3, p4);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type>\
- template <typename arg_type>\
- bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- class name##MatcherP6 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- inline name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
- p3##_type p3, p4##_type p4, p5##_type p5) {\
- return name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type>\
- template <typename arg_type>\
- bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type>::gmock_Impl<arg_type>::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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- class name##MatcherP7 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \
- p6)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- inline name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type> 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type>\
- template <typename arg_type>\
- bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type>::gmock_Impl<arg_type>::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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- class name##MatcherP8 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \
- p3, p4, p5, p6, p7)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(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 <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- inline name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type> 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
- p6, p7);\
- }\
- template <typename p0##_type, typename p1##_type, typename p2##_type, \
- typename p3##_type, typename p4##_type, typename p5##_type, \
- typename p6##_type, typename p7##_type>\
- template <typename arg_type>\
- bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, \
- p7##_type>::gmock_Impl<arg_type>::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 <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>\
- class name##MatcherP9 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, \
- p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(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 <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>\
- inline name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, \
- p8##_type> 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
- p3, p4, p5, p6, p7, p8);\
- }\
- template <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>\
- template <typename arg_type>\
- bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
- p5##_type, p6##_type, p7##_type, \
- p8##_type>::gmock_Impl<arg_type>::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 <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>\
- class name##MatcherP10 {\
- public:\
- template <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
- p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\
- }\
- GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
- };\
- template <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>(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 <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>\
- inline name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
- p9##_type> 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##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
- p1, p2, p3, p4, p5, p6, p7, p8, p9);\
- }\
- template <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>\
- template <typename arg_type>\
- bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
- p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
- p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
diff --git a/src/lib/install/include/gmock/gmock-generated-matchers.h.pump b/src/lib/install/include/gmock/gmock-generated-matchers.h.pump
deleted file mode 100755
index de30c2c..0000000
--- a/src/lib/install/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 <iterator>
-#include <sstream>
-#include <string>
-#include <vector>
-#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<i, Tuple>::type
-
-// TupleFields<Tuple, k0, ..., kn> 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<tuple<bool, char, int>, 2, 0>, we have:
-//
-// type is tuple<int, bool>, and
-// GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true).
-
-template <class Tuple$for i [[, int k$i = -1]]>
-class TupleFields;
-
-// This generic version is used when there are $n selectors.
-template <class Tuple$for i [[, int k$i]]>
-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<k$i>(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 Tuple$for j [[, int k$j]]>
-class TupleFields<Tuple, $for k, [[$if k < i [[k$k]] $else [[-1]]]]> {
- 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<k$j>(t)]]);
- }
-};
-
-]]
-
-#undef GMOCK_FIELD_TYPE_
-
-// Implements the Args() matcher.
-
-$var ks = [[$for i, [[k$i]]]]
-template <class ArgsTuple$for i [[, int k$i = -1]]>
-class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> {
- public:
- // ArgsTuple may have top-level const or reference modifiers.
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple;
- typedef typename internal::TupleFields<RawArgsTuple, $ks>::type SelectedArgs;
- typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher;
-
- template <typename InnerMatcher>
- explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher)
- : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(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<RawArgsTuple, $ks>::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 InnerMatcher$for i [[, int k$i = -1]]>
-class ArgsMatcher {
- public:
- explicit ArgsMatcher(const InnerMatcher& inner_matcher)
- : inner_matcher_(inner_matcher) {}
-
- template <typename ArgsTuple>
- operator Matcher<ArgsTuple>() const {
- return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, $ks>(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<decltype(m1), ..., decltype(mN)>::type.
-
-// Although AllOf isn't defined for one argument, AllOfResult1 is defined
-// to simplify the implementation.
-template <typename M1>
-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 <typename M1$for j [[, typename M$j]]>
-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<decltype(m1), ..., decltype(mN)>::type.
-
-// Although AnyOf isn't defined for one argument, AnyOfResult1 is defined
-// to simplify the implementation.
-template <typename M1>
-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 <typename M1$for j [[, typename M$j]]>
-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<N1, N2, ..., Nk>(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<InnerMatcher$for j [[, k$j]]>
-Args(const InnerMatcher& matcher) {
- return internal::ArgsMatcher<InnerMatcher$for j [[, k$j]]>(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<T$j[[]]>::type]]> >
-ElementsAre($for j, [[const T$j& e$j]]) {
- typedef ::testing::tuple<
-$for j, [[
-
- typename internal::DecayArray<T$j[[]]>::type]]> Args;
- return internal::ElementsAreMatcher<Args>(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<T$j[[]]>::type]]> >
-UnorderedElementsAre($for j, [[const T$j& e$j]]) {
- typedef ::testing::tuple<
-$for j, [[
-
- typename internal::DecayArray<T$j[[]]>::type]]> Args;
- return internal::UnorderedElementsAreMatcher<Args>(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 <typename p1_type, ..., typename pk_type>
-// FooMatcherPk<p1_type, ..., pk_type>
-// 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<long, bool>(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<p1_type, ..., pk_type>. 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 <typename arg_type>\
- class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\
- 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 <typename arg_type>\
- operator ::testing::Matcher<arg_type>() const {\
- return ::testing::Matcher<arg_type>(\
- new gmock_Impl<arg_type>($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 <typename arg_type>\
- bool $class_name$param_types::gmock_Impl<arg_type>::MatchAndExplain(\
- arg_type arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
- const
-]]
-
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
diff --git a/src/lib/install/include/gmock/gmock-generated-nice-strict.h b/src/lib/install/include/gmock/gmock-generated-nice-strict.h
deleted file mode 100755
index 4095f4d..0000000
--- a/src/lib/install/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<MockFoo> is a subclass of MockFoo that allows
-// uninteresting calls (i.e. calls to mock methods that have no
-// EXPECT_CALL specs), NaggyMock<MockFoo> is a subclass of MockFoo
-// that prints a warning when an uninteresting call occurs, and
-// StrictMock<MockFoo> is a subclass of MockFoo that treats all
-// uninteresting calls as errors.
-//
-// Currently a mock is naggy by default, so MockFoo and
-// NaggyMock<MockFoo> 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<MockFoo> and start behaving like
-// NiceMock<MockFoo>.
-//
-// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
-// their respective base class, with up-to 10 arguments. Therefore
-// you can write NiceMock<MockFoo>(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<MockFoo>, NaggyMock<MockFoo>,
-// and StrictMock<MockFoo> 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 MockClass>
-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_<MockClass*>(this));
- }
-
- // C++ doesn't (yet) allow inheritance of constructors, so we have
- // to define it for each arity.
- template <typename A1>
- explicit NiceMock(const A1& a1) : MockClass(a1) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
- template <typename A1, typename A2>
- NiceMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3>
- NiceMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4>
- NiceMock(const A1& a1, const A2& a2, const A3& a3,
- const A4& a4) : MockClass(a1, a2, a3, a4) {
- ::testing::Mock::AllowUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9, typename A10>
- 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_<MockClass*>(this));
- }
-
- virtual ~NiceMock() {
- ::testing::Mock::UnregisterCallReaction(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock);
-};
-
-template <class MockClass>
-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_<MockClass*>(this));
- }
-
- // C++ doesn't (yet) allow inheritance of constructors, so we have
- // to define it for each arity.
- template <typename A1>
- explicit NaggyMock(const A1& a1) : MockClass(a1) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
- template <typename A1, typename A2>
- NaggyMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3>
- NaggyMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4>
- NaggyMock(const A1& a1, const A2& a2, const A3& a3,
- const A4& a4) : MockClass(a1, a2, a3, a4) {
- ::testing::Mock::WarnUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9, typename A10>
- 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_<MockClass*>(this));
- }
-
- virtual ~NaggyMock() {
- ::testing::Mock::UnregisterCallReaction(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock);
-};
-
-template <class MockClass>
-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_<MockClass*>(this));
- }
-
- // C++ doesn't (yet) allow inheritance of constructors, so we have
- // to define it for each arity.
- template <typename A1>
- explicit StrictMock(const A1& a1) : MockClass(a1) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
- template <typename A1, typename A2>
- StrictMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3>
- StrictMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4>
- StrictMock(const A1& a1, const A2& a2, const A3& a3,
- const A4& a4) : MockClass(a1, a2, a3, a4) {
- ::testing::Mock::FailUninterestingCalls(
- internal::ImplicitCast_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9>
- 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_<MockClass*>(this));
- }
-
- template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9, typename A10>
- 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_<MockClass*>(this));
- }
-
- virtual ~StrictMock() {
- ::testing::Mock::UnregisterCallReaction(
- internal::ImplicitCast_<MockClass*>(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 <typename MockClass>
-class NiceMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class NiceMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class NiceMock<StrictMock<MockClass> >;
-
-template <typename MockClass>
-class NaggyMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class NaggyMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class NaggyMock<StrictMock<MockClass> >;
-
-template <typename MockClass>
-class StrictMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class StrictMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class StrictMock<StrictMock<MockClass> >;
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
diff --git a/src/lib/install/include/gmock/gmock-generated-nice-strict.h.pump b/src/lib/install/include/gmock/gmock-generated-nice-strict.h.pump
deleted file mode 100755
index 3ee1ce7..0000000
--- a/src/lib/install/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<MockFoo> is a subclass of MockFoo that allows
-// uninteresting calls (i.e. calls to mock methods that have no
-// EXPECT_CALL specs), NaggyMock<MockFoo> is a subclass of MockFoo
-// that prints a warning when an uninteresting call occurs, and
-// StrictMock<MockFoo> is a subclass of MockFoo that treats all
-// uninteresting calls as errors.
-//
-// Currently a mock is naggy by default, so MockFoo and
-// NaggyMock<MockFoo> 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<MockFoo> and start behaving like
-// NiceMock<MockFoo>.
-//
-// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
-// their respective base class, with up-to $n arguments. Therefore
-// you can write NiceMock<MockFoo>(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<MockFoo>, NaggyMock<MockFoo>,
-// and StrictMock<MockFoo> 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 MockClass>
-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_<MockClass*>(this));
- }
-
- // C++ doesn't (yet) allow inheritance of constructors, so we have
- // to define it for each arity.
- template <typename A1>
- explicit $clazz(const A1& a1) : MockClass(a1) {
- ::testing::Mock::$method(
- internal::ImplicitCast_<MockClass*>(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_<MockClass*>(this));
- }
-
-
-]]
- virtual ~$clazz() {
- ::testing::Mock::UnregisterCallReaction(
- internal::ImplicitCast_<MockClass*>(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 <typename MockClass>
-class NiceMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class NiceMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class NiceMock<StrictMock<MockClass> >;
-
-template <typename MockClass>
-class NaggyMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class NaggyMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class NaggyMock<StrictMock<MockClass> >;
-
-template <typename MockClass>
-class StrictMock<NiceMock<MockClass> >;
-template <typename MockClass>
-class StrictMock<NaggyMock<MockClass> >;
-template <typename MockClass>
-class StrictMock<StrictMock<MockClass> >;
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
diff --git a/src/lib/install/include/gmock/gmock-matchers.h b/src/lib/install/include/gmock/gmock-matchers.h
deleted file mode 100755
index 9ade5b6..0000000
--- a/src/lib/install/include/gmock/gmock-matchers.h
+++ /dev/null
@@ -1,4397 +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<T> interface if necessary.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
-
-#include <math.h>
-#include <algorithm>
-#include <iterator>
-#include <limits>
-#include <ostream> // NOLINT
-#include <sstream>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "gmock/internal/gmock-internal-utils.h"
-#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
-
-#if GTEST_HAS_STD_INITIALIZER_LIST_
-# include <initializer_list> // 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<T> interface, and
-// 2. a factory function that creates a Matcher<T> 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 <typename T>
- 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 <typename T>
-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 <typename A, typename B>
- bool operator()(const A& a, const B& b) const { return a == b; }
-};
-struct AnyNe {
- template <typename A, typename B>
- bool operator()(const A& a, const B& b) const { return a != b; }
-};
-struct AnyLt {
- template <typename A, typename B>
- bool operator()(const A& a, const B& b) const { return a < b; }
-};
-struct AnyGt {
- template <typename A, typename B>
- bool operator()(const A& a, const B& b) const { return a > b; }
-};
-struct AnyLe {
- template <typename A, typename B>
- bool operator()(const A& a, const B& b) const { return a <= b; }
-};
-struct AnyGe {
- template <typename A, typename B>
- 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<T>, which will derive
-// from it. We put functionalities common to all Matcher<T>
-// specializations here to avoid code duplication.
-template <typename T>
-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<T>* 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<const MatcherInterface<T> > impl_;
-};
-
-} // namespace internal
-
-// A Matcher<T> is a copyable and IMMUTABLE (except by assignment)
-// object that can check whether a value of type T matches. The
-// implementation of Matcher<T> is just a linked_ptr to const
-// MatcherInterface<T>, so copying is fairly cheap. Don't inherit
-// from Matcher!
-template <typename T>
-class Matcher : public internal::MatcherBase<T> {
- 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<T>* impl)
- : internal::MatcherBase<T>(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<const internal::string&>
- : public internal::MatcherBase<const internal::string&> {
- public:
- Matcher() {}
-
- explicit Matcher(const MatcherInterface<const internal::string&>* impl)
- : internal::MatcherBase<const internal::string&>(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<internal::string>
- : public internal::MatcherBase<internal::string> {
- public:
- Matcher() {}
-
- explicit Matcher(const MatcherInterface<internal::string>* impl)
- : internal::MatcherBase<internal::string>(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<const StringPiece&>
- : public internal::MatcherBase<const StringPiece&> {
- public:
- Matcher() {}
-
- explicit Matcher(const MatcherInterface<const StringPiece&>* impl)
- : internal::MatcherBase<const StringPiece&>(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<StringPiece>
- : public internal::MatcherBase<StringPiece> {
- public:
- Matcher() {}
-
- explicit Matcher(const MatcherInterface<StringPiece>* impl)
- : internal::MatcherBase<StringPiece>(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 Impl>
-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 <typename T>
- operator Matcher<T>() const {
- return Matcher<T>(new MonomorphicImpl<T>(impl_));
- }
-
- private:
- template <typename T>
- class MonomorphicImpl : public MatcherInterface<T> {
- 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<T> constructor as it doesn't require you to
-// explicitly write the template argument, e.g.
-//
-// MakeMatcher(foo);
-// vs
-// Matcher<const string&>(foo);
-template <typename T>
-inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
- return Matcher<T>(impl);
-}
-
-// Creates a polymorphic matcher from its implementation. This is
-// easier to use than the PolymorphicMatcher<Impl> constructor as it
-// doesn't require you to explicitly write the template argument, e.g.
-//
-// MakePolymorphicMatcher(foo);
-// vs
-// PolymorphicMatcher<TypeOfFoo>(foo);
-template <class Impl>
-inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
- return PolymorphicMatcher<Impl>(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 <typename T, typename M>
-class MatcherCastImpl {
- public:
- static Matcher<T> 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<T>. Or it can be a value
- // that should be passed to the Matcher<T>'s constructor.
- //
- // We can't call Matcher<T>(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<T> 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<M, Matcher<T> >::value>());
- }
-
- private:
- static Matcher<T> CastImpl(const M& value, BooleanConstant<false>) {
- // M can't be implicitly converted to Matcher<T>, so M isn't a polymorphic
- // matcher. It must be a value then. Use direct initialization to create
- // a matcher.
- return Matcher<T>(ImplicitCast_<T>(value));
- }
-
- static Matcher<T> CastImpl(const M& polymorphic_matcher_or_value,
- BooleanConstant<true>) {
- // M is implicitly convertible to Matcher<T>, which means that either
- // M is a polymorhpic matcher or Matcher<T> 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<T> would require a chain of two user-defined conversions
- // (first to create T from M and then to create Matcher<T> 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 <typename T, typename U>
-class MatcherCastImpl<T, Matcher<U> > {
- public:
- static Matcher<T> Cast(const Matcher<U>& source_matcher) {
- return Matcher<T>(new Impl(source_matcher));
- }
-
- private:
- class Impl : public MatcherInterface<T> {
- public:
- explicit Impl(const Matcher<U>& 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<U>(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<U> source_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-};
-
-// This even more specialized version is used for efficiently casting
-// a matcher to its own type.
-template <typename T>
-class MatcherCastImpl<T, Matcher<T> > {
- public:
- static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; }
-};
-
-} // namespace internal
-
-// In order to be safe and clear, casting between different matcher
-// types is done explicitly via MatcherCast<T>(m), which takes a
-// matcher m and returns a Matcher<T>. It compiles only when T can be
-// statically converted to the argument type of m.
-template <typename T, typename M>
-inline Matcher<T> MatcherCast(const M& matcher) {
- return internal::MatcherCastImpl<T, M>::Cast(matcher);
-}
-
-// Implements SafeMatcherCast().
-//
-// We use an intermediate class to do the actual safe casting as Nokia's
-// Symbian compiler cannot decide between
-// template <T, M> ... (M) and
-// template <T, U> ... (const Matcher<U>&)
-// for function templates but can for member function templates.
-template <typename T>
-class SafeMatcherCastImpl {
- public:
- // This overload handles polymorphic matchers and values only since
- // monomorphic matchers are handled by the next one.
- template <typename M>
- static inline Matcher<T> Cast(const M& polymorphic_matcher_or_value) {
- return internal::MatcherCastImpl<T, M>::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<U> to a Matcher<T> (i.e. Matcher is
- // contravariant): just keep a copy of the original Matcher<U>, convert the
- // argument from type T to U, and then pass it to the underlying Matcher<U>.
- // The only exception is when U is a reference and T is not, as the
- // underlying Matcher<U> may be interested in the argument's address, which
- // is not preserved in the conversion from T to U.
- template <typename U>
- static inline Matcher<T> Cast(const Matcher<U>& matcher) {
- // Enforce that T can be implicitly converted to U.
- GTEST_COMPILE_ASSERT_((internal::ImplicitlyConvertible<T, U>::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<T>::value || !internal::is_reference<U>::value,
- cannot_convert_non_referentce_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<RawT, RawU>::value),
- conversion_of_arithmetic_types_must_be_lossless);
- return MatcherCast<T>(matcher);
- }
-};
-
-template <typename T, typename M>
-inline Matcher<T> SafeMatcherCast(const M& polymorphic_matcher) {
- return SafeMatcherCastImpl<T>::Cast(polymorphic_matcher);
-}
-
-// A<T>() returns a matcher that matches any value of type T.
-template <typename T>
-Matcher<T> 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 <typename Value, typename T>
-bool MatchPrintAndExplain(Value& value, const Matcher<T>& 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<Value>();
- 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 <size_t N>
-class TuplePrefix {
- public:
- // TuplePrefix<N>::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 <typename MatcherTuple, typename ValueTuple>
- static bool Matches(const MatcherTuple& matcher_tuple,
- const ValueTuple& value_tuple) {
- return TuplePrefix<N - 1>::Matches(matcher_tuple, value_tuple)
- && get<N - 1>(matcher_tuple).Matches(get<N - 1>(value_tuple));
- }
-
- // TuplePrefix<N>::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 <typename MatcherTuple, typename ValueTuple>
- static void ExplainMatchFailuresTo(const MatcherTuple& matchers,
- const ValueTuple& values,
- ::std::ostream* os) {
- // First, describes failures in the first N - 1 fields.
- TuplePrefix<N - 1>::ExplainMatchFailuresTo(matchers, values, os);
-
- // Then describes the failure (if any) in the (N - 1)-th (0-based)
- // field.
- typename tuple_element<N - 1, MatcherTuple>::type matcher =
- get<N - 1>(matchers);
- typedef typename tuple_element<N - 1, ValueTuple>::type Value;
- Value value = get<N - 1>(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<N - 1>(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 <typename MatcherTuple, typename ValueTuple>
- static bool Matches(const MatcherTuple& /* matcher_tuple */,
- const ValueTuple& /* value_tuple */) {
- return true;
- }
-
- template <typename MatcherTuple, typename ValueTuple>
- 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 <typename MatcherTuple, typename ValueTuple>
-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<MatcherTuple>::value ==
- tuple_size<ValueTuple>::value,
- matcher_and_value_have_different_numbers_of_fields);
- return TuplePrefix<tuple_size<ValueTuple>::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 <typename MatcherTuple, typename ValueTuple>
-void ExplainMatchFailureTupleTo(const MatcherTuple& matchers,
- const ValueTuple& values,
- ::std::ostream* os) {
- TuplePrefix<tuple_size<MatcherTuple>::value>::ExplainMatchFailuresTo(
- matchers, values, os);
-}
-
-// TransformTupleValues and its helper.
-//
-// TransformTupleValuesHelper hides the internal machinery that
-// TransformTupleValues uses to implement a tuple traversal.
-template <typename Tuple, typename Func, typename OutIter>
-class TransformTupleValuesHelper {
- private:
- typedef ::testing::tuple_size<Tuple> 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<Tuple, TupleSize::value>()(f, t, out);
- }
-
- private:
- template <typename Tup, size_t kRemainingSize>
- struct IterateOverTuple {
- OutIter operator() (Func f, const Tup& t, OutIter out) const {
- *out++ = f(::testing::get<TupleSize::value - kRemainingSize>(t));
- return IterateOverTuple<Tup, kRemainingSize - 1>()(f, t, out);
- }
- };
- template <typename Tup>
- struct IterateOverTuple<Tup, 0> {
- 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 <typename Tuple, typename Func, typename OutIter>
-OutIter TransformTupleValues(Func f, const Tuple& t, OutIter out) {
- return TransformTupleValuesHelper<Tuple, Func, OutIter>::Run(f, t, out);
-}
-
-// Implements A<T>().
-template <typename T>
-class AnyMatcherImpl : public MatcherInterface<T> {
- 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<bool>()). 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<T> for any
-// type T.
-class AnythingMatcher {
- public:
- template <typename T>
- operator Matcher<T>() const { return A<T>(); }
-};
-
-// 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 <typename D, typename Rhs, typename Op>
-class ComparisonBase {
- public:
- explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {}
- template <typename Lhs>
- operator Matcher<Lhs>() const {
- return MakeMatcher(new Impl<Lhs>(rhs_));
- }
-
- private:
- template <typename Lhs>
- class Impl : public MatcherInterface<Lhs> {
- 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 <typename Rhs>
-class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> {
- public:
- explicit EqMatcher(const Rhs& rhs)
- : ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) { }
- static const char* Desc() { return "is equal to"; }
- static const char* NegatedDesc() { return "isn't equal to"; }
-};
-template <typename Rhs>
-class NeMatcher : public ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe> {
- public:
- explicit NeMatcher(const Rhs& rhs)
- : ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) { }
- static const char* Desc() { return "isn't equal to"; }
- static const char* NegatedDesc() { return "is equal to"; }
-};
-template <typename Rhs>
-class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt> {
- public:
- explicit LtMatcher(const Rhs& rhs)
- : ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) { }
- static const char* Desc() { return "is <"; }
- static const char* NegatedDesc() { return "isn't <"; }
-};
-template <typename Rhs>
-class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt> {
- public:
- explicit GtMatcher(const Rhs& rhs)
- : ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) { }
- static const char* Desc() { return "is >"; }
- static const char* NegatedDesc() { return "isn't >"; }
-};
-template <typename Rhs>
-class LeMatcher : public ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe> {
- public:
- explicit LeMatcher(const Rhs& rhs)
- : ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) { }
- static const char* Desc() { return "is <="; }
- static const char* NegatedDesc() { return "isn't <="; }
-};
-template <typename Rhs>
-class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> {
- public:
- explicit GeMatcher(const Rhs& rhs)
- : ComparisonBase<GeMatcher<Rhs>, 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 <typename Pointer>
- 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 <typename Pointer>
- 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<int> m1 = Ref(n); // This won't compile.
-// Matcher<int&> m2 = Ref(n); // This will compile.
-template <typename T>
-class RefMatcher;
-
-template <typename T>
-class RefMatcher<T&> {
- // 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 <typename Super>
- operator Matcher<Super&>() 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<Super>(object_));
- }
-
- private:
- template <typename Super>
- class Impl : public MatcherInterface<Super&> {
- public:
- explicit Impl(Super& x) : object_(x) {} // NOLINT
-
- // MatchAndExplain() takes a Super& (as opposed to const Super&)
- // in order to match the interface MatcherInterface<Super&>.
- virtual bool MatchAndExplain(
- Super& x, MatchResultListener* listener) const {
- *listener << "which is located @" << static_cast<const void*>(&x);
- return &x == &object_;
- }
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "references the variable ";
- UniversalPrinter<Super&>::Print(object_, os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "does not reference the variable ";
- UniversalPrinter<Super&>::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 <typename StringType>
-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 <typename StringType>
-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 <typename CharType>
- 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 <typename MatcheeStringType>
- 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<T> as long as T can be converted to a
-// string.
-template <typename StringType>
-class HasSubstrMatcher {
- public:
- explicit HasSubstrMatcher(const StringType& substring)
- : substring_(substring) {}
-
- // Accepts pointer types, particularly:
- // const char*
- // char*
- // const wchar_t*
- // wchar_t*
- template <typename CharType>
- 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 <typename MatcheeStringType>
- 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<T> as long as T can be converted to a
-// string.
-template <typename StringType>
-class StartsWithMatcher {
- public:
- explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) {
- }
-
- // Accepts pointer types, particularly:
- // const char*
- // char*
- // const wchar_t*
- // wchar_t*
- template <typename CharType>
- 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 <typename MatcheeStringType>
- 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<T> as long as T can be converted to a
-// string.
-template <typename StringType>
-class EndsWithMatcher {
- public:
- explicit EndsWithMatcher(const StringType& suffix) : suffix_(suffix) {}
-
- // Accepts pointer types, particularly:
- // const char*
- // char*
- // const wchar_t*
- // wchar_t*
- template <typename CharType>
- 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 <typename MatcheeStringType>
- 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<T> 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 <typename CharType>
- 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 <class MatcheeStringType>
- 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<std::string>::Print(regex_->pattern(), os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't " << (full_match_ ? "match" : "contain")
- << " regular expression ";
- UniversalPrinter<std::string>::Print(regex_->pattern(), os);
- }
-
- private:
- const internal::linked_ptr<const RE> 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<int, short>, a tuple<const long&, double>,
-// etc). Therefore we use a template type conversion operator in the
-// implementation.
-template <typename D, typename Op>
-class PairMatchBase {
- public:
- template <typename T1, typename T2>
- operator Matcher< ::testing::tuple<T1, T2> >() const {
- return MakeMatcher(new Impl< ::testing::tuple<T1, T2> >);
- }
- template <typename T1, typename T2>
- operator Matcher<const ::testing::tuple<T1, T2>&>() const {
- return MakeMatcher(new Impl<const ::testing::tuple<T1, T2>&>);
- }
-
- private:
- static ::std::ostream& GetDesc(::std::ostream& os) { // NOLINT
- return os << D::Desc();
- }
-
- template <typename Tuple>
- class Impl : public MatcherInterface<Tuple> {
- 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<Eq2Matcher, AnyEq> {
- public:
- static const char* Desc() { return "an equal pair"; }
-};
-class Ne2Matcher : public PairMatchBase<Ne2Matcher, AnyNe> {
- public:
- static const char* Desc() { return "an unequal pair"; }
-};
-class Lt2Matcher : public PairMatchBase<Lt2Matcher, AnyLt> {
- public:
- static const char* Desc() { return "a pair where the first < the second"; }
-};
-class Gt2Matcher : public PairMatchBase<Gt2Matcher, AnyGt> {
- public:
- static const char* Desc() { return "a pair where the first > the second"; }
-};
-class Le2Matcher : public PairMatchBase<Le2Matcher, AnyLe> {
- public:
- static const char* Desc() { return "a pair where the first <= the second"; }
-};
-class Ge2Matcher : public PairMatchBase<Ge2Matcher, AnyGe> {
- 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<T> class.
-template <typename T>
-class NotMatcherImpl : public MatcherInterface<T> {
- public:
- explicit NotMatcherImpl(const Matcher<T>& 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<T> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(NotMatcherImpl);
-};
-
-// Implements the Not(m) matcher, which matches a value that doesn't
-// match matcher m.
-template <typename InnerMatcher>
-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 <typename T>
- operator Matcher<T>() const {
- return Matcher<T>(new NotMatcherImpl<T>(SafeMatcherCast<T>(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<T> class.
-template <typename T>
-class BothOfMatcherImpl : public MatcherInterface<T> {
- public:
- BothOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& 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<T> matcher1_;
- const Matcher<T> 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 <int kSize, typename Head, typename... Tail>
-struct MatcherList {
- typedef MatcherList<kSize - 1, Tail...> MatcherListTail;
- typedef ::std::pair<Head, typename MatcherListTail::ListType> 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<int, pair<string, float>>.
- static ListType BuildList(const Head& matcher, const Tail&... tail) {
- return ListType(matcher, MatcherListTail::BuildList(tail...));
- }
-
- // CreateMatcher<T> creates a Matcher<T> from a given list of matchers (built
- // by BuildList()). CombiningMatcher<T> is used to combine the matchers of the
- // list. CombiningMatcher<T> must implement MatcherInterface<T> and have a
- // constructor taking two Matcher<T>s as input.
- template <typename T, template <typename /* T */> class CombiningMatcher>
- static Matcher<T> CreateMatcher(const ListType& matchers) {
- return Matcher<T>(new CombiningMatcher<T>(
- SafeMatcherCast<T>(matchers.first),
- MatcherListTail::template CreateMatcher<T, CombiningMatcher>(
- matchers.second)));
- }
-};
-
-// The following defines the base case for the recursive definition of
-// MatcherList.
-template <typename Matcher1, typename Matcher2>
-struct MatcherList<2, Matcher1, Matcher2> {
- typedef ::std::pair<Matcher1, Matcher2> ListType;
-
- static ListType BuildList(const Matcher1& matcher1,
- const Matcher2& matcher2) {
- return ::std::pair<Matcher1, Matcher2>(matcher1, matcher2);
- }
-
- template <typename T, template <typename /* T */> class CombiningMatcher>
- static Matcher<T> CreateMatcher(const ListType& matchers) {
- return Matcher<T>(new CombiningMatcher<T>(
- SafeMatcherCast<T>(matchers.first),
- SafeMatcherCast<T>(matchers.second)));
- }
-};
-
-// VariadicMatcher is used for the variadic implementation of
-// AllOf(m_1, m_2, ...) and AnyOf(m_1, m_2, ...).
-// CombiningMatcher<T> is used to recursively combine the provided matchers
-// (of type Args...).
-template <template <typename T> class CombiningMatcher, typename... Args>
-class VariadicMatcher {
- public:
- VariadicMatcher(const Args&... matchers) // NOLINT
- : matchers_(MatcherListType::BuildList(matchers...)) {}
-
- // This template type conversion operator allows an
- // VariadicMatcher<Matcher1, Matcher2...> object to match any type that
- // all of the provided matchers (Matcher1, Matcher2, ...) can match.
- template <typename T>
- operator Matcher<T>() const {
- return MatcherListType::template CreateMatcher<T, CombiningMatcher>(
- matchers_);
- }
-
- private:
- typedef MatcherList<sizeof...(Args), Args...> MatcherListType;
-
- const typename MatcherListType::ListType matchers_;
-
- GTEST_DISALLOW_ASSIGN_(VariadicMatcher);
-};
-
-template <typename... Args>
-using AllOfMatcher = VariadicMatcher<BothOfMatcherImpl, Args...>;
-
-#endif // GTEST_LANG_CXX11
-
-// Used for implementing the AllOf(m_1, ..., m_n) matcher, which
-// matches a value that matches all of the matchers m_1, ..., and m_n.
-template <typename Matcher1, typename Matcher2>
-class BothOfMatcher {
- public:
- BothOfMatcher(Matcher1 matcher1, Matcher2 matcher2)
- : matcher1_(matcher1), matcher2_(matcher2) {}
-
- // This template type conversion operator allows a
- // BothOfMatcher<Matcher1, Matcher2> object to match any type that
- // both Matcher1 and Matcher2 can match.
- template <typename T>
- operator Matcher<T>() const {
- return Matcher<T>(new BothOfMatcherImpl<T>(SafeMatcherCast<T>(matcher1_),
- SafeMatcherCast<T>(matcher2_)));
- }
-
- private:
- Matcher1 matcher1_;
- Matcher2 matcher2_;
-
- GTEST_DISALLOW_ASSIGN_(BothOfMatcher);
-};
-
-// Implements the AnyOf(m1, m2) matcher for a particular argument type
-// T. We do not nest it inside the AnyOfMatcher class template, as
-// that will prevent different instantiations of AnyOfMatcher from
-// sharing the same EitherOfMatcherImpl<T> class.
-template <typename T>
-class EitherOfMatcherImpl : public MatcherInterface<T> {
- public:
- EitherOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher2)
- : matcher1_(matcher1), matcher2_(matcher2) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "(";
- matcher1_.DescribeTo(os);
- *os << ") or (";
- matcher2_.DescribeTo(os);
- *os << ")";
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "(";
- matcher1_.DescribeNegationTo(os);
- *os << ") and (";
- matcher2_.DescribeNegationTo(os);
- *os << ")";
- }
-
- virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
- // If either matcher1_ or matcher2_ matches x, we just need to
- // explain why *one* of them matches.
- StringMatchResultListener listener1;
- if (matcher1_.MatchAndExplain(x, &listener1)) {
- *listener << listener1.str();
- return true;
- }
-
- StringMatchResultListener listener2;
- if (matcher2_.MatchAndExplain(x, &listener2)) {
- *listener << listener2.str();
- return true;
- }
-
- // Otherwise we need to explain why *both* of them fail.
- 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 false;
- }
-
- private:
- const Matcher<T> matcher1_;
- const Matcher<T> matcher2_;
-
- GTEST_DISALLOW_ASSIGN_(EitherOfMatcherImpl);
-};
-
-#if GTEST_LANG_CXX11
-// AnyOfMatcher is used for the variadic implementation of AnyOf(m_1, m_2, ...).
-template <typename... Args>
-using AnyOfMatcher = VariadicMatcher<EitherOfMatcherImpl, Args...>;
-
-#endif // GTEST_LANG_CXX11
-
-// Used for implementing the AnyOf(m_1, ..., m_n) matcher, which
-// matches a value that matches at least one of the matchers m_1, ...,
-// and m_n.
-template <typename Matcher1, typename Matcher2>
-class EitherOfMatcher {
- public:
- EitherOfMatcher(Matcher1 matcher1, Matcher2 matcher2)
- : matcher1_(matcher1), matcher2_(matcher2) {}
-
- // This template type conversion operator allows a
- // EitherOfMatcher<Matcher1, Matcher2> object to match any type that
- // both Matcher1 and Matcher2 can match.
- template <typename T>
- operator Matcher<T>() const {
- return Matcher<T>(new EitherOfMatcherImpl<T>(
- SafeMatcherCast<T>(matcher1_), SafeMatcherCast<T>(matcher2_)));
- }
-
- private:
- Matcher1 matcher1_;
- Matcher2 matcher2_;
-
- GTEST_DISALLOW_ASSIGN_(EitherOfMatcher);
-};
-
-// Used for implementing Truly(pred), which turns a predicate into a
-// matcher.
-template <typename Predicate>
-class TrulyMatcher {
- public:
- explicit TrulyMatcher(Predicate pred) : predicate_(pred) {}
-
- // This method template allows Truly(pred) to be used as a matcher
- // for type T where T is the argument type of predicate 'pred'. The
- // argument is passed by reference as the predicate may be
- // interested in the address of the argument.
- template <typename T>
- bool MatchAndExplain(T& x, // NOLINT
- MatchResultListener* /* listener */) const {
- // Without the if-statement, MSVC sometimes warns about converting
- // a value to bool (warning 4800).
- //
- // We cannot write 'return !!predicate_(x);' as that doesn't work
- // when predicate_(x) returns a class convertible to bool but
- // having no operator!().
- if (predicate_(x))
- return true;
- return false;
- }
-
- void DescribeTo(::std::ostream* os) const {
- *os << "satisfies the given predicate";
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't satisfy the given predicate";
- }
-
- private:
- Predicate predicate_;
-
- GTEST_DISALLOW_ASSIGN_(TrulyMatcher);
-};
-
-// Used for implementing Matches(matcher), which turns a matcher into
-// a predicate.
-template <typename M>
-class MatcherAsPredicate {
- public:
- explicit MatcherAsPredicate(M matcher) : matcher_(matcher) {}
-
- // This template operator() allows Matches(m) to be used as a
- // predicate on type T where m is a matcher on type T.
- //
- // The argument x is passed by reference instead of by value, as
- // some matcher may be interested in its address (e.g. as in
- // Matches(Ref(n))(x)).
- template <typename T>
- bool operator()(const T& x) const {
- // We let matcher_ commit to a particular type here instead of
- // when the MatcherAsPredicate object was constructed. This
- // allows us to write Matches(m) where m is a polymorphic matcher
- // (e.g. Eq(5)).
- //
- // If we write Matcher<T>(matcher_).Matches(x) here, it won't
- // compile when matcher_ has type Matcher<const T&>; if we write
- // Matcher<const T&>(matcher_).Matches(x) here, it won't compile
- // when matcher_ has type Matcher<T>; if we just write
- // matcher_.Matches(x), it won't compile when matcher_ is
- // polymorphic, e.g. Eq(5).
- //
- // MatcherCast<const T&>() is necessary for making the code work
- // in all of the above situations.
- return MatcherCast<const T&>(matcher_).Matches(x);
- }
-
- private:
- M matcher_;
-
- GTEST_DISALLOW_ASSIGN_(MatcherAsPredicate);
-};
-
-// For implementing ASSERT_THAT() and EXPECT_THAT(). The template
-// argument M must be a type that can be converted to a matcher.
-template <typename M>
-class PredicateFormatterFromMatcher {
- public:
- explicit PredicateFormatterFromMatcher(M m) : matcher_(internal::move(m)) {}
-
- // This template () operator allows a PredicateFormatterFromMatcher
- // object to act as a predicate-formatter suitable for using with
- // Google Test's EXPECT_PRED_FORMAT1() macro.
- template <typename T>
- AssertionResult operator()(const char* value_text, const T& x) const {
- // We convert matcher_ to a Matcher<const T&> *now* instead of
- // when the PredicateFormatterFromMatcher object was constructed,
- // as matcher_ may be polymorphic (e.g. NotNull()) and we won't
- // know which type to instantiate it to until we actually see the
- // type of x here.
- //
- // We write SafeMatcherCast<const T&>(matcher_) instead of
- // Matcher<const T&>(matcher_), as the latter won't compile when
- // matcher_ has type Matcher<T> (e.g. An<int>()).
- // We don't write MatcherCast<const T&> either, as that allows
- // potentially unsafe downcasting of the matcher argument.
- const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_);
- StringMatchResultListener listener;
- if (MatchPrintAndExplain(x, matcher, &listener))
- return AssertionSuccess();
-
- ::std::stringstream ss;
- ss << "Value of: " << value_text << "\n"
- << "Expected: ";
- matcher.DescribeTo(&ss);
- ss << "\n Actual: " << listener.str();
- return AssertionFailure() << ss.str();
- }
-
- private:
- const M matcher_;
-
- GTEST_DISALLOW_ASSIGN_(PredicateFormatterFromMatcher);
-};
-
-// A helper function for converting a matcher to a predicate-formatter
-// without the user needing to explicitly write the type. This is
-// used for implementing ASSERT_THAT() and EXPECT_THAT().
-// Implementation detail: 'matcher' is received by-value to force decaying.
-template <typename M>
-inline PredicateFormatterFromMatcher<M>
-MakePredicateFormatterFromMatcher(M matcher) {
- return PredicateFormatterFromMatcher<M>(internal::move(matcher));
-}
-
-// Implements the polymorphic floating point equality matcher, which matches
-// two float values using ULP-based approximation or, optionally, a
-// user-specified epsilon. The template is meant to be instantiated with
-// FloatType being either float or double.
-template <typename FloatType>
-class FloatingEqMatcher {
- public:
- // Constructor for FloatingEqMatcher.
- // The matcher's input will be compared with expected. The matcher treats two
- // NANs as equal if nan_eq_nan is true. Otherwise, under IEEE standards,
- // equality comparisons between NANs will always return false. We specify a
- // negative max_abs_error_ term to indicate that ULP-based approximation will
- // be used for comparison.
- FloatingEqMatcher(FloatType expected, bool nan_eq_nan) :
- expected_(expected), nan_eq_nan_(nan_eq_nan), max_abs_error_(-1) {
- }
-
- // Constructor that supports a user-specified max_abs_error that will be used
- // for comparison instead of ULP-based approximation. The max absolute
- // should be non-negative.
- FloatingEqMatcher(FloatType expected, bool nan_eq_nan,
- FloatType max_abs_error)
- : expected_(expected),
- nan_eq_nan_(nan_eq_nan),
- max_abs_error_(max_abs_error) {
- GTEST_CHECK_(max_abs_error >= 0)
- << ", where max_abs_error is" << max_abs_error;
- }
-
- // Implements floating point equality matcher as a Matcher<T>.
- template <typename T>
- class Impl : public MatcherInterface<T> {
- public:
- Impl(FloatType expected, bool nan_eq_nan, FloatType max_abs_error)
- : expected_(expected),
- nan_eq_nan_(nan_eq_nan),
- max_abs_error_(max_abs_error) {}
-
- virtual bool MatchAndExplain(T value,
- MatchResultListener* listener) const {
- const FloatingPoint<FloatType> actual(value), expected(expected_);
-
- // Compares NaNs first, if nan_eq_nan_ is true.
- if (actual.is_nan() || expected.is_nan()) {
- if (actual.is_nan() && expected.is_nan()) {
- return nan_eq_nan_;
- }
- // One is nan; the other is not nan.
- return false;
- }
- if (HasMaxAbsError()) {
- // We perform an equality check so that inf will match inf, regardless
- // of error bounds. If the result of value - expected_ would result in
- // overflow or if either value is inf, the default result is infinity,
- // which should only match if max_abs_error_ is also infinity.
- if (value == expected_) {
- return true;
- }
-
- const FloatType diff = value - expected_;
- if (fabs(diff) <= max_abs_error_) {
- return true;
- }
-
- if (listener->IsInterested()) {
- *listener << "which is " << diff << " from " << expected_;
- }
- return false;
- } else {
- return actual.AlmostEquals(expected);
- }
- }
-
- virtual void DescribeTo(::std::ostream* os) const {
- // os->precision() returns the previously set precision, which we
- // store to restore the ostream to its original configuration
- // after outputting.
- const ::std::streamsize old_precision = os->precision(
- ::std::numeric_limits<FloatType>::digits10 + 2);
- if (FloatingPoint<FloatType>(expected_).is_nan()) {
- if (nan_eq_nan_) {
- *os << "is NaN";
- } else {
- *os << "never matches";
- }
- } else {
- *os << "is approximately " << expected_;
- if (HasMaxAbsError()) {
- *os << " (absolute error <= " << max_abs_error_ << ")";
- }
- }
- os->precision(old_precision);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- // As before, get original precision.
- const ::std::streamsize old_precision = os->precision(
- ::std::numeric_limits<FloatType>::digits10 + 2);
- if (FloatingPoint<FloatType>(expected_).is_nan()) {
- if (nan_eq_nan_) {
- *os << "isn't NaN";
- } else {
- *os << "is anything";
- }
- } else {
- *os << "isn't approximately " << expected_;
- if (HasMaxAbsError()) {
- *os << " (absolute error > " << max_abs_error_ << ")";
- }
- }
- // Restore original precision.
- os->precision(old_precision);
- }
-
- private:
- bool HasMaxAbsError() const {
- return max_abs_error_ >= 0;
- }
-
- const FloatType expected_;
- const bool nan_eq_nan_;
- // max_abs_error will be used for value comparison when >= 0.
- const FloatType max_abs_error_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- // The following 3 type conversion operators allow FloatEq(expected) and
- // NanSensitiveFloatEq(expected) to be used as a Matcher<float>, a
- // Matcher<const float&>, or a Matcher<float&>, but nothing else.
- // (While Google's C++ coding style doesn't allow arguments passed
- // by non-const reference, we may see them in code not conforming to
- // the style. Therefore Google Mock needs to support them.)
- operator Matcher<FloatType>() const {
- return MakeMatcher(
- new Impl<FloatType>(expected_, nan_eq_nan_, max_abs_error_));
- }
-
- operator Matcher<const FloatType&>() const {
- return MakeMatcher(
- new Impl<const FloatType&>(expected_, nan_eq_nan_, max_abs_error_));
- }
-
- operator Matcher<FloatType&>() const {
- return MakeMatcher(
- new Impl<FloatType&>(expected_, nan_eq_nan_, max_abs_error_));
- }
-
- private:
- const FloatType expected_;
- const bool nan_eq_nan_;
- // max_abs_error will be used for value comparison when >= 0.
- const FloatType max_abs_error_;
-
- GTEST_DISALLOW_ASSIGN_(FloatingEqMatcher);
-};
-
-// Implements the Pointee(m) matcher for matching a pointer whose
-// pointee matches matcher m. The pointer can be either raw or smart.
-template <typename InnerMatcher>
-class PointeeMatcher {
- public:
- explicit PointeeMatcher(const InnerMatcher& matcher) : matcher_(matcher) {}
-
- // This type conversion operator template allows Pointee(m) to be
- // used as a matcher for any pointer type whose pointee type is
- // compatible with the inner matcher, where type Pointer can be
- // either a raw pointer or a smart pointer.
- //
- // The reason we do this instead of relying on
- // MakePolymorphicMatcher() is that the latter is not flexible
- // enough for implementing the DescribeTo() method of Pointee().
- template <typename Pointer>
- operator Matcher<Pointer>() const {
- return MakeMatcher(new Impl<Pointer>(matcher_));
- }
-
- private:
- // The monomorphic implementation that works for a particular pointer type.
- template <typename Pointer>
- class Impl : public MatcherInterface<Pointer> {
- public:
- typedef typename PointeeOf<GTEST_REMOVE_CONST_( // NOLINT
- GTEST_REMOVE_REFERENCE_(Pointer))>::type Pointee;
-
- explicit Impl(const InnerMatcher& matcher)
- : matcher_(MatcherCast<const Pointee&>(matcher)) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "points to a value that ";
- matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "does not point to a value that ";
- matcher_.DescribeTo(os);
- }
-
- virtual bool MatchAndExplain(Pointer pointer,
- MatchResultListener* listener) const {
- if (GetRawPointer(pointer) == NULL)
- return false;
-
- *listener << "which points to ";
- return MatchPrintAndExplain(*pointer, matcher_, listener);
- }
-
- private:
- const Matcher<const Pointee&> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- const InnerMatcher matcher_;
-
- GTEST_DISALLOW_ASSIGN_(PointeeMatcher);
-};
-
-// Implements the WhenDynamicCastTo<T>(m) matcher that matches a pointer or
-// reference that matches inner_matcher when dynamic_cast<T> is applied.
-// The result of dynamic_cast<To> is forwarded to the inner matcher.
-// If To is a pointer and the cast fails, the inner matcher will receive NULL.
-// If To is a reference and the cast fails, this matcher returns false
-// immediately.
-template <typename To>
-class WhenDynamicCastToMatcherBase {
- public:
- explicit WhenDynamicCastToMatcherBase(const Matcher<To>& matcher)
- : matcher_(matcher) {}
-
- void DescribeTo(::std::ostream* os) const {
- GetCastTypeDescription(os);
- matcher_.DescribeTo(os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- GetCastTypeDescription(os);
- matcher_.DescribeNegationTo(os);
- }
-
- protected:
- const Matcher<To> matcher_;
-
- static std::string GetToName() {
-#if GTEST_HAS_RTTI
- return GetTypeName<To>();
-#else // GTEST_HAS_RTTI
- return "the target type";
-#endif // GTEST_HAS_RTTI
- }
-
- private:
- static void GetCastTypeDescription(::std::ostream* os) {
- *os << "when dynamic_cast to " << GetToName() << ", ";
- }
-
- GTEST_DISALLOW_ASSIGN_(WhenDynamicCastToMatcherBase);
-};
-
-// Primary template.
-// To is a pointer. Cast and forward the result.
-template <typename To>
-class WhenDynamicCastToMatcher : public WhenDynamicCastToMatcherBase<To> {
- public:
- explicit WhenDynamicCastToMatcher(const Matcher<To>& matcher)
- : WhenDynamicCastToMatcherBase<To>(matcher) {}
-
- template <typename From>
- bool MatchAndExplain(From from, MatchResultListener* listener) const {
- // TODO(sbenza): Add more detail on failures. ie did the dyn_cast fail?
- To to = dynamic_cast<To>(from);
- return MatchPrintAndExplain(to, this->matcher_, listener);
- }
-};
-
-// Specialize for references.
-// In this case we return false if the dynamic_cast fails.
-template <typename To>
-class WhenDynamicCastToMatcher<To&> : public WhenDynamicCastToMatcherBase<To&> {
- public:
- explicit WhenDynamicCastToMatcher(const Matcher<To&>& matcher)
- : WhenDynamicCastToMatcherBase<To&>(matcher) {}
-
- template <typename From>
- bool MatchAndExplain(From& from, MatchResultListener* listener) const {
- // We don't want an std::bad_cast here, so do the cast with pointers.
- To* to = dynamic_cast<To*>(&from);
- if (to == NULL) {
- *listener << "which cannot be dynamic_cast to " << this->GetToName();
- return false;
- }
- return MatchPrintAndExplain(*to, this->matcher_, listener);
- }
-};
-
-// Implements the Field() matcher for matching a field (i.e. member
-// variable) of an object.
-template <typename Class, typename FieldType>
-class FieldMatcher {
- public:
- FieldMatcher(FieldType Class::*field,
- const Matcher<const FieldType&>& matcher)
- : field_(field), matcher_(matcher) {}
-
- void DescribeTo(::std::ostream* os) const {
- *os << "is an object whose given field ";
- matcher_.DescribeTo(os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "is an object whose given field ";
- matcher_.DescribeNegationTo(os);
- }
-
- template <typename T>
- bool MatchAndExplain(const T& value, MatchResultListener* listener) const {
- return MatchAndExplainImpl(
- typename ::testing::internal::
- is_pointer<GTEST_REMOVE_CONST_(T)>::type(),
- value, listener);
- }
-
- private:
- // The first argument of MatchAndExplainImpl() is needed to help
- // Symbian's C++ compiler choose which overload to use. Its type is
- // true_type iff the Field() matcher is used to match a pointer.
- bool MatchAndExplainImpl(false_type /* is_not_pointer */, const Class& obj,
- MatchResultListener* listener) const {
- *listener << "whose given field is ";
- return MatchPrintAndExplain(obj.*field_, matcher_, listener);
- }
-
- bool MatchAndExplainImpl(true_type /* is_pointer */, const Class* p,
- MatchResultListener* listener) const {
- if (p == NULL)
- return false;
-
- *listener << "which points to an object ";
- // Since *p has a field, it must be a class/struct/union type and
- // thus cannot be a pointer. Therefore we pass false_type() as
- // the first argument.
- return MatchAndExplainImpl(false_type(), *p, listener);
- }
-
- const FieldType Class::*field_;
- const Matcher<const FieldType&> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(FieldMatcher);
-};
-
-// Implements the Property() matcher for matching a property
-// (i.e. return value of a getter method) of an object.
-template <typename Class, typename PropertyType>
-class PropertyMatcher {
- public:
- // The property may have a reference type, so 'const PropertyType&'
- // may cause double references and fail to compile. That's why we
- // need GTEST_REFERENCE_TO_CONST, which works regardless of
- // PropertyType being a reference or not.
- typedef GTEST_REFERENCE_TO_CONST_(PropertyType) RefToConstProperty;
-
- PropertyMatcher(PropertyType (Class::*property)() const,
- const Matcher<RefToConstProperty>& matcher)
- : property_(property), matcher_(matcher) {}
-
- void DescribeTo(::std::ostream* os) const {
- *os << "is an object whose given property ";
- matcher_.DescribeTo(os);
- }
-
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "is an object whose given property ";
- matcher_.DescribeNegationTo(os);
- }
-
- template <typename T>
- bool MatchAndExplain(const T&value, MatchResultListener* listener) const {
- return MatchAndExplainImpl(
- typename ::testing::internal::
- is_pointer<GTEST_REMOVE_CONST_(T)>::type(),
- value, listener);
- }
-
- private:
- // The first argument of MatchAndExplainImpl() is needed to help
- // Symbian's C++ compiler choose which overload to use. Its type is
- // true_type iff the Property() matcher is used to match a pointer.
- bool MatchAndExplainImpl(false_type /* is_not_pointer */, const Class& obj,
- MatchResultListener* listener) const {
- *listener << "whose given property is ";
- // Cannot pass the return value (for example, int) to MatchPrintAndExplain,
- // which takes a non-const reference as argument.
-#if defined(_PREFAST_ ) && _MSC_VER == 1800
- // Workaround bug in VC++ 2013's /analyze parser.
- // https://connect.microsoft.com/VisualStudio/feedback/details/1106363/internal-compiler-error-with-analyze-due-to-failure-to-infer-move
- posix::Abort(); // To make sure it is never run.
- return false;
-#else
- RefToConstProperty result = (obj.*property_)();
- return MatchPrintAndExplain(result, matcher_, listener);
-#endif
- }
-
- bool MatchAndExplainImpl(true_type /* is_pointer */, const Class* p,
- MatchResultListener* listener) const {
- if (p == NULL)
- return false;
-
- *listener << "which points to an object ";
- // Since *p has a property method, it must be a class/struct/union
- // type and thus cannot be a pointer. Therefore we pass
- // false_type() as the first argument.
- return MatchAndExplainImpl(false_type(), *p, listener);
- }
-
- PropertyType (Class::*property_)() const;
- const Matcher<RefToConstProperty> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(PropertyMatcher);
-};
-
-// Type traits specifying various features of different functors for ResultOf.
-// The default template specifies features for functor objects.
-// Functor classes have to typedef argument_type and result_type
-// to be compatible with ResultOf.
-template <typename Functor>
-struct CallableTraits {
- typedef typename Functor::result_type ResultType;
- typedef Functor StorageType;
-
- static void CheckIsValid(Functor /* functor */) {}
- template <typename T>
- static ResultType Invoke(Functor f, T arg) { return f(arg); }
-};
-
-// Specialization for function pointers.
-template <typename ArgType, typename ResType>
-struct CallableTraits<ResType(*)(ArgType)> {
- typedef ResType ResultType;
- typedef ResType(*StorageType)(ArgType);
-
- static void CheckIsValid(ResType(*f)(ArgType)) {
- GTEST_CHECK_(f != NULL)
- << "NULL function pointer is passed into ResultOf().";
- }
- template <typename T>
- static ResType Invoke(ResType(*f)(ArgType), T arg) {
- return (*f)(arg);
- }
-};
-
-// Implements the ResultOf() matcher for matching a return value of a
-// unary function of an object.
-template <typename Callable>
-class ResultOfMatcher {
- public:
- typedef typename CallableTraits<Callable>::ResultType ResultType;
-
- ResultOfMatcher(Callable callable, const Matcher<ResultType>& matcher)
- : callable_(callable), matcher_(matcher) {
- CallableTraits<Callable>::CheckIsValid(callable_);
- }
-
- template <typename T>
- operator Matcher<T>() const {
- return Matcher<T>(new Impl<T>(callable_, matcher_));
- }
-
- private:
- typedef typename CallableTraits<Callable>::StorageType CallableStorageType;
-
- template <typename T>
- class Impl : public MatcherInterface<T> {
- public:
- Impl(CallableStorageType callable, const Matcher<ResultType>& matcher)
- : callable_(callable), matcher_(matcher) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "is mapped by the given callable to a value that ";
- matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "is mapped by the given callable to a value that ";
- matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(T obj, MatchResultListener* listener) const {
- *listener << "which is mapped by the given callable to ";
- // Cannot pass the return value (for example, int) to
- // MatchPrintAndExplain, which takes a non-const reference as argument.
- ResultType result =
- CallableTraits<Callable>::template Invoke<T>(callable_, obj);
- return MatchPrintAndExplain(result, matcher_, listener);
- }
-
- private:
- // Functors often define operator() as non-const method even though
- // they are actualy stateless. But we need to use them even when
- // 'this' is a const pointer. It's the user's responsibility not to
- // use stateful callables with ResultOf(), which does't guarantee
- // how many times the callable will be invoked.
- mutable CallableStorageType callable_;
- const Matcher<ResultType> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- }; // class Impl
-
- const CallableStorageType callable_;
- const Matcher<ResultType> matcher_;
-
- GTEST_DISALLOW_ASSIGN_(ResultOfMatcher);
-};
-
-// Implements a matcher that checks the size of an STL-style container.
-template <typename SizeMatcher>
-class SizeIsMatcher {
- public:
- explicit SizeIsMatcher(const SizeMatcher& size_matcher)
- : size_matcher_(size_matcher) {
- }
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(new Impl<Container>(size_matcher_));
- }
-
- template <typename Container>
- class Impl : public MatcherInterface<Container> {
- public:
- typedef internal::StlContainerView<
- GTEST_REMOVE_REFERENCE_AND_CONST_(Container)> ContainerView;
- typedef typename ContainerView::type::size_type SizeType;
- explicit Impl(const SizeMatcher& size_matcher)
- : size_matcher_(MatcherCast<SizeType>(size_matcher)) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "size ";
- size_matcher_.DescribeTo(os);
- }
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "size ";
- size_matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
- SizeType size = container.size();
- StringMatchResultListener size_listener;
- const bool result = size_matcher_.MatchAndExplain(size, &size_listener);
- *listener
- << "whose size " << size << (result ? " matches" : " doesn't match");
- PrintIfNotEmpty(size_listener.str(), listener->stream());
- return result;
- }
-
- private:
- const Matcher<SizeType> size_matcher_;
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- private:
- const SizeMatcher size_matcher_;
- GTEST_DISALLOW_ASSIGN_(SizeIsMatcher);
-};
-
-// Implements a matcher that checks the begin()..end() distance of an STL-style
-// container.
-template <typename DistanceMatcher>
-class BeginEndDistanceIsMatcher {
- public:
- explicit BeginEndDistanceIsMatcher(const DistanceMatcher& distance_matcher)
- : distance_matcher_(distance_matcher) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(new Impl<Container>(distance_matcher_));
- }
-
- template <typename Container>
- class Impl : public MatcherInterface<Container> {
- public:
- typedef internal::StlContainerView<
- GTEST_REMOVE_REFERENCE_AND_CONST_(Container)> ContainerView;
- typedef typename std::iterator_traits<
- typename ContainerView::type::const_iterator>::difference_type
- DistanceType;
- explicit Impl(const DistanceMatcher& distance_matcher)
- : distance_matcher_(MatcherCast<DistanceType>(distance_matcher)) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "distance between begin() and end() ";
- distance_matcher_.DescribeTo(os);
- }
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "distance between begin() and end() ";
- distance_matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
-#if GTEST_HAS_STD_BEGIN_AND_END_
- using std::begin;
- using std::end;
- DistanceType distance = std::distance(begin(container), end(container));
-#else
- DistanceType distance = std::distance(container.begin(), container.end());
-#endif
- StringMatchResultListener distance_listener;
- const bool result =
- distance_matcher_.MatchAndExplain(distance, &distance_listener);
- *listener << "whose distance between begin() and end() " << distance
- << (result ? " matches" : " doesn't match");
- PrintIfNotEmpty(distance_listener.str(), listener->stream());
- return result;
- }
-
- private:
- const Matcher<DistanceType> distance_matcher_;
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- private:
- const DistanceMatcher distance_matcher_;
- GTEST_DISALLOW_ASSIGN_(BeginEndDistanceIsMatcher);
-};
-
-// Implements an equality matcher for any STL-style container whose elements
-// support ==. This matcher is like Eq(), but its failure explanations provide
-// more detailed information that is useful when the container is used as a set.
-// The failure message reports elements that are in one of the operands but not
-// the other. The failure messages do not report duplicate or out-of-order
-// elements in the containers (which don't properly matter to sets, but can
-// occur if the containers are vectors or lists, for example).
-//
-// Uses the container's const_iterator, value_type, operator ==,
-// begin(), and end().
-template <typename Container>
-class ContainerEqMatcher {
- public:
- typedef internal::StlContainerView<Container> View;
- typedef typename View::type StlContainer;
- typedef typename View::const_reference StlContainerReference;
-
- // We make a copy of expected in case the elements in it are modified
- // after this matcher is created.
- explicit ContainerEqMatcher(const Container& expected)
- : expected_(View::Copy(expected)) {
- // Makes sure the user doesn't instantiate this class template
- // with a const or reference type.
- (void)testing::StaticAssertTypeEq<Container,
- GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>();
- }
-
- void DescribeTo(::std::ostream* os) const {
- *os << "equals ";
- UniversalPrint(expected_, os);
- }
- void DescribeNegationTo(::std::ostream* os) const {
- *os << "does not equal ";
- UniversalPrint(expected_, os);
- }
-
- template <typename LhsContainer>
- bool MatchAndExplain(const LhsContainer& lhs,
- MatchResultListener* listener) const {
- // GTEST_REMOVE_CONST_() is needed to work around an MSVC 8.0 bug
- // that causes LhsContainer to be a const type sometimes.
- typedef internal::StlContainerView<GTEST_REMOVE_CONST_(LhsContainer)>
- LhsView;
- typedef typename LhsView::type LhsStlContainer;
- StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
- if (lhs_stl_container == expected_)
- return true;
-
- ::std::ostream* const os = listener->stream();
- if (os != NULL) {
- // Something is different. Check for extra values first.
- bool printed_header = false;
- for (typename LhsStlContainer::const_iterator it =
- lhs_stl_container.begin();
- it != lhs_stl_container.end(); ++it) {
- if (internal::ArrayAwareFind(expected_.begin(), expected_.end(), *it) ==
- expected_.end()) {
- if (printed_header) {
- *os << ", ";
- } else {
- *os << "which has these unexpected elements: ";
- printed_header = true;
- }
- UniversalPrint(*it, os);
- }
- }
-
- // Now check for missing values.
- bool printed_header2 = false;
- for (typename StlContainer::const_iterator it = expected_.begin();
- it != expected_.end(); ++it) {
- if (internal::ArrayAwareFind(
- lhs_stl_container.begin(), lhs_stl_container.end(), *it) ==
- lhs_stl_container.end()) {
- if (printed_header2) {
- *os << ", ";
- } else {
- *os << (printed_header ? ",\nand" : "which")
- << " doesn't have these expected elements: ";
- printed_header2 = true;
- }
- UniversalPrint(*it, os);
- }
- }
- }
-
- return false;
- }
-
- private:
- const StlContainer expected_;
-
- GTEST_DISALLOW_ASSIGN_(ContainerEqMatcher);
-};
-
-// A comparator functor that uses the < operator to compare two values.
-struct LessComparator {
- template <typename T, typename U>
- bool operator()(const T& lhs, const U& rhs) const { return lhs < rhs; }
-};
-
-// Implements WhenSortedBy(comparator, container_matcher).
-template <typename Comparator, typename ContainerMatcher>
-class WhenSortedByMatcher {
- public:
- WhenSortedByMatcher(const Comparator& comparator,
- const ContainerMatcher& matcher)
- : comparator_(comparator), matcher_(matcher) {}
-
- template <typename LhsContainer>
- operator Matcher<LhsContainer>() const {
- return MakeMatcher(new Impl<LhsContainer>(comparator_, matcher_));
- }
-
- template <typename LhsContainer>
- class Impl : public MatcherInterface<LhsContainer> {
- public:
- typedef internal::StlContainerView<
- GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView;
- typedef typename LhsView::type LhsStlContainer;
- typedef typename LhsView::const_reference LhsStlContainerReference;
- // Transforms std::pair<const Key, Value> into std::pair<Key, Value>
- // so that we can match associative containers.
- typedef typename RemoveConstFromKey<
- typename LhsStlContainer::value_type>::type LhsValue;
-
- Impl(const Comparator& comparator, const ContainerMatcher& matcher)
- : comparator_(comparator), matcher_(matcher) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "(when sorted) ";
- matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "(when sorted) ";
- matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(LhsContainer lhs,
- MatchResultListener* listener) const {
- LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
- ::std::vector<LhsValue> sorted_container(lhs_stl_container.begin(),
- lhs_stl_container.end());
- ::std::sort(
- sorted_container.begin(), sorted_container.end(), comparator_);
-
- if (!listener->IsInterested()) {
- // If the listener is not interested, we do not need to
- // construct the inner explanation.
- return matcher_.Matches(sorted_container);
- }
-
- *listener << "which is ";
- UniversalPrint(sorted_container, listener->stream());
- *listener << " when sorted";
-
- StringMatchResultListener inner_listener;
- const bool match = matcher_.MatchAndExplain(sorted_container,
- &inner_listener);
- PrintIfNotEmpty(inner_listener.str(), listener->stream());
- return match;
- }
-
- private:
- const Comparator comparator_;
- const Matcher<const ::std::vector<LhsValue>&> matcher_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl);
- };
-
- private:
- const Comparator comparator_;
- const ContainerMatcher matcher_;
-
- GTEST_DISALLOW_ASSIGN_(WhenSortedByMatcher);
-};
-
-// Implements Pointwise(tuple_matcher, rhs_container). tuple_matcher
-// must be able to be safely cast to Matcher<tuple<const T1&, const
-// T2&> >, where T1 and T2 are the types of elements in the LHS
-// container and the RHS container respectively.
-template <typename TupleMatcher, typename RhsContainer>
-class PointwiseMatcher {
- public:
- typedef internal::StlContainerView<RhsContainer> RhsView;
- typedef typename RhsView::type RhsStlContainer;
- typedef typename RhsStlContainer::value_type RhsValue;
-
- // Like ContainerEq, we make a copy of rhs in case the elements in
- // it are modified after this matcher is created.
- PointwiseMatcher(const TupleMatcher& tuple_matcher, const RhsContainer& rhs)
- : tuple_matcher_(tuple_matcher), rhs_(RhsView::Copy(rhs)) {
- // Makes sure the user doesn't instantiate this class template
- // with a const or reference type.
- (void)testing::StaticAssertTypeEq<RhsContainer,
- GTEST_REMOVE_REFERENCE_AND_CONST_(RhsContainer)>();
- }
-
- template <typename LhsContainer>
- operator Matcher<LhsContainer>() const {
- return MakeMatcher(new Impl<LhsContainer>(tuple_matcher_, rhs_));
- }
-
- template <typename LhsContainer>
- class Impl : public MatcherInterface<LhsContainer> {
- public:
- typedef internal::StlContainerView<
- GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView;
- typedef typename LhsView::type LhsStlContainer;
- typedef typename LhsView::const_reference LhsStlContainerReference;
- typedef typename LhsStlContainer::value_type LhsValue;
- // We pass the LHS value and the RHS value to the inner matcher by
- // reference, as they may be expensive to copy. We must use tuple
- // instead of pair here, as a pair cannot hold references (C++ 98,
- // 20.2.2 [lib.pairs]).
- typedef ::testing::tuple<const LhsValue&, const RhsValue&> InnerMatcherArg;
-
- Impl(const TupleMatcher& tuple_matcher, const RhsStlContainer& rhs)
- // mono_tuple_matcher_ holds a monomorphic version of the tuple matcher.
- : mono_tuple_matcher_(SafeMatcherCast<InnerMatcherArg>(tuple_matcher)),
- rhs_(rhs) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "contains " << rhs_.size()
- << " values, where each value and its corresponding value in ";
- UniversalPrinter<RhsStlContainer>::Print(rhs_, os);
- *os << " ";
- mono_tuple_matcher_.DescribeTo(os);
- }
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't contain exactly " << rhs_.size()
- << " values, or contains a value x at some index i"
- << " where x and the i-th value of ";
- UniversalPrint(rhs_, os);
- *os << " ";
- mono_tuple_matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(LhsContainer lhs,
- MatchResultListener* listener) const {
- LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
- const size_t actual_size = lhs_stl_container.size();
- if (actual_size != rhs_.size()) {
- *listener << "which contains " << actual_size << " values";
- return false;
- }
-
- typename LhsStlContainer::const_iterator left = lhs_stl_container.begin();
- typename RhsStlContainer::const_iterator right = rhs_.begin();
- for (size_t i = 0; i != actual_size; ++i, ++left, ++right) {
- const InnerMatcherArg value_pair(*left, *right);
-
- if (listener->IsInterested()) {
- StringMatchResultListener inner_listener;
- if (!mono_tuple_matcher_.MatchAndExplain(
- value_pair, &inner_listener)) {
- *listener << "where the value pair (";
- UniversalPrint(*left, listener->stream());
- *listener << ", ";
- UniversalPrint(*right, listener->stream());
- *listener << ") at index #" << i << " don't match";
- PrintIfNotEmpty(inner_listener.str(), listener->stream());
- return false;
- }
- } else {
- if (!mono_tuple_matcher_.Matches(value_pair))
- return false;
- }
- }
-
- return true;
- }
-
- private:
- const Matcher<InnerMatcherArg> mono_tuple_matcher_;
- const RhsStlContainer rhs_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- private:
- const TupleMatcher tuple_matcher_;
- const RhsStlContainer rhs_;
-
- GTEST_DISALLOW_ASSIGN_(PointwiseMatcher);
-};
-
-// Holds the logic common to ContainsMatcherImpl and EachMatcherImpl.
-template <typename Container>
-class QuantifierMatcherImpl : public MatcherInterface<Container> {
- public:
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
- typedef StlContainerView<RawContainer> View;
- typedef typename View::type StlContainer;
- typedef typename View::const_reference StlContainerReference;
- typedef typename StlContainer::value_type Element;
-
- template <typename InnerMatcher>
- explicit QuantifierMatcherImpl(InnerMatcher inner_matcher)
- : inner_matcher_(
- testing::SafeMatcherCast<const Element&>(inner_matcher)) {}
-
- // Checks whether:
- // * All elements in the container match, if all_elements_should_match.
- // * Any element in the container matches, if !all_elements_should_match.
- bool MatchAndExplainImpl(bool all_elements_should_match,
- Container container,
- MatchResultListener* listener) const {
- StlContainerReference stl_container = View::ConstReference(container);
- size_t i = 0;
- for (typename StlContainer::const_iterator it = stl_container.begin();
- it != stl_container.end(); ++it, ++i) {
- StringMatchResultListener inner_listener;
- const bool matches = inner_matcher_.MatchAndExplain(*it, &inner_listener);
-
- if (matches != all_elements_should_match) {
- *listener << "whose element #" << i
- << (matches ? " matches" : " doesn't match");
- PrintIfNotEmpty(inner_listener.str(), listener->stream());
- return !all_elements_should_match;
- }
- }
- return all_elements_should_match;
- }
-
- protected:
- const Matcher<const Element&> inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(QuantifierMatcherImpl);
-};
-
-// Implements Contains(element_matcher) for the given argument type Container.
-// Symmetric to EachMatcherImpl.
-template <typename Container>
-class ContainsMatcherImpl : public QuantifierMatcherImpl<Container> {
- public:
- template <typename InnerMatcher>
- explicit ContainsMatcherImpl(InnerMatcher inner_matcher)
- : QuantifierMatcherImpl<Container>(inner_matcher) {}
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "contains at least one element that ";
- this->inner_matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't contain any element that ";
- this->inner_matcher_.DescribeTo(os);
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
- return this->MatchAndExplainImpl(false, container, listener);
- }
-
- private:
- GTEST_DISALLOW_ASSIGN_(ContainsMatcherImpl);
-};
-
-// Implements Each(element_matcher) for the given argument type Container.
-// Symmetric to ContainsMatcherImpl.
-template <typename Container>
-class EachMatcherImpl : public QuantifierMatcherImpl<Container> {
- public:
- template <typename InnerMatcher>
- explicit EachMatcherImpl(InnerMatcher inner_matcher)
- : QuantifierMatcherImpl<Container>(inner_matcher) {}
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "only contains elements that ";
- this->inner_matcher_.DescribeTo(os);
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "contains some element that ";
- this->inner_matcher_.DescribeNegationTo(os);
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
- return this->MatchAndExplainImpl(true, container, listener);
- }
-
- private:
- GTEST_DISALLOW_ASSIGN_(EachMatcherImpl);
-};
-
-// Implements polymorphic Contains(element_matcher).
-template <typename M>
-class ContainsMatcher {
- public:
- explicit ContainsMatcher(M m) : inner_matcher_(m) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(new ContainsMatcherImpl<Container>(inner_matcher_));
- }
-
- private:
- const M inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(ContainsMatcher);
-};
-
-// Implements polymorphic Each(element_matcher).
-template <typename M>
-class EachMatcher {
- public:
- explicit EachMatcher(M m) : inner_matcher_(m) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(new EachMatcherImpl<Container>(inner_matcher_));
- }
-
- private:
- const M inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(EachMatcher);
-};
-
-// Implements Key(inner_matcher) for the given argument pair type.
-// Key(inner_matcher) matches an std::pair whose 'first' field matches
-// inner_matcher. For example, Contains(Key(Ge(5))) can be used to match an
-// std::map that contains at least one element whose key is >= 5.
-template <typename PairType>
-class KeyMatcherImpl : public MatcherInterface<PairType> {
- public:
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(PairType) RawPairType;
- typedef typename RawPairType::first_type KeyType;
-
- template <typename InnerMatcher>
- explicit KeyMatcherImpl(InnerMatcher inner_matcher)
- : inner_matcher_(
- testing::SafeMatcherCast<const KeyType&>(inner_matcher)) {
- }
-
- // Returns true iff 'key_value.first' (the key) matches the inner matcher.
- virtual bool MatchAndExplain(PairType key_value,
- MatchResultListener* listener) const {
- StringMatchResultListener inner_listener;
- const bool match = inner_matcher_.MatchAndExplain(key_value.first,
- &inner_listener);
- const std::string explanation = inner_listener.str();
- if (explanation != "") {
- *listener << "whose first field is a value " << explanation;
- }
- return match;
- }
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "has a key that ";
- inner_matcher_.DescribeTo(os);
- }
-
- // Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "doesn't have a key that ";
- inner_matcher_.DescribeTo(os);
- }
-
- private:
- const Matcher<const KeyType&> inner_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(KeyMatcherImpl);
-};
-
-// Implements polymorphic Key(matcher_for_key).
-template <typename M>
-class KeyMatcher {
- public:
- explicit KeyMatcher(M m) : matcher_for_key_(m) {}
-
- template <typename PairType>
- operator Matcher<PairType>() const {
- return MakeMatcher(new KeyMatcherImpl<PairType>(matcher_for_key_));
- }
-
- private:
- const M matcher_for_key_;
-
- GTEST_DISALLOW_ASSIGN_(KeyMatcher);
-};
-
-// Implements Pair(first_matcher, second_matcher) for the given argument pair
-// type with its two matchers. See Pair() function below.
-template <typename PairType>
-class PairMatcherImpl : public MatcherInterface<PairType> {
- public:
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(PairType) RawPairType;
- typedef typename RawPairType::first_type FirstType;
- typedef typename RawPairType::second_type SecondType;
-
- template <typename FirstMatcher, typename SecondMatcher>
- PairMatcherImpl(FirstMatcher first_matcher, SecondMatcher second_matcher)
- : first_matcher_(
- testing::SafeMatcherCast<const FirstType&>(first_matcher)),
- second_matcher_(
- testing::SafeMatcherCast<const SecondType&>(second_matcher)) {
- }
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "has a first field that ";
- first_matcher_.DescribeTo(os);
- *os << ", and has a second field that ";
- second_matcher_.DescribeTo(os);
- }
-
- // Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "has a first field that ";
- first_matcher_.DescribeNegationTo(os);
- *os << ", or has a second field that ";
- second_matcher_.DescribeNegationTo(os);
- }
-
- // Returns true iff 'a_pair.first' matches first_matcher and 'a_pair.second'
- // matches second_matcher.
- virtual bool MatchAndExplain(PairType a_pair,
- MatchResultListener* listener) const {
- if (!listener->IsInterested()) {
- // If the listener is not interested, we don't need to construct the
- // explanation.
- return first_matcher_.Matches(a_pair.first) &&
- second_matcher_.Matches(a_pair.second);
- }
- StringMatchResultListener first_inner_listener;
- if (!first_matcher_.MatchAndExplain(a_pair.first,
- &first_inner_listener)) {
- *listener << "whose first field does not match";
- PrintIfNotEmpty(first_inner_listener.str(), listener->stream());
- return false;
- }
- StringMatchResultListener second_inner_listener;
- if (!second_matcher_.MatchAndExplain(a_pair.second,
- &second_inner_listener)) {
- *listener << "whose second field does not match";
- PrintIfNotEmpty(second_inner_listener.str(), listener->stream());
- return false;
- }
- ExplainSuccess(first_inner_listener.str(), second_inner_listener.str(),
- listener);
- return true;
- }
-
- private:
- void ExplainSuccess(const std::string& first_explanation,
- const std::string& second_explanation,
- MatchResultListener* listener) const {
- *listener << "whose both fields match";
- if (first_explanation != "") {
- *listener << ", where the first field is a value " << first_explanation;
- }
- if (second_explanation != "") {
- *listener << ", ";
- if (first_explanation != "") {
- *listener << "and ";
- } else {
- *listener << "where ";
- }
- *listener << "the second field is a value " << second_explanation;
- }
- }
-
- const Matcher<const FirstType&> first_matcher_;
- const Matcher<const SecondType&> second_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(PairMatcherImpl);
-};
-
-// Implements polymorphic Pair(first_matcher, second_matcher).
-template <typename FirstMatcher, typename SecondMatcher>
-class PairMatcher {
- public:
- PairMatcher(FirstMatcher first_matcher, SecondMatcher second_matcher)
- : first_matcher_(first_matcher), second_matcher_(second_matcher) {}
-
- template <typename PairType>
- operator Matcher<PairType> () const {
- return MakeMatcher(
- new PairMatcherImpl<PairType>(
- first_matcher_, second_matcher_));
- }
-
- private:
- const FirstMatcher first_matcher_;
- const SecondMatcher second_matcher_;
-
- GTEST_DISALLOW_ASSIGN_(PairMatcher);
-};
-
-// Implements ElementsAre() and ElementsAreArray().
-template <typename Container>
-class ElementsAreMatcherImpl : public MatcherInterface<Container> {
- public:
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
- typedef internal::StlContainerView<RawContainer> View;
- typedef typename View::type StlContainer;
- typedef typename View::const_reference StlContainerReference;
- typedef typename StlContainer::value_type Element;
-
- // Constructs the matcher from a sequence of element values or
- // element matchers.
- template <typename InputIter>
- ElementsAreMatcherImpl(InputIter first, InputIter last) {
- while (first != last) {
- matchers_.push_back(MatcherCast<const Element&>(*first++));
- }
- }
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- if (count() == 0) {
- *os << "is empty";
- } else if (count() == 1) {
- *os << "has 1 element that ";
- matchers_[0].DescribeTo(os);
- } else {
- *os << "has " << Elements(count()) << " where\n";
- for (size_t i = 0; i != count(); ++i) {
- *os << "element #" << i << " ";
- matchers_[i].DescribeTo(os);
- if (i + 1 < count()) {
- *os << ",\n";
- }
- }
- }
- }
-
- // Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
- if (count() == 0) {
- *os << "isn't empty";
- return;
- }
-
- *os << "doesn't have " << Elements(count()) << ", or\n";
- for (size_t i = 0; i != count(); ++i) {
- *os << "element #" << i << " ";
- matchers_[i].DescribeNegationTo(os);
- if (i + 1 < count()) {
- *os << ", or\n";
- }
- }
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
- // To work with stream-like "containers", we must only walk
- // through the elements in one pass.
-
- const bool listener_interested = listener->IsInterested();
-
- // explanations[i] is the explanation of the element at index i.
- ::std::vector<std::string> explanations(count());
- StlContainerReference stl_container = View::ConstReference(container);
- typename StlContainer::const_iterator it = stl_container.begin();
- size_t exam_pos = 0;
- bool mismatch_found = false; // Have we found a mismatched element yet?
-
- // Go through the elements and matchers in pairs, until we reach
- // the end of either the elements or the matchers, or until we find a
- // mismatch.
- for (; it != stl_container.end() && exam_pos != count(); ++it, ++exam_pos) {
- bool match; // Does the current element match the current matcher?
- if (listener_interested) {
- StringMatchResultListener s;
- match = matchers_[exam_pos].MatchAndExplain(*it, &s);
- explanations[exam_pos] = s.str();
- } else {
- match = matchers_[exam_pos].Matches(*it);
- }
-
- if (!match) {
- mismatch_found = true;
- break;
- }
- }
- // If mismatch_found is true, 'exam_pos' is the index of the mismatch.
-
- // Find how many elements the actual container has. We avoid
- // calling size() s.t. this code works for stream-like "containers"
- // that don't define size().
- size_t actual_count = exam_pos;
- for (; it != stl_container.end(); ++it) {
- ++actual_count;
- }
-
- if (actual_count != count()) {
- // The element count doesn't match. If the container is empty,
- // there's no need to explain anything as Google Mock already
- // prints the empty container. Otherwise we just need to show
- // how many elements there actually are.
- if (listener_interested && (actual_count != 0)) {
- *listener << "which has " << Elements(actual_count);
- }
- return false;
- }
-
- if (mismatch_found) {
- // The element count matches, but the exam_pos-th element doesn't match.
- if (listener_interested) {
- *listener << "whose element #" << exam_pos << " doesn't match";
- PrintIfNotEmpty(explanations[exam_pos], listener->stream());
- }
- return false;
- }
-
- // Every element matches its expectation. We need to explain why
- // (the obvious ones can be skipped).
- if (listener_interested) {
- bool reason_printed = false;
- for (size_t i = 0; i != count(); ++i) {
- const std::string& s = explanations[i];
- if (!s.empty()) {
- if (reason_printed) {
- *listener << ",\nand ";
- }
- *listener << "whose element #" << i << " matches, " << s;
- reason_printed = true;
- }
- }
- }
- return true;
- }
-
- private:
- static Message Elements(size_t count) {
- return Message() << count << (count == 1 ? " element" : " elements");
- }
-
- size_t count() const { return matchers_.size(); }
-
- ::std::vector<Matcher<const Element&> > matchers_;
-
- GTEST_DISALLOW_ASSIGN_(ElementsAreMatcherImpl);
-};
-
-// Connectivity matrix of (elements X matchers), in element-major order.
-// Initially, there are no edges.
-// Use NextGraph() to iterate over all possible edge configurations.
-// Use Randomize() to generate a random edge configuration.
-class GTEST_API_ MatchMatrix {
- public:
- MatchMatrix(size_t num_elements, size_t num_matchers)
- : num_elements_(num_elements),
- num_matchers_(num_matchers),
- matched_(num_elements_* num_matchers_, 0) {
- }
-
- size_t LhsSize() const { return num_elements_; }
- size_t RhsSize() const { return num_matchers_; }
- bool HasEdge(size_t ilhs, size_t irhs) const {
- return matched_[SpaceIndex(ilhs, irhs)] == 1;
- }
- void SetEdge(size_t ilhs, size_t irhs, bool b) {
- matched_[SpaceIndex(ilhs, irhs)] = b ? 1 : 0;
- }
-
- // Treating the connectivity matrix as a (LhsSize()*RhsSize())-bit number,
- // adds 1 to that number; returns false if incrementing the graph left it
- // empty.
- bool NextGraph();
-
- void Randomize();
-
- std::string DebugString() const;
-
- private:
- size_t SpaceIndex(size_t ilhs, size_t irhs) const {
- return ilhs * num_matchers_ + irhs;
- }
-
- size_t num_elements_;
- size_t num_matchers_;
-
- // Each element is a char interpreted as bool. They are stored as a
- // flattened array in lhs-major order, use 'SpaceIndex()' to translate
- // a (ilhs, irhs) matrix coordinate into an offset.
- ::std::vector<char> matched_;
-};
-
-typedef ::std::pair<size_t, size_t> ElementMatcherPair;
-typedef ::std::vector<ElementMatcherPair> ElementMatcherPairs;
-
-// Returns a maximum bipartite matching for the specified graph 'g'.
-// The matching is represented as a vector of {element, matcher} pairs.
-GTEST_API_ ElementMatcherPairs
-FindMaxBipartiteMatching(const MatchMatrix& g);
-
-GTEST_API_ bool FindPairing(const MatchMatrix& matrix,
- MatchResultListener* listener);
-
-// Untyped base class for implementing UnorderedElementsAre. By
-// putting logic that's not specific to the element type here, we
-// reduce binary bloat and increase compilation speed.
-class GTEST_API_ UnorderedElementsAreMatcherImplBase {
- protected:
- // A vector of matcher describers, one for each element matcher.
- // Does not own the describers (and thus can be used only when the
- // element matchers are alive).
- typedef ::std::vector<const MatcherDescriberInterface*> MatcherDescriberVec;
-
- // Describes this UnorderedElementsAre matcher.
- void DescribeToImpl(::std::ostream* os) const;
-
- // Describes the negation of this UnorderedElementsAre matcher.
- void DescribeNegationToImpl(::std::ostream* os) const;
-
- bool VerifyAllElementsAndMatchersAreMatched(
- const ::std::vector<std::string>& element_printouts,
- const MatchMatrix& matrix, MatchResultListener* listener) const;
-
- MatcherDescriberVec& matcher_describers() {
- return matcher_describers_;
- }
-
- static Message Elements(size_t n) {
- return Message() << n << " element" << (n == 1 ? "" : "s");
- }
-
- private:
- MatcherDescriberVec matcher_describers_;
-
- GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcherImplBase);
-};
-
-// Implements unordered ElementsAre and unordered ElementsAreArray.
-template <typename Container>
-class UnorderedElementsAreMatcherImpl
- : public MatcherInterface<Container>,
- public UnorderedElementsAreMatcherImplBase {
- public:
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
- typedef internal::StlContainerView<RawContainer> View;
- typedef typename View::type StlContainer;
- typedef typename View::const_reference StlContainerReference;
- typedef typename StlContainer::const_iterator StlContainerConstIterator;
- typedef typename StlContainer::value_type Element;
-
- // Constructs the matcher from a sequence of element values or
- // element matchers.
- template <typename InputIter>
- UnorderedElementsAreMatcherImpl(InputIter first, InputIter last) {
- for (; first != last; ++first) {
- matchers_.push_back(MatcherCast<const Element&>(*first));
- matcher_describers().push_back(matchers_.back().GetDescriber());
- }
- }
-
- // Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
- return UnorderedElementsAreMatcherImplBase::DescribeToImpl(os);
- }
-
- // Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
- return UnorderedElementsAreMatcherImplBase::DescribeNegationToImpl(os);
- }
-
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
- StlContainerReference stl_container = View::ConstReference(container);
- ::std::vector<std::string> element_printouts;
- MatchMatrix matrix = AnalyzeElements(stl_container.begin(),
- stl_container.end(),
- &element_printouts,
- listener);
-
- const size_t actual_count = matrix.LhsSize();
- if (actual_count == 0 && matchers_.empty()) {
- return true;
- }
- if (actual_count != matchers_.size()) {
- // The element count doesn't match. If the container is empty,
- // there's no need to explain anything as Google Mock already
- // prints the empty container. Otherwise we just need to show
- // how many elements there actually are.
- if (actual_count != 0 && listener->IsInterested()) {
- *listener << "which has " << Elements(actual_count);
- }
- return false;
- }
-
- return VerifyAllElementsAndMatchersAreMatched(element_printouts,
- matrix, listener) &&
- FindPairing(matrix, listener);
- }
-
- private:
- typedef ::std::vector<Matcher<const Element&> > MatcherVec;
-
- template <typename ElementIter>
- MatchMatrix AnalyzeElements(ElementIter elem_first, ElementIter elem_last,
- ::std::vector<std::string>* element_printouts,
- MatchResultListener* listener) const {
- element_printouts->clear();
- ::std::vector<char> did_match;
- size_t num_elements = 0;
- for (; elem_first != elem_last; ++num_elements, ++elem_first) {
- if (listener->IsInterested()) {
- element_printouts->push_back(PrintToString(*elem_first));
- }
- for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) {
- did_match.push_back(Matches(matchers_[irhs])(*elem_first));
- }
- }
-
- MatchMatrix matrix(num_elements, matchers_.size());
- ::std::vector<char>::const_iterator did_match_iter = did_match.begin();
- for (size_t ilhs = 0; ilhs != num_elements; ++ilhs) {
- for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) {
- matrix.SetEdge(ilhs, irhs, *did_match_iter++ != 0);
- }
- }
- return matrix;
- }
-
- MatcherVec matchers_;
-
- GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcherImpl);
-};
-
-// Functor for use in TransformTuple.
-// Performs MatcherCast<Target> on an input argument of any type.
-template <typename Target>
-struct CastAndAppendTransform {
- template <typename Arg>
- Matcher<Target> operator()(const Arg& a) const {
- return MatcherCast<Target>(a);
- }
-};
-
-// Implements UnorderedElementsAre.
-template <typename MatcherTuple>
-class UnorderedElementsAreMatcher {
- public:
- explicit UnorderedElementsAreMatcher(const MatcherTuple& args)
- : matchers_(args) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
- typedef typename internal::StlContainerView<RawContainer>::type View;
- typedef typename View::value_type Element;
- typedef ::std::vector<Matcher<const Element&> > MatcherVec;
- MatcherVec matchers;
- matchers.reserve(::testing::tuple_size<MatcherTuple>::value);
- TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_,
- ::std::back_inserter(matchers));
- return MakeMatcher(new UnorderedElementsAreMatcherImpl<Container>(
- matchers.begin(), matchers.end()));
- }
-
- private:
- const MatcherTuple matchers_;
- GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcher);
-};
-
-// Implements ElementsAre.
-template <typename MatcherTuple>
-class ElementsAreMatcher {
- public:
- explicit ElementsAreMatcher(const MatcherTuple& args) : matchers_(args) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
- typedef typename internal::StlContainerView<RawContainer>::type View;
- typedef typename View::value_type Element;
- typedef ::std::vector<Matcher<const Element&> > MatcherVec;
- MatcherVec matchers;
- matchers.reserve(::testing::tuple_size<MatcherTuple>::value);
- TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_,
- ::std::back_inserter(matchers));
- return MakeMatcher(new ElementsAreMatcherImpl<Container>(
- matchers.begin(), matchers.end()));
- }
-
- private:
- const MatcherTuple matchers_;
- GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher);
-};
-
-// Implements UnorderedElementsAreArray().
-template <typename T>
-class UnorderedElementsAreArrayMatcher {
- public:
- UnorderedElementsAreArrayMatcher() {}
-
- template <typename Iter>
- UnorderedElementsAreArrayMatcher(Iter first, Iter last)
- : matchers_(first, last) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(
- new UnorderedElementsAreMatcherImpl<Container>(matchers_.begin(),
- matchers_.end()));
- }
-
- private:
- ::std::vector<T> matchers_;
-
- GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreArrayMatcher);
-};
-
-// Implements ElementsAreArray().
-template <typename T>
-class ElementsAreArrayMatcher {
- public:
- template <typename Iter>
- ElementsAreArrayMatcher(Iter first, Iter last) : matchers_(first, last) {}
-
- template <typename Container>
- operator Matcher<Container>() const {
- return MakeMatcher(new ElementsAreMatcherImpl<Container>(
- matchers_.begin(), matchers_.end()));
- }
-
- private:
- const ::std::vector<T> matchers_;
-
- GTEST_DISALLOW_ASSIGN_(ElementsAreArrayMatcher);
-};
-
-// Given a 2-tuple matcher tm of type Tuple2Matcher and a value second
-// of type Second, BoundSecondMatcher<Tuple2Matcher, Second>(tm,
-// second) is a polymorphic matcher that matches a value x iff tm
-// matches tuple (x, second). Useful for implementing
-// UnorderedPointwise() in terms of UnorderedElementsAreArray().
-//
-// BoundSecondMatcher is copyable and assignable, as we need to put
-// instances of this class in a vector when implementing
-// UnorderedPointwise().
-template <typename Tuple2Matcher, typename Second>
-class BoundSecondMatcher {
- public:
- BoundSecondMatcher(const Tuple2Matcher& tm, const Second& second)
- : tuple2_matcher_(tm), second_value_(second) {}
-
- template <typename T>
- operator Matcher<T>() const {
- return MakeMatcher(new Impl<T>(tuple2_matcher_, second_value_));
- }
-
- // We have to define this for UnorderedPointwise() to compile in
- // C++98 mode, as it puts BoundSecondMatcher instances in a vector,
- // which requires the elements to be assignable in C++98. The
- // compiler cannot generate the operator= for us, as Tuple2Matcher
- // and Second may not be assignable.
- //
- // However, this should never be called, so the implementation just
- // need to assert.
- void operator=(const BoundSecondMatcher& /*rhs*/) {
- GTEST_LOG_(FATAL) << "BoundSecondMatcher should never be assigned.";
- }
-
- private:
- template <typename T>
- class Impl : public MatcherInterface<T> {
- public:
- typedef ::testing::tuple<T, Second> ArgTuple;
-
- Impl(const Tuple2Matcher& tm, const Second& second)
- : mono_tuple2_matcher_(SafeMatcherCast<const ArgTuple&>(tm)),
- second_value_(second) {}
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "and ";
- UniversalPrint(second_value_, os);
- *os << " ";
- mono_tuple2_matcher_.DescribeTo(os);
- }
-
- virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
- return mono_tuple2_matcher_.MatchAndExplain(ArgTuple(x, second_value_),
- listener);
- }
-
- private:
- const Matcher<const ArgTuple&> mono_tuple2_matcher_;
- const Second second_value_;
-
- GTEST_DISALLOW_ASSIGN_(Impl);
- };
-
- const Tuple2Matcher tuple2_matcher_;
- const Second second_value_;
-};
-
-// Given a 2-tuple matcher tm and a value second,
-// MatcherBindSecond(tm, second) returns a matcher that matches a
-// value x iff tm matches tuple (x, second). Useful for implementing
-// UnorderedPointwise() in terms of UnorderedElementsAreArray().
-template <typename Tuple2Matcher, typename Second>
-BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond(
- const Tuple2Matcher& tm, const Second& second) {
- return BoundSecondMatcher<Tuple2Matcher, Second>(tm, second);
-}
-
-// Returns the description for a matcher defined using the MATCHER*()
-// macro where the user-supplied description string is "", if
-// 'negation' is false; otherwise returns the description of the
-// negation of the matcher. 'param_values' contains a list of strings
-// that are the print-out of the matcher's parameters.
-GTEST_API_ std::string FormatMatcherDescription(bool negation,
- const char* matcher_name,
- const Strings& param_values);
-
-} // namespace internal
-
-// ElementsAreArray(first, last)
-// ElementsAreArray(pointer, count)
-// ElementsAreArray(array)
-// ElementsAreArray(container)
-// ElementsAreArray({ e1, e2, ..., en })
-//
-// The ElementsAreArray() functions are like ElementsAre(...), except
-// that they are given a homogeneous sequence rather than taking each
-// element as a function argument. The sequence can be specified as an
-// array, a pointer and count, a vector, an initializer list, or an
-// STL iterator range. In each of these cases, the underlying sequence
-// can be either a sequence of values or a sequence of matchers.
-//
-// All forms of ElementsAreArray() make a copy of the input matcher sequence.
-
-template <typename Iter>
-inline internal::ElementsAreArrayMatcher<
- typename ::std::iterator_traits<Iter>::value_type>
-ElementsAreArray(Iter first, Iter last) {
- typedef typename ::std::iterator_traits<Iter>::value_type T;
- return internal::ElementsAreArrayMatcher<T>(first, last);
-}
-
-template <typename T>
-inline internal::ElementsAreArrayMatcher<T> ElementsAreArray(
- const T* pointer, size_t count) {
- return ElementsAreArray(pointer, pointer + count);
-}
-
-template <typename T, size_t N>
-inline internal::ElementsAreArrayMatcher<T> ElementsAreArray(
- const T (&array)[N]) {
- return ElementsAreArray(array, N);
-}
-
-template <typename Container>
-inline internal::ElementsAreArrayMatcher<typename Container::value_type>
-ElementsAreArray(const Container& container) {
- return ElementsAreArray(container.begin(), container.end());
-}
-
-#if GTEST_HAS_STD_INITIALIZER_LIST_
-template <typename T>
-inline internal::ElementsAreArrayMatcher<T>
-ElementsAreArray(::std::initializer_list<T> xs) {
- return ElementsAreArray(xs.begin(), xs.end());
-}
-#endif
-
-// UnorderedElementsAreArray(first, last)
-// UnorderedElementsAreArray(pointer, count)
-// UnorderedElementsAreArray(array)
-// UnorderedElementsAreArray(container)
-// UnorderedElementsAreArray({ e1, e2, ..., en })
-//
-// The UnorderedElementsAreArray() functions are like
-// ElementsAreArray(...), but allow matching the elements in any order.
-template <typename Iter>
-inline internal::UnorderedElementsAreArrayMatcher<
- typename ::std::iterator_traits<Iter>::value_type>
-UnorderedElementsAreArray(Iter first, Iter last) {
- typedef typename ::std::iterator_traits<Iter>::value_type T;
- return internal::UnorderedElementsAreArrayMatcher<T>(first, last);
-}
-
-template <typename T>
-inline internal::UnorderedElementsAreArrayMatcher<T>
-UnorderedElementsAreArray(const T* pointer, size_t count) {
- return UnorderedElementsAreArray(pointer, pointer + count);
-}
-
-template <typename T, size_t N>
-inline internal::UnorderedElementsAreArrayMatcher<T>
-UnorderedElementsAreArray(const T (&array)[N]) {
- return UnorderedElementsAreArray(array, N);
-}
-
-template <typename Container>
-inline internal::UnorderedElementsAreArrayMatcher<
- typename Container::value_type>
-UnorderedElementsAreArray(const Container& container) {
- return UnorderedElementsAreArray(container.begin(), container.end());
-}
-
-#if GTEST_HAS_STD_INITIALIZER_LIST_
-template <typename T>
-inline internal::UnorderedElementsAreArrayMatcher<T>
-UnorderedElementsAreArray(::std::initializer_list<T> xs) {
- return UnorderedElementsAreArray(xs.begin(), xs.end());
-}
-#endif
-
-// _ is a matcher that matches anything of any type.
-//
-// This definition is fine as:
-//
-// 1. The C++ standard permits using the name _ in a namespace that
-// is not the global namespace or ::std.
-// 2. The AnythingMatcher class has no data member or constructor,
-// so it's OK to create global variables of this type.
-// 3. c-style has approved of using _ in this case.
-const internal::AnythingMatcher _ = {};
-// Creates a matcher that matches any value of the given type T.
-template <typename T>
-inline Matcher<T> A() { return MakeMatcher(new internal::AnyMatcherImpl<T>()); }
-
-// Creates a matcher that matches any value of the given type T.
-template <typename T>
-inline Matcher<T> An() { return A<T>(); }
-
-// Creates a polymorphic matcher that matches anything equal to x.
-// Note: if the parameter of Eq() were declared as const T&, Eq("foo")
-// wouldn't compile.
-template <typename T>
-inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); }
-
-// Constructs a Matcher<T> from a 'value' of type T. The constructed
-// matcher matches any value that's equal to 'value'.
-template <typename T>
-Matcher<T>::Matcher(T value) { *this = Eq(value); }
-
-// Creates a monomorphic matcher that matches anything with type Lhs
-// and equal to rhs. A user may need to use this instead of Eq(...)
-// in order to resolve an overloading ambiguity.
-//
-// TypedEq<T>(x) is just a convenient short-hand for Matcher<T>(Eq(x))
-// or Matcher<T>(x), but more readable than the latter.
-//
-// We could define similar monomorphic matchers for other comparison
-// operations (e.g. TypedLt, TypedGe, and etc), but decided not to do
-// it yet as those are used much less than Eq() in practice. A user
-// can always write Matcher<T>(Lt(5)) to be explicit about the type,
-// for example.
-template <typename Lhs, typename Rhs>
-inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
-
-// Creates a polymorphic matcher that matches anything >= x.
-template <typename Rhs>
-inline internal::GeMatcher<Rhs> Ge(Rhs x) {
- return internal::GeMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything > x.
-template <typename Rhs>
-inline internal::GtMatcher<Rhs> Gt(Rhs x) {
- return internal::GtMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything <= x.
-template <typename Rhs>
-inline internal::LeMatcher<Rhs> Le(Rhs x) {
- return internal::LeMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything < x.
-template <typename Rhs>
-inline internal::LtMatcher<Rhs> Lt(Rhs x) {
- return internal::LtMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches anything != x.
-template <typename Rhs>
-inline internal::NeMatcher<Rhs> Ne(Rhs x) {
- return internal::NeMatcher<Rhs>(x);
-}
-
-// Creates a polymorphic matcher that matches any NULL pointer.
-inline PolymorphicMatcher<internal::IsNullMatcher > IsNull() {
- return MakePolymorphicMatcher(internal::IsNullMatcher());
-}
-
-// Creates a polymorphic matcher that matches any non-NULL pointer.
-// This is convenient as Not(NULL) doesn't compile (the compiler
-// thinks that that expression is comparing a pointer with an integer).
-inline PolymorphicMatcher<internal::NotNullMatcher > NotNull() {
- return MakePolymorphicMatcher(internal::NotNullMatcher());
-}
-
-// Creates a polymorphic matcher that matches any argument that
-// references variable x.
-template <typename T>
-inline internal::RefMatcher<T&> Ref(T& x) { // NOLINT
- return internal::RefMatcher<T&>(x);
-}
-
-// Creates a matcher that matches any double argument approximately
-// equal to rhs, where two NANs are considered unequal.
-inline internal::FloatingEqMatcher<double> DoubleEq(double rhs) {
- return internal::FloatingEqMatcher<double>(rhs, false);
-}
-
-// Creates a matcher that matches any double argument approximately
-// equal to rhs, including NaN values when rhs is NaN.
-inline internal::FloatingEqMatcher<double> NanSensitiveDoubleEq(double rhs) {
- return internal::FloatingEqMatcher<double>(rhs, true);
-}
-
-// Creates a matcher that matches any double argument approximately equal to
-// rhs, up to the specified max absolute error bound, where two NANs are
-// considered unequal. The max absolute error bound must be non-negative.
-inline internal::FloatingEqMatcher<double> DoubleNear(
- double rhs, double max_abs_error) {
- return internal::FloatingEqMatcher<double>(rhs, false, max_abs_error);
-}
-
-// Creates a matcher that matches any double argument approximately equal to
-// rhs, up to the specified max absolute error bound, including NaN values when
-// rhs is NaN. The max absolute error bound must be non-negative.
-inline internal::FloatingEqMatcher<double> NanSensitiveDoubleNear(
- double rhs, double max_abs_error) {
- return internal::FloatingEqMatcher<double>(rhs, true, max_abs_error);
-}
-
-// Creates a matcher that matches any float argument approximately
-// equal to rhs, where two NANs are considered unequal.
-inline internal::FloatingEqMatcher<float> FloatEq(float rhs) {
- return internal::FloatingEqMatcher<float>(rhs, false);
-}
-
-// Creates a matcher that matches any float argument approximately
-// equal to rhs, including NaN values when rhs is NaN.
-inline internal::FloatingEqMatcher<float> NanSensitiveFloatEq(float rhs) {
- return internal::FloatingEqMatcher<float>(rhs, true);
-}
-
-// Creates a matcher that matches any float argument approximately equal to
-// rhs, up to the specified max absolute error bound, where two NANs are
-// considered unequal. The max absolute error bound must be non-negative.
-inline internal::FloatingEqMatcher<float> FloatNear(
- float rhs, float max_abs_error) {
- return internal::FloatingEqMatcher<float>(rhs, false, max_abs_error);
-}
-
-// Creates a matcher that matches any float argument approximately equal to
-// rhs, up to the specified max absolute error bound, including NaN values when
-// rhs is NaN. The max absolute error bound must be non-negative.
-inline internal::FloatingEqMatcher<float> NanSensitiveFloatNear(
- float rhs, float max_abs_error) {
- return internal::FloatingEqMatcher<float>(rhs, true, max_abs_error);
-}
-
-// Creates a matcher that matches a pointer (raw or smart) that points
-// to a value that matches inner_matcher.
-template <typename InnerMatcher>
-inline internal::PointeeMatcher<InnerMatcher> Pointee(
- const InnerMatcher& inner_matcher) {
- return internal::PointeeMatcher<InnerMatcher>(inner_matcher);
-}
-
-// Creates a matcher that matches a pointer or reference that matches
-// inner_matcher when dynamic_cast<To> is applied.
-// The result of dynamic_cast<To> is forwarded to the inner matcher.
-// If To is a pointer and the cast fails, the inner matcher will receive NULL.
-// If To is a reference and the cast fails, this matcher returns false
-// immediately.
-template <typename To>
-inline PolymorphicMatcher<internal::WhenDynamicCastToMatcher<To> >
-WhenDynamicCastTo(const Matcher<To>& inner_matcher) {
- return MakePolymorphicMatcher(
- internal::WhenDynamicCastToMatcher<To>(inner_matcher));
-}
-
-// Creates a matcher that matches an object whose given field matches
-// 'matcher'. For example,
-// Field(&Foo::number, Ge(5))
-// matches a Foo object x iff x.number >= 5.
-template <typename Class, typename FieldType, typename FieldMatcher>
-inline PolymorphicMatcher<
- internal::FieldMatcher<Class, FieldType> > Field(
- FieldType Class::*field, const FieldMatcher& matcher) {
- return MakePolymorphicMatcher(
- internal::FieldMatcher<Class, FieldType>(
- field, MatcherCast<const FieldType&>(matcher)));
- // The call to MatcherCast() is required for supporting inner
- // matchers of compatible types. For example, it allows
- // Field(&Foo::bar, m)
- // to compile where bar is an int32 and m is a matcher for int64.
-}
-
-// Creates a matcher that matches an object whose given property
-// matches 'matcher'. For example,
-// Property(&Foo::str, StartsWith("hi"))
-// matches a Foo object x iff x.str() starts with "hi".
-template <typename Class, typename PropertyType, typename PropertyMatcher>
-inline PolymorphicMatcher<
- internal::PropertyMatcher<Class, PropertyType> > Property(
- PropertyType (Class::*property)() const, const PropertyMatcher& matcher) {
- return MakePolymorphicMatcher(
- internal::PropertyMatcher<Class, PropertyType>(
- property,
- MatcherCast<GTEST_REFERENCE_TO_CONST_(PropertyType)>(matcher)));
- // The call to MatcherCast() is required for supporting inner
- // matchers of compatible types. For example, it allows
- // Property(&Foo::bar, m)
- // to compile where bar() returns an int32 and m is a matcher for int64.
-}
-
-// Creates a matcher that matches an object iff the result of applying
-// a callable to x matches 'matcher'.
-// For example,
-// ResultOf(f, StartsWith("hi"))
-// matches a Foo object x iff f(x) starts with "hi".
-// callable parameter can be a function, function pointer, or a functor.
-// Callable has to satisfy the following conditions:
-// * It is required to keep no state affecting the results of
-// the calls on it and make no assumptions about how many calls
-// will be made. Any state it keeps must be protected from the
-// concurrent access.
-// * If it is a function object, it has to define type result_type.
-// We recommend deriving your functor classes from std::unary_function.
-template <typename Callable, typename ResultOfMatcher>
-internal::ResultOfMatcher<Callable> ResultOf(
- Callable callable, const ResultOfMatcher& matcher) {
- return internal::ResultOfMatcher<Callable>(
- callable,
- MatcherCast<typename internal::CallableTraits<Callable>::ResultType>(
- matcher));
- // The call to MatcherCast() is required for supporting inner
- // matchers of compatible types. For example, it allows
- // ResultOf(Function, m)
- // to compile where Function() returns an int32 and m is a matcher for int64.
-}
-
-// String matchers.
-
-// Matches a string equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrEq(
- const std::string& str) {
- return MakePolymorphicMatcher(
- internal::StrEqualityMatcher<std::string>(str, true, true));
-}
-
-// Matches a string not equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrNe(
- const std::string& str) {
- return MakePolymorphicMatcher(
- internal::StrEqualityMatcher<std::string>(str, false, true));
-}
-
-// Matches a string equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrCaseEq(
- const std::string& str) {
- return MakePolymorphicMatcher(
- internal::StrEqualityMatcher<std::string>(str, true, false));
-}
-
-// Matches a string not equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrCaseNe(
- const std::string& str) {
- return MakePolymorphicMatcher(
- internal::StrEqualityMatcher<std::string>(str, false, false));
-}
-
-// Creates a matcher that matches any string, std::string, or C string
-// that contains the given substring.
-inline PolymorphicMatcher<internal::HasSubstrMatcher<std::string> > HasSubstr(
- const std::string& substring) {
- return MakePolymorphicMatcher(
- internal::HasSubstrMatcher<std::string>(substring));
-}
-
-// Matches a string that starts with 'prefix' (case-sensitive).
-inline PolymorphicMatcher<internal::StartsWithMatcher<std::string> > StartsWith(
- const std::string& prefix) {
- return MakePolymorphicMatcher(
- internal::StartsWithMatcher<std::string>(prefix));
-}
-
-// Matches a string that ends with 'suffix' (case-sensitive).
-inline PolymorphicMatcher<internal::EndsWithMatcher<std::string> > EndsWith(
- const std::string& suffix) {
- return MakePolymorphicMatcher(internal::EndsWithMatcher<std::string>(suffix));
-}
-
-// Matches a string that fully matches regular expression 'regex'.
-// The matcher takes ownership of 'regex'.
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
- const internal::RE* regex) {
- return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
-}
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
- const std::string& regex) {
- return MatchesRegex(new internal::RE(regex));
-}
-
-// Matches a string that contains regular expression 'regex'.
-// The matcher takes ownership of 'regex'.
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
- const internal::RE* regex) {
- return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
-}
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
- const std::string& regex) {
- return ContainsRegex(new internal::RE(regex));
-}
-
-#if GTEST_HAS_GLOBAL_WSTRING || GTEST_HAS_STD_WSTRING
-// Wide string matchers.
-
-// Matches a string equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
- StrEq(const internal::wstring& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
- str, true, true));
-}
-
-// Matches a string not equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
- StrNe(const internal::wstring& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
- str, false, true));
-}
-
-// Matches a string equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
- StrCaseEq(const internal::wstring& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
- str, true, false));
-}
-
-// Matches a string not equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> >
- StrCaseNe(const internal::wstring& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>(
- str, false, false));
-}
-
-// Creates a matcher that matches any wstring, std::wstring, or C wide string
-// that contains the given substring.
-inline PolymorphicMatcher<internal::HasSubstrMatcher<internal::wstring> >
- HasSubstr(const internal::wstring& substring) {
- return MakePolymorphicMatcher(internal::HasSubstrMatcher<internal::wstring>(
- substring));
-}
-
-// Matches a string that starts with 'prefix' (case-sensitive).
-inline PolymorphicMatcher<internal::StartsWithMatcher<internal::wstring> >
- StartsWith(const internal::wstring& prefix) {
- return MakePolymorphicMatcher(internal::StartsWithMatcher<internal::wstring>(
- prefix));
-}
-
-// Matches a string that ends with 'suffix' (case-sensitive).
-inline PolymorphicMatcher<internal::EndsWithMatcher<internal::wstring> >
- EndsWith(const internal::wstring& suffix) {
- return MakePolymorphicMatcher(internal::EndsWithMatcher<internal::wstring>(
- suffix));
-}
-
-#endif // GTEST_HAS_GLOBAL_WSTRING || GTEST_HAS_STD_WSTRING
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field == the second field.
-inline internal::Eq2Matcher Eq() { return internal::Eq2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field >= the second field.
-inline internal::Ge2Matcher Ge() { return internal::Ge2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field > the second field.
-inline internal::Gt2Matcher Gt() { return internal::Gt2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field <= the second field.
-inline internal::Le2Matcher Le() { return internal::Le2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field < the second field.
-inline internal::Lt2Matcher Lt() { return internal::Lt2Matcher(); }
-
-// Creates a polymorphic matcher that matches a 2-tuple where the
-// first field != the second field.
-inline internal::Ne2Matcher Ne() { return internal::Ne2Matcher(); }
-
-// Creates a matcher that matches any value of type T that m doesn't
-// match.
-template <typename InnerMatcher>
-inline internal::NotMatcher<InnerMatcher> Not(InnerMatcher m) {
- return internal::NotMatcher<InnerMatcher>(m);
-}
-
-// Returns a matcher that matches anything that satisfies the given
-// predicate. The predicate can be any unary function or functor
-// whose return type can be implicitly converted to bool.
-template <typename Predicate>
-inline PolymorphicMatcher<internal::TrulyMatcher<Predicate> >
-Truly(Predicate pred) {
- return MakePolymorphicMatcher(internal::TrulyMatcher<Predicate>(pred));
-}
-
-// Returns a matcher that matches the container size. The container must
-// support both size() and size_type which all STL-like containers provide.
-// Note that the parameter 'size' can be a value of type size_type as well as
-// matcher. For instance:
-// EXPECT_THAT(container, SizeIs(2)); // Checks container has 2 elements.
-// EXPECT_THAT(container, SizeIs(Le(2)); // Checks container has at most 2.
-template <typename SizeMatcher>
-inline internal::SizeIsMatcher<SizeMatcher>
-SizeIs(const SizeMatcher& size_matcher) {
- return internal::SizeIsMatcher<SizeMatcher>(size_matcher);
-}
-
-// Returns a matcher that matches the distance between the container's begin()
-// iterator and its end() iterator, i.e. the size of the container. This matcher
-// can be used instead of SizeIs with containers such as std::forward_list which
-// do not implement size(). The container must provide const_iterator (with
-// valid iterator_traits), begin() and end().
-template <typename DistanceMatcher>
-inline internal::BeginEndDistanceIsMatcher<DistanceMatcher>
-BeginEndDistanceIs(const DistanceMatcher& distance_matcher) {
- return internal::BeginEndDistanceIsMatcher<DistanceMatcher>(distance_matcher);
-}
-
-// Returns a matcher that matches an equal container.
-// This matcher behaves like Eq(), but in the event of mismatch lists the
-// values that are included in one container but not the other. (Duplicate
-// values and order differences are not explained.)
-template <typename Container>
-inline PolymorphicMatcher<internal::ContainerEqMatcher< // NOLINT
- GTEST_REMOVE_CONST_(Container)> >
- ContainerEq(const Container& rhs) {
- // This following line is for working around a bug in MSVC 8.0,
- // which causes Container to be a const type sometimes.
- typedef GTEST_REMOVE_CONST_(Container) RawContainer;
- return MakePolymorphicMatcher(
- internal::ContainerEqMatcher<RawContainer>(rhs));
-}
-
-// Returns a matcher that matches a container that, when sorted using
-// the given comparator, matches container_matcher.
-template <typename Comparator, typename ContainerMatcher>
-inline internal::WhenSortedByMatcher<Comparator, ContainerMatcher>
-WhenSortedBy(const Comparator& comparator,
- const ContainerMatcher& container_matcher) {
- return internal::WhenSortedByMatcher<Comparator, ContainerMatcher>(
- comparator, container_matcher);
-}
-
-// Returns a matcher that matches a container that, when sorted using
-// the < operator, matches container_matcher.
-template <typename ContainerMatcher>
-inline internal::WhenSortedByMatcher<internal::LessComparator, ContainerMatcher>
-WhenSorted(const ContainerMatcher& container_matcher) {
- return
- internal::WhenSortedByMatcher<internal::LessComparator, ContainerMatcher>(
- internal::LessComparator(), container_matcher);
-}
-
-// Matches an STL-style container or a native array that contains the
-// same number of elements as in rhs, where its i-th element and rhs's
-// i-th element (as a pair) satisfy the given pair matcher, for all i.
-// TupleMatcher must be able to be safely cast to Matcher<tuple<const
-// T1&, const T2&> >, where T1 and T2 are the types of elements in the
-// LHS container and the RHS container respectively.
-template <typename TupleMatcher, typename Container>
-inline internal::PointwiseMatcher<TupleMatcher,
- GTEST_REMOVE_CONST_(Container)>
-Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) {
- // This following line is for working around a bug in MSVC 8.0,
- // which causes Container to be a const type sometimes (e.g. when
- // rhs is a const int[])..
- typedef GTEST_REMOVE_CONST_(Container) RawContainer;
- return internal::PointwiseMatcher<TupleMatcher, RawContainer>(
- tuple_matcher, rhs);
-}
-
-#if GTEST_HAS_STD_INITIALIZER_LIST_
-
-// Supports the Pointwise(m, {a, b, c}) syntax.
-template <typename TupleMatcher, typename T>
-inline internal::PointwiseMatcher<TupleMatcher, std::vector<T> > Pointwise(
- const TupleMatcher& tuple_matcher, std::initializer_list<T> rhs) {
- return Pointwise(tuple_matcher, std::vector<T>(rhs));
-}
-
-#endif // GTEST_HAS_STD_INITIALIZER_LIST_
-
-// UnorderedPointwise(pair_matcher, rhs) matches an STL-style
-// container or a native array that contains the same number of
-// elements as in rhs, where in some permutation of the container, its
-// i-th element and rhs's i-th element (as a pair) satisfy the given
-// pair matcher, for all i. Tuple2Matcher must be able to be safely
-// cast to Matcher<tuple<const T1&, const T2&> >, where T1 and T2 are
-// the types of elements in the LHS container and the RHS container
-// respectively.
-//
-// This is like Pointwise(pair_matcher, rhs), except that the element
-// order doesn't matter.
-template <typename Tuple2Matcher, typename RhsContainer>
-inline internal::UnorderedElementsAreArrayMatcher<
- typename internal::BoundSecondMatcher<
- Tuple2Matcher, typename internal::StlContainerView<GTEST_REMOVE_CONST_(
- RhsContainer)>::type::value_type> >
-UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
- const RhsContainer& rhs_container) {
- // This following line is for working around a bug in MSVC 8.0,
- // which causes RhsContainer to be a const type sometimes (e.g. when
- // rhs_container is a const int[]).
- typedef GTEST_REMOVE_CONST_(RhsContainer) RawRhsContainer;
-
- // RhsView allows the same code to handle RhsContainer being a
- // STL-style container and it being a native C-style array.
- typedef typename internal::StlContainerView<RawRhsContainer> RhsView;
- typedef typename RhsView::type RhsStlContainer;
- typedef typename RhsStlContainer::value_type Second;
- const RhsStlContainer& rhs_stl_container =
- RhsView::ConstReference(rhs_container);
-
- // Create a matcher for each element in rhs_container.
- ::std::vector<internal::BoundSecondMatcher<Tuple2Matcher, Second> > matchers;
- for (typename RhsStlContainer::const_iterator it = rhs_stl_container.begin();
- it != rhs_stl_container.end(); ++it) {
- matchers.push_back(
- internal::MatcherBindSecond(tuple2_matcher, *it));
- }
-
- // Delegate the work to UnorderedElementsAreArray().
- return UnorderedElementsAreArray(matchers);
-}
-
-#if GTEST_HAS_STD_INITIALIZER_LIST_
-
-// Supports the UnorderedPointwise(m, {a, b, c}) syntax.
-template <typename Tuple2Matcher, typename T>
-inline internal::UnorderedElementsAreArrayMatcher<
- typename internal::BoundSecondMatcher<Tuple2Matcher, T> >
-UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
- std::initializer_list<T> rhs) {
- return UnorderedPointwise(tuple2_matcher, std::vector<T>(rhs));
-}
-
-#endif // GTEST_HAS_STD_INITIALIZER_LIST_
-
-// Matches an STL-style container or a native array that contains at
-// least one element matching the given value or matcher.
-//
-// Examples:
-// ::std::set<int> page_ids;
-// page_ids.insert(3);
-// page_ids.insert(1);
-// EXPECT_THAT(page_ids, Contains(1));
-// EXPECT_THAT(page_ids, Contains(Gt(2)));
-// EXPECT_THAT(page_ids, Not(Contains(4)));
-//
-// ::std::map<int, size_t> page_lengths;
-// page_lengths[1] = 100;
-// EXPECT_THAT(page_lengths,
-// Contains(::std::pair<const int, size_t>(1, 100)));
-//
-// const char* user_ids[] = { "joe", "mike", "tom" };
-// EXPECT_THAT(user_ids, Contains(Eq(::std::string("tom"))));
-template <typename M>
-inline internal::ContainsMatcher<M> Contains(M matcher) {
- return internal::ContainsMatcher<M>(matcher);
-}
-
-// Matches an STL-style container or a native array that contains only
-// elements matching the given value or matcher.
-//
-// Each(m) is semantically equivalent to Not(Contains(Not(m))). Only
-// the messages are different.
-//
-// Examples:
-// ::std::set<int> page_ids;
-// // Each(m) matches an empty container, regardless of what m is.
-// EXPECT_THAT(page_ids, Each(Eq(1)));
-// EXPECT_THAT(page_ids, Each(Eq(77)));
-//
-// page_ids.insert(3);
-// EXPECT_THAT(page_ids, Each(Gt(0)));
-// EXPECT_THAT(page_ids, Not(Each(Gt(4))));
-// page_ids.insert(1);
-// EXPECT_THAT(page_ids, Not(Each(Lt(2))));
-//
-// ::std::map<int, size_t> page_lengths;
-// page_lengths[1] = 100;
-// page_lengths[2] = 200;
-// page_lengths[3] = 300;
-// EXPECT_THAT(page_lengths, Not(Each(Pair(1, 100))));
-// EXPECT_THAT(page_lengths, Each(Key(Le(3))));
-//
-// const char* user_ids[] = { "joe", "mike", "tom" };
-// EXPECT_THAT(user_ids, Not(Each(Eq(::std::string("tom")))));
-template <typename M>
-inline internal::EachMatcher<M> Each(M matcher) {
- return internal::EachMatcher<M>(matcher);
-}
-
-// Key(inner_matcher) matches an std::pair whose 'first' field matches
-// inner_matcher. For example, Contains(Key(Ge(5))) can be used to match an
-// std::map that contains at least one element whose key is >= 5.
-template <typename M>
-inline internal::KeyMatcher<M> Key(M inner_matcher) {
- return internal::KeyMatcher<M>(inner_matcher);
-}
-
-// Pair(first_matcher, second_matcher) matches a std::pair whose 'first' field
-// matches first_matcher and whose 'second' field matches second_matcher. For
-// example, EXPECT_THAT(map_type, ElementsAre(Pair(Ge(5), "foo"))) can be used
-// to match a std::map<int, string> that contains exactly one element whose key
-// is >= 5 and whose value equals "foo".
-template <typename FirstMatcher, typename SecondMatcher>
-inline internal::PairMatcher<FirstMatcher, SecondMatcher>
-Pair(FirstMatcher first_matcher, SecondMatcher second_matcher) {
- return internal::PairMatcher<FirstMatcher, SecondMatcher>(
- first_matcher, second_matcher);
-}
-
-// Returns a predicate that is satisfied by anything that matches the
-// given matcher.
-template <typename M>
-inline internal::MatcherAsPredicate<M> Matches(M matcher) {
- return internal::MatcherAsPredicate<M>(matcher);
-}
-
-// Returns true iff the value matches the matcher.
-template <typename T, typename M>
-inline bool Value(const T& value, M matcher) {
- return testing::Matches(matcher)(value);
-}
-
-// Matches the value against the given matcher and explains the match
-// result to listener.
-template <typename T, typename M>
-inline bool ExplainMatchResult(
- M matcher, const T& value, MatchResultListener* listener) {
- return SafeMatcherCast<const T&>(matcher).MatchAndExplain(value, listener);
-}
-
-#if GTEST_LANG_CXX11
-// Define variadic matcher versions. They are overloaded in
-// gmock-generated-matchers.h for the cases supported by pre C++11 compilers.
-template <typename... Args>
-inline internal::AllOfMatcher<Args...> AllOf(const Args&... matchers) {
- return internal::AllOfMatcher<Args...>(matchers...);
-}
-
-template <typename... Args>
-inline internal::AnyOfMatcher<Args...> AnyOf(const Args&... matchers) {
- return internal::AnyOfMatcher<Args...>(matchers...);
-}
-
-#endif // GTEST_LANG_CXX11
-
-// AllArgs(m) is a synonym of m. This is useful in
-//
-// EXPECT_CALL(foo, Bar(_, _)).With(AllArgs(Eq()));
-//
-// which is easier to read than
-//
-// EXPECT_CALL(foo, Bar(_, _)).With(Eq());
-template <typename InnerMatcher>
-inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; }
-
-// These macros allow using matchers to check values in Google Test
-// tests. ASSERT_THAT(value, matcher) and EXPECT_THAT(value, matcher)
-// succeed iff the value matches the matcher. If the assertion fails,
-// the value and the description of the matcher will be printed.
-#define ASSERT_THAT(value, matcher) ASSERT_PRED_FORMAT1(\
- ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value)
-#define EXPECT_THAT(value, matcher) EXPECT_PRED_FORMAT1(\
- ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value)
-
-} // namespace testing
-
-// Include any custom callback matchers 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-matchers.h"
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
diff --git a/src/lib/install/include/gmock/gmock-more-actions.h b/src/lib/install/include/gmock/gmock-more-actions.h
deleted file mode 100755
index 3d387b6..0000000
--- a/src/lib/install/include/gmock/gmock-more-actions.h
+++ /dev/null
@@ -1,246 +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 actions that depend on gmock-generated-actions.h.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
-
-#include <algorithm>
-
-#include "gmock/gmock-generated-actions.h"
-
-namespace testing {
-namespace internal {
-
-// Implements the Invoke(f) action. The template argument
-// FunctionImpl is the implementation type of f, which can be either a
-// function pointer or a functor. Invoke(f) can be used as an
-// Action<F> as long as f's type is compatible with F (i.e. f can be
-// assigned to a tr1::function<F>).
-template <typename FunctionImpl>
-class InvokeAction {
- public:
- // The c'tor makes a copy of function_impl (either a function
- // pointer or a functor).
- explicit InvokeAction(FunctionImpl function_impl)
- : function_impl_(function_impl) {}
-
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple& args) {
- return InvokeHelper<Result, ArgumentTuple>::Invoke(function_impl_, args);
- }
-
- private:
- FunctionImpl function_impl_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeAction);
-};
-
-// Implements the Invoke(object_ptr, &Class::Method) action.
-template <class Class, typename MethodPtr>
-class InvokeMethodAction {
- public:
- InvokeMethodAction(Class* obj_ptr, MethodPtr method_ptr)
- : method_ptr_(method_ptr), obj_ptr_(obj_ptr) {}
-
- template <typename Result, typename ArgumentTuple>
- Result Perform(const ArgumentTuple& args) const {
- return InvokeHelper<Result, ArgumentTuple>::InvokeMethod(
- obj_ptr_, method_ptr_, args);
- }
-
- private:
- // The order of these members matters. Reversing the order can trigger
- // warning C4121 in MSVC (see
- // http://computer-programming-forum.com/7-vc.net/6fbc30265f860ad1.htm ).
- const MethodPtr method_ptr_;
- Class* const obj_ptr_;
-
- GTEST_DISALLOW_ASSIGN_(InvokeMethodAction);
-};
-
-// An internal replacement for std::copy which mimics its behavior. This is
-// necessary because Visual Studio deprecates ::std::copy, issuing warning 4996.
-// However Visual Studio 2010 and later do not honor #pragmas which disable that
-// warning.
-template<typename InputIterator, typename OutputIterator>
-inline OutputIterator CopyElements(InputIterator first,
- InputIterator last,
- OutputIterator output) {
- for (; first != last; ++first, ++output) {
- *output = *first;
- }
- return output;
-}
-
-} // namespace internal
-
-// Various overloads for Invoke().
-
-// Creates an action that invokes 'function_impl' with the mock
-// function's arguments.
-template <typename FunctionImpl>
-PolymorphicAction<internal::InvokeAction<FunctionImpl> > Invoke(
- FunctionImpl function_impl) {
- return MakePolymorphicAction(
- internal::InvokeAction<FunctionImpl>(function_impl));
-}
-
-// Creates an action that invokes the given method on the given object
-// with the mock function's arguments.
-template <class Class, typename MethodPtr>
-PolymorphicAction<internal::InvokeMethodAction<Class, MethodPtr> > Invoke(
- Class* obj_ptr, MethodPtr method_ptr) {
- return MakePolymorphicAction(
- internal::InvokeMethodAction<Class, MethodPtr>(obj_ptr, method_ptr));
-}
-
-// WithoutArgs(inner_action) can be used in a mock function with a
-// non-empty argument list to perform inner_action, which takes no
-// argument. In other words, it adapts an action accepting no
-// argument to one that accepts (and ignores) arguments.
-template <typename InnerAction>
-inline internal::WithArgsAction<InnerAction>
-WithoutArgs(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction>(action);
-}
-
-// WithArg<k>(an_action) creates an action that passes the k-th
-// (0-based) argument of the mock function to an_action and performs
-// it. It adapts an action accepting one argument to one that accepts
-// multiple arguments. For convenience, we also provide
-// WithArgs<k>(an_action) (defined below) as a synonym.
-template <int k, typename InnerAction>
-inline internal::WithArgsAction<InnerAction, k>
-WithArg(const InnerAction& action) {
- return internal::WithArgsAction<InnerAction, k>(action);
-}
-
-// 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
-
-// Action ReturnArg<k>() returns the k-th argument of the mock function.
-ACTION_TEMPLATE(ReturnArg,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_0_VALUE_PARAMS()) {
- return ::testing::get<k>(args);
-}
-
-// Action SaveArg<k>(pointer) saves the k-th (0-based) argument of the
-// mock function to *pointer.
-ACTION_TEMPLATE(SaveArg,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_1_VALUE_PARAMS(pointer)) {
- *pointer = ::testing::get<k>(args);
-}
-
-// Action SaveArgPointee<k>(pointer) saves the value pointed to
-// by the k-th (0-based) argument of the mock function to *pointer.
-ACTION_TEMPLATE(SaveArgPointee,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_1_VALUE_PARAMS(pointer)) {
- *pointer = *::testing::get<k>(args);
-}
-
-// Action SetArgReferee<k>(value) assigns 'value' to the variable
-// referenced by the k-th (0-based) argument of the mock function.
-ACTION_TEMPLATE(SetArgReferee,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_1_VALUE_PARAMS(value)) {
- typedef typename ::testing::tuple_element<k, args_type>::type argk_type;
- // Ensures that argument #k is a reference. If you get a compiler
- // error on the next line, you are using SetArgReferee<k>(value) in
- // a mock function whose k-th (0-based) argument is not a reference.
- GTEST_COMPILE_ASSERT_(internal::is_reference<argk_type>::value,
- SetArgReferee_must_be_used_with_a_reference_argument);
- ::testing::get<k>(args) = value;
-}
-
-// Action SetArrayArgument<k>(first, last) copies the elements in
-// source range [first, last) to the array pointed to by the k-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.
-ACTION_TEMPLATE(SetArrayArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_2_VALUE_PARAMS(first, last)) {
- // Visual Studio deprecates ::std::copy, so we use our own copy in that case.
-#ifdef _MSC_VER
- internal::CopyElements(first, last, ::testing::get<k>(args));
-#else
- ::std::copy(first, last, ::testing::get<k>(args));
-#endif
-}
-
-// Action DeleteArg<k>() deletes the k-th (0-based) argument of the mock
-// function.
-ACTION_TEMPLATE(DeleteArg,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_0_VALUE_PARAMS()) {
- delete ::testing::get<k>(args);
-}
-
-// This action returns the value pointed to by 'pointer'.
-ACTION_P(ReturnPointee, pointer) { return *pointer; }
-
-// Action Throw(exception) can be used in a mock function of any type
-// to throw the given exception. Any copyable value can be thrown.
-#if GTEST_HAS_EXCEPTIONS
-
-// Suppresses the 'unreachable code' warning that VC generates in opt modes.
-# ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4702) // Temporarily disables warning 4702.
-# endif
-ACTION_P(Throw, exception) { throw exception; }
-# ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-# endif
-
-#endif // GTEST_HAS_EXCEPTIONS
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
diff --git a/src/lib/install/include/gmock/gmock-more-matchers.h b/src/lib/install/include/gmock/gmock-more-matchers.h
deleted file mode 100755
index 3db899f..0000000
--- a/src/lib/install/include/gmock/gmock-more-matchers.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2013, 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: marcus.boerger@google.com (Marcus Boerger)
-
-// Google Mock - a framework for writing C++ mock classes.
-//
-// This file implements some matchers that depend on gmock-generated-matchers.h.
-//
-// Note that tests are implemented in gmock-matchers_test.cc rather than
-// gmock-more-matchers-test.cc.
-
-#ifndef GMOCK_GMOCK_MORE_MATCHERS_H_
-#define GMOCK_GMOCK_MORE_MATCHERS_H_
-
-#include "gmock/gmock-generated-matchers.h"
-
-namespace testing {
-
-// Defines a matcher that matches an empty container. The container must
-// support both size() and empty(), which all STL-like containers provide.
-MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
- if (arg.empty()) {
- return true;
- }
- *result_listener << "whose size is " << arg.size();
- return false;
-}
-
-} // namespace testing
-
-#endif // GMOCK_GMOCK_MORE_MATCHERS_H_
diff --git a/src/lib/install/include/gmock/gmock-spec-builders.h b/src/lib/install/include/gmock/gmock-spec-builders.h
deleted file mode 100755
index 39f7212..0000000
--- a/src/lib/install/include/gmock/gmock-spec-builders.h
+++ /dev/null
@@ -1,1850 +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 the ON_CALL() and EXPECT_CALL() macros.
-//
-// A user can use the ON_CALL() macro to specify the default action of
-// a mock method. The syntax is:
-//
-// ON_CALL(mock_object, Method(argument-matchers))
-// .With(multi-argument-matcher)
-// .WillByDefault(action);
-//
-// where the .With() clause is optional.
-//
-// A user can use the EXPECT_CALL() macro to specify an expectation on
-// a mock method. The syntax is:
-//
-// EXPECT_CALL(mock_object, Method(argument-matchers))
-// .With(multi-argument-matchers)
-// .Times(cardinality)
-// .InSequence(sequences)
-// .After(expectations)
-// .WillOnce(action)
-// .WillRepeatedly(action)
-// .RetiresOnSaturation();
-//
-// where all clauses are optional, and .InSequence()/.After()/
-// .WillOnce() can appear any number of times.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
-
-#include <map>
-#include <set>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#if GTEST_HAS_EXCEPTIONS
-# include <stdexcept> // NOLINT
-#endif
-
-#include "gmock/gmock-actions.h"
-#include "gmock/gmock-cardinalities.h"
-#include "gmock/gmock-matchers.h"
-#include "gmock/internal/gmock-internal-utils.h"
-#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-
-// An abstract handle of an expectation.
-class Expectation;
-
-// A set of expectation handles.
-class ExpectationSet;
-
-// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
-// and MUST NOT BE USED IN USER CODE!!!
-namespace internal {
-
-// Implements a mock function.
-template <typename F> class FunctionMocker;
-
-// Base class for expectations.
-class ExpectationBase;
-
-// Implements an expectation.
-template <typename F> class TypedExpectation;
-
-// Helper class for testing the Expectation class template.
-class ExpectationTester;
-
-// Base class for function mockers.
-template <typename F> class FunctionMockerBase;
-
-// Protects the mock object registry (in class Mock), all function
-// mockers, and all expectations.
-//
-// The reason we don't use more fine-grained protection is: when a
-// mock function Foo() is called, it needs to consult its expectations
-// to see which one should be picked. If another thread is allowed to
-// call a mock function (either Foo() or a different one) at the same
-// time, it could affect the "retired" attributes of Foo()'s
-// expectations when InSequence() is used, and thus affect which
-// expectation gets picked. Therefore, we sequence all mock function
-// calls to ensure the integrity of the mock objects' states.
-GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex);
-
-// Untyped base class for ActionResultHolder<R>.
-class UntypedActionResultHolderBase;
-
-// Abstract base class of FunctionMockerBase. This is the
-// type-agnostic part of the function mocker interface. Its pure
-// virtual methods are implemented by FunctionMockerBase.
-class GTEST_API_ UntypedFunctionMockerBase {
- public:
- UntypedFunctionMockerBase();
- virtual ~UntypedFunctionMockerBase();
-
- // Verifies that all expectations on this mock function have been
- // satisfied. Reports one or more Google Test non-fatal failures
- // and returns false if not.
- bool VerifyAndClearExpectationsLocked()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
-
- // Clears the ON_CALL()s set on this mock function.
- virtual void ClearDefaultActionsLocked()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) = 0;
-
- // In all of the following Untyped* functions, it's the caller's
- // responsibility to guarantee the correctness of the arguments'
- // types.
-
- // Performs the default action with the given arguments and returns
- // the action's result. The call description string will be used in
- // the error message to describe the call in the case the default
- // action fails.
- // L = *
- virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
- const void* untyped_args, const std::string& call_description) const = 0;
-
- // Performs the given action with the given arguments and returns
- // the action's result.
- // L = *
- virtual UntypedActionResultHolderBase* UntypedPerformAction(
- const void* untyped_action,
- const void* untyped_args) const = 0;
-
- // Writes a message that the call is uninteresting (i.e. neither
- // explicitly expected nor explicitly unexpected) to the given
- // ostream.
- virtual void UntypedDescribeUninterestingCall(
- const void* untyped_args,
- ::std::ostream* os) const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0;
-
- // Returns the expectation that matches the given function arguments
- // (or NULL is there's no match); when a match is found,
- // untyped_action is set to point to the action that should be
- // performed (or NULL if the action is "do default"), and
- // is_excessive is modified to indicate whether the call exceeds the
- // expected number.
- virtual const ExpectationBase* UntypedFindMatchingExpectation(
- const void* untyped_args,
- const void** untyped_action, bool* is_excessive,
- ::std::ostream* what, ::std::ostream* why)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0;
-
- // Prints the given function arguments to the ostream.
- virtual void UntypedPrintArgs(const void* untyped_args,
- ::std::ostream* os) const = 0;
-
- // Sets the mock object this mock method belongs to, and registers
- // this information in the global mock registry. Will be called
- // whenever an EXPECT_CALL() or ON_CALL() is executed on this mock
- // method.
- // TODO(wan@google.com): rename to SetAndRegisterOwner().
- void RegisterOwner(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
-
- // Sets the mock object this mock method belongs to, and sets the
- // name of the mock function. Will be called upon each invocation
- // of this mock function.
- void SetOwnerAndName(const void* mock_obj, const char* name)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
-
- // Returns the mock object this mock method belongs to. Must be
- // called after RegisterOwner() or SetOwnerAndName() has been
- // called.
- const void* MockObject() const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
-
- // Returns the name of this mock method. Must be called after
- // SetOwnerAndName() has been called.
- const char* Name() const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
-
- // Returns the result of invoking this mock function with the given
- // arguments. This function can be safely called from multiple
- // threads concurrently. The caller is responsible for deleting the
- // result.
- UntypedActionResultHolderBase* UntypedInvokeWith(
- const void* untyped_args)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
-
- protected:
- typedef std::vector<const void*> UntypedOnCallSpecs;
-
- typedef std::vector<internal::linked_ptr<ExpectationBase> >
- UntypedExpectations;
-
- // Returns an Expectation object that references and co-owns exp,
- // which must be an expectation on this mock function.
- Expectation GetHandleOf(ExpectationBase* exp);
-
- // Address of the mock object this mock method belongs to. Only
- // valid after this mock method has been called or
- // ON_CALL/EXPECT_CALL has been invoked on it.
- const void* mock_obj_; // Protected by g_gmock_mutex.
-
- // Name of the function being mocked. Only valid after this mock
- // method has been called.
- const char* name_; // Protected by g_gmock_mutex.
-
- // All default action specs for this function mocker.
- UntypedOnCallSpecs untyped_on_call_specs_;
-
- // All expectations for this function mocker.
- UntypedExpectations untyped_expectations_;
-}; // class UntypedFunctionMockerBase
-
-// Untyped base class for OnCallSpec<F>.
-class UntypedOnCallSpecBase {
- public:
- // The arguments are the location of the ON_CALL() statement.
- UntypedOnCallSpecBase(const char* a_file, int a_line)
- : file_(a_file), line_(a_line), last_clause_(kNone) {}
-
- // Where in the source file was the default action spec defined?
- const char* file() const { return file_; }
- int line() const { return line_; }
-
- protected:
- // Gives each clause in the ON_CALL() statement a name.
- enum Clause {
- // Do not change the order of the enum members! The run-time
- // syntax checking relies on it.
- kNone,
- kWith,
- kWillByDefault
- };
-
- // Asserts that the ON_CALL() statement has a certain property.
- void AssertSpecProperty(bool property,
- const std::string& failure_message) const {
- Assert(property, file_, line_, failure_message);
- }
-
- // Expects that the ON_CALL() statement has a certain property.
- void ExpectSpecProperty(bool property,
- const std::string& failure_message) const {
- Expect(property, file_, line_, failure_message);
- }
-
- const char* file_;
- int line_;
-
- // The last clause in the ON_CALL() statement as seen so far.
- // Initially kNone and changes as the statement is parsed.
- Clause last_clause_;
-}; // class UntypedOnCallSpecBase
-
-// This template class implements an ON_CALL spec.
-template <typename F>
-class OnCallSpec : public UntypedOnCallSpecBase {
- public:
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
- typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
-
- // Constructs an OnCallSpec object from the information inside
- // the parenthesis of an ON_CALL() statement.
- OnCallSpec(const char* a_file, int a_line,
- const ArgumentMatcherTuple& matchers)
- : UntypedOnCallSpecBase(a_file, a_line),
- matchers_(matchers),
- // By default, extra_matcher_ should match anything. However,
- // we cannot initialize it with _ as that triggers a compiler
- // bug in Symbian's C++ compiler (cannot decide between two
- // overloaded constructors of Matcher<const ArgumentTuple&>).
- extra_matcher_(A<const ArgumentTuple&>()) {
- }
-
- // Implements the .With() clause.
- OnCallSpec& With(const Matcher<const ArgumentTuple&>& m) {
- // Makes sure this is called at most once.
- ExpectSpecProperty(last_clause_ < kWith,
- ".With() cannot appear "
- "more than once in an ON_CALL().");
- last_clause_ = kWith;
-
- extra_matcher_ = m;
- return *this;
- }
-
- // Implements the .WillByDefault() clause.
- OnCallSpec& WillByDefault(const Action<F>& action) {
- ExpectSpecProperty(last_clause_ < kWillByDefault,
- ".WillByDefault() must appear "
- "exactly once in an ON_CALL().");
- last_clause_ = kWillByDefault;
-
- ExpectSpecProperty(!action.IsDoDefault(),
- "DoDefault() cannot be used in ON_CALL().");
- action_ = action;
- return *this;
- }
-
- // Returns true iff the given arguments match the matchers.
- bool Matches(const ArgumentTuple& args) const {
- return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
- }
-
- // Returns the action specified by the user.
- const Action<F>& GetAction() const {
- AssertSpecProperty(last_clause_ == kWillByDefault,
- ".WillByDefault() must appear exactly "
- "once in an ON_CALL().");
- return action_;
- }
-
- private:
- // The information in statement
- //
- // ON_CALL(mock_object, Method(matchers))
- // .With(multi-argument-matcher)
- // .WillByDefault(action);
- //
- // is recorded in the data members like this:
- //
- // source file that contains the statement => file_
- // line number of the statement => line_
- // matchers => matchers_
- // multi-argument-matcher => extra_matcher_
- // action => action_
- ArgumentMatcherTuple matchers_;
- Matcher<const ArgumentTuple&> extra_matcher_;
- Action<F> action_;
-}; // class OnCallSpec
-
-// Possible reactions on uninteresting calls.
-enum CallReaction {
- kAllow,
- kWarn,
- kFail,
- kDefault = kWarn // By default, warn about uninteresting calls.
-};
-
-} // namespace internal
-
-// Utilities for manipulating mock objects.
-class GTEST_API_ Mock {
- public:
- // The following public methods can be called concurrently.
-
- // Tells Google Mock to ignore mock_obj when checking for leaked
- // mock objects.
- static void AllowLeak(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Verifies and clears all expectations on the given mock object.
- // If the expectations aren't satisfied, generates one or more
- // Google Test non-fatal failures and returns false.
- static bool VerifyAndClearExpectations(void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Verifies all expectations on the given mock object and clears its
- // default actions and expectations. Returns true iff the
- // verification was successful.
- static bool VerifyAndClear(void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- private:
- friend class internal::UntypedFunctionMockerBase;
-
- // Needed for a function mocker to register itself (so that we know
- // how to clear a mock object).
- template <typename F>
- friend class internal::FunctionMockerBase;
-
- template <typename M>
- friend class NiceMock;
-
- template <typename M>
- friend class NaggyMock;
-
- template <typename M>
- friend class StrictMock;
-
- // Tells Google Mock to allow uninteresting calls on the given mock
- // object.
- static void AllowUninterestingCalls(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Tells Google Mock to warn the user about uninteresting calls on
- // the given mock object.
- static void WarnUninterestingCalls(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Tells Google Mock to fail uninteresting calls on the given mock
- // object.
- static void FailUninterestingCalls(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Tells Google Mock the given mock object is being destroyed and
- // its entry in the call-reaction table should be removed.
- static void UnregisterCallReaction(const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Returns the reaction Google Mock will have on uninteresting calls
- // made on the given mock object.
- static internal::CallReaction GetReactionOnUninterestingCalls(
- const void* mock_obj)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Verifies that all expectations on the given mock object have been
- // satisfied. Reports one or more Google Test non-fatal failures
- // and returns false if not.
- static bool VerifyAndClearExpectationsLocked(void* mock_obj)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
-
- // Clears all ON_CALL()s set on the given mock object.
- static void ClearDefaultActionsLocked(void* mock_obj)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
-
- // Registers a mock object and a mock method it owns.
- static void Register(
- const void* mock_obj,
- internal::UntypedFunctionMockerBase* mocker)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Tells Google Mock where in the source code mock_obj is used in an
- // ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this
- // information helps the user identify which object it is.
- static void RegisterUseByOnCallOrExpectCall(
- const void* mock_obj, const char* file, int line)
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
-
- // Unregisters a mock method; removes the owning mock object from
- // the registry when the last mock method associated with it has
- // been unregistered. This is called only in the destructor of
- // FunctionMockerBase.
- static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
-}; // class Mock
-
-// An abstract handle of an expectation. Useful in the .After()
-// clause of EXPECT_CALL() for setting the (partial) order of
-// expectations. The syntax:
-//
-// Expectation e1 = EXPECT_CALL(...)...;
-// EXPECT_CALL(...).After(e1)...;
-//
-// sets two expectations where the latter can only be matched after
-// the former has been satisfied.
-//
-// Notes:
-// - This class is copyable and has value semantics.
-// - Constness is shallow: a const Expectation object itself cannot
-// be modified, but the mutable methods of the ExpectationBase
-// object it references can be called via expectation_base().
-// - The constructors and destructor are defined out-of-line because
-// the Symbian WINSCW compiler wants to otherwise instantiate them
-// when it sees this class definition, at which point it doesn't have
-// ExpectationBase available yet, leading to incorrect destruction
-// in the linked_ptr (or compilation errors if using a checking
-// linked_ptr).
-class GTEST_API_ Expectation {
- public:
- // Constructs a null object that doesn't reference any expectation.
- Expectation();
-
- ~Expectation();
-
- // This single-argument ctor must not be explicit, in order to support the
- // Expectation e = EXPECT_CALL(...);
- // syntax.
- //
- // A TypedExpectation object stores its pre-requisites as
- // Expectation objects, and needs to call the non-const Retire()
- // method on the ExpectationBase objects they reference. Therefore
- // Expectation must receive a *non-const* reference to the
- // ExpectationBase object.
- Expectation(internal::ExpectationBase& exp); // NOLINT
-
- // The compiler-generated copy ctor and operator= work exactly as
- // intended, so we don't need to define our own.
-
- // Returns true iff rhs references the same expectation as this object does.
- bool operator==(const Expectation& rhs) const {
- return expectation_base_ == rhs.expectation_base_;
- }
-
- bool operator!=(const Expectation& rhs) const { return !(*this == rhs); }
-
- private:
- friend class ExpectationSet;
- friend class Sequence;
- friend class ::testing::internal::ExpectationBase;
- friend class ::testing::internal::UntypedFunctionMockerBase;
-
- template <typename F>
- friend class ::testing::internal::FunctionMockerBase;
-
- template <typename F>
- friend class ::testing::internal::TypedExpectation;
-
- // This comparator is needed for putting Expectation objects into a set.
- class Less {
- public:
- bool operator()(const Expectation& lhs, const Expectation& rhs) const {
- return lhs.expectation_base_.get() < rhs.expectation_base_.get();
- }
- };
-
- typedef ::std::set<Expectation, Less> Set;
-
- Expectation(
- const internal::linked_ptr<internal::ExpectationBase>& expectation_base);
-
- // Returns the expectation this object references.
- const internal::linked_ptr<internal::ExpectationBase>&
- expectation_base() const {
- return expectation_base_;
- }
-
- // A linked_ptr that co-owns the expectation this handle references.
- internal::linked_ptr<internal::ExpectationBase> expectation_base_;
-};
-
-// A set of expectation handles. Useful in the .After() clause of
-// EXPECT_CALL() for setting the (partial) order of expectations. The
-// syntax:
-//
-// ExpectationSet es;
-// es += EXPECT_CALL(...)...;
-// es += EXPECT_CALL(...)...;
-// EXPECT_CALL(...).After(es)...;
-//
-// sets three expectations where the last one can only be matched
-// after the first two have both been satisfied.
-//
-// This class is copyable and has value semantics.
-class ExpectationSet {
- public:
- // A bidirectional iterator that can read a const element in the set.
- typedef Expectation::Set::const_iterator const_iterator;
-
- // An object stored in the set. This is an alias of Expectation.
- typedef Expectation::Set::value_type value_type;
-
- // Constructs an empty set.
- ExpectationSet() {}
-
- // This single-argument ctor must not be explicit, in order to support the
- // ExpectationSet es = EXPECT_CALL(...);
- // syntax.
- ExpectationSet(internal::ExpectationBase& exp) { // NOLINT
- *this += Expectation(exp);
- }
-
- // This single-argument ctor implements implicit conversion from
- // Expectation and thus must not be explicit. This allows either an
- // Expectation or an ExpectationSet to be used in .After().
- ExpectationSet(const Expectation& e) { // NOLINT
- *this += e;
- }
-
- // The compiler-generator ctor and operator= works exactly as
- // intended, so we don't need to define our own.
-
- // Returns true iff rhs contains the same set of Expectation objects
- // as this does.
- bool operator==(const ExpectationSet& rhs) const {
- return expectations_ == rhs.expectations_;
- }
-
- bool operator!=(const ExpectationSet& rhs) const { return !(*this == rhs); }
-
- // Implements the syntax
- // expectation_set += EXPECT_CALL(...);
- ExpectationSet& operator+=(const Expectation& e) {
- expectations_.insert(e);
- return *this;
- }
-
- int size() const { return static_cast<int>(expectations_.size()); }
-
- const_iterator begin() const { return expectations_.begin(); }
- const_iterator end() const { return expectations_.end(); }
-
- private:
- Expectation::Set expectations_;
-};
-
-
-// Sequence objects are used by a user to specify the relative order
-// in which the expectations should match. They are copyable (we rely
-// on the compiler-defined copy constructor and assignment operator).
-class GTEST_API_ Sequence {
- public:
- // Constructs an empty sequence.
- Sequence() : last_expectation_(new Expectation) {}
-
- // Adds an expectation to this sequence. The caller must ensure
- // that no other thread is accessing this Sequence object.
- void AddExpectation(const Expectation& expectation) const;
-
- private:
- // The last expectation in this sequence. We use a linked_ptr here
- // because Sequence objects are copyable and we want the copies to
- // be aliases. The linked_ptr allows the copies to co-own and share
- // the same Expectation object.
- internal::linked_ptr<Expectation> last_expectation_;
-}; // class Sequence
-
-// An object of this type causes all EXPECT_CALL() statements
-// encountered in its scope to be put in an anonymous sequence. The
-// work is done in the constructor and destructor. You should only
-// create an InSequence object on the stack.
-//
-// The sole purpose for this class is to support easy definition of
-// sequential expectations, e.g.
-//
-// {
-// InSequence dummy; // The name of the object doesn't matter.
-//
-// // The following expectations must match in the order they appear.
-// EXPECT_CALL(a, Bar())...;
-// EXPECT_CALL(a, Baz())...;
-// ...
-// EXPECT_CALL(b, Xyz())...;
-// }
-//
-// You can create InSequence objects in multiple threads, as long as
-// they are used to affect different mock objects. The idea is that
-// each thread can create and set up its own mocks as if it's the only
-// thread. However, for clarity of your tests we recommend you to set
-// up mocks in the main thread unless you have a good reason not to do
-// so.
-class GTEST_API_ InSequence {
- public:
- InSequence();
- ~InSequence();
- private:
- bool sequence_created_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT
-} GTEST_ATTRIBUTE_UNUSED_;
-
-namespace internal {
-
-// Points to the implicit sequence introduced by a living InSequence
-// object (if any) in the current thread or NULL.
-GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
-
-// Base class for implementing expectations.
-//
-// There are two reasons for having a type-agnostic base class for
-// Expectation:
-//
-// 1. We need to store collections of expectations of different
-// types (e.g. all pre-requisites of a particular expectation, all
-// expectations in a sequence). Therefore these expectation objects
-// must share a common base class.
-//
-// 2. We can avoid binary code bloat by moving methods not depending
-// on the template argument of Expectation to the base class.
-//
-// This class is internal and mustn't be used by user code directly.
-class GTEST_API_ ExpectationBase {
- public:
- // source_text is the EXPECT_CALL(...) source that created this Expectation.
- ExpectationBase(const char* file, int line, const std::string& source_text);
-
- virtual ~ExpectationBase();
-
- // Where in the source file was the expectation spec defined?
- const char* file() const { return file_; }
- int line() const { return line_; }
- const char* source_text() const { return source_text_.c_str(); }
- // Returns the cardinality specified in the expectation spec.
- const Cardinality& cardinality() const { return cardinality_; }
-
- // Describes the source file location of this expectation.
- void DescribeLocationTo(::std::ostream* os) const {
- *os << FormatFileLocation(file(), line()) << " ";
- }
-
- // Describes how many times a function call matching this
- // expectation has occurred.
- void DescribeCallCountTo(::std::ostream* os) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
-
- // If this mock method has an extra matcher (i.e. .With(matcher)),
- // describes it to the ostream.
- virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) = 0;
-
- protected:
- friend class ::testing::Expectation;
- friend class UntypedFunctionMockerBase;
-
- enum Clause {
- // Don't change the order of the enum members!
- kNone,
- kWith,
- kTimes,
- kInSequence,
- kAfter,
- kWillOnce,
- kWillRepeatedly,
- kRetiresOnSaturation
- };
-
- typedef std::vector<const void*> UntypedActions;
-
- // Returns an Expectation object that references and co-owns this
- // expectation.
- virtual Expectation GetHandle() = 0;
-
- // Asserts that the EXPECT_CALL() statement has the given property.
- void AssertSpecProperty(bool property,
- const std::string& failure_message) const {
- Assert(property, file_, line_, failure_message);
- }
-
- // Expects that the EXPECT_CALL() statement has the given property.
- void ExpectSpecProperty(bool property,
- const std::string& failure_message) const {
- Expect(property, file_, line_, failure_message);
- }
-
- // Explicitly specifies the cardinality of this expectation. Used
- // by the subclasses to implement the .Times() clause.
- void SpecifyCardinality(const Cardinality& cardinality);
-
- // Returns true iff the user specified the cardinality explicitly
- // using a .Times().
- bool cardinality_specified() const { return cardinality_specified_; }
-
- // Sets the cardinality of this expectation spec.
- void set_cardinality(const Cardinality& a_cardinality) {
- cardinality_ = a_cardinality;
- }
-
- // The following group of methods should only be called after the
- // EXPECT_CALL() statement, and only when g_gmock_mutex is held by
- // the current thread.
-
- // Retires all pre-requisites of this expectation.
- void RetireAllPreRequisites()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
-
- // Returns true iff this expectation is retired.
- bool is_retired() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return retired_;
- }
-
- // Retires this expectation.
- void Retire()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- retired_ = true;
- }
-
- // Returns true iff this expectation is satisfied.
- bool IsSatisfied() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return cardinality().IsSatisfiedByCallCount(call_count_);
- }
-
- // Returns true iff this expectation is saturated.
- bool IsSaturated() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return cardinality().IsSaturatedByCallCount(call_count_);
- }
-
- // Returns true iff this expectation is over-saturated.
- bool IsOverSaturated() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return cardinality().IsOverSaturatedByCallCount(call_count_);
- }
-
- // Returns true iff all pre-requisites of this expectation are satisfied.
- bool AllPrerequisitesAreSatisfied() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
-
- // Adds unsatisfied pre-requisites of this expectation to 'result'.
- void FindUnsatisfiedPrerequisites(ExpectationSet* result) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
-
- // Returns the number this expectation has been invoked.
- int call_count() const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return call_count_;
- }
-
- // Increments the number this expectation has been invoked.
- void IncrementCallCount()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- call_count_++;
- }
-
- // Checks the action count (i.e. the number of WillOnce() and
- // WillRepeatedly() clauses) against the cardinality if this hasn't
- // been done before. Prints a warning if there are too many or too
- // few actions.
- void CheckActionCountIfNotDone() const
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- friend class ::testing::Sequence;
- friend class ::testing::internal::ExpectationTester;
-
- template <typename Function>
- friend class TypedExpectation;
-
- // Implements the .Times() clause.
- void UntypedTimes(const Cardinality& a_cardinality);
-
- // This group of fields are part of the spec and won't change after
- // an EXPECT_CALL() statement finishes.
- const char* file_; // The file that contains the expectation.
- int line_; // The line number of the expectation.
- const std::string source_text_; // The EXPECT_CALL(...) source text.
- // True iff the cardinality is specified explicitly.
- bool cardinality_specified_;
- Cardinality cardinality_; // The cardinality of the expectation.
- // The immediate pre-requisites (i.e. expectations that must be
- // satisfied before this expectation can be matched) of this
- // expectation. We use linked_ptr in the set because we want an
- // Expectation object to be co-owned by its FunctionMocker and its
- // successors. This allows multiple mock objects to be deleted at
- // different times.
- ExpectationSet immediate_prerequisites_;
-
- // This group of fields are the current state of the expectation,
- // and can change as the mock function is called.
- int call_count_; // How many times this expectation has been invoked.
- bool retired_; // True iff this expectation has retired.
- UntypedActions untyped_actions_;
- bool extra_matcher_specified_;
- bool repeated_action_specified_; // True if a WillRepeatedly() was specified.
- bool retires_on_saturation_;
- Clause last_clause_;
- mutable bool action_count_checked_; // Under mutex_.
- mutable Mutex mutex_; // Protects action_count_checked_.
-
- GTEST_DISALLOW_ASSIGN_(ExpectationBase);
-}; // class ExpectationBase
-
-// Impements an expectation for the given function type.
-template <typename F>
-class TypedExpectation : public ExpectationBase {
- public:
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
- typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
- typedef typename Function<F>::Result Result;
-
- TypedExpectation(FunctionMockerBase<F>* owner, const char* a_file, int a_line,
- const std::string& a_source_text,
- const ArgumentMatcherTuple& m)
- : ExpectationBase(a_file, a_line, a_source_text),
- owner_(owner),
- matchers_(m),
- // By default, extra_matcher_ should match anything. However,
- // we cannot initialize it with _ as that triggers a compiler
- // bug in Symbian's C++ compiler (cannot decide between two
- // overloaded constructors of Matcher<const ArgumentTuple&>).
- extra_matcher_(A<const ArgumentTuple&>()),
- repeated_action_(DoDefault()) {}
-
- virtual ~TypedExpectation() {
- // Check the validity of the action count if it hasn't been done
- // yet (for example, if the expectation was never used).
- CheckActionCountIfNotDone();
- for (UntypedActions::const_iterator it = untyped_actions_.begin();
- it != untyped_actions_.end(); ++it) {
- delete static_cast<const Action<F>*>(*it);
- }
- }
-
- // Implements the .With() clause.
- TypedExpectation& With(const Matcher<const ArgumentTuple&>& m) {
- if (last_clause_ == kWith) {
- ExpectSpecProperty(false,
- ".With() cannot appear "
- "more than once in an EXPECT_CALL().");
- } else {
- ExpectSpecProperty(last_clause_ < kWith,
- ".With() must be the first "
- "clause in an EXPECT_CALL().");
- }
- last_clause_ = kWith;
-
- extra_matcher_ = m;
- extra_matcher_specified_ = true;
- return *this;
- }
-
- // Implements the .Times() clause.
- TypedExpectation& Times(const Cardinality& a_cardinality) {
- ExpectationBase::UntypedTimes(a_cardinality);
- return *this;
- }
-
- // Implements the .Times() clause.
- TypedExpectation& Times(int n) {
- return Times(Exactly(n));
- }
-
- // Implements the .InSequence() clause.
- TypedExpectation& InSequence(const Sequence& s) {
- ExpectSpecProperty(last_clause_ <= kInSequence,
- ".InSequence() cannot appear after .After(),"
- " .WillOnce(), .WillRepeatedly(), or "
- ".RetiresOnSaturation().");
- last_clause_ = kInSequence;
-
- s.AddExpectation(GetHandle());
- return *this;
- }
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2) {
- return InSequence(s1).InSequence(s2);
- }
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
- const Sequence& s3) {
- return InSequence(s1, s2).InSequence(s3);
- }
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
- const Sequence& s3, const Sequence& s4) {
- return InSequence(s1, s2, s3).InSequence(s4);
- }
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
- const Sequence& s3, const Sequence& s4,
- const Sequence& s5) {
- return InSequence(s1, s2, s3, s4).InSequence(s5);
- }
-
- // Implements that .After() clause.
- TypedExpectation& After(const ExpectationSet& s) {
- ExpectSpecProperty(last_clause_ <= kAfter,
- ".After() cannot appear after .WillOnce(),"
- " .WillRepeatedly(), or "
- ".RetiresOnSaturation().");
- last_clause_ = kAfter;
-
- for (ExpectationSet::const_iterator it = s.begin(); it != s.end(); ++it) {
- immediate_prerequisites_ += *it;
- }
- return *this;
- }
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2) {
- return After(s1).After(s2);
- }
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
- const ExpectationSet& s3) {
- return After(s1, s2).After(s3);
- }
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
- const ExpectationSet& s3, const ExpectationSet& s4) {
- return After(s1, s2, s3).After(s4);
- }
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
- const ExpectationSet& s3, const ExpectationSet& s4,
- const ExpectationSet& s5) {
- return After(s1, s2, s3, s4).After(s5);
- }
-
- // Implements the .WillOnce() clause.
- TypedExpectation& WillOnce(const Action<F>& action) {
- ExpectSpecProperty(last_clause_ <= kWillOnce,
- ".WillOnce() cannot appear after "
- ".WillRepeatedly() or .RetiresOnSaturation().");
- last_clause_ = kWillOnce;
-
- untyped_actions_.push_back(new Action<F>(action));
- if (!cardinality_specified()) {
- set_cardinality(Exactly(static_cast<int>(untyped_actions_.size())));
- }
- return *this;
- }
-
- // Implements the .WillRepeatedly() clause.
- TypedExpectation& WillRepeatedly(const Action<F>& action) {
- if (last_clause_ == kWillRepeatedly) {
- ExpectSpecProperty(false,
- ".WillRepeatedly() cannot appear "
- "more than once in an EXPECT_CALL().");
- } else {
- ExpectSpecProperty(last_clause_ < kWillRepeatedly,
- ".WillRepeatedly() cannot appear "
- "after .RetiresOnSaturation().");
- }
- last_clause_ = kWillRepeatedly;
- repeated_action_specified_ = true;
-
- repeated_action_ = action;
- if (!cardinality_specified()) {
- set_cardinality(AtLeast(static_cast<int>(untyped_actions_.size())));
- }
-
- // Now that no more action clauses can be specified, we check
- // whether their count makes sense.
- CheckActionCountIfNotDone();
- return *this;
- }
-
- // Implements the .RetiresOnSaturation() clause.
- TypedExpectation& RetiresOnSaturation() {
- ExpectSpecProperty(last_clause_ < kRetiresOnSaturation,
- ".RetiresOnSaturation() cannot appear "
- "more than once.");
- last_clause_ = kRetiresOnSaturation;
- retires_on_saturation_ = true;
-
- // Now that no more action clauses can be specified, we check
- // whether their count makes sense.
- CheckActionCountIfNotDone();
- return *this;
- }
-
- // Returns the matchers for the arguments as specified inside the
- // EXPECT_CALL() macro.
- const ArgumentMatcherTuple& matchers() const {
- return matchers_;
- }
-
- // Returns the matcher specified by the .With() clause.
- const Matcher<const ArgumentTuple&>& extra_matcher() const {
- return extra_matcher_;
- }
-
- // Returns the action specified by the .WillRepeatedly() clause.
- const Action<F>& repeated_action() const { return repeated_action_; }
-
- // If this mock method has an extra matcher (i.e. .With(matcher)),
- // describes it to the ostream.
- virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) {
- if (extra_matcher_specified_) {
- *os << " Expected args: ";
- extra_matcher_.DescribeTo(os);
- *os << "\n";
- }
- }
-
- private:
- template <typename Function>
- friend class FunctionMockerBase;
-
- // Returns an Expectation object that references and co-owns this
- // expectation.
- virtual Expectation GetHandle() {
- return owner_->GetHandleOf(this);
- }
-
- // The following methods will be called only after the EXPECT_CALL()
- // statement finishes and when the current thread holds
- // g_gmock_mutex.
-
- // Returns true iff this expectation matches the given arguments.
- bool Matches(const ArgumentTuple& args) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
- }
-
- // Returns true iff this expectation should handle the given arguments.
- bool ShouldHandleArguments(const ArgumentTuple& args) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
-
- // In case the action count wasn't checked when the expectation
- // was defined (e.g. if this expectation has no WillRepeatedly()
- // or RetiresOnSaturation() clause), we check it when the
- // expectation is used for the first time.
- CheckActionCountIfNotDone();
- return !is_retired() && AllPrerequisitesAreSatisfied() && Matches(args);
- }
-
- // Describes the result of matching the arguments against this
- // expectation to the given ostream.
- void ExplainMatchResultTo(
- const ArgumentTuple& args,
- ::std::ostream* os) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
-
- if (is_retired()) {
- *os << " Expected: the expectation is active\n"
- << " Actual: it is retired\n";
- } else if (!Matches(args)) {
- if (!TupleMatches(matchers_, args)) {
- ExplainMatchFailureTupleTo(matchers_, args, os);
- }
- StringMatchResultListener listener;
- if (!extra_matcher_.MatchAndExplain(args, &listener)) {
- *os << " Expected args: ";
- extra_matcher_.DescribeTo(os);
- *os << "\n Actual: don't match";
-
- internal::PrintIfNotEmpty(listener.str(), os);
- *os << "\n";
- }
- } else if (!AllPrerequisitesAreSatisfied()) {
- *os << " Expected: all pre-requisites are satisfied\n"
- << " Actual: the following immediate pre-requisites "
- << "are not satisfied:\n";
- ExpectationSet unsatisfied_prereqs;
- FindUnsatisfiedPrerequisites(&unsatisfied_prereqs);
- int i = 0;
- for (ExpectationSet::const_iterator it = unsatisfied_prereqs.begin();
- it != unsatisfied_prereqs.end(); ++it) {
- it->expectation_base()->DescribeLocationTo(os);
- *os << "pre-requisite #" << i++ << "\n";
- }
- *os << " (end of pre-requisites)\n";
- } else {
- // This line is here just for completeness' sake. It will never
- // be executed as currently the ExplainMatchResultTo() function
- // is called only when the mock function call does NOT match the
- // expectation.
- *os << "The call matches the expectation.\n";
- }
- }
-
- // Returns the action that should be taken for the current invocation.
- const Action<F>& GetCurrentAction(
- const FunctionMockerBase<F>* mocker,
- const ArgumentTuple& args) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- const int count = call_count();
- Assert(count >= 1, __FILE__, __LINE__,
- "call_count() is <= 0 when GetCurrentAction() is "
- "called - this should never happen.");
-
- const int action_count = static_cast<int>(untyped_actions_.size());
- if (action_count > 0 && !repeated_action_specified_ &&
- count > action_count) {
- // If there is at least one WillOnce() and no WillRepeatedly(),
- // we warn the user when the WillOnce() clauses ran out.
- ::std::stringstream ss;
- DescribeLocationTo(&ss);
- ss << "Actions ran out in " << source_text() << "...\n"
- << "Called " << count << " times, but only "
- << action_count << " WillOnce()"
- << (action_count == 1 ? " is" : "s are") << " specified - ";
- mocker->DescribeDefaultActionTo(args, &ss);
- Log(kWarning, ss.str(), 1);
- }
-
- return count <= action_count ?
- *static_cast<const Action<F>*>(untyped_actions_[count - 1]) :
- repeated_action();
- }
-
- // Given the arguments of a mock function call, if the call will
- // over-saturate this expectation, returns the default action;
- // otherwise, returns the next action in this expectation. Also
- // describes *what* happened to 'what', and explains *why* Google
- // Mock does it to 'why'. This method is not const as it calls
- // IncrementCallCount(). A return value of NULL means the default
- // action.
- const Action<F>* GetActionForArguments(
- const FunctionMockerBase<F>* mocker,
- const ArgumentTuple& args,
- ::std::ostream* what,
- ::std::ostream* why)
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- if (IsSaturated()) {
- // We have an excessive call.
- IncrementCallCount();
- *what << "Mock function called more times than expected - ";
- mocker->DescribeDefaultActionTo(args, what);
- DescribeCallCountTo(why);
-
- // TODO(wan@google.com): allow the user to control whether
- // unexpected calls should fail immediately or continue using a
- // flag --gmock_unexpected_calls_are_fatal.
- return NULL;
- }
-
- IncrementCallCount();
- RetireAllPreRequisites();
-
- if (retires_on_saturation_ && IsSaturated()) {
- Retire();
- }
-
- // Must be done after IncrementCount()!
- *what << "Mock function call matches " << source_text() <<"...\n";
- return &(GetCurrentAction(mocker, args));
- }
-
- // All the fields below won't change once the EXPECT_CALL()
- // statement finishes.
- FunctionMockerBase<F>* const owner_;
- ArgumentMatcherTuple matchers_;
- Matcher<const ArgumentTuple&> extra_matcher_;
- Action<F> repeated_action_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TypedExpectation);
-}; // class TypedExpectation
-
-// A MockSpec object is used by ON_CALL() or EXPECT_CALL() for
-// specifying the default behavior of, or expectation on, a mock
-// function.
-
-// Note: class MockSpec 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 MockSpec in
-// ::testing::internal and import it into ::testing.
-
-// Logs a message including file and line number information.
-GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
- const char* file, int line,
- const std::string& message);
-
-template <typename F>
-class MockSpec {
- public:
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
- typedef typename internal::Function<F>::ArgumentMatcherTuple
- ArgumentMatcherTuple;
-
- // Constructs a MockSpec object, given the function mocker object
- // that the spec is associated with.
- explicit MockSpec(internal::FunctionMockerBase<F>* function_mocker)
- : function_mocker_(function_mocker) {}
-
- // Adds a new default action spec to the function mocker and returns
- // the newly created spec.
- internal::OnCallSpec<F>& InternalDefaultActionSetAt(
- const char* file, int line, const char* obj, const char* call) {
- LogWithLocation(internal::kInfo, file, line,
- std::string("ON_CALL(") + obj + ", " + call + ") invoked");
- return function_mocker_->AddNewOnCallSpec(file, line, matchers_);
- }
-
- // Adds a new expectation spec to the function mocker and returns
- // the newly created spec.
- internal::TypedExpectation<F>& InternalExpectedAt(
- const char* file, int line, const char* obj, const char* call) {
- const std::string source_text(std::string("EXPECT_CALL(") + obj + ", " +
- call + ")");
- LogWithLocation(internal::kInfo, file, line, source_text + " invoked");
- return function_mocker_->AddNewExpectation(
- file, line, source_text, matchers_);
- }
-
- private:
- template <typename Function>
- friend class internal::FunctionMocker;
-
- void SetMatchers(const ArgumentMatcherTuple& matchers) {
- matchers_ = matchers;
- }
-
- // The function mocker that owns this spec.
- internal::FunctionMockerBase<F>* const function_mocker_;
- // The argument matchers specified in the spec.
- ArgumentMatcherTuple matchers_;
-
- GTEST_DISALLOW_ASSIGN_(MockSpec);
-}; // class MockSpec
-
-// Wrapper type for generically holding an ordinary value or lvalue reference.
-// If T is not a reference type, it must be copyable or movable.
-// ReferenceOrValueWrapper<T> is movable, and will also be copyable unless
-// T is a move-only value type (which means that it will always be copyable
-// if the current platform does not support move semantics).
-//
-// The primary template defines handling for values, but function header
-// comments describe the contract for the whole template (including
-// specializations).
-template <typename T>
-class ReferenceOrValueWrapper {
- public:
- // Constructs a wrapper from the given value/reference.
- explicit ReferenceOrValueWrapper(T value)
- : value_(::testing::internal::move(value)) {
- }
-
- // Unwraps and returns the underlying value/reference, exactly as
- // originally passed. The behavior of calling this more than once on
- // the same object is unspecified.
- T Unwrap() { return ::testing::internal::move(value_); }
-
- // Provides nondestructive access to the underlying value/reference.
- // Always returns a const reference (more precisely,
- // const RemoveReference<T>&). The behavior of calling this after
- // calling Unwrap on the same object is unspecified.
- const T& Peek() const {
- return value_;
- }
-
- private:
- T value_;
-};
-
-// Specialization for lvalue reference types. See primary template
-// for documentation.
-template <typename T>
-class ReferenceOrValueWrapper<T&> {
- public:
- // Workaround for debatable pass-by-reference lint warning (c-library-team
- // policy precludes NOLINT in this context)
- typedef T& reference;
- explicit ReferenceOrValueWrapper(reference ref)
- : value_ptr_(&ref) {}
- T& Unwrap() { return *value_ptr_; }
- const T& Peek() const { return *value_ptr_; }
-
- private:
- T* value_ptr_;
-};
-
-// MSVC warns about using 'this' in base member initializer list, so
-// we need to temporarily disable the warning. We have to do it for
-// the entire class to suppress the warning, even though it's about
-// the constructor only.
-
-#ifdef _MSC_VER
-# pragma warning(push) // Saves the current warning state.
-# pragma warning(disable:4355) // Temporarily disables warning 4355.
-#endif // _MSV_VER
-
-// C++ treats the void type specially. For example, you cannot define
-// a void-typed variable or pass a void value to a function.
-// ActionResultHolder<T> holds a value of type T, where T must be a
-// copyable type or void (T doesn't need to be default-constructable).
-// It hides the syntactic difference between void and other types, and
-// is used to unify the code for invoking both void-returning and
-// non-void-returning mock functions.
-
-// Untyped base class for ActionResultHolder<T>.
-class UntypedActionResultHolderBase {
- public:
- virtual ~UntypedActionResultHolderBase() {}
-
- // Prints the held value as an action's result to os.
- virtual void PrintAsActionResult(::std::ostream* os) const = 0;
-};
-
-// This generic definition is used when T is not void.
-template <typename T>
-class ActionResultHolder : public UntypedActionResultHolderBase {
- public:
- // Returns the held value. Must not be called more than once.
- T Unwrap() {
- return result_.Unwrap();
- }
-
- // Prints the held value as an action's result to os.
- virtual void PrintAsActionResult(::std::ostream* os) const {
- *os << "\n Returns: ";
- // T may be a reference type, so we don't use UniversalPrint().
- UniversalPrinter<T>::Print(result_.Peek(), os);
- }
-
- // Performs the given mock function's default action and returns the
- // result in a new-ed ActionResultHolder.
- template <typename F>
- static ActionResultHolder* PerformDefaultAction(
- const FunctionMockerBase<F>* func_mocker,
- const typename Function<F>::ArgumentTuple& args,
- const std::string& call_description) {
- return new ActionResultHolder(Wrapper(
- func_mocker->PerformDefaultAction(args, call_description)));
- }
-
- // Performs the given action and returns the result in a new-ed
- // ActionResultHolder.
- template <typename F>
- static ActionResultHolder*
- PerformAction(const Action<F>& action,
- const typename Function<F>::ArgumentTuple& args) {
- return new ActionResultHolder(Wrapper(action.Perform(args)));
- }
-
- private:
- typedef ReferenceOrValueWrapper<T> Wrapper;
-
- explicit ActionResultHolder(Wrapper result)
- : result_(::testing::internal::move(result)) {
- }
-
- Wrapper result_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder);
-};
-
-// Specialization for T = void.
-template <>
-class ActionResultHolder<void> : public UntypedActionResultHolderBase {
- public:
- void Unwrap() { }
-
- virtual void PrintAsActionResult(::std::ostream* /* os */) const {}
-
- // Performs the given mock function's default action and returns ownership
- // of an empty ActionResultHolder*.
- template <typename F>
- static ActionResultHolder* PerformDefaultAction(
- const FunctionMockerBase<F>* func_mocker,
- const typename Function<F>::ArgumentTuple& args,
- const std::string& call_description) {
- func_mocker->PerformDefaultAction(args, call_description);
- return new ActionResultHolder;
- }
-
- // Performs the given action and returns ownership of an empty
- // ActionResultHolder*.
- template <typename F>
- static ActionResultHolder* PerformAction(
- const Action<F>& action,
- const typename Function<F>::ArgumentTuple& args) {
- action.Perform(args);
- return new ActionResultHolder;
- }
-
- private:
- ActionResultHolder() {}
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder);
-};
-
-// The base of the function mocker class for the given function type.
-// We put the methods in this class instead of its child to avoid code
-// bloat.
-template <typename F>
-class FunctionMockerBase : public UntypedFunctionMockerBase {
- public:
- typedef typename Function<F>::Result Result;
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
- typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
-
- FunctionMockerBase() : current_spec_(this) {}
-
- // The destructor verifies that all expectations on this mock
- // function have been satisfied. If not, it will report Google Test
- // non-fatal failures for the violations.
- virtual ~FunctionMockerBase()
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- MutexLock l(&g_gmock_mutex);
- VerifyAndClearExpectationsLocked();
- Mock::UnregisterLocked(this);
- ClearDefaultActionsLocked();
- }
-
- // Returns the ON_CALL spec that matches this mock function with the
- // given arguments; returns NULL if no matching ON_CALL is found.
- // L = *
- const OnCallSpec<F>* FindOnCallSpec(
- const ArgumentTuple& args) const {
- for (UntypedOnCallSpecs::const_reverse_iterator it
- = untyped_on_call_specs_.rbegin();
- it != untyped_on_call_specs_.rend(); ++it) {
- const OnCallSpec<F>* spec = static_cast<const OnCallSpec<F>*>(*it);
- if (spec->Matches(args))
- return spec;
- }
-
- return NULL;
- }
-
- // Performs the default action of this mock function on the given
- // arguments and returns the result. Asserts (or throws if
- // exceptions are enabled) with a helpful call descrption if there
- // is no valid return value. This method doesn't depend on the
- // mutable state of this object, and thus can be called concurrently
- // without locking.
- // L = *
- Result PerformDefaultAction(const ArgumentTuple& args,
- const std::string& call_description) const {
- const OnCallSpec<F>* const spec =
- this->FindOnCallSpec(args);
- if (spec != NULL) {
- return spec->GetAction().Perform(args);
- }
- const std::string message =
- call_description +
- "\n The mock function has no default action "
- "set, and its return type has no default value set.";
-#if GTEST_HAS_EXCEPTIONS
- if (!DefaultValue<Result>::Exists()) {
- throw std::runtime_error(message);
- }
-#else
- Assert(DefaultValue<Result>::Exists(), "", -1, message);
-#endif
- return DefaultValue<Result>::Get();
- }
-
- // Performs the default action with the given arguments and returns
- // the action's result. The call description string will be used in
- // the error message to describe the call in the case the default
- // action fails. The caller is responsible for deleting the result.
- // L = *
- virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
- const void* untyped_args, // must point to an ArgumentTuple
- const std::string& call_description) const {
- const ArgumentTuple& args =
- *static_cast<const ArgumentTuple*>(untyped_args);
- return ResultHolder::PerformDefaultAction(this, args, call_description);
- }
-
- // Performs the given action with the given arguments and returns
- // the action's result. The caller is responsible for deleting the
- // result.
- // L = *
- virtual UntypedActionResultHolderBase* UntypedPerformAction(
- const void* untyped_action, const void* untyped_args) const {
- // Make a copy of the action before performing it, in case the
- // action deletes the mock object (and thus deletes itself).
- const Action<F> action = *static_cast<const Action<F>*>(untyped_action);
- const ArgumentTuple& args =
- *static_cast<const ArgumentTuple*>(untyped_args);
- return ResultHolder::PerformAction(action, args);
- }
-
- // Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
- // clears the ON_CALL()s set on this mock function.
- virtual void ClearDefaultActionsLocked()
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
-
- // Deleting our default actions may trigger other mock objects to be
- // deleted, for example if an action contains a reference counted smart
- // pointer to that mock object, and that is the last reference. So if we
- // delete our actions within the context of the global mutex we may deadlock
- // when this method is called again. Instead, make a copy of the set of
- // actions to delete, clear our set within the mutex, and then delete the
- // actions outside of the mutex.
- UntypedOnCallSpecs specs_to_delete;
- untyped_on_call_specs_.swap(specs_to_delete);
-
- g_gmock_mutex.Unlock();
- for (UntypedOnCallSpecs::const_iterator it =
- specs_to_delete.begin();
- it != specs_to_delete.end(); ++it) {
- delete static_cast<const OnCallSpec<F>*>(*it);
- }
-
- // Lock the mutex again, since the caller expects it to be locked when we
- // return.
- g_gmock_mutex.Lock();
- }
-
- protected:
- template <typename Function>
- friend class MockSpec;
-
- typedef ActionResultHolder<Result> ResultHolder;
-
- // Returns the result of invoking this mock function with the given
- // arguments. This function can be safely called from multiple
- // threads concurrently.
- Result InvokeWith(const ArgumentTuple& args)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- scoped_ptr<ResultHolder> holder(
- DownCast_<ResultHolder*>(this->UntypedInvokeWith(&args)));
- return holder->Unwrap();
- }
-
- // Adds and returns a default action spec for this mock function.
- OnCallSpec<F>& AddNewOnCallSpec(
- const char* file, int line,
- const ArgumentMatcherTuple& m)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
- OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m);
- untyped_on_call_specs_.push_back(on_call_spec);
- return *on_call_spec;
- }
-
- // Adds and returns an expectation spec for this mock function.
- TypedExpectation<F>& AddNewExpectation(const char* file, int line,
- const std::string& source_text,
- const ArgumentMatcherTuple& m)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
- TypedExpectation<F>* const expectation =
- new TypedExpectation<F>(this, file, line, source_text, m);
- const linked_ptr<ExpectationBase> untyped_expectation(expectation);
- untyped_expectations_.push_back(untyped_expectation);
-
- // Adds this expectation into the implicit sequence if there is one.
- Sequence* const implicit_sequence = g_gmock_implicit_sequence.get();
- if (implicit_sequence != NULL) {
- implicit_sequence->AddExpectation(Expectation(untyped_expectation));
- }
-
- return *expectation;
- }
-
- // The current spec (either default action spec or expectation spec)
- // being described on this function mocker.
- MockSpec<F>& current_spec() { return current_spec_; }
-
- private:
- template <typename Func> friend class TypedExpectation;
-
- // Some utilities needed for implementing UntypedInvokeWith().
-
- // Describes what default action will be performed for the given
- // arguments.
- // L = *
- void DescribeDefaultActionTo(const ArgumentTuple& args,
- ::std::ostream* os) const {
- const OnCallSpec<F>* const spec = FindOnCallSpec(args);
-
- if (spec == NULL) {
- *os << (internal::type_equals<Result, void>::value ?
- "returning directly.\n" :
- "returning default value.\n");
- } else {
- *os << "taking default action specified at:\n"
- << FormatFileLocation(spec->file(), spec->line()) << "\n";
- }
- }
-
- // Writes a message that the call is uninteresting (i.e. neither
- // explicitly expected nor explicitly unexpected) to the given
- // ostream.
- virtual void UntypedDescribeUninterestingCall(
- const void* untyped_args,
- ::std::ostream* os) const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- const ArgumentTuple& args =
- *static_cast<const ArgumentTuple*>(untyped_args);
- *os << "Uninteresting mock function call - ";
- DescribeDefaultActionTo(args, os);
- *os << " Function call: " << Name();
- UniversalPrint(args, os);
- }
-
- // Returns the expectation that matches the given function arguments
- // (or NULL is there's no match); when a match is found,
- // untyped_action is set to point to the action that should be
- // performed (or NULL if the action is "do default"), and
- // is_excessive is modified to indicate whether the call exceeds the
- // expected number.
- //
- // Critical section: We must find the matching expectation and the
- // corresponding action that needs to be taken in an ATOMIC
- // transaction. Otherwise another thread may call this mock
- // method in the middle and mess up the state.
- //
- // However, performing the action has to be left out of the critical
- // section. The reason is that we have no control on what the
- // action does (it can invoke an arbitrary user function or even a
- // mock function) and excessive locking could cause a dead lock.
- virtual const ExpectationBase* UntypedFindMatchingExpectation(
- const void* untyped_args,
- const void** untyped_action, bool* is_excessive,
- ::std::ostream* what, ::std::ostream* why)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- const ArgumentTuple& args =
- *static_cast<const ArgumentTuple*>(untyped_args);
- MutexLock l(&g_gmock_mutex);
- TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args);
- if (exp == NULL) { // A match wasn't found.
- this->FormatUnexpectedCallMessageLocked(args, what, why);
- return NULL;
- }
-
- // This line must be done before calling GetActionForArguments(),
- // which will increment the call count for *exp and thus affect
- // its saturation status.
- *is_excessive = exp->IsSaturated();
- const Action<F>* action = exp->GetActionForArguments(this, args, what, why);
- if (action != NULL && action->IsDoDefault())
- action = NULL; // Normalize "do default" to NULL.
- *untyped_action = action;
- return exp;
- }
-
- // Prints the given function arguments to the ostream.
- virtual void UntypedPrintArgs(const void* untyped_args,
- ::std::ostream* os) const {
- const ArgumentTuple& args =
- *static_cast<const ArgumentTuple*>(untyped_args);
- UniversalPrint(args, os);
- }
-
- // Returns the expectation that matches the arguments, or NULL if no
- // expectation matches them.
- TypedExpectation<F>* FindMatchingExpectationLocked(
- const ArgumentTuple& args) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- for (typename UntypedExpectations::const_reverse_iterator it =
- untyped_expectations_.rbegin();
- it != untyped_expectations_.rend(); ++it) {
- TypedExpectation<F>* const exp =
- static_cast<TypedExpectation<F>*>(it->get());
- if (exp->ShouldHandleArguments(args)) {
- return exp;
- }
- }
- return NULL;
- }
-
- // Returns a message that the arguments don't match any expectation.
- void FormatUnexpectedCallMessageLocked(
- const ArgumentTuple& args,
- ::std::ostream* os,
- ::std::ostream* why) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- *os << "\nUnexpected mock function call - ";
- DescribeDefaultActionTo(args, os);
- PrintTriedExpectationsLocked(args, why);
- }
-
- // Prints a list of expectations that have been tried against the
- // current mock function call.
- void PrintTriedExpectationsLocked(
- const ArgumentTuple& args,
- ::std::ostream* why) const
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
- g_gmock_mutex.AssertHeld();
- const int count = static_cast<int>(untyped_expectations_.size());
- *why << "Google Mock tried the following " << count << " "
- << (count == 1 ? "expectation, but it didn't match" :
- "expectations, but none matched")
- << ":\n";
- for (int i = 0; i < count; i++) {
- TypedExpectation<F>* const expectation =
- static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get());
- *why << "\n";
- expectation->DescribeLocationTo(why);
- if (count > 1) {
- *why << "tried expectation #" << i << ": ";
- }
- *why << expectation->source_text() << "...\n";
- expectation->ExplainMatchResultTo(args, why);
- expectation->DescribeCallCountTo(why);
- }
- }
-
- // The current spec (either default action spec or expectation spec)
- // being described on this function mocker.
- MockSpec<F> current_spec_;
-
- // There is no generally useful and implementable semantics of
- // copying a mock object, so copying a mock is usually a user error.
- // Thus we disallow copying function mockers. If the user really
- // wants to copy a mock object, he should implement his own copy
- // operation, for example:
- //
- // class MockFoo : public Foo {
- // public:
- // // Defines a copy constructor explicitly.
- // MockFoo(const MockFoo& src) {}
- // ...
- // };
- GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase);
-}; // class FunctionMockerBase
-
-#ifdef _MSC_VER
-# pragma warning(pop) // Restores the warning state.
-#endif // _MSV_VER
-
-// Implements methods of FunctionMockerBase.
-
-// Verifies that all expectations on this mock function have been
-// satisfied. Reports one or more Google Test non-fatal failures and
-// returns false if not.
-
-// Reports an uninteresting call (whose description is in msg) in the
-// manner specified by 'reaction'.
-void ReportUninterestingCall(CallReaction reaction, const std::string& msg);
-
-} // namespace internal
-
-// The style guide prohibits "using" statements in a namespace scope
-// inside a header file. However, the MockSpec 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 MockSpec in ::testing.
-using internal::MockSpec;
-
-// Const(x) is a convenient function for obtaining a const reference
-// to x. This is useful for setting expectations on an overloaded
-// const mock method, e.g.
-//
-// class MockFoo : public FooInterface {
-// public:
-// MOCK_METHOD0(Bar, int());
-// MOCK_CONST_METHOD0(Bar, int&());
-// };
-//
-// MockFoo foo;
-// // Expects a call to non-const MockFoo::Bar().
-// EXPECT_CALL(foo, Bar());
-// // Expects a call to const MockFoo::Bar().
-// EXPECT_CALL(Const(foo), Bar());
-template <typename T>
-inline const T& Const(const T& x) { return x; }
-
-// Constructs an Expectation object that references and co-owns exp.
-inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
- : expectation_base_(exp.GetHandle().expectation_base()) {}
-
-} // namespace testing
-
-// A separate macro is required to avoid compile errors when the name
-// of the method used in call is a result of macro expansion.
-// See CompilesWithMethodNameExpandedFromMacro tests in
-// internal/gmock-spec-builders_test.cc for more details.
-#define GMOCK_ON_CALL_IMPL_(obj, call) \
- ((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \
- #obj, #call)
-#define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call)
-
-#define GMOCK_EXPECT_CALL_IMPL_(obj, call) \
- ((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call)
-#define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call)
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
diff --git a/src/lib/install/include/gmock/gmock.h b/src/lib/install/include/gmock/gmock.h
deleted file mode 100755
index 6735c71..0000000
--- a/src/lib/install/include/gmock/gmock.h
+++ /dev/null
@@ -1,94 +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 is the main header file a user should include.
-
-#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_
-#define GMOCK_INCLUDE_GMOCK_GMOCK_H_
-
-// This file implements the following syntax:
-//
-// ON_CALL(mock_object.Method(...))
-// .With(...) ?
-// .WillByDefault(...);
-//
-// where With() is optional and WillByDefault() must appear exactly
-// once.
-//
-// EXPECT_CALL(mock_object.Method(...))
-// .With(...) ?
-// .Times(...) ?
-// .InSequence(...) *
-// .WillOnce(...) *
-// .WillRepeatedly(...) ?
-// .RetiresOnSaturation() ? ;
-//
-// where all clauses are optional and WillOnce() can be repeated.
-
-#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-nice-strict.h"
-#include "gmock/gmock-generated-matchers.h"
-#include "gmock/gmock-matchers.h"
-#include "gmock/gmock-more-actions.h"
-#include "gmock/gmock-more-matchers.h"
-#include "gmock/internal/gmock-internal-utils.h"
-
-namespace testing {
-
-// Declares Google Mock flags that we want a user to use programmatically.
-GMOCK_DECLARE_bool_(catch_leaked_mocks);
-GMOCK_DECLARE_string_(verbose);
-
-// Initializes Google Mock. This must be called before running the
-// tests. In particular, it parses the command line for the flags
-// that Google Mock recognizes. Whenever a Google Mock flag is seen,
-// it is removed from argv, and *argc is decremented.
-//
-// No value is returned. Instead, the Google Mock flag variables are
-// updated.
-//
-// Since Google Test is needed for Google Mock to work, this function
-// also initializes Google Test and parses its flags, if that hasn't
-// been done.
-GTEST_API_ void InitGoogleMock(int* argc, char** argv);
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_
diff --git a/src/lib/install/include/gmock/internal/custom/gmock-generated-actions.h b/src/lib/install/include/gmock/internal/custom/gmock-generated-actions.h
deleted file mode 100755
index 7dc3b1a..0000000
--- a/src/lib/install/include/gmock/internal/custom/gmock-generated-actions.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gmock-generated-actions.h.pump
-// DO NOT EDIT BY HAND!!!
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
diff --git a/src/lib/install/include/gmock/internal/custom/gmock-generated-actions.h.pump b/src/lib/install/include/gmock/internal/custom/gmock-generated-actions.h.pump
deleted file mode 100755
index d26c8a0..0000000
--- a/src/lib/install/include/gmock/internal/custom/gmock-generated-actions.h.pump
+++ /dev/null
@@ -1,10 +0,0 @@
-$$ -*- mode: c++; -*-
-$$ This is a Pump source file (http://go/pump). Please use Pump to convert
-$$ it to callback-actions.h.
-$$
-$var max_callback_arity = 5
-$$}} This meta comment fixes auto-indentation in editors.
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
diff --git a/src/lib/install/include/gmock/internal/custom/gmock-matchers.h b/src/lib/install/include/gmock/internal/custom/gmock-matchers.h
deleted file mode 100755
index f2efef9..0000000
--- a/src/lib/install/include/gmock/internal/custom/gmock-matchers.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015, 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.
-//
-// ============================================================
-// An installation-specific extension point for gmock-matchers.h.
-// ============================================================
-//
-// Adds google3 callback support to CallableTraits.
-//
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
diff --git a/src/lib/install/include/gmock/internal/custom/gmock-port.h b/src/lib/install/include/gmock/internal/custom/gmock-port.h
deleted file mode 100755
index 9ce8bfe..0000000
--- a/src/lib/install/include/gmock/internal/custom/gmock-port.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2015, 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.
-//
-// Injection point for custom user configurations.
-// The following macros can be defined:
-//
-// Flag related macros:
-// GMOCK_DECLARE_bool_(name)
-// GMOCK_DECLARE_int32_(name)
-// GMOCK_DECLARE_string_(name)
-// GMOCK_DEFINE_bool_(name, default_val, doc)
-// GMOCK_DEFINE_int32_(name, default_val, doc)
-// GMOCK_DEFINE_string_(name, default_val, doc)
-//
-// ** Custom implementation starts here **
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
diff --git a/src/lib/install/include/gmock/internal/gmock-generated-internal-utils.h b/src/lib/install/include/gmock/internal/gmock-generated-internal-utils.h
deleted file mode 100755
index 7811e43..0000000
--- a/src/lib/install/include/gmock/internal/gmock-generated-internal-utils.h
+++ /dev/null
@@ -1,279 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gmock-generated-internal-utils.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 contains template meta-programming utility classes needed
-// for implementing Google Mock.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-
-#include "gmock/internal/gmock-port.h"
-
-namespace testing {
-
-template <typename T>
-class Matcher;
-
-namespace internal {
-
-// An IgnoredValue object can be implicitly constructed from ANY value.
-// This is used in implementing the IgnoreResult(a) action.
-class IgnoredValue {
- public:
- // This constructor template allows any value to be implicitly
- // converted to IgnoredValue. The object has no data member and
- // doesn't try to remember anything about the argument. We
- // deliberately omit the 'explicit' keyword in order to allow the
- // conversion to be implicit.
- template <typename T>
- IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
-};
-
-// MatcherTuple<T>::type is a tuple type where each field is a Matcher
-// for the corresponding field in tuple type T.
-template <typename Tuple>
-struct MatcherTuple;
-
-template <>
-struct MatcherTuple< ::testing::tuple<> > {
- typedef ::testing::tuple< > type;
-};
-
-template <typename A1>
-struct MatcherTuple< ::testing::tuple<A1> > {
- typedef ::testing::tuple<Matcher<A1> > type;
-};
-
-template <typename A1, typename A2>
-struct MatcherTuple< ::testing::tuple<A1, A2> > {
- typedef ::testing::tuple<Matcher<A1>, Matcher<A2> > type;
-};
-
-template <typename A1, typename A2, typename A3>
-struct MatcherTuple< ::testing::tuple<A1, A2, A3> > {
- typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4>
-struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4> > {
- typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>,
- Matcher<A4> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5>
-struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5> > {
- typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6>
-struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
- typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7>
-struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
- typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8>
-struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
- typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9>
-struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
- typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9> > type;
-};
-
-template <typename A1, typename A2, typename A3, typename A4, typename A5,
- typename A6, typename A7, typename A8, typename A9, typename A10>
-struct MatcherTuple< ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
- A10> > {
- typedef ::testing::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>,
- Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9>,
- Matcher<A10> > type;
-};
-
-// Template struct Function<F>, where F must be a function type, contains
-// the following typedefs:
-//
-// Result: the function's return type.
-// ArgumentN: the type of the N-th argument, where N starts with 1.
-// ArgumentTuple: the tuple type consisting of all parameters of F.
-// ArgumentMatcherTuple: the tuple type consisting of Matchers for all
-// parameters of F.
-// MakeResultVoid: the function type obtained by substituting void
-// for the return type of F.
-// MakeResultIgnoredValue:
-// the function type obtained by substituting Something
-// for the return type of F.
-template <typename F>
-struct Function;
-
-template <typename R>
-struct Function<R()> {
- typedef R Result;
- typedef ::testing::tuple<> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid();
- typedef IgnoredValue MakeResultIgnoredValue();
-};
-
-template <typename R, typename A1>
-struct Function<R(A1)>
- : Function<R()> {
- typedef A1 Argument1;
- typedef ::testing::tuple<A1> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1);
- typedef IgnoredValue MakeResultIgnoredValue(A1);
-};
-
-template <typename R, typename A1, typename A2>
-struct Function<R(A1, A2)>
- : Function<R(A1)> {
- typedef A2 Argument2;
- typedef ::testing::tuple<A1, A2> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2);
-};
-
-template <typename R, typename A1, typename A2, typename A3>
-struct Function<R(A1, A2, A3)>
- : Function<R(A1, A2)> {
- typedef A3 Argument3;
- typedef ::testing::tuple<A1, A2, A3> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4>
-struct Function<R(A1, A2, A3, A4)>
- : Function<R(A1, A2, A3)> {
- typedef A4 Argument4;
- typedef ::testing::tuple<A1, A2, A3, A4> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5>
-struct Function<R(A1, A2, A3, A4, A5)>
- : Function<R(A1, A2, A3, A4)> {
- typedef A5 Argument5;
- typedef ::testing::tuple<A1, A2, A3, A4, A5> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6>
-struct Function<R(A1, A2, A3, A4, A5, A6)>
- : Function<R(A1, A2, A3, A4, A5)> {
- typedef A6 Argument6;
- typedef ::testing::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7)>
- : Function<R(A1, A2, A3, A4, A5, A6)> {
- typedef A7 Argument7;
- typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>
- : Function<R(A1, A2, A3, A4, A5, A6, A7)> {
- typedef A8 Argument8;
- typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
- : Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
- typedef A9 Argument9;
- typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
- A9);
-};
-
-template <typename R, typename A1, typename A2, typename A3, typename A4,
- typename A5, typename A6, typename A7, typename A8, typename A9,
- typename A10>
-struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
- : Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
- typedef A10 Argument10;
- typedef ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
- A10> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
- typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
- A9, A10);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
diff --git a/src/lib/install/include/gmock/internal/gmock-generated-internal-utils.h.pump b/src/lib/install/include/gmock/internal/gmock-generated-internal-utils.h.pump
deleted file mode 100755
index 800af17..0000000
--- a/src/lib/install/include/gmock/internal/gmock-generated-internal-utils.h.pump
+++ /dev/null
@@ -1,136 +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 contains template meta-programming utility classes needed
-// for implementing Google Mock.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
-
-#include "gmock/internal/gmock-port.h"
-
-namespace testing {
-
-template <typename T>
-class Matcher;
-
-namespace internal {
-
-// An IgnoredValue object can be implicitly constructed from ANY value.
-// This is used in implementing the IgnoreResult(a) action.
-class IgnoredValue {
- public:
- // This constructor template allows any value to be implicitly
- // converted to IgnoredValue. The object has no data member and
- // doesn't try to remember anything about the argument. We
- // deliberately omit the 'explicit' keyword in order to allow the
- // conversion to be implicit.
- template <typename T>
- IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
-};
-
-// MatcherTuple<T>::type is a tuple type where each field is a Matcher
-// for the corresponding field in tuple type T.
-template <typename Tuple>
-struct MatcherTuple;
-
-
-$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 matcher_As = [[$for j, [[Matcher<A$j>]]]]
-template <$typename_As>
-struct MatcherTuple< ::testing::tuple<$As> > {
- typedef ::testing::tuple<$matcher_As > type;
-};
-
-
-]]
-// Template struct Function<F>, where F must be a function type, contains
-// the following typedefs:
-//
-// Result: the function's return type.
-// ArgumentN: the type of the N-th argument, where N starts with 1.
-// ArgumentTuple: the tuple type consisting of all parameters of F.
-// ArgumentMatcherTuple: the tuple type consisting of Matchers for all
-// parameters of F.
-// MakeResultVoid: the function type obtained by substituting void
-// for the return type of F.
-// MakeResultIgnoredValue:
-// the function type obtained by substituting Something
-// for the return type of F.
-template <typename F>
-struct Function;
-
-template <typename R>
-struct Function<R()> {
- typedef R Result;
- typedef ::testing::tuple<> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid();
- typedef IgnoredValue MakeResultIgnoredValue();
-};
-
-
-$range i 1..n
-$for i [[
-$range j 1..i
-$var typename_As = [[$for j [[, typename A$j]]]]
-$var As = [[$for j, [[A$j]]]]
-$var matcher_As = [[$for j, [[Matcher<A$j>]]]]
-$range k 1..i-1
-$var prev_As = [[$for k, [[A$k]]]]
-template <typename R$typename_As>
-struct Function<R($As)>
- : Function<R($prev_As)> {
- typedef A$i Argument$i;
- typedef ::testing::tuple<$As> ArgumentTuple;
- typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
- typedef void MakeResultVoid($As);
- typedef IgnoredValue MakeResultIgnoredValue($As);
-};
-
-
-]]
-} // namespace internal
-
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
diff --git a/src/lib/install/include/gmock/internal/gmock-internal-utils.h b/src/lib/install/include/gmock/internal/gmock-internal-utils.h
deleted file mode 100755
index 7e65cea..0000000
--- a/src/lib/install/include/gmock/internal/gmock-internal-utils.h
+++ /dev/null
@@ -1,510 +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 defines some utilities useful for implementing Google
-// Mock. They are subject to change without notice, so please DO NOT
-// USE THEM IN USER CODE.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
-
-#include <stdio.h>
-#include <ostream> // NOLINT
-#include <string>
-
-#include "gmock/internal/gmock-generated-internal-utils.h"
-#include "gmock/internal/gmock-port.h"
-#include "gtest/gtest.h"
-
-namespace testing {
-namespace internal {
-
-// Converts an identifier name to a space-separated list of lower-case
-// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
-// treated as one word. For example, both "FooBar123" and
-// "foo_bar_123" are converted to "foo bar 123".
-GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name);
-
-// PointeeOf<Pointer>::type is the type of a value pointed to by a
-// Pointer, which can be either a smart pointer or a raw pointer. The
-// following default implementation is for the case where Pointer is a
-// smart pointer.
-template <typename Pointer>
-struct PointeeOf {
- // Smart pointer classes define type element_type as the type of
- // their pointees.
- typedef typename Pointer::element_type type;
-};
-// This specialization is for the raw pointer case.
-template <typename T>
-struct PointeeOf<T*> { typedef T type; }; // NOLINT
-
-// GetRawPointer(p) returns the raw pointer underlying p when p is a
-// smart pointer, or returns p itself when p is already a raw pointer.
-// The following default implementation is for the smart pointer case.
-template <typename Pointer>
-inline const typename Pointer::element_type* GetRawPointer(const Pointer& p) {
- return p.get();
-}
-// This overloaded version is for the raw pointer case.
-template <typename Element>
-inline Element* GetRawPointer(Element* p) { return p; }
-
-// This comparator allows linked_ptr to be stored in sets.
-template <typename T>
-struct LinkedPtrLessThan {
- bool operator()(const ::testing::internal::linked_ptr<T>& lhs,
- const ::testing::internal::linked_ptr<T>& rhs) const {
- return lhs.get() < rhs.get();
- }
-};
-
-// Symbian compilation can be done with wchar_t being either a native
-// type or a typedef. Using Google Mock with OpenC without wchar_t
-// should require the definition of _STLP_NO_WCHAR_T.
-//
-// MSVC treats wchar_t as a native type usually, but treats it as the
-// same as unsigned short when the compiler option /Zc:wchar_t- is
-// specified. It defines _NATIVE_WCHAR_T_DEFINED symbol when wchar_t
-// is a native type.
-#if (GTEST_OS_SYMBIAN && defined(_STLP_NO_WCHAR_T)) || \
- (defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED))
-// wchar_t is a typedef.
-#else
-# define GMOCK_WCHAR_T_IS_NATIVE_ 1
-#endif
-
-// signed wchar_t and unsigned wchar_t are NOT in the C++ standard.
-// Using them is a bad practice and not portable. So DON'T use them.
-//
-// Still, Google Mock is designed to work even if the user uses signed
-// wchar_t or unsigned wchar_t (obviously, assuming the compiler
-// supports them).
-//
-// To gcc,
-// wchar_t == signed wchar_t != unsigned wchar_t == unsigned int
-#ifdef __GNUC__
-// signed/unsigned wchar_t are valid types.
-# define GMOCK_HAS_SIGNED_WCHAR_T_ 1
-#endif
-
-// In what follows, we use the term "kind" to indicate whether a type
-// is bool, an integer type (excluding bool), a floating-point type,
-// or none of them. This categorization is useful for determining
-// when a matcher argument type can be safely converted to another
-// type in the implementation of SafeMatcherCast.
-enum TypeKind {
- kBool, kInteger, kFloatingPoint, kOther
-};
-
-// KindOf<T>::value is the kind of type T.
-template <typename T> struct KindOf {
- enum { value = kOther }; // The default kind.
-};
-
-// This macro declares that the kind of 'type' is 'kind'.
-#define GMOCK_DECLARE_KIND_(type, kind) \
- template <> struct KindOf<type> { enum { value = kind }; }
-
-GMOCK_DECLARE_KIND_(bool, kBool);
-
-// All standard integer types.
-GMOCK_DECLARE_KIND_(char, kInteger);
-GMOCK_DECLARE_KIND_(signed char, kInteger);
-GMOCK_DECLARE_KIND_(unsigned char, kInteger);
-GMOCK_DECLARE_KIND_(short, kInteger); // NOLINT
-GMOCK_DECLARE_KIND_(unsigned short, kInteger); // NOLINT
-GMOCK_DECLARE_KIND_(int, kInteger);
-GMOCK_DECLARE_KIND_(unsigned int, kInteger);
-GMOCK_DECLARE_KIND_(long, kInteger); // NOLINT
-GMOCK_DECLARE_KIND_(unsigned long, kInteger); // NOLINT
-
-#if GMOCK_WCHAR_T_IS_NATIVE_
-GMOCK_DECLARE_KIND_(wchar_t, kInteger);
-#endif
-
-// Non-standard integer types.
-GMOCK_DECLARE_KIND_(Int64, kInteger);
-GMOCK_DECLARE_KIND_(UInt64, kInteger);
-
-// All standard floating-point types.
-GMOCK_DECLARE_KIND_(float, kFloatingPoint);
-GMOCK_DECLARE_KIND_(double, kFloatingPoint);
-GMOCK_DECLARE_KIND_(long double, kFloatingPoint);
-
-#undef GMOCK_DECLARE_KIND_
-
-// Evaluates to the kind of 'type'.
-#define GMOCK_KIND_OF_(type) \
- static_cast< ::testing::internal::TypeKind>( \
- ::testing::internal::KindOf<type>::value)
-
-// Evaluates to true iff integer type T is signed.
-#define GMOCK_IS_SIGNED_(T) (static_cast<T>(-1) < 0)
-
-// LosslessArithmeticConvertibleImpl<kFromKind, From, kToKind, To>::value
-// is true iff arithmetic type From can be losslessly converted to
-// arithmetic type To.
-//
-// It's the user's responsibility to ensure that both From and To are
-// raw (i.e. has no CV modifier, is not a pointer, and is not a
-// reference) built-in arithmetic types, kFromKind is the kind of
-// From, and kToKind is the kind of To; the value is
-// implementation-defined when the above pre-condition is violated.
-template <TypeKind kFromKind, typename From, TypeKind kToKind, typename To>
-struct LosslessArithmeticConvertibleImpl : public false_type {};
-
-// Converting bool to bool is lossless.
-template <>
-struct LosslessArithmeticConvertibleImpl<kBool, bool, kBool, bool>
- : public true_type {}; // NOLINT
-
-// Converting bool to any integer type is lossless.
-template <typename To>
-struct LosslessArithmeticConvertibleImpl<kBool, bool, kInteger, To>
- : public true_type {}; // NOLINT
-
-// Converting bool to any floating-point type is lossless.
-template <typename To>
-struct LosslessArithmeticConvertibleImpl<kBool, bool, kFloatingPoint, To>
- : public true_type {}; // NOLINT
-
-// Converting an integer to bool is lossy.
-template <typename From>
-struct LosslessArithmeticConvertibleImpl<kInteger, From, kBool, bool>
- : public false_type {}; // NOLINT
-
-// Converting an integer to another non-bool integer is lossless iff
-// the target type's range encloses the source type's range.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<kInteger, From, kInteger, To>
- : public bool_constant<
- // When converting from a smaller size to a larger size, we are
- // fine as long as we are not converting from signed to unsigned.
- ((sizeof(From) < sizeof(To)) &&
- (!GMOCK_IS_SIGNED_(From) || GMOCK_IS_SIGNED_(To))) ||
- // When converting between the same size, the signedness must match.
- ((sizeof(From) == sizeof(To)) &&
- (GMOCK_IS_SIGNED_(From) == GMOCK_IS_SIGNED_(To)))> {}; // NOLINT
-
-#undef GMOCK_IS_SIGNED_
-
-// Converting an integer to a floating-point type may be lossy, since
-// the format of a floating-point number is implementation-defined.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<kInteger, From, kFloatingPoint, To>
- : public false_type {}; // NOLINT
-
-// Converting a floating-point to bool is lossy.
-template <typename From>
-struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kBool, bool>
- : public false_type {}; // NOLINT
-
-// Converting a floating-point to an integer is lossy.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kInteger, To>
- : public false_type {}; // NOLINT
-
-// Converting a floating-point to another floating-point is lossless
-// iff the target type is at least as big as the source type.
-template <typename From, typename To>
-struct LosslessArithmeticConvertibleImpl<
- kFloatingPoint, From, kFloatingPoint, To>
- : public bool_constant<sizeof(From) <= sizeof(To)> {}; // NOLINT
-
-// LosslessArithmeticConvertible<From, To>::value is true iff arithmetic
-// type From can be losslessly converted to arithmetic type To.
-//
-// It's the user's responsibility to ensure that both From and To are
-// raw (i.e. has no CV modifier, is not a pointer, and is not a
-// reference) built-in arithmetic types; the value is
-// implementation-defined when the above pre-condition is violated.
-template <typename From, typename To>
-struct LosslessArithmeticConvertible
- : public LosslessArithmeticConvertibleImpl<
- GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To> {}; // NOLINT
-
-// This interface knows how to report a Google Mock failure (either
-// non-fatal or fatal).
-class FailureReporterInterface {
- public:
- // The type of a failure (either non-fatal or fatal).
- enum FailureType {
- kNonfatal, kFatal
- };
-
- virtual ~FailureReporterInterface() {}
-
- // Reports a failure that occurred at the given source file location.
- virtual void ReportFailure(FailureType type, const char* file, int line,
- const std::string& message) = 0;
-};
-
-// Returns the failure reporter used by Google Mock.
-GTEST_API_ FailureReporterInterface* GetFailureReporter();
-
-// Asserts that condition is true; aborts the process with the given
-// message if condition is false. We cannot use LOG(FATAL) or CHECK()
-// as Google Mock might be used to mock the log sink itself. We
-// inline this function to prevent it from showing up in the stack
-// trace.
-inline void Assert(bool condition, const char* file, int line,
- const std::string& msg) {
- if (!condition) {
- GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal,
- file, line, msg);
- }
-}
-inline void Assert(bool condition, const char* file, int line) {
- Assert(condition, file, line, "Assertion failed.");
-}
-
-// Verifies that condition is true; generates a non-fatal failure if
-// condition is false.
-inline void Expect(bool condition, const char* file, int line,
- const std::string& msg) {
- if (!condition) {
- GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal,
- file, line, msg);
- }
-}
-inline void Expect(bool condition, const char* file, int line) {
- Expect(condition, file, line, "Expectation failed.");
-}
-
-// Severity level of a log.
-enum LogSeverity {
- kInfo = 0,
- kWarning = 1
-};
-
-// Valid values for the --gmock_verbose flag.
-
-// All logs (informational and warnings) are printed.
-const char kInfoVerbosity[] = "info";
-// Only warnings are printed.
-const char kWarningVerbosity[] = "warning";
-// No logs are printed.
-const char kErrorVerbosity[] = "error";
-
-// Returns true iff a log with the given severity is visible according
-// to the --gmock_verbose flag.
-GTEST_API_ bool LogIsVisible(LogSeverity severity);
-
-// Prints the given message to stdout iff 'severity' >= the level
-// specified by the --gmock_verbose flag. If stack_frames_to_skip >=
-// 0, also prints the stack trace excluding the top
-// stack_frames_to_skip frames. In opt mode, any positive
-// stack_frames_to_skip is treated as 0, since we don't know which
-// function calls will be inlined by the compiler and need to be
-// conservative.
-GTEST_API_ void Log(LogSeverity severity, const std::string& message,
- int stack_frames_to_skip);
-
-// TODO(wan@google.com): group all type utilities together.
-
-// Type traits.
-
-// is_reference<T>::value is non-zero iff T is a reference type.
-template <typename T> struct is_reference : public false_type {};
-template <typename T> struct is_reference<T&> : public true_type {};
-
-// type_equals<T1, T2>::value is non-zero iff T1 and T2 are the same type.
-template <typename T1, typename T2> struct type_equals : public false_type {};
-template <typename T> struct type_equals<T, T> : public true_type {};
-
-// remove_reference<T>::type removes the reference from type T, if any.
-template <typename T> struct remove_reference { typedef T type; }; // NOLINT
-template <typename T> struct remove_reference<T&> { typedef T type; }; // NOLINT
-
-// DecayArray<T>::type turns an array type U[N] to const U* and preserves
-// other types. Useful for saving a copy of a function argument.
-template <typename T> struct DecayArray { typedef T type; }; // NOLINT
-template <typename T, size_t N> struct DecayArray<T[N]> {
- typedef const T* type;
-};
-// Sometimes people use arrays whose size is not available at the use site
-// (e.g. extern const char kNamePrefix[]). This specialization covers that
-// case.
-template <typename T> struct DecayArray<T[]> {
- typedef const T* type;
-};
-
-// Disable MSVC warnings for infinite recursion, since in this case the
-// the recursion is unreachable.
-#ifdef _MSC_VER
-# pragma warning(push)
-# pragma warning(disable:4717)
-#endif
-
-// Invalid<T>() is usable as an expression of type T, but will terminate
-// the program with an assertion failure if actually run. This is useful
-// when a value of type T is needed for compilation, but the statement
-// will not really be executed (or we don't care if the statement
-// crashes).
-template <typename T>
-inline T Invalid() {
- Assert(false, "", -1, "Internal error: attempt to return invalid value");
- // This statement is unreachable, and would never terminate even if it
- // could be reached. It is provided only to placate compiler warnings
- // about missing return statements.
- return Invalid<T>();
-}
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-// Given a raw type (i.e. having no top-level reference or const
-// modifier) RawContainer that's either an STL-style container or a
-// native array, class StlContainerView<RawContainer> has the
-// following members:
-//
-// - type is a type that provides an STL-style container view to
-// (i.e. implements the STL container concept for) RawContainer;
-// - const_reference is a type that provides a reference to a const
-// RawContainer;
-// - ConstReference(raw_container) returns a const reference to an STL-style
-// container view to raw_container, which is a RawContainer.
-// - Copy(raw_container) returns an STL-style container view of a
-// copy of raw_container, which is a RawContainer.
-//
-// This generic version is used when RawContainer itself is already an
-// STL-style container.
-template <class RawContainer>
-class StlContainerView {
- public:
- typedef RawContainer type;
- typedef const type& const_reference;
-
- static const_reference ConstReference(const RawContainer& container) {
- // Ensures that RawContainer is not a const type.
- testing::StaticAssertTypeEq<RawContainer,
- GTEST_REMOVE_CONST_(RawContainer)>();
- return container;
- }
- static type Copy(const RawContainer& container) { return container; }
-};
-
-// This specialization is used when RawContainer is a native array type.
-template <typename Element, size_t N>
-class StlContainerView<Element[N]> {
- public:
- typedef GTEST_REMOVE_CONST_(Element) RawElement;
- typedef internal::NativeArray<RawElement> type;
- // NativeArray<T> can represent a native array either by value or by
- // reference (selected by a constructor argument), so 'const type'
- // can be used to reference a const native array. We cannot
- // 'typedef const type& const_reference' here, as that would mean
- // ConstReference() has to return a reference to a local variable.
- typedef const type const_reference;
-
- static const_reference ConstReference(const Element (&array)[N]) {
- // Ensures that Element is not a const type.
- testing::StaticAssertTypeEq<Element, RawElement>();
-#if GTEST_OS_SYMBIAN
- // The Nokia Symbian compiler confuses itself in template instantiation
- // for this call without the cast to Element*:
- // function call '[testing::internal::NativeArray<char *>].NativeArray(
- // {lval} const char *[4], long, testing::internal::RelationToSource)'
- // does not match
- // 'testing::internal::NativeArray<char *>::NativeArray(
- // char *const *, unsigned int, testing::internal::RelationToSource)'
- // (instantiating: 'testing::internal::ContainsMatcherImpl
- // <const char * (&)[4]>::Matches(const char * (&)[4]) const')
- // (instantiating: 'testing::internal::StlContainerView<char *[4]>::
- // ConstReference(const char * (&)[4])')
- // (and though the N parameter type is mismatched in the above explicit
- // conversion of it doesn't help - only the conversion of the array).
- return type(const_cast<Element*>(&array[0]), N,
- RelationToSourceReference());
-#else
- return type(array, N, RelationToSourceReference());
-#endif // GTEST_OS_SYMBIAN
- }
- static type Copy(const Element (&array)[N]) {
-#if GTEST_OS_SYMBIAN
- return type(const_cast<Element*>(&array[0]), N, RelationToSourceCopy());
-#else
- return type(array, N, RelationToSourceCopy());
-#endif // GTEST_OS_SYMBIAN
- }
-};
-
-// This specialization is used when RawContainer is a native array
-// represented as a (pointer, size) tuple.
-template <typename ElementPointer, typename Size>
-class StlContainerView< ::testing::tuple<ElementPointer, Size> > {
- public:
- typedef GTEST_REMOVE_CONST_(
- typename internal::PointeeOf<ElementPointer>::type) RawElement;
- typedef internal::NativeArray<RawElement> type;
- typedef const type const_reference;
-
- static const_reference ConstReference(
- const ::testing::tuple<ElementPointer, Size>& array) {
- return type(get<0>(array), get<1>(array), RelationToSourceReference());
- }
- static type Copy(const ::testing::tuple<ElementPointer, Size>& array) {
- return type(get<0>(array), get<1>(array), RelationToSourceCopy());
- }
-};
-
-// The following specialization prevents the user from instantiating
-// StlContainer with a reference type.
-template <typename T> class StlContainerView<T&>;
-
-// A type transform to remove constness from the first part of a pair.
-// Pairs like that are used as the value_type of associative containers,
-// and this transform produces a similar but assignable pair.
-template <typename T>
-struct RemoveConstFromKey {
- typedef T type;
-};
-
-// Partially specialized to remove constness from std::pair<const K, V>.
-template <typename K, typename V>
-struct RemoveConstFromKey<std::pair<const K, V> > {
- typedef std::pair<K, V> type;
-};
-
-// Mapping from booleans to types. Similar to boost::bool_<kValue> and
-// std::integral_constant<bool, kValue>.
-template <bool kValue>
-struct BooleanConstant {};
-
-} // namespace internal
-} // namespace testing
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
-
diff --git a/src/lib/install/include/gmock/internal/gmock-port.h b/src/lib/install/include/gmock/internal/gmock-port.h
deleted file mode 100755
index 63f4a68..0000000
--- a/src/lib/install/include/gmock/internal/gmock-port.h
+++ /dev/null
@@ -1,91 +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.
-//
-// Author: vadimb@google.com (Vadim Berman)
-//
-// Low-level types and utilities for porting Google Mock to various
-// platforms. All macros ending with _ and symbols defined in an
-// internal namespace are subject to change without notice. Code
-// outside Google Mock MUST NOT USE THEM DIRECTLY. Macros that don't
-// end with _ are part of Google Mock's public API and can be used by
-// code outside Google Mock.
-
-#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
-#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
-
-#include <assert.h>
-#include <stdlib.h>
-#include <iostream>
-
-// Most of the utilities needed for porting Google Mock are also
-// required for Google Test and are defined in gtest-port.h.
-//
-// Note to maintainers: to reduce code duplication, prefer adding
-// portability utilities to Google Test's gtest-port.h instead of
-// here, as Google Mock depends on Google Test. Only add a utility
-// here if it's truly specific to Google Mock.
-#include "gtest/internal/gtest-linked_ptr.h"
-#include "gtest/internal/gtest-port.h"
-#include "gmock/internal/custom/gmock-port.h"
-
-// To avoid conditional compilation everywhere, we make it
-// gmock-port.h's responsibility to #include the header implementing
-// tr1/tuple. gmock-port.h does this via gtest-port.h, which is
-// guaranteed to pull in the tuple header.
-
-// For MS Visual C++, check the compiler version. At least VS 2003 is
-// required to compile Google Mock.
-#if defined(_MSC_VER) && _MSC_VER < 1310
-# error "At least Visual C++ 2003 (7.1) is required to compile Google Mock."
-#endif
-
-// Macro for referencing flags. This is public as we want the user to
-// use this syntax to reference Google Mock flags.
-#define GMOCK_FLAG(name) FLAGS_gmock_##name
-
-#if !defined(GMOCK_DECLARE_bool_)
-
-// Macros for declaring flags.
-#define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name)
-#define GMOCK_DECLARE_int32_(name) \
- extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name)
-#define GMOCK_DECLARE_string_(name) \
- extern GTEST_API_ ::std::string GMOCK_FLAG(name)
-
-// Macros for defining flags.
-#define GMOCK_DEFINE_bool_(name, default_val, doc) \
- GTEST_API_ bool GMOCK_FLAG(name) = (default_val)
-#define GMOCK_DEFINE_int32_(name, default_val, doc) \
- GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
-#define GMOCK_DEFINE_string_(name, default_val, doc) \
- GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val)
-
-#endif // !defined(GMOCK_DECLARE_bool_)
-
-#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
diff --git a/src/lib/install/include/gtest/gtest-death-test.h b/src/lib/install/include/gtest/gtest-death-test.h
deleted file mode 100755
index 957a69c..0000000
--- a/src/lib/install/include/gtest/gtest-death-test.h
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 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.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the public API for death tests. It is
-// #included by gtest.h so a user doesn't need to include this
-// directly.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
-
-#include "gtest/internal/gtest-death-test-internal.h"
-
-namespace testing {
-
-// This flag controls the style of death tests. Valid values are "threadsafe",
-// meaning that the death test child process will re-execute the test binary
-// from the start, running only a single death test, or "fast",
-// meaning that the child process will execute the test logic immediately
-// after forking.
-GTEST_DECLARE_string_(death_test_style);
-
-#if GTEST_HAS_DEATH_TEST
-
-namespace internal {
-
-// Returns a Boolean value indicating whether the caller is currently
-// executing in the context of the death test child process. Tools such as
-// Valgrind heap checkers may need this to modify their behavior in death
-// tests. IMPORTANT: This is an internal utility. Using it may break the
-// implementation of death tests. User code MUST NOT use it.
-GTEST_API_ bool InDeathTestChild();
-
-} // namespace internal
-
-// The following macros are useful for writing death tests.
-
-// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
-// executed:
-//
-// 1. It generates a warning if there is more than one active
-// thread. This is because it's safe to fork() or clone() only
-// when there is a single thread.
-//
-// 2. The parent process clone()s a sub-process and runs the death
-// test in it; the sub-process exits with code 0 at the end of the
-// death test, if it hasn't exited already.
-//
-// 3. The parent process waits for the sub-process to terminate.
-//
-// 4. The parent process checks the exit code and error message of
-// the sub-process.
-//
-// Examples:
-//
-// ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
-// for (int i = 0; i < 5; i++) {
-// EXPECT_DEATH(server.ProcessRequest(i),
-// "Invalid request .* in ProcessRequest()")
-// << "Failed to die on request " << i;
-// }
-//
-// ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
-//
-// bool KilledBySIGHUP(int exit_code) {
-// return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
-// }
-//
-// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
-//
-// On the regular expressions used in death tests:
-//
-// On POSIX-compliant systems (*nix), we use the <regex.h> library,
-// which uses the POSIX extended regex syntax.
-//
-// On other platforms (e.g. Windows), we only support a simple regex
-// syntax implemented as part of Google Test. This limited
-// implementation should be enough most of the time when writing
-// death tests; though it lacks many features you can find in PCRE
-// or POSIX extended regex syntax. For example, we don't support
-// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
-// repetition count ("x{5,7}"), among others.
-//
-// Below is the syntax that we do support. We chose it to be a
-// subset of both PCRE and POSIX extended regex, so it's easy to
-// learn wherever you come from. In the following: 'A' denotes a
-// literal character, period (.), or a single \\ escape sequence;
-// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
-// natural numbers.
-//
-// c matches any literal character c
-// \\d matches any decimal digit
-// \\D matches any character that's not a decimal digit
-// \\f matches \f
-// \\n matches \n
-// \\r matches \r
-// \\s matches any ASCII whitespace, including \n
-// \\S matches any character that's not a whitespace
-// \\t matches \t
-// \\v matches \v
-// \\w matches any letter, _, or decimal digit
-// \\W matches any character that \\w doesn't match
-// \\c matches any literal character c, which must be a punctuation
-// . matches any single character except \n
-// A? matches 0 or 1 occurrences of A
-// A* matches 0 or many occurrences of A
-// A+ matches 1 or many occurrences of A
-// ^ matches the beginning of a string (not that of each line)
-// $ matches the end of a string (not that of each line)
-// xy matches x followed by y
-//
-// If you accidentally use PCRE or POSIX extended regex features
-// not implemented by us, you will get a run-time failure. In that
-// case, please try to rewrite your regular expression within the
-// above syntax.
-//
-// This implementation is *not* meant to be as highly tuned or robust
-// as a compiled regex library, but should perform well enough for a
-// death test, which already incurs significant overhead by launching
-// a child process.
-//
-// Known caveats:
-//
-// A "threadsafe" style death test obtains the path to the test
-// program from argv[0] and re-executes it in the sub-process. For
-// simplicity, the current implementation doesn't search the PATH
-// when launching the sub-process. This means that the user must
-// invoke the test program via a path that contains at least one
-// path separator (e.g. path/to/foo_test and
-// /absolute/path/to/bar_test are fine, but foo_test is not). This
-// is rarely a problem as people usually don't put the test binary
-// directory in PATH.
-//
-// TODO(wan@google.com): make thread-safe death tests search the PATH.
-
-// Asserts that a given statement causes the program to exit, with an
-// integer exit status that satisfies predicate, and emitting error output
-// that matches regex.
-# define ASSERT_EXIT(statement, predicate, regex) \
- GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
-
-// Like ASSERT_EXIT, but continues on to successive tests in the
-// test case, if any:
-# define EXPECT_EXIT(statement, predicate, regex) \
- GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
-
-// Asserts that a given statement causes the program to exit, either by
-// explicitly exiting with a nonzero exit code or being killed by a
-// signal, and emitting error output that matches regex.
-# define ASSERT_DEATH(statement, regex) \
- ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
-
-// Like ASSERT_DEATH, but continues on to successive tests in the
-// test case, if any:
-# define EXPECT_DEATH(statement, regex) \
- EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
-
-// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
-
-// Tests that an exit code describes a normal exit with a given exit code.
-class GTEST_API_ ExitedWithCode {
- public:
- explicit ExitedWithCode(int exit_code);
- bool operator()(int exit_status) const;
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ExitedWithCode& other);
-
- const int exit_code_;
-};
-
-# if !GTEST_OS_WINDOWS
-// Tests that an exit code describes an exit due to termination by a
-// given signal.
-class GTEST_API_ KilledBySignal {
- public:
- explicit KilledBySignal(int signum);
- bool operator()(int exit_status) const;
- private:
- const int signum_;
-};
-# endif // !GTEST_OS_WINDOWS
-
-// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
-// The death testing framework causes this to have interesting semantics,
-// since the sideeffects of the call are only visible in opt mode, and not
-// in debug mode.
-//
-// In practice, this can be used to test functions that utilize the
-// LOG(DFATAL) macro using the following style:
-//
-// int DieInDebugOr12(int* sideeffect) {
-// if (sideeffect) {
-// *sideeffect = 12;
-// }
-// LOG(DFATAL) << "death";
-// return 12;
-// }
-//
-// TEST(TestCase, TestDieOr12WorksInDgbAndOpt) {
-// int sideeffect = 0;
-// // Only asserts in dbg.
-// EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
-//
-// #ifdef NDEBUG
-// // opt-mode has sideeffect visible.
-// EXPECT_EQ(12, sideeffect);
-// #else
-// // dbg-mode no visible sideeffect.
-// EXPECT_EQ(0, sideeffect);
-// #endif
-// }
-//
-// This will assert that DieInDebugReturn12InOpt() crashes in debug
-// mode, usually due to a DCHECK or LOG(DFATAL), but returns the
-// appropriate fallback value (12 in this case) in opt mode. If you
-// need to test that a function has appropriate side-effects in opt
-// mode, include assertions against the side-effects. A general
-// pattern for this is:
-//
-// EXPECT_DEBUG_DEATH({
-// // Side-effects here will have an effect after this statement in
-// // opt mode, but none in debug mode.
-// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
-// }, "death");
-//
-# ifdef NDEBUG
-
-# define EXPECT_DEBUG_DEATH(statement, regex) \
- GTEST_EXECUTE_STATEMENT_(statement, regex)
-
-# define ASSERT_DEBUG_DEATH(statement, regex) \
- GTEST_EXECUTE_STATEMENT_(statement, regex)
-
-# else
-
-# define EXPECT_DEBUG_DEATH(statement, regex) \
- EXPECT_DEATH(statement, regex)
-
-# define ASSERT_DEBUG_DEATH(statement, regex) \
- ASSERT_DEATH(statement, regex)
-
-# endif // NDEBUG for EXPECT_DEBUG_DEATH
-#endif // GTEST_HAS_DEATH_TEST
-
-// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
-// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
-// death tests are supported; otherwise they just issue a warning. This is
-// useful when you are combining death test assertions with normal test
-// assertions in one test.
-#if GTEST_HAS_DEATH_TEST
-# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
- EXPECT_DEATH(statement, regex)
-# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
- ASSERT_DEATH(statement, regex)
-#else
-# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
- GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
-# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
- GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
-#endif
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
diff --git a/src/lib/install/include/gtest/gtest-message.h b/src/lib/install/include/gtest/gtest-message.h
deleted file mode 100755
index fe879bc..0000000
--- a/src/lib/install/include/gtest/gtest-message.h
+++ /dev/null
@@ -1,250 +0,0 @@
-// Copyright 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.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the Message class.
-//
-// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
-// leave some internal implementation details in this header file.
-// They are clearly marked by comments like this:
-//
-// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-//
-// Such code is NOT meant to be used by a user directly, and is subject
-// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
-// program!
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
-
-#include <limits>
-
-#include "gtest/internal/gtest-port.h"
-
-// Ensures that there is at least one operator<< in the global namespace.
-// See Message& operator<<(...) below for why.
-void operator<<(const testing::internal::Secret&, int);
-
-namespace testing {
-
-// The Message class works like an ostream repeater.
-//
-// Typical usage:
-//
-// 1. You stream a bunch of values to a Message object.
-// It will remember the text in a stringstream.
-// 2. Then you stream the Message object to an ostream.
-// This causes the text in the Message to be streamed
-// to the ostream.
-//
-// For example;
-//
-// testing::Message foo;
-// foo << 1 << " != " << 2;
-// std::cout << foo;
-//
-// will print "1 != 2".
-//
-// Message is not intended to be inherited from. In particular, its
-// destructor is not virtual.
-//
-// Note that stringstream behaves differently in gcc and in MSVC. You
-// can stream a NULL char pointer to it in the former, but not in the
-// latter (it causes an access violation if you do). The Message
-// class hides this difference by treating a NULL char pointer as
-// "(null)".
-class GTEST_API_ Message {
- private:
- // The type of basic IO manipulators (endl, ends, and flush) for
- // narrow streams.
- typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
-
- public:
- // Constructs an empty Message.
- Message();
-
- // Copy constructor.
- Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
- *ss_ << msg.GetString();
- }
-
- // Constructs a Message from a C-string.
- explicit Message(const char* str) : ss_(new ::std::stringstream) {
- *ss_ << str;
- }
-
-#if GTEST_OS_SYMBIAN
- // Streams a value (either a pointer or not) to this object.
- template <typename T>
- inline Message& operator <<(const T& value) {
- StreamHelper(typename internal::is_pointer<T>::type(), value);
- return *this;
- }
-#else
- // Streams a non-pointer value to this object.
- template <typename T>
- inline Message& operator <<(const T& val) {
- // Some libraries overload << for STL containers. These
- // overloads are defined in the global namespace instead of ::std.
- //
- // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
- // overloads are visible in either the std namespace or the global
- // namespace, but not other namespaces, including the testing
- // namespace which Google Test's Message class is in.
- //
- // To allow STL containers (and other types that has a << operator
- // defined in the global namespace) to be used in Google Test
- // assertions, testing::Message must access the custom << operator
- // from the global namespace. With this using declaration,
- // overloads of << defined in the global namespace and those
- // visible via Koenig lookup are both exposed in this function.
- using ::operator <<;
- *ss_ << val;
- return *this;
- }
-
- // Streams a pointer value to this object.
- //
- // This function is an overload of the previous one. When you
- // stream a pointer to a Message, this definition will be used as it
- // is more specialized. (The C++ Standard, section
- // [temp.func.order].) If you stream a non-pointer, then the
- // previous definition will be used.
- //
- // The reason for this overload is that streaming a NULL pointer to
- // ostream is undefined behavior. Depending on the compiler, you
- // may get "0", "(nil)", "(null)", or an access violation. To
- // ensure consistent result across compilers, we always treat NULL
- // as "(null)".
- template <typename T>
- inline Message& operator <<(T* const& pointer) { // NOLINT
- if (pointer == NULL) {
- *ss_ << "(null)";
- } else {
- *ss_ << pointer;
- }
- return *this;
- }
-#endif // GTEST_OS_SYMBIAN
-
- // Since the basic IO manipulators are overloaded for both narrow
- // and wide streams, we have to provide this specialized definition
- // of operator <<, even though its body is the same as the
- // templatized version above. Without this definition, streaming
- // endl or other basic IO manipulators to Message will confuse the
- // compiler.
- Message& operator <<(BasicNarrowIoManip val) {
- *ss_ << val;
- return *this;
- }
-
- // Instead of 1/0, we want to see true/false for bool values.
- Message& operator <<(bool b) {
- return *this << (b ? "true" : "false");
- }
-
- // These two overloads allow streaming a wide C string to a Message
- // using the UTF-8 encoding.
- Message& operator <<(const wchar_t* wide_c_str);
- Message& operator <<(wchar_t* wide_c_str);
-
-#if GTEST_HAS_STD_WSTRING
- // Converts the given wide string to a narrow string using the UTF-8
- // encoding, and streams the result to this Message object.
- Message& operator <<(const ::std::wstring& wstr);
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
- // Converts the given wide string to a narrow string using the UTF-8
- // encoding, and streams the result to this Message object.
- Message& operator <<(const ::wstring& wstr);
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
- // Gets the text streamed to this object so far as an std::string.
- // Each '\0' character in the buffer is replaced with "\\0".
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- std::string GetString() const;
-
- private:
-
-#if GTEST_OS_SYMBIAN
- // These are needed as the Nokia Symbian Compiler cannot decide between
- // const T& and const T* in a function template. The Nokia compiler _can_
- // decide between class template specializations for T and T*, so a
- // tr1::type_traits-like is_pointer works, and we can overload on that.
- template <typename T>
- inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
- if (pointer == NULL) {
- *ss_ << "(null)";
- } else {
- *ss_ << pointer;
- }
- }
- template <typename T>
- inline void StreamHelper(internal::false_type /*is_pointer*/,
- const T& value) {
- // See the comments in Message& operator <<(const T&) above for why
- // we need this using statement.
- using ::operator <<;
- *ss_ << value;
- }
-#endif // GTEST_OS_SYMBIAN
-
- // We'll hold the text streamed to this object here.
- const internal::scoped_ptr< ::std::stringstream> ss_;
-
- // We declare (but don't implement) this to prevent the compiler
- // from implementing the assignment operator.
- void operator=(const Message&);
-};
-
-// Streams a Message to an ostream.
-inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
- return os << sb.GetString();
-}
-
-namespace internal {
-
-// Converts a streamable value to an std::string. A NULL pointer is
-// converted to "(null)". When the input value is a ::string,
-// ::std::string, ::wstring, or ::std::wstring object, each NUL
-// character in it is replaced with "\\0".
-template <typename T>
-std::string StreamableToString(const T& streamable) {
- return (Message() << streamable).GetString();
-}
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
diff --git a/src/lib/install/include/gtest/gtest-param-test.h b/src/lib/install/include/gtest/gtest-param-test.h
deleted file mode 100755
index 038f9ba..0000000
--- a/src/lib/install/include/gtest/gtest-param-test.h
+++ /dev/null
@@ -1,1444 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-param-test.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.
-//
-// Authors: vladl@google.com (Vlad Losev)
-//
-// Macros and functions for implementing parameterized tests
-// in Google C++ Testing Framework (Google Test)
-//
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-
-
-// Value-parameterized tests allow you to test your code with different
-// parameters without writing multiple copies of the same test.
-//
-// Here is how you use value-parameterized tests:
-
-#if 0
-
-// To write value-parameterized tests, first you should define a fixture
-// class. It is usually derived from testing::TestWithParam<T> (see below for
-// another inheritance scheme that's sometimes useful in more complicated
-// class hierarchies), where the type of your parameter values.
-// TestWithParam<T> is itself derived from testing::Test. T can be any
-// copyable type. If it's a raw pointer, you are responsible for managing the
-// lifespan of the pointed values.
-
-class FooTest : public ::testing::TestWithParam<const char*> {
- // You can implement all the usual class fixture members here.
-};
-
-// Then, use the TEST_P macro to define as many parameterized tests
-// for this fixture as you want. The _P suffix is for "parameterized"
-// or "pattern", whichever you prefer to think.
-
-TEST_P(FooTest, DoesBlah) {
- // Inside a test, access the test parameter with the GetParam() method
- // of the TestWithParam<T> class:
- EXPECT_TRUE(foo.Blah(GetParam()));
- ...
-}
-
-TEST_P(FooTest, HasBlahBlah) {
- ...
-}
-
-// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
-// case with any set of parameters you want. Google Test defines a number
-// of functions for generating test parameters. They return what we call
-// (surprise!) parameter generators. Here is a summary of them, which
-// are all in the testing namespace:
-//
-//
-// Range(begin, end [, step]) - Yields values {begin, begin+step,
-// begin+step+step, ...}. The values do not
-// include end. step defaults to 1.
-// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
-// ValuesIn(container) - Yields values from a C-style array, an STL
-// ValuesIn(begin,end) container, or an iterator range [begin, end).
-// Bool() - Yields sequence {false, true}.
-// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
-// for the math savvy) of the values generated
-// by the N generators.
-//
-// For more details, see comments at the definitions of these functions below
-// in this file.
-//
-// The following statement will instantiate tests from the FooTest test case
-// each with parameter values "meeny", "miny", and "moe".
-
-INSTANTIATE_TEST_CASE_P(InstantiationName,
- FooTest,
- Values("meeny", "miny", "moe"));
-
-// To distinguish different instances of the pattern, (yes, you
-// can instantiate it more then once) the first argument to the
-// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
-// actual test case name. Remember to pick unique prefixes for different
-// instantiations. The tests from the instantiation above will have
-// these names:
-//
-// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
-// * InstantiationName/FooTest.DoesBlah/1 for "miny"
-// * InstantiationName/FooTest.DoesBlah/2 for "moe"
-// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
-// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
-// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
-//
-// You can use these names in --gtest_filter.
-//
-// This statement will instantiate all tests from FooTest again, each
-// with parameter values "cat" and "dog":
-
-const char* pets[] = {"cat", "dog"};
-INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
-
-// The tests from the instantiation above will have these names:
-//
-// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
-//
-// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
-// in the given test case, whether their definitions come before or
-// AFTER the INSTANTIATE_TEST_CASE_P statement.
-//
-// Please also note that generator expressions (including parameters to the
-// generators) are evaluated in InitGoogleTest(), after main() has started.
-// This allows the user on one hand, to adjust generator parameters in order
-// to dynamically determine a set of tests to run and on the other hand,
-// give the user a chance to inspect the generated tests with Google Test
-// reflection API before RUN_ALL_TESTS() is executed.
-//
-// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
-// for more examples.
-//
-// In the future, we plan to publish the API for defining new parameter
-// generators. But for now this interface remains part of the internal
-// implementation and is subject to change.
-//
-//
-// A parameterized test fixture must be derived from testing::Test and from
-// testing::WithParamInterface<T>, where T is the type of the parameter
-// values. Inheriting from TestWithParam<T> satisfies that requirement because
-// TestWithParam<T> inherits from both Test and WithParamInterface. In more
-// complicated hierarchies, however, it is occasionally useful to inherit
-// separately from Test and WithParamInterface. For example:
-
-class BaseTest : public ::testing::Test {
- // You can inherit all the usual members for a non-parameterized test
- // fixture here.
-};
-
-class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
- // The usual test fixture members go here too.
-};
-
-TEST_F(BaseTest, HasFoo) {
- // This is an ordinary non-parameterized test.
-}
-
-TEST_P(DerivedTest, DoesBlah) {
- // GetParam works just the same here as if you inherit from TestWithParam.
- EXPECT_TRUE(foo.Blah(GetParam()));
-}
-
-#endif // 0
-
-#include "gtest/internal/gtest-port.h"
-
-#if !GTEST_OS_SYMBIAN
-# include <utility>
-#endif
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-param-util-generated.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Functions producing parameter generators.
-//
-// Google Test uses these generators to produce parameters for value-
-// parameterized tests. When a parameterized test case is instantiated
-// with a particular generator, Google Test creates and runs tests
-// for each element in the sequence produced by the generator.
-//
-// In the following sample, tests from test case FooTest are instantiated
-// each three times with parameter values 3, 5, and 8:
-//
-// class FooTest : public TestWithParam<int> { ... };
-//
-// TEST_P(FooTest, TestThis) {
-// }
-// TEST_P(FooTest, TestThat) {
-// }
-// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
-//
-
-// Range() returns generators providing sequences of values in a range.
-//
-// Synopsis:
-// Range(start, end)
-// - returns a generator producing a sequence of values {start, start+1,
-// start+2, ..., }.
-// Range(start, end, step)
-// - returns a generator producing a sequence of values {start, start+step,
-// start+step+step, ..., }.
-// Notes:
-// * The generated sequences never include end. For example, Range(1, 5)
-// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
-// returns a generator producing {1, 3, 5, 7}.
-// * start and end must have the same type. That type may be any integral or
-// floating-point type or a user defined type satisfying these conditions:
-// * It must be assignable (have operator=() defined).
-// * It must have operator+() (operator+(int-compatible type) for
-// two-operand version).
-// * It must have operator<() defined.
-// Elements in the resulting sequences will also have that type.
-// * Condition start < end must be satisfied in order for resulting sequences
-// to contain any elements.
-//
-template <typename T, typename IncrementT>
-internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
- return internal::ParamGenerator<T>(
- new internal::RangeGenerator<T, IncrementT>(start, end, step));
-}
-
-template <typename T>
-internal::ParamGenerator<T> Range(T start, T end) {
- return Range(start, end, 1);
-}
-
-// ValuesIn() function allows generation of tests with parameters coming from
-// a container.
-//
-// Synopsis:
-// ValuesIn(const T (&array)[N])
-// - returns a generator producing sequences with elements from
-// a C-style array.
-// ValuesIn(const Container& container)
-// - returns a generator producing sequences with elements from
-// an STL-style container.
-// ValuesIn(Iterator begin, Iterator end)
-// - returns a generator producing sequences with elements from
-// a range [begin, end) defined by a pair of STL-style iterators. These
-// iterators can also be plain C pointers.
-//
-// Please note that ValuesIn copies the values from the containers
-// passed in and keeps them to generate tests in RUN_ALL_TESTS().
-//
-// Examples:
-//
-// This instantiates tests from test case StringTest
-// each with C-string values of "foo", "bar", and "baz":
-//
-// const char* strings[] = {"foo", "bar", "baz"};
-// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
-//
-// This instantiates tests from test case StlStringTest
-// each with STL strings with values "a" and "b":
-//
-// ::std::vector< ::std::string> GetParameterStrings() {
-// ::std::vector< ::std::string> v;
-// v.push_back("a");
-// v.push_back("b");
-// return v;
-// }
-//
-// INSTANTIATE_TEST_CASE_P(CharSequence,
-// StlStringTest,
-// ValuesIn(GetParameterStrings()));
-//
-//
-// This will also instantiate tests from CharTest
-// each with parameter values 'a' and 'b':
-//
-// ::std::list<char> GetParameterChars() {
-// ::std::list<char> list;
-// list.push_back('a');
-// list.push_back('b');
-// return list;
-// }
-// ::std::list<char> l = GetParameterChars();
-// INSTANTIATE_TEST_CASE_P(CharSequence2,
-// CharTest,
-// ValuesIn(l.begin(), l.end()));
-//
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end) {
- typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
- ::value_type ParamType;
- return internal::ParamGenerator<ParamType>(
- new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
-}
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
- return ValuesIn(array, array + N);
-}
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container) {
- return ValuesIn(container.begin(), container.end());
-}
-
-// Values() allows generating tests from explicitly specified list of
-// parameters.
-//
-// Synopsis:
-// Values(T v1, T v2, ..., T vN)
-// - returns a generator producing sequences with elements v1, v2, ..., vN.
-//
-// For example, this instantiates tests from test case BarTest each
-// with values "one", "two", and "three":
-//
-// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
-//
-// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
-// The exact type of values will depend on the type of parameter in BazTest.
-//
-// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
-//
-// Currently, Values() supports from 1 to 50 parameters.
-//
-template <typename T1>
-internal::ValueArray1<T1> Values(T1 v1) {
- return internal::ValueArray1<T1>(v1);
-}
-
-template <typename T1, typename T2>
-internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
- return internal::ValueArray2<T1, T2>(v1, v2);
-}
-
-template <typename T1, typename T2, typename T3>
-internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
- return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
- return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5) {
- return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6) {
- return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7) {
- return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
- v6, v7);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
- return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
- v5, v6, v7, v8);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
- return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
- return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
- T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11) {
- return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
- T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12) {
- return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13) {
- return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
- return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
- return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16) {
- return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17) {
- return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18) {
- return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
- return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
- return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
- return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22) {
- return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23) {
- return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24) {
- return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
- v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
- v19, v20, v21, v22, v23, v24);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
- T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
- T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
- return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
- v18, v19, v20, v21, v22, v23, v24, v25);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26) {
- return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
- v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27) {
- return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
- v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28) {
- return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
- v28);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29) {
- return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
- v27, v28, v29);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
- return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
- v26, v27, v28, v29, v30);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
- return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
- v25, v26, v27, v28, v29, v30, v31);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32) {
- return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33) {
- return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
- T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
- T31 v31, T32 v32, T33 v33, T34 v34) {
- return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
- v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
- return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
- v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
- return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
- T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37) {
- return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
- v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36, v37);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37, T38 v38) {
- return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
- v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
- v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
- v33, v34, v35, v36, v37, v38);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
- T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
- T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
- T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
- T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
- T37 v37, T38 v38, T39 v39) {
- return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
- v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
- v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
- v32, v33, v34, v35, v36, v37, v38, v39);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
- T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
- T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
- T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
- T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
- T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
- return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
- v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
- v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
- return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
- v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
- v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42) {
- return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
- v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
- v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
- v42);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43) {
- return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
- v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
- v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
- v41, v42, v43);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44) {
- return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
- v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
- v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
- v40, v41, v42, v43, v44);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
- T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
- T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
- return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
- v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
- v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
- v39, v40, v41, v42, v43, v44, v45);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
- return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
- v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
- v38, v39, v40, v41, v42, v43, v44, v45, v46);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
- return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
- v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
- v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
- T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
- T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
- T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
- T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
- T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
- T48 v48) {
- return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
- v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
- v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
- v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
- T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
- T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
- T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
- T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
- T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
- T47 v47, T48 v48, T49 v49) {
- return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
- v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
- v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
- v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
- T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
- T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
- T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
- T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
- T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
- T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
- return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
- v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
- v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
- v48, v49, v50);
-}
-
-// Bool() allows generating tests with parameters in a set of (false, true).
-//
-// Synopsis:
-// Bool()
-// - returns a generator producing sequences with elements {false, true}.
-//
-// It is useful when testing code that depends on Boolean flags. Combinations
-// of multiple flags can be tested when several Bool()'s are combined using
-// Combine() function.
-//
-// In the following example all tests in the test case FlagDependentTest
-// will be instantiated twice with parameters false and true.
-//
-// class FlagDependentTest : public testing::TestWithParam<bool> {
-// virtual void SetUp() {
-// external_flag = GetParam();
-// }
-// }
-// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
-//
-inline internal::ParamGenerator<bool> Bool() {
- return Values(false, true);
-}
-
-# if GTEST_HAS_COMBINE
-// Combine() allows the user to combine two or more sequences to produce
-// values of a Cartesian product of those sequences' elements.
-//
-// Synopsis:
-// Combine(gen1, gen2, ..., genN)
-// - returns a generator producing sequences with elements coming from
-// the Cartesian product of elements from the sequences generated by
-// gen1, gen2, ..., genN. The sequence elements will have a type of
-// tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
-// of elements from sequences produces by gen1, gen2, ..., genN.
-//
-// Combine can have up to 10 arguments. This number is currently limited
-// by the maximum number of elements in the tuple implementation used by Google
-// Test.
-//
-// Example:
-//
-// This will instantiate tests in test case AnimalTest each one with
-// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
-// tuple("dog", BLACK), and tuple("dog", WHITE):
-//
-// enum Color { BLACK, GRAY, WHITE };
-// class AnimalTest
-// : public testing::TestWithParam<tuple<const char*, Color> > {...};
-//
-// TEST_P(AnimalTest, AnimalLooksNice) {...}
-//
-// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
-// Combine(Values("cat", "dog"),
-// Values(BLACK, WHITE)));
-//
-// This will instantiate tests in FlagDependentTest with all variations of two
-// Boolean flags:
-//
-// class FlagDependentTest
-// : public testing::TestWithParam<tuple<bool, bool> > {
-// virtual void SetUp() {
-// // Assigns external_flag_1 and external_flag_2 values from the tuple.
-// tie(external_flag_1, external_flag_2) = GetParam();
-// }
-// };
-//
-// TEST_P(FlagDependentTest, TestFeature1) {
-// // Test your code using external_flag_1 and external_flag_2 here.
-// }
-// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
-// Combine(Bool(), Bool()));
-//
-template <typename Generator1, typename Generator2>
-internal::CartesianProductHolder2<Generator1, Generator2> Combine(
- const Generator1& g1, const Generator2& g2) {
- return internal::CartesianProductHolder2<Generator1, Generator2>(
- g1, g2);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3>
-internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3) {
- return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
- g1, g2, g3);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4>
-internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
- Generator4> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4) {
- return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
- Generator4>(
- g1, g2, g3, g4);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5>
-internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
- Generator4, Generator5> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5) {
- return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
- Generator4, Generator5>(
- g1, g2, g3, g4, g5);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6>
-internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6) {
- return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6>(
- g1, g2, g3, g4, g5, g6);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7>
-internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7) {
- return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7>(
- g1, g2, g3, g4, g5, g6, g7);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8>
-internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8) {
- return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8>(
- g1, g2, g3, g4, g5, g6, g7, g8);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8, typename Generator9>
-internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8,
- Generator9> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8, const Generator9& g9) {
- return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
- g1, g2, g3, g4, g5, g6, g7, g8, g9);
-}
-
-template <typename Generator1, typename Generator2, typename Generator3,
- typename Generator4, typename Generator5, typename Generator6,
- typename Generator7, typename Generator8, typename Generator9,
- typename Generator10>
-internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
- Generator10> Combine(
- const Generator1& g1, const Generator2& g2, const Generator3& g3,
- const Generator4& g4, const Generator5& g5, const Generator6& g6,
- const Generator7& g7, const Generator8& g8, const Generator9& g9,
- const Generator10& g10) {
- return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
- Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
- Generator10>(
- g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
-}
-# endif // GTEST_HAS_COMBINE
-
-
-
-# define TEST_P(test_case_name, test_name) \
- class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- : public test_case_name { \
- public: \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
- virtual void TestBody(); \
- private: \
- static int AddToRegistry() { \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, \
- ::testing::internal::CodeLocation(\
- __FILE__, __LINE__))->AddTestPattern(\
- #test_case_name, \
- #test_name, \
- new ::testing::internal::TestMetaFactory< \
- GTEST_TEST_CLASS_NAME_(\
- test_case_name, test_name)>()); \
- return 0; \
- } \
- static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
- }; \
- int GTEST_TEST_CLASS_NAME_(test_case_name, \
- test_name)::gtest_registering_dummy_ = \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
- void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-// The optional last argument to INSTANTIATE_TEST_CASE_P allows the user
-// to specify a function or functor that generates custom test name suffixes
-// based on the test parameters. The function should accept one argument of
-// type testing::TestParamInfo<class ParamType>, and return std::string.
-//
-// testing::PrintToStringParamName is a builtin test suffix generator that
-// returns the value of testing::PrintToString(GetParam()). It does not work
-// for std::string or C strings.
-//
-// Note: test names must be non-empty, unique, and may only contain ASCII
-// alphanumeric characters or underscore.
-
-# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
- ::testing::internal::ParamGenerator<test_case_name::ParamType> \
- gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
- ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
- const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
- return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
- (__VA_ARGS__)(info); \
- } \
- int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, \
- ::testing::internal::CodeLocation(\
- __FILE__, __LINE__))->AddTestCaseInstantiation(\
- #prefix, \
- &gtest_##prefix##test_case_name##_EvalGenerator_, \
- &gtest_##prefix##test_case_name##_EvalGenerateName_, \
- __FILE__, __LINE__)
-
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
diff --git a/src/lib/install/include/gtest/gtest-param-test.h.pump b/src/lib/install/include/gtest/gtest-param-test.h.pump
deleted file mode 100755
index 3078d6d..0000000
--- a/src/lib/install/include/gtest/gtest-param-test.h.pump
+++ /dev/null
@@ -1,510 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 50 $$ Maximum length of Values arguments we want to support.
-$var maxtuple = 10 $$ Maximum number of Combine arguments we want to 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.
-//
-// Authors: vladl@google.com (Vlad Losev)
-//
-// Macros and functions for implementing parameterized tests
-// in Google C++ Testing Framework (Google Test)
-//
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
-
-
-// Value-parameterized tests allow you to test your code with different
-// parameters without writing multiple copies of the same test.
-//
-// Here is how you use value-parameterized tests:
-
-#if 0
-
-// To write value-parameterized tests, first you should define a fixture
-// class. It is usually derived from testing::TestWithParam<T> (see below for
-// another inheritance scheme that's sometimes useful in more complicated
-// class hierarchies), where the type of your parameter values.
-// TestWithParam<T> is itself derived from testing::Test. T can be any
-// copyable type. If it's a raw pointer, you are responsible for managing the
-// lifespan of the pointed values.
-
-class FooTest : public ::testing::TestWithParam<const char*> {
- // You can implement all the usual class fixture members here.
-};
-
-// Then, use the TEST_P macro to define as many parameterized tests
-// for this fixture as you want. The _P suffix is for "parameterized"
-// or "pattern", whichever you prefer to think.
-
-TEST_P(FooTest, DoesBlah) {
- // Inside a test, access the test parameter with the GetParam() method
- // of the TestWithParam<T> class:
- EXPECT_TRUE(foo.Blah(GetParam()));
- ...
-}
-
-TEST_P(FooTest, HasBlahBlah) {
- ...
-}
-
-// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
-// case with any set of parameters you want. Google Test defines a number
-// of functions for generating test parameters. They return what we call
-// (surprise!) parameter generators. Here is a summary of them, which
-// are all in the testing namespace:
-//
-//
-// Range(begin, end [, step]) - Yields values {begin, begin+step,
-// begin+step+step, ...}. The values do not
-// include end. step defaults to 1.
-// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
-// ValuesIn(container) - Yields values from a C-style array, an STL
-// ValuesIn(begin,end) container, or an iterator range [begin, end).
-// Bool() - Yields sequence {false, true}.
-// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
-// for the math savvy) of the values generated
-// by the N generators.
-//
-// For more details, see comments at the definitions of these functions below
-// in this file.
-//
-// The following statement will instantiate tests from the FooTest test case
-// each with parameter values "meeny", "miny", and "moe".
-
-INSTANTIATE_TEST_CASE_P(InstantiationName,
- FooTest,
- Values("meeny", "miny", "moe"));
-
-// To distinguish different instances of the pattern, (yes, you
-// can instantiate it more then once) the first argument to the
-// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
-// actual test case name. Remember to pick unique prefixes for different
-// instantiations. The tests from the instantiation above will have
-// these names:
-//
-// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
-// * InstantiationName/FooTest.DoesBlah/1 for "miny"
-// * InstantiationName/FooTest.DoesBlah/2 for "moe"
-// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
-// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
-// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
-//
-// You can use these names in --gtest_filter.
-//
-// This statement will instantiate all tests from FooTest again, each
-// with parameter values "cat" and "dog":
-
-const char* pets[] = {"cat", "dog"};
-INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
-
-// The tests from the instantiation above will have these names:
-//
-// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
-// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
-//
-// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
-// in the given test case, whether their definitions come before or
-// AFTER the INSTANTIATE_TEST_CASE_P statement.
-//
-// Please also note that generator expressions (including parameters to the
-// generators) are evaluated in InitGoogleTest(), after main() has started.
-// This allows the user on one hand, to adjust generator parameters in order
-// to dynamically determine a set of tests to run and on the other hand,
-// give the user a chance to inspect the generated tests with Google Test
-// reflection API before RUN_ALL_TESTS() is executed.
-//
-// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
-// for more examples.
-//
-// In the future, we plan to publish the API for defining new parameter
-// generators. But for now this interface remains part of the internal
-// implementation and is subject to change.
-//
-//
-// A parameterized test fixture must be derived from testing::Test and from
-// testing::WithParamInterface<T>, where T is the type of the parameter
-// values. Inheriting from TestWithParam<T> satisfies that requirement because
-// TestWithParam<T> inherits from both Test and WithParamInterface. In more
-// complicated hierarchies, however, it is occasionally useful to inherit
-// separately from Test and WithParamInterface. For example:
-
-class BaseTest : public ::testing::Test {
- // You can inherit all the usual members for a non-parameterized test
- // fixture here.
-};
-
-class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
- // The usual test fixture members go here too.
-};
-
-TEST_F(BaseTest, HasFoo) {
- // This is an ordinary non-parameterized test.
-}
-
-TEST_P(DerivedTest, DoesBlah) {
- // GetParam works just the same here as if you inherit from TestWithParam.
- EXPECT_TRUE(foo.Blah(GetParam()));
-}
-
-#endif // 0
-
-#include "gtest/internal/gtest-port.h"
-
-#if !GTEST_OS_SYMBIAN
-# include <utility>
-#endif
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-param-util-generated.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Functions producing parameter generators.
-//
-// Google Test uses these generators to produce parameters for value-
-// parameterized tests. When a parameterized test case is instantiated
-// with a particular generator, Google Test creates and runs tests
-// for each element in the sequence produced by the generator.
-//
-// In the following sample, tests from test case FooTest are instantiated
-// each three times with parameter values 3, 5, and 8:
-//
-// class FooTest : public TestWithParam<int> { ... };
-//
-// TEST_P(FooTest, TestThis) {
-// }
-// TEST_P(FooTest, TestThat) {
-// }
-// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
-//
-
-// Range() returns generators providing sequences of values in a range.
-//
-// Synopsis:
-// Range(start, end)
-// - returns a generator producing a sequence of values {start, start+1,
-// start+2, ..., }.
-// Range(start, end, step)
-// - returns a generator producing a sequence of values {start, start+step,
-// start+step+step, ..., }.
-// Notes:
-// * The generated sequences never include end. For example, Range(1, 5)
-// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
-// returns a generator producing {1, 3, 5, 7}.
-// * start and end must have the same type. That type may be any integral or
-// floating-point type or a user defined type satisfying these conditions:
-// * It must be assignable (have operator=() defined).
-// * It must have operator+() (operator+(int-compatible type) for
-// two-operand version).
-// * It must have operator<() defined.
-// Elements in the resulting sequences will also have that type.
-// * Condition start < end must be satisfied in order for resulting sequences
-// to contain any elements.
-//
-template <typename T, typename IncrementT>
-internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
- return internal::ParamGenerator<T>(
- new internal::RangeGenerator<T, IncrementT>(start, end, step));
-}
-
-template <typename T>
-internal::ParamGenerator<T> Range(T start, T end) {
- return Range(start, end, 1);
-}
-
-// ValuesIn() function allows generation of tests with parameters coming from
-// a container.
-//
-// Synopsis:
-// ValuesIn(const T (&array)[N])
-// - returns a generator producing sequences with elements from
-// a C-style array.
-// ValuesIn(const Container& container)
-// - returns a generator producing sequences with elements from
-// an STL-style container.
-// ValuesIn(Iterator begin, Iterator end)
-// - returns a generator producing sequences with elements from
-// a range [begin, end) defined by a pair of STL-style iterators. These
-// iterators can also be plain C pointers.
-//
-// Please note that ValuesIn copies the values from the containers
-// passed in and keeps them to generate tests in RUN_ALL_TESTS().
-//
-// Examples:
-//
-// This instantiates tests from test case StringTest
-// each with C-string values of "foo", "bar", and "baz":
-//
-// const char* strings[] = {"foo", "bar", "baz"};
-// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
-//
-// This instantiates tests from test case StlStringTest
-// each with STL strings with values "a" and "b":
-//
-// ::std::vector< ::std::string> GetParameterStrings() {
-// ::std::vector< ::std::string> v;
-// v.push_back("a");
-// v.push_back("b");
-// return v;
-// }
-//
-// INSTANTIATE_TEST_CASE_P(CharSequence,
-// StlStringTest,
-// ValuesIn(GetParameterStrings()));
-//
-//
-// This will also instantiate tests from CharTest
-// each with parameter values 'a' and 'b':
-//
-// ::std::list<char> GetParameterChars() {
-// ::std::list<char> list;
-// list.push_back('a');
-// list.push_back('b');
-// return list;
-// }
-// ::std::list<char> l = GetParameterChars();
-// INSTANTIATE_TEST_CASE_P(CharSequence2,
-// CharTest,
-// ValuesIn(l.begin(), l.end()));
-//
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end) {
- typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
- ::value_type ParamType;
- return internal::ParamGenerator<ParamType>(
- new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
-}
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
- return ValuesIn(array, array + N);
-}
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container) {
- return ValuesIn(container.begin(), container.end());
-}
-
-// Values() allows generating tests from explicitly specified list of
-// parameters.
-//
-// Synopsis:
-// Values(T v1, T v2, ..., T vN)
-// - returns a generator producing sequences with elements v1, v2, ..., vN.
-//
-// For example, this instantiates tests from test case BarTest each
-// with values "one", "two", and "three":
-//
-// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
-//
-// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
-// The exact type of values will depend on the type of parameter in BazTest.
-//
-// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
-//
-// Currently, Values() supports from 1 to $n parameters.
-//
-$range i 1..n
-$for i [[
-$range j 1..i
-
-template <$for j, [[typename T$j]]>
-internal::ValueArray$i<$for j, [[T$j]]> Values($for j, [[T$j v$j]]) {
- return internal::ValueArray$i<$for j, [[T$j]]>($for j, [[v$j]]);
-}
-
-]]
-
-// Bool() allows generating tests with parameters in a set of (false, true).
-//
-// Synopsis:
-// Bool()
-// - returns a generator producing sequences with elements {false, true}.
-//
-// It is useful when testing code that depends on Boolean flags. Combinations
-// of multiple flags can be tested when several Bool()'s are combined using
-// Combine() function.
-//
-// In the following example all tests in the test case FlagDependentTest
-// will be instantiated twice with parameters false and true.
-//
-// class FlagDependentTest : public testing::TestWithParam<bool> {
-// virtual void SetUp() {
-// external_flag = GetParam();
-// }
-// }
-// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
-//
-inline internal::ParamGenerator<bool> Bool() {
- return Values(false, true);
-}
-
-# if GTEST_HAS_COMBINE
-// Combine() allows the user to combine two or more sequences to produce
-// values of a Cartesian product of those sequences' elements.
-//
-// Synopsis:
-// Combine(gen1, gen2, ..., genN)
-// - returns a generator producing sequences with elements coming from
-// the Cartesian product of elements from the sequences generated by
-// gen1, gen2, ..., genN. The sequence elements will have a type of
-// tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
-// of elements from sequences produces by gen1, gen2, ..., genN.
-//
-// Combine can have up to $maxtuple arguments. This number is currently limited
-// by the maximum number of elements in the tuple implementation used by Google
-// Test.
-//
-// Example:
-//
-// This will instantiate tests in test case AnimalTest each one with
-// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
-// tuple("dog", BLACK), and tuple("dog", WHITE):
-//
-// enum Color { BLACK, GRAY, WHITE };
-// class AnimalTest
-// : public testing::TestWithParam<tuple<const char*, Color> > {...};
-//
-// TEST_P(AnimalTest, AnimalLooksNice) {...}
-//
-// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
-// Combine(Values("cat", "dog"),
-// Values(BLACK, WHITE)));
-//
-// This will instantiate tests in FlagDependentTest with all variations of two
-// Boolean flags:
-//
-// class FlagDependentTest
-// : public testing::TestWithParam<tuple<bool, bool> > {
-// virtual void SetUp() {
-// // Assigns external_flag_1 and external_flag_2 values from the tuple.
-// tie(external_flag_1, external_flag_2) = GetParam();
-// }
-// };
-//
-// TEST_P(FlagDependentTest, TestFeature1) {
-// // Test your code using external_flag_1 and external_flag_2 here.
-// }
-// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
-// Combine(Bool(), Bool()));
-//
-$range i 2..maxtuple
-$for i [[
-$range j 1..i
-
-template <$for j, [[typename Generator$j]]>
-internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
- $for j, [[const Generator$j& g$j]]) {
- return internal::CartesianProductHolder$i<$for j, [[Generator$j]]>(
- $for j, [[g$j]]);
-}
-
-]]
-# endif // GTEST_HAS_COMBINE
-
-
-
-# define TEST_P(test_case_name, test_name) \
- class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- : public test_case_name { \
- public: \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
- virtual void TestBody(); \
- private: \
- static int AddToRegistry() { \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, \
- ::testing::internal::CodeLocation(\
- __FILE__, __LINE__))->AddTestPattern(\
- #test_case_name, \
- #test_name, \
- new ::testing::internal::TestMetaFactory< \
- GTEST_TEST_CLASS_NAME_(\
- test_case_name, test_name)>()); \
- return 0; \
- } \
- static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
- }; \
- int GTEST_TEST_CLASS_NAME_(test_case_name, \
- test_name)::gtest_registering_dummy_ = \
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
- void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-// The optional last argument to INSTANTIATE_TEST_CASE_P allows the user
-// to specify a function or functor that generates custom test name suffixes
-// based on the test parameters. The function should accept one argument of
-// type testing::TestParamInfo<class ParamType>, and return std::string.
-//
-// testing::PrintToStringParamName is a builtin test suffix generator that
-// returns the value of testing::PrintToString(GetParam()).
-//
-// Note: test names must be non-empty, unique, and may only contain ASCII
-// alphanumeric characters or underscore. Because PrintToString adds quotes
-// to std::string and C strings, it won't work for these types.
-
-# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
- ::testing::internal::ParamGenerator<test_case_name::ParamType> \
- gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
- ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
- const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
- return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
- (__VA_ARGS__)(info); \
- } \
- int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
- ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
- GetTestCasePatternHolder<test_case_name>(\
- #test_case_name, \
- ::testing::internal::CodeLocation(\
- __FILE__, __LINE__))->AddTestCaseInstantiation(\
- #prefix, \
- &gtest_##prefix##test_case_name##_EvalGenerator_, \
- &gtest_##prefix##test_case_name##_EvalGenerateName_, \
- __FILE__, __LINE__)
-
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
diff --git a/src/lib/install/include/gtest/gtest-printers.h b/src/lib/install/include/gtest/gtest-printers.h
deleted file mode 100755
index e850d60..0000000
--- a/src/lib/install/include/gtest/gtest-printers.h
+++ /dev/null
@@ -1,1006 +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 Test - The Google C++ Testing Framework
-//
-// This file implements a universal value printer that can print a
-// value of any type T:
-//
-// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
-//
-// A user can teach this function how to print a class type T by
-// defining either operator<<() or PrintTo() in the namespace that
-// defines T. More specifically, the FIRST defined function in the
-// following list will be used (assuming T is defined in namespace
-// foo):
-//
-// 1. foo::PrintTo(const T&, ostream*)
-// 2. operator<<(ostream&, const T&) defined in either foo or the
-// global namespace.
-//
-// If none of the above is defined, it will print the debug string of
-// the value if it is a protocol buffer, or print the raw bytes in the
-// value otherwise.
-//
-// To aid debugging: when T is a reference type, the address of the
-// value is also printed; when T is a (const) char pointer, both the
-// pointer value and the NUL-terminated string it points to are
-// printed.
-//
-// We also provide some convenient wrappers:
-//
-// // Prints a value to a string. For a (const or not) char
-// // pointer, the NUL-terminated string (but not the pointer) is
-// // printed.
-// std::string ::testing::PrintToString(const T& value);
-//
-// // Prints a value tersely: for a reference type, the referenced
-// // value (but not the address) is printed; for a (const or not) char
-// // pointer, the NUL-terminated string (but not the pointer) is
-// // printed.
-// void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
-//
-// // Prints value using the type inferred by the compiler. The difference
-// // from UniversalTersePrint() is that this function prints both the
-// // pointer and the NUL-terminated string for a (const or not) char pointer.
-// void ::testing::internal::UniversalPrint(const T& value, ostream*);
-//
-// // Prints the fields of a tuple tersely to a string vector, one
-// // element for each field. Tuple support must be enabled in
-// // gtest-port.h.
-// std::vector<string> UniversalTersePrintTupleFieldsToStrings(
-// const Tuple& value);
-//
-// Known limitation:
-//
-// The print primitives print the elements of an STL-style container
-// using the compiler-inferred type of *iter where iter is a
-// const_iterator of the container. When const_iterator is an input
-// iterator but not a forward iterator, this inferred type may not
-// match value_type, and the print output may be incorrect. In
-// practice, this is rarely a problem as for most containers
-// const_iterator is a forward iterator. We'll fix this if there's an
-// actual need for it. Note that this fix cannot rely on value_type
-// being defined as many user-defined container types don't have
-// value_type.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
-
-#include <ostream> // NOLINT
-#include <sstream>
-#include <string>
-#include <utility>
-#include <vector>
-#include "gtest/internal/gtest-port.h"
-#include "gtest/internal/gtest-internal.h"
-
-#if GTEST_HAS_STD_TUPLE_
-# include <tuple>
-#endif
-
-namespace testing {
-
-// Definitions in the 'internal' and 'internal2' name spaces are
-// subject to change without notice. DO NOT USE THEM IN USER CODE!
-namespace internal2 {
-
-// Prints the given number of bytes in the given object to the given
-// ostream.
-GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
- size_t count,
- ::std::ostream* os);
-
-// For selecting which printer to use when a given type has neither <<
-// nor PrintTo().
-enum TypeKind {
- kProtobuf, // a protobuf type
- kConvertibleToInteger, // a type implicitly convertible to BiggestInt
- // (e.g. a named or unnamed enum type)
- kOtherType // anything else
-};
-
-// TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
-// by the universal printer to print a value of type T when neither
-// operator<< nor PrintTo() is defined for T, where kTypeKind is the
-// "kind" of T as defined by enum TypeKind.
-template <typename T, TypeKind kTypeKind>
-class TypeWithoutFormatter {
- public:
- // This default version is called when kTypeKind is kOtherType.
- static void PrintValue(const T& value, ::std::ostream* os) {
- PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),
- sizeof(value), os);
- }
-};
-
-// We print a protobuf using its ShortDebugString() when the string
-// doesn't exceed this many characters; otherwise we print it using
-// DebugString() for better readability.
-const size_t kProtobufOneLinerMaxLength = 50;
-
-template <typename T>
-class TypeWithoutFormatter<T, kProtobuf> {
- public:
- static void PrintValue(const T& value, ::std::ostream* os) {
- std::string pretty_str = value.ShortDebugString();
- if (pretty_str.length() > kProtobufOneLinerMaxLength) {
- pretty_str = "\n" + value.DebugString();
- }
- *os << ("<" + pretty_str + ">");
- }
-};
-
-template <typename T>
-class TypeWithoutFormatter<T, kConvertibleToInteger> {
- public:
- // Since T has no << operator or PrintTo() but can be implicitly
- // converted to BiggestInt, we print it as a BiggestInt.
- //
- // Most likely T is an enum type (either named or unnamed), in which
- // case printing it as an integer is the desired behavior. In case
- // T is not an enum, printing it as an integer is the best we can do
- // given that it has no user-defined printer.
- static void PrintValue(const T& value, ::std::ostream* os) {
- const internal::BiggestInt kBigInt = value;
- *os << kBigInt;
- }
-};
-
-// Prints the given value to the given ostream. If the value is a
-// protocol message, its debug string is printed; if it's an enum or
-// of a type implicitly convertible to BiggestInt, it's printed as an
-// integer; otherwise the bytes in the value are printed. This is
-// what UniversalPrinter<T>::Print() does when it knows nothing about
-// type T and T has neither << operator nor PrintTo().
-//
-// A user can override this behavior for a class type Foo by defining
-// a << operator in the namespace where Foo is defined.
-//
-// We put this operator in namespace 'internal2' instead of 'internal'
-// to simplify the implementation, as much code in 'internal' needs to
-// use << in STL, which would conflict with our own << were it defined
-// in 'internal'.
-//
-// Note that this operator<< takes a generic std::basic_ostream<Char,
-// CharTraits> type instead of the more restricted std::ostream. If
-// we define it to take an std::ostream instead, we'll get an
-// "ambiguous overloads" compiler error when trying to print a type
-// Foo that supports streaming to std::basic_ostream<Char,
-// CharTraits>, as the compiler cannot tell whether
-// operator<<(std::ostream&, const T&) or
-// operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
-// specific.
-template <typename Char, typename CharTraits, typename T>
-::std::basic_ostream<Char, CharTraits>& operator<<(
- ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
- TypeWithoutFormatter<T,
- (internal::IsAProtocolMessage<T>::value ? kProtobuf :
- internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?
- kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);
- return os;
-}
-
-} // namespace internal2
-} // namespace testing
-
-// This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
-// magic needed for implementing UniversalPrinter won't work.
-namespace testing_internal {
-
-// Used to print a value that is not an STL-style container when the
-// user doesn't define PrintTo() for it.
-template <typename T>
-void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
- // With the following statement, during unqualified name lookup,
- // testing::internal2::operator<< appears as if it was declared in
- // the nearest enclosing namespace that contains both
- // ::testing_internal and ::testing::internal2, i.e. the global
- // namespace. For more details, refer to the C++ Standard section
- // 7.3.4-1 [namespace.udir]. This allows us to fall back onto
- // testing::internal2::operator<< in case T doesn't come with a <<
- // operator.
- //
- // We cannot write 'using ::testing::internal2::operator<<;', which
- // gcc 3.3 fails to compile due to a compiler bug.
- using namespace ::testing::internal2; // NOLINT
-
- // Assuming T is defined in namespace foo, in the next statement,
- // the compiler will consider all of:
- //
- // 1. foo::operator<< (thanks to Koenig look-up),
- // 2. ::operator<< (as the current namespace is enclosed in ::),
- // 3. testing::internal2::operator<< (thanks to the using statement above).
- //
- // The operator<< whose type matches T best will be picked.
- //
- // We deliberately allow #2 to be a candidate, as sometimes it's
- // impossible to define #1 (e.g. when foo is ::std, defining
- // anything in it is undefined behavior unless you are a compiler
- // vendor.).
- *os << value;
-}
-
-} // namespace testing_internal
-
-namespace testing {
-namespace internal {
-
-// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
-// value of type ToPrint that is an operand of a comparison assertion
-// (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in
-// the comparison, and is used to help determine the best way to
-// format the value. In particular, when the value is a C string
-// (char pointer) and the other operand is an STL string object, we
-// want to format the C string as a string, since we know it is
-// compared by value with the string object. If the value is a char
-// pointer but the other operand is not an STL string object, we don't
-// know whether the pointer is supposed to point to a NUL-terminated
-// string, and thus want to print it as a pointer to be safe.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-
-// The default case.
-template <typename ToPrint, typename OtherOperand>
-class FormatForComparison {
- public:
- static ::std::string Format(const ToPrint& value) {
- return ::testing::PrintToString(value);
- }
-};
-
-// Array.
-template <typename ToPrint, size_t N, typename OtherOperand>
-class FormatForComparison<ToPrint[N], OtherOperand> {
- public:
- static ::std::string Format(const ToPrint* value) {
- return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
- }
-};
-
-// By default, print C string as pointers to be safe, as we don't know
-// whether they actually point to a NUL-terminated string.
-
-#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \
- template <typename OtherOperand> \
- class FormatForComparison<CharType*, OtherOperand> { \
- public: \
- static ::std::string Format(CharType* value) { \
- return ::testing::PrintToString(static_cast<const void*>(value)); \
- } \
- }
-
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
-GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
-
-#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
-
-// If a C string is compared with an STL string object, we know it's meant
-// to point to a NUL-terminated string, and thus can print it as a string.
-
-#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
- template <> \
- class FormatForComparison<CharType*, OtherStringType> { \
- public: \
- static ::std::string Format(CharType* value) { \
- return ::testing::PrintToString(value); \
- } \
- }
-
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
-
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
-#endif
-
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
-#endif
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
-GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
-#endif
-
-#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
-
-// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
-// operand to be used in a failure message. The type (but not value)
-// of the other operand may affect the format. This allows us to
-// print a char* as a raw pointer when it is compared against another
-// char* or void*, and print it as a C string when it is compared
-// against an std::string object, for example.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-template <typename T1, typename T2>
-std::string FormatForComparisonFailureMessage(
- const T1& value, const T2& /* other_operand */) {
- return FormatForComparison<T1, T2>::Format(value);
-}
-
-// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
-// value to the given ostream. The caller must ensure that
-// 'ostream_ptr' is not NULL, or the behavior is undefined.
-//
-// We define UniversalPrinter as a class template (as opposed to a
-// function template), as we need to partially specialize it for
-// reference types, which cannot be done with function templates.
-template <typename T>
-class UniversalPrinter;
-
-template <typename T>
-void UniversalPrint(const T& value, ::std::ostream* os);
-
-enum DefaultPrinterType {
- kPrintContainer,
- kPrintPointer,
- kPrintFunctionPointer,
- kPrintOther,
-};
-template <DefaultPrinterType type> struct WrapPrinterType {};
-
-// Used to print an STL-style container when the user doesn't define
-// a PrintTo() for it.
-template <typename C>
-void DefaultPrintTo(WrapPrinterType<kPrintContainer> /* dummy */,
- const C& container, ::std::ostream* os) {
- const size_t kMaxCount = 32; // The maximum number of elements to print.
- *os << '{';
- size_t count = 0;
- for (typename C::const_iterator it = container.begin();
- it != container.end(); ++it, ++count) {
- if (count > 0) {
- *os << ',';
- if (count == kMaxCount) { // Enough has been printed.
- *os << " ...";
- break;
- }
- }
- *os << ' ';
- // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
- // handle *it being a native array.
- internal::UniversalPrint(*it, os);
- }
-
- if (count > 0) {
- *os << ' ';
- }
- *os << '}';
-}
-
-// Used to print a pointer that is neither a char pointer nor a member
-// pointer, when the user doesn't define PrintTo() for it. (A member
-// variable pointer or member function pointer doesn't really point to
-// a location in the address space. Their representation is
-// implementation-defined. Therefore they will be printed as raw
-// bytes.)
-template <typename T>
-void DefaultPrintTo(WrapPrinterType<kPrintPointer> /* dummy */,
- T* p, ::std::ostream* os) {
- if (p == NULL) {
- *os << "NULL";
- } else {
- // T is not a function type. We just call << to print p,
- // relying on ADL to pick up user-defined << for their pointer
- // types, if any.
- *os << p;
- }
-}
-template <typename T>
-void DefaultPrintTo(WrapPrinterType<kPrintFunctionPointer> /* dummy */,
- T* p, ::std::ostream* os) {
- if (p == NULL) {
- *os << "NULL";
- } else {
- // T is a function type, so '*os << p' doesn't do what we want
- // (it just prints p as bool). We want to print p as a const
- // void*. However, we cannot cast it to const void* directly,
- // even using reinterpret_cast, as earlier versions of gcc
- // (e.g. 3.4.5) cannot compile the cast when p is a function
- // pointer. Casting to UInt64 first solves the problem.
- *os << reinterpret_cast<const void*>(
- reinterpret_cast<internal::UInt64>(p));
- }
-}
-
-// Used to print a non-container, non-pointer value when the user
-// doesn't define PrintTo() for it.
-template <typename T>
-void DefaultPrintTo(WrapPrinterType<kPrintOther> /* dummy */,
- const T& value, ::std::ostream* os) {
- ::testing_internal::DefaultPrintNonContainerTo(value, os);
-}
-
-// Prints the given value using the << operator if it has one;
-// otherwise prints the bytes in it. This is what
-// UniversalPrinter<T>::Print() does when PrintTo() is not specialized
-// or overloaded for type T.
-//
-// A user can override this behavior for a class type Foo by defining
-// an overload of PrintTo() in the namespace where Foo is defined. We
-// give the user this option as sometimes defining a << operator for
-// Foo is not desirable (e.g. the coding style may prevent doing it,
-// or there is already a << operator but it doesn't do what the user
-// wants).
-template <typename T>
-void PrintTo(const T& value, ::std::ostream* os) {
- // DefaultPrintTo() is overloaded. The type of its first argument
- // determines which version will be picked.
- //
- // Note that we check for container types here, prior to we check
- // for protocol message types in our operator<<. The rationale is:
- //
- // For protocol messages, we want to give people a chance to
- // override Google Mock's format by defining a PrintTo() or
- // operator<<. For STL containers, other formats can be
- // incompatible with Google Mock's format for the container
- // elements; therefore we check for container types here to ensure
- // that our format is used.
- //
- // Note that MSVC and clang-cl do allow an implicit conversion from
- // pointer-to-function to pointer-to-object, but clang-cl warns on it.
- // So don't use ImplicitlyConvertible if it can be helped since it will
- // cause this warning, and use a separate overload of DefaultPrintTo for
- // function pointers so that the `*os << p` in the object pointer overload
- // doesn't cause that warning either.
- DefaultPrintTo(
- WrapPrinterType<sizeof(IsContainerTest<T>(0)) == sizeof(IsContainer)
- ? kPrintContainer : !is_pointer<T>::value
- ? kPrintOther
-#if GTEST_LANG_CXX11
- : std::is_function<typename std::remove_pointer<T>::type>::value
-#else
- : !internal::ImplicitlyConvertible<T, const void*>::value
-#endif
- ? kPrintFunctionPointer
- : kPrintPointer>(),
- value, os);
-}
-
-// The following list of PrintTo() overloads tells
-// UniversalPrinter<T>::Print() how to print standard types (built-in
-// types, strings, plain arrays, and pointers).
-
-// Overloads for various char types.
-GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
-GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
-inline void PrintTo(char c, ::std::ostream* os) {
- // When printing a plain char, we always treat it as unsigned. This
- // way, the output won't be affected by whether the compiler thinks
- // char is signed or not.
- PrintTo(static_cast<unsigned char>(c), os);
-}
-
-// Overloads for other simple built-in types.
-inline void PrintTo(bool x, ::std::ostream* os) {
- *os << (x ? "true" : "false");
-}
-
-// Overload for wchar_t type.
-// Prints a wchar_t as a symbol if it is printable or as its internal
-// code otherwise and also as its decimal code (except for L'\0').
-// The L'\0' char is printed as "L'\\0'". The decimal code is printed
-// as signed integer when wchar_t is implemented by the compiler
-// as a signed type and is printed as an unsigned integer when wchar_t
-// is implemented as an unsigned type.
-GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
-
-// Overloads for C strings.
-GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
-inline void PrintTo(char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const char*>(s), os);
-}
-
-// signed/unsigned char is often used for representing binary data, so
-// we print pointers to it as void* to be safe.
-inline void PrintTo(const signed char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(signed char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-inline void PrintTo(unsigned char* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const void*>(s), os);
-}
-
-// MSVC can be configured to define wchar_t as a typedef of unsigned
-// short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
-// type. When wchar_t is a typedef, defining an overload for const
-// wchar_t* would cause unsigned short* be printed as a wide string,
-// possibly causing invalid memory accesses.
-#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
-// Overloads for wide C strings
-GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
-inline void PrintTo(wchar_t* s, ::std::ostream* os) {
- PrintTo(ImplicitCast_<const wchar_t*>(s), os);
-}
-#endif
-
-// Overload for C arrays. Multi-dimensional arrays are printed
-// properly.
-
-// Prints the given number of elements in an array, without printing
-// the curly braces.
-template <typename T>
-void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
- UniversalPrint(a[0], os);
- for (size_t i = 1; i != count; i++) {
- *os << ", ";
- UniversalPrint(a[i], os);
- }
-}
-
-// Overloads for ::string and ::std::string.
-#if GTEST_HAS_GLOBAL_STRING
-GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
-inline void PrintTo(const ::string& s, ::std::ostream* os) {
- PrintStringTo(s, os);
-}
-#endif // GTEST_HAS_GLOBAL_STRING
-
-GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
-inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
- PrintStringTo(s, os);
-}
-
-// Overloads for ::wstring and ::std::wstring.
-#if GTEST_HAS_GLOBAL_WSTRING
-GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
-inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
- PrintWideStringTo(s, os);
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
-inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
- PrintWideStringTo(s, os);
-}
-#endif // GTEST_HAS_STD_WSTRING
-
-#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
-// Helper function for printing a tuple. T must be instantiated with
-// a tuple type.
-template <typename T>
-void PrintTupleTo(const T& t, ::std::ostream* os);
-#endif // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
-
-#if GTEST_HAS_TR1_TUPLE
-// Overload for ::std::tr1::tuple. Needed for printing function arguments,
-// which are packed as tuples.
-
-// Overloaded PrintTo() for tuples of various arities. We support
-// tuples of up-to 10 fields. The following implementation works
-// regardless of whether tr1::tuple is implemented using the
-// non-standard variadic template feature or not.
-
-inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1>
-void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2>
-void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-void PrintTo(
- const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,
- ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-#endif // GTEST_HAS_TR1_TUPLE
-
-#if GTEST_HAS_STD_TUPLE_
-template <typename... Types>
-void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) {
- PrintTupleTo(t, os);
-}
-#endif // GTEST_HAS_STD_TUPLE_
-
-// Overload for std::pair.
-template <typename T1, typename T2>
-void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
- *os << '(';
- // We cannot use UniversalPrint(value.first, os) here, as T1 may be
- // a reference type. The same for printing value.second.
- UniversalPrinter<T1>::Print(value.first, os);
- *os << ", ";
- UniversalPrinter<T2>::Print(value.second, os);
- *os << ')';
-}
-
-// Implements printing a non-reference type T by letting the compiler
-// pick the right overload of PrintTo() for T.
-template <typename T>
-class UniversalPrinter {
- public:
- // MSVC warns about adding const to a function type, so we want to
- // disable the warning.
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
-
- // Note: we deliberately don't call this PrintTo(), as that name
- // conflicts with ::testing::internal::PrintTo in the body of the
- // function.
- static void Print(const T& value, ::std::ostream* os) {
- // By default, ::testing::internal::PrintTo() is used for printing
- // the value.
- //
- // Thanks to Koenig look-up, if T is a class and has its own
- // PrintTo() function defined in its namespace, that function will
- // be visible here. Since it is more specific than the generic ones
- // in ::testing::internal, it will be picked by the compiler in the
- // following statement - exactly what we want.
- PrintTo(value, os);
- }
-
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-};
-
-// UniversalPrintArray(begin, len, os) prints an array of 'len'
-// elements, starting at address 'begin'.
-template <typename T>
-void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
- if (len == 0) {
- *os << "{}";
- } else {
- *os << "{ ";
- const size_t kThreshold = 18;
- const size_t kChunkSize = 8;
- // If the array has more than kThreshold elements, we'll have to
- // omit some details by printing only the first and the last
- // kChunkSize elements.
- // TODO(wan@google.com): let the user control the threshold using a flag.
- if (len <= kThreshold) {
- PrintRawArrayTo(begin, len, os);
- } else {
- PrintRawArrayTo(begin, kChunkSize, os);
- *os << ", ..., ";
- PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
- }
- *os << " }";
- }
-}
-// This overload prints a (const) char array compactly.
-GTEST_API_ void UniversalPrintArray(
- const char* begin, size_t len, ::std::ostream* os);
-
-// This overload prints a (const) wchar_t array compactly.
-GTEST_API_ void UniversalPrintArray(
- const wchar_t* begin, size_t len, ::std::ostream* os);
-
-// Implements printing an array type T[N].
-template <typename T, size_t N>
-class UniversalPrinter<T[N]> {
- public:
- // Prints the given array, omitting some elements when there are too
- // many.
- static void Print(const T (&a)[N], ::std::ostream* os) {
- UniversalPrintArray(a, N, os);
- }
-};
-
-// Implements printing a reference type T&.
-template <typename T>
-class UniversalPrinter<T&> {
- public:
- // MSVC warns about adding const to a function type, so we want to
- // disable the warning.
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180)
-
- static void Print(const T& value, ::std::ostream* os) {
- // Prints the address of the value. We use reinterpret_cast here
- // as static_cast doesn't compile when T is a function type.
- *os << "@" << reinterpret_cast<const void*>(&value) << " ";
-
- // Then prints the value itself.
- UniversalPrint(value, os);
- }
-
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-};
-
-// Prints a value tersely: for a reference type, the referenced value
-// (but not the address) is printed; for a (const) char pointer, the
-// NUL-terminated string (but not the pointer) is printed.
-
-template <typename T>
-class UniversalTersePrinter {
- public:
- static void Print(const T& value, ::std::ostream* os) {
- UniversalPrint(value, os);
- }
-};
-template <typename T>
-class UniversalTersePrinter<T&> {
- public:
- static void Print(const T& value, ::std::ostream* os) {
- UniversalPrint(value, os);
- }
-};
-template <typename T, size_t N>
-class UniversalTersePrinter<T[N]> {
- public:
- static void Print(const T (&value)[N], ::std::ostream* os) {
- UniversalPrinter<T[N]>::Print(value, os);
- }
-};
-template <>
-class UniversalTersePrinter<const char*> {
- public:
- static void Print(const char* str, ::std::ostream* os) {
- if (str == NULL) {
- *os << "NULL";
- } else {
- UniversalPrint(std::string(str), os);
- }
- }
-};
-template <>
-class UniversalTersePrinter<char*> {
- public:
- static void Print(char* str, ::std::ostream* os) {
- UniversalTersePrinter<const char*>::Print(str, os);
- }
-};
-
-#if GTEST_HAS_STD_WSTRING
-template <>
-class UniversalTersePrinter<const wchar_t*> {
- public:
- static void Print(const wchar_t* str, ::std::ostream* os) {
- if (str == NULL) {
- *os << "NULL";
- } else {
- UniversalPrint(::std::wstring(str), os);
- }
- }
-};
-#endif
-
-template <>
-class UniversalTersePrinter<wchar_t*> {
- public:
- static void Print(wchar_t* str, ::std::ostream* os) {
- UniversalTersePrinter<const wchar_t*>::Print(str, os);
- }
-};
-
-template <typename T>
-void UniversalTersePrint(const T& value, ::std::ostream* os) {
- UniversalTersePrinter<T>::Print(value, os);
-}
-
-// Prints a value using the type inferred by the compiler. The
-// difference between this and UniversalTersePrint() is that for a
-// (const) char pointer, this prints both the pointer and the
-// NUL-terminated string.
-template <typename T>
-void UniversalPrint(const T& value, ::std::ostream* os) {
- // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
- // UniversalPrinter with T directly.
- typedef T T1;
- UniversalPrinter<T1>::Print(value, os);
-}
-
-typedef ::std::vector<string> Strings;
-
-// TuplePolicy<TupleT> must provide:
-// - tuple_size
-// size of tuple TupleT.
-// - get<size_t I>(const TupleT& t)
-// static function extracting element I of tuple TupleT.
-// - tuple_element<size_t I>::type
-// type of element I of tuple TupleT.
-template <typename TupleT>
-struct TuplePolicy;
-
-#if GTEST_HAS_TR1_TUPLE
-template <typename TupleT>
-struct TuplePolicy {
- typedef TupleT Tuple;
- static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value;
-
- template <size_t I>
- struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {};
-
- template <size_t I>
- static typename AddReference<
- const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get(
- const Tuple& tuple) {
- return ::std::tr1::get<I>(tuple);
- }
-};
-template <typename TupleT>
-const size_t TuplePolicy<TupleT>::tuple_size;
-#endif // GTEST_HAS_TR1_TUPLE
-
-#if GTEST_HAS_STD_TUPLE_
-template <typename... Types>
-struct TuplePolicy< ::std::tuple<Types...> > {
- typedef ::std::tuple<Types...> Tuple;
- static const size_t tuple_size = ::std::tuple_size<Tuple>::value;
-
- template <size_t I>
- struct tuple_element : ::std::tuple_element<I, Tuple> {};
-
- template <size_t I>
- static const typename ::std::tuple_element<I, Tuple>::type& get(
- const Tuple& tuple) {
- return ::std::get<I>(tuple);
- }
-};
-template <typename... Types>
-const size_t TuplePolicy< ::std::tuple<Types...> >::tuple_size;
-#endif // GTEST_HAS_STD_TUPLE_
-
-#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
-// This helper template allows PrintTo() for tuples and
-// UniversalTersePrintTupleFieldsToStrings() to be defined by
-// induction on the number of tuple fields. The idea is that
-// TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
-// fields in tuple t, and can be defined in terms of
-// TuplePrefixPrinter<N - 1>.
-//
-// The inductive case.
-template <size_t N>
-struct TuplePrefixPrinter {
- // Prints the first N fields of a tuple.
- template <typename Tuple>
- static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
- TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
- GTEST_INTENTIONAL_CONST_COND_PUSH_()
- if (N > 1) {
- GTEST_INTENTIONAL_CONST_COND_POP_()
- *os << ", ";
- }
- UniversalPrinter<
- typename TuplePolicy<Tuple>::template tuple_element<N - 1>::type>
- ::Print(TuplePolicy<Tuple>::template get<N - 1>(t), os);
- }
-
- // Tersely prints the first N fields of a tuple to a string vector,
- // one element for each field.
- template <typename Tuple>
- static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
- TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
- ::std::stringstream ss;
- UniversalTersePrint(TuplePolicy<Tuple>::template get<N - 1>(t), &ss);
- strings->push_back(ss.str());
- }
-};
-
-// Base case.
-template <>
-struct TuplePrefixPrinter<0> {
- template <typename Tuple>
- static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}
-
- template <typename Tuple>
- static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
-};
-
-// Helper function for printing a tuple.
-// Tuple must be either std::tr1::tuple or std::tuple type.
-template <typename Tuple>
-void PrintTupleTo(const Tuple& t, ::std::ostream* os) {
- *os << "(";
- TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::PrintPrefixTo(t, os);
- *os << ")";
-}
-
-// Prints the fields of a tuple tersely to a string vector, one
-// element for each field. See the comment before
-// UniversalTersePrint() for how we define "tersely".
-template <typename Tuple>
-Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
- Strings result;
- TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::
- TersePrintPrefixToStrings(value, &result);
- return result;
-}
-#endif // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
-
-} // namespace internal
-
-template <typename T>
-::std::string PrintToString(const T& value) {
- ::std::stringstream ss;
- internal::UniversalTersePrinter<T>::Print(value, &ss);
- return ss.str();
-}
-
-} // namespace testing
-
-// Include any custom printer 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 "gtest/internal/custom/gtest-printers.h"
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
diff --git a/src/lib/install/include/gtest/gtest-spi.h b/src/lib/install/include/gtest/gtest-spi.h
deleted file mode 100755
index 0e5c10c..0000000
--- a/src/lib/install/include/gtest/gtest-spi.h
+++ /dev/null
@@ -1,231 +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)
-//
-// Utilities for testing Google Test itself and code that uses Google Test
-// (e.g. frameworks built on top of Google Test).
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
-
-#include "gtest/gtest.h"
-
-namespace testing {
-
-// This helper class can be used to mock out Google Test failure reporting
-// so that we can test Google Test or code that builds on Google Test.
-//
-// An object of this class appends a TestPartResult object to the
-// TestPartResultArray object given in the constructor whenever a Google Test
-// failure is reported. It can either intercept only failures that are
-// generated in the same thread that created this object or it can intercept
-// all generated failures. The scope of this mock object can be controlled with
-// the second argument to the two arguments constructor.
-class GTEST_API_ ScopedFakeTestPartResultReporter
- : public TestPartResultReporterInterface {
- public:
- // The two possible mocking modes of this object.
- enum InterceptMode {
- INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
- INTERCEPT_ALL_THREADS // Intercepts all failures.
- };
-
- // The c'tor sets this object as the test part result reporter used
- // by Google Test. The 'result' parameter specifies where to report the
- // results. This reporter will only catch failures generated in the current
- // thread. DEPRECATED
- explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
-
- // Same as above, but you can choose the interception scope of this object.
- ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
- TestPartResultArray* result);
-
- // The d'tor restores the previous test part result reporter.
- virtual ~ScopedFakeTestPartResultReporter();
-
- // Appends the TestPartResult object to the TestPartResultArray
- // received in the constructor.
- //
- // This method is from the TestPartResultReporterInterface
- // interface.
- virtual void ReportTestPartResult(const TestPartResult& result);
- private:
- void Init();
-
- const InterceptMode intercept_mode_;
- TestPartResultReporterInterface* old_reporter_;
- TestPartResultArray* const result_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
-};
-
-namespace internal {
-
-// A helper class for implementing EXPECT_FATAL_FAILURE() and
-// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given
-// TestPartResultArray contains exactly one failure that has the given
-// type and contains the given substring. If that's not the case, a
-// non-fatal failure will be generated.
-class GTEST_API_ SingleFailureChecker {
- public:
- // The constructor remembers the arguments.
- SingleFailureChecker(const TestPartResultArray* results,
- TestPartResult::Type type, const std::string& substr);
- ~SingleFailureChecker();
- private:
- const TestPartResultArray* const results_;
- const TestPartResult::Type type_;
- const std::string substr_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-// A set of macros for testing Google Test assertions or code that's expected
-// to generate Google Test fatal failures. It verifies that the given
-// statement will cause exactly one fatal Google Test failure with 'substr'
-// being part of the failure message.
-//
-// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
-// affects and considers failures generated in the current thread and
-// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
-//
-// The verification of the assertion is done correctly even when the statement
-// throws an exception or aborts the current function.
-//
-// Known restrictions:
-// - 'statement' cannot reference local non-static variables or
-// non-static members of the current object.
-// - 'statement' cannot return a value.
-// - You cannot stream a failure message to this macro.
-//
-// Note that even though the implementations of the following two
-// macros are much alike, we cannot refactor them to use a common
-// helper macro, due to some peculiarity in how the preprocessor
-// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
-// gtest_unittest.cc will fail to compile if we do that.
-#define EXPECT_FATAL_FAILURE(statement, substr) \
- do { \
- class GTestExpectFatalFailureHelper {\
- public:\
- static void Execute() { statement; }\
- };\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
- GTestExpectFatalFailureHelper::Execute();\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
- do { \
- class GTestExpectFatalFailureHelper {\
- public:\
- static void Execute() { statement; }\
- };\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ALL_THREADS, &gtest_failures);\
- GTestExpectFatalFailureHelper::Execute();\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-// A macro for testing Google Test assertions or code that's expected to
-// generate Google Test non-fatal failures. It asserts that the given
-// statement will cause exactly one non-fatal Google Test failure with 'substr'
-// being part of the failure message.
-//
-// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
-// affects and considers failures generated in the current thread and
-// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
-//
-// 'statement' is allowed to reference local variables and members of
-// the current object.
-//
-// The verification of the assertion is done correctly even when the statement
-// throws an exception or aborts the current function.
-//
-// Known restrictions:
-// - You cannot stream a failure message to this macro.
-//
-// Note that even though the implementations of the following two
-// macros are much alike, we cannot refactor them to use a common
-// helper macro, due to some peculiarity in how the preprocessor
-// works. If we do that, the code won't compile when the user gives
-// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
-// expands to code containing an unprotected comma. The
-// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
-// catches that.
-//
-// For the same reason, we have to write
-// if (::testing::internal::AlwaysTrue()) { statement; }
-// instead of
-// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
-// to avoid an MSVC warning on unreachable code.
-#define EXPECT_NONFATAL_FAILURE(statement, substr) \
- do {\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
- (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter:: \
- INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
- if (::testing::internal::AlwaysTrue()) { statement; }\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
- do {\
- ::testing::TestPartResultArray gtest_failures;\
- ::testing::internal::SingleFailureChecker gtest_checker(\
- &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
- (substr));\
- {\
- ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
- ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
- &gtest_failures);\
- if (::testing::internal::AlwaysTrue()) { statement; }\
- }\
- } while (::testing::internal::AlwaysFalse())
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
diff --git a/src/lib/install/include/gtest/gtest-test-part.h b/src/lib/install/include/gtest/gtest-test-part.h
deleted file mode 100755
index 77eb844..0000000
--- a/src/lib/install/include/gtest/gtest-test-part.h
+++ /dev/null
@@ -1,179 +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.
-//
-// Author: mheule@google.com (Markus Heule)
-//
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
-
-#include <iosfwd>
-#include <vector>
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-string.h"
-
-namespace testing {
-
-// A copyable object representing the result of a test part (i.e. an
-// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
-//
-// Don't inherit from TestPartResult as its destructor is not virtual.
-class GTEST_API_ TestPartResult {
- public:
- // The possible outcomes of a test part (i.e. an assertion or an
- // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
- enum Type {
- kSuccess, // Succeeded.
- kNonFatalFailure, // Failed but the test can continue.
- kFatalFailure // Failed and the test should be terminated.
- };
-
- // C'tor. TestPartResult does NOT have a default constructor.
- // Always use this constructor (with parameters) to create a
- // TestPartResult object.
- TestPartResult(Type a_type,
- const char* a_file_name,
- int a_line_number,
- const char* a_message)
- : type_(a_type),
- file_name_(a_file_name == NULL ? "" : a_file_name),
- line_number_(a_line_number),
- summary_(ExtractSummary(a_message)),
- message_(a_message) {
- }
-
- // Gets the outcome of the test part.
- Type type() const { return type_; }
-
- // Gets the name of the source file where the test part took place, or
- // NULL if it's unknown.
- const char* file_name() const {
- return file_name_.empty() ? NULL : file_name_.c_str();
- }
-
- // Gets the line in the source file where the test part took place,
- // or -1 if it's unknown.
- int line_number() const { return line_number_; }
-
- // Gets the summary of the failure message.
- const char* summary() const { return summary_.c_str(); }
-
- // Gets the message associated with the test part.
- const char* message() const { return message_.c_str(); }
-
- // Returns true iff the test part passed.
- bool passed() const { return type_ == kSuccess; }
-
- // Returns true iff the test part failed.
- bool failed() const { return type_ != kSuccess; }
-
- // Returns true iff the test part non-fatally failed.
- bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
-
- // Returns true iff the test part fatally failed.
- bool fatally_failed() const { return type_ == kFatalFailure; }
-
- private:
- Type type_;
-
- // Gets the summary of the failure message by omitting the stack
- // trace in it.
- static std::string ExtractSummary(const char* message);
-
- // The name of the source file where the test part took place, or
- // "" if the source file is unknown.
- std::string file_name_;
- // The line in the source file where the test part took place, or -1
- // if the line number is unknown.
- int line_number_;
- std::string summary_; // The test failure summary.
- std::string message_; // The test failure message.
-};
-
-// Prints a TestPartResult object.
-std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
-
-// An array of TestPartResult objects.
-//
-// Don't inherit from TestPartResultArray as its destructor is not
-// virtual.
-class GTEST_API_ TestPartResultArray {
- public:
- TestPartResultArray() {}
-
- // Appends the given TestPartResult to the array.
- void Append(const TestPartResult& result);
-
- // Returns the TestPartResult at the given index (0-based).
- const TestPartResult& GetTestPartResult(int index) const;
-
- // Returns the number of TestPartResult objects in the array.
- int size() const;
-
- private:
- std::vector<TestPartResult> array_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
-};
-
-// This interface knows how to report a test part result.
-class TestPartResultReporterInterface {
- public:
- virtual ~TestPartResultReporterInterface() {}
-
- virtual void ReportTestPartResult(const TestPartResult& result) = 0;
-};
-
-namespace internal {
-
-// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
-// statement generates new fatal failures. To do so it registers itself as the
-// current test part result reporter. Besides checking if fatal failures were
-// reported, it only delegates the reporting to the former result reporter.
-// The original result reporter is restored in the destructor.
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-class GTEST_API_ HasNewFatalFailureHelper
- : public TestPartResultReporterInterface {
- public:
- HasNewFatalFailureHelper();
- virtual ~HasNewFatalFailureHelper();
- virtual void ReportTestPartResult(const TestPartResult& result);
- bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
- private:
- bool has_new_fatal_failure_;
- TestPartResultReporterInterface* original_reporter_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
-};
-
-} // namespace internal
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
diff --git a/src/lib/install/include/gtest/gtest-typed-test.h b/src/lib/install/include/gtest/gtest-typed-test.h
deleted file mode 100755
index 20726b2..0000000
--- a/src/lib/install/include/gtest/gtest-typed-test.h
+++ /dev/null
@@ -1,264 +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.
-//
-// Author: wan@google.com (Zhanyong Wan)
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
-
-// This header implements typed tests and type-parameterized tests.
-
-// Typed (aka type-driven) tests repeat the same test for types in a
-// list. You must know which types you want to test with when writing
-// typed tests. Here's how you do it:
-
-#if 0
-
-// First, define a fixture class template. It should be parameterized
-// by a type. Remember to derive it from testing::Test.
-template <typename T>
-class FooTest : public testing::Test {
- public:
- ...
- typedef std::list<T> List;
- static T shared_;
- T value_;
-};
-
-// Next, associate a list of types with the test case, which will be
-// repeated for each type in the list. The typedef is necessary for
-// the macro to parse correctly.
-typedef testing::Types<char, int, unsigned int> MyTypes;
-TYPED_TEST_CASE(FooTest, MyTypes);
-
-// If the type list contains only one type, you can write that type
-// directly without Types<...>:
-// TYPED_TEST_CASE(FooTest, int);
-
-// Then, use TYPED_TEST() instead of TEST_F() to define as many typed
-// tests for this test case as you want.
-TYPED_TEST(FooTest, DoesBlah) {
- // Inside a test, refer to TypeParam to get the type parameter.
- // Since we are inside a derived class template, C++ requires use to
- // visit the members of FooTest via 'this'.
- TypeParam n = this->value_;
-
- // To visit static members of the fixture, add the TestFixture::
- // prefix.
- n += TestFixture::shared_;
-
- // To refer to typedefs in the fixture, add the "typename
- // TestFixture::" prefix.
- typename TestFixture::List values;
- values.push_back(n);
- ...
-}
-
-TYPED_TEST(FooTest, HasPropertyA) { ... }
-
-#endif // 0
-
-// Type-parameterized tests are abstract test patterns parameterized
-// by a type. Compared with typed tests, type-parameterized tests
-// allow you to define the test pattern without knowing what the type
-// parameters are. The defined pattern can be instantiated with
-// different types any number of times, in any number of translation
-// units.
-//
-// If you are designing an interface or concept, you can define a
-// suite of type-parameterized tests to verify properties that any
-// valid implementation of the interface/concept should have. Then,
-// each implementation can easily instantiate the test suite to verify
-// that it conforms to the requirements, without having to write
-// similar tests repeatedly. Here's an example:
-
-#if 0
-
-// First, define a fixture class template. It should be parameterized
-// by a type. Remember to derive it from testing::Test.
-template <typename T>
-class FooTest : public testing::Test {
- ...
-};
-
-// Next, declare that you will define a type-parameterized test case
-// (the _P suffix is for "parameterized" or "pattern", whichever you
-// prefer):
-TYPED_TEST_CASE_P(FooTest);
-
-// Then, use TYPED_TEST_P() to define as many type-parameterized tests
-// for this type-parameterized test case as you want.
-TYPED_TEST_P(FooTest, DoesBlah) {
- // Inside a test, refer to TypeParam to get the type parameter.
- TypeParam n = 0;
- ...
-}
-
-TYPED_TEST_P(FooTest, HasPropertyA) { ... }
-
-// Now the tricky part: you need to register all test patterns before
-// you can instantiate them. The first argument of the macro is the
-// test case name; the rest are the names of the tests in this test
-// case.
-REGISTER_TYPED_TEST_CASE_P(FooTest,
- DoesBlah, HasPropertyA);
-
-// Finally, you are free to instantiate the pattern with the types you
-// want. If you put the above code in a header file, you can #include
-// it in multiple C++ source files and instantiate it multiple times.
-//
-// To distinguish different instances of the pattern, the first
-// argument to the INSTANTIATE_* macro is a prefix that will be added
-// to the actual test case name. Remember to pick unique prefixes for
-// different instances.
-typedef testing::Types<char, int, unsigned int> MyTypes;
-INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
-
-// If the type list contains only one type, you can write that type
-// directly without Types<...>:
-// INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int);
-
-#endif // 0
-
-#include "gtest/internal/gtest-port.h"
-#include "gtest/internal/gtest-type-util.h"
-
-// Implements typed tests.
-
-#if GTEST_HAS_TYPED_TEST
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the name of the typedef for the type parameters of the
-// given test case.
-# define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
-
-// The 'Types' template argument below must have spaces around it
-// since some compilers may choke on '>>' when passing a template
-// instance (e.g. Types<int>)
-# define TYPED_TEST_CASE(CaseName, Types) \
- typedef ::testing::internal::TypeList< Types >::type \
- GTEST_TYPE_PARAMS_(CaseName)
-
-# define TYPED_TEST(CaseName, TestName) \
- template <typename gtest_TypeParam_> \
- class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
- : public CaseName<gtest_TypeParam_> { \
- private: \
- typedef CaseName<gtest_TypeParam_> TestFixture; \
- typedef gtest_TypeParam_ TypeParam; \
- virtual void TestBody(); \
- }; \
- bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \
- ::testing::internal::TypeParameterizedTest< \
- CaseName, \
- ::testing::internal::TemplateSel< \
- GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \
- GTEST_TYPE_PARAMS_(CaseName)>::Register(\
- "", ::testing::internal::CodeLocation(__FILE__, __LINE__), \
- #CaseName, #TestName, 0); \
- template <typename gtest_TypeParam_> \
- void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody()
-
-#endif // GTEST_HAS_TYPED_TEST
-
-// Implements type-parameterized tests.
-
-#if GTEST_HAS_TYPED_TEST_P
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the namespace name that the type-parameterized tests for
-// the given type-parameterized test case are defined in. The exact
-// name of the namespace is subject to change without notice.
-# define GTEST_CASE_NAMESPACE_(TestCaseName) \
- gtest_case_##TestCaseName##_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Expands to the name of the variable used to remember the names of
-// the defined tests in the given test case.
-# define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
- gtest_typed_test_case_p_state_##TestCaseName##_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
-//
-// Expands to the name of the variable used to remember the names of
-// the registered tests in the given test case.
-# define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
- gtest_registered_test_names_##TestCaseName##_
-
-// The variables defined in the type-parameterized test macros are
-// static as typically these macros are used in a .h file that can be
-// #included in multiple translation units linked together.
-# define TYPED_TEST_CASE_P(CaseName) \
- static ::testing::internal::TypedTestCasePState \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
-
-# define TYPED_TEST_P(CaseName, TestName) \
- namespace GTEST_CASE_NAMESPACE_(CaseName) { \
- template <typename gtest_TypeParam_> \
- class TestName : public CaseName<gtest_TypeParam_> { \
- private: \
- typedef CaseName<gtest_TypeParam_> TestFixture; \
- typedef gtest_TypeParam_ TypeParam; \
- virtual void TestBody(); \
- }; \
- static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\
- __FILE__, __LINE__, #CaseName, #TestName); \
- } \
- template <typename gtest_TypeParam_> \
- void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
-
-# define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
- namespace GTEST_CASE_NAMESPACE_(CaseName) { \
- typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
- } \
- static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \
- GTEST_ATTRIBUTE_UNUSED_ = \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
- __FILE__, __LINE__, #__VA_ARGS__)
-
-// The 'Types' template argument below must have spaces around it
-// since some compilers may choke on '>>' when passing a template
-// instance (e.g. Types<int>)
-# define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
- bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
- ::testing::internal::TypeParameterizedTestCase<CaseName, \
- GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
- ::testing::internal::TypeList< Types >::type>::Register(\
- #Prefix, \
- ::testing::internal::CodeLocation(__FILE__, __LINE__), \
- &GTEST_TYPED_TEST_CASE_P_STATE_(CaseName), \
- #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName))
-
-#endif // GTEST_HAS_TYPED_TEST_P
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
diff --git a/src/lib/install/include/gtest/gtest.h b/src/lib/install/include/gtest/gtest.h
deleted file mode 100755
index c1cd69a..0000000
--- a/src/lib/install/include/gtest/gtest.h
+++ /dev/null
@@ -1,2240 +0,0 @@
-// Copyright 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.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the public API for Google Test. It should be
-// included by any test program that uses Google Test.
-//
-// IMPORTANT NOTE: Due to limitation of the C++ language, we have to
-// leave some internal implementation details in this header file.
-// They are clearly marked by comments like this:
-//
-// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-//
-// Such code is NOT meant to be used by a user directly, and is subject
-// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
-// program!
-//
-// Acknowledgment: Google Test borrowed the idea of automatic test
-// registration from Barthelemy Dagenais' (barthelemy@prologique.com)
-// easyUnit framework.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-#define GTEST_INCLUDE_GTEST_GTEST_H_
-
-#include <limits>
-#include <ostream>
-#include <vector>
-
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-string.h"
-#include "gtest/gtest-death-test.h"
-#include "gtest/gtest-message.h"
-#include "gtest/gtest-param-test.h"
-#include "gtest/gtest-printers.h"
-#include "gtest/gtest_prod.h"
-#include "gtest/gtest-test-part.h"
-#include "gtest/gtest-typed-test.h"
-
-// Depending on the platform, different string classes are available.
-// On Linux, in addition to ::std::string, Google also makes use of
-// class ::string, which has the same interface as ::std::string, but
-// has a different implementation.
-//
-// You can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
-// ::string is available AND is a distinct type to ::std::string, or
-// define it to 0 to indicate otherwise.
-//
-// If ::std::string and ::string are the same class on your platform
-// due to aliasing, you should define GTEST_HAS_GLOBAL_STRING to 0.
-//
-// If you do not define GTEST_HAS_GLOBAL_STRING, it is defined
-// heuristically.
-
-namespace testing {
-
-// Declares the flags.
-
-// This flag temporary enables the disabled tests.
-GTEST_DECLARE_bool_(also_run_disabled_tests);
-
-// This flag brings the debugger on an assertion failure.
-GTEST_DECLARE_bool_(break_on_failure);
-
-// This flag controls whether Google Test catches all test-thrown exceptions
-// and logs them as failures.
-GTEST_DECLARE_bool_(catch_exceptions);
-
-// This flag enables using colors in terminal output. Available values are
-// "yes" to enable colors, "no" (disable colors), or "auto" (the default)
-// to let Google Test decide.
-GTEST_DECLARE_string_(color);
-
-// This flag sets up the filter to select by name using a glob pattern
-// the tests to run. If the filter is not given all tests are executed.
-GTEST_DECLARE_string_(filter);
-
-// This flag causes the Google Test to list tests. None of the tests listed
-// are actually run if the flag is provided.
-GTEST_DECLARE_bool_(list_tests);
-
-// This flag controls whether Google Test emits a detailed XML report to a file
-// in addition to its normal textual output.
-GTEST_DECLARE_string_(output);
-
-// This flags control whether Google Test prints the elapsed time for each
-// test.
-GTEST_DECLARE_bool_(print_time);
-
-// This flag specifies the random number seed.
-GTEST_DECLARE_int32_(random_seed);
-
-// This flag sets how many times the tests are repeated. The default value
-// is 1. If the value is -1 the tests are repeating forever.
-GTEST_DECLARE_int32_(repeat);
-
-// This flag controls whether Google Test includes Google Test internal
-// stack frames in failure stack traces.
-GTEST_DECLARE_bool_(show_internal_stack_frames);
-
-// When this flag is specified, tests' order is randomized on every iteration.
-GTEST_DECLARE_bool_(shuffle);
-
-// This flag specifies the maximum number of stack frames to be
-// printed in a failure message.
-GTEST_DECLARE_int32_(stack_trace_depth);
-
-// When this flag is specified, a failed assertion will throw an
-// exception if exceptions are enabled, or exit the program with a
-// non-zero code otherwise.
-GTEST_DECLARE_bool_(throw_on_failure);
-
-// When this flag is set with a "host:port" string, on supported
-// platforms test results are streamed to the specified port on
-// the specified host machine.
-GTEST_DECLARE_string_(stream_result_to);
-
-// The upper limit for valid stack trace depths.
-const int kMaxStackTraceDepth = 100;
-
-namespace internal {
-
-class AssertHelper;
-class DefaultGlobalTestPartResultReporter;
-class ExecDeathTest;
-class NoExecDeathTest;
-class FinalSuccessChecker;
-class GTestFlagSaver;
-class StreamingListenerTest;
-class TestResultAccessor;
-class TestEventListenersAccessor;
-class TestEventRepeater;
-class UnitTestRecordPropertyTestHelper;
-class WindowsDeathTest;
-class UnitTestImpl* GetUnitTestImpl();
-void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
- const std::string& message);
-
-} // namespace internal
-
-// The friend relationship of some of these classes is cyclic.
-// If we don't forward declare them the compiler might confuse the classes
-// in friendship clauses with same named classes on the scope.
-class Test;
-class TestCase;
-class TestInfo;
-class UnitTest;
-
-// A class for indicating whether an assertion was successful. When
-// the assertion wasn't successful, the AssertionResult object
-// remembers a non-empty message that describes how it failed.
-//
-// To create an instance of this class, use one of the factory functions
-// (AssertionSuccess() and AssertionFailure()).
-//
-// This class is useful for two purposes:
-// 1. Defining predicate functions to be used with Boolean test assertions
-// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
-// 2. Defining predicate-format functions to be
-// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
-//
-// For example, if you define IsEven predicate:
-//
-// testing::AssertionResult IsEven(int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess();
-// else
-// return testing::AssertionFailure() << n << " is odd";
-// }
-//
-// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
-// will print the message
-//
-// Value of: IsEven(Fib(5))
-// Actual: false (5 is odd)
-// Expected: true
-//
-// instead of a more opaque
-//
-// Value of: IsEven(Fib(5))
-// Actual: false
-// Expected: true
-//
-// in case IsEven is a simple Boolean predicate.
-//
-// If you expect your predicate to be reused and want to support informative
-// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
-// about half as often as positive ones in our tests), supply messages for
-// both success and failure cases:
-//
-// testing::AssertionResult IsEven(int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess() << n << " is even";
-// else
-// return testing::AssertionFailure() << n << " is odd";
-// }
-//
-// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
-//
-// Value of: IsEven(Fib(6))
-// Actual: true (8 is even)
-// Expected: false
-//
-// NB: Predicates that support negative Boolean assertions have reduced
-// performance in positive ones so be careful not to use them in tests
-// that have lots (tens of thousands) of positive Boolean assertions.
-//
-// To use this class with EXPECT_PRED_FORMAT assertions such as:
-//
-// // Verifies that Foo() returns an even number.
-// EXPECT_PRED_FORMAT1(IsEven, Foo());
-//
-// you need to define:
-//
-// testing::AssertionResult IsEven(const char* expr, int n) {
-// if ((n % 2) == 0)
-// return testing::AssertionSuccess();
-// else
-// return testing::AssertionFailure()
-// << "Expected: " << expr << " is even\n Actual: it's " << n;
-// }
-//
-// If Foo() returns 5, you will see the following message:
-//
-// Expected: Foo() is even
-// Actual: it's 5
-//
-class GTEST_API_ AssertionResult {
- public:
- // Copy constructor.
- // Used in EXPECT_TRUE/FALSE(assertion_result).
- AssertionResult(const AssertionResult& other);
-
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
-
- // Used in the EXPECT_TRUE/FALSE(bool_expression).
- //
- // T must be contextually convertible to bool.
- //
- // The second parameter prevents this overload from being considered if
- // the argument is implicitly convertible to AssertionResult. In that case
- // we want AssertionResult's copy constructor to be used.
- template <typename T>
- explicit AssertionResult(
- const T& success,
- typename internal::EnableIf<
- !internal::ImplicitlyConvertible<T, AssertionResult>::value>::type*
- /*enabler*/ = NULL)
- : success_(success) {}
-
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-
- // Assignment operator.
- AssertionResult& operator=(AssertionResult other) {
- swap(other);
- return *this;
- }
-
- // Returns true iff the assertion succeeded.
- operator bool() const { return success_; } // NOLINT
-
- // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
- AssertionResult operator!() const;
-
- // Returns the text streamed into this AssertionResult. Test assertions
- // use it when they fail (i.e., the predicate's outcome doesn't match the
- // assertion's expectation). When nothing has been streamed into the
- // object, returns an empty string.
- const char* message() const {
- return message_.get() != NULL ? message_->c_str() : "";
- }
- // TODO(vladl@google.com): Remove this after making sure no clients use it.
- // Deprecated; please use message() instead.
- const char* failure_message() const { return message(); }
-
- // Streams a custom failure message into this object.
- template <typename T> AssertionResult& operator<<(const T& value) {
- AppendMessage(Message() << value);
- return *this;
- }
-
- // Allows streaming basic output manipulators such as endl or flush into
- // this object.
- AssertionResult& operator<<(
- ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
- AppendMessage(Message() << basic_manipulator);
- return *this;
- }
-
- private:
- // Appends the contents of message to message_.
- void AppendMessage(const Message& a_message) {
- if (message_.get() == NULL)
- message_.reset(new ::std::string);
- message_->append(a_message.GetString().c_str());
- }
-
- // Swap the contents of this AssertionResult with other.
- void swap(AssertionResult& other);
-
- // Stores result of the assertion predicate.
- bool success_;
- // Stores the message describing the condition in case the expectation
- // construct is not satisfied with the predicate's outcome.
- // Referenced via a pointer to avoid taking too much stack frame space
- // with test assertions.
- internal::scoped_ptr< ::std::string> message_;
-};
-
-// Makes a successful assertion result.
-GTEST_API_ AssertionResult AssertionSuccess();
-
-// Makes a failed assertion result.
-GTEST_API_ AssertionResult AssertionFailure();
-
-// Makes a failed assertion result with the given failure message.
-// Deprecated; use AssertionFailure() << msg.
-GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
-
-// The abstract class that all tests inherit from.
-//
-// In Google Test, a unit test program contains one or many TestCases, and
-// each TestCase contains one or many Tests.
-//
-// When you define a test using the TEST macro, you don't need to
-// explicitly derive from Test - the TEST macro automatically does
-// this for you.
-//
-// The only time you derive from Test is when defining a test fixture
-// to be used a TEST_F. For example:
-//
-// class FooTest : public testing::Test {
-// protected:
-// void SetUp() override { ... }
-// void TearDown() override { ... }
-// ...
-// };
-//
-// TEST_F(FooTest, Bar) { ... }
-// TEST_F(FooTest, Baz) { ... }
-//
-// Test is not copyable.
-class GTEST_API_ Test {
- public:
- friend class TestInfo;
-
- // Defines types for pointers to functions that set up and tear down
- // a test case.
- typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
- typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
-
- // The d'tor is virtual as we intend to inherit from Test.
- virtual ~Test();
-
- // Sets up the stuff shared by all tests in this test case.
- //
- // Google Test will call Foo::SetUpTestCase() before running the first
- // test in test case Foo. Hence a sub-class can define its own
- // SetUpTestCase() method to shadow the one defined in the super
- // class.
- static void SetUpTestCase() {}
-
- // Tears down the stuff shared by all tests in this test case.
- //
- // Google Test will call Foo::TearDownTestCase() after running the last
- // test in test case Foo. Hence a sub-class can define its own
- // TearDownTestCase() method to shadow the one defined in the super
- // class.
- static void TearDownTestCase() {}
-
- // Returns true iff the current test has a fatal failure.
- static bool HasFatalFailure();
-
- // Returns true iff the current test has a non-fatal failure.
- static bool HasNonfatalFailure();
-
- // Returns true iff the current test has a (either fatal or
- // non-fatal) failure.
- static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
-
- // Logs a property for the current test, test case, or for the entire
- // invocation of the test program when used outside of the context of a
- // test case. Only the last value for a given key is remembered. These
- // are public static so they can be called from utility functions that are
- // not members of the test fixture. Calls to RecordProperty made during
- // lifespan of the test (from the moment its constructor starts to the
- // moment its destructor finishes) will be output in XML as attributes of
- // the <testcase> element. Properties recorded from fixture's
- // SetUpTestCase or TearDownTestCase are logged as attributes of the
- // corresponding <testsuite> element. Calls to RecordProperty made in the
- // global context (before or after invocation of RUN_ALL_TESTS and from
- // SetUp/TearDown method of Environment objects registered with Google
- // Test) will be output as attributes of the <testsuites> element.
- static void RecordProperty(const std::string& key, const std::string& value);
- static void RecordProperty(const std::string& key, int value);
-
- protected:
- // Creates a Test object.
- Test();
-
- // Sets up the test fixture.
- virtual void SetUp();
-
- // Tears down the test fixture.
- virtual void TearDown();
-
- private:
- // Returns true iff the current test has the same fixture class as
- // the first test in the current test case.
- static bool HasSameFixtureClass();
-
- // Runs the test after the test fixture has been set up.
- //
- // A sub-class must implement this to define the test logic.
- //
- // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
- // Instead, use the TEST or TEST_F macro.
- virtual void TestBody() = 0;
-
- // Sets up, executes, and tears down the test.
- void Run();
-
- // Deletes self. We deliberately pick an unusual name for this
- // internal method to avoid clashing with names used in user TESTs.
- void DeleteSelf_() { delete this; }
-
- const internal::scoped_ptr< GTEST_FLAG_SAVER_ > gtest_flag_saver_;
-
- // Often a user misspells SetUp() as Setup() and spends a long time
- // wondering why it is never called by Google Test. The declaration of
- // the following method is solely for catching such an error at
- // compile time:
- //
- // - The return type is deliberately chosen to be not void, so it
- // will be a conflict if void Setup() is declared in the user's
- // test fixture.
- //
- // - This method is private, so it will be another compiler error
- // if the method is called from the user's test fixture.
- //
- // DO NOT OVERRIDE THIS FUNCTION.
- //
- // If you see an error about overriding the following function or
- // about it being private, you have mis-spelled SetUp() as Setup().
- struct Setup_should_be_spelled_SetUp {};
- virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
-
- // We disallow copying Tests.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
-};
-
-typedef internal::TimeInMillis TimeInMillis;
-
-// A copyable object representing a user specified test property which can be
-// output as a key/value string pair.
-//
-// Don't inherit from TestProperty as its destructor is not virtual.
-class TestProperty {
- public:
- // C'tor. TestProperty does NOT have a default constructor.
- // Always use this constructor (with parameters) to create a
- // TestProperty object.
- TestProperty(const std::string& a_key, const std::string& a_value) :
- key_(a_key), value_(a_value) {
- }
-
- // Gets the user supplied key.
- const char* key() const {
- return key_.c_str();
- }
-
- // Gets the user supplied value.
- const char* value() const {
- return value_.c_str();
- }
-
- // Sets a new value, overriding the one supplied in the constructor.
- void SetValue(const std::string& new_value) {
- value_ = new_value;
- }
-
- private:
- // The key supplied by the user.
- std::string key_;
- // The value supplied by the user.
- std::string value_;
-};
-
-// The result of a single Test. This includes a list of
-// TestPartResults, a list of TestProperties, a count of how many
-// death tests there are in the Test, and how much time it took to run
-// the Test.
-//
-// TestResult is not copyable.
-class GTEST_API_ TestResult {
- public:
- // Creates an empty TestResult.
- TestResult();
-
- // D'tor. Do not inherit from TestResult.
- ~TestResult();
-
- // Gets the number of all test parts. This is the sum of the number
- // of successful test parts and the number of failed test parts.
- int total_part_count() const;
-
- // Returns the number of the test properties.
- int test_property_count() const;
-
- // Returns true iff the test passed (i.e. no test part failed).
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the test failed.
- bool Failed() const;
-
- // Returns true iff the test fatally failed.
- bool HasFatalFailure() const;
-
- // Returns true iff the test has a non-fatal failure.
- bool HasNonfatalFailure() const;
-
- // Returns the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns the i-th test part result among all the results. i can range
- // from 0 to test_property_count() - 1. If i is not in that range, aborts
- // the program.
- const TestPartResult& GetTestPartResult(int i) const;
-
- // Returns the i-th test property. i can range from 0 to
- // test_property_count() - 1. If i is not in that range, aborts the
- // program.
- const TestProperty& GetTestProperty(int i) const;
-
- private:
- friend class TestInfo;
- friend class TestCase;
- friend class UnitTest;
- friend class internal::DefaultGlobalTestPartResultReporter;
- friend class internal::ExecDeathTest;
- friend class internal::TestResultAccessor;
- friend class internal::UnitTestImpl;
- friend class internal::WindowsDeathTest;
-
- // Gets the vector of TestPartResults.
- const std::vector<TestPartResult>& test_part_results() const {
- return test_part_results_;
- }
-
- // Gets the vector of TestProperties.
- const std::vector<TestProperty>& test_properties() const {
- return test_properties_;
- }
-
- // Sets the elapsed time.
- void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
-
- // Adds a test property to the list. The property is validated and may add
- // a non-fatal failure if invalid (e.g., if it conflicts with reserved
- // key names). If a property is already recorded for the same key, the
- // value will be updated, rather than storing multiple values for the same
- // key. xml_element specifies the element for which the property is being
- // recorded and is used for validation.
- void RecordProperty(const std::string& xml_element,
- const TestProperty& test_property);
-
- // Adds a failure if the key is a reserved attribute of Google Test
- // testcase tags. Returns true if the property is valid.
- // TODO(russr): Validate attribute names are legal and human readable.
- static bool ValidateTestProperty(const std::string& xml_element,
- const TestProperty& test_property);
-
- // Adds a test part result to the list.
- void AddTestPartResult(const TestPartResult& test_part_result);
-
- // Returns the death test count.
- int death_test_count() const { return death_test_count_; }
-
- // Increments the death test count, returning the new count.
- int increment_death_test_count() { return ++death_test_count_; }
-
- // Clears the test part results.
- void ClearTestPartResults();
-
- // Clears the object.
- void Clear();
-
- // Protects mutable state of the property vector and of owned
- // properties, whose values may be updated.
- internal::Mutex test_properites_mutex_;
-
- // The vector of TestPartResults
- std::vector<TestPartResult> test_part_results_;
- // The vector of TestProperties
- std::vector<TestProperty> test_properties_;
- // Running count of death tests.
- int death_test_count_;
- // The elapsed time, in milliseconds.
- TimeInMillis elapsed_time_;
-
- // We disallow copying TestResult.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
-}; // class TestResult
-
-// A TestInfo object stores the following information about a test:
-//
-// Test case name
-// Test name
-// Whether the test should be run
-// A function pointer that creates the test object when invoked
-// Test result
-//
-// The constructor of TestInfo registers itself with the UnitTest
-// singleton such that the RUN_ALL_TESTS() macro knows which tests to
-// run.
-class GTEST_API_ TestInfo {
- public:
- // Destructs a TestInfo object. This function is not virtual, so
- // don't inherit from TestInfo.
- ~TestInfo();
-
- // Returns the test case name.
- const char* test_case_name() const { return test_case_name_.c_str(); }
-
- // Returns the test name.
- const char* name() const { return name_.c_str(); }
-
- // Returns the name of the parameter type, or NULL if this is not a typed
- // or a type-parameterized test.
- const char* type_param() const {
- if (type_param_.get() != NULL)
- return type_param_->c_str();
- return NULL;
- }
-
- // Returns the text representation of the value parameter, or NULL if this
- // is not a value-parameterized test.
- const char* value_param() const {
- if (value_param_.get() != NULL)
- return value_param_->c_str();
- return NULL;
- }
-
- // Returns the file name where this test is defined.
- const char* file() const { return location_.file.c_str(); }
-
- // Returns the line where this test is defined.
- int line() const { return location_.line; }
-
- // Returns true if this test should run, that is if the test is not
- // disabled (or it is disabled but the also_run_disabled_tests flag has
- // been specified) and its full name matches the user-specified filter.
- //
- // Google Test allows the user to filter the tests by their full names.
- // The full name of a test Bar in test case Foo is defined as
- // "Foo.Bar". Only the tests that match the filter will run.
- //
- // A filter is a colon-separated list of glob (not regex) patterns,
- // optionally followed by a '-' and a colon-separated list of
- // negative patterns (tests to exclude). A test is run if it
- // matches one of the positive patterns and does not match any of
- // the negative patterns.
- //
- // For example, *A*:Foo.* is a filter that matches any string that
- // contains the character 'A' or starts with "Foo.".
- bool should_run() const { return should_run_; }
-
- // Returns true iff this test will appear in the XML report.
- bool is_reportable() const {
- // For now, the XML report includes all tests matching the filter.
- // In the future, we may trim tests that are excluded because of
- // sharding.
- return matches_filter_;
- }
-
- // Returns the result of the test.
- const TestResult* result() const { return &result_; }
-
- private:
-#if GTEST_HAS_DEATH_TEST
- friend class internal::DefaultDeathTestFactory;
-#endif // GTEST_HAS_DEATH_TEST
- friend class Test;
- friend class TestCase;
- friend class internal::UnitTestImpl;
- friend class internal::StreamingListenerTest;
- friend TestInfo* internal::MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- internal::CodeLocation code_location,
- internal::TypeId fixture_class_id,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc,
- internal::TestFactoryBase* factory);
-
- // Constructs a TestInfo object. The newly constructed instance assumes
- // ownership of the factory object.
- TestInfo(const std::string& test_case_name,
- const std::string& name,
- const char* a_type_param, // NULL if not a type-parameterized test
- const char* a_value_param, // NULL if not a value-parameterized test
- internal::CodeLocation a_code_location,
- internal::TypeId fixture_class_id,
- internal::TestFactoryBase* factory);
-
- // Increments the number of death tests encountered in this test so
- // far.
- int increment_death_test_count() {
- return result_.increment_death_test_count();
- }
-
- // Creates the test object, runs it, records its result, and then
- // deletes it.
- void Run();
-
- static void ClearTestResult(TestInfo* test_info) {
- test_info->result_.Clear();
- }
-
- // These fields are immutable properties of the test.
- const std::string test_case_name_; // Test case name
- const std::string name_; // Test name
- // Name of the parameter type, or NULL if this is not a typed or a
- // type-parameterized test.
- const internal::scoped_ptr<const ::std::string> type_param_;
- // Text representation of the value parameter, or NULL if this is not a
- // value-parameterized test.
- const internal::scoped_ptr<const ::std::string> value_param_;
- internal::CodeLocation location_;
- const internal::TypeId fixture_class_id_; // ID of the test fixture class
- bool should_run_; // True iff this test should run
- bool is_disabled_; // True iff this test is disabled
- bool matches_filter_; // True if this test matches the
- // user-specified filter.
- internal::TestFactoryBase* const factory_; // The factory that creates
- // the test object
-
- // This field is mutable and needs to be reset before running the
- // test for the second time.
- TestResult result_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
-};
-
-// A test case, which consists of a vector of TestInfos.
-//
-// TestCase is not copyable.
-class GTEST_API_ TestCase {
- public:
- // Creates a TestCase with the given name.
- //
- // TestCase does NOT have a default constructor. Always use this
- // constructor to create a TestCase object.
- //
- // Arguments:
- //
- // name: name of the test case
- // a_type_param: the name of the test's type parameter, or NULL if
- // this is not a type-parameterized test.
- // set_up_tc: pointer to the function that sets up the test case
- // tear_down_tc: pointer to the function that tears down the test case
- TestCase(const char* name, const char* a_type_param,
- Test::SetUpTestCaseFunc set_up_tc,
- Test::TearDownTestCaseFunc tear_down_tc);
-
- // Destructor of TestCase.
- virtual ~TestCase();
-
- // Gets the name of the TestCase.
- const char* name() const { return name_.c_str(); }
-
- // Returns the name of the parameter type, or NULL if this is not a
- // type-parameterized test case.
- const char* type_param() const {
- if (type_param_.get() != NULL)
- return type_param_->c_str();
- return NULL;
- }
-
- // Returns true if any test in this test case should run.
- bool should_run() const { return should_run_; }
-
- // Gets the number of successful tests in this test case.
- int successful_test_count() const;
-
- // Gets the number of failed tests in this test case.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests in this test case.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Get the number of tests in this test case that should run.
- int test_to_run_count() const;
-
- // Gets the number of all tests in this test case.
- int total_test_count() const;
-
- // Returns true iff the test case passed.
- bool Passed() const { return !Failed(); }
-
- // Returns true iff the test case failed.
- bool Failed() const { return failed_test_count() > 0; }
-
- // Returns the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const { return elapsed_time_; }
-
- // Returns the i-th test among all the tests. i can range from 0 to
- // total_test_count() - 1. If i is not in that range, returns NULL.
- const TestInfo* GetTestInfo(int i) const;
-
- // Returns the TestResult that holds test properties recorded during
- // execution of SetUpTestCase and TearDownTestCase.
- const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
-
- private:
- friend class Test;
- friend class internal::UnitTestImpl;
-
- // Gets the (mutable) vector of TestInfos in this TestCase.
- std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
-
- // Gets the (immutable) vector of TestInfos in this TestCase.
- const std::vector<TestInfo*>& test_info_list() const {
- return test_info_list_;
- }
-
- // Returns the i-th test among all the tests. i can range from 0 to
- // total_test_count() - 1. If i is not in that range, returns NULL.
- TestInfo* GetMutableTestInfo(int i);
-
- // Sets the should_run member.
- void set_should_run(bool should) { should_run_ = should; }
-
- // Adds a TestInfo to this test case. Will delete the TestInfo upon
- // destruction of the TestCase object.
- void AddTestInfo(TestInfo * test_info);
-
- // Clears the results of all tests in this test case.
- void ClearResult();
-
- // Clears the results of all tests in the given test case.
- static void ClearTestCaseResult(TestCase* test_case) {
- test_case->ClearResult();
- }
-
- // Runs every test in this TestCase.
- void Run();
-
- // Runs SetUpTestCase() for this TestCase. This wrapper is needed
- // for catching exceptions thrown from SetUpTestCase().
- void RunSetUpTestCase() { (*set_up_tc_)(); }
-
- // Runs TearDownTestCase() for this TestCase. This wrapper is
- // needed for catching exceptions thrown from TearDownTestCase().
- void RunTearDownTestCase() { (*tear_down_tc_)(); }
-
- // Returns true iff test passed.
- static bool TestPassed(const TestInfo* test_info) {
- return test_info->should_run() && test_info->result()->Passed();
- }
-
- // Returns true iff test failed.
- static bool TestFailed(const TestInfo* test_info) {
- return test_info->should_run() && test_info->result()->Failed();
- }
-
- // Returns true iff the test is disabled and will be reported in the XML
- // report.
- static bool TestReportableDisabled(const TestInfo* test_info) {
- return test_info->is_reportable() && test_info->is_disabled_;
- }
-
- // Returns true iff test is disabled.
- static bool TestDisabled(const TestInfo* test_info) {
- return test_info->is_disabled_;
- }
-
- // Returns true iff this test will appear in the XML report.
- static bool TestReportable(const TestInfo* test_info) {
- return test_info->is_reportable();
- }
-
- // Returns true if the given test should run.
- static bool ShouldRunTest(const TestInfo* test_info) {
- return test_info->should_run();
- }
-
- // Shuffles the tests in this test case.
- void ShuffleTests(internal::Random* random);
-
- // Restores the test order to before the first shuffle.
- void UnshuffleTests();
-
- // Name of the test case.
- std::string name_;
- // Name of the parameter type, or NULL if this is not a typed or a
- // type-parameterized test.
- const internal::scoped_ptr<const ::std::string> type_param_;
- // The vector of TestInfos in their original order. It owns the
- // elements in the vector.
- std::vector<TestInfo*> test_info_list_;
- // Provides a level of indirection for the test list to allow easy
- // shuffling and restoring the test order. The i-th element in this
- // vector is the index of the i-th test in the shuffled test list.
- std::vector<int> test_indices_;
- // Pointer to the function that sets up the test case.
- Test::SetUpTestCaseFunc set_up_tc_;
- // Pointer to the function that tears down the test case.
- Test::TearDownTestCaseFunc tear_down_tc_;
- // True iff any test in this test case should run.
- bool should_run_;
- // Elapsed time, in milliseconds.
- TimeInMillis elapsed_time_;
- // Holds test properties recorded during execution of SetUpTestCase and
- // TearDownTestCase.
- TestResult ad_hoc_test_result_;
-
- // We disallow copying TestCases.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
-};
-
-// An Environment object is capable of setting up and tearing down an
-// environment. You should subclass this to define your own
-// environment(s).
-//
-// An Environment object does the set-up and tear-down in virtual
-// methods SetUp() and TearDown() instead of the constructor and the
-// destructor, as:
-//
-// 1. You cannot safely throw from a destructor. This is a problem
-// as in some cases Google Test is used where exceptions are enabled, and
-// we may want to implement ASSERT_* using exceptions where they are
-// available.
-// 2. You cannot use ASSERT_* directly in a constructor or
-// destructor.
-class Environment {
- public:
- // The d'tor is virtual as we need to subclass Environment.
- virtual ~Environment() {}
-
- // Override this to define how to set up the environment.
- virtual void SetUp() {}
-
- // Override this to define how to tear down the environment.
- virtual void TearDown() {}
- private:
- // If you see an error about overriding the following function or
- // about it being private, you have mis-spelled SetUp() as Setup().
- struct Setup_should_be_spelled_SetUp {};
- virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
-};
-
-// The interface for tracing execution of tests. The methods are organized in
-// the order the corresponding events are fired.
-class TestEventListener {
- public:
- virtual ~TestEventListener() {}
-
- // Fired before any test activity starts.
- virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
-
- // Fired before each iteration of tests starts. There may be more than
- // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
- // index, starting from 0.
- virtual void OnTestIterationStart(const UnitTest& unit_test,
- int iteration) = 0;
-
- // Fired before environment set-up for each iteration of tests starts.
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
-
- // Fired after environment set-up for each iteration of tests ends.
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
-
- // Fired before the test case starts.
- virtual void OnTestCaseStart(const TestCase& test_case) = 0;
-
- // Fired before the test starts.
- virtual void OnTestStart(const TestInfo& test_info) = 0;
-
- // Fired after a failed assertion or a SUCCEED() invocation.
- virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
-
- // Fired after the test ends.
- virtual void OnTestEnd(const TestInfo& test_info) = 0;
-
- // Fired after the test case ends.
- virtual void OnTestCaseEnd(const TestCase& test_case) = 0;
-
- // Fired before environment tear-down for each iteration of tests starts.
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
-
- // Fired after environment tear-down for each iteration of tests ends.
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
-
- // Fired after each iteration of tests finishes.
- virtual void OnTestIterationEnd(const UnitTest& unit_test,
- int iteration) = 0;
-
- // Fired after all test activities have ended.
- virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
-};
-
-// The convenience class for users who need to override just one or two
-// methods and are not concerned that a possible change to a signature of
-// the methods they override will not be caught during the build. For
-// comments about each method please see the definition of TestEventListener
-// above.
-class EmptyTestEventListener : public TestEventListener {
- public:
- virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
- int /*iteration*/) {}
- virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {}
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
- virtual void OnTestStart(const TestInfo& /*test_info*/) {}
- virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {}
- virtual void OnTestEnd(const TestInfo& /*test_info*/) {}
- virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
- virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {}
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
- virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
- int /*iteration*/) {}
- virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
-};
-
-// TestEventListeners lets users add listeners to track events in Google Test.
-class GTEST_API_ TestEventListeners {
- public:
- TestEventListeners();
- ~TestEventListeners();
-
- // Appends an event listener to the end of the list. Google Test assumes
- // the ownership of the listener (i.e. it will delete the listener when
- // the test program finishes).
- void Append(TestEventListener* listener);
-
- // Removes the given event listener from the list and returns it. It then
- // becomes the caller's responsibility to delete the listener. Returns
- // NULL if the listener is not found in the list.
- TestEventListener* Release(TestEventListener* listener);
-
- // Returns the standard listener responsible for the default console
- // output. Can be removed from the listeners list to shut down default
- // console output. Note that removing this object from the listener list
- // with Release transfers its ownership to the caller and makes this
- // function return NULL the next time.
- TestEventListener* default_result_printer() const {
- return default_result_printer_;
- }
-
- // Returns the standard listener responsible for the default XML output
- // controlled by the --gtest_output=xml flag. Can be removed from the
- // listeners list by users who want to shut down the default XML output
- // controlled by this flag and substitute it with custom one. Note that
- // removing this object from the listener list with Release transfers its
- // ownership to the caller and makes this function return NULL the next
- // time.
- TestEventListener* default_xml_generator() const {
- return default_xml_generator_;
- }
-
- private:
- friend class TestCase;
- friend class TestInfo;
- friend class internal::DefaultGlobalTestPartResultReporter;
- friend class internal::NoExecDeathTest;
- friend class internal::TestEventListenersAccessor;
- friend class internal::UnitTestImpl;
-
- // Returns repeater that broadcasts the TestEventListener events to all
- // subscribers.
- TestEventListener* repeater();
-
- // Sets the default_result_printer attribute to the provided listener.
- // The listener is also added to the listener list and previous
- // default_result_printer is removed from it and deleted. The listener can
- // also be NULL in which case it will not be added to the list. Does
- // nothing if the previous and the current listener objects are the same.
- void SetDefaultResultPrinter(TestEventListener* listener);
-
- // Sets the default_xml_generator attribute to the provided listener. The
- // listener is also added to the listener list and previous
- // default_xml_generator is removed from it and deleted. The listener can
- // also be NULL in which case it will not be added to the list. Does
- // nothing if the previous and the current listener objects are the same.
- void SetDefaultXmlGenerator(TestEventListener* listener);
-
- // Controls whether events will be forwarded by the repeater to the
- // listeners in the list.
- bool EventForwardingEnabled() const;
- void SuppressEventForwarding();
-
- // The actual list of listeners.
- internal::TestEventRepeater* repeater_;
- // Listener responsible for the standard result output.
- TestEventListener* default_result_printer_;
- // Listener responsible for the creation of the XML output file.
- TestEventListener* default_xml_generator_;
-
- // We disallow copying TestEventListeners.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
-};
-
-// A UnitTest consists of a vector of TestCases.
-//
-// This is a singleton class. The only instance of UnitTest is
-// created when UnitTest::GetInstance() is first called. This
-// instance is never deleted.
-//
-// UnitTest is not copyable.
-//
-// This class is thread-safe as long as the methods are called
-// according to their specification.
-class GTEST_API_ UnitTest {
- public:
- // Gets the singleton UnitTest object. The first time this method
- // is called, a UnitTest object is constructed and returned.
- // Consecutive calls will return the same object.
- static UnitTest* GetInstance();
-
- // Runs all tests in this UnitTest object and prints the result.
- // Returns 0 if successful, or 1 otherwise.
- //
- // This method can only be called from the main thread.
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- int Run() GTEST_MUST_USE_RESULT_;
-
- // Returns the working directory when the first TEST() or TEST_F()
- // was executed. The UnitTest object owns the string.
- const char* original_working_dir() const;
-
- // Returns the TestCase object for the test that's currently running,
- // or NULL if no test is running.
- const TestCase* current_test_case() const
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Returns the TestInfo object for the test that's currently running,
- // or NULL if no test is running.
- const TestInfo* current_test_info() const
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Returns the random seed used at the start of the current test run.
- int random_seed() const;
-
-#if GTEST_HAS_PARAM_TEST
- // Returns the ParameterizedTestCaseRegistry object used to keep track of
- // value-parameterized tests and instantiate and register them.
- //
- // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
- internal::ParameterizedTestCaseRegistry& parameterized_test_registry()
- GTEST_LOCK_EXCLUDED_(mutex_);
-#endif // GTEST_HAS_PARAM_TEST
-
- // Gets the number of successful test cases.
- int successful_test_case_count() const;
-
- // Gets the number of failed test cases.
- int failed_test_case_count() const;
-
- // Gets the number of all test cases.
- int total_test_case_count() const;
-
- // Gets the number of all test cases that contain at least one test
- // that should run.
- int test_case_to_run_count() const;
-
- // Gets the number of successful tests.
- int successful_test_count() const;
-
- // Gets the number of failed tests.
- int failed_test_count() const;
-
- // Gets the number of disabled tests that will be reported in the XML report.
- int reportable_disabled_test_count() const;
-
- // Gets the number of disabled tests.
- int disabled_test_count() const;
-
- // Gets the number of tests to be printed in the XML report.
- int reportable_test_count() const;
-
- // Gets the number of all tests.
- int total_test_count() const;
-
- // Gets the number of tests that should run.
- int test_to_run_count() const;
-
- // Gets the time of the test program start, in ms from the start of the
- // UNIX epoch.
- TimeInMillis start_timestamp() const;
-
- // Gets the elapsed time, in milliseconds.
- TimeInMillis elapsed_time() const;
-
- // Returns true iff the unit test passed (i.e. all test cases passed).
- bool Passed() const;
-
- // Returns true iff the unit test failed (i.e. some test case failed
- // or something outside of all tests failed).
- bool Failed() const;
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- const TestCase* GetTestCase(int i) const;
-
- // Returns the TestResult containing information on test failures and
- // properties logged outside of individual test cases.
- const TestResult& ad_hoc_test_result() const;
-
- // Returns the list of event listeners that can be used to track events
- // inside Google Test.
- TestEventListeners& listeners();
-
- private:
- // Registers and returns a global test environment. When a test
- // program is run, all global test environments will be set-up in
- // the order they were registered. After all tests in the program
- // have finished, all global test environments will be torn-down in
- // the *reverse* order they were registered.
- //
- // The UnitTest object takes ownership of the given environment.
- //
- // This method can only be called from the main thread.
- Environment* AddEnvironment(Environment* env);
-
- // Adds a TestPartResult to the current TestResult object. All
- // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
- // eventually call this to report their results. The user code
- // should use the assertion macros instead of calling this directly.
- void AddTestPartResult(TestPartResult::Type result_type,
- const char* file_name,
- int line_number,
- const std::string& message,
- const std::string& os_stack_trace)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Adds a TestProperty to the current TestResult object when invoked from
- // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
- // from SetUpTestCase or TearDownTestCase, or to the global property set
- // when invoked elsewhere. If the result already contains a property with
- // the same key, the value will be updated.
- void RecordProperty(const std::string& key, const std::string& value);
-
- // Gets the i-th test case among all the test cases. i can range from 0 to
- // total_test_case_count() - 1. If i is not in that range, returns NULL.
- TestCase* GetMutableTestCase(int i);
-
- // Accessors for the implementation object.
- internal::UnitTestImpl* impl() { return impl_; }
- const internal::UnitTestImpl* impl() const { return impl_; }
-
- // These classes and functions are friends as they need to access private
- // members of UnitTest.
- friend class Test;
- friend class internal::AssertHelper;
- friend class internal::ScopedTrace;
- friend class internal::StreamingListenerTest;
- friend class internal::UnitTestRecordPropertyTestHelper;
- friend Environment* AddGlobalTestEnvironment(Environment* env);
- friend internal::UnitTestImpl* internal::GetUnitTestImpl();
- friend void internal::ReportFailureInUnknownLocation(
- TestPartResult::Type result_type,
- const std::string& message);
-
- // Creates an empty UnitTest.
- UnitTest();
-
- // D'tor
- virtual ~UnitTest();
-
- // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
- // Google Test trace stack.
- void PushGTestTrace(const internal::TraceInfo& trace)
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Pops a trace from the per-thread Google Test trace stack.
- void PopGTestTrace()
- GTEST_LOCK_EXCLUDED_(mutex_);
-
- // Protects mutable state in *impl_. This is mutable as some const
- // methods need to lock it too.
- mutable internal::Mutex mutex_;
-
- // Opaque implementation object. This field is never changed once
- // the object is constructed. We don't mark it as const here, as
- // doing so will cause a warning in the constructor of UnitTest.
- // Mutable state in *impl_ is protected by mutex_.
- internal::UnitTestImpl* impl_;
-
- // We disallow copying UnitTest.
- GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
-};
-
-// A convenient wrapper for adding an environment for the test
-// program.
-//
-// You should call this before RUN_ALL_TESTS() is called, probably in
-// main(). If you use gtest_main, you need to call this before main()
-// starts for it to take effect. For example, you can define a global
-// variable like this:
-//
-// testing::Environment* const foo_env =
-// testing::AddGlobalTestEnvironment(new FooEnvironment);
-//
-// However, we strongly recommend you to write your own main() and
-// call AddGlobalTestEnvironment() there, as relying on initialization
-// of global variables makes the code harder to read and may cause
-// problems when you register multiple environments from different
-// translation units and the environments have dependencies among them
-// (remember that the compiler doesn't guarantee the order in which
-// global variables from different translation units are initialized).
-inline Environment* AddGlobalTestEnvironment(Environment* env) {
- return UnitTest::GetInstance()->AddEnvironment(env);
-}
-
-// Initializes Google Test. This must be called before calling
-// RUN_ALL_TESTS(). In particular, it parses a command line for the
-// flags that Google Test recognizes. Whenever a Google Test flag is
-// seen, it is removed from argv, and *argc is decremented.
-//
-// No value is returned. Instead, the Google Test flag variables are
-// updated.
-//
-// Calling the function for the second time has no user-visible effect.
-GTEST_API_ void InitGoogleTest(int* argc, char** argv);
-
-// This overloaded version can be used in Windows programs compiled in
-// UNICODE mode.
-GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
-
-namespace internal {
-
-// Separate the error generating code from the code path to reduce the stack
-// frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers
-// when calling EXPECT_* in a tight loop.
-template <typename T1, typename T2>
-AssertionResult CmpHelperEQFailure(const char* lhs_expression,
- const char* rhs_expression,
- const T1& lhs, const T2& rhs) {
- return EqFailure(lhs_expression,
- rhs_expression,
- FormatForComparisonFailureMessage(lhs, rhs),
- FormatForComparisonFailureMessage(rhs, lhs),
- false);
-}
-
-// The helper function for {ASSERT|EXPECT}_EQ.
-template <typename T1, typename T2>
-AssertionResult CmpHelperEQ(const char* lhs_expression,
- const char* rhs_expression,
- const T1& lhs,
- const T2& rhs) {
-GTEST_DISABLE_MSC_WARNINGS_PUSH_(4389 /* signed/unsigned mismatch */)
- if (lhs == rhs) {
- return AssertionSuccess();
- }
-GTEST_DISABLE_MSC_WARNINGS_POP_()
-
- return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
-}
-
-// With this overloaded version, we allow anonymous enums to be used
-// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
-// can be implicitly cast to BiggestInt.
-GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression,
- const char* rhs_expression,
- BiggestInt lhs,
- BiggestInt rhs);
-
-// The helper class for {ASSERT|EXPECT}_EQ. The template argument
-// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
-// is a null pointer literal. The following default implementation is
-// for lhs_is_null_literal being false.
-template <bool lhs_is_null_literal>
-class EqHelper {
- public:
- // This templatized version is for the general case.
- template <typename T1, typename T2>
- static AssertionResult Compare(const char* lhs_expression,
- const char* rhs_expression,
- const T1& lhs,
- const T2& rhs) {
- return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
- }
-
- // With this overloaded version, we allow anonymous enums to be used
- // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
- // enums can be implicitly cast to BiggestInt.
- //
- // Even though its body looks the same as the above version, we
- // cannot merge the two, as it will make anonymous enums unhappy.
- static AssertionResult Compare(const char* lhs_expression,
- const char* rhs_expression,
- BiggestInt lhs,
- BiggestInt rhs) {
- return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
- }
-};
-
-// This specialization is used when the first argument to ASSERT_EQ()
-// is a null pointer literal, like NULL, false, or 0.
-template <>
-class EqHelper<true> {
- public:
- // We define two overloaded versions of Compare(). The first
- // version will be picked when the second argument to ASSERT_EQ() is
- // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
- // EXPECT_EQ(false, a_bool).
- template <typename T1, typename T2>
- static AssertionResult Compare(
- const char* lhs_expression,
- const char* rhs_expression,
- const T1& lhs,
- const T2& rhs,
- // The following line prevents this overload from being considered if T2
- // is not a pointer type. We need this because ASSERT_EQ(NULL, my_ptr)
- // expands to Compare("", "", NULL, my_ptr), which requires a conversion
- // to match the Secret* in the other overload, which would otherwise make
- // this template match better.
- typename EnableIf<!is_pointer<T2>::value>::type* = 0) {
- return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
- }
-
- // This version will be picked when the second argument to ASSERT_EQ() is a
- // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
- template <typename T>
- static AssertionResult Compare(
- const char* lhs_expression,
- const char* rhs_expression,
- // We used to have a second template parameter instead of Secret*. That
- // template parameter would deduce to 'long', making this a better match
- // than the first overload even without the first overload's EnableIf.
- // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
- // non-pointer argument" (even a deduced integral argument), so the old
- // implementation caused warnings in user code.
- Secret* /* lhs (NULL) */,
- T* rhs) {
- // We already know that 'lhs' is a null pointer.
- return CmpHelperEQ(lhs_expression, rhs_expression,
- static_cast<T*>(NULL), rhs);
- }
-};
-
-// Separate the error generating code from the code path to reduce the stack
-// frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers
-// when calling EXPECT_OP in a tight loop.
-template <typename T1, typename T2>
-AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
- const T1& val1, const T2& val2,
- const char* op) {
- return AssertionFailure()
- << "Expected: (" << expr1 << ") " << op << " (" << expr2
- << "), actual: " << FormatForComparisonFailureMessage(val1, val2)
- << " vs " << FormatForComparisonFailureMessage(val2, val1);
-}
-
-// A macro for implementing the helper functions needed to implement
-// ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
-// of similar code.
-//
-// For each templatized helper function, we also define an overloaded
-// version for BiggestInt in order to reduce code bloat and allow
-// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
-// with gcc 4.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-
-#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
-template <typename T1, typename T2>\
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
- const T1& val1, const T2& val2) {\
- if (val1 op val2) {\
- return AssertionSuccess();\
- } else {\
- return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
- }\
-}\
-GTEST_API_ AssertionResult CmpHelper##op_name(\
- const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-
-// Implements the helper function for {ASSERT|EXPECT}_NE
-GTEST_IMPL_CMP_HELPER_(NE, !=);
-// Implements the helper function for {ASSERT|EXPECT}_LE
-GTEST_IMPL_CMP_HELPER_(LE, <=);
-// Implements the helper function for {ASSERT|EXPECT}_LT
-GTEST_IMPL_CMP_HELPER_(LT, <);
-// Implements the helper function for {ASSERT|EXPECT}_GE
-GTEST_IMPL_CMP_HELPER_(GE, >=);
-// Implements the helper function for {ASSERT|EXPECT}_GT
-GTEST_IMPL_CMP_HELPER_(GT, >);
-
-#undef GTEST_IMPL_CMP_HELPER_
-
-// The helper function for {ASSERT|EXPECT}_STREQ.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
-
-// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
-
-// The helper function for {ASSERT|EXPECT}_STRNE.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
-
-// The helper function for {ASSERT|EXPECT}_STRCASENE.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
- const char* s2_expression,
- const char* s1,
- const char* s2);
-
-
-// Helper function for *_STREQ on wide strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
- const char* s2_expression,
- const wchar_t* s1,
- const wchar_t* s2);
-
-// Helper function for *_STRNE on wide strings.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
- const char* s2_expression,
- const wchar_t* s1,
- const wchar_t* s2);
-
-} // namespace internal
-
-// IsSubstring() and IsNotSubstring() are intended to be used as the
-// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
-// themselves. They check whether needle is a substring of haystack
-// (NULL is considered a substring of itself only), and return an
-// appropriate error message when they fail.
-//
-// The {needle,haystack}_expr arguments are the stringified
-// expressions that generated the two real arguments.
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack);
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const char* needle, const char* haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const wchar_t* needle, const wchar_t* haystack);
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::string& needle, const ::std::string& haystack);
-
-#if GTEST_HAS_STD_WSTRING
-GTEST_API_ AssertionResult IsSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack);
-GTEST_API_ AssertionResult IsNotSubstring(
- const char* needle_expr, const char* haystack_expr,
- const ::std::wstring& needle, const ::std::wstring& haystack);
-#endif // GTEST_HAS_STD_WSTRING
-
-namespace internal {
-
-// Helper template function for comparing floating-points.
-//
-// Template parameter:
-//
-// RawType: the raw floating-point type (either float or double)
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-template <typename RawType>
-AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
- const char* rhs_expression,
- RawType lhs_value,
- RawType rhs_value) {
- const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
-
- if (lhs.AlmostEquals(rhs)) {
- return AssertionSuccess();
- }
-
- ::std::stringstream lhs_ss;
- lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << lhs_value;
-
- ::std::stringstream rhs_ss;
- rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << rhs_value;
-
- return EqFailure(lhs_expression,
- rhs_expression,
- StringStreamToString(&lhs_ss),
- StringStreamToString(&rhs_ss),
- false);
-}
-
-// Helper function for implementing ASSERT_NEAR.
-//
-// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
- const char* expr2,
- const char* abs_error_expr,
- double val1,
- double val2,
- double abs_error);
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-// A class that enables one to stream messages to assertion macros
-class GTEST_API_ AssertHelper {
- public:
- // Constructor.
- AssertHelper(TestPartResult::Type type,
- const char* file,
- int line,
- const char* message);
- ~AssertHelper();
-
- // Message assignment is a semantic trick to enable assertion
- // streaming; see the GTEST_MESSAGE_ macro below.
- void operator=(const Message& message) const;
-
- private:
- // We put our data in a struct so that the size of the AssertHelper class can
- // be as small as possible. This is important because gcc is incapable of
- // re-using stack space even for temporary variables, so every EXPECT_EQ
- // reserves stack space for another AssertHelper.
- struct AssertHelperData {
- AssertHelperData(TestPartResult::Type t,
- const char* srcfile,
- int line_num,
- const char* msg)
- : type(t), file(srcfile), line(line_num), message(msg) { }
-
- TestPartResult::Type const type;
- const char* const file;
- int const line;
- std::string const message;
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
- };
-
- AssertHelperData* const data_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
-};
-
-} // namespace internal
-
-#if GTEST_HAS_PARAM_TEST
-// The pure interface class that all value-parameterized tests inherit from.
-// A value-parameterized class must inherit from both ::testing::Test and
-// ::testing::WithParamInterface. In most cases that just means inheriting
-// from ::testing::TestWithParam, but more complicated test hierarchies
-// may need to inherit from Test and WithParamInterface at different levels.
-//
-// This interface has support for accessing the test parameter value via
-// the GetParam() method.
-//
-// Use it with one of the parameter generator defining functions, like Range(),
-// Values(), ValuesIn(), Bool(), and Combine().
-//
-// class FooTest : public ::testing::TestWithParam<int> {
-// protected:
-// FooTest() {
-// // Can use GetParam() here.
-// }
-// virtual ~FooTest() {
-// // Can use GetParam() here.
-// }
-// virtual void SetUp() {
-// // Can use GetParam() here.
-// }
-// virtual void TearDown {
-// // Can use GetParam() here.
-// }
-// };
-// TEST_P(FooTest, DoesBar) {
-// // Can use GetParam() method here.
-// Foo foo;
-// ASSERT_TRUE(foo.DoesBar(GetParam()));
-// }
-// INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
-
-template <typename T>
-class WithParamInterface {
- public:
- typedef T ParamType;
- virtual ~WithParamInterface() {}
-
- // The current parameter value. Is also available in the test fixture's
- // constructor. This member function is non-static, even though it only
- // references static data, to reduce the opportunity for incorrect uses
- // like writing 'WithParamInterface<bool>::GetParam()' for a test that
- // uses a fixture whose parameter type is int.
- const ParamType& GetParam() const {
- GTEST_CHECK_(parameter_ != NULL)
- << "GetParam() can only be called inside a value-parameterized test "
- << "-- did you intend to write TEST_P instead of TEST_F?";
- return *parameter_;
- }
-
- private:
- // Sets parameter value. The caller is responsible for making sure the value
- // remains alive and unchanged throughout the current test.
- static void SetParam(const ParamType* parameter) {
- parameter_ = parameter;
- }
-
- // Static value used for accessing parameter during a test lifetime.
- static const ParamType* parameter_;
-
- // TestClass must be a subclass of WithParamInterface<T> and Test.
- template <class TestClass> friend class internal::ParameterizedTestFactory;
-};
-
-template <typename T>
-const T* WithParamInterface<T>::parameter_ = NULL;
-
-// Most value-parameterized classes can ignore the existence of
-// WithParamInterface, and can just inherit from ::testing::TestWithParam.
-
-template <typename T>
-class TestWithParam : public Test, public WithParamInterface<T> {
-};
-
-#endif // GTEST_HAS_PARAM_TEST
-
-// Macros for indicating success/failure in test code.
-
-// ADD_FAILURE unconditionally adds a failure to the current test.
-// SUCCEED generates a success - it doesn't automatically make the
-// current test successful, as a test is only successful when it has
-// no failure.
-//
-// EXPECT_* verifies that a certain condition is satisfied. If not,
-// it behaves like ADD_FAILURE. In particular:
-//
-// EXPECT_TRUE verifies that a Boolean condition is true.
-// EXPECT_FALSE verifies that a Boolean condition is false.
-//
-// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
-// that they will also abort the current function on failure. People
-// usually want the fail-fast behavior of FAIL and ASSERT_*, but those
-// writing data-driven tests often find themselves using ADD_FAILURE
-// and EXPECT_* more.
-
-// Generates a nonfatal failure with a generic message.
-#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
-
-// Generates a nonfatal failure at the given source file location with
-// a generic message.
-#define ADD_FAILURE_AT(file, line) \
- GTEST_MESSAGE_AT_(file, line, "Failed", \
- ::testing::TestPartResult::kNonFatalFailure)
-
-// Generates a fatal failure with a generic message.
-#define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
-
-// Define this macro to 1 to omit the definition of FAIL(), which is a
-// generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_FAIL
-# define FAIL() GTEST_FAIL()
-#endif
-
-// Generates a success with a generic message.
-#define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
-
-// Define this macro to 1 to omit the definition of SUCCEED(), which
-// is a generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_SUCCEED
-# define SUCCEED() GTEST_SUCCEED()
-#endif
-
-// Macros for testing exceptions.
-//
-// * {ASSERT|EXPECT}_THROW(statement, expected_exception):
-// Tests that the statement throws the expected exception.
-// * {ASSERT|EXPECT}_NO_THROW(statement):
-// Tests that the statement doesn't throw any exception.
-// * {ASSERT|EXPECT}_ANY_THROW(statement):
-// Tests that the statement throws an exception.
-
-#define EXPECT_THROW(statement, expected_exception) \
- GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_NO_THROW(statement) \
- GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_ANY_THROW(statement) \
- GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_THROW(statement, expected_exception) \
- GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
-#define ASSERT_NO_THROW(statement) \
- GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
-#define ASSERT_ANY_THROW(statement) \
- GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
-
-// Boolean assertions. Condition can be either a Boolean expression or an
-// AssertionResult. For more information on how to use AssertionResult with
-// these macros see comments on that class.
-#define EXPECT_TRUE(condition) \
- GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \
- GTEST_NONFATAL_FAILURE_)
-#define EXPECT_FALSE(condition) \
- GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
- GTEST_NONFATAL_FAILURE_)
-#define ASSERT_TRUE(condition) \
- GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \
- GTEST_FATAL_FAILURE_)
-#define ASSERT_FALSE(condition) \
- GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
- GTEST_FATAL_FAILURE_)
-
-// Includes the auto-generated header that implements a family of
-// generic predicate assertion macros.
-#include "gtest/gtest_pred_impl.h"
-
-// Macros for testing equalities and inequalities.
-//
-// * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2
-// * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
-// * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
-// * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
-// * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
-// * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
-//
-// When they are not, Google Test prints both the tested expressions and
-// their actual values. The values must be compatible built-in types,
-// or you will get a compiler error. By "compatible" we mean that the
-// values can be compared by the respective operator.
-//
-// Note:
-//
-// 1. It is possible to make a user-defined type work with
-// {ASSERT|EXPECT}_??(), but that requires overloading the
-// comparison operators and is thus discouraged by the Google C++
-// Usage Guide. Therefore, you are advised to use the
-// {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
-// equal.
-//
-// 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
-// pointers (in particular, C strings). Therefore, if you use it
-// with two C strings, you are testing how their locations in memory
-// are related, not how their content is related. To compare two C
-// strings by content, use {ASSERT|EXPECT}_STR*().
-//
-// 3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to
-// {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you
-// what the actual value is when it fails, and similarly for the
-// other comparisons.
-//
-// 4. Do not depend on the order in which {ASSERT|EXPECT}_??()
-// evaluate their arguments, which is undefined.
-//
-// 5. These macros evaluate their arguments exactly once.
-//
-// Examples:
-//
-// EXPECT_NE(5, Foo());
-// EXPECT_EQ(NULL, a_pointer);
-// ASSERT_LT(i, array_size);
-// ASSERT_GT(records.size(), 0) << "There is no record left.";
-
-#define EXPECT_EQ(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal:: \
- EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
- val1, val2)
-#define EXPECT_NE(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
-#define EXPECT_LE(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
-#define EXPECT_LT(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
-#define EXPECT_GE(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
-#define EXPECT_GT(val1, val2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-
-#define GTEST_ASSERT_EQ(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal:: \
- EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
- val1, val2)
-#define GTEST_ASSERT_NE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
-#define GTEST_ASSERT_LE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
-#define GTEST_ASSERT_LT(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
-#define GTEST_ASSERT_GE(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
-#define GTEST_ASSERT_GT(val1, val2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-
-// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
-// ASSERT_XY(), which clashes with some users' own code.
-
-#if !GTEST_DONT_DEFINE_ASSERT_EQ
-# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_NE
-# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_LE
-# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_LT
-# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_GE
-# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
-#endif
-
-#if !GTEST_DONT_DEFINE_ASSERT_GT
-# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
-#endif
-
-// C-string Comparisons. All tests treat NULL and any non-NULL string
-// as different. Two NULLs are equal.
-//
-// * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2
-// * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2
-// * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
-// * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
-//
-// For wide or narrow string objects, you can use the
-// {ASSERT|EXPECT}_??() macros.
-//
-// Don't depend on the order in which the arguments are evaluated,
-// which is undefined.
-//
-// These macros evaluate their arguments exactly once.
-
-#define EXPECT_STREQ(s1, s2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
-#define EXPECT_STRNE(s1, s2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define EXPECT_STRCASEEQ(s1, s2) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
-#define EXPECT_STRCASENE(s1, s2)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-
-#define ASSERT_STREQ(s1, s2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
-#define ASSERT_STRNE(s1, s2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define ASSERT_STRCASEEQ(s1, s2) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
-#define ASSERT_STRCASENE(s1, s2)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-
-// Macros for comparing floating-point numbers.
-//
-// * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2):
-// Tests that two float values are almost equal.
-// * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2):
-// Tests that two double values are almost equal.
-// * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
-// Tests that v1 and v2 are within the given distance to each other.
-//
-// Google Test uses ULP-based comparison to automatically pick a default
-// error bound that is appropriate for the operands. See the
-// FloatingPoint template class in gtest-internal.h if you are
-// interested in the implementation details.
-
-#define EXPECT_FLOAT_EQ(val1, val2)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
- val1, val2)
-
-#define EXPECT_DOUBLE_EQ(val1, val2)\
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
- val1, val2)
-
-#define ASSERT_FLOAT_EQ(val1, val2)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
- val1, val2)
-
-#define ASSERT_DOUBLE_EQ(val1, val2)\
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
- val1, val2)
-
-#define EXPECT_NEAR(val1, val2, abs_error)\
- EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
- val1, val2, abs_error)
-
-#define ASSERT_NEAR(val1, val2, abs_error)\
- ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
- val1, val2, abs_error)
-
-// These predicate format functions work on floating-point values, and
-// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
-//
-// EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
-
-// Asserts that val1 is less than, or almost equal to, val2. Fails
-// otherwise. In particular, it fails if either val1 or val2 is NaN.
-GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
- float val1, float val2);
-GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
- double val1, double val2);
-
-
-#if GTEST_OS_WINDOWS
-
-// Macros that test for HRESULT failure and success, these are only useful
-// on Windows, and rely on Windows SDK macros and APIs to compile.
-//
-// * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
-//
-// When expr unexpectedly fails or succeeds, Google Test prints the
-// expected result and the actual result with both a human-readable
-// string representation of the error, if available, as well as the
-// hex result code.
-# define EXPECT_HRESULT_SUCCEEDED(expr) \
- EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
-
-# define ASSERT_HRESULT_SUCCEEDED(expr) \
- ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
-
-# define EXPECT_HRESULT_FAILED(expr) \
- EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
-
-# define ASSERT_HRESULT_FAILED(expr) \
- ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
-
-#endif // GTEST_OS_WINDOWS
-
-// Macros that execute statement and check that it doesn't generate new fatal
-// failures in the current thread.
-//
-// * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
-//
-// Examples:
-//
-// EXPECT_NO_FATAL_FAILURE(Process());
-// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
-//
-#define ASSERT_NO_FATAL_FAILURE(statement) \
- GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
-#define EXPECT_NO_FATAL_FAILURE(statement) \
- GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
-
-// Causes a trace (including the source file path, the current line
-// number, and the given message) to be included in every test failure
-// message generated by code in the current scope. The effect is
-// undone when the control leaves the current scope.
-//
-// The message argument can be anything streamable to std::ostream.
-//
-// In the implementation, we include the current line number as part
-// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
-// to appear in the same block - as long as they are on different
-// lines.
-#define SCOPED_TRACE(message) \
- ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
- __FILE__, __LINE__, ::testing::Message() << (message))
-
-// Compile-time assertion for type equality.
-// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
-// the same type. The value it returns is not interesting.
-//
-// Instead of making StaticAssertTypeEq a class template, we make it a
-// function template that invokes a helper class template. This
-// prevents a user from misusing StaticAssertTypeEq<T1, T2> by
-// defining objects of that type.
-//
-// CAVEAT:
-//
-// When used inside a method of a class template,
-// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
-// instantiated. For example, given:
-//
-// template <typename T> class Foo {
-// public:
-// void Bar() { testing::StaticAssertTypeEq<int, T>(); }
-// };
-//
-// the code:
-//
-// void Test1() { Foo<bool> foo; }
-//
-// will NOT generate a compiler error, as Foo<bool>::Bar() is never
-// actually instantiated. Instead, you need:
-//
-// void Test2() { Foo<bool> foo; foo.Bar(); }
-//
-// to cause a compiler error.
-template <typename T1, typename T2>
-bool StaticAssertTypeEq() {
- (void)internal::StaticAssertTypeEqHelper<T1, T2>();
- return true;
-}
-
-// Defines a test.
-//
-// The first parameter is the name of the test case, and the second
-// parameter is the name of the test within the test case.
-//
-// The convention is to end the test case name with "Test". For
-// example, a test case for the Foo class can be named FooTest.
-//
-// Test code should appear between braces after an invocation of
-// this macro. Example:
-//
-// TEST(FooTest, InitializesCorrectly) {
-// Foo foo;
-// EXPECT_TRUE(foo.StatusIsOK());
-// }
-
-// Note that we call GetTestTypeId() instead of GetTypeId<
-// ::testing::Test>() here to get the type ID of testing::Test. This
-// is to work around a suspected linker bug when using Google Test as
-// a framework on Mac OS X. The bug causes GetTypeId<
-// ::testing::Test>() to return different values depending on whether
-// the call is from the Google Test framework itself or from user test
-// code. GetTestTypeId() is guaranteed to always return the same
-// value, as it always calls GetTypeId<>() from the Google Test
-// framework.
-#define GTEST_TEST(test_case_name, test_name)\
- GTEST_TEST_(test_case_name, test_name, \
- ::testing::Test, ::testing::internal::GetTestTypeId())
-
-// Define this macro to 1 to omit the definition of TEST(), which
-// is a generic name and clashes with some other libraries.
-#if !GTEST_DONT_DEFINE_TEST
-# define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
-#endif
-
-// Defines a test that uses a test fixture.
-//
-// The first parameter is the name of the test fixture class, which
-// also doubles as the test case name. The second parameter is the
-// name of the test within the test case.
-//
-// A test fixture class must be declared earlier. The user should put
-// the test code between braces after using this macro. Example:
-//
-// class FooTest : public testing::Test {
-// protected:
-// virtual void SetUp() { b_.AddElement(3); }
-//
-// Foo a_;
-// Foo b_;
-// };
-//
-// TEST_F(FooTest, InitializesCorrectly) {
-// EXPECT_TRUE(a_.StatusIsOK());
-// }
-//
-// TEST_F(FooTest, ReturnsElementCountCorrectly) {
-// EXPECT_EQ(0, a_.size());
-// EXPECT_EQ(1, b_.size());
-// }
-
-#define TEST_F(test_fixture, test_name)\
- GTEST_TEST_(test_fixture, test_name, test_fixture, \
- ::testing::internal::GetTypeId<test_fixture>())
-
-// Returns a path to temporary directory.
-// Tries to determine an appropriate directory for the platform.
-GTEST_API_ std::string TempDir();
-
-} // namespace testing
-
-// Use this function in main() to run all tests. It returns 0 if all
-// tests are successful, or 1 otherwise.
-//
-// RUN_ALL_TESTS() should be invoked after the command line has been
-// parsed by InitGoogleTest().
-//
-// This function was formerly a macro; thus, it is in the global
-// namespace and has an all-caps name.
-int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
-
-inline int RUN_ALL_TESTS() {
- return ::testing::UnitTest::GetInstance()->Run();
-}
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_H_
diff --git a/src/lib/install/include/gtest/gtest_pred_impl.h b/src/lib/install/include/gtest/gtest_pred_impl.h
deleted file mode 100755
index 30ae712..0000000
--- a/src/lib/install/include/gtest/gtest_pred_impl.h
+++ /dev/null
@@ -1,358 +0,0 @@
-// Copyright 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.
-
-// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
-// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
-//
-// Implements a family of generic predicate assertion macros.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
-
-// Makes sure this header is not included before gtest.h.
-#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-# error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
-#endif // GTEST_INCLUDE_GTEST_GTEST_H_
-
-// This header implements a family of generic predicate assertion
-// macros:
-//
-// ASSERT_PRED_FORMAT1(pred_format, v1)
-// ASSERT_PRED_FORMAT2(pred_format, v1, v2)
-// ...
-//
-// where pred_format is a function or functor that takes n (in the
-// case of ASSERT_PRED_FORMATn) values and their source expression
-// text, and returns a testing::AssertionResult. See the definition
-// of ASSERT_EQ in gtest.h for an example.
-//
-// If you don't care about formatting, you can use the more
-// restrictive version:
-//
-// ASSERT_PRED1(pred, v1)
-// ASSERT_PRED2(pred, v1, v2)
-// ...
-//
-// where pred is an n-ary function or functor that returns bool,
-// and the values v1, v2, ..., must support the << operator for
-// streaming to std::ostream.
-//
-// We also define the EXPECT_* variations.
-//
-// For now we only support predicates whose arity is at most 5.
-// Please email googletestframework@googlegroups.com if you need
-// support for higher arities.
-
-// GTEST_ASSERT_ is the basic statement to which all of the assertions
-// in this file reduce. Don't use this in your code.
-
-#define GTEST_ASSERT_(expression, on_failure) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (const ::testing::AssertionResult gtest_ar = (expression)) \
- ; \
- else \
- on_failure(gtest_ar.failure_message())
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use
-// this in your code.
-template <typename Pred,
- typename T1>
-AssertionResult AssertPred1Helper(const char* pred_text,
- const char* e1,
- Pred pred,
- const T1& v1) {
- if (pred(v1)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, v1), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
-// this in your code.
-#define GTEST_PRED1_(pred, v1, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
- #v1, \
- pred, \
- v1), on_failure)
-
-// Unary predicate assertion macros.
-#define EXPECT_PRED_FORMAT1(pred_format, v1) \
- GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED1(pred, v1) \
- GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT1(pred_format, v1) \
- GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED1(pred, v1) \
- GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2>
-AssertionResult AssertPred2Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- Pred pred,
- const T1& v1,
- const T2& v2) {
- if (pred(v1, v2)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
-// this in your code.
-#define GTEST_PRED2_(pred, v1, v2, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
- #v1, \
- #v2, \
- pred, \
- v1, \
- v2), on_failure)
-
-// Binary predicate assertion macros.
-#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
- GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED2(pred, v1, v2) \
- GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
- GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED2(pred, v1, v2) \
- GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3>
-AssertionResult AssertPred3Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3) {
- if (pred(v1, v2, v3)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
-// this in your code.
-#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- pred, \
- v1, \
- v2, \
- v3), on_failure)
-
-// Ternary predicate assertion macros.
-#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
- GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED3(pred, v1, v2, v3) \
- GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
- GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED3(pred, v1, v2, v3) \
- GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3,
- typename T4>
-AssertionResult AssertPred4Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- const char* e4,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3,
- const T4& v4) {
- if (pred(v1, v2, v3, v4)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ", "
- << e4 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3
- << "\n" << e4 << " evaluates to " << v4;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
-// this in your code.
-#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- #v4, \
- pred, \
- v1, \
- v2, \
- v3, \
- v4), on_failure)
-
-// 4-ary predicate assertion macros.
-#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
- GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
- GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
- GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
- GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
-
-
-
-// Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use
-// this in your code.
-template <typename Pred,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5>
-AssertionResult AssertPred5Helper(const char* pred_text,
- const char* e1,
- const char* e2,
- const char* e3,
- const char* e4,
- const char* e5,
- Pred pred,
- const T1& v1,
- const T2& v2,
- const T3& v3,
- const T4& v4,
- const T5& v5) {
- if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
-
- return AssertionFailure() << pred_text << "("
- << e1 << ", "
- << e2 << ", "
- << e3 << ", "
- << e4 << ", "
- << e5 << ") evaluates to false, where"
- << "\n" << e1 << " evaluates to " << v1
- << "\n" << e2 << " evaluates to " << v2
- << "\n" << e3 << " evaluates to " << v3
- << "\n" << e4 << " evaluates to " << v4
- << "\n" << e5 << " evaluates to " << v5;
-}
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
-// Don't use this in your code.
-#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
- GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
- on_failure)
-
-// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
-// this in your code.
-#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
- GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
- #v1, \
- #v2, \
- #v3, \
- #v4, \
- #v5, \
- pred, \
- v1, \
- v2, \
- v3, \
- v4, \
- v5), on_failure)
-
-// 5-ary predicate assertion macros.
-#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
- GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
-#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
- GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
-#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
- GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
-#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
- GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
-
-
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
diff --git a/src/lib/install/include/gtest/gtest_prod.h b/src/lib/install/include/gtest/gtest_prod.h
deleted file mode 100755
index da80ddc..0000000
--- a/src/lib/install/include/gtest/gtest_prod.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 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.
-//
-// Author: wan@google.com (Zhanyong Wan)
-//
-// Google C++ Testing Framework definitions useful in production code.
-
-#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
-
-// When you need to test the private or protected members of a class,
-// use the FRIEND_TEST macro to declare your tests as friends of the
-// class. For example:
-//
-// class MyClass {
-// private:
-// void MyMethod();
-// FRIEND_TEST(MyClassTest, MyMethod);
-// };
-//
-// class MyClassTest : public testing::Test {
-// // ...
-// };
-//
-// TEST_F(MyClassTest, MyMethod) {
-// // Can call MyClass::MyMethod() here.
-// }
-
-#define FRIEND_TEST(test_case_name, test_name)\
-friend class test_case_name##_##test_name##_Test
-
-#endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
diff --git a/src/lib/install/include/gtest/internal/custom/gtest-port.h b/src/lib/install/include/gtest/internal/custom/gtest-port.h
deleted file mode 100755
index c85f5d5..0000000
--- a/src/lib/install/include/gtest/internal/custom/gtest-port.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015, 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.
-//
-// Injection point for custom user configurations.
-// The following macros can be defined:
-//
-// Flag related macros:
-// GTEST_FLAG(flag_name)
-// GTEST_USE_OWN_FLAGFILE_FLAG_ - Define to 0 when the system provides its
-// own flagfile flag parsing.
-// GTEST_DECLARE_bool_(name)
-// GTEST_DECLARE_int32_(name)
-// GTEST_DECLARE_string_(name)
-// GTEST_DEFINE_bool_(name, default_val, doc)
-// GTEST_DEFINE_int32_(name, default_val, doc)
-// GTEST_DEFINE_string_(name, default_val, doc)
-//
-// Test filtering:
-// GTEST_TEST_FILTER_ENV_VAR_ - The name of an environment variable that
-// will be used if --GTEST_FLAG(test_filter)
-// is not provided.
-//
-// Logging:
-// GTEST_LOG_(severity)
-// GTEST_CHECK_(condition)
-// Functions LogToStderr() and FlushInfoLog() have to be provided too.
-//
-// Threading:
-// GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided.
-// GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are
-// already provided.
-// Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and
-// GTEST_DEFINE_STATIC_MUTEX_(mutex)
-//
-// GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
-// GTEST_LOCK_EXCLUDED_(locks)
-//
-// Exporting API symbols:
-// GTEST_API_ - Specifier for exported symbols.
-//
-// ** Custom implementation starts here **
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
diff --git a/src/lib/install/include/gtest/internal/custom/gtest-printers.h b/src/lib/install/include/gtest/internal/custom/gtest-printers.h
deleted file mode 100755
index 60c1ea0..0000000
--- a/src/lib/install/include/gtest/internal/custom/gtest-printers.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2015, 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.
-//
-// This file provides an injection point for custom printers in a local
-// installation of gTest.
-// It will be included from gtest-printers.h and the overrides in this file
-// will be visible to everyone.
-// See documentation at gtest/gtest-printers.h for details on how to define a
-// custom printer.
-//
-// ** Custom implementation starts here **
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
diff --git a/src/lib/install/include/gtest/internal/custom/gtest.h b/src/lib/install/include/gtest/internal/custom/gtest.h
deleted file mode 100755
index a7a1c0b..0000000
--- a/src/lib/install/include/gtest/internal/custom/gtest.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2015, 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.
-//
-// Injection point for custom user configurations.
-// The following macros can be defined:
-//
-// GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of
-// OsStackTraceGetterInterface.
-//
-// GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir().
-// See testing::TempDir for semantics and
-// signature.
-//
-// ** Custom implementation starts here **
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-death-test-internal.h b/src/lib/install/include/gtest/internal/gtest-death-test-internal.h
deleted file mode 100755
index 2b3a78f..0000000
--- a/src/lib/install/include/gtest/internal/gtest-death-test-internal.h
+++ /dev/null
@@ -1,319 +0,0 @@
-// Copyright 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.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines internal utilities needed for implementing
-// death tests. They are subject to change without notice.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
-
-#include "gtest/internal/gtest-internal.h"
-
-#include <stdio.h>
-
-namespace testing {
-namespace internal {
-
-GTEST_DECLARE_string_(internal_run_death_test);
-
-// Names of the flags (needed for parsing Google Test flags).
-const char kDeathTestStyleFlag[] = "death_test_style";
-const char kDeathTestUseFork[] = "death_test_use_fork";
-const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
-
-#if GTEST_HAS_DEATH_TEST
-
-// DeathTest is a class that hides much of the complexity of the
-// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
-// returns a concrete class that depends on the prevailing death test
-// style, as defined by the --gtest_death_test_style and/or
-// --gtest_internal_run_death_test flags.
-
-// In describing the results of death tests, these terms are used with
-// the corresponding definitions:
-//
-// exit status: The integer exit information in the format specified
-// by wait(2)
-// exit code: The integer code passed to exit(3), _exit(2), or
-// returned from main()
-class GTEST_API_ DeathTest {
- public:
- // Create returns false if there was an error determining the
- // appropriate action to take for the current death test; for example,
- // if the gtest_death_test_style flag is set to an invalid value.
- // The LastMessage method will return a more detailed message in that
- // case. Otherwise, the DeathTest pointer pointed to by the "test"
- // argument is set. If the death test should be skipped, the pointer
- // is set to NULL; otherwise, it is set to the address of a new concrete
- // DeathTest object that controls the execution of the current test.
- static bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test);
- DeathTest();
- virtual ~DeathTest() { }
-
- // A helper class that aborts a death test when it's deleted.
- class ReturnSentinel {
- public:
- explicit ReturnSentinel(DeathTest* test) : test_(test) { }
- ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
- private:
- DeathTest* const test_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
- } GTEST_ATTRIBUTE_UNUSED_;
-
- // An enumeration of possible roles that may be taken when a death
- // test is encountered. EXECUTE means that the death test logic should
- // be executed immediately. OVERSEE means that the program should prepare
- // the appropriate environment for a child process to execute the death
- // test, then wait for it to complete.
- enum TestRole { OVERSEE_TEST, EXECUTE_TEST };
-
- // An enumeration of the three reasons that a test might be aborted.
- enum AbortReason {
- TEST_ENCOUNTERED_RETURN_STATEMENT,
- TEST_THREW_EXCEPTION,
- TEST_DID_NOT_DIE
- };
-
- // Assumes one of the above roles.
- virtual TestRole AssumeRole() = 0;
-
- // Waits for the death test to finish and returns its status.
- virtual int Wait() = 0;
-
- // Returns true if the death test passed; that is, the test process
- // exited during the test, its exit status matches a user-supplied
- // predicate, and its stderr output matches a user-supplied regular
- // expression.
- // The user-supplied predicate may be a macro expression rather
- // than a function pointer or functor, or else Wait and Passed could
- // be combined.
- virtual bool Passed(bool exit_status_ok) = 0;
-
- // Signals that the death test did not die as expected.
- virtual void Abort(AbortReason reason) = 0;
-
- // Returns a human-readable outcome message regarding the outcome of
- // the last death test.
- static const char* LastMessage();
-
- static void set_last_death_test_message(const std::string& message);
-
- private:
- // A string containing a description of the outcome of the last death test.
- static std::string last_death_test_message_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
-};
-
-// Factory interface for death tests. May be mocked out for testing.
-class DeathTestFactory {
- public:
- virtual ~DeathTestFactory() { }
- virtual bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test) = 0;
-};
-
-// A concrete DeathTestFactory implementation for normal use.
-class DefaultDeathTestFactory : public DeathTestFactory {
- public:
- virtual bool Create(const char* statement, const RE* regex,
- const char* file, int line, DeathTest** test);
-};
-
-// Returns true if exit_status describes a process that was terminated
-// by a signal, or exited normally with a nonzero exit code.
-GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
-
-// Traps C++ exceptions escaping statement and reports them as test
-// failures. Note that trapping SEH exceptions is not implemented here.
-# if GTEST_HAS_EXCEPTIONS
-# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } catch (const ::std::exception& gtest_exception) { \
- fprintf(\
- stderr, \
- "\n%s: Caught std::exception-derived exception escaping the " \
- "death test statement. Exception message: %s\n", \
- ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
- gtest_exception.what()); \
- fflush(stderr); \
- death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
- } catch (...) { \
- death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
- }
-
-# else
-# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
-
-# endif
-
-// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
-// ASSERT_EXIT*, and EXPECT_EXIT*.
-# define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- const ::testing::internal::RE& gtest_regex = (regex); \
- ::testing::internal::DeathTest* gtest_dt; \
- if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \
- __FILE__, __LINE__, &gtest_dt)) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
- } \
- if (gtest_dt != NULL) { \
- ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
- gtest_dt_ptr(gtest_dt); \
- switch (gtest_dt->AssumeRole()) { \
- case ::testing::internal::DeathTest::OVERSEE_TEST: \
- if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
- } \
- break; \
- case ::testing::internal::DeathTest::EXECUTE_TEST: { \
- ::testing::internal::DeathTest::ReturnSentinel \
- gtest_sentinel(gtest_dt); \
- GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \
- gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \
- break; \
- } \
- default: \
- break; \
- } \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
- fail(::testing::internal::DeathTest::LastMessage())
-// The symbol "fail" here expands to something into which a message
-// can be streamed.
-
-// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in
-// NDEBUG mode. In this case we need the statements to be executed, the regex is
-// ignored, and the macro must accept a streamed message even though the message
-// is never printed.
-# define GTEST_EXECUTE_STATEMENT_(statement, regex) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } else \
- ::testing::Message()
-
-// A class representing the parsed contents of the
-// --gtest_internal_run_death_test flag, as it existed when
-// RUN_ALL_TESTS was called.
-class InternalRunDeathTestFlag {
- public:
- InternalRunDeathTestFlag(const std::string& a_file,
- int a_line,
- int an_index,
- int a_write_fd)
- : file_(a_file), line_(a_line), index_(an_index),
- write_fd_(a_write_fd) {}
-
- ~InternalRunDeathTestFlag() {
- if (write_fd_ >= 0)
- posix::Close(write_fd_);
- }
-
- const std::string& file() const { return file_; }
- int line() const { return line_; }
- int index() const { return index_; }
- int write_fd() const { return write_fd_; }
-
- private:
- std::string file_;
- int line_;
- int index_;
- int write_fd_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag);
-};
-
-// Returns a newly created InternalRunDeathTestFlag object with fields
-// initialized from the GTEST_FLAG(internal_run_death_test) flag if
-// the flag is specified; otherwise returns NULL.
-InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
-
-#else // GTEST_HAS_DEATH_TEST
-
-// This macro is used for implementing macros such as
-// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
-// death tests are not supported. Those macros must compile on such systems
-// iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on
-// systems that support death tests. This allows one to write such a macro
-// on a system that does not support death tests and be sure that it will
-// compile on a death-test supporting system.
-//
-// Parameters:
-// statement - A statement that a macro such as EXPECT_DEATH would test
-// for program termination. This macro has to make sure this
-// statement is compiled but not executed, to ensure that
-// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
-// parameter iff EXPECT_DEATH compiles with it.
-// regex - A regex that a macro such as EXPECT_DEATH would use to test
-// the output of statement. This parameter has to be
-// compiled but not evaluated by this macro, to ensure that
-// this macro only accepts expressions that a macro such as
-// EXPECT_DEATH would accept.
-// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
-// and a return statement for ASSERT_DEATH_IF_SUPPORTED.
-// This ensures that ASSERT_DEATH_IF_SUPPORTED will not
-// compile inside functions where ASSERT_DEATH doesn't
-// compile.
-//
-// The branch that has an always false condition is used to ensure that
-// statement and regex are compiled (and thus syntactically correct) but
-// never executed. The unreachable code macro protects the terminator
-// statement from generating an 'unreachable code' warning in case
-// statement unconditionally returns or throws. The Message constructor at
-// the end allows the syntax of streaming additional messages into the
-// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
-# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- GTEST_LOG_(WARNING) \
- << "Death tests are not supported on this platform.\n" \
- << "Statement '" #statement "' cannot be verified."; \
- } else if (::testing::internal::AlwaysFalse()) { \
- ::testing::internal::RE::PartialMatch(".*", (regex)); \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- terminator; \
- } else \
- ::testing::Message()
-
-#endif // GTEST_HAS_DEATH_TEST
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-filepath.h b/src/lib/install/include/gtest/internal/gtest-filepath.h
deleted file mode 100755
index 7a13b4b..0000000
--- a/src/lib/install/include/gtest/internal/gtest-filepath.h
+++ /dev/null
@@ -1,206 +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.
-//
-// Author: keith.ray@gmail.com (Keith Ray)
-//
-// Google Test filepath utilities
-//
-// This header file declares classes and functions used internally by
-// Google Test. They are subject to change without notice.
-//
-// This file is #included in <gtest/internal/gtest-internal.h>.
-// Do not include this header file separately!
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
-
-#include "gtest/internal/gtest-string.h"
-
-namespace testing {
-namespace internal {
-
-// FilePath - a class for file and directory pathname manipulation which
-// handles platform-specific conventions (like the pathname separator).
-// Used for helper functions for naming files in a directory for xml output.
-// Except for Set methods, all methods are const or static, which provides an
-// "immutable value object" -- useful for peace of mind.
-// A FilePath with a value ending in a path separator ("like/this/") represents
-// a directory, otherwise it is assumed to represent a file. In either case,
-// it may or may not represent an actual file or directory in the file system.
-// Names are NOT checked for syntax correctness -- no checking for illegal
-// characters, malformed paths, etc.
-
-class GTEST_API_ FilePath {
- public:
- FilePath() : pathname_("") { }
- FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
-
- explicit FilePath(const std::string& pathname) : pathname_(pathname) {
- Normalize();
- }
-
- FilePath& operator=(const FilePath& rhs) {
- Set(rhs);
- return *this;
- }
-
- void Set(const FilePath& rhs) {
- pathname_ = rhs.pathname_;
- }
-
- const std::string& string() const { return pathname_; }
- const char* c_str() const { return pathname_.c_str(); }
-
- // Returns the current working directory, or "" if unsuccessful.
- static FilePath GetCurrentDir();
-
- // Given directory = "dir", base_name = "test", number = 0,
- // extension = "xml", returns "dir/test.xml". If number is greater
- // than zero (e.g., 12), returns "dir/test_12.xml".
- // On Windows platform, uses \ as the separator rather than /.
- static FilePath MakeFileName(const FilePath& directory,
- const FilePath& base_name,
- int number,
- const char* extension);
-
- // Given directory = "dir", relative_path = "test.xml",
- // returns "dir/test.xml".
- // On Windows, uses \ as the separator rather than /.
- static FilePath ConcatPaths(const FilePath& directory,
- const FilePath& relative_path);
-
- // Returns a pathname for a file that does not currently exist. The pathname
- // will be directory/base_name.extension or
- // directory/base_name_<number>.extension if directory/base_name.extension
- // already exists. The number will be incremented until a pathname is found
- // that does not already exist.
- // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
- // There could be a race condition if two or more processes are calling this
- // function at the same time -- they could both pick the same filename.
- static FilePath GenerateUniqueFileName(const FilePath& directory,
- const FilePath& base_name,
- const char* extension);
-
- // Returns true iff the path is "".
- bool IsEmpty() const { return pathname_.empty(); }
-
- // If input name has a trailing separator character, removes it and returns
- // the name, otherwise return the name string unmodified.
- // On Windows platform, uses \ as the separator, other platforms use /.
- FilePath RemoveTrailingPathSeparator() const;
-
- // Returns a copy of the FilePath with the directory part removed.
- // Example: FilePath("path/to/file").RemoveDirectoryName() returns
- // FilePath("file"). If there is no directory part ("just_a_file"), it returns
- // the FilePath unmodified. If there is no file part ("just_a_dir/") it
- // returns an empty FilePath ("").
- // On Windows platform, '\' is the path separator, otherwise it is '/'.
- FilePath RemoveDirectoryName() const;
-
- // RemoveFileName returns the directory path with the filename removed.
- // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
- // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
- // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
- // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
- // On Windows platform, '\' is the path separator, otherwise it is '/'.
- FilePath RemoveFileName() const;
-
- // Returns a copy of the FilePath with the case-insensitive extension removed.
- // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
- // FilePath("dir/file"). If a case-insensitive extension is not
- // found, returns a copy of the original FilePath.
- FilePath RemoveExtension(const char* extension) const;
-
- // Creates directories so that path exists. Returns true if successful or if
- // the directories already exist; returns false if unable to create
- // directories for any reason. Will also return false if the FilePath does
- // not represent a directory (that is, it doesn't end with a path separator).
- bool CreateDirectoriesRecursively() const;
-
- // Create the directory so that path exists. Returns true if successful or
- // if the directory already exists; returns false if unable to create the
- // directory for any reason, including if the parent directory does not
- // exist. Not named "CreateDirectory" because that's a macro on Windows.
- bool CreateFolder() const;
-
- // Returns true if FilePath describes something in the file-system,
- // either a file, directory, or whatever, and that something exists.
- bool FileOrDirectoryExists() const;
-
- // Returns true if pathname describes a directory in the file-system
- // that exists.
- bool DirectoryExists() const;
-
- // Returns true if FilePath ends with a path separator, which indicates that
- // it is intended to represent a directory. Returns false otherwise.
- // This does NOT check that a directory (or file) actually exists.
- bool IsDirectory() const;
-
- // Returns true if pathname describes a root directory. (Windows has one
- // root directory per disk drive.)
- bool IsRootDirectory() const;
-
- // Returns true if pathname describes an absolute path.
- bool IsAbsolutePath() const;
-
- private:
- // Replaces multiple consecutive separators with a single separator.
- // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
- // redundancies that might be in a pathname involving "." or "..".
- //
- // A pathname with multiple consecutive separators may occur either through
- // user error or as a result of some scripts or APIs that generate a pathname
- // with a trailing separator. On other platforms the same API or script
- // may NOT generate a pathname with a trailing "/". Then elsewhere that
- // pathname may have another "/" and pathname components added to it,
- // without checking for the separator already being there.
- // The script language and operating system may allow paths like "foo//bar"
- // but some of the functions in FilePath will not handle that correctly. In
- // particular, RemoveTrailingPathSeparator() only removes one separator, and
- // it is called in CreateDirectoriesRecursively() assuming that it will change
- // a pathname from directory syntax (trailing separator) to filename syntax.
- //
- // On Windows this method also replaces the alternate path separator '/' with
- // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
- // "bar\\foo".
-
- void Normalize();
-
- // Returns a pointer to the last occurence of a valid path separator in
- // the FilePath. On Windows, for example, both '/' and '\' are valid path
- // separators. Returns NULL if no path separator was found.
- const char* FindLastPathSeparator() const;
-
- std::string pathname_;
-}; // class FilePath
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-internal.h b/src/lib/install/include/gtest/internal/gtest-internal.h
deleted file mode 100755
index 72d83f0..0000000
--- a/src/lib/install/include/gtest/internal/gtest-internal.h
+++ /dev/null
@@ -1,1239 +0,0 @@
-// Copyright 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.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file declares functions and macros used internally by
-// Google Test. They are subject to change without notice.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_OS_LINUX
-# include <stdlib.h>
-# include <sys/types.h>
-# include <sys/wait.h>
-# include <unistd.h>
-#endif // GTEST_OS_LINUX
-
-#if GTEST_HAS_EXCEPTIONS
-# include <stdexcept>
-#endif
-
-#include <ctype.h>
-#include <float.h>
-#include <string.h>
-#include <iomanip>
-#include <limits>
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "gtest/gtest-message.h"
-#include "gtest/internal/gtest-string.h"
-#include "gtest/internal/gtest-filepath.h"
-#include "gtest/internal/gtest-type-util.h"
-
-// Due to C++ preprocessor weirdness, we need double indirection to
-// concatenate two tokens when one of them is __LINE__. Writing
-//
-// foo ## __LINE__
-//
-// will result in the token foo__LINE__, instead of foo followed by
-// the current line number. For more details, see
-// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
-#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
-#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
-
-class ProtocolMessage;
-namespace proto2 { class Message; }
-
-namespace testing {
-
-// Forward declarations.
-
-class AssertionResult; // Result of an assertion.
-class Message; // Represents a failure message.
-class Test; // Represents a test.
-class TestInfo; // Information about a test.
-class TestPartResult; // Result of a test part.
-class UnitTest; // A collection of test cases.
-
-template <typename T>
-::std::string PrintToString(const T& value);
-
-namespace internal {
-
-struct TraceInfo; // Information about a trace point.
-class ScopedTrace; // Implements scoped trace.
-class TestInfoImpl; // Opaque implementation of TestInfo
-class UnitTestImpl; // Opaque implementation of UnitTest
-
-// The text used in failure messages to indicate the start of the
-// stack trace.
-GTEST_API_ extern const char kStackTraceMarker[];
-
-// Two overloaded helpers for checking at compile time whether an
-// expression is a null pointer literal (i.e. NULL or any 0-valued
-// compile-time integral constant). Their return values have
-// different sizes, so we can use sizeof() to test which version is
-// picked by the compiler. These helpers have no implementations, as
-// we only need their signatures.
-//
-// Given IsNullLiteralHelper(x), the compiler will pick the first
-// version if x can be implicitly converted to Secret*, and pick the
-// second version otherwise. Since Secret is a secret and incomplete
-// type, the only expression a user can write that has type Secret* is
-// a null pointer literal. Therefore, we know that x is a null
-// pointer literal if and only if the first version is picked by the
-// compiler.
-char IsNullLiteralHelper(Secret* p);
-char (&IsNullLiteralHelper(...))[2]; // NOLINT
-
-// A compile-time bool constant that is true if and only if x is a
-// null pointer literal (i.e. NULL or any 0-valued compile-time
-// integral constant).
-#ifdef GTEST_ELLIPSIS_NEEDS_POD_
-// We lose support for NULL detection where the compiler doesn't like
-// passing non-POD classes through ellipsis (...).
-# define GTEST_IS_NULL_LITERAL_(x) false
-#else
-# define GTEST_IS_NULL_LITERAL_(x) \
- (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
-#endif // GTEST_ELLIPSIS_NEEDS_POD_
-
-// Appends the user-supplied message to the Google-Test-generated message.
-GTEST_API_ std::string AppendUserMessage(
- const std::string& gtest_msg, const Message& user_msg);
-
-#if GTEST_HAS_EXCEPTIONS
-
-// This exception is thrown by (and only by) a failed Google Test
-// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
-// are enabled). We derive it from std::runtime_error, which is for
-// errors presumably detectable only at run time. Since
-// std::runtime_error inherits from std::exception, many testing
-// frameworks know how to extract and print the message inside it.
-class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
- public:
- explicit GoogleTestFailureException(const TestPartResult& failure);
-};
-
-#endif // GTEST_HAS_EXCEPTIONS
-
-// A helper class for creating scoped traces in user programs.
-class GTEST_API_ ScopedTrace {
- public:
- // The c'tor pushes the given source file location and message onto
- // a trace stack maintained by Google Test.
- ScopedTrace(const char* file, int line, const Message& message);
-
- // The d'tor pops the info pushed by the c'tor.
- //
- // Note that the d'tor is not virtual in order to be efficient.
- // Don't inherit from ScopedTrace!
- ~ScopedTrace();
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
-} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
- // c'tor and d'tor. Therefore it doesn't
- // need to be used otherwise.
-
-namespace edit_distance {
-// Returns the optimal edits to go from 'left' to 'right'.
-// All edits cost the same, with replace having lower priority than
-// add/remove.
-// Simple implementation of the Wagner-Fischer algorithm.
-// See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
-enum EditType { kMatch, kAdd, kRemove, kReplace };
-GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
- const std::vector<size_t>& left, const std::vector<size_t>& right);
-
-// Same as above, but the input is represented as strings.
-GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
- const std::vector<std::string>& left,
- const std::vector<std::string>& right);
-
-// Create a diff of the input strings in Unified diff format.
-GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left,
- const std::vector<std::string>& right,
- size_t context = 2);
-
-} // namespace edit_distance
-
-// Calculate the diff between 'left' and 'right' and return it in unified diff
-// format.
-// If not null, stores in 'total_line_count' the total number of lines found
-// in left + right.
-GTEST_API_ std::string DiffStrings(const std::string& left,
- const std::string& right,
- size_t* total_line_count);
-
-// Constructs and returns the message for an equality assertion
-// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
-//
-// The first four parameters are the expressions used in the assertion
-// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
-// where foo is 5 and bar is 6, we have:
-//
-// expected_expression: "foo"
-// actual_expression: "bar"
-// expected_value: "5"
-// actual_value: "6"
-//
-// The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
-// be inserted into the message.
-GTEST_API_ AssertionResult EqFailure(const char* expected_expression,
- const char* actual_expression,
- const std::string& expected_value,
- const std::string& actual_value,
- bool ignoring_case);
-
-// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
-GTEST_API_ std::string GetBoolAssertionFailureMessage(
- const AssertionResult& assertion_result,
- const char* expression_text,
- const char* actual_predicate_value,
- const char* expected_predicate_value);
-
-// This template class represents an IEEE floating-point number
-// (either single-precision or double-precision, depending on the
-// template parameters).
-//
-// The purpose of this class is to do more sophisticated number
-// comparison. (Due to round-off error, etc, it's very unlikely that
-// two floating-points will be equal exactly. Hence a naive
-// comparison by the == operation often doesn't work.)
-//
-// Format of IEEE floating-point:
-//
-// The most-significant bit being the leftmost, an IEEE
-// floating-point looks like
-//
-// sign_bit exponent_bits fraction_bits
-//
-// Here, sign_bit is a single bit that designates the sign of the
-// number.
-//
-// For float, there are 8 exponent bits and 23 fraction bits.
-//
-// For double, there are 11 exponent bits and 52 fraction bits.
-//
-// More details can be found at
-// http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
-//
-// Template parameter:
-//
-// RawType: the raw floating-point type (either float or double)
-template <typename RawType>
-class FloatingPoint {
- public:
- // Defines the unsigned integer type that has the same size as the
- // floating point number.
- typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits;
-
- // Constants.
-
- // # of bits in a number.
- static const size_t kBitCount = 8*sizeof(RawType);
-
- // # of fraction bits in a number.
- static const size_t kFractionBitCount =
- std::numeric_limits<RawType>::digits - 1;
-
- // # of exponent bits in a number.
- static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
-
- // The mask for the sign bit.
- static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
-
- // The mask for the fraction bits.
- static const Bits kFractionBitMask =
- ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
-
- // The mask for the exponent bits.
- static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
-
- // How many ULP's (Units in the Last Place) we want to tolerate when
- // comparing two numbers. The larger the value, the more error we
- // allow. A 0 value means that two numbers must be exactly the same
- // to be considered equal.
- //
- // The maximum error of a single floating-point operation is 0.5
- // units in the last place. On Intel CPU's, all floating-point
- // calculations are done with 80-bit precision, while double has 64
- // bits. Therefore, 4 should be enough for ordinary use.
- //
- // See the following article for more details on ULP:
- // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
- static const size_t kMaxUlps = 4;
-
- // Constructs a FloatingPoint from a raw floating-point number.
- //
- // On an Intel CPU, passing a non-normalized NAN (Not a Number)
- // around may change its bits, although the new value is guaranteed
- // to be also a NAN. Therefore, don't expect this constructor to
- // preserve the bits in x when x is a NAN.
- explicit FloatingPoint(const RawType& x) { u_.value_ = x; }
-
- // Static methods
-
- // Reinterprets a bit pattern as a floating-point number.
- //
- // This function is needed to test the AlmostEquals() method.
- static RawType ReinterpretBits(const Bits bits) {
- FloatingPoint fp(0);
- fp.u_.bits_ = bits;
- return fp.u_.value_;
- }
-
- // Returns the floating-point number that represent positive infinity.
- static RawType Infinity() {
- return ReinterpretBits(kExponentBitMask);
- }
-
- // Returns the maximum representable finite floating-point number.
- static RawType Max();
-
- // Non-static methods
-
- // Returns the bits that represents this number.
- const Bits &bits() const { return u_.bits_; }
-
- // Returns the exponent bits of this number.
- Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
-
- // Returns the fraction bits of this number.
- Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
-
- // Returns the sign bit of this number.
- Bits sign_bit() const { return kSignBitMask & u_.bits_; }
-
- // Returns true iff this is NAN (not a number).
- bool is_nan() const {
- // It's a NAN if the exponent bits are all ones and the fraction
- // bits are not entirely zeros.
- return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
- }
-
- // Returns true iff this number is at most kMaxUlps ULP's away from
- // rhs. In particular, this function:
- //
- // - returns false if either number is (or both are) NAN.
- // - treats really large numbers as almost equal to infinity.
- // - thinks +0.0 and -0.0 are 0 DLP's apart.
- bool AlmostEquals(const FloatingPoint& rhs) const {
- // The IEEE standard says that any comparison operation involving
- // a NAN must return false.
- if (is_nan() || rhs.is_nan()) return false;
-
- return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
- <= kMaxUlps;
- }
-
- private:
- // The data type used to store the actual floating-point number.
- union FloatingPointUnion {
- RawType value_; // The raw floating-point number.
- Bits bits_; // The bits that represent the number.
- };
-
- // Converts an integer from the sign-and-magnitude representation to
- // the biased representation. More precisely, let N be 2 to the
- // power of (kBitCount - 1), an integer x is represented by the
- // unsigned number x + N.
- //
- // For instance,
- //
- // -N + 1 (the most negative number representable using
- // sign-and-magnitude) is represented by 1;
- // 0 is represented by N; and
- // N - 1 (the biggest number representable using
- // sign-and-magnitude) is represented by 2N - 1.
- //
- // Read http://en.wikipedia.org/wiki/Signed_number_representations
- // for more details on signed number representations.
- static Bits SignAndMagnitudeToBiased(const Bits &sam) {
- if (kSignBitMask & sam) {
- // sam represents a negative number.
- return ~sam + 1;
- } else {
- // sam represents a positive number.
- return kSignBitMask | sam;
- }
- }
-
- // Given two numbers in the sign-and-magnitude representation,
- // returns the distance between them as an unsigned number.
- static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
- const Bits &sam2) {
- const Bits biased1 = SignAndMagnitudeToBiased(sam1);
- const Bits biased2 = SignAndMagnitudeToBiased(sam2);
- return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
- }
-
- FloatingPointUnion u_;
-};
-
-// We cannot use std::numeric_limits<T>::max() as it clashes with the max()
-// macro defined by <windows.h>.
-template <>
-inline float FloatingPoint<float>::Max() { return FLT_MAX; }
-template <>
-inline double FloatingPoint<double>::Max() { return DBL_MAX; }
-
-// Typedefs the instances of the FloatingPoint template class that we
-// care to use.
-typedef FloatingPoint<float> Float;
-typedef FloatingPoint<double> Double;
-
-// In order to catch the mistake of putting tests that use different
-// test fixture classes in the same test case, we need to assign
-// unique IDs to fixture classes and compare them. The TypeId type is
-// used to hold such IDs. The user should treat TypeId as an opaque
-// type: the only operation allowed on TypeId values is to compare
-// them for equality using the == operator.
-typedef const void* TypeId;
-
-template <typename T>
-class TypeIdHelper {
- public:
- // dummy_ must not have a const type. Otherwise an overly eager
- // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
- // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
- static bool dummy_;
-};
-
-template <typename T>
-bool TypeIdHelper<T>::dummy_ = false;
-
-// GetTypeId<T>() returns the ID of type T. Different values will be
-// returned for different types. Calling the function twice with the
-// same type argument is guaranteed to return the same ID.
-template <typename T>
-TypeId GetTypeId() {
- // The compiler is required to allocate a different
- // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
- // the template. Therefore, the address of dummy_ is guaranteed to
- // be unique.
- return &(TypeIdHelper<T>::dummy_);
-}
-
-// Returns the type ID of ::testing::Test. Always call this instead
-// of GetTypeId< ::testing::Test>() to get the type ID of
-// ::testing::Test, as the latter may give the wrong result due to a
-// suspected linker bug when compiling Google Test as a Mac OS X
-// framework.
-GTEST_API_ TypeId GetTestTypeId();
-
-// Defines the abstract factory interface that creates instances
-// of a Test object.
-class TestFactoryBase {
- public:
- virtual ~TestFactoryBase() {}
-
- // Creates a test instance to run. The instance is both created and destroyed
- // within TestInfoImpl::Run()
- virtual Test* CreateTest() = 0;
-
- protected:
- TestFactoryBase() {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
-};
-
-// This class provides implementation of TeastFactoryBase interface.
-// It is used in TEST and TEST_F macros.
-template <class TestClass>
-class TestFactoryImpl : public TestFactoryBase {
- public:
- virtual Test* CreateTest() { return new TestClass; }
-};
-
-#if GTEST_OS_WINDOWS
-
-// Predicate-formatters for implementing the HRESULT checking macros
-// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
-// We pass a long instead of HRESULT to avoid causing an
-// include dependency for the HRESULT type.
-GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr,
- long hr); // NOLINT
-GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr,
- long hr); // NOLINT
-
-#endif // GTEST_OS_WINDOWS
-
-// Types of SetUpTestCase() and TearDownTestCase() functions.
-typedef void (*SetUpTestCaseFunc)();
-typedef void (*TearDownTestCaseFunc)();
-
-struct CodeLocation {
- CodeLocation(const std::string& a_file, int a_line)
- : file(a_file), line(a_line) {}
-
- std::string file;
- int line;
-};
-
-// Creates a new TestInfo object and registers it with Google Test;
-// returns the created object.
-//
-// Arguments:
-//
-// test_case_name: name of the test case
-// name: name of the test
-// type_param the name of the test's type parameter, or NULL if
-// this is not a typed or a type-parameterized test.
-// value_param text representation of the test's value parameter,
-// or NULL if this is not a type-parameterized test.
-// code_location: code location where the test is defined
-// fixture_class_id: ID of the test fixture class
-// set_up_tc: pointer to the function that sets up the test case
-// tear_down_tc: pointer to the function that tears down the test case
-// factory: pointer to the factory that creates a test object.
-// The newly created TestInfo instance will assume
-// ownership of the factory object.
-GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
- const char* test_case_name,
- const char* name,
- const char* type_param,
- const char* value_param,
- CodeLocation code_location,
- TypeId fixture_class_id,
- SetUpTestCaseFunc set_up_tc,
- TearDownTestCaseFunc tear_down_tc,
- TestFactoryBase* factory);
-
-// If *pstr starts with the given prefix, modifies *pstr to be right
-// past the prefix and returns true; otherwise leaves *pstr unchanged
-// and returns false. None of pstr, *pstr, and prefix can be NULL.
-GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// State of the definition of a type-parameterized test case.
-class GTEST_API_ TypedTestCasePState {
- public:
- TypedTestCasePState() : registered_(false) {}
-
- // Adds the given test name to defined_test_names_ and return true
- // if the test case hasn't been registered; otherwise aborts the
- // program.
- bool AddTestName(const char* file, int line, const char* case_name,
- const char* test_name) {
- if (registered_) {
- fprintf(stderr, "%s Test %s must be defined before "
- "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
- FormatFileLocation(file, line).c_str(), test_name, case_name);
- fflush(stderr);
- posix::Abort();
- }
- registered_tests_.insert(
- ::std::make_pair(test_name, CodeLocation(file, line)));
- return true;
- }
-
- bool TestExists(const std::string& test_name) const {
- return registered_tests_.count(test_name) > 0;
- }
-
- const CodeLocation& GetCodeLocation(const std::string& test_name) const {
- RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
- GTEST_CHECK_(it != registered_tests_.end());
- return it->second;
- }
-
- // Verifies that registered_tests match the test names in
- // defined_test_names_; returns registered_tests if successful, or
- // aborts the program otherwise.
- const char* VerifyRegisteredTestNames(
- const char* file, int line, const char* registered_tests);
-
- private:
- typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
-
- bool registered_;
- RegisteredTestsMap registered_tests_;
-};
-
-// Skips to the first non-space char after the first comma in 'str';
-// returns NULL if no comma is found in 'str'.
-inline const char* SkipComma(const char* str) {
- const char* comma = strchr(str, ',');
- if (comma == NULL) {
- return NULL;
- }
- while (IsSpace(*(++comma))) {}
- return comma;
-}
-
-// Returns the prefix of 'str' before the first comma in it; returns
-// the entire string if it contains no comma.
-inline std::string GetPrefixUntilComma(const char* str) {
- const char* comma = strchr(str, ',');
- return comma == NULL ? str : std::string(str, comma);
-}
-
-// Splits a given string on a given delimiter, populating a given
-// vector with the fields.
-void SplitString(const ::std::string& str, char delimiter,
- ::std::vector< ::std::string>* dest);
-
-// TypeParameterizedTest<Fixture, TestSel, Types>::Register()
-// registers a list of type-parameterized tests with Google Test. The
-// return value is insignificant - we just need to return something
-// such that we can call this function in a namespace scope.
-//
-// Implementation note: The GTEST_TEMPLATE_ macro declares a template
-// template parameter. It's defined in gtest-type-util.h.
-template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
-class TypeParameterizedTest {
- public:
- // 'index' is the index of the test in the type list 'Types'
- // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
- // Types). Valid values for 'index' are [0, N - 1] where N is the
- // length of Types.
- static bool Register(const char* prefix,
- CodeLocation code_location,
- const char* case_name, const char* test_names,
- int index) {
- typedef typename Types::Head Type;
- typedef Fixture<Type> FixtureClass;
- typedef typename GTEST_BIND_(TestSel, Type) TestClass;
-
- // First, registers the first type-parameterized test in the type
- // list.
- MakeAndRegisterTestInfo(
- (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/"
- + StreamableToString(index)).c_str(),
- StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(),
- GetTypeName<Type>().c_str(),
- NULL, // No value parameter.
- code_location,
- GetTypeId<FixtureClass>(),
- TestClass::SetUpTestCase,
- TestClass::TearDownTestCase,
- new TestFactoryImpl<TestClass>);
-
- // Next, recurses (at compile time) with the tail of the type list.
- return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
- ::Register(prefix, code_location, case_name, test_names, index + 1);
- }
-};
-
-// The base case for the compile time recursion.
-template <GTEST_TEMPLATE_ Fixture, class TestSel>
-class TypeParameterizedTest<Fixture, TestSel, Types0> {
- public:
- static bool Register(const char* /*prefix*/, CodeLocation,
- const char* /*case_name*/, const char* /*test_names*/,
- int /*index*/) {
- return true;
- }
-};
-
-// TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
-// registers *all combinations* of 'Tests' and 'Types' with Google
-// Test. The return value is insignificant - we just need to return
-// something such that we can call this function in a namespace scope.
-template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
-class TypeParameterizedTestCase {
- public:
- static bool Register(const char* prefix, CodeLocation code_location,
- const TypedTestCasePState* state,
- const char* case_name, const char* test_names) {
- std::string test_name = StripTrailingSpaces(
- GetPrefixUntilComma(test_names));
- if (!state->TestExists(test_name)) {
- fprintf(stderr, "Failed to get code location for test %s.%s at %s.",
- case_name, test_name.c_str(),
- FormatFileLocation(code_location.file.c_str(),
- code_location.line).c_str());
- fflush(stderr);
- posix::Abort();
- }
- const CodeLocation& test_location = state->GetCodeLocation(test_name);
-
- typedef typename Tests::Head Head;
-
- // First, register the first test in 'Test' for each type in 'Types'.
- TypeParameterizedTest<Fixture, Head, Types>::Register(
- prefix, test_location, case_name, test_names, 0);
-
- // Next, recurses (at compile time) with the tail of the test list.
- return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
- ::Register(prefix, code_location, state,
- case_name, SkipComma(test_names));
- }
-};
-
-// The base case for the compile time recursion.
-template <GTEST_TEMPLATE_ Fixture, typename Types>
-class TypeParameterizedTestCase<Fixture, Templates0, Types> {
- public:
- static bool Register(const char* /*prefix*/, CodeLocation,
- const TypedTestCasePState* /*state*/,
- const char* /*case_name*/, const char* /*test_names*/) {
- return true;
- }
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// Returns the current OS stack trace as an std::string.
-//
-// The maximum number of stack frames to be included is specified by
-// the gtest_stack_trace_depth flag. The skip_count parameter
-// specifies the number of top frames to be skipped, which doesn't
-// count against the number of frames to be included.
-//
-// For example, if Foo() calls Bar(), which in turn calls
-// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
-// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
-GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(
- UnitTest* unit_test, int skip_count);
-
-// Helpers for suppressing warnings on unreachable code or constant
-// condition.
-
-// Always returns true.
-GTEST_API_ bool AlwaysTrue();
-
-// Always returns false.
-inline bool AlwaysFalse() { return !AlwaysTrue(); }
-
-// Helper for suppressing false warning from Clang on a const char*
-// variable declared in a conditional expression always being NULL in
-// the else branch.
-struct GTEST_API_ ConstCharPtr {
- ConstCharPtr(const char* str) : value(str) {}
- operator bool() const { return true; }
- const char* value;
-};
-
-// A simple Linear Congruential Generator for generating random
-// numbers with a uniform distribution. Unlike rand() and srand(), it
-// doesn't use global state (and therefore can't interfere with user
-// code). Unlike rand_r(), it's portable. An LCG isn't very random,
-// but it's good enough for our purposes.
-class GTEST_API_ Random {
- public:
- static const UInt32 kMaxRange = 1u << 31;
-
- explicit Random(UInt32 seed) : state_(seed) {}
-
- void Reseed(UInt32 seed) { state_ = seed; }
-
- // Generates a random number from [0, range). Crashes if 'range' is
- // 0 or greater than kMaxRange.
- UInt32 Generate(UInt32 range);
-
- private:
- UInt32 state_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
-};
-
-// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
-// compiler error iff T1 and T2 are different types.
-template <typename T1, typename T2>
-struct CompileAssertTypesEqual;
-
-template <typename T>
-struct CompileAssertTypesEqual<T, T> {
-};
-
-// Removes the reference from a type if it is a reference type,
-// otherwise leaves it unchanged. This is the same as
-// tr1::remove_reference, which is not widely available yet.
-template <typename T>
-struct RemoveReference { typedef T type; }; // NOLINT
-template <typename T>
-struct RemoveReference<T&> { typedef T type; }; // NOLINT
-
-// A handy wrapper around RemoveReference that works when the argument
-// T depends on template parameters.
-#define GTEST_REMOVE_REFERENCE_(T) \
- typename ::testing::internal::RemoveReference<T>::type
-
-// Removes const from a type if it is a const type, otherwise leaves
-// it unchanged. This is the same as tr1::remove_const, which is not
-// widely available yet.
-template <typename T>
-struct RemoveConst { typedef T type; }; // NOLINT
-template <typename T>
-struct RemoveConst<const T> { typedef T type; }; // NOLINT
-
-// MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
-// definition to fail to remove the const in 'const int[3]' and 'const
-// char[3][4]'. The following specialization works around the bug.
-template <typename T, size_t N>
-struct RemoveConst<const T[N]> {
- typedef typename RemoveConst<T>::type type[N];
-};
-
-#if defined(_MSC_VER) && _MSC_VER < 1400
-// This is the only specialization that allows VC++ 7.1 to remove const in
-// 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC
-// and thus needs to be conditionally compiled.
-template <typename T, size_t N>
-struct RemoveConst<T[N]> {
- typedef typename RemoveConst<T>::type type[N];
-};
-#endif
-
-// A handy wrapper around RemoveConst that works when the argument
-// T depends on template parameters.
-#define GTEST_REMOVE_CONST_(T) \
- typename ::testing::internal::RemoveConst<T>::type
-
-// Turns const U&, U&, const U, and U all into U.
-#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
- GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
-
-// Adds reference to a type if it is not a reference type,
-// otherwise leaves it unchanged. This is the same as
-// tr1::add_reference, which is not widely available yet.
-template <typename T>
-struct AddReference { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddReference<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper around AddReference that works when the argument T
-// depends on template parameters.
-#define GTEST_ADD_REFERENCE_(T) \
- typename ::testing::internal::AddReference<T>::type
-
-// Adds a reference to const on top of T as necessary. For example,
-// it transforms
-//
-// char ==> const char&
-// const char ==> const char&
-// char& ==> const char&
-// const char& ==> const char&
-//
-// The argument T must depend on some template parameters.
-#define GTEST_REFERENCE_TO_CONST_(T) \
- GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
-
-// ImplicitlyConvertible<From, To>::value is a compile-time bool
-// constant that's true iff type From can be implicitly converted to
-// type To.
-template <typename From, typename To>
-class ImplicitlyConvertible {
- private:
- // We need the following helper functions only for their types.
- // They have no implementations.
-
- // MakeFrom() is an expression whose type is From. We cannot simply
- // use From(), as the type From may not have a public default
- // constructor.
- static typename AddReference<From>::type MakeFrom();
-
- // These two functions are overloaded. Given an expression
- // Helper(x), the compiler will pick the first version if x can be
- // implicitly converted to type To; otherwise it will pick the
- // second version.
- //
- // The first version returns a value of size 1, and the second
- // version returns a value of size 2. Therefore, by checking the
- // size of Helper(x), which can be done at compile time, we can tell
- // which version of Helper() is used, and hence whether x can be
- // implicitly converted to type To.
- static char Helper(To);
- static char (&Helper(...))[2]; // NOLINT
-
- // We have to put the 'public' section after the 'private' section,
- // or MSVC refuses to compile the code.
- public:
-#if defined(__BORLANDC__)
- // C++Builder cannot use member overload resolution during template
- // instantiation. The simplest workaround is to use its C++0x type traits
- // functions (C++Builder 2009 and above only).
- static const bool value = __is_convertible(From, To);
-#else
- // MSVC warns about implicitly converting from double to int for
- // possible loss of data, so we need to temporarily disable the
- // warning.
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244)
- static const bool value =
- sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-#endif // __BORLANDC__
-};
-template <typename From, typename To>
-const bool ImplicitlyConvertible<From, To>::value;
-
-// IsAProtocolMessage<T>::value is a compile-time bool constant that's
-// true iff T is type ProtocolMessage, proto2::Message, or a subclass
-// of those.
-template <typename T>
-struct IsAProtocolMessage
- : public bool_constant<
- ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value ||
- ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> {
-};
-
-// When the compiler sees expression IsContainerTest<C>(0), if C is an
-// STL-style container class, the first overload of IsContainerTest
-// will be viable (since both C::iterator* and C::const_iterator* are
-// valid types and NULL can be implicitly converted to them). It will
-// be picked over the second overload as 'int' is a perfect match for
-// the type of argument 0. If C::iterator or C::const_iterator is not
-// a valid type, the first overload is not viable, and the second
-// overload will be picked. Therefore, we can determine whether C is
-// a container class by checking the type of IsContainerTest<C>(0).
-// The value of the expression is insignificant.
-//
-// Note that we look for both C::iterator and C::const_iterator. The
-// reason is that C++ injects the name of a class as a member of the
-// class itself (e.g. you can refer to class iterator as either
-// 'iterator' or 'iterator::iterator'). If we look for C::iterator
-// only, for example, we would mistakenly think that a class named
-// iterator is an STL container.
-//
-// Also note that the simpler approach of overloading
-// IsContainerTest(typename C::const_iterator*) and
-// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
-typedef int IsContainer;
-template <class C>
-IsContainer IsContainerTest(int /* dummy */,
- typename C::iterator* /* it */ = NULL,
- typename C::const_iterator* /* const_it */ = NULL) {
- return 0;
-}
-
-typedef char IsNotContainer;
-template <class C>
-IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
-
-// EnableIf<condition>::type is void when 'Cond' is true, and
-// undefined when 'Cond' is false. To use SFINAE to make a function
-// overload only apply when a particular expression is true, add
-// "typename EnableIf<expression>::type* = 0" as the last parameter.
-template<bool> struct EnableIf;
-template<> struct EnableIf<true> { typedef void type; }; // NOLINT
-
-// Utilities for native arrays.
-
-// ArrayEq() compares two k-dimensional native arrays using the
-// elements' operator==, where k can be any integer >= 0. When k is
-// 0, ArrayEq() degenerates into comparing a single pair of values.
-
-template <typename T, typename U>
-bool ArrayEq(const T* lhs, size_t size, const U* rhs);
-
-// This generic version is used when k is 0.
-template <typename T, typename U>
-inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; }
-
-// This overload is used when k >= 1.
-template <typename T, typename U, size_t N>
-inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) {
- return internal::ArrayEq(lhs, N, rhs);
-}
-
-// This helper reduces code bloat. If we instead put its logic inside
-// the previous ArrayEq() function, arrays with different sizes would
-// lead to different copies of the template code.
-template <typename T, typename U>
-bool ArrayEq(const T* lhs, size_t size, const U* rhs) {
- for (size_t i = 0; i != size; i++) {
- if (!internal::ArrayEq(lhs[i], rhs[i]))
- return false;
- }
- return true;
-}
-
-// Finds the first element in the iterator range [begin, end) that
-// equals elem. Element may be a native array type itself.
-template <typename Iter, typename Element>
-Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) {
- for (Iter it = begin; it != end; ++it) {
- if (internal::ArrayEq(*it, elem))
- return it;
- }
- return end;
-}
-
-// CopyArray() copies a k-dimensional native array using the elements'
-// operator=, where k can be any integer >= 0. When k is 0,
-// CopyArray() degenerates into copying a single value.
-
-template <typename T, typename U>
-void CopyArray(const T* from, size_t size, U* to);
-
-// This generic version is used when k is 0.
-template <typename T, typename U>
-inline void CopyArray(const T& from, U* to) { *to = from; }
-
-// This overload is used when k >= 1.
-template <typename T, typename U, size_t N>
-inline void CopyArray(const T(&from)[N], U(*to)[N]) {
- internal::CopyArray(from, N, *to);
-}
-
-// This helper reduces code bloat. If we instead put its logic inside
-// the previous CopyArray() function, arrays with different sizes
-// would lead to different copies of the template code.
-template <typename T, typename U>
-void CopyArray(const T* from, size_t size, U* to) {
- for (size_t i = 0; i != size; i++) {
- internal::CopyArray(from[i], to + i);
- }
-}
-
-// The relation between an NativeArray object (see below) and the
-// native array it represents.
-// We use 2 different structs to allow non-copyable types to be used, as long
-// as RelationToSourceReference() is passed.
-struct RelationToSourceReference {};
-struct RelationToSourceCopy {};
-
-// Adapts a native array to a read-only STL-style container. Instead
-// of the complete STL container concept, this adaptor only implements
-// members useful for Google Mock's container matchers. New members
-// should be added as needed. To simplify the implementation, we only
-// support Element being a raw type (i.e. having no top-level const or
-// reference modifier). It's the client's responsibility to satisfy
-// this requirement. Element can be an array type itself (hence
-// multi-dimensional arrays are supported).
-template <typename Element>
-class NativeArray {
- public:
- // STL-style container typedefs.
- typedef Element value_type;
- typedef Element* iterator;
- typedef const Element* const_iterator;
-
- // Constructs from a native array. References the source.
- NativeArray(const Element* array, size_t count, RelationToSourceReference) {
- InitRef(array, count);
- }
-
- // Constructs from a native array. Copies the source.
- NativeArray(const Element* array, size_t count, RelationToSourceCopy) {
- InitCopy(array, count);
- }
-
- // Copy constructor.
- NativeArray(const NativeArray& rhs) {
- (this->*rhs.clone_)(rhs.array_, rhs.size_);
- }
-
- ~NativeArray() {
- if (clone_ != &NativeArray::InitRef)
- delete[] array_;
- }
-
- // STL-style container methods.
- size_t size() const { return size_; }
- const_iterator begin() const { return array_; }
- const_iterator end() const { return array_ + size_; }
- bool operator==(const NativeArray& rhs) const {
- return size() == rhs.size() &&
- ArrayEq(begin(), size(), rhs.begin());
- }
-
- private:
- enum {
- kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper<
- Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value,
- };
-
- // Initializes this object with a copy of the input.
- void InitCopy(const Element* array, size_t a_size) {
- Element* const copy = new Element[a_size];
- CopyArray(array, a_size, copy);
- array_ = copy;
- size_ = a_size;
- clone_ = &NativeArray::InitCopy;
- }
-
- // Initializes this object with a reference of the input.
- void InitRef(const Element* array, size_t a_size) {
- array_ = array;
- size_ = a_size;
- clone_ = &NativeArray::InitRef;
- }
-
- const Element* array_;
- size_t size_;
- void (NativeArray::*clone_)(const Element*, size_t);
-
- GTEST_DISALLOW_ASSIGN_(NativeArray);
-};
-
-} // namespace internal
-} // namespace testing
-
-#define GTEST_MESSAGE_AT_(file, line, message, result_type) \
- ::testing::internal::AssertHelper(result_type, file, line, message) \
- = ::testing::Message()
-
-#define GTEST_MESSAGE_(message, result_type) \
- GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
-
-#define GTEST_FATAL_FAILURE_(message) \
- return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
-
-#define GTEST_NONFATAL_FAILURE_(message) \
- GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
-
-#define GTEST_SUCCESS_(message) \
- GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
-
-// Suppresses MSVC warnings 4072 (unreachable code) for the code following
-// statement if it returns or throws (or doesn't return or throw in some
-// situations).
-#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
- if (::testing::internal::AlwaysTrue()) { statement; }
-
-#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::ConstCharPtr gtest_msg = "") { \
- bool gtest_caught_expected = false; \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (expected_exception const&) { \
- gtest_caught_expected = true; \
- } \
- catch (...) { \
- gtest_msg.value = \
- "Expected: " #statement " throws an exception of type " \
- #expected_exception ".\n Actual: it throws a different type."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
- } \
- if (!gtest_caught_expected) { \
- gtest_msg.value = \
- "Expected: " #statement " throws an exception of type " \
- #expected_exception ".\n Actual: it throws nothing."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
- fail(gtest_msg.value)
-
-#define GTEST_TEST_NO_THROW_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (...) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
- fail("Expected: " #statement " doesn't throw an exception.\n" \
- " Actual: it throws.")
-
-#define GTEST_TEST_ANY_THROW_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- bool gtest_caught_any = false; \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (...) { \
- gtest_caught_any = true; \
- } \
- if (!gtest_caught_any) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
- fail("Expected: " #statement " throws an exception.\n" \
- " Actual: it doesn't.")
-
-
-// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
-// either a boolean expression or an AssertionResult. text is a textual
-// represenation of expression as it was passed into the EXPECT_TRUE.
-#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (const ::testing::AssertionResult gtest_ar_ = \
- ::testing::AssertionResult(expression)) \
- ; \
- else \
- fail(::testing::internal::GetBoolAssertionFailureMessage(\
- gtest_ar_, text, #actual, #expected).c_str())
-
-#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
- fail("Expected: " #statement " doesn't generate new fatal " \
- "failures in the current thread.\n" \
- " Actual: it does.")
-
-// Expands to the name of the class that implements the given test.
-#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
- test_case_name##_##test_name##_Test
-
-// Helper macro for defining tests.
-#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
-class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
- public:\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
- private:\
- virtual void TestBody();\
- static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
- GTEST_DISALLOW_COPY_AND_ASSIGN_(\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
-};\
-\
-::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
- ::test_info_ =\
- ::testing::internal::MakeAndRegisterTestInfo(\
- #test_case_name, #test_name, NULL, NULL, \
- ::testing::internal::CodeLocation(__FILE__, __LINE__), \
- (parent_id), \
- parent_class::SetUpTestCase, \
- parent_class::TearDownTestCase, \
- new ::testing::internal::TestFactoryImpl<\
- GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
-void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
-
diff --git a/src/lib/install/include/gtest/internal/gtest-linked_ptr.h b/src/lib/install/include/gtest/internal/gtest-linked_ptr.h
deleted file mode 100755
index 3602942..0000000
--- a/src/lib/install/include/gtest/internal/gtest-linked_ptr.h
+++ /dev/null
@@ -1,243 +0,0 @@
-// Copyright 2003 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.
-//
-// Authors: Dan Egnor (egnor@google.com)
-//
-// A "smart" pointer type with reference tracking. Every pointer to a
-// particular object is kept on a circular linked list. When the last pointer
-// to an object is destroyed or reassigned, the object is deleted.
-//
-// Used properly, this deletes the object when the last reference goes away.
-// There are several caveats:
-// - Like all reference counting schemes, cycles lead to leaks.
-// - Each smart pointer is actually two pointers (8 bytes instead of 4).
-// - Every time a pointer is assigned, the entire list of pointers to that
-// object is traversed. This class is therefore NOT SUITABLE when there
-// will often be more than two or three pointers to a particular object.
-// - References are only tracked as long as linked_ptr<> objects are copied.
-// If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
-// will happen (double deletion).
-//
-// A good use of this class is storing object references in STL containers.
-// You can safely put linked_ptr<> in a vector<>.
-// Other uses may not be as good.
-//
-// Note: If you use an incomplete type with linked_ptr<>, the class
-// *containing* linked_ptr<> must have a constructor and destructor (even
-// if they do nothing!).
-//
-// Bill Gibbons suggested we use something like this.
-//
-// Thread Safety:
-// Unlike other linked_ptr implementations, in this implementation
-// a linked_ptr object is thread-safe in the sense that:
-// - it's safe to copy linked_ptr objects concurrently,
-// - it's safe to copy *from* a linked_ptr and read its underlying
-// raw pointer (e.g. via get()) concurrently, and
-// - it's safe to write to two linked_ptrs that point to the same
-// shared object concurrently.
-// TODO(wan@google.com): rename this to safe_linked_ptr to avoid
-// confusion with normal linked_ptr.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include "gtest/internal/gtest-port.h"
-
-namespace testing {
-namespace internal {
-
-// Protects copying of all linked_ptr objects.
-GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
-
-// This is used internally by all instances of linked_ptr<>. It needs to be
-// a non-template class because different types of linked_ptr<> can refer to
-// the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)).
-// So, it needs to be possible for different types of linked_ptr to participate
-// in the same circular linked list, so we need a single class type here.
-//
-// DO NOT USE THIS CLASS DIRECTLY YOURSELF. Use linked_ptr<T>.
-class linked_ptr_internal {
- public:
- // Create a new circle that includes only this instance.
- void join_new() {
- next_ = this;
- }
-
- // Many linked_ptr operations may change p.link_ for some linked_ptr
- // variable p in the same circle as this object. Therefore we need
- // to prevent two such operations from occurring concurrently.
- //
- // Note that different types of linked_ptr objects can coexist in a
- // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and
- // linked_ptr<Derived2>). Therefore we must use a single mutex to
- // protect all linked_ptr objects. This can create serious
- // contention in production code, but is acceptable in a testing
- // framework.
-
- // Join an existing circle.
- void join(linked_ptr_internal const* ptr)
- GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
- MutexLock lock(&g_linked_ptr_mutex);
-
- linked_ptr_internal const* p = ptr;
- while (p->next_ != ptr) {
- assert(p->next_ != this &&
- "Trying to join() a linked ring we are already in. "
- "Is GMock thread safety enabled?");
- p = p->next_;
- }
- p->next_ = this;
- next_ = ptr;
- }
-
- // Leave whatever circle we're part of. Returns true if we were the
- // last member of the circle. Once this is done, you can join() another.
- bool depart()
- GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
- MutexLock lock(&g_linked_ptr_mutex);
-
- if (next_ == this) return true;
- linked_ptr_internal const* p = next_;
- while (p->next_ != this) {
- assert(p->next_ != next_ &&
- "Trying to depart() a linked ring we are not in. "
- "Is GMock thread safety enabled?");
- p = p->next_;
- }
- p->next_ = next_;
- return false;
- }
-
- private:
- mutable linked_ptr_internal const* next_;
-};
-
-template <typename T>
-class linked_ptr {
- public:
- typedef T element_type;
-
- // Take over ownership of a raw pointer. This should happen as soon as
- // possible after the object is created.
- explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
- ~linked_ptr() { depart(); }
-
- // Copy an existing linked_ptr<>, adding ourselves to the list of references.
- template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); }
- linked_ptr(linked_ptr const& ptr) { // NOLINT
- assert(&ptr != this);
- copy(&ptr);
- }
-
- // Assignment releases the old value and acquires the new.
- template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) {
- depart();
- copy(&ptr);
- return *this;
- }
-
- linked_ptr& operator=(linked_ptr const& ptr) {
- if (&ptr != this) {
- depart();
- copy(&ptr);
- }
- return *this;
- }
-
- // Smart pointer members.
- void reset(T* ptr = NULL) {
- depart();
- capture(ptr);
- }
- T* get() const { return value_; }
- T* operator->() const { return value_; }
- T& operator*() const { return *value_; }
-
- bool operator==(T* p) const { return value_ == p; }
- bool operator!=(T* p) const { return value_ != p; }
- template <typename U>
- bool operator==(linked_ptr<U> const& ptr) const {
- return value_ == ptr.get();
- }
- template <typename U>
- bool operator!=(linked_ptr<U> const& ptr) const {
- return value_ != ptr.get();
- }
-
- private:
- template <typename U>
- friend class linked_ptr;
-
- T* value_;
- linked_ptr_internal link_;
-
- void depart() {
- if (link_.depart()) delete value_;
- }
-
- void capture(T* ptr) {
- value_ = ptr;
- link_.join_new();
- }
-
- template <typename U> void copy(linked_ptr<U> const* ptr) {
- value_ = ptr->get();
- if (value_)
- link_.join(&ptr->link_);
- else
- link_.join_new();
- }
-};
-
-template<typename T> inline
-bool operator==(T* ptr, const linked_ptr<T>& x) {
- return ptr == x.get();
-}
-
-template<typename T> inline
-bool operator!=(T* ptr, const linked_ptr<T>& x) {
- return ptr != x.get();
-}
-
-// A function to convert T* into linked_ptr<T>
-// Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
-// for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
-template <typename T>
-linked_ptr<T> make_linked_ptr(T* ptr) {
- return linked_ptr<T>(ptr);
-}
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-param-util-generated.h b/src/lib/install/include/gtest/internal/gtest-param-util-generated.h
deleted file mode 100755
index 4d1d81d..0000000
--- a/src/lib/install/include/gtest/internal/gtest-param-util-generated.h
+++ /dev/null
@@ -1,5146 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-param-util-generated.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: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently Google Test supports at most 50 arguments in Values,
-// and at most 10 arguments in Combine. Please contact
-// googletestframework@googlegroups.com if you need more.
-// Please note that the number of arguments to Combine is limited
-// by the maximum arity of the implementation of tuple which is
-// currently set at 10.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Forward declarations of ValuesIn(), which is implemented in
-// include/gtest/gtest-param-test.h.
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end);
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container);
-
-namespace internal {
-
-// Used in the Values() function to provide polymorphic capabilities.
-template <typename T1>
-class ValueArray1 {
- public:
- explicit ValueArray1(T1 v1) : v1_(v1) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray1& other);
-
- const T1 v1_;
-};
-
-template <typename T1, typename T2>
-class ValueArray2 {
- public:
- ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray2& other);
-
- const T1 v1_;
- const T2 v2_;
-};
-
-template <typename T1, typename T2, typename T3>
-class ValueArray3 {
- public:
- ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray3& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-class ValueArray4 {
- public:
- ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray4& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class ValueArray5 {
- public:
- ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray5& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-class ValueArray6 {
- public:
- ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray6& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-class ValueArray7 {
- public:
- ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray7& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-class ValueArray8 {
- public:
- ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
- T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray8& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-class ValueArray9 {
- public:
- ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
- T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray9& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-class ValueArray10 {
- public:
- ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray10& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-class ValueArray11 {
- public:
- ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray11& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-class ValueArray12 {
- public:
- ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray12& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-class ValueArray13 {
- public:
- ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray13& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-class ValueArray14 {
- public:
- ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray14& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-class ValueArray15 {
- public:
- ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray15& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-class ValueArray16 {
- public:
- ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray16& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-class ValueArray17 {
- public:
- ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
- T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray17& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-class ValueArray18 {
- public:
- ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray18& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-class ValueArray19 {
- public:
- ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray19& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-class ValueArray20 {
- public:
- ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray20& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-class ValueArray21 {
- public:
- ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray21& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-class ValueArray22 {
- public:
- ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray22& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-class ValueArray23 {
- public:
- ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray23& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-class ValueArray24 {
- public:
- ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray24& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-class ValueArray25 {
- public:
- ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
- T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray25& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-class ValueArray26 {
- public:
- ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray26& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-class ValueArray27 {
- public:
- ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray27& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-class ValueArray28 {
- public:
- ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray28& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-class ValueArray29 {
- public:
- ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray29& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-class ValueArray30 {
- public:
- ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray30& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-class ValueArray31 {
- public:
- ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray31& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-class ValueArray32 {
- public:
- ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray32& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-class ValueArray33 {
- public:
- ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
- T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray33& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-class ValueArray34 {
- public:
- ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray34& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-class ValueArray35 {
- public:
- ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
- v32_(v32), v33_(v33), v34_(v34), v35_(v35) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray35& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-class ValueArray36 {
- public:
- ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
- v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray36& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-class ValueArray37 {
- public:
- ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
- v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
- v36_(v36), v37_(v37) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray37& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-class ValueArray38 {
- public:
- ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray38& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-class ValueArray39 {
- public:
- ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray39& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-class ValueArray40 {
- public:
- ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
- v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
- v40_(v40) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray40& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-class ValueArray41 {
- public:
- ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
- T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray41& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-class ValueArray42 {
- public:
- ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray42& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-class ValueArray43 {
- public:
- ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6),
- v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13),
- v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19),
- v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25),
- v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31),
- v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37),
- v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray43& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-class ValueArray44 {
- public:
- ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5),
- v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12),
- v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18),
- v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24),
- v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30),
- v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36),
- v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42),
- v43_(v43), v44_(v44) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray44& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-class ValueArray45 {
- public:
- ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4),
- v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11),
- v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17),
- v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23),
- v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29),
- v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35),
- v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41),
- v42_(v42), v43_(v43), v44_(v44), v45_(v45) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray45& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-class ValueArray46 {
- public:
- ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3),
- v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
- v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray46& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-class ValueArray47 {
- public:
- ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2),
- v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10),
- v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16),
- v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22),
- v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28),
- v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34),
- v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40),
- v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46),
- v47_(v47) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray47& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-class ValueArray48 {
- public:
- ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1),
- v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9),
- v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15),
- v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21),
- v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27),
- v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33),
- v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39),
- v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45),
- v46_(v46), v47_(v47), v48_(v48) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray48& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-class ValueArray49 {
- public:
- ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48,
- T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
- v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_), static_cast<T>(v49_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray49& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
- const T49 v49_;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-class ValueArray50 {
- public:
- ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
- T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
- T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
- T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
- T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
- T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49,
- T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7),
- v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14),
- v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20),
- v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26),
- v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32),
- v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38),
- v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44),
- v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_),
- static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_),
- static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_),
- static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_),
- static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_),
- static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_),
- static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_),
- static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_),
- static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_),
- static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_),
- static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_),
- static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_),
- static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_),
- static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_),
- static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_),
- static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_),
- static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray50& other);
-
- const T1 v1_;
- const T2 v2_;
- const T3 v3_;
- const T4 v4_;
- const T5 v5_;
- const T6 v6_;
- const T7 v7_;
- const T8 v8_;
- const T9 v9_;
- const T10 v10_;
- const T11 v11_;
- const T12 v12_;
- const T13 v13_;
- const T14 v14_;
- const T15 v15_;
- const T16 v16_;
- const T17 v17_;
- const T18 v18_;
- const T19 v19_;
- const T20 v20_;
- const T21 v21_;
- const T22 v22_;
- const T23 v23_;
- const T24 v24_;
- const T25 v25_;
- const T26 v26_;
- const T27 v27_;
- const T28 v28_;
- const T29 v29_;
- const T30 v30_;
- const T31 v31_;
- const T32 v32_;
- const T33 v33_;
- const T34 v34_;
- const T35 v35_;
- const T36 v36_;
- const T37 v37_;
- const T38 v38_;
- const T39 v39_;
- const T40 v40_;
- const T41 v41_;
- const T42 v42_;
- const T43 v43_;
- const T44 v44_;
- const T45 v45_;
- const T46 v46_;
- const T47 v47_;
- const T48 v48_;
- const T49 v49_;
- const T50 v50_;
-};
-
-# if GTEST_HAS_COMBINE
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Generates values from the Cartesian product of values produced
-// by the argument generators.
-//
-template <typename T1, typename T2>
-class CartesianProductGenerator2
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2> > {
- public:
- typedef ::testing::tuple<T1, T2> ParamType;
-
- CartesianProductGenerator2(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2)
- : g1_(g1), g2_(g2) {}
- virtual ~CartesianProductGenerator2() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current2_;
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- ParamType current_value_;
- }; // class CartesianProductGenerator2::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator2& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
-}; // class CartesianProductGenerator2
-
-
-template <typename T1, typename T2, typename T3>
-class CartesianProductGenerator3
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3> > {
- public:
- typedef ::testing::tuple<T1, T2, T3> ParamType;
-
- CartesianProductGenerator3(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3)
- : g1_(g1), g2_(g2), g3_(g3) {}
- virtual ~CartesianProductGenerator3() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current3_;
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- ParamType current_value_;
- }; // class CartesianProductGenerator3::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator3& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
-}; // class CartesianProductGenerator3
-
-
-template <typename T1, typename T2, typename T3, typename T4>
-class CartesianProductGenerator4
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4> ParamType;
-
- CartesianProductGenerator4(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
- virtual ~CartesianProductGenerator4() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current4_;
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- ParamType current_value_;
- }; // class CartesianProductGenerator4::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator4& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
-}; // class CartesianProductGenerator4
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-class CartesianProductGenerator5
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5> ParamType;
-
- CartesianProductGenerator5(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
- virtual ~CartesianProductGenerator5() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current5_;
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- ParamType current_value_;
- }; // class CartesianProductGenerator5::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator5& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
-}; // class CartesianProductGenerator5
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-class CartesianProductGenerator6
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5,
- T6> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5, T6> ParamType;
-
- CartesianProductGenerator6(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
- virtual ~CartesianProductGenerator6() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current6_;
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- ParamType current_value_;
- }; // class CartesianProductGenerator6::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator6& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
-}; // class CartesianProductGenerator6
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-class CartesianProductGenerator7
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
- T7> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType;
-
- CartesianProductGenerator7(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
- virtual ~CartesianProductGenerator7() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current7_;
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- ParamType current_value_;
- }; // class CartesianProductGenerator7::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator7& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
-}; // class CartesianProductGenerator7
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-class CartesianProductGenerator8
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType;
-
- CartesianProductGenerator8(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
- g8_(g8) {}
- virtual ~CartesianProductGenerator8() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current8_;
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- ParamType current_value_;
- }; // class CartesianProductGenerator8::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator8& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
-}; // class CartesianProductGenerator8
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-class CartesianProductGenerator9
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8, T9> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType;
-
- CartesianProductGenerator9(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9) {}
- virtual ~CartesianProductGenerator9() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end(), g9_, g9_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8,
- const ParamGenerator<T9>& g9,
- const typename ParamGenerator<T9>::iterator& current9)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
- begin9_(g9.begin()), end9_(g9.end()), current9_(current9) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current9_;
- if (current9_ == end9_) {
- current9_ = begin9_;
- ++current8_;
- }
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_ &&
- current9_ == typed_other->current9_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_),
- begin9_(other.begin9_),
- end9_(other.end9_),
- current9_(other.current9_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_,
- *current9_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_ ||
- current9_ == end9_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- const typename ParamGenerator<T9>::iterator begin9_;
- const typename ParamGenerator<T9>::iterator end9_;
- typename ParamGenerator<T9>::iterator current9_;
- ParamType current_value_;
- }; // class CartesianProductGenerator9::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator9& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
- const ParamGenerator<T9> g9_;
-}; // class CartesianProductGenerator9
-
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-class CartesianProductGenerator10
- : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6,
- T7, T8, T9, T10> > {
- public:
- typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType;
-
- CartesianProductGenerator10(const ParamGenerator<T1>& g1,
- const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3,
- const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5,
- const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7,
- const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9,
- const ParamGenerator<T10>& g10)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9), g10_(g10) {}
- virtual ~CartesianProductGenerator10() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_,
- g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_,
- g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin());
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(),
- g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_,
- g8_.end(), g9_, g9_.end(), g10_, g10_.end());
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base,
- const ParamGenerator<T1>& g1,
- const typename ParamGenerator<T1>::iterator& current1,
- const ParamGenerator<T2>& g2,
- const typename ParamGenerator<T2>::iterator& current2,
- const ParamGenerator<T3>& g3,
- const typename ParamGenerator<T3>::iterator& current3,
- const ParamGenerator<T4>& g4,
- const typename ParamGenerator<T4>::iterator& current4,
- const ParamGenerator<T5>& g5,
- const typename ParamGenerator<T5>::iterator& current5,
- const ParamGenerator<T6>& g6,
- const typename ParamGenerator<T6>::iterator& current6,
- const ParamGenerator<T7>& g7,
- const typename ParamGenerator<T7>::iterator& current7,
- const ParamGenerator<T8>& g8,
- const typename ParamGenerator<T8>::iterator& current8,
- const ParamGenerator<T9>& g9,
- const typename ParamGenerator<T9>::iterator& current9,
- const ParamGenerator<T10>& g10,
- const typename ParamGenerator<T10>::iterator& current10)
- : base_(base),
- begin1_(g1.begin()), end1_(g1.end()), current1_(current1),
- begin2_(g2.begin()), end2_(g2.end()), current2_(current2),
- begin3_(g3.begin()), end3_(g3.end()), current3_(current3),
- begin4_(g4.begin()), end4_(g4.end()), current4_(current4),
- begin5_(g5.begin()), end5_(g5.end()), current5_(current5),
- begin6_(g6.begin()), end6_(g6.end()), current6_(current6),
- begin7_(g7.begin()), end7_(g7.end()), current7_(current7),
- begin8_(g8.begin()), end8_(g8.end()), current8_(current8),
- begin9_(g9.begin()), end9_(g9.end()), current9_(current9),
- begin10_(g10.begin()), end10_(g10.end()), current10_(current10) {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current10_;
- if (current10_ == end10_) {
- current10_ = begin10_;
- ++current9_;
- }
- if (current9_ == end9_) {
- current9_ = begin9_;
- ++current8_;
- }
- if (current8_ == end8_) {
- current8_ = begin8_;
- ++current7_;
- }
- if (current7_ == end7_) {
- current7_ = begin7_;
- ++current6_;
- }
- if (current6_ == end6_) {
- current6_ = begin6_;
- ++current5_;
- }
- if (current5_ == end5_) {
- current5_ = begin5_;
- ++current4_;
- }
- if (current4_ == end4_) {
- current4_ = begin4_;
- ++current3_;
- }
- if (current3_ == end3_) {
- current3_ = begin3_;
- ++current2_;
- }
- if (current2_ == end2_) {
- current2_ = begin2_;
- ++current1_;
- }
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- (
- current1_ == typed_other->current1_ &&
- current2_ == typed_other->current2_ &&
- current3_ == typed_other->current3_ &&
- current4_ == typed_other->current4_ &&
- current5_ == typed_other->current5_ &&
- current6_ == typed_other->current6_ &&
- current7_ == typed_other->current7_ &&
- current8_ == typed_other->current8_ &&
- current9_ == typed_other->current9_ &&
- current10_ == typed_other->current10_);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_),
- begin1_(other.begin1_),
- end1_(other.end1_),
- current1_(other.current1_),
- begin2_(other.begin2_),
- end2_(other.end2_),
- current2_(other.current2_),
- begin3_(other.begin3_),
- end3_(other.end3_),
- current3_(other.current3_),
- begin4_(other.begin4_),
- end4_(other.end4_),
- current4_(other.current4_),
- begin5_(other.begin5_),
- end5_(other.end5_),
- current5_(other.current5_),
- begin6_(other.begin6_),
- end6_(other.end6_),
- current6_(other.current6_),
- begin7_(other.begin7_),
- end7_(other.end7_),
- current7_(other.current7_),
- begin8_(other.begin8_),
- end8_(other.end8_),
- current8_(other.current8_),
- begin9_(other.begin9_),
- end9_(other.end9_),
- current9_(other.current9_),
- begin10_(other.begin10_),
- end10_(other.end10_),
- current10_(other.current10_) {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType(*current1_, *current2_, *current3_,
- *current4_, *current5_, *current6_, *current7_, *current8_,
- *current9_, *current10_);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
- current1_ == end1_ ||
- current2_ == end2_ ||
- current3_ == end3_ ||
- current4_ == end4_ ||
- current5_ == end5_ ||
- current6_ == end6_ ||
- current7_ == end7_ ||
- current8_ == end8_ ||
- current9_ == end9_ ||
- current10_ == end10_;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
- const typename ParamGenerator<T1>::iterator begin1_;
- const typename ParamGenerator<T1>::iterator end1_;
- typename ParamGenerator<T1>::iterator current1_;
- const typename ParamGenerator<T2>::iterator begin2_;
- const typename ParamGenerator<T2>::iterator end2_;
- typename ParamGenerator<T2>::iterator current2_;
- const typename ParamGenerator<T3>::iterator begin3_;
- const typename ParamGenerator<T3>::iterator end3_;
- typename ParamGenerator<T3>::iterator current3_;
- const typename ParamGenerator<T4>::iterator begin4_;
- const typename ParamGenerator<T4>::iterator end4_;
- typename ParamGenerator<T4>::iterator current4_;
- const typename ParamGenerator<T5>::iterator begin5_;
- const typename ParamGenerator<T5>::iterator end5_;
- typename ParamGenerator<T5>::iterator current5_;
- const typename ParamGenerator<T6>::iterator begin6_;
- const typename ParamGenerator<T6>::iterator end6_;
- typename ParamGenerator<T6>::iterator current6_;
- const typename ParamGenerator<T7>::iterator begin7_;
- const typename ParamGenerator<T7>::iterator end7_;
- typename ParamGenerator<T7>::iterator current7_;
- const typename ParamGenerator<T8>::iterator begin8_;
- const typename ParamGenerator<T8>::iterator end8_;
- typename ParamGenerator<T8>::iterator current8_;
- const typename ParamGenerator<T9>::iterator begin9_;
- const typename ParamGenerator<T9>::iterator end9_;
- typename ParamGenerator<T9>::iterator current9_;
- const typename ParamGenerator<T10>::iterator begin10_;
- const typename ParamGenerator<T10>::iterator end10_;
- typename ParamGenerator<T10>::iterator current10_;
- ParamType current_value_;
- }; // class CartesianProductGenerator10::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator10& other);
-
- const ParamGenerator<T1> g1_;
- const ParamGenerator<T2> g2_;
- const ParamGenerator<T3> g3_;
- const ParamGenerator<T4> g4_;
- const ParamGenerator<T5> g5_;
- const ParamGenerator<T6> g6_;
- const ParamGenerator<T7> g7_;
- const ParamGenerator<T8> g8_;
- const ParamGenerator<T9> g9_;
- const ParamGenerator<T10> g10_;
-}; // class CartesianProductGenerator10
-
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Helper classes providing Combine() with polymorphic features. They allow
-// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
-// convertible to U.
-//
-template <class Generator1, class Generator2>
-class CartesianProductHolder2 {
- public:
-CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
- : g1_(g1), g2_(g2) {}
- template <typename T1, typename T2>
- operator ParamGenerator< ::testing::tuple<T1, T2> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2> >(
- new CartesianProductGenerator2<T1, T2>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder2& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
-}; // class CartesianProductHolder2
-
-template <class Generator1, class Generator2, class Generator3>
-class CartesianProductHolder3 {
- public:
-CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
- const Generator3& g3)
- : g1_(g1), g2_(g2), g3_(g3) {}
- template <typename T1, typename T2, typename T3>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3> >(
- new CartesianProductGenerator3<T1, T2, T3>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder3& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
-}; // class CartesianProductHolder3
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4>
-class CartesianProductHolder4 {
- public:
-CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {}
- template <typename T1, typename T2, typename T3, typename T4>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >(
- new CartesianProductGenerator4<T1, T2, T3, T4>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder4& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
-}; // class CartesianProductHolder4
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5>
-class CartesianProductHolder5 {
- public:
-CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >(
- new CartesianProductGenerator5<T1, T2, T3, T4, T5>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder5& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
-}; // class CartesianProductHolder5
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6>
-class CartesianProductHolder6 {
- public:
-CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >(
- new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder6& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
-}; // class CartesianProductHolder6
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7>
-class CartesianProductHolder7 {
- public:
-CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6,
- T7> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> >(
- new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder7& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
-}; // class CartesianProductHolder7
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8>
-class CartesianProductHolder8 {
- public:
-CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7),
- g8_(g8) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7,
- T8> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >(
- new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder8& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
-}; // class CartesianProductHolder8
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8, class Generator9>
-class CartesianProductHolder9 {
- public:
-CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8,
- const Generator9& g9)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8,
- T9> >(
- new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_),
- static_cast<ParamGenerator<T9> >(g9_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder9& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
- const Generator9 g9_;
-}; // class CartesianProductHolder9
-
-template <class Generator1, class Generator2, class Generator3,
- class Generator4, class Generator5, class Generator6, class Generator7,
- class Generator8, class Generator9, class Generator10>
-class CartesianProductHolder10 {
- public:
-CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
- const Generator3& g3, const Generator4& g4, const Generator5& g5,
- const Generator6& g6, const Generator7& g7, const Generator8& g8,
- const Generator9& g9, const Generator10& g10)
- : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8),
- g9_(g9), g10_(g10) {}
- template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
- operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
- T10> >() const {
- return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9,
- T10> >(
- new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9,
- T10>(
- static_cast<ParamGenerator<T1> >(g1_),
- static_cast<ParamGenerator<T2> >(g2_),
- static_cast<ParamGenerator<T3> >(g3_),
- static_cast<ParamGenerator<T4> >(g4_),
- static_cast<ParamGenerator<T5> >(g5_),
- static_cast<ParamGenerator<T6> >(g6_),
- static_cast<ParamGenerator<T7> >(g7_),
- static_cast<ParamGenerator<T8> >(g8_),
- static_cast<ParamGenerator<T9> >(g9_),
- static_cast<ParamGenerator<T10> >(g10_)));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder10& other);
-
- const Generator1 g1_;
- const Generator2 g2_;
- const Generator3 g3_;
- const Generator4 g4_;
- const Generator5 g5_;
- const Generator6 g6_;
- const Generator7 g7_;
- const Generator8 g8_;
- const Generator9 g9_;
- const Generator10 g10_;
-}; // class CartesianProductHolder10
-
-# endif // GTEST_HAS_COMBINE
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-param-util-generated.h.pump b/src/lib/install/include/gtest/internal/gtest-param-util-generated.h.pump
deleted file mode 100755
index 5c7c47a..0000000
--- a/src/lib/install/include/gtest/internal/gtest-param-util-generated.h.pump
+++ /dev/null
@@ -1,286 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 50 $$ Maximum length of Values arguments we want to support.
-$var maxtuple = 10 $$ Maximum number of Combine arguments we want to 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: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently Google Test supports at most $n arguments in Values,
-// and at most $maxtuple arguments in Combine. Please contact
-// googletestframework@googlegroups.com if you need more.
-// Please note that the number of arguments to Combine is limited
-// by the maximum arity of the implementation of tuple which is
-// currently set at $maxtuple.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-param-util.h"
-#include "gtest/internal/gtest-port.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Forward declarations of ValuesIn(), which is implemented in
-// include/gtest/gtest-param-test.h.
-template <typename ForwardIterator>
-internal::ParamGenerator<
- typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
-ValuesIn(ForwardIterator begin, ForwardIterator end);
-
-template <typename T, size_t N>
-internal::ParamGenerator<T> ValuesIn(const T (&array)[N]);
-
-template <class Container>
-internal::ParamGenerator<typename Container::value_type> ValuesIn(
- const Container& container);
-
-namespace internal {
-
-// Used in the Values() function to provide polymorphic capabilities.
-$range i 1..n
-$for i [[
-$range j 1..i
-
-template <$for j, [[typename T$j]]>
-class ValueArray$i {
- public:
- $if i==1 [[explicit ]]ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {}
-
- template <typename T>
- operator ParamGenerator<T>() const {
- const T array[] = {$for j, [[static_cast<T>(v$(j)_)]]};
- return ValuesIn(array);
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const ValueArray$i& other);
-
-$for j [[
-
- const T$j v$(j)_;
-]]
-
-};
-
-]]
-
-# if GTEST_HAS_COMBINE
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Generates values from the Cartesian product of values produced
-// by the argument generators.
-//
-$range i 2..maxtuple
-$for i [[
-$range j 1..i
-$range k 2..i
-
-template <$for j, [[typename T$j]]>
-class CartesianProductGenerator$i
- : public ParamGeneratorInterface< ::testing::tuple<$for j, [[T$j]]> > {
- public:
- typedef ::testing::tuple<$for j, [[T$j]]> ParamType;
-
- CartesianProductGenerator$i($for j, [[const ParamGenerator<T$j>& g$j]])
- : $for j, [[g$(j)_(g$j)]] {}
- virtual ~CartesianProductGenerator$i() {}
-
- virtual ParamIteratorInterface<ParamType>* Begin() const {
- return new Iterator(this, $for j, [[g$(j)_, g$(j)_.begin()]]);
- }
- virtual ParamIteratorInterface<ParamType>* End() const {
- return new Iterator(this, $for j, [[g$(j)_, g$(j)_.end()]]);
- }
-
- private:
- class Iterator : public ParamIteratorInterface<ParamType> {
- public:
- Iterator(const ParamGeneratorInterface<ParamType>* base, $for j, [[
-
- const ParamGenerator<T$j>& g$j,
- const typename ParamGenerator<T$j>::iterator& current$(j)]])
- : base_(base),
-$for j, [[
-
- begin$(j)_(g$j.begin()), end$(j)_(g$j.end()), current$(j)_(current$j)
-]] {
- ComputeCurrentValue();
- }
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const {
- return base_;
- }
- // Advance should not be called on beyond-of-range iterators
- // so no component iterators must be beyond end of range, either.
- virtual void Advance() {
- assert(!AtEnd());
- ++current$(i)_;
-
-$for k [[
- if (current$(i+2-k)_ == end$(i+2-k)_) {
- current$(i+2-k)_ = begin$(i+2-k)_;
- ++current$(i+2-k-1)_;
- }
-
-]]
- ComputeCurrentValue();
- }
- virtual ParamIteratorInterface<ParamType>* Clone() const {
- return new Iterator(*this);
- }
- virtual const ParamType* Current() const { return &current_value_; }
- virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const Iterator* typed_other =
- CheckedDowncastToActualType<const Iterator>(&other);
- // We must report iterators equal if they both point beyond their
- // respective ranges. That can happen in a variety of fashions,
- // so we have to consult AtEnd().
- return (AtEnd() && typed_other->AtEnd()) ||
- ($for j && [[
-
- current$(j)_ == typed_other->current$(j)_
-]]);
- }
-
- private:
- Iterator(const Iterator& other)
- : base_(other.base_), $for j, [[
-
- begin$(j)_(other.begin$(j)_),
- end$(j)_(other.end$(j)_),
- current$(j)_(other.current$(j)_)
-]] {
- ComputeCurrentValue();
- }
-
- void ComputeCurrentValue() {
- if (!AtEnd())
- current_value_ = ParamType($for j, [[*current$(j)_]]);
- }
- bool AtEnd() const {
- // We must report iterator past the end of the range when either of the
- // component iterators has reached the end of its range.
- return
-$for j || [[
-
- current$(j)_ == end$(j)_
-]];
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<ParamType>* const base_;
- // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
- // current[i]_ is the actual traversing iterator.
-$for j [[
-
- const typename ParamGenerator<T$j>::iterator begin$(j)_;
- const typename ParamGenerator<T$j>::iterator end$(j)_;
- typename ParamGenerator<T$j>::iterator current$(j)_;
-]]
-
- ParamType current_value_;
- }; // class CartesianProductGenerator$i::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductGenerator$i& other);
-
-
-$for j [[
- const ParamGenerator<T$j> g$(j)_;
-
-]]
-}; // class CartesianProductGenerator$i
-
-
-]]
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Helper classes providing Combine() with polymorphic features. They allow
-// casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is
-// convertible to U.
-//
-$range i 2..maxtuple
-$for i [[
-$range j 1..i
-
-template <$for j, [[class Generator$j]]>
-class CartesianProductHolder$i {
- public:
-CartesianProductHolder$i($for j, [[const Generator$j& g$j]])
- : $for j, [[g$(j)_(g$j)]] {}
- template <$for j, [[typename T$j]]>
- operator ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >() const {
- return ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >(
- new CartesianProductGenerator$i<$for j, [[T$j]]>(
-$for j,[[
-
- static_cast<ParamGenerator<T$j> >(g$(j)_)
-]]));
- }
-
- private:
- // No implementation - assignment is unsupported.
- void operator=(const CartesianProductHolder$i& other);
-
-
-$for j [[
- const Generator$j g$(j)_;
-
-]]
-}; // class CartesianProductHolder$i
-
-]]
-
-# endif // GTEST_HAS_COMBINE
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-param-util.h b/src/lib/install/include/gtest/internal/gtest-param-util.h
deleted file mode 100755
index 3142f74..0000000
--- a/src/lib/install/include/gtest/internal/gtest-param-util.h
+++ /dev/null
@@ -1,730 +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.
-//
-// Author: vladl@google.com (Vlad Losev)
-
-// Type and function utilities for implementing parameterized tests.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-
-#include <ctype.h>
-
-#include <iterator>
-#include <set>
-#include <utility>
-#include <vector>
-
-// scripts/fuse_gtest.py depends on gtest's own header being #included
-// *unconditionally*. Therefore these #includes cannot be moved
-// inside #if GTEST_HAS_PARAM_TEST.
-#include "gtest/internal/gtest-internal.h"
-#include "gtest/internal/gtest-linked_ptr.h"
-#include "gtest/internal/gtest-port.h"
-#include "gtest/gtest-printers.h"
-
-#if GTEST_HAS_PARAM_TEST
-
-namespace testing {
-
-// Input to a parameterized test name generator, describing a test parameter.
-// Consists of the parameter value and the integer parameter index.
-template <class ParamType>
-struct TestParamInfo {
- TestParamInfo(const ParamType& a_param, size_t an_index) :
- param(a_param),
- index(an_index) {}
- ParamType param;
- size_t index;
-};
-
-// A builtin parameterized test name generator which returns the result of
-// testing::PrintToString.
-struct PrintToStringParamName {
- template <class ParamType>
- std::string operator()(const TestParamInfo<ParamType>& info) const {
- return PrintToString(info.param);
- }
-};
-
-namespace internal {
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Outputs a message explaining invalid registration of different
-// fixture class for the same test case. This may happen when
-// TEST_P macro is used to define two tests with the same name
-// but in different namespaces.
-GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name,
- CodeLocation code_location);
-
-template <typename> class ParamGeneratorInterface;
-template <typename> class ParamGenerator;
-
-// Interface for iterating over elements provided by an implementation
-// of ParamGeneratorInterface<T>.
-template <typename T>
-class ParamIteratorInterface {
- public:
- virtual ~ParamIteratorInterface() {}
- // A pointer to the base generator instance.
- // Used only for the purposes of iterator comparison
- // to make sure that two iterators belong to the same generator.
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0;
- // Advances iterator to point to the next element
- // provided by the generator. The caller is responsible
- // for not calling Advance() on an iterator equal to
- // BaseGenerator()->End().
- virtual void Advance() = 0;
- // Clones the iterator object. Used for implementing copy semantics
- // of ParamIterator<T>.
- virtual ParamIteratorInterface* Clone() const = 0;
- // Dereferences the current iterator and provides (read-only) access
- // to the pointed value. It is the caller's responsibility not to call
- // Current() on an iterator equal to BaseGenerator()->End().
- // Used for implementing ParamGenerator<T>::operator*().
- virtual const T* Current() const = 0;
- // Determines whether the given iterator and other point to the same
- // element in the sequence generated by the generator.
- // Used for implementing ParamGenerator<T>::operator==().
- virtual bool Equals(const ParamIteratorInterface& other) const = 0;
-};
-
-// Class iterating over elements provided by an implementation of
-// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T>
-// and implements the const forward iterator concept.
-template <typename T>
-class ParamIterator {
- public:
- typedef T value_type;
- typedef const T& reference;
- typedef ptrdiff_t difference_type;
-
- // ParamIterator assumes ownership of the impl_ pointer.
- ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
- ParamIterator& operator=(const ParamIterator& other) {
- if (this != &other)
- impl_.reset(other.impl_->Clone());
- return *this;
- }
-
- const T& operator*() const { return *impl_->Current(); }
- const T* operator->() const { return impl_->Current(); }
- // Prefix version of operator++.
- ParamIterator& operator++() {
- impl_->Advance();
- return *this;
- }
- // Postfix version of operator++.
- ParamIterator operator++(int /*unused*/) {
- ParamIteratorInterface<T>* clone = impl_->Clone();
- impl_->Advance();
- return ParamIterator(clone);
- }
- bool operator==(const ParamIterator& other) const {
- return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
- }
- bool operator!=(const ParamIterator& other) const {
- return !(*this == other);
- }
-
- private:
- friend class ParamGenerator<T>;
- explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
- scoped_ptr<ParamIteratorInterface<T> > impl_;
-};
-
-// ParamGeneratorInterface<T> is the binary interface to access generators
-// defined in other translation units.
-template <typename T>
-class ParamGeneratorInterface {
- public:
- typedef T ParamType;
-
- virtual ~ParamGeneratorInterface() {}
-
- // Generator interface definition
- virtual ParamIteratorInterface<T>* Begin() const = 0;
- virtual ParamIteratorInterface<T>* End() const = 0;
-};
-
-// Wraps ParamGeneratorInterface<T> and provides general generator syntax
-// compatible with the STL Container concept.
-// This class implements copy initialization semantics and the contained
-// ParamGeneratorInterface<T> instance is shared among all copies
-// of the original object. This is possible because that instance is immutable.
-template<typename T>
-class ParamGenerator {
- public:
- typedef ParamIterator<T> iterator;
-
- explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {}
- ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {}
-
- ParamGenerator& operator=(const ParamGenerator& other) {
- impl_ = other.impl_;
- return *this;
- }
-
- iterator begin() const { return iterator(impl_->Begin()); }
- iterator end() const { return iterator(impl_->End()); }
-
- private:
- linked_ptr<const ParamGeneratorInterface<T> > impl_;
-};
-
-// Generates values from a range of two comparable values. Can be used to
-// generate sequences of user-defined types that implement operator+() and
-// operator<().
-// This class is used in the Range() function.
-template <typename T, typename IncrementT>
-class RangeGenerator : public ParamGeneratorInterface<T> {
- public:
- RangeGenerator(T begin, T end, IncrementT step)
- : begin_(begin), end_(end),
- step_(step), end_index_(CalculateEndIndex(begin, end, step)) {}
- virtual ~RangeGenerator() {}
-
- virtual ParamIteratorInterface<T>* Begin() const {
- return new Iterator(this, begin_, 0, step_);
- }
- virtual ParamIteratorInterface<T>* End() const {
- return new Iterator(this, end_, end_index_, step_);
- }
-
- private:
- class Iterator : public ParamIteratorInterface<T> {
- public:
- Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
- IncrementT step)
- : base_(base), value_(value), index_(index), step_(step) {}
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
- return base_;
- }
- virtual void Advance() {
- value_ = static_cast<T>(value_ + step_);
- index_++;
- }
- virtual ParamIteratorInterface<T>* Clone() const {
- return new Iterator(*this);
- }
- virtual const T* Current() const { return &value_; }
- virtual bool Equals(const ParamIteratorInterface<T>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- const int other_index =
- CheckedDowncastToActualType<const Iterator>(&other)->index_;
- return index_ == other_index;
- }
-
- private:
- Iterator(const Iterator& other)
- : ParamIteratorInterface<T>(),
- base_(other.base_), value_(other.value_), index_(other.index_),
- step_(other.step_) {}
-
- // No implementation - assignment is unsupported.
- void operator=(const Iterator& other);
-
- const ParamGeneratorInterface<T>* const base_;
- T value_;
- int index_;
- const IncrementT step_;
- }; // class RangeGenerator::Iterator
-
- static int CalculateEndIndex(const T& begin,
- const T& end,
- const IncrementT& step) {
- int end_index = 0;
- for (T i = begin; i < end; i = static_cast<T>(i + step))
- end_index++;
- return end_index;
- }
-
- // No implementation - assignment is unsupported.
- void operator=(const RangeGenerator& other);
-
- const T begin_;
- const T end_;
- const IncrementT step_;
- // The index for the end() iterator. All the elements in the generated
- // sequence are indexed (0-based) to aid iterator comparison.
- const int end_index_;
-}; // class RangeGenerator
-
-
-// Generates values from a pair of STL-style iterators. Used in the
-// ValuesIn() function. The elements are copied from the source range
-// since the source can be located on the stack, and the generator
-// is likely to persist beyond that stack frame.
-template <typename T>
-class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> {
- public:
- template <typename ForwardIterator>
- ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
- : container_(begin, end) {}
- virtual ~ValuesInIteratorRangeGenerator() {}
-
- virtual ParamIteratorInterface<T>* Begin() const {
- return new Iterator(this, container_.begin());
- }
- virtual ParamIteratorInterface<T>* End() const {
- return new Iterator(this, container_.end());
- }
-
- private:
- typedef typename ::std::vector<T> ContainerType;
-
- class Iterator : public ParamIteratorInterface<T> {
- public:
- Iterator(const ParamGeneratorInterface<T>* base,
- typename ContainerType::const_iterator iterator)
- : base_(base), iterator_(iterator) {}
- virtual ~Iterator() {}
-
- virtual const ParamGeneratorInterface<T>* BaseGenerator() const {
- return base_;
- }
- virtual void Advance() {
- ++iterator_;
- value_.reset();
- }
- virtual ParamIteratorInterface<T>* Clone() const {
- return new Iterator(*this);
- }
- // We need to use cached value referenced by iterator_ because *iterator_
- // can return a temporary object (and of type other then T), so just
- // having "return &*iterator_;" doesn't work.
- // value_ is updated here and not in Advance() because Advance()
- // can advance iterator_ beyond the end of the range, and we cannot
- // detect that fact. The client code, on the other hand, is
- // responsible for not calling Current() on an out-of-range iterator.
- virtual const T* Current() const {
- if (value_.get() == NULL)
- value_.reset(new T(*iterator_));
- return value_.get();
- }
- virtual bool Equals(const ParamIteratorInterface<T>& other) const {
- // Having the same base generator guarantees that the other
- // iterator is of the same type and we can downcast.
- GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
- << "The program attempted to compare iterators "
- << "from different generators." << std::endl;
- return iterator_ ==
- CheckedDowncastToActualType<const Iterator>(&other)->iterator_;
- }
-
- private:
- Iterator(const Iterator& other)
- // The explicit constructor call suppresses a false warning
- // emitted by gcc when supplied with the -Wextra option.
- : ParamIteratorInterface<T>(),
- base_(other.base_),
- iterator_(other.iterator_) {}
-
- const ParamGeneratorInterface<T>* const base_;
- typename ContainerType::const_iterator iterator_;
- // A cached value of *iterator_. We keep it here to allow access by
- // pointer in the wrapping iterator's operator->().
- // value_ needs to be mutable to be accessed in Current().
- // Use of scoped_ptr helps manage cached value's lifetime,
- // which is bound by the lifespan of the iterator itself.
- mutable scoped_ptr<const T> value_;
- }; // class ValuesInIteratorRangeGenerator::Iterator
-
- // No implementation - assignment is unsupported.
- void operator=(const ValuesInIteratorRangeGenerator& other);
-
- const ContainerType container_;
-}; // class ValuesInIteratorRangeGenerator
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Default parameterized test name generator, returns a string containing the
-// integer test parameter index.
-template <class ParamType>
-std::string DefaultParamName(const TestParamInfo<ParamType>& info) {
- Message name_stream;
- name_stream << info.index;
- return name_stream.GetString();
-}
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Parameterized test name overload helpers, which help the
-// INSTANTIATE_TEST_CASE_P macro choose between the default parameterized
-// test name generator and user param name generator.
-template <class ParamType, class ParamNameGenFunctor>
-ParamNameGenFunctor GetParamNameGen(ParamNameGenFunctor func) {
- return func;
-}
-
-template <class ParamType>
-struct ParamNameGenFunc {
- typedef std::string Type(const TestParamInfo<ParamType>&);
-};
-
-template <class ParamType>
-typename ParamNameGenFunc<ParamType>::Type *GetParamNameGen() {
- return DefaultParamName;
-}
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Stores a parameter value and later creates tests parameterized with that
-// value.
-template <class TestClass>
-class ParameterizedTestFactory : public TestFactoryBase {
- public:
- typedef typename TestClass::ParamType ParamType;
- explicit ParameterizedTestFactory(ParamType parameter) :
- parameter_(parameter) {}
- virtual Test* CreateTest() {
- TestClass::SetParam(&parameter_);
- return new TestClass();
- }
-
- private:
- const ParamType parameter_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// TestMetaFactoryBase is a base class for meta-factories that create
-// test factories for passing into MakeAndRegisterTestInfo function.
-template <class ParamType>
-class TestMetaFactoryBase {
- public:
- virtual ~TestMetaFactoryBase() {}
-
- virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// TestMetaFactory creates test factories for passing into
-// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives
-// ownership of test factory pointer, same factory object cannot be passed
-// into that method twice. But ParameterizedTestCaseInfo is going to call
-// it for each Test/Parameter value combination. Thus it needs meta factory
-// creator class.
-template <class TestCase>
-class TestMetaFactory
- : public TestMetaFactoryBase<typename TestCase::ParamType> {
- public:
- typedef typename TestCase::ParamType ParamType;
-
- TestMetaFactory() {}
-
- virtual TestFactoryBase* CreateTestFactory(ParamType parameter) {
- return new ParameterizedTestFactory<TestCase>(parameter);
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseInfoBase is a generic interface
-// to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase
-// accumulates test information provided by TEST_P macro invocations
-// and generators provided by INSTANTIATE_TEST_CASE_P macro invocations
-// and uses that information to register all resulting test instances
-// in RegisterTests method. The ParameterizeTestCaseRegistry class holds
-// a collection of pointers to the ParameterizedTestCaseInfo objects
-// and calls RegisterTests() on each of them when asked.
-class ParameterizedTestCaseInfoBase {
- public:
- virtual ~ParameterizedTestCaseInfoBase() {}
-
- // Base part of test case name for display purposes.
- virtual const std::string& GetTestCaseName() const = 0;
- // Test case id to verify identity.
- virtual TypeId GetTestCaseTypeId() const = 0;
- // UnitTest class invokes this method to register tests in this
- // test case right before running them in RUN_ALL_TESTS macro.
- // This method should not be called more then once on any single
- // instance of a ParameterizedTestCaseInfoBase derived class.
- virtual void RegisterTests() = 0;
-
- protected:
- ParameterizedTestCaseInfoBase() {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase);
-};
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseInfo accumulates tests obtained from TEST_P
-// macro invocations for a particular test case and generators
-// obtained from INSTANTIATE_TEST_CASE_P macro invocations for that
-// test case. It registers tests with all values generated by all
-// generators when asked.
-template <class TestCase>
-class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
- public:
- // ParamType and GeneratorCreationFunc are private types but are required
- // for declarations of public methods AddTestPattern() and
- // AddTestCaseInstantiation().
- typedef typename TestCase::ParamType ParamType;
- // A function that returns an instance of appropriate generator type.
- typedef ParamGenerator<ParamType>(GeneratorCreationFunc)();
- typedef typename ParamNameGenFunc<ParamType>::Type ParamNameGeneratorFunc;
-
- explicit ParameterizedTestCaseInfo(
- const char* name, CodeLocation code_location)
- : test_case_name_(name), code_location_(code_location) {}
-
- // Test case base name for display purposes.
- virtual const std::string& GetTestCaseName() const { return test_case_name_; }
- // Test case id to verify identity.
- virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
- // TEST_P macro uses AddTestPattern() to record information
- // about a single test in a LocalTestInfo structure.
- // test_case_name is the base name of the test case (without invocation
- // prefix). test_base_name is the name of an individual test without
- // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
- // test case base name and DoBar is test base name.
- void AddTestPattern(const char* test_case_name,
- const char* test_base_name,
- TestMetaFactoryBase<ParamType>* meta_factory) {
- tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name,
- test_base_name,
- meta_factory)));
- }
- // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
- // about a generator.
- int AddTestCaseInstantiation(const std::string& instantiation_name,
- GeneratorCreationFunc* func,
- ParamNameGeneratorFunc* name_func,
- const char* file, int line) {
- instantiations_.push_back(
- InstantiationInfo(instantiation_name, func, name_func, file, line));
- return 0; // Return value used only to run this method in namespace scope.
- }
- // UnitTest class invokes this method to register tests in this test case
- // test cases right before running tests in RUN_ALL_TESTS macro.
- // This method should not be called more then once on any single
- // instance of a ParameterizedTestCaseInfoBase derived class.
- // UnitTest has a guard to prevent from calling this method more then once.
- virtual void RegisterTests() {
- for (typename TestInfoContainer::iterator test_it = tests_.begin();
- test_it != tests_.end(); ++test_it) {
- linked_ptr<TestInfo> test_info = *test_it;
- for (typename InstantiationContainer::iterator gen_it =
- instantiations_.begin(); gen_it != instantiations_.end();
- ++gen_it) {
- const std::string& instantiation_name = gen_it->name;
- ParamGenerator<ParamType> generator((*gen_it->generator)());
- ParamNameGeneratorFunc* name_func = gen_it->name_func;
- const char* file = gen_it->file;
- int line = gen_it->line;
-
- std::string test_case_name;
- if ( !instantiation_name.empty() )
- test_case_name = instantiation_name + "/";
- test_case_name += test_info->test_case_base_name;
-
- size_t i = 0;
- std::set<std::string> test_param_names;
- for (typename ParamGenerator<ParamType>::iterator param_it =
- generator.begin();
- param_it != generator.end(); ++param_it, ++i) {
- Message test_name_stream;
-
- std::string param_name = name_func(
- TestParamInfo<ParamType>(*param_it, i));
-
- GTEST_CHECK_(IsValidParamName(param_name))
- << "Parameterized test name '" << param_name
- << "' is invalid, in " << file
- << " line " << line << std::endl;
-
- GTEST_CHECK_(test_param_names.count(param_name) == 0)
- << "Duplicate parameterized test name '" << param_name
- << "', in " << file << " line " << line << std::endl;
-
- test_param_names.insert(param_name);
-
- test_name_stream << test_info->test_base_name << "/" << param_name;
- MakeAndRegisterTestInfo(
- test_case_name.c_str(),
- test_name_stream.GetString().c_str(),
- NULL, // No type parameter.
- PrintToString(*param_it).c_str(),
- code_location_,
- GetTestCaseTypeId(),
- TestCase::SetUpTestCase,
- TestCase::TearDownTestCase,
- test_info->test_meta_factory->CreateTestFactory(*param_it));
- } // for param_it
- } // for gen_it
- } // for test_it
- } // RegisterTests
-
- private:
- // LocalTestInfo structure keeps information about a single test registered
- // with TEST_P macro.
- struct TestInfo {
- TestInfo(const char* a_test_case_base_name,
- const char* a_test_base_name,
- TestMetaFactoryBase<ParamType>* a_test_meta_factory) :
- test_case_base_name(a_test_case_base_name),
- test_base_name(a_test_base_name),
- test_meta_factory(a_test_meta_factory) {}
-
- const std::string test_case_base_name;
- const std::string test_base_name;
- const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
- };
- typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
- // Records data received from INSTANTIATE_TEST_CASE_P macros:
- // <Instantiation name, Sequence generator creation function,
- // Name generator function, Source file, Source line>
- struct InstantiationInfo {
- InstantiationInfo(const std::string &name_in,
- GeneratorCreationFunc* generator_in,
- ParamNameGeneratorFunc* name_func_in,
- const char* file_in,
- int line_in)
- : name(name_in),
- generator(generator_in),
- name_func(name_func_in),
- file(file_in),
- line(line_in) {}
-
- std::string name;
- GeneratorCreationFunc* generator;
- ParamNameGeneratorFunc* name_func;
- const char* file;
- int line;
- };
- typedef ::std::vector<InstantiationInfo> InstantiationContainer;
-
- static bool IsValidParamName(const std::string& name) {
- // Check for empty string
- if (name.empty())
- return false;
-
- // Check for invalid characters
- for (std::string::size_type index = 0; index < name.size(); ++index) {
- if (!isalnum(name[index]) && name[index] != '_')
- return false;
- }
-
- return true;
- }
-
- const std::string test_case_name_;
- CodeLocation code_location_;
- TestInfoContainer tests_;
- InstantiationContainer instantiations_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo);
-}; // class ParameterizedTestCaseInfo
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase
-// classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P
-// macros use it to locate their corresponding ParameterizedTestCaseInfo
-// descriptors.
-class ParameterizedTestCaseRegistry {
- public:
- ParameterizedTestCaseRegistry() {}
- ~ParameterizedTestCaseRegistry() {
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- delete *it;
- }
- }
-
- // Looks up or creates and returns a structure containing information about
- // tests and instantiations of a particular test case.
- template <class TestCase>
- ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder(
- const char* test_case_name,
- CodeLocation code_location) {
- ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL;
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- if ((*it)->GetTestCaseName() == test_case_name) {
- if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) {
- // Complain about incorrect usage of Google Test facilities
- // and terminate the program since we cannot guaranty correct
- // test case setup and tear-down in this case.
- ReportInvalidTestCaseType(test_case_name, code_location);
- posix::Abort();
- } else {
- // At this point we are sure that the object we found is of the same
- // type we are looking for, so we downcast it to that type
- // without further checks.
- typed_test_info = CheckedDowncastToActualType<
- ParameterizedTestCaseInfo<TestCase> >(*it);
- }
- break;
- }
- }
- if (typed_test_info == NULL) {
- typed_test_info = new ParameterizedTestCaseInfo<TestCase>(
- test_case_name, code_location);
- test_case_infos_.push_back(typed_test_info);
- }
- return typed_test_info;
- }
- void RegisterTests() {
- for (TestCaseInfoContainer::iterator it = test_case_infos_.begin();
- it != test_case_infos_.end(); ++it) {
- (*it)->RegisterTests();
- }
- }
-
- private:
- typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer;
-
- TestCaseInfoContainer test_case_infos_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry);
-};
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_HAS_PARAM_TEST
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-port-arch.h b/src/lib/install/include/gtest/internal/gtest-port-arch.h
deleted file mode 100755
index f32fc06..0000000
--- a/src/lib/install/include/gtest/internal/gtest-port-arch.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2015, 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.
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file defines the GTEST_OS_* macro.
-// It is separate from gtest-port.h so that custom/gtest-port.h can include it.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
-
-// Determines the platform on which Google Test is compiled.
-#ifdef __CYGWIN__
-# define GTEST_OS_CYGWIN 1
-#elif defined __SYMBIAN32__
-# define GTEST_OS_SYMBIAN 1
-#elif defined _WIN32
-# define GTEST_OS_WINDOWS 1
-# ifdef _WIN32_WCE
-# define GTEST_OS_WINDOWS_MOBILE 1
-# elif defined(__MINGW__) || defined(__MINGW32__)
-# define GTEST_OS_WINDOWS_MINGW 1
-# elif defined(WINAPI_FAMILY)
-# include <winapifamily.h>
-# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-# define GTEST_OS_WINDOWS_DESKTOP 1
-# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-# define GTEST_OS_WINDOWS_PHONE 1
-# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
-# define GTEST_OS_WINDOWS_RT 1
-# else
- // WINAPI_FAMILY defined but no known partition matched.
- // Default to desktop.
-# define GTEST_OS_WINDOWS_DESKTOP 1
-# endif
-# else
-# define GTEST_OS_WINDOWS_DESKTOP 1
-# endif // _WIN32_WCE
-#elif defined __APPLE__
-# define GTEST_OS_MAC 1
-# if TARGET_OS_IPHONE
-# define GTEST_OS_IOS 1
-# endif
-#elif defined __FreeBSD__
-# define GTEST_OS_FREEBSD 1
-#elif defined __linux__
-# define GTEST_OS_LINUX 1
-# if defined __ANDROID__
-# define GTEST_OS_LINUX_ANDROID 1
-# endif
-#elif defined __MVS__
-# define GTEST_OS_ZOS 1
-#elif defined(__sun) && defined(__SVR4)
-# define GTEST_OS_SOLARIS 1
-#elif defined(_AIX)
-# define GTEST_OS_AIX 1
-#elif defined(__hpux)
-# define GTEST_OS_HPUX 1
-#elif defined __native_client__
-# define GTEST_OS_NACL 1
-#elif defined __NetBSD__
-# define GTEST_OS_NETBSD 1
-#elif defined __OpenBSD__
-# define GTEST_OS_OPENBSD 1
-#elif defined __QNX__
-# define GTEST_OS_QNX 1
-#endif // __CYGWIN__
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-port.h b/src/lib/install/include/gtest/internal/gtest-port.h
deleted file mode 100755
index f6cd3c0..0000000
--- a/src/lib/install/include/gtest/internal/gtest-port.h
+++ /dev/null
@@ -1,2591 +0,0 @@
-// Copyright 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.
-//
-// Authors: wan@google.com (Zhanyong Wan)
-//
-// Low-level types and utilities for porting Google Test to various
-// platforms. All macros ending with _ and symbols defined in an
-// internal namespace are subject to change without notice. Code
-// outside Google Test MUST NOT USE THEM DIRECTLY. Macros that don't
-// end with _ are part of Google Test's public API and can be used by
-// code outside Google Test.
-//
-// This file is fundamental to Google Test. All other Google Test source
-// files are expected to #include this. Therefore, it cannot #include
-// any other Google Test header.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
-
-// Environment-describing macros
-// -----------------------------
-//
-// Google Test can be used in many different environments. Macros in
-// this section tell Google Test what kind of environment it is being
-// used in, such that Google Test can provide environment-specific
-// features and implementations.
-//
-// Google Test tries to automatically detect the properties of its
-// environment, so users usually don't need to worry about these
-// macros. However, the automatic detection is not perfect.
-// Sometimes it's necessary for a user to define some of the following
-// macros in the build script to override Google Test's decisions.
-//
-// If the user doesn't define a macro in the list, Google Test will
-// provide a default definition. After this header is #included, all
-// macros in this list will be defined to either 1 or 0.
-//
-// Notes to maintainers:
-// - Each macro here is a user-tweakable knob; do not grow the list
-// lightly.
-// - Use #if to key off these macros. Don't use #ifdef or "#if
-// defined(...)", which will not work as these macros are ALWAYS
-// defined.
-//
-// GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2)
-// is/isn't available.
-// GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
-// are enabled.
-// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
-// is/isn't available (some systems define
-// ::string, which is different to std::string).
-// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
-// is/isn't available (some systems define
-// ::wstring, which is different to std::wstring).
-// GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular
-// expressions are/aren't available.
-// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
-// is/isn't available.
-// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
-// enabled.
-// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
-// std::wstring does/doesn't work (Google Test can
-// be used where std::wstring is unavailable).
-// GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple
-// is/isn't available.
-// GTEST_HAS_SEH - Define it to 1/0 to indicate whether the
-// compiler supports Microsoft's "Structured
-// Exception Handling".
-// GTEST_HAS_STREAM_REDIRECTION
-// - Define it to 1/0 to indicate whether the
-// platform supports I/O stream redirection using
-// dup() and dup2().
-// GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google
-// Test's own tr1 tuple implementation should be
-// used. Unused when the user sets
-// GTEST_HAS_TR1_TUPLE to 0.
-// GTEST_LANG_CXX11 - Define it to 1/0 to indicate that Google Test
-// is building in C++11/C++98 mode.
-// GTEST_LINKED_AS_SHARED_LIBRARY
-// - Define to 1 when compiling tests that use
-// Google Test as a shared library (known as
-// DLL on Windows).
-// GTEST_CREATE_SHARED_LIBRARY
-// - Define to 1 when compiling Google Test itself
-// as a shared library.
-
-// Platform-indicating macros
-// --------------------------
-//
-// Macros indicating the platform on which Google Test is being used
-// (a macro is defined to 1 if compiled on the given platform;
-// otherwise UNDEFINED -- it's never defined to 0.). Google Test
-// defines these macros automatically. Code outside Google Test MUST
-// NOT define them.
-//
-// GTEST_OS_AIX - IBM AIX
-// GTEST_OS_CYGWIN - Cygwin
-// GTEST_OS_FREEBSD - FreeBSD
-// GTEST_OS_HPUX - HP-UX
-// GTEST_OS_LINUX - Linux
-// GTEST_OS_LINUX_ANDROID - Google Android
-// GTEST_OS_MAC - Mac OS X
-// GTEST_OS_IOS - iOS
-// GTEST_OS_NACL - Google Native Client (NaCl)
-// GTEST_OS_NETBSD - NetBSD
-// GTEST_OS_OPENBSD - OpenBSD
-// GTEST_OS_QNX - QNX
-// GTEST_OS_SOLARIS - Sun Solaris
-// GTEST_OS_SYMBIAN - Symbian
-// GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile)
-// GTEST_OS_WINDOWS_DESKTOP - Windows Desktop
-// GTEST_OS_WINDOWS_MINGW - MinGW
-// GTEST_OS_WINDOWS_MOBILE - Windows Mobile
-// GTEST_OS_WINDOWS_PHONE - Windows Phone
-// GTEST_OS_WINDOWS_RT - Windows Store App/WinRT
-// GTEST_OS_ZOS - z/OS
-//
-// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
-// most stable support. Since core members of the Google Test project
-// don't have access to other platforms, support for them may be less
-// stable. If you notice any problems on your platform, please notify
-// googletestframework@googlegroups.com (patches for fixing them are
-// even more welcome!).
-//
-// It is possible that none of the GTEST_OS_* macros are defined.
-
-// Feature-indicating macros
-// -------------------------
-//
-// Macros indicating which Google Test features are available (a macro
-// is defined to 1 if the corresponding feature is supported;
-// otherwise UNDEFINED -- it's never defined to 0.). Google Test
-// defines these macros automatically. Code outside Google Test MUST
-// NOT define them.
-//
-// These macros are public so that portable tests can be written.
-// Such tests typically surround code using a feature with an #if
-// which controls that code. For example:
-//
-// #if GTEST_HAS_DEATH_TEST
-// EXPECT_DEATH(DoSomethingDeadly());
-// #endif
-//
-// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
-// tests)
-// GTEST_HAS_DEATH_TEST - death tests
-// GTEST_HAS_PARAM_TEST - value-parameterized tests
-// GTEST_HAS_TYPED_TEST - typed tests
-// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
-// GTEST_IS_THREADSAFE - Google Test is thread-safe.
-// GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with
-// GTEST_HAS_POSIX_RE (see above) which users can
-// define themselves.
-// GTEST_USES_SIMPLE_RE - our own simple regex is used;
-// the above two are mutually exclusive.
-// GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
-
-// Misc public macros
-// ------------------
-//
-// GTEST_FLAG(flag_name) - references the variable corresponding to
-// the given Google Test flag.
-
-// Internal utilities
-// ------------------
-//
-// The following macros and utilities are for Google Test's INTERNAL
-// use only. Code outside Google Test MUST NOT USE THEM DIRECTLY.
-//
-// Macros for basic C++ coding:
-// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
-// GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a
-// variable don't have to be used.
-// GTEST_DISALLOW_ASSIGN_ - disables operator=.
-// GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
-// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
-// GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is
-// suppressed (constant conditional).
-// GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127
-// is suppressed.
-//
-// C++11 feature wrappers:
-//
-// testing::internal::move - portability wrapper for std::move.
-//
-// Synchronization:
-// Mutex, MutexLock, ThreadLocal, GetThreadCount()
-// - synchronization primitives.
-//
-// Template meta programming:
-// is_pointer - as in TR1; needed on Symbian and IBM XL C/C++ only.
-// IteratorTraits - partial implementation of std::iterator_traits, which
-// is not available in libCstd when compiled with Sun C++.
-//
-// Smart pointers:
-// scoped_ptr - as in TR2.
-//
-// Regular expressions:
-// RE - a simple regular expression class using the POSIX
-// Extended Regular Expression syntax on UNIX-like
-// platforms, or a reduced regular exception syntax on
-// other platforms, including Windows.
-//
-// Logging:
-// GTEST_LOG_() - logs messages at the specified severity level.
-// LogToStderr() - directs all log messages to stderr.
-// FlushInfoLog() - flushes informational log messages.
-//
-// Stdout and stderr capturing:
-// CaptureStdout() - starts capturing stdout.
-// GetCapturedStdout() - stops capturing stdout and returns the captured
-// string.
-// CaptureStderr() - starts capturing stderr.
-// GetCapturedStderr() - stops capturing stderr and returns the captured
-// string.
-//
-// Integer types:
-// TypeWithSize - maps an integer to a int type.
-// Int32, UInt32, Int64, UInt64, TimeInMillis
-// - integers of known sizes.
-// BiggestInt - the biggest signed integer type.
-//
-// Command-line utilities:
-// GTEST_DECLARE_*() - declares a flag.
-// GTEST_DEFINE_*() - defines a flag.
-// GetInjectableArgvs() - returns the command line as a vector of strings.
-//
-// Environment variable utilities:
-// GetEnv() - gets the value of an environment variable.
-// BoolFromGTestEnv() - parses a bool environment variable.
-// Int32FromGTestEnv() - parses an Int32 environment variable.
-// StringFromGTestEnv() - parses a string environment variable.
-
-#include <ctype.h> // for isspace, etc
-#include <stddef.h> // for ptrdiff_t
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#ifndef _WIN32_WCE
-# include <sys/types.h>
-# include <sys/stat.h>
-#endif // !_WIN32_WCE
-
-#if defined __APPLE__
-# include <AvailabilityMacros.h>
-# include <TargetConditionals.h>
-#endif
-
-#include <algorithm> // NOLINT
-#include <iostream> // NOLINT
-#include <sstream> // NOLINT
-#include <string> // NOLINT
-#include <utility>
-#include <vector> // NOLINT
-
-#include "gtest/internal/gtest-port-arch.h"
-#include "gtest/internal/custom/gtest-port.h"
-
-#if !defined(GTEST_DEV_EMAIL_)
-# define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com"
-# define GTEST_FLAG_PREFIX_ "gtest_"
-# define GTEST_FLAG_PREFIX_DASH_ "gtest-"
-# define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
-# define GTEST_NAME_ "Google Test"
-# define GTEST_PROJECT_URL_ "https://github.com/google/googletest/"
-#endif // !defined(GTEST_DEV_EMAIL_)
-
-#if !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
-# define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest"
-#endif // !defined(GTEST_INIT_GOOGLE_TEST_NAME_)
-
-// Determines the version of gcc that is used to compile this.
-#ifdef __GNUC__
-// 40302 means version 4.3.2.
-# define GTEST_GCC_VER_ \
- (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
-#endif // __GNUC__
-
-// Macros for disabling Microsoft Visual C++ warnings.
-//
-// GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
-// /* code that triggers warnings C4800 and C4385 */
-// GTEST_DISABLE_MSC_WARNINGS_POP_()
-#if _MSC_VER >= 1500
-# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
- __pragma(warning(push)) \
- __pragma(warning(disable: warnings))
-# define GTEST_DISABLE_MSC_WARNINGS_POP_() \
- __pragma(warning(pop))
-#else
-// Older versions of MSVC don't have __pragma.
-# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
-# define GTEST_DISABLE_MSC_WARNINGS_POP_()
-#endif
-
-#ifndef GTEST_LANG_CXX11
-// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
-// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
-// value for __cplusplus, and recent versions of clang, gcc, and
-// probably other compilers set that too in C++11 mode.
-# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
-// Compiling in at least C++11 mode.
-# define GTEST_LANG_CXX11 1
-# else
-# define GTEST_LANG_CXX11 0
-# endif
-#endif
-
-// Distinct from C++11 language support, some environments don't provide
-// proper C++11 library support. Notably, it's possible to build in
-// C++11 mode when targeting Mac OS X 10.6, which has an old libstdc++
-// with no C++11 support.
-//
-// libstdc++ has sufficient C++11 support as of GCC 4.6.0, __GLIBCXX__
-// 20110325, but maintenance releases in the 4.4 and 4.5 series followed
-// this date, so check for those versions by their date stamps.
-// https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning
-#if GTEST_LANG_CXX11 && \
- (!defined(__GLIBCXX__) || ( \
- __GLIBCXX__ >= 20110325ul && /* GCC >= 4.6.0 */ \
- /* Blacklist of patch releases of older branches: */ \
- __GLIBCXX__ != 20110416ul && /* GCC 4.4.6 */ \
- __GLIBCXX__ != 20120313ul && /* GCC 4.4.7 */ \
- __GLIBCXX__ != 20110428ul && /* GCC 4.5.3 */ \
- __GLIBCXX__ != 20120702ul)) /* GCC 4.5.4 */
-# define GTEST_STDLIB_CXX11 1
-#endif
-
-// Only use C++11 library features if the library provides them.
-#if GTEST_STDLIB_CXX11
-# define GTEST_HAS_STD_BEGIN_AND_END_ 1
-# define GTEST_HAS_STD_FORWARD_LIST_ 1
-# define GTEST_HAS_STD_FUNCTION_ 1
-# define GTEST_HAS_STD_INITIALIZER_LIST_ 1
-# define GTEST_HAS_STD_MOVE_ 1
-# define GTEST_HAS_STD_SHARED_PTR_ 1
-# define GTEST_HAS_STD_TYPE_TRAITS_ 1
-# define GTEST_HAS_STD_UNIQUE_PTR_ 1
-#endif
-
-// C++11 specifies that <tuple> provides std::tuple.
-// Some platforms still might not have it, however.
-#if GTEST_LANG_CXX11
-# define GTEST_HAS_STD_TUPLE_ 1
-# if defined(__clang__)
-// Inspired by http://clang.llvm.org/docs/LanguageExtensions.html#__has_include
-# if defined(__has_include) && !__has_include(<tuple>)
-# undef GTEST_HAS_STD_TUPLE_
-# endif
-# elif defined(_MSC_VER)
-// Inspired by boost/config/stdlib/dinkumware.hpp
-# if defined(_CPPLIB_VER) && _CPPLIB_VER < 520
-# undef GTEST_HAS_STD_TUPLE_
-# endif
-# elif defined(__GLIBCXX__)
-// Inspired by boost/config/stdlib/libstdcpp3.hpp,
-// http://gcc.gnu.org/gcc-4.2/changes.html and
-// http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x
-# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
-# undef GTEST_HAS_STD_TUPLE_
-# endif
-# endif
-#endif
-
-// Brings in definitions for functions used in the testing::internal::posix
-// namespace (read, write, close, chdir, isatty, stat). We do not currently
-// use them on Windows Mobile.
-#if GTEST_OS_WINDOWS
-# if !GTEST_OS_WINDOWS_MOBILE
-# include <direct.h>
-# include <io.h>
-# endif
-// In order to avoid having to include <windows.h>, use forward declaration
-#if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR)
-// MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
-// separate (equivalent) structs, instead of using typedef
-typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
-#else
-// Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
-// This assumption is verified by
-// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
-typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
-#endif
-#else
-// This assumes that non-Windows OSes provide unistd.h. For OSes where this
-// is not the case, we need to include headers that provide the functions
-// mentioned above.
-# include <unistd.h>
-# include <strings.h>
-#endif // GTEST_OS_WINDOWS
-
-#if GTEST_OS_LINUX_ANDROID
-// Used to define __ANDROID_API__ matching the target NDK API level.
-# include <android/api-level.h> // NOLINT
-#endif
-
-// Defines this to true iff Google Test can use POSIX regular expressions.
-#ifndef GTEST_HAS_POSIX_RE
-# if GTEST_OS_LINUX_ANDROID
-// On Android, <regex.h> is only available starting with Gingerbread.
-# define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
-# else
-# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
-# endif
-#endif
-
-#if GTEST_USES_PCRE
-// The appropriate headers have already been included.
-
-#elif GTEST_HAS_POSIX_RE
-
-// On some platforms, <regex.h> needs someone to define size_t, and
-// won't compile otherwise. We can #include it here as we already
-// included <stdlib.h>, which is guaranteed to define size_t through
-// <stddef.h>.
-# include <regex.h> // NOLINT
-
-# define GTEST_USES_POSIX_RE 1
-
-#elif GTEST_OS_WINDOWS
-
-// <regex.h> is not available on Windows. Use our own simple regex
-// implementation instead.
-# define GTEST_USES_SIMPLE_RE 1
-
-#else
-
-// <regex.h> may not be available on this platform. Use our own
-// simple regex implementation instead.
-# define GTEST_USES_SIMPLE_RE 1
-
-#endif // GTEST_USES_PCRE
-
-#ifndef GTEST_HAS_EXCEPTIONS
-// The user didn't tell us whether exceptions are enabled, so we need
-// to figure it out.
-# if defined(_MSC_VER) || defined(__BORLANDC__)
-// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
-// macro to enable exceptions, so we'll do the same.
-// Assumes that exceptions are enabled by default.
-# ifndef _HAS_EXCEPTIONS
-# define _HAS_EXCEPTIONS 1
-# endif // _HAS_EXCEPTIONS
-# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
-# elif defined(__clang__)
-// clang defines __EXCEPTIONS iff exceptions are enabled before clang 220714,
-// but iff cleanups are enabled after that. In Obj-C++ files, there can be
-// cleanups for ObjC exceptions which also need cleanups, even if C++ exceptions
-// are disabled. clang has __has_feature(cxx_exceptions) which checks for C++
-// exceptions starting at clang r206352, but which checked for cleanups prior to
-// that. To reliably check for C++ exception availability with clang, check for
-// __EXCEPTIONS && __has_feature(cxx_exceptions).
-# define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions))
-# elif defined(__GNUC__) && __EXCEPTIONS
-// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__SUNPRO_CC)
-// Sun Pro CC supports exceptions. However, there is no compile-time way of
-// detecting whether they are enabled or not. Therefore, we assume that
-// they are enabled unless the user tells us otherwise.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__IBMCPP__) && __EXCEPTIONS
-// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
-# define GTEST_HAS_EXCEPTIONS 1
-# elif defined(__HP_aCC)
-// Exception handling is in effect by default in HP aCC compiler. It has to
-// be turned of by +noeh compiler option if desired.
-# define GTEST_HAS_EXCEPTIONS 1
-# else
-// For other compilers, we assume exceptions are disabled to be
-// conservative.
-# define GTEST_HAS_EXCEPTIONS 0
-# endif // defined(_MSC_VER) || defined(__BORLANDC__)
-#endif // GTEST_HAS_EXCEPTIONS
-
-#if !defined(GTEST_HAS_STD_STRING)
-// Even though we don't use this macro any longer, we keep it in case
-// some clients still depend on it.
-# define GTEST_HAS_STD_STRING 1
-#elif !GTEST_HAS_STD_STRING
-// The user told us that ::std::string isn't available.
-# error "Google Test cannot be used where ::std::string isn't available."
-#endif // !defined(GTEST_HAS_STD_STRING)
-
-#ifndef GTEST_HAS_GLOBAL_STRING
-// The user didn't tell us whether ::string is available, so we need
-// to figure it out.
-
-# define GTEST_HAS_GLOBAL_STRING 0
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
-#ifndef GTEST_HAS_STD_WSTRING
-// The user didn't tell us whether ::std::wstring is available, so we need
-// to figure it out.
-// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
-// is available.
-
-// Cygwin 1.7 and below doesn't support ::std::wstring.
-// Solaris' libc++ doesn't support it either. Android has
-// no support for it at least as recent as Froyo (2.2).
-# define GTEST_HAS_STD_WSTRING \
- (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
-
-#endif // GTEST_HAS_STD_WSTRING
-
-#ifndef GTEST_HAS_GLOBAL_WSTRING
-// The user didn't tell us whether ::wstring is available, so we need
-// to figure it out.
-# define GTEST_HAS_GLOBAL_WSTRING \
- (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// Determines whether RTTI is available.
-#ifndef GTEST_HAS_RTTI
-// The user didn't tell us whether RTTI is enabled, so we need to
-// figure it out.
-
-# ifdef _MSC_VER
-
-# ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled.
-# define GTEST_HAS_RTTI 1
-# else
-# define GTEST_HAS_RTTI 0
-# endif
-
-// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
-# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
-
-# ifdef __GXX_RTTI
-// When building against STLport with the Android NDK and with
-// -frtti -fno-exceptions, the build fails at link time with undefined
-// references to __cxa_bad_typeid. Note sure if STL or toolchain bug,
-// so disable RTTI when detected.
-# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \
- !defined(__EXCEPTIONS)
-# define GTEST_HAS_RTTI 0
-# else
-# define GTEST_HAS_RTTI 1
-# endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS
-# else
-# define GTEST_HAS_RTTI 0
-# endif // __GXX_RTTI
-
-// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
-// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
-// first version with C++ support.
-# elif defined(__clang__)
-
-# define GTEST_HAS_RTTI __has_feature(cxx_rtti)
-
-// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
-// both the typeid and dynamic_cast features are present.
-# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
-
-# ifdef __RTTI_ALL__
-# define GTEST_HAS_RTTI 1
-# else
-# define GTEST_HAS_RTTI 0
-# endif
-
-# else
-
-// For all other compilers, we assume RTTI is enabled.
-# define GTEST_HAS_RTTI 1
-
-# endif // _MSC_VER
-
-#endif // GTEST_HAS_RTTI
-
-// It's this header's responsibility to #include <typeinfo> when RTTI
-// is enabled.
-#if GTEST_HAS_RTTI
-# include <typeinfo>
-#endif
-
-// Determines whether Google Test can use the pthreads library.
-#ifndef GTEST_HAS_PTHREAD
-// The user didn't tell us explicitly, so we make reasonable assumptions about
-// which platforms have pthreads support.
-//
-// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
-// to your compiler flags.
-# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
- || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NACL || GTEST_OS_NETBSD)
-#endif // GTEST_HAS_PTHREAD
-
-#if GTEST_HAS_PTHREAD
-// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
-// true.
-# include <pthread.h> // NOLINT
-
-// For timespec and nanosleep, used below.
-# include <time.h> // NOLINT
-#endif
-
-// Determines if hash_map/hash_set are available.
-// Only used for testing against those containers.
-#if !defined(GTEST_HAS_HASH_MAP_)
-# if defined(_MSC_VER) && (_MSC_VER < 1900)
-# define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
-# define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
-# endif // _MSC_VER
-#endif // !defined(GTEST_HAS_HASH_MAP_)
-
-// Determines whether Google Test can use tr1/tuple. You can define
-// this macro to 0 to prevent Google Test from using tuple (any
-// feature depending on tuple with be disabled in this mode).
-#ifndef GTEST_HAS_TR1_TUPLE
-# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR)
-// STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>.
-# define GTEST_HAS_TR1_TUPLE 0
-# else
-// The user didn't tell us not to do it, so we assume it's OK.
-# define GTEST_HAS_TR1_TUPLE 1
-# endif
-#endif // GTEST_HAS_TR1_TUPLE
-
-// Determines whether Google Test's own tr1 tuple implementation
-// should be used.
-#ifndef GTEST_USE_OWN_TR1_TUPLE
-// The user didn't tell us, so we need to figure it out.
-
-// We use our own TR1 tuple if we aren't sure the user has an
-// implementation of it already. At this time, libstdc++ 4.0.0+ and
-// MSVC 2010 are the only mainstream standard libraries that come
-// with a TR1 tuple implementation. NVIDIA's CUDA NVCC compiler
-// pretends to be GCC by defining __GNUC__ and friends, but cannot
-// compile GCC's tuple implementation. MSVC 2008 (9.0) provides TR1
-// tuple in a 323 MB Feature Pack download, which we cannot assume the
-// user has. QNX's QCC compiler is a modified GCC but it doesn't
-// support TR1 tuple. libc++ only provides std::tuple, in C++11 mode,
-// and it can be used with some compilers that define __GNUC__.
-# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
- && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
-# define GTEST_ENV_HAS_TR1_TUPLE_ 1
-# endif
-
-// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
-// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
-// can build with clang but need to use gcc4.2's libstdc++).
-# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
-# define GTEST_ENV_HAS_STD_TUPLE_ 1
-# endif
-
-# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
-# define GTEST_USE_OWN_TR1_TUPLE 0
-# else
-# define GTEST_USE_OWN_TR1_TUPLE 1
-# endif
-
-#endif // GTEST_USE_OWN_TR1_TUPLE
-
-// To avoid conditional compilation everywhere, we make it
-// gtest-port.h's responsibility to #include the header implementing
-// tuple.
-#if GTEST_HAS_STD_TUPLE_
-# include <tuple> // IWYU pragma: export
-# define GTEST_TUPLE_NAMESPACE_ ::std
-#endif // GTEST_HAS_STD_TUPLE_
-
-// We include tr1::tuple even if std::tuple is available to define printers for
-// them.
-#if GTEST_HAS_TR1_TUPLE
-# ifndef GTEST_TUPLE_NAMESPACE_
-# define GTEST_TUPLE_NAMESPACE_ ::std::tr1
-# endif // GTEST_TUPLE_NAMESPACE_
-
-# if GTEST_USE_OWN_TR1_TUPLE
-# include "gtest/internal/gtest-tuple.h" // IWYU pragma: export // NOLINT
-# elif GTEST_ENV_HAS_STD_TUPLE_
-# include <tuple>
-// C++11 puts its tuple into the ::std namespace rather than
-// ::std::tr1. gtest expects tuple to live in ::std::tr1, so put it there.
-// This causes undefined behavior, but supported compilers react in
-// the way we intend.
-namespace std {
-namespace tr1 {
-using ::std::get;
-using ::std::make_tuple;
-using ::std::tuple;
-using ::std::tuple_element;
-using ::std::tuple_size;
-}
-}
-
-# elif GTEST_OS_SYMBIAN
-
-// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
-// use STLport's tuple implementation, which unfortunately doesn't
-// work as the copy of STLport distributed with Symbian is incomplete.
-// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
-// use its own tuple implementation.
-# ifdef BOOST_HAS_TR1_TUPLE
-# undef BOOST_HAS_TR1_TUPLE
-# endif // BOOST_HAS_TR1_TUPLE
-
-// This prevents <boost/tr1/detail/config.hpp>, which defines
-// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
-# define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
-# include <tuple> // IWYU pragma: export // NOLINT
-
-# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
-// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does
-// not conform to the TR1 spec, which requires the header to be <tuple>.
-
-# if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
-// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
-// which is #included by <tr1/tuple>, to not compile when RTTI is
-// disabled. _TR1_FUNCTIONAL is the header guard for
-// <tr1/functional>. Hence the following #define is a hack to prevent
-// <tr1/functional> from being included.
-# define _TR1_FUNCTIONAL 1
-# include <tr1/tuple>
-# undef _TR1_FUNCTIONAL // Allows the user to #include
- // <tr1/functional> if he chooses to.
-# else
-# include <tr1/tuple> // NOLINT
-# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
-
-# else
-// If the compiler is not GCC 4.0+, we assume the user is using a
-// spec-conforming TR1 implementation.
-# include <tuple> // IWYU pragma: export // NOLINT
-# endif // GTEST_USE_OWN_TR1_TUPLE
-
-#endif // GTEST_HAS_TR1_TUPLE
-
-// Determines whether clone(2) is supported.
-// Usually it will only be available on Linux, excluding
-// Linux on the Itanium architecture.
-// Also see http://linux.die.net/man/2/clone.
-#ifndef GTEST_HAS_CLONE
-// The user didn't tell us, so we need to figure it out.
-
-# if GTEST_OS_LINUX && !defined(__ia64__)
-# if GTEST_OS_LINUX_ANDROID
-// On Android, clone() became available at different API levels for each 32-bit
-// architecture.
-# if defined(__LP64__) || \
- (defined(__arm__) && __ANDROID_API__ >= 9) || \
- (defined(__mips__) && __ANDROID_API__ >= 12) || \
- (defined(__i386__) && __ANDROID_API__ >= 17)
-# define GTEST_HAS_CLONE 1
-# else
-# define GTEST_HAS_CLONE 0
-# endif
-# else
-# define GTEST_HAS_CLONE 1
-# endif
-# else
-# define GTEST_HAS_CLONE 0
-# endif // GTEST_OS_LINUX && !defined(__ia64__)
-
-#endif // GTEST_HAS_CLONE
-
-// Determines whether to support stream redirection. This is used to test
-// output correctness and to implement death tests.
-#ifndef GTEST_HAS_STREAM_REDIRECTION
-// By default, we assume that stream redirection is supported on all
-// platforms except known mobile ones.
-# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || \
- GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
-# define GTEST_HAS_STREAM_REDIRECTION 0
-# else
-# define GTEST_HAS_STREAM_REDIRECTION 1
-# endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-// Determines whether to support death tests.
-// Google Test does not support death tests for VC 7.1 and earlier as
-// abort() in a VC 7.1 application compiled as GUI in debug config
-// pops up a dialog window that cannot be suppressed programmatically.
-#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
- (GTEST_OS_MAC && !GTEST_OS_IOS) || \
- (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
- GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
- GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NETBSD)
-# define GTEST_HAS_DEATH_TEST 1
-#endif
-
-// We don't support MSVC 7.1 with exceptions disabled now. Therefore
-// all the compilers we care about are adequate for supporting
-// value-parameterized tests.
-#define GTEST_HAS_PARAM_TEST 1
-
-// Determines whether to support type-driven tests.
-
-// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0,
-// Sun Pro CC, IBM Visual Age, and HP aCC support.
-#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
- defined(__IBMCPP__) || defined(__HP_aCC)
-# define GTEST_HAS_TYPED_TEST 1
-# define GTEST_HAS_TYPED_TEST_P 1
-#endif
-
-// Determines whether to support Combine(). This only makes sense when
-// value-parameterized tests are enabled. The implementation doesn't
-// work on Sun Studio since it doesn't understand templated conversion
-// operators.
-#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
-# define GTEST_HAS_COMBINE 1
-#endif
-
-// Determines whether the system compiler uses UTF-16 for encoding wide strings.
-#define GTEST_WIDE_STRING_USES_UTF16_ \
- (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX)
-
-// Determines whether test results can be streamed to a socket.
-#if GTEST_OS_LINUX
-# define GTEST_CAN_STREAM_RESULTS_ 1
-#endif
-
-// Defines some utility macros.
-
-// The GNU compiler emits a warning if nested "if" statements are followed by
-// an "else" statement and braces are not used to explicitly disambiguate the
-// "else" binding. This leads to problems with code like:
-//
-// if (gate)
-// ASSERT_*(condition) << "Some message";
-//
-// The "switch (0) case 0:" idiom is used to suppress this.
-#ifdef __INTEL_COMPILER
-# define GTEST_AMBIGUOUS_ELSE_BLOCKER_
-#else
-# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT
-#endif
-
-// Use this annotation at the end of a struct/class definition to
-// prevent the compiler from optimizing away instances that are never
-// used. This is useful when all interesting logic happens inside the
-// c'tor and / or d'tor. Example:
-//
-// struct Foo {
-// Foo() { ... }
-// } GTEST_ATTRIBUTE_UNUSED_;
-//
-// Also use it after a variable or parameter declaration to tell the
-// compiler the variable/parameter does not have to be used.
-#if defined(__GNUC__) && !defined(COMPILER_ICC)
-# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
-#elif defined(__clang__)
-# if __has_attribute(unused)
-# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
-# endif
-#endif
-#ifndef GTEST_ATTRIBUTE_UNUSED_
-# define GTEST_ATTRIBUTE_UNUSED_
-#endif
-
-// Use this annotation before a function that takes a printf format string.
-#if defined(__GNUC__) && !defined(COMPILER_ICC)
-# if defined(__MINGW_PRINTF_FORMAT)
-// MinGW has two different printf implementations. Ensure the format macro
-// matches the selected implementation. See
-// https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/.
-# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
- __attribute__((__format__(__MINGW_PRINTF_FORMAT, string_index, \
- first_to_check)))
-# else
-# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
- __attribute__((__format__(__printf__, string_index, first_to_check)))
-# endif
-#else
-# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
-#endif
-
-// A macro to disallow operator=
-// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_ASSIGN_(type)\
- void operator=(type const &)
-
-// A macro to disallow copy constructor and operator=
-// This should be used in the private: declarations for a class.
-#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
- type(type const &);\
- GTEST_DISALLOW_ASSIGN_(type)
-
-// Tell the compiler to warn about unused return values for functions declared
-// with this macro. The macro should be used on function declarations
-// following the argument list:
-//
-// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
-#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
-# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
-#else
-# define GTEST_MUST_USE_RESULT_
-#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
-
-// MS C++ compiler emits warning when a conditional expression is compile time
-// constant. In some contexts this warning is false positive and needs to be
-// suppressed. Use the following two macros in such cases:
-//
-// GTEST_INTENTIONAL_CONST_COND_PUSH_()
-// while (true) {
-// GTEST_INTENTIONAL_CONST_COND_POP_()
-// }
-# define GTEST_INTENTIONAL_CONST_COND_PUSH_() \
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127)
-# define GTEST_INTENTIONAL_CONST_COND_POP_() \
- GTEST_DISABLE_MSC_WARNINGS_POP_()
-
-// Determine whether the compiler supports Microsoft's Structured Exception
-// Handling. This is supported by several Windows compilers but generally
-// does not exist on any other system.
-#ifndef GTEST_HAS_SEH
-// The user didn't tell us, so we need to figure it out.
-
-# if defined(_MSC_VER) || defined(__BORLANDC__)
-// These two compilers are known to support SEH.
-# define GTEST_HAS_SEH 1
-# else
-// Assume no SEH.
-# define GTEST_HAS_SEH 0
-# endif
-
-#define GTEST_IS_THREADSAFE \
- (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ \
- || (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) \
- || GTEST_HAS_PTHREAD)
-
-#endif // GTEST_HAS_SEH
-
-// GTEST_API_ qualifies all symbols that must be exported. The definitions below
-// are guarded by #ifndef to give embedders a chance to define GTEST_API_ in
-// gtest/internal/custom/gtest-port.h
-#ifndef GTEST_API_
-
-#ifdef _MSC_VER
-# if GTEST_LINKED_AS_SHARED_LIBRARY
-# define GTEST_API_ __declspec(dllimport)
-# elif GTEST_CREATE_SHARED_LIBRARY
-# define GTEST_API_ __declspec(dllexport)
-# endif
-#elif __GNUC__ >= 4 || defined(__clang__)
-# define GTEST_API_ __attribute__((visibility ("default")))
-#endif // _MSC_VER
-
-#endif // GTEST_API_
-
-#ifndef GTEST_API_
-# define GTEST_API_
-#endif // GTEST_API_
-
-#ifdef __GNUC__
-// Ask the compiler to never inline a given function.
-# define GTEST_NO_INLINE_ __attribute__((noinline))
-#else
-# define GTEST_NO_INLINE_
-#endif
-
-// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project.
-#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)
-# define GTEST_HAS_CXXABI_H_ 1
-#else
-# define GTEST_HAS_CXXABI_H_ 0
-#endif
-
-// A function level attribute to disable checking for use of uninitialized
-// memory when built with MemorySanitizer.
-#if defined(__clang__)
-# if __has_feature(memory_sanitizer)
-# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \
- __attribute__((no_sanitize_memory))
-# else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
-# endif // __has_feature(memory_sanitizer)
-#else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_
-#endif // __clang__
-
-// A function level attribute to disable AddressSanitizer instrumentation.
-#if defined(__clang__)
-# if __has_feature(address_sanitizer)
-# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \
- __attribute__((no_sanitize_address))
-# else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
-# endif // __has_feature(address_sanitizer)
-#else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
-#endif // __clang__
-
-// A function level attribute to disable ThreadSanitizer instrumentation.
-#if defined(__clang__)
-# if __has_feature(thread_sanitizer)
-# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \
- __attribute__((no_sanitize_thread))
-# else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
-# endif // __has_feature(thread_sanitizer)
-#else
-# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_
-#endif // __clang__
-
-namespace testing {
-
-class Message;
-
-#if defined(GTEST_TUPLE_NAMESPACE_)
-// Import tuple and friends into the ::testing namespace.
-// It is part of our interface, having them in ::testing allows us to change
-// their types as needed.
-using GTEST_TUPLE_NAMESPACE_::get;
-using GTEST_TUPLE_NAMESPACE_::make_tuple;
-using GTEST_TUPLE_NAMESPACE_::tuple;
-using GTEST_TUPLE_NAMESPACE_::tuple_size;
-using GTEST_TUPLE_NAMESPACE_::tuple_element;
-#endif // defined(GTEST_TUPLE_NAMESPACE_)
-
-namespace internal {
-
-// A secret type that Google Test users don't know about. It has no
-// definition on purpose. Therefore it's impossible to create a
-// Secret object, which is what we want.
-class Secret;
-
-// The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time
-// expression is true. For example, you could use it to verify the
-// size of a static array:
-//
-// GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
-// names_incorrect_size);
-//
-// or to make sure a struct is smaller than a certain size:
-//
-// GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large);
-//
-// The second argument to the macro is the name of the variable. If
-// the expression is false, most compilers will issue a warning/error
-// containing the name of the variable.
-
-#if GTEST_LANG_CXX11
-# define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
-#else // !GTEST_LANG_CXX11
-template <bool>
- struct CompileAssert {
-};
-
-# define GTEST_COMPILE_ASSERT_(expr, msg) \
- typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \
- msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_
-#endif // !GTEST_LANG_CXX11
-
-// Implementation details of GTEST_COMPILE_ASSERT_:
-//
-// (In C++11, we simply use static_assert instead of the following)
-//
-// - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1
-// elements (and thus is invalid) when the expression is false.
-//
-// - The simpler definition
-//
-// #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
-//
-// does not work, as gcc supports variable-length arrays whose sizes
-// are determined at run-time (this is gcc's extension and not part
-// of the C++ standard). As a result, gcc fails to reject the
-// following code with the simple definition:
-//
-// int foo;
-// GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
-// // not a compile-time constant.
-//
-// - By using the type CompileAssert<(bool(expr))>, we ensures that
-// expr is a compile-time constant. (Template arguments must be
-// determined at compile-time.)
-//
-// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
-// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
-//
-// CompileAssert<bool(expr)>
-//
-// instead, these compilers will refuse to compile
-//
-// GTEST_COMPILE_ASSERT_(5 > 0, some_message);
-//
-// (They seem to think the ">" in "5 > 0" marks the end of the
-// template argument list.)
-//
-// - The array size is (bool(expr) ? 1 : -1), instead of simply
-//
-// ((expr) ? 1 : -1).
-//
-// This is to avoid running into a bug in MS VC 7.1, which
-// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
-
-// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h.
-//
-// This template is declared, but intentionally undefined.
-template <typename T1, typename T2>
-struct StaticAssertTypeEqHelper;
-
-template <typename T>
-struct StaticAssertTypeEqHelper<T, T> {
- enum { value = true };
-};
-
-// Evaluates to the number of elements in 'array'.
-#define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
-
-#if GTEST_HAS_GLOBAL_STRING
-typedef ::string string;
-#else
-typedef ::std::string string;
-#endif // GTEST_HAS_GLOBAL_STRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-typedef ::wstring wstring;
-#elif GTEST_HAS_STD_WSTRING
-typedef ::std::wstring wstring;
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
-// A helper for suppressing warnings on constant condition. It just
-// returns 'condition'.
-GTEST_API_ bool IsTrue(bool condition);
-
-// Defines scoped_ptr.
-
-// This implementation of scoped_ptr is PARTIAL - it only contains
-// enough stuff to satisfy Google Test's need.
-template <typename T>
-class scoped_ptr {
- public:
- typedef T element_type;
-
- explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
- ~scoped_ptr() { reset(); }
-
- T& operator*() const { return *ptr_; }
- T* operator->() const { return ptr_; }
- T* get() const { return ptr_; }
-
- T* release() {
- T* const ptr = ptr_;
- ptr_ = NULL;
- return ptr;
- }
-
- void reset(T* p = NULL) {
- if (p != ptr_) {
- if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type.
- delete ptr_;
- }
- ptr_ = p;
- }
- }
-
- friend void swap(scoped_ptr& a, scoped_ptr& b) {
- using std::swap;
- swap(a.ptr_, b.ptr_);
- }
-
- private:
- T* ptr_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
-};
-
-// Defines RE.
-
-// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
-// Regular Expression syntax.
-class GTEST_API_ RE {
- public:
- // A copy constructor is required by the Standard to initialize object
- // references from r-values.
- RE(const RE& other) { Init(other.pattern()); }
-
- // Constructs an RE from a string.
- RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
-
-#if GTEST_HAS_GLOBAL_STRING
-
- RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
- RE(const char* regex) { Init(regex); } // NOLINT
- ~RE();
-
- // Returns the string representation of the regex.
- const char* pattern() const { return pattern_; }
-
- // FullMatch(str, re) returns true iff regular expression re matches
- // the entire str.
- // PartialMatch(str, re) returns true iff regular expression re
- // matches a substring of str (including str itself).
- //
- // TODO(wan@google.com): make FullMatch() and PartialMatch() work
- // when str contains NUL characters.
- static bool FullMatch(const ::std::string& str, const RE& re) {
- return FullMatch(str.c_str(), re);
- }
- static bool PartialMatch(const ::std::string& str, const RE& re) {
- return PartialMatch(str.c_str(), re);
- }
-
-#if GTEST_HAS_GLOBAL_STRING
-
- static bool FullMatch(const ::string& str, const RE& re) {
- return FullMatch(str.c_str(), re);
- }
- static bool PartialMatch(const ::string& str, const RE& re) {
- return PartialMatch(str.c_str(), re);
- }
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
- static bool FullMatch(const char* str, const RE& re);
- static bool PartialMatch(const char* str, const RE& re);
-
- private:
- void Init(const char* regex);
-
- // We use a const char* instead of an std::string, as Google Test used to be
- // used where std::string is not available. TODO(wan@google.com): change to
- // std::string.
- const char* pattern_;
- bool is_valid_;
-
-#if GTEST_USES_POSIX_RE
-
- regex_t full_regex_; // For FullMatch().
- regex_t partial_regex_; // For PartialMatch().
-
-#else // GTEST_USES_SIMPLE_RE
-
- const char* full_pattern_; // For FullMatch();
-
-#endif
-
- GTEST_DISALLOW_ASSIGN_(RE);
-};
-
-// Formats a source file path and a line number as they would appear
-// in an error message from the compiler used to compile this code.
-GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
-
-// Formats a file location for compiler-independent XML output.
-// Although this function is not platform dependent, we put it next to
-// FormatFileLocation in order to contrast the two functions.
-GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
- int line);
-
-// Defines logging utilities:
-// GTEST_LOG_(severity) - logs messages at the specified severity level. The
-// message itself is streamed into the macro.
-// LogToStderr() - directs all log messages to stderr.
-// FlushInfoLog() - flushes informational log messages.
-
-enum GTestLogSeverity {
- GTEST_INFO,
- GTEST_WARNING,
- GTEST_ERROR,
- GTEST_FATAL
-};
-
-// Formats log entry severity, provides a stream object for streaming the
-// log message, and terminates the message with a newline when going out of
-// scope.
-class GTEST_API_ GTestLog {
- public:
- GTestLog(GTestLogSeverity severity, const char* file, int line);
-
- // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
- ~GTestLog();
-
- ::std::ostream& GetStream() { return ::std::cerr; }
-
- private:
- const GTestLogSeverity severity_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
-};
-
-#if !defined(GTEST_LOG_)
-
-# define GTEST_LOG_(severity) \
- ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \
- __FILE__, __LINE__).GetStream()
-
-inline void LogToStderr() {}
-inline void FlushInfoLog() { fflush(NULL); }
-
-#endif // !defined(GTEST_LOG_)
-
-#if !defined(GTEST_CHECK_)
-// INTERNAL IMPLEMENTATION - DO NOT USE.
-//
-// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition
-// is not satisfied.
-// Synopsys:
-// GTEST_CHECK_(boolean_condition);
-// or
-// GTEST_CHECK_(boolean_condition) << "Additional message";
-//
-// This checks the condition and if the condition is not satisfied
-// it prints message about the condition violation, including the
-// condition itself, plus additional message streamed into it, if any,
-// and then it aborts the program. It aborts the program irrespective of
-// whether it is built in the debug mode or not.
-# define GTEST_CHECK_(condition) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::IsTrue(condition)) \
- ; \
- else \
- GTEST_LOG_(FATAL) << "Condition " #condition " failed. "
-#endif // !defined(GTEST_CHECK_)
-
-// An all-mode assert to verify that the given POSIX-style function
-// call returns 0 (indicating success). Known limitation: this
-// doesn't expand to a balanced 'if' statement, so enclose the macro
-// in {} if you need to use it as the only statement in an 'if'
-// branch.
-#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \
- if (const int gtest_error = (posix_call)) \
- GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
- << gtest_error
-
-#if GTEST_HAS_STD_MOVE_
-using std::move;
-#else // GTEST_HAS_STD_MOVE_
-template <typename T>
-const T& move(const T& t) {
- return t;
-}
-#endif // GTEST_HAS_STD_MOVE_
-
-// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
-//
-// Use ImplicitCast_ as a safe version of static_cast for upcasting in
-// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a
-// const Foo*). When you use ImplicitCast_, the compiler checks that
-// the cast is safe. Such explicit ImplicitCast_s are necessary in
-// surprisingly many situations where C++ demands an exact type match
-// instead of an argument type convertable to a target type.
-//
-// The syntax for using ImplicitCast_ is the same as for static_cast:
-//
-// ImplicitCast_<ToType>(expr)
-//
-// ImplicitCast_ would have been part of the C++ standard library,
-// but the proposal was submitted too late. It will probably make
-// its way into the language in the future.
-//
-// This relatively ugly name is intentional. It prevents clashes with
-// similar functions users may have (e.g., implicit_cast). The internal
-// namespace alone is not enough because the function can be found by ADL.
-template<typename To>
-inline To ImplicitCast_(To x) { return x; }
-
-// When you upcast (that is, cast a pointer from type Foo to type
-// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
-// always succeed. When you downcast (that is, cast a pointer from
-// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
-// how do you know the pointer is really of type SubclassOfFoo? It
-// could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
-// when you downcast, you should use this macro. In debug mode, we
-// use dynamic_cast<> to double-check the downcast is legal (we die
-// if it's not). In normal mode, we do the efficient static_cast<>
-// instead. Thus, it's important to test in debug mode to make sure
-// the cast is legal!
-// This is the only place in the code we should use dynamic_cast<>.
-// In particular, you SHOULDN'T be using dynamic_cast<> in order to
-// do RTTI (eg code like this:
-// if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
-// if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
-// You should design the code some other way not to need this.
-//
-// This relatively ugly name is intentional. It prevents clashes with
-// similar functions users may have (e.g., down_cast). The internal
-// namespace alone is not enough because the function can be found by ADL.
-template<typename To, typename From> // use like this: DownCast_<T*>(foo);
-inline To DownCast_(From* f) { // so we only accept pointers
- // Ensures that To is a sub-type of From *. This test is here only
- // for compile-time type checking, and has no overhead in an
- // optimized build at run-time, as it will be optimized away
- // completely.
- GTEST_INTENTIONAL_CONST_COND_PUSH_()
- if (false) {
- GTEST_INTENTIONAL_CONST_COND_POP_()
- const To to = NULL;
- ::testing::internal::ImplicitCast_<From*>(to);
- }
-
-#if GTEST_HAS_RTTI
- // RTTI: debug mode only!
- GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);
-#endif
- return static_cast<To>(f);
-}
-
-// Downcasts the pointer of type Base to Derived.
-// Derived must be a subclass of Base. The parameter MUST
-// point to a class of type Derived, not any subclass of it.
-// When RTTI is available, the function performs a runtime
-// check to enforce this.
-template <class Derived, class Base>
-Derived* CheckedDowncastToActualType(Base* base) {
-#if GTEST_HAS_RTTI
- GTEST_CHECK_(typeid(*base) == typeid(Derived));
-#endif
-
-#if GTEST_HAS_DOWNCAST_
- return ::down_cast<Derived*>(base);
-#elif GTEST_HAS_RTTI
- return dynamic_cast<Derived*>(base); // NOLINT
-#else
- return static_cast<Derived*>(base); // Poor man's downcast.
-#endif
-}
-
-#if GTEST_HAS_STREAM_REDIRECTION
-
-// Defines the stderr capturer:
-// CaptureStdout - starts capturing stdout.
-// GetCapturedStdout - stops capturing stdout and returns the captured string.
-// CaptureStderr - starts capturing stderr.
-// GetCapturedStderr - stops capturing stderr and returns the captured string.
-//
-GTEST_API_ void CaptureStdout();
-GTEST_API_ std::string GetCapturedStdout();
-GTEST_API_ void CaptureStderr();
-GTEST_API_ std::string GetCapturedStderr();
-
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
-// Returns the size (in bytes) of a file.
-GTEST_API_ size_t GetFileSize(FILE* file);
-
-// Reads the entire content of a file as a string.
-GTEST_API_ std::string ReadEntireFile(FILE* file);
-
-// All command line arguments.
-GTEST_API_ const ::std::vector<testing::internal::string>& GetArgvs();
-
-#if GTEST_HAS_DEATH_TEST
-
-const ::std::vector<testing::internal::string>& GetInjectableArgvs();
-void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
- new_argvs);
-
-
-#endif // GTEST_HAS_DEATH_TEST
-
-// Defines synchronization primitives.
-#if GTEST_IS_THREADSAFE
-# if GTEST_HAS_PTHREAD
-// Sleeps for (roughly) n milliseconds. This function is only for testing
-// Google Test's own constructs. Don't use it in user tests, either
-// directly or indirectly.
-inline void SleepMilliseconds(int n) {
- const timespec time = {
- 0, // 0 seconds.
- n * 1000L * 1000L, // And n ms.
- };
- nanosleep(&time, NULL);
-}
-# endif // GTEST_HAS_PTHREAD
-
-# if GTEST_HAS_NOTIFICATION_
-// Notification has already been imported into the namespace.
-// Nothing to do here.
-
-# elif GTEST_HAS_PTHREAD
-// Allows a controller thread to pause execution of newly created
-// threads until notified. Instances of this class must be created
-// and destroyed in the controller thread.
-//
-// This class is only for testing Google Test's own constructs. Do not
-// use it in user tests, either directly or indirectly.
-class Notification {
- public:
- Notification() : notified_(false) {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
- }
- ~Notification() {
- pthread_mutex_destroy(&mutex_);
- }
-
- // Notifies all threads created with this notification to start. Must
- // be called from the controller thread.
- void Notify() {
- pthread_mutex_lock(&mutex_);
- notified_ = true;
- pthread_mutex_unlock(&mutex_);
- }
-
- // Blocks until the controller thread notifies. Must be called from a test
- // thread.
- void WaitForNotification() {
- for (;;) {
- pthread_mutex_lock(&mutex_);
- const bool notified = notified_;
- pthread_mutex_unlock(&mutex_);
- if (notified)
- break;
- SleepMilliseconds(10);
- }
- }
-
- private:
- pthread_mutex_t mutex_;
- bool notified_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
-};
-
-# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
-
-GTEST_API_ void SleepMilliseconds(int n);
-
-// Provides leak-safe Windows kernel handle ownership.
-// Used in death tests and in threading support.
-class GTEST_API_ AutoHandle {
- public:
- // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to
- // avoid including <windows.h> in this header file. Including <windows.h> is
- // undesirable because it defines a lot of symbols and macros that tend to
- // conflict with client code. This assumption is verified by
- // WindowsTypesTest.HANDLEIsVoidStar.
- typedef void* Handle;
- AutoHandle();
- explicit AutoHandle(Handle handle);
-
- ~AutoHandle();
-
- Handle Get() const;
- void Reset();
- void Reset(Handle handle);
-
- private:
- // Returns true iff the handle is a valid handle object that can be closed.
- bool IsCloseable() const;
-
- Handle handle_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
-};
-
-// Allows a controller thread to pause execution of newly created
-// threads until notified. Instances of this class must be created
-// and destroyed in the controller thread.
-//
-// This class is only for testing Google Test's own constructs. Do not
-// use it in user tests, either directly or indirectly.
-class GTEST_API_ Notification {
- public:
- Notification();
- void Notify();
- void WaitForNotification();
-
- private:
- AutoHandle event_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification);
-};
-# endif // GTEST_HAS_NOTIFICATION_
-
-// On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD
-// defined, but we don't want to use MinGW's pthreads implementation, which
-// has conformance problems with some versions of the POSIX standard.
-# if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW
-
-// As a C-function, ThreadFuncWithCLinkage cannot be templated itself.
-// Consequently, it cannot select a correct instantiation of ThreadWithParam
-// in order to call its Run(). Introducing ThreadWithParamBase as a
-// non-templated base class for ThreadWithParam allows us to bypass this
-// problem.
-class ThreadWithParamBase {
- public:
- virtual ~ThreadWithParamBase() {}
- virtual void Run() = 0;
-};
-
-// pthread_create() accepts a pointer to a function type with the C linkage.
-// According to the Standard (7.5/1), function types with different linkages
-// are different even if they are otherwise identical. Some compilers (for
-// example, SunStudio) treat them as different types. Since class methods
-// cannot be defined with C-linkage we need to define a free C-function to
-// pass into pthread_create().
-extern "C" inline void* ThreadFuncWithCLinkage(void* thread) {
- static_cast<ThreadWithParamBase*>(thread)->Run();
- return NULL;
-}
-
-// Helper class for testing Google Test's multi-threading constructs.
-// To use it, write:
-//
-// void ThreadFunc(int param) { /* Do things with param */ }
-// Notification thread_can_start;
-// ...
-// // The thread_can_start parameter is optional; you can supply NULL.
-// ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start);
-// thread_can_start.Notify();
-//
-// These classes are only for testing Google Test's own constructs. Do
-// not use them in user tests, either directly or indirectly.
-template <typename T>
-class ThreadWithParam : public ThreadWithParamBase {
- public:
- typedef void UserThreadFunc(T);
-
- ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
- : func_(func),
- param_(param),
- thread_can_start_(thread_can_start),
- finished_(false) {
- ThreadWithParamBase* const base = this;
- // The thread can be created only after all fields except thread_
- // have been initialized.
- GTEST_CHECK_POSIX_SUCCESS_(
- pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
- }
- ~ThreadWithParam() { Join(); }
-
- void Join() {
- if (!finished_) {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0));
- finished_ = true;
- }
- }
-
- virtual void Run() {
- if (thread_can_start_ != NULL)
- thread_can_start_->WaitForNotification();
- func_(param_);
- }
-
- private:
- UserThreadFunc* const func_; // User-supplied thread function.
- const T param_; // User-supplied parameter to the thread function.
- // When non-NULL, used to block execution until the controller thread
- // notifies.
- Notification* const thread_can_start_;
- bool finished_; // true iff we know that the thread function has finished.
- pthread_t thread_; // The native thread object.
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
-};
-# endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD ||
- // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
-
-# if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
-// Mutex and ThreadLocal have already been imported into the namespace.
-// Nothing to do here.
-
-# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
-
-// Mutex implements mutex on Windows platforms. It is used in conjunction
-// with class MutexLock:
-//
-// Mutex mutex;
-// ...
-// MutexLock lock(&mutex); // Acquires the mutex and releases it at the
-// // end of the current scope.
-//
-// A static Mutex *must* be defined or declared using one of the following
-// macros:
-// GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex);
-// GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex);
-//
-// (A non-static Mutex is defined/declared in the usual way).
-class GTEST_API_ Mutex {
- public:
- enum MutexType { kStatic = 0, kDynamic = 1 };
- // We rely on kStaticMutex being 0 as it is to what the linker initializes
- // type_ in static mutexes. critical_section_ will be initialized lazily
- // in ThreadSafeLazyInit().
- enum StaticConstructorSelector { kStaticMutex = 0 };
-
- // This constructor intentionally does nothing. It relies on type_ being
- // statically initialized to 0 (effectively setting it to kStatic) and on
- // ThreadSafeLazyInit() to lazily initialize the rest of the members.
- explicit Mutex(StaticConstructorSelector /*dummy*/) {}
-
- Mutex();
- ~Mutex();
-
- void Lock();
-
- void Unlock();
-
- // Does nothing if the current thread holds the mutex. Otherwise, crashes
- // with high probability.
- void AssertHeld();
-
- private:
- // Initializes owner_thread_id_ and critical_section_ in static mutexes.
- void ThreadSafeLazyInit();
-
- // Per http://blogs.msdn.com/b/oldnewthing/archive/2004/02/23/78395.aspx,
- // we assume that 0 is an invalid value for thread IDs.
- unsigned int owner_thread_id_;
-
- // For static mutexes, we rely on these members being initialized to zeros
- // by the linker.
- MutexType type_;
- long critical_section_init_phase_; // NOLINT
- GTEST_CRITICAL_SECTION* critical_section_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
-};
-
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
- extern ::testing::internal::Mutex mutex
-
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
- ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex)
-
-// We cannot name this class MutexLock because the ctor declaration would
-// conflict with a macro named MutexLock, which is defined on some
-// platforms. That macro is used as a defensive measure to prevent against
-// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
-// "MutexLock l(&mu)". Hence the typedef trick below.
-class GTestMutexLock {
- public:
- explicit GTestMutexLock(Mutex* mutex)
- : mutex_(mutex) { mutex_->Lock(); }
-
- ~GTestMutexLock() { mutex_->Unlock(); }
-
- private:
- Mutex* const mutex_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
-};
-
-typedef GTestMutexLock MutexLock;
-
-// Base class for ValueHolder<T>. Allows a caller to hold and delete a value
-// without knowing its type.
-class ThreadLocalValueHolderBase {
- public:
- virtual ~ThreadLocalValueHolderBase() {}
-};
-
-// Provides a way for a thread to send notifications to a ThreadLocal
-// regardless of its parameter type.
-class ThreadLocalBase {
- public:
- // Creates a new ValueHolder<T> object holding a default value passed to
- // this ThreadLocal<T>'s constructor and returns it. It is the caller's
- // responsibility not to call this when the ThreadLocal<T> instance already
- // has a value on the current thread.
- virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0;
-
- protected:
- ThreadLocalBase() {}
- virtual ~ThreadLocalBase() {}
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase);
-};
-
-// Maps a thread to a set of ThreadLocals that have values instantiated on that
-// thread and notifies them when the thread exits. A ThreadLocal instance is
-// expected to persist until all threads it has values on have terminated.
-class GTEST_API_ ThreadLocalRegistry {
- public:
- // Registers thread_local_instance as having value on the current thread.
- // Returns a value that can be used to identify the thread from other threads.
- static ThreadLocalValueHolderBase* GetValueOnCurrentThread(
- const ThreadLocalBase* thread_local_instance);
-
- // Invoked when a ThreadLocal instance is destroyed.
- static void OnThreadLocalDestroyed(
- const ThreadLocalBase* thread_local_instance);
-};
-
-class GTEST_API_ ThreadWithParamBase {
- public:
- void Join();
-
- protected:
- class Runnable {
- public:
- virtual ~Runnable() {}
- virtual void Run() = 0;
- };
-
- ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start);
- virtual ~ThreadWithParamBase();
-
- private:
- AutoHandle thread_;
-};
-
-// Helper class for testing Google Test's multi-threading constructs.
-template <typename T>
-class ThreadWithParam : public ThreadWithParamBase {
- public:
- typedef void UserThreadFunc(T);
-
- ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
- : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {
- }
- virtual ~ThreadWithParam() {}
-
- private:
- class RunnableImpl : public Runnable {
- public:
- RunnableImpl(UserThreadFunc* func, T param)
- : func_(func),
- param_(param) {
- }
- virtual ~RunnableImpl() {}
- virtual void Run() {
- func_(param_);
- }
-
- private:
- UserThreadFunc* const func_;
- const T param_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl);
- };
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam);
-};
-
-// Implements thread-local storage on Windows systems.
-//
-// // Thread 1
-// ThreadLocal<int> tl(100); // 100 is the default value for each thread.
-//
-// // Thread 2
-// tl.set(150); // Changes the value for thread 2 only.
-// EXPECT_EQ(150, tl.get());
-//
-// // Thread 1
-// EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value.
-// tl.set(200);
-// EXPECT_EQ(200, tl.get());
-//
-// The template type argument T must have a public copy constructor.
-// In addition, the default ThreadLocal constructor requires T to have
-// a public default constructor.
-//
-// The users of a TheadLocal instance have to make sure that all but one
-// threads (including the main one) using that instance have exited before
-// destroying it. Otherwise, the per-thread objects managed for them by the
-// ThreadLocal instance are not guaranteed to be destroyed on all platforms.
-//
-// Google Test only uses global ThreadLocal objects. That means they
-// will die after main() has returned. Therefore, no per-thread
-// object managed by Google Test will be leaked as long as all threads
-// using Google Test have exited when main() returns.
-template <typename T>
-class ThreadLocal : public ThreadLocalBase {
- public:
- ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {}
- explicit ThreadLocal(const T& value)
- : default_factory_(new InstanceValueHolderFactory(value)) {}
-
- ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); }
-
- T* pointer() { return GetOrCreateValue(); }
- const T* pointer() const { return GetOrCreateValue(); }
- const T& get() const { return *pointer(); }
- void set(const T& value) { *pointer() = value; }
-
- private:
- // Holds a value of T. Can be deleted via its base class without the caller
- // knowing the type of T.
- class ValueHolder : public ThreadLocalValueHolderBase {
- public:
- ValueHolder() : value_() {}
- explicit ValueHolder(const T& value) : value_(value) {}
-
- T* pointer() { return &value_; }
-
- private:
- T value_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
- };
-
-
- T* GetOrCreateValue() const {
- return static_cast<ValueHolder*>(
- ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer();
- }
-
- virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const {
- return default_factory_->MakeNewHolder();
- }
-
- class ValueHolderFactory {
- public:
- ValueHolderFactory() {}
- virtual ~ValueHolderFactory() {}
- virtual ValueHolder* MakeNewHolder() const = 0;
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
- };
-
- class DefaultValueHolderFactory : public ValueHolderFactory {
- public:
- DefaultValueHolderFactory() {}
- virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
- };
-
- class InstanceValueHolderFactory : public ValueHolderFactory {
- public:
- explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
- virtual ValueHolder* MakeNewHolder() const {
- return new ValueHolder(value_);
- }
-
- private:
- const T value_; // The value for each thread.
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
- };
-
- scoped_ptr<ValueHolderFactory> default_factory_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
-};
-
-# elif GTEST_HAS_PTHREAD
-
-// MutexBase and Mutex implement mutex on pthreads-based platforms.
-class MutexBase {
- public:
- // Acquires this mutex.
- void Lock() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
- owner_ = pthread_self();
- has_owner_ = true;
- }
-
- // Releases this mutex.
- void Unlock() {
- // Since the lock is being released the owner_ field should no longer be
- // considered valid. We don't protect writing to has_owner_ here, as it's
- // the caller's responsibility to ensure that the current thread holds the
- // mutex when this is called.
- has_owner_ = false;
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
- }
-
- // Does nothing if the current thread holds the mutex. Otherwise, crashes
- // with high probability.
- void AssertHeld() const {
- GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
- << "The current thread is not holding the mutex @" << this;
- }
-
- // A static mutex may be used before main() is entered. It may even
- // be used before the dynamic initialization stage. Therefore we
- // must be able to initialize a static mutex object at link time.
- // This means MutexBase has to be a POD and its member variables
- // have to be public.
- public:
- pthread_mutex_t mutex_; // The underlying pthread mutex.
- // has_owner_ indicates whether the owner_ field below contains a valid thread
- // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All
- // accesses to the owner_ field should be protected by a check of this field.
- // An alternative might be to memset() owner_ to all zeros, but there's no
- // guarantee that a zero'd pthread_t is necessarily invalid or even different
- // from pthread_self().
- bool has_owner_;
- pthread_t owner_; // The thread holding the mutex.
-};
-
-// Forward-declares a static mutex.
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
- extern ::testing::internal::MutexBase mutex
-
-// Defines and statically (i.e. at link time) initializes a static mutex.
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
- ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, pthread_t() }
-
-// The Mutex class can only be used for mutexes created at runtime. It
-// shares its API with MutexBase otherwise.
-class Mutex : public MutexBase {
- public:
- Mutex() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
- has_owner_ = false;
- }
- ~Mutex() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
- }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
-};
-
-// We cannot name this class MutexLock because the ctor declaration would
-// conflict with a macro named MutexLock, which is defined on some
-// platforms. That macro is used as a defensive measure to prevent against
-// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
-// "MutexLock l(&mu)". Hence the typedef trick below.
-class GTestMutexLock {
- public:
- explicit GTestMutexLock(MutexBase* mutex)
- : mutex_(mutex) { mutex_->Lock(); }
-
- ~GTestMutexLock() { mutex_->Unlock(); }
-
- private:
- MutexBase* const mutex_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock);
-};
-
-typedef GTestMutexLock MutexLock;
-
-// Helpers for ThreadLocal.
-
-// pthread_key_create() requires DeleteThreadLocalValue() to have
-// C-linkage. Therefore it cannot be templatized to access
-// ThreadLocal<T>. Hence the need for class
-// ThreadLocalValueHolderBase.
-class ThreadLocalValueHolderBase {
- public:
- virtual ~ThreadLocalValueHolderBase() {}
-};
-
-// Called by pthread to delete thread-local data stored by
-// pthread_setspecific().
-extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
- delete static_cast<ThreadLocalValueHolderBase*>(value_holder);
-}
-
-// Implements thread-local storage on pthreads-based systems.
-template <typename T>
-class ThreadLocal {
- public:
- ThreadLocal()
- : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
- explicit ThreadLocal(const T& value)
- : key_(CreateKey()),
- default_factory_(new InstanceValueHolderFactory(value)) {}
-
- ~ThreadLocal() {
- // Destroys the managed object for the current thread, if any.
- DeleteThreadLocalValue(pthread_getspecific(key_));
-
- // Releases resources associated with the key. This will *not*
- // delete managed objects for other threads.
- GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_));
- }
-
- T* pointer() { return GetOrCreateValue(); }
- const T* pointer() const { return GetOrCreateValue(); }
- const T& get() const { return *pointer(); }
- void set(const T& value) { *pointer() = value; }
-
- private:
- // Holds a value of type T.
- class ValueHolder : public ThreadLocalValueHolderBase {
- public:
- ValueHolder() : value_() {}
- explicit ValueHolder(const T& value) : value_(value) {}
-
- T* pointer() { return &value_; }
-
- private:
- T value_;
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder);
- };
-
- static pthread_key_t CreateKey() {
- pthread_key_t key;
- // When a thread exits, DeleteThreadLocalValue() will be called on
- // the object managed for that thread.
- GTEST_CHECK_POSIX_SUCCESS_(
- pthread_key_create(&key, &DeleteThreadLocalValue));
- return key;
- }
-
- T* GetOrCreateValue() const {
- ThreadLocalValueHolderBase* const holder =
- static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_));
- if (holder != NULL) {
- return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
- }
-
- ValueHolder* const new_holder = default_factory_->MakeNewHolder();
- ThreadLocalValueHolderBase* const holder_base = new_holder;
- GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base));
- return new_holder->pointer();
- }
-
- class ValueHolderFactory {
- public:
- ValueHolderFactory() {}
- virtual ~ValueHolderFactory() {}
- virtual ValueHolder* MakeNewHolder() const = 0;
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory);
- };
-
- class DefaultValueHolderFactory : public ValueHolderFactory {
- public:
- DefaultValueHolderFactory() {}
- virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); }
-
- private:
- GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory);
- };
-
- class InstanceValueHolderFactory : public ValueHolderFactory {
- public:
- explicit InstanceValueHolderFactory(const T& value) : value_(value) {}
- virtual ValueHolder* MakeNewHolder() const {
- return new ValueHolder(value_);
- }
-
- private:
- const T value_; // The value for each thread.
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory);
- };
-
- // A key pthreads uses for looking up per-thread values.
- const pthread_key_t key_;
- scoped_ptr<ValueHolderFactory> default_factory_;
-
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
-};
-
-# endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
-
-#else // GTEST_IS_THREADSAFE
-
-// A dummy implementation of synchronization primitives (mutex, lock,
-// and thread-local variable). Necessary for compiling Google Test where
-// mutex is not supported - using Google Test in multiple threads is not
-// supported on such platforms.
-
-class Mutex {
- public:
- Mutex() {}
- void Lock() {}
- void Unlock() {}
- void AssertHeld() const {}
-};
-
-# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
- extern ::testing::internal::Mutex mutex
-
-# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
-
-// We cannot name this class MutexLock because the ctor declaration would
-// conflict with a macro named MutexLock, which is defined on some
-// platforms. That macro is used as a defensive measure to prevent against
-// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than
-// "MutexLock l(&mu)". Hence the typedef trick below.
-class GTestMutexLock {
- public:
- explicit GTestMutexLock(Mutex*) {} // NOLINT
-};
-
-typedef GTestMutexLock MutexLock;
-
-template <typename T>
-class ThreadLocal {
- public:
- ThreadLocal() : value_() {}
- explicit ThreadLocal(const T& value) : value_(value) {}
- T* pointer() { return &value_; }
- const T* pointer() const { return &value_; }
- const T& get() const { return value_; }
- void set(const T& value) { value_ = value; }
- private:
- T value_;
-};
-
-#endif // GTEST_IS_THREADSAFE
-
-// Returns the number of threads running in the process, or 0 to indicate that
-// we cannot detect it.
-GTEST_API_ size_t GetThreadCount();
-
-// Passing non-POD classes through ellipsis (...) crashes the ARM
-// compiler and generates a warning in Sun Studio. The Nokia Symbian
-// and the IBM XL C/C++ compiler try to instantiate a copy constructor
-// for objects passed through ellipsis (...), failing for uncopyable
-// objects. We define this to ensure that only POD is passed through
-// ellipsis on these systems.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
-// We lose support for NULL detection where the compiler doesn't like
-// passing non-POD classes through ellipsis (...).
-# define GTEST_ELLIPSIS_NEEDS_POD_ 1
-#else
-# define GTEST_CAN_COMPARE_NULL 1
-#endif
-
-// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
-// const T& and const T* in a function template. These compilers
-// _can_ decide between class template specializations for T and T*,
-// so a tr1::type_traits-like is_pointer works.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__)
-# define GTEST_NEEDS_IS_POINTER_ 1
-#endif
-
-template <bool bool_value>
-struct bool_constant {
- typedef bool_constant<bool_value> type;
- static const bool value = bool_value;
-};
-template <bool bool_value> const bool bool_constant<bool_value>::value;
-
-typedef bool_constant<false> false_type;
-typedef bool_constant<true> true_type;
-
-template <typename T>
-struct is_pointer : public false_type {};
-
-template <typename T>
-struct is_pointer<T*> : public true_type {};
-
-template <typename Iterator>
-struct IteratorTraits {
- typedef typename Iterator::value_type value_type;
-};
-
-template <typename T>
-struct IteratorTraits<T*> {
- typedef T value_type;
-};
-
-template <typename T>
-struct IteratorTraits<const T*> {
- typedef T value_type;
-};
-
-#if GTEST_OS_WINDOWS
-# define GTEST_PATH_SEP_ "\\"
-# define GTEST_HAS_ALT_PATH_SEP_ 1
-// The biggest signed integer type the compiler supports.
-typedef __int64 BiggestInt;
-#else
-# define GTEST_PATH_SEP_ "/"
-# define GTEST_HAS_ALT_PATH_SEP_ 0
-typedef long long BiggestInt; // NOLINT
-#endif // GTEST_OS_WINDOWS
-
-// Utilities for char.
-
-// isspace(int ch) and friends accept an unsigned char or EOF. char
-// may be signed, depending on the compiler (or compiler flags).
-// Therefore we need to cast a char to unsigned char before calling
-// isspace(), etc.
-
-inline bool IsAlpha(char ch) {
- return isalpha(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsAlNum(char ch) {
- return isalnum(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsDigit(char ch) {
- return isdigit(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsLower(char ch) {
- return islower(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsSpace(char ch) {
- return isspace(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsUpper(char ch) {
- return isupper(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsXDigit(char ch) {
- return isxdigit(static_cast<unsigned char>(ch)) != 0;
-}
-inline bool IsXDigit(wchar_t ch) {
- const unsigned char low_byte = static_cast<unsigned char>(ch);
- return ch == low_byte && isxdigit(low_byte) != 0;
-}
-
-inline char ToLower(char ch) {
- return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
-}
-inline char ToUpper(char ch) {
- return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
-}
-
-inline std::string StripTrailingSpaces(std::string str) {
- std::string::iterator it = str.end();
- while (it != str.begin() && IsSpace(*--it))
- it = str.erase(it);
- return str;
-}
-
-// The testing::internal::posix namespace holds wrappers for common
-// POSIX functions. These wrappers hide the differences between
-// Windows/MSVC and POSIX systems. Since some compilers define these
-// standard functions as macros, the wrapper cannot have the same name
-// as the wrapped function.
-
-namespace posix {
-
-// Functions with a different name on Windows.
-
-#if GTEST_OS_WINDOWS
-
-typedef struct _stat StatStruct;
-
-# ifdef __BORLANDC__
-inline int IsATTY(int fd) { return isatty(fd); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return stricmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-# else // !__BORLANDC__
-# if GTEST_OS_WINDOWS_MOBILE
-inline int IsATTY(int /* fd */) { return 0; }
-# else
-inline int IsATTY(int fd) { return _isatty(fd); }
-# endif // GTEST_OS_WINDOWS_MOBILE
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return _stricmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return _strdup(src); }
-# endif // __BORLANDC__
-
-# if GTEST_OS_WINDOWS_MOBILE
-inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
-// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
-// time and thus not defined there.
-# else
-inline int FileNo(FILE* file) { return _fileno(file); }
-inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
-inline int RmDir(const char* dir) { return _rmdir(dir); }
-inline bool IsDir(const StatStruct& st) {
- return (_S_IFDIR & st.st_mode) != 0;
-}
-# endif // GTEST_OS_WINDOWS_MOBILE
-
-#else
-
-typedef struct stat StatStruct;
-
-inline int FileNo(FILE* file) { return fileno(file); }
-inline int IsATTY(int fd) { return isatty(fd); }
-inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return strcasecmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-inline int RmDir(const char* dir) { return rmdir(dir); }
-inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
-
-#endif // GTEST_OS_WINDOWS
-
-// Functions deprecated by MSVC 8.0.
-
-GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */)
-
-inline const char* StrNCpy(char* dest, const char* src, size_t n) {
- return strncpy(dest, src, n);
-}
-
-// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
-// StrError() aren't needed on Windows CE at this time and thus not
-// defined there.
-
-#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
-inline int ChDir(const char* dir) { return chdir(dir); }
-#endif
-inline FILE* FOpen(const char* path, const char* mode) {
- return fopen(path, mode);
-}
-#if !GTEST_OS_WINDOWS_MOBILE
-inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
- return freopen(path, mode, stream);
-}
-inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
-#endif
-inline int FClose(FILE* fp) { return fclose(fp); }
-#if !GTEST_OS_WINDOWS_MOBILE
-inline int Read(int fd, void* buf, unsigned int count) {
- return static_cast<int>(read(fd, buf, count));
-}
-inline int Write(int fd, const void* buf, unsigned int count) {
- return static_cast<int>(write(fd, buf, count));
-}
-inline int Close(int fd) { return close(fd); }
-inline const char* StrError(int errnum) { return strerror(errnum); }
-#endif
-inline const char* GetEnv(const char* name) {
-#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE | GTEST_OS_WINDOWS_RT
- // We are on Windows CE, which has no environment variables.
- static_cast<void>(name); // To prevent 'unused argument' warning.
- return NULL;
-#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9)
- // Environment variables which we programmatically clear will be set to the
- // empty string rather than unset (NULL). Handle that case.
- const char* const env = getenv(name);
- return (env != NULL && env[0] != '\0') ? env : NULL;
-#else
- return getenv(name);
-#endif
-}
-
-GTEST_DISABLE_MSC_WARNINGS_POP_()
-
-#if GTEST_OS_WINDOWS_MOBILE
-// Windows CE has no C library. The abort() function is used in
-// several places in Google Test. This implementation provides a reasonable
-// imitation of standard behaviour.
-void Abort();
-#else
-inline void Abort() { abort(); }
-#endif // GTEST_OS_WINDOWS_MOBILE
-
-} // namespace posix
-
-// MSVC "deprecates" snprintf and issues warnings wherever it is used. In
-// order to avoid these warnings, we need to use _snprintf or _snprintf_s on
-// MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate
-// function in order to achieve that. We use macro definition here because
-// snprintf is a variadic function.
-#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
-// MSVC 2005 and above support variadic macros.
-# define GTEST_SNPRINTF_(buffer, size, format, ...) \
- _snprintf_s(buffer, size, size, format, __VA_ARGS__)
-#elif defined(_MSC_VER)
-// Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't
-// complain about _snprintf.
-# define GTEST_SNPRINTF_ _snprintf
-#else
-# define GTEST_SNPRINTF_ snprintf
-#endif
-
-// The maximum number a BiggestInt can represent. This definition
-// works no matter BiggestInt is represented in one's complement or
-// two's complement.
-//
-// We cannot rely on numeric_limits in STL, as __int64 and long long
-// are not part of standard C++ and numeric_limits doesn't need to be
-// defined for them.
-const BiggestInt kMaxBiggestInt =
- ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1));
-
-// This template class serves as a compile-time function from size to
-// type. It maps a size in bytes to a primitive type with that
-// size. e.g.
-//
-// TypeWithSize<4>::UInt
-//
-// is typedef-ed to be unsigned int (unsigned integer made up of 4
-// bytes).
-//
-// Such functionality should belong to STL, but I cannot find it
-// there.
-//
-// Google Test uses this class in the implementation of floating-point
-// comparison.
-//
-// For now it only handles UInt (unsigned int) as that's all Google Test
-// needs. Other types can be easily added in the future if need
-// arises.
-template <size_t size>
-class TypeWithSize {
- public:
- // This prevents the user from using TypeWithSize<N> with incorrect
- // values of N.
- typedef void UInt;
-};
-
-// The specialization for size 4.
-template <>
-class TypeWithSize<4> {
- public:
- // unsigned int has size 4 in both gcc and MSVC.
- //
- // As base/basictypes.h doesn't compile on Windows, we cannot use
- // uint32, uint64, and etc here.
- typedef int Int;
- typedef unsigned int UInt;
-};
-
-// The specialization for size 8.
-template <>
-class TypeWithSize<8> {
- public:
-#if GTEST_OS_WINDOWS
- typedef __int64 Int;
- typedef unsigned __int64 UInt;
-#else
- typedef long long Int; // NOLINT
- typedef unsigned long long UInt; // NOLINT
-#endif // GTEST_OS_WINDOWS
-};
-
-// Integer types of known sizes.
-typedef TypeWithSize<4>::Int Int32;
-typedef TypeWithSize<4>::UInt UInt32;
-typedef TypeWithSize<8>::Int Int64;
-typedef TypeWithSize<8>::UInt UInt64;
-typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
-
-// Utilities for command line flags and environment variables.
-
-// Macro for referencing flags.
-#if !defined(GTEST_FLAG)
-# define GTEST_FLAG(name) FLAGS_gtest_##name
-#endif // !defined(GTEST_FLAG)
-
-#if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
-# define GTEST_USE_OWN_FLAGFILE_FLAG_ 1
-#endif // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
-
-#if !defined(GTEST_DECLARE_bool_)
-# define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
-
-// Macros for declaring flags.
-# define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
-# define GTEST_DECLARE_int32_(name) \
- GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name)
-#define GTEST_DECLARE_string_(name) \
- GTEST_API_ extern ::std::string GTEST_FLAG(name)
-
-// Macros for defining flags.
-#define GTEST_DEFINE_bool_(name, default_val, doc) \
- GTEST_API_ bool GTEST_FLAG(name) = (default_val)
-#define GTEST_DEFINE_int32_(name, default_val, doc) \
- GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
-#define GTEST_DEFINE_string_(name, default_val, doc) \
- GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
-
-#endif // !defined(GTEST_DECLARE_bool_)
-
-// Thread annotations
-#if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
-# define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
-# define GTEST_LOCK_EXCLUDED_(locks)
-#endif // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
-
-// Parses 'str' for a 32-bit signed integer. If successful, writes the result
-// to *value and returns true; otherwise leaves *value unchanged and returns
-// false.
-// TODO(chandlerc): Find a better way to refactor flag and environment parsing
-// out of both gtest-port.cc and gtest.cc to avoid exporting this utility
-// function.
-bool ParseInt32(const Message& src_text, const char* str, Int32* value);
-
-// Parses a bool/Int32/string from the environment variable
-// corresponding to the given Google Test flag.
-bool BoolFromGTestEnv(const char* flag, bool default_val);
-GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
-std::string StringFromGTestEnv(const char* flag, const char* default_val);
-
-} // namespace internal
-
-// Returns a path to temporary directory.
-// Tries to determine an appropriate directory for the platform.
-GTEST_API_ std::string TempDir();
-
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-string.h b/src/lib/install/include/gtest/internal/gtest-string.h
deleted file mode 100755
index 97f1a7f..0000000
--- a/src/lib/install/include/gtest/internal/gtest-string.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 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.
-//
-// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
-//
-// The Google C++ Testing Framework (Google Test)
-//
-// This header file declares the String class and functions used internally by
-// Google Test. They are subject to change without notice. They should not used
-// by code external to Google Test.
-//
-// This header file is #included by <gtest/internal/gtest-internal.h>.
-// It should not be #included by other files.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
-
-#ifdef __BORLANDC__
-// string.h is not guaranteed to provide strcpy on C++ Builder.
-# include <mem.h>
-#endif
-
-#include <string.h>
-#include <string>
-
-#include "gtest/internal/gtest-port.h"
-
-namespace testing {
-namespace internal {
-
-// String - an abstract class holding static string utilities.
-class GTEST_API_ String {
- public:
- // Static utility methods
-
- // Clones a 0-terminated C string, allocating memory using new. The
- // caller is responsible for deleting the return value using
- // delete[]. Returns the cloned string, or NULL if the input is
- // NULL.
- //
- // This is different from strdup() in string.h, which allocates
- // memory using malloc().
- static const char* CloneCString(const char* c_str);
-
-#if GTEST_OS_WINDOWS_MOBILE
- // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
- // able to pass strings to Win32 APIs on CE we need to convert them
- // to 'Unicode', UTF-16.
-
- // Creates a UTF-16 wide string from the given ANSI string, allocating
- // memory using new. The caller is responsible for deleting the return
- // value using delete[]. Returns the wide string, or NULL if the
- // input is NULL.
- //
- // The wide string is created using the ANSI codepage (CP_ACP) to
- // match the behaviour of the ANSI versions of Win32 calls and the
- // C runtime.
- static LPCWSTR AnsiToUtf16(const char* c_str);
-
- // Creates an ANSI string from the given wide string, allocating
- // memory using new. The caller is responsible for deleting the return
- // value using delete[]. Returns the ANSI string, or NULL if the
- // input is NULL.
- //
- // The returned string is created using the ANSI codepage (CP_ACP) to
- // match the behaviour of the ANSI versions of Win32 calls and the
- // C runtime.
- static const char* Utf16ToAnsi(LPCWSTR utf16_str);
-#endif
-
- // Compares two C strings. Returns true iff they have the same content.
- //
- // Unlike strcmp(), this function can handle NULL argument(s). A
- // NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool CStringEquals(const char* lhs, const char* rhs);
-
- // Converts a wide C string to a String using the UTF-8 encoding.
- // NULL will be converted to "(null)". If an error occurred during
- // the conversion, "(failed to convert from wide string)" is
- // returned.
- static std::string ShowWideCString(const wchar_t* wide_c_str);
-
- // Compares two wide C strings. Returns true iff they have the same
- // content.
- //
- // Unlike wcscmp(), this function can handle NULL argument(s). A
- // NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
-
- // Compares two C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike strcasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL C string,
- // including the empty string.
- static bool CaseInsensitiveCStringEquals(const char* lhs,
- const char* rhs);
-
- // Compares two wide C strings, ignoring case. Returns true iff they
- // have the same content.
- //
- // Unlike wcscasecmp(), this function can handle NULL argument(s).
- // A NULL C string is considered different to any non-NULL wide C string,
- // including the empty string.
- // NB: The implementations on different platforms slightly differ.
- // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
- // environment variable. On GNU platform this method uses wcscasecmp
- // which compares according to LC_CTYPE category of the current locale.
- // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
- // current locale.
- static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
- const wchar_t* rhs);
-
- // Returns true iff the given string ends with the given suffix, ignoring
- // case. Any string is considered to end with an empty suffix.
- static bool EndsWithCaseInsensitive(
- const std::string& str, const std::string& suffix);
-
- // Formats an int value as "%02d".
- static std::string FormatIntWidth2(int value); // "%02d" for width == 2
-
- // Formats an int value as "%X".
- static std::string FormatHexInt(int value);
-
- // Formats a byte as "%02X".
- static std::string FormatByte(unsigned char value);
-
- private:
- String(); // Not meant to be instantiated.
-}; // class String
-
-// Gets the content of the stringstream's buffer as an std::string. Each '\0'
-// character in the buffer is replaced with "\\0".
-GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-tuple.h b/src/lib/install/include/gtest/internal/gtest-tuple.h
deleted file mode 100755
index e9b4053..0000000
--- a/src/lib/install/include/gtest/internal/gtest-tuple.h
+++ /dev/null
@@ -1,1020 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-tuple.h.pump
-// DO NOT EDIT BY HAND!!!
-
-// Copyright 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: wan@google.com (Zhanyong Wan)
-
-// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-
-#include <utility> // For ::std::pair.
-
-// The compiler used in Symbian has a bug that prevents us from declaring the
-// tuple template as a friend (it complains that tuple is redefined). This
-// hack bypasses the bug by declaring the members that should otherwise be
-// private as public.
-// Sun Studio versions < 12 also have the above bug.
-#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
-#else
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
- template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
- private:
-#endif
-
-// 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.
-#if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */
-# error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \
-GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers."
-#endif
-
-// GTEST_n_TUPLE_(T) is the type of an n-tuple.
-#define GTEST_0_TUPLE_(T) tuple<>
-#define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
- void, void, void>
-#define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
- void, void, void>
-#define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
- void, void, void>
-#define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
- void, void, void>
-#define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
- void, void, void>
-#define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
- void, void, void>
-#define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- void, void, void>
-#define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, void, void>
-#define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, T##8, void>
-#define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
- T##7, T##8, T##9>
-
-// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
-#define GTEST_0_TYPENAMES_(T)
-#define GTEST_1_TYPENAMES_(T) typename T##0
-#define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
-#define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
-#define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3
-#define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4
-#define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5
-#define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6
-#define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
-#define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, \
- typename T##7, typename T##8
-#define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
- typename T##3, typename T##4, typename T##5, typename T##6, \
- typename T##7, typename T##8, typename T##9
-
-// In theory, defining stuff in the ::std namespace is undefined
-// behavior. We can do this as we are playing the role of a standard
-// library vendor.
-namespace std {
-namespace tr1 {
-
-template <typename T0 = void, typename T1 = void, typename T2 = void,
- typename T3 = void, typename T4 = void, typename T5 = void,
- typename T6 = void, typename T7 = void, typename T8 = void,
- typename T9 = void>
-class tuple;
-
-// Anything in namespace gtest_internal is Google Test's INTERNAL
-// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
-namespace gtest_internal {
-
-// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
-template <typename T>
-struct ByRef { typedef const T& type; }; // NOLINT
-template <typename T>
-struct ByRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for ByRef.
-#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
-
-// AddRef<T>::type is T if T is a reference; otherwise it's T&. This
-// is the same as tr1::add_reference<T>::type.
-template <typename T>
-struct AddRef { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for AddRef.
-#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
-
-// A helper for implementing get<k>().
-template <int k> class Get;
-
-// A helper for implementing tuple_element<k, T>. kIndexValid is true
-// iff k < the number of fields in tuple type T.
-template <bool kIndexValid, int kIndex, class Tuple>
-struct TupleElement;
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > {
- typedef T0 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > {
- typedef T1 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > {
- typedef T2 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > {
- typedef T3 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > {
- typedef T4 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > {
- typedef T5 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > {
- typedef T6 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > {
- typedef T7 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > {
- typedef T8 type;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > {
- typedef T9 type;
-};
-
-} // namespace gtest_internal
-
-template <>
-class tuple<> {
- public:
- tuple() {}
- tuple(const tuple& /* t */) {}
- tuple& operator=(const tuple& /* t */) { return *this; }
-};
-
-template <GTEST_1_TYPENAMES_(T)>
-class GTEST_1_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
-
- tuple(const tuple& t) : f0_(t.f0_) {}
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_1_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
- f0_ = t.f0_;
- return *this;
- }
-
- T0 f0_;
-};
-
-template <GTEST_2_TYPENAMES_(T)>
-class GTEST_2_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
- f1_(f1) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
- template <typename U0, typename U1>
- tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
- template <typename U0, typename U1>
- tuple& operator=(const ::std::pair<U0, U1>& p) {
- f0_ = p.first;
- f1_ = p.second;
- return *this;
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_2_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
-};
-
-template <GTEST_3_TYPENAMES_(T)>
-class GTEST_3_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_3_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
-};
-
-template <GTEST_4_TYPENAMES_(T)>
-class GTEST_4_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_4_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
-};
-
-template <GTEST_5_TYPENAMES_(T)>
-class GTEST_5_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
- GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_) {}
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_5_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
-};
-
-template <GTEST_6_TYPENAMES_(T)>
-class GTEST_6_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_) {}
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_6_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
-};
-
-template <GTEST_7_TYPENAMES_(T)>
-class GTEST_7_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_7_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
-};
-
-template <GTEST_8_TYPENAMES_(T)>
-class GTEST_8_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
- GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5), f6_(f6), f7_(f7) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_8_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
-};
-
-template <GTEST_9_TYPENAMES_(T)>
-class GTEST_9_TUPLE_(T) {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
- GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
- f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_9_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- f8_ = t.f8_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
- T8 f8_;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-class tuple {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
- f9_() {}
-
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
- GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
- f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
-
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
- f9_(t.f9_) {}
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_10_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
- f0_ = t.f0_;
- f1_ = t.f1_;
- f2_ = t.f2_;
- f3_ = t.f3_;
- f4_ = t.f4_;
- f5_ = t.f5_;
- f6_ = t.f6_;
- f7_ = t.f7_;
- f8_ = t.f8_;
- f9_ = t.f9_;
- return *this;
- }
-
- T0 f0_;
- T1 f1_;
- T2 f2_;
- T3 f3_;
- T4 f4_;
- T5 f5_;
- T6 f6_;
- T7 f7_;
- T8 f8_;
- T9 f9_;
-};
-
-// 6.1.3.2 Tuple creation functions.
-
-// Known limitations: we don't support passing an
-// std::tr1::reference_wrapper<T> to make_tuple(). And we don't
-// implement tie().
-
-inline tuple<> make_tuple() { return tuple<>(); }
-
-template <GTEST_1_TYPENAMES_(T)>
-inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
- return GTEST_1_TUPLE_(T)(f0);
-}
-
-template <GTEST_2_TYPENAMES_(T)>
-inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
- return GTEST_2_TUPLE_(T)(f0, f1);
-}
-
-template <GTEST_3_TYPENAMES_(T)>
-inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
- return GTEST_3_TUPLE_(T)(f0, f1, f2);
-}
-
-template <GTEST_4_TYPENAMES_(T)>
-inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3) {
- return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
-}
-
-template <GTEST_5_TYPENAMES_(T)>
-inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4) {
- return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
-}
-
-template <GTEST_6_TYPENAMES_(T)>
-inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5) {
- return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
-}
-
-template <GTEST_7_TYPENAMES_(T)>
-inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
- return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
-}
-
-template <GTEST_8_TYPENAMES_(T)>
-inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
- return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
-}
-
-template <GTEST_9_TYPENAMES_(T)>
-inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
- const T8& f8) {
- return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
-}
-
-template <GTEST_10_TYPENAMES_(T)>
-inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
- const T8& f8, const T9& f9) {
- return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
-}
-
-// 6.1.3.3 Tuple helper classes.
-
-template <typename Tuple> struct tuple_size;
-
-template <GTEST_0_TYPENAMES_(T)>
-struct tuple_size<GTEST_0_TUPLE_(T) > {
- static const int value = 0;
-};
-
-template <GTEST_1_TYPENAMES_(T)>
-struct tuple_size<GTEST_1_TUPLE_(T) > {
- static const int value = 1;
-};
-
-template <GTEST_2_TYPENAMES_(T)>
-struct tuple_size<GTEST_2_TUPLE_(T) > {
- static const int value = 2;
-};
-
-template <GTEST_3_TYPENAMES_(T)>
-struct tuple_size<GTEST_3_TUPLE_(T) > {
- static const int value = 3;
-};
-
-template <GTEST_4_TYPENAMES_(T)>
-struct tuple_size<GTEST_4_TUPLE_(T) > {
- static const int value = 4;
-};
-
-template <GTEST_5_TYPENAMES_(T)>
-struct tuple_size<GTEST_5_TUPLE_(T) > {
- static const int value = 5;
-};
-
-template <GTEST_6_TYPENAMES_(T)>
-struct tuple_size<GTEST_6_TUPLE_(T) > {
- static const int value = 6;
-};
-
-template <GTEST_7_TYPENAMES_(T)>
-struct tuple_size<GTEST_7_TUPLE_(T) > {
- static const int value = 7;
-};
-
-template <GTEST_8_TYPENAMES_(T)>
-struct tuple_size<GTEST_8_TUPLE_(T) > {
- static const int value = 8;
-};
-
-template <GTEST_9_TYPENAMES_(T)>
-struct tuple_size<GTEST_9_TUPLE_(T) > {
- static const int value = 9;
-};
-
-template <GTEST_10_TYPENAMES_(T)>
-struct tuple_size<GTEST_10_TUPLE_(T) > {
- static const int value = 10;
-};
-
-template <int k, class Tuple>
-struct tuple_element {
- typedef typename gtest_internal::TupleElement<
- k < (tuple_size<Tuple>::value), k, Tuple>::type type;
-};
-
-#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
-
-// 6.1.3.4 Element access.
-
-namespace gtest_internal {
-
-template <>
-class Get<0> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
- Field(Tuple& t) { return t.f0_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
- ConstField(const Tuple& t) { return t.f0_; }
-};
-
-template <>
-class Get<1> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
- Field(Tuple& t) { return t.f1_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
- ConstField(const Tuple& t) { return t.f1_; }
-};
-
-template <>
-class Get<2> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
- Field(Tuple& t) { return t.f2_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
- ConstField(const Tuple& t) { return t.f2_; }
-};
-
-template <>
-class Get<3> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
- Field(Tuple& t) { return t.f3_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
- ConstField(const Tuple& t) { return t.f3_; }
-};
-
-template <>
-class Get<4> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
- Field(Tuple& t) { return t.f4_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
- ConstField(const Tuple& t) { return t.f4_; }
-};
-
-template <>
-class Get<5> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
- Field(Tuple& t) { return t.f5_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
- ConstField(const Tuple& t) { return t.f5_; }
-};
-
-template <>
-class Get<6> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
- Field(Tuple& t) { return t.f6_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
- ConstField(const Tuple& t) { return t.f6_; }
-};
-
-template <>
-class Get<7> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
- Field(Tuple& t) { return t.f7_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
- ConstField(const Tuple& t) { return t.f7_; }
-};
-
-template <>
-class Get<8> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
- Field(Tuple& t) { return t.f8_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
- ConstField(const Tuple& t) { return t.f8_; }
-};
-
-template <>
-class Get<9> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
- Field(Tuple& t) { return t.f9_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
- ConstField(const Tuple& t) { return t.f9_; }
-};
-
-} // namespace gtest_internal
-
-template <int k, GTEST_10_TYPENAMES_(T)>
-GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
-get(GTEST_10_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::Field(t);
-}
-
-template <int k, GTEST_10_TYPENAMES_(T)>
-GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
-get(const GTEST_10_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::ConstField(t);
-}
-
-// 6.1.3.5 Relational operators
-
-// We only implement == and !=, as we don't have a need for the rest yet.
-
-namespace gtest_internal {
-
-// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
-// first k fields of t1 equals the first k fields of t2.
-// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
-// k1 != k2.
-template <int kSize1, int kSize2>
-struct SameSizeTuplePrefixComparator;
-
-template <>
-struct SameSizeTuplePrefixComparator<0, 0> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
- return true;
- }
-};
-
-template <int k>
-struct SameSizeTuplePrefixComparator<k, k> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& t1, const Tuple2& t2) {
- return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
- ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
- }
-};
-
-} // namespace gtest_internal
-
-template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
-inline bool operator==(const GTEST_10_TUPLE_(T)& t,
- const GTEST_10_TUPLE_(U)& u) {
- return gtest_internal::SameSizeTuplePrefixComparator<
- tuple_size<GTEST_10_TUPLE_(T) >::value,
- tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u);
-}
-
-template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
-inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
- const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
-
-// 6.1.4 Pairs.
-// Unimplemented.
-
-} // namespace tr1
-} // namespace std
-
-#undef GTEST_0_TUPLE_
-#undef GTEST_1_TUPLE_
-#undef GTEST_2_TUPLE_
-#undef GTEST_3_TUPLE_
-#undef GTEST_4_TUPLE_
-#undef GTEST_5_TUPLE_
-#undef GTEST_6_TUPLE_
-#undef GTEST_7_TUPLE_
-#undef GTEST_8_TUPLE_
-#undef GTEST_9_TUPLE_
-#undef GTEST_10_TUPLE_
-
-#undef GTEST_0_TYPENAMES_
-#undef GTEST_1_TYPENAMES_
-#undef GTEST_2_TYPENAMES_
-#undef GTEST_3_TYPENAMES_
-#undef GTEST_4_TYPENAMES_
-#undef GTEST_5_TYPENAMES_
-#undef GTEST_6_TYPENAMES_
-#undef GTEST_7_TYPENAMES_
-#undef GTEST_8_TYPENAMES_
-#undef GTEST_9_TYPENAMES_
-#undef GTEST_10_TYPENAMES_
-
-#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
-#undef GTEST_BY_REF_
-#undef GTEST_ADD_REF_
-#undef GTEST_TUPLE_ELEMENT_
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-tuple.h.pump b/src/lib/install/include/gtest/internal/gtest-tuple.h.pump
deleted file mode 100755
index 429ddfe..0000000
--- a/src/lib/install/include/gtest/internal/gtest-tuple.h.pump
+++ /dev/null
@@ -1,347 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 10 $$ Maximum number of tuple fields we want to support.
-$$ This meta comment fixes auto-indentation in Emacs. }}
-// Copyright 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: wan@google.com (Zhanyong Wan)
-
-// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
-
-#include <utility> // For ::std::pair.
-
-// The compiler used in Symbian has a bug that prevents us from declaring the
-// tuple template as a friend (it complains that tuple is redefined). This
-// hack bypasses the bug by declaring the members that should otherwise be
-// private as public.
-// Sun Studio versions < 12 also have the above bug.
-#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
-#else
-# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
- template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \
- private:
-#endif
-
-// 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.
-#if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */
-# error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \
-GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers."
-#endif
-
-
-$range i 0..n-1
-$range j 0..n
-$range k 1..n
-// GTEST_n_TUPLE_(T) is the type of an n-tuple.
-#define GTEST_0_TUPLE_(T) tuple<>
-
-$for k [[
-$range m 0..k-1
-$range m2 k..n-1
-#define GTEST_$(k)_TUPLE_(T) tuple<$for m, [[T##$m]]$for m2 [[, void]]>
-
-]]
-
-// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
-
-$for j [[
-$range m 0..j-1
-#define GTEST_$(j)_TYPENAMES_(T) $for m, [[typename T##$m]]
-
-
-]]
-
-// In theory, defining stuff in the ::std namespace is undefined
-// behavior. We can do this as we are playing the role of a standard
-// library vendor.
-namespace std {
-namespace tr1 {
-
-template <$for i, [[typename T$i = void]]>
-class tuple;
-
-// Anything in namespace gtest_internal is Google Test's INTERNAL
-// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
-namespace gtest_internal {
-
-// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
-template <typename T>
-struct ByRef { typedef const T& type; }; // NOLINT
-template <typename T>
-struct ByRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for ByRef.
-#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
-
-// AddRef<T>::type is T if T is a reference; otherwise it's T&. This
-// is the same as tr1::add_reference<T>::type.
-template <typename T>
-struct AddRef { typedef T& type; }; // NOLINT
-template <typename T>
-struct AddRef<T&> { typedef T& type; }; // NOLINT
-
-// A handy wrapper for AddRef.
-#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
-
-// A helper for implementing get<k>().
-template <int k> class Get;
-
-// A helper for implementing tuple_element<k, T>. kIndexValid is true
-// iff k < the number of fields in tuple type T.
-template <bool kIndexValid, int kIndex, class Tuple>
-struct TupleElement;
-
-
-$for i [[
-template <GTEST_$(n)_TYPENAMES_(T)>
-struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T) > {
- typedef T$i type;
-};
-
-
-]]
-} // namespace gtest_internal
-
-template <>
-class tuple<> {
- public:
- tuple() {}
- tuple(const tuple& /* t */) {}
- tuple& operator=(const tuple& /* t */) { return *this; }
-};
-
-
-$for k [[
-$range m 0..k-1
-template <GTEST_$(k)_TYPENAMES_(T)>
-class $if k < n [[GTEST_$(k)_TUPLE_(T)]] $else [[tuple]] {
- public:
- template <int k> friend class gtest_internal::Get;
-
- tuple() : $for m, [[f$(m)_()]] {}
-
- explicit tuple($for m, [[GTEST_BY_REF_(T$m) f$m]]) : [[]]
-$for m, [[f$(m)_(f$m)]] {}
-
- tuple(const tuple& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}
-
- template <GTEST_$(k)_TYPENAMES_(U)>
- tuple(const GTEST_$(k)_TUPLE_(U)& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}
-
-$if k == 2 [[
- template <typename U0, typename U1>
- tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
-
-]]
-
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
-
- template <GTEST_$(k)_TYPENAMES_(U)>
- tuple& operator=(const GTEST_$(k)_TUPLE_(U)& t) {
- return CopyFrom(t);
- }
-
-$if k == 2 [[
- template <typename U0, typename U1>
- tuple& operator=(const ::std::pair<U0, U1>& p) {
- f0_ = p.first;
- f1_ = p.second;
- return *this;
- }
-
-]]
-
- GTEST_DECLARE_TUPLE_AS_FRIEND_
-
- template <GTEST_$(k)_TYPENAMES_(U)>
- tuple& CopyFrom(const GTEST_$(k)_TUPLE_(U)& t) {
-
-$for m [[
- f$(m)_ = t.f$(m)_;
-
-]]
- return *this;
- }
-
-
-$for m [[
- T$m f$(m)_;
-
-]]
-};
-
-
-]]
-// 6.1.3.2 Tuple creation functions.
-
-// Known limitations: we don't support passing an
-// std::tr1::reference_wrapper<T> to make_tuple(). And we don't
-// implement tie().
-
-inline tuple<> make_tuple() { return tuple<>(); }
-
-$for k [[
-$range m 0..k-1
-
-template <GTEST_$(k)_TYPENAMES_(T)>
-inline GTEST_$(k)_TUPLE_(T) make_tuple($for m, [[const T$m& f$m]]) {
- return GTEST_$(k)_TUPLE_(T)($for m, [[f$m]]);
-}
-
-]]
-
-// 6.1.3.3 Tuple helper classes.
-
-template <typename Tuple> struct tuple_size;
-
-
-$for j [[
-template <GTEST_$(j)_TYPENAMES_(T)>
-struct tuple_size<GTEST_$(j)_TUPLE_(T) > {
- static const int value = $j;
-};
-
-
-]]
-template <int k, class Tuple>
-struct tuple_element {
- typedef typename gtest_internal::TupleElement<
- k < (tuple_size<Tuple>::value), k, Tuple>::type type;
-};
-
-#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
-
-// 6.1.3.4 Element access.
-
-namespace gtest_internal {
-
-
-$for i [[
-template <>
-class Get<$i> {
- public:
- template <class Tuple>
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))
- Field(Tuple& t) { return t.f$(i)_; } // NOLINT
-
- template <class Tuple>
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))
- ConstField(const Tuple& t) { return t.f$(i)_; }
-};
-
-
-]]
-} // namespace gtest_internal
-
-template <int k, GTEST_$(n)_TYPENAMES_(T)>
-GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))
-get(GTEST_$(n)_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::Field(t);
-}
-
-template <int k, GTEST_$(n)_TYPENAMES_(T)>
-GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))
-get(const GTEST_$(n)_TUPLE_(T)& t) {
- return gtest_internal::Get<k>::ConstField(t);
-}
-
-// 6.1.3.5 Relational operators
-
-// We only implement == and !=, as we don't have a need for the rest yet.
-
-namespace gtest_internal {
-
-// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
-// first k fields of t1 equals the first k fields of t2.
-// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
-// k1 != k2.
-template <int kSize1, int kSize2>
-struct SameSizeTuplePrefixComparator;
-
-template <>
-struct SameSizeTuplePrefixComparator<0, 0> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
- return true;
- }
-};
-
-template <int k>
-struct SameSizeTuplePrefixComparator<k, k> {
- template <class Tuple1, class Tuple2>
- static bool Eq(const Tuple1& t1, const Tuple2& t2) {
- return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
- ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
- }
-};
-
-} // namespace gtest_internal
-
-template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
-inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t,
- const GTEST_$(n)_TUPLE_(U)& u) {
- return gtest_internal::SameSizeTuplePrefixComparator<
- tuple_size<GTEST_$(n)_TUPLE_(T) >::value,
- tuple_size<GTEST_$(n)_TUPLE_(U) >::value>::Eq(t, u);
-}
-
-template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
-inline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t,
- const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); }
-
-// 6.1.4 Pairs.
-// Unimplemented.
-
-} // namespace tr1
-} // namespace std
-
-
-$for j [[
-#undef GTEST_$(j)_TUPLE_
-
-]]
-
-
-$for j [[
-#undef GTEST_$(j)_TYPENAMES_
-
-]]
-
-#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
-#undef GTEST_BY_REF_
-#undef GTEST_ADD_REF_
-#undef GTEST_TUPLE_ELEMENT_
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-type-util.h b/src/lib/install/include/gtest/internal/gtest-type-util.h
deleted file mode 100755
index e46f7cf..0000000
--- a/src/lib/install/include/gtest/internal/gtest-type-util.h
+++ /dev/null
@@ -1,3331 +0,0 @@
-// This file was GENERATED by command:
-// pump.py gtest-type-util.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)
-
-// Type utilities needed for implementing typed and type-parameterized
-// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently we support at most 50 types in a list, and at most 50
-// type-parameterized tests in one type-parameterized test case.
-// Please contact googletestframework@googlegroups.com if you need
-// more.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-
-#include "gtest/internal/gtest-port.h"
-
-// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
-// libstdc++ (which is where cxxabi.h comes from).
-# if GTEST_HAS_CXXABI_H_
-# include <cxxabi.h>
-# elif defined(__HP_aCC)
-# include <acxx_demangle.h>
-# endif // GTEST_HASH_CXXABI_H_
-
-namespace testing {
-namespace internal {
-
-// GetTypeName<T>() returns a human-readable name of type T.
-// NB: This function is also used in Google Mock, so don't move it inside of
-// the typed-test-only section below.
-template <typename T>
-std::string GetTypeName() {
-# if GTEST_HAS_RTTI
-
- const char* const name = typeid(T).name();
-# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
- int status = 0;
- // gcc's implementation of typeid(T).name() mangles the type name,
- // so we have to demangle it.
-# if GTEST_HAS_CXXABI_H_
- using abi::__cxa_demangle;
-# endif // GTEST_HAS_CXXABI_H_
- char* const readable_name = __cxa_demangle(name, 0, 0, &status);
- const std::string name_str(status == 0 ? readable_name : name);
- free(readable_name);
- return name_str;
-# else
- return name;
-# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
-
-# else
-
- return "<type>";
-
-# endif // GTEST_HAS_RTTI
-}
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
-// type. This can be used as a compile-time assertion to ensure that
-// two types are equal.
-
-template <typename T1, typename T2>
-struct AssertTypeEq;
-
-template <typename T>
-struct AssertTypeEq<T, T> {
- typedef bool type;
-};
-
-// A unique type used as the default value for the arguments of class
-// template Types. This allows us to simulate variadic templates
-// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
-// support directly.
-struct None {};
-
-// The following family of struct and struct templates are used to
-// represent type lists. In particular, TypesN<T1, T2, ..., TN>
-// represents a type list with N types (T1, T2, ..., and TN) in it.
-// Except for Types0, every struct in the family has two member types:
-// Head for the first type in the list, and Tail for the rest of the
-// list.
-
-// The empty type list.
-struct Types0 {};
-
-// Type lists of length 1, 2, 3, and so on.
-
-template <typename T1>
-struct Types1 {
- typedef T1 Head;
- typedef Types0 Tail;
-};
-template <typename T1, typename T2>
-struct Types2 {
- typedef T1 Head;
- typedef Types1<T2> Tail;
-};
-
-template <typename T1, typename T2, typename T3>
-struct Types3 {
- typedef T1 Head;
- typedef Types2<T2, T3> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4>
-struct Types4 {
- typedef T1 Head;
- typedef Types3<T2, T3, T4> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-struct Types5 {
- typedef T1 Head;
- typedef Types4<T2, T3, T4, T5> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-struct Types6 {
- typedef T1 Head;
- typedef Types5<T2, T3, T4, T5, T6> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-struct Types7 {
- typedef T1 Head;
- typedef Types6<T2, T3, T4, T5, T6, T7> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-struct Types8 {
- typedef T1 Head;
- typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-struct Types9 {
- typedef T1 Head;
- typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-struct Types10 {
- typedef T1 Head;
- typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-struct Types11 {
- typedef T1 Head;
- typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-struct Types12 {
- typedef T1 Head;
- typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-struct Types13 {
- typedef T1 Head;
- typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-struct Types14 {
- typedef T1 Head;
- typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-struct Types15 {
- typedef T1 Head;
- typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-struct Types16 {
- typedef T1 Head;
- typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-struct Types17 {
- typedef T1 Head;
- typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-struct Types18 {
- typedef T1 Head;
- typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-struct Types19 {
- typedef T1 Head;
- typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-struct Types20 {
- typedef T1 Head;
- typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-struct Types21 {
- typedef T1 Head;
- typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-struct Types22 {
- typedef T1 Head;
- typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-struct Types23 {
- typedef T1 Head;
- typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-struct Types24 {
- typedef T1 Head;
- typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-struct Types25 {
- typedef T1 Head;
- typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-struct Types26 {
- typedef T1 Head;
- typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-struct Types27 {
- typedef T1 Head;
- typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-struct Types28 {
- typedef T1 Head;
- typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-struct Types29 {
- typedef T1 Head;
- typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-struct Types30 {
- typedef T1 Head;
- typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-struct Types31 {
- typedef T1 Head;
- typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-struct Types32 {
- typedef T1 Head;
- typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-struct Types33 {
- typedef T1 Head;
- typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-struct Types34 {
- typedef T1 Head;
- typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-struct Types35 {
- typedef T1 Head;
- typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-struct Types36 {
- typedef T1 Head;
- typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-struct Types37 {
- typedef T1 Head;
- typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-struct Types38 {
- typedef T1 Head;
- typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-struct Types39 {
- typedef T1 Head;
- typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-struct Types40 {
- typedef T1 Head;
- typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-struct Types41 {
- typedef T1 Head;
- typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-struct Types42 {
- typedef T1 Head;
- typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-struct Types43 {
- typedef T1 Head;
- typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-struct Types44 {
- typedef T1 Head;
- typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-struct Types45 {
- typedef T1 Head;
- typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-struct Types46 {
- typedef T1 Head;
- typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-struct Types47 {
- typedef T1 Head;
- typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-struct Types48 {
- typedef T1 Head;
- typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-struct Types49 {
- typedef T1 Head;
- typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49> Tail;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-struct Types50 {
- typedef T1 Head;
- typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> Tail;
-};
-
-
-} // namespace internal
-
-// We don't want to require the users to write TypesN<...> directly,
-// as that would require them to count the length. Types<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Types<int>
-// will appear as Types<int, None, None, ..., None> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Types<T1, ..., TN>, and Google Test will translate
-// that to TypesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Types template.
-template <typename T1 = internal::None, typename T2 = internal::None,
- typename T3 = internal::None, typename T4 = internal::None,
- typename T5 = internal::None, typename T6 = internal::None,
- typename T7 = internal::None, typename T8 = internal::None,
- typename T9 = internal::None, typename T10 = internal::None,
- typename T11 = internal::None, typename T12 = internal::None,
- typename T13 = internal::None, typename T14 = internal::None,
- typename T15 = internal::None, typename T16 = internal::None,
- typename T17 = internal::None, typename T18 = internal::None,
- typename T19 = internal::None, typename T20 = internal::None,
- typename T21 = internal::None, typename T22 = internal::None,
- typename T23 = internal::None, typename T24 = internal::None,
- typename T25 = internal::None, typename T26 = internal::None,
- typename T27 = internal::None, typename T28 = internal::None,
- typename T29 = internal::None, typename T30 = internal::None,
- typename T31 = internal::None, typename T32 = internal::None,
- typename T33 = internal::None, typename T34 = internal::None,
- typename T35 = internal::None, typename T36 = internal::None,
- typename T37 = internal::None, typename T38 = internal::None,
- typename T39 = internal::None, typename T40 = internal::None,
- typename T41 = internal::None, typename T42 = internal::None,
- typename T43 = internal::None, typename T44 = internal::None,
- typename T45 = internal::None, typename T46 = internal::None,
- typename T47 = internal::None, typename T48 = internal::None,
- typename T49 = internal::None, typename T50 = internal::None>
-struct Types {
- typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
-};
-
-template <>
-struct Types<internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types0 type;
-};
-template <typename T1>
-struct Types<T1, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types1<T1> type;
-};
-template <typename T1, typename T2>
-struct Types<T1, T2, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types2<T1, T2> type;
-};
-template <typename T1, typename T2, typename T3>
-struct Types<T1, T2, T3, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types3<T1, T2, T3> type;
-};
-template <typename T1, typename T2, typename T3, typename T4>
-struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types4<T1, T2, T3, T4> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5>
-struct Types<T1, T2, T3, T4, T5, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types5<T1, T2, T3, T4, T5> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6>
-struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types6<T1, T2, T3, T4, T5, T6> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7>
-struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
- T12> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
- T26> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
- T40> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None, internal::None> {
- typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- internal::None, internal::None, internal::None, internal::None,
- internal::None, internal::None> {
- typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- internal::None, internal::None, internal::None, internal::None,
- internal::None> {
- typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, internal::None, internal::None, internal::None, internal::None> {
- typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, internal::None, internal::None, internal::None> {
- typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, T48, internal::None, internal::None> {
- typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48> type;
-};
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49>
-struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
- T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30,
- T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45,
- T46, T47, T48, T49, internal::None> {
- typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49> type;
-};
-
-namespace internal {
-
-# define GTEST_TEMPLATE_ template <typename T> class
-
-// The template "selector" struct TemplateSel<Tmpl> is used to
-// represent Tmpl, which must be a class template with one type
-// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
-// as the type Tmpl<T>. This allows us to actually instantiate the
-// template "selected" by TemplateSel<Tmpl>.
-//
-// This trick is necessary for simulating typedef for class templates,
-// which C++ doesn't support directly.
-template <GTEST_TEMPLATE_ Tmpl>
-struct TemplateSel {
- template <typename T>
- struct Bind {
- typedef Tmpl<T> type;
- };
-};
-
-# define GTEST_BIND_(TmplSel, T) \
- TmplSel::template Bind<T>::type
-
-// A unique struct template used as the default value for the
-// arguments of class template Templates. This allows us to simulate
-// variadic templates (e.g. Templates<int>, Templates<int, double>,
-// and etc), which C++ doesn't support directly.
-template <typename T>
-struct NoneT {};
-
-// The following family of struct and struct templates are used to
-// represent template lists. In particular, TemplatesN<T1, T2, ...,
-// TN> represents a list of N templates (T1, T2, ..., and TN). Except
-// for Templates0, every struct in the family has two member types:
-// Head for the selector of the first template in the list, and Tail
-// for the rest of the list.
-
-// The empty template list.
-struct Templates0 {};
-
-// Template lists of length 1, 2, 3, and so on.
-
-template <GTEST_TEMPLATE_ T1>
-struct Templates1 {
- typedef TemplateSel<T1> Head;
- typedef Templates0 Tail;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
-struct Templates2 {
- typedef TemplateSel<T1> Head;
- typedef Templates1<T2> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
-struct Templates3 {
- typedef TemplateSel<T1> Head;
- typedef Templates2<T2, T3> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4>
-struct Templates4 {
- typedef TemplateSel<T1> Head;
- typedef Templates3<T2, T3, T4> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
-struct Templates5 {
- typedef TemplateSel<T1> Head;
- typedef Templates4<T2, T3, T4, T5> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
-struct Templates6 {
- typedef TemplateSel<T1> Head;
- typedef Templates5<T2, T3, T4, T5, T6> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7>
-struct Templates7 {
- typedef TemplateSel<T1> Head;
- typedef Templates6<T2, T3, T4, T5, T6, T7> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
-struct Templates8 {
- typedef TemplateSel<T1> Head;
- typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
-struct Templates9 {
- typedef TemplateSel<T1> Head;
- typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10>
-struct Templates10 {
- typedef TemplateSel<T1> Head;
- typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
-struct Templates11 {
- typedef TemplateSel<T1> Head;
- typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
-struct Templates12 {
- typedef TemplateSel<T1> Head;
- typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13>
-struct Templates13 {
- typedef TemplateSel<T1> Head;
- typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
-struct Templates14 {
- typedef TemplateSel<T1> Head;
- typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
-struct Templates15 {
- typedef TemplateSel<T1> Head;
- typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16>
-struct Templates16 {
- typedef TemplateSel<T1> Head;
- typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
-struct Templates17 {
- typedef TemplateSel<T1> Head;
- typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
-struct Templates18 {
- typedef TemplateSel<T1> Head;
- typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19>
-struct Templates19 {
- typedef TemplateSel<T1> Head;
- typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
-struct Templates20 {
- typedef TemplateSel<T1> Head;
- typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
-struct Templates21 {
- typedef TemplateSel<T1> Head;
- typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22>
-struct Templates22 {
- typedef TemplateSel<T1> Head;
- typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
-struct Templates23 {
- typedef TemplateSel<T1> Head;
- typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
-struct Templates24 {
- typedef TemplateSel<T1> Head;
- typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25>
-struct Templates25 {
- typedef TemplateSel<T1> Head;
- typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
-struct Templates26 {
- typedef TemplateSel<T1> Head;
- typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
-struct Templates27 {
- typedef TemplateSel<T1> Head;
- typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28>
-struct Templates28 {
- typedef TemplateSel<T1> Head;
- typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
-struct Templates29 {
- typedef TemplateSel<T1> Head;
- typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
-struct Templates30 {
- typedef TemplateSel<T1> Head;
- typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31>
-struct Templates31 {
- typedef TemplateSel<T1> Head;
- typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
-struct Templates32 {
- typedef TemplateSel<T1> Head;
- typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
-struct Templates33 {
- typedef TemplateSel<T1> Head;
- typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34>
-struct Templates34 {
- typedef TemplateSel<T1> Head;
- typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
-struct Templates35 {
- typedef TemplateSel<T1> Head;
- typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
-struct Templates36 {
- typedef TemplateSel<T1> Head;
- typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37>
-struct Templates37 {
- typedef TemplateSel<T1> Head;
- typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
-struct Templates38 {
- typedef TemplateSel<T1> Head;
- typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
-struct Templates39 {
- typedef TemplateSel<T1> Head;
- typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40>
-struct Templates40 {
- typedef TemplateSel<T1> Head;
- typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
-struct Templates41 {
- typedef TemplateSel<T1> Head;
- typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
-struct Templates42 {
- typedef TemplateSel<T1> Head;
- typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43>
-struct Templates43 {
- typedef TemplateSel<T1> Head;
- typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
-struct Templates44 {
- typedef TemplateSel<T1> Head;
- typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
-struct Templates45 {
- typedef TemplateSel<T1> Head;
- typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46>
-struct Templates46 {
- typedef TemplateSel<T1> Head;
- typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
-struct Templates47 {
- typedef TemplateSel<T1> Head;
- typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
-struct Templates48 {
- typedef TemplateSel<T1> Head;
- typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49>
-struct Templates49 {
- typedef TemplateSel<T1> Head;
- typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48, T49> Tail;
-};
-
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50>
-struct Templates50 {
- typedef TemplateSel<T1> Head;
- typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
- T43, T44, T45, T46, T47, T48, T49, T50> Tail;
-};
-
-
-// We don't want to require the users to write TemplatesN<...> directly,
-// as that would require them to count the length. Templates<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Templates<list>
-// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Templates<T1, ..., TN>, and Google Test will translate
-// that to TemplatesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Templates template.
-template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT,
- GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT,
- GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT,
- GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT,
- GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT,
- GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT,
- GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT,
- GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT,
- GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT,
- GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT,
- GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT,
- GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT,
- GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT,
- GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT,
- GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT,
- GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT,
- GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT,
- GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT,
- GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT,
- GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT,
- GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT,
- GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT,
- GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT,
- GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT,
- GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT>
-struct Templates {
- typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48, T49, T50> type;
-};
-
-template <>
-struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates0 type;
-};
-template <GTEST_TEMPLATE_ T1>
-struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates1<T1> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2>
-struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates2<T1, T2> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3>
-struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates3<T1, T2, T3> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4>
-struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates4<T1, T2, T3, T4> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5>
-struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates5<T1, T2, T3, T4, T5> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6>
-struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates6<T1, T2, T3, T4, T5, T6> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT> {
- typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT> {
- typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT> {
- typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT> {
- typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, NoneT, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, NoneT, NoneT, NoneT, NoneT> {
- typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, NoneT, NoneT, NoneT> {
- typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, T48, NoneT, NoneT> {
- typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48> type;
-};
-template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3,
- GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6,
- GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9,
- GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12,
- GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15,
- GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18,
- GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21,
- GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24,
- GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27,
- GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30,
- GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33,
- GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36,
- GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39,
- GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42,
- GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45,
- GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48,
- GTEST_TEMPLATE_ T49>
-struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
- T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,
- T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44,
- T45, T46, T47, T48, T49, NoneT> {
- typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
- T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
- T42, T43, T44, T45, T46, T47, T48, T49> type;
-};
-
-// The TypeList template makes it possible to use either a single type
-// or a Types<...> list in TYPED_TEST_CASE() and
-// INSTANTIATE_TYPED_TEST_CASE_P().
-
-template <typename T>
-struct TypeList {
- typedef Types1<T> type;
-};
-
-template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14, typename T15,
- typename T16, typename T17, typename T18, typename T19, typename T20,
- typename T21, typename T22, typename T23, typename T24, typename T25,
- typename T26, typename T27, typename T28, typename T29, typename T30,
- typename T31, typename T32, typename T33, typename T34, typename T35,
- typename T36, typename T37, typename T38, typename T39, typename T40,
- typename T41, typename T42, typename T43, typename T44, typename T45,
- typename T46, typename T47, typename T48, typename T49, typename T50>
-struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
- T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
- T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
- T44, T45, T46, T47, T48, T49, T50> > {
- typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
- T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
- T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
- T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
diff --git a/src/lib/install/include/gtest/internal/gtest-type-util.h.pump b/src/lib/install/include/gtest/internal/gtest-type-util.h.pump
deleted file mode 100755
index 251fdf0..0000000
--- a/src/lib/install/include/gtest/internal/gtest-type-util.h.pump
+++ /dev/null
@@ -1,297 +0,0 @@
-$$ -*- mode: c++; -*-
-$var n = 50 $$ Maximum length of type lists we want to 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)
-
-// Type utilities needed for implementing typed and type-parameterized
-// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
-//
-// Currently we support at most $n types in a list, and at most $n
-// type-parameterized tests in one type-parameterized test case.
-// Please contact googletestframework@googlegroups.com if you need
-// more.
-
-#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
-
-#include "gtest/internal/gtest-port.h"
-
-// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
-// libstdc++ (which is where cxxabi.h comes from).
-# if GTEST_HAS_CXXABI_H_
-# include <cxxabi.h>
-# elif defined(__HP_aCC)
-# include <acxx_demangle.h>
-# endif // GTEST_HASH_CXXABI_H_
-
-namespace testing {
-namespace internal {
-
-// GetTypeName<T>() returns a human-readable name of type T.
-// NB: This function is also used in Google Mock, so don't move it inside of
-// the typed-test-only section below.
-template <typename T>
-std::string GetTypeName() {
-# if GTEST_HAS_RTTI
-
- const char* const name = typeid(T).name();
-# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
- int status = 0;
- // gcc's implementation of typeid(T).name() mangles the type name,
- // so we have to demangle it.
-# if GTEST_HAS_CXXABI_H_
- using abi::__cxa_demangle;
-# endif // GTEST_HAS_CXXABI_H_
- char* const readable_name = __cxa_demangle(name, 0, 0, &status);
- const std::string name_str(status == 0 ? readable_name : name);
- free(readable_name);
- return name_str;
-# else
- return name;
-# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
-
-# else
-
- return "<type>";
-
-# endif // GTEST_HAS_RTTI
-}
-
-#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
-// type. This can be used as a compile-time assertion to ensure that
-// two types are equal.
-
-template <typename T1, typename T2>
-struct AssertTypeEq;
-
-template <typename T>
-struct AssertTypeEq<T, T> {
- typedef bool type;
-};
-
-// A unique type used as the default value for the arguments of class
-// template Types. This allows us to simulate variadic templates
-// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
-// support directly.
-struct None {};
-
-// The following family of struct and struct templates are used to
-// represent type lists. In particular, TypesN<T1, T2, ..., TN>
-// represents a type list with N types (T1, T2, ..., and TN) in it.
-// Except for Types0, every struct in the family has two member types:
-// Head for the first type in the list, and Tail for the rest of the
-// list.
-
-// The empty type list.
-struct Types0 {};
-
-// Type lists of length 1, 2, 3, and so on.
-
-template <typename T1>
-struct Types1 {
- typedef T1 Head;
- typedef Types0 Tail;
-};
-
-$range i 2..n
-
-$for i [[
-$range j 1..i
-$range k 2..i
-template <$for j, [[typename T$j]]>
-struct Types$i {
- typedef T1 Head;
- typedef Types$(i-1)<$for k, [[T$k]]> Tail;
-};
-
-
-]]
-
-} // namespace internal
-
-// We don't want to require the users to write TypesN<...> directly,
-// as that would require them to count the length. Types<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Types<int>
-// will appear as Types<int, None, None, ..., None> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Types<T1, ..., TN>, and Google Test will translate
-// that to TypesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Types template.
-
-$range i 1..n
-template <$for i, [[typename T$i = internal::None]]>
-struct Types {
- typedef internal::Types$n<$for i, [[T$i]]> type;
-};
-
-template <>
-struct Types<$for i, [[internal::None]]> {
- typedef internal::Types0 type;
-};
-
-$range i 1..n-1
-$for i [[
-$range j 1..i
-$range k i+1..n
-template <$for j, [[typename T$j]]>
-struct Types<$for j, [[T$j]]$for k[[, internal::None]]> {
- typedef internal::Types$i<$for j, [[T$j]]> type;
-};
-
-]]
-
-namespace internal {
-
-# define GTEST_TEMPLATE_ template <typename T> class
-
-// The template "selector" struct TemplateSel<Tmpl> is used to
-// represent Tmpl, which must be a class template with one type
-// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
-// as the type Tmpl<T>. This allows us to actually instantiate the
-// template "selected" by TemplateSel<Tmpl>.
-//
-// This trick is necessary for simulating typedef for class templates,
-// which C++ doesn't support directly.
-template <GTEST_TEMPLATE_ Tmpl>
-struct TemplateSel {
- template <typename T>
- struct Bind {
- typedef Tmpl<T> type;
- };
-};
-
-# define GTEST_BIND_(TmplSel, T) \
- TmplSel::template Bind<T>::type
-
-// A unique struct template used as the default value for the
-// arguments of class template Templates. This allows us to simulate
-// variadic templates (e.g. Templates<int>, Templates<int, double>,
-// and etc), which C++ doesn't support directly.
-template <typename T>
-struct NoneT {};
-
-// The following family of struct and struct templates are used to
-// represent template lists. In particular, TemplatesN<T1, T2, ...,
-// TN> represents a list of N templates (T1, T2, ..., and TN). Except
-// for Templates0, every struct in the family has two member types:
-// Head for the selector of the first template in the list, and Tail
-// for the rest of the list.
-
-// The empty template list.
-struct Templates0 {};
-
-// Template lists of length 1, 2, 3, and so on.
-
-template <GTEST_TEMPLATE_ T1>
-struct Templates1 {
- typedef TemplateSel<T1> Head;
- typedef Templates0 Tail;
-};
-
-$range i 2..n
-
-$for i [[
-$range j 1..i
-$range k 2..i
-template <$for j, [[GTEST_TEMPLATE_ T$j]]>
-struct Templates$i {
- typedef TemplateSel<T1> Head;
- typedef Templates$(i-1)<$for k, [[T$k]]> Tail;
-};
-
-
-]]
-
-// We don't want to require the users to write TemplatesN<...> directly,
-// as that would require them to count the length. Templates<...> is much
-// easier to write, but generates horrible messages when there is a
-// compiler error, as gcc insists on printing out each template
-// argument, even if it has the default value (this means Templates<list>
-// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
-// errors).
-//
-// Our solution is to combine the best part of the two approaches: a
-// user would write Templates<T1, ..., TN>, and Google Test will translate
-// that to TemplatesN<T1, ..., TN> internally to make error messages
-// readable. The translation is done by the 'type' member of the
-// Templates template.
-
-$range i 1..n
-template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]>
-struct Templates {
- typedef Templates$n<$for i, [[T$i]]> type;
-};
-
-template <>
-struct Templates<$for i, [[NoneT]]> {
- typedef Templates0 type;
-};
-
-$range i 1..n-1
-$for i [[
-$range j 1..i
-$range k i+1..n
-template <$for j, [[GTEST_TEMPLATE_ T$j]]>
-struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> {
- typedef Templates$i<$for j, [[T$j]]> type;
-};
-
-]]
-
-// The TypeList template makes it possible to use either a single type
-// or a Types<...> list in TYPED_TEST_CASE() and
-// INSTANTIATE_TYPED_TEST_CASE_P().
-
-template <typename T>
-struct TypeList {
- typedef Types1<T> type;
-};
-
-
-$range i 1..n
-template <$for i, [[typename T$i]]>
-struct TypeList<Types<$for i, [[T$i]]> > {
- typedef typename Types<$for i, [[T$i]]>::type type;
-};
-
-#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
-
-} // namespace internal
-} // namespace testing
-
-#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
diff --git a/src/lib/install/include/json-c/arraylist.h b/src/lib/install/include/json-c/arraylist.h
deleted file mode 100644
index 4f3113c..0000000
--- a/src/lib/install/include/json-c/arraylist.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * $Id: arraylist.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _arraylist_h_
-#define _arraylist_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ARRAY_LIST_DEFAULT_SIZE 32
-
-typedef void (array_list_free_fn) (void *data);
-
-struct array_list
-{
- void **array;
- int length;
- int size;
- array_list_free_fn *free_fn;
-};
-
-extern struct array_list*
-array_list_new(array_list_free_fn *free_fn);
-
-extern void
-array_list_free(struct array_list *al);
-
-extern void*
-array_list_get_idx(struct array_list *al, int i);
-
-extern int
-array_list_put_idx(struct array_list *al, int i, void *data);
-
-extern int
-array_list_add(struct array_list *al, void *data);
-
-extern int
-array_list_length(struct array_list *al);
-
-extern void
-array_list_sort(struct array_list *arr, int(*compar)(const void *, const void *));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/include/json-c/bits.h b/src/lib/install/include/json-c/bits.h
deleted file mode 100644
index c8cbbc8..0000000
--- a/src/lib/install/include/json-c/bits.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * $Id: bits.h,v 1.10 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _bits_h_
-#define _bits_h_
-
-#ifndef json_min
-#define json_min(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
-#ifndef json_max
-#define json_max(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-#define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
-#define error_ptr(error) ((void*)error)
-#define error_description(error) (json_tokener_errors[error])
-#define is_error(ptr) (ptr == NULL)
-
-#endif
diff --git a/src/lib/install/include/json-c/debug.h b/src/lib/install/include/json-c/debug.h
deleted file mode 100644
index 80ca3e4..0000000
--- a/src/lib/install/include/json-c/debug.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * $Id: debug.h,v 1.5 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- * Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _DEBUG_H_
-#define _DEBUG_H_
-
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void mc_set_debug(int debug);
-extern int mc_get_debug(void);
-
-extern void mc_set_syslog(int syslog);
-
-extern void mc_debug(const char *msg, ...);
-extern void mc_error(const char *msg, ...);
-extern void mc_info(const char *msg, ...);
-
-#ifndef __STRING
-#define __STRING(x) #x
-#endif
-
-#ifndef PARSER_BROKEN_FIXED
-
-#define JASSERT(cond) do {} while(0)
-
-#else
-
-#define JASSERT(cond) do { \
- if (!(cond)) { \
- mc_error("cjson assert failure %s:%d : cond \"" __STRING(cond) "failed\n", __FILE__, __LINE__); \
- *(int *)0 = 1;\
- abort(); \
- }\
- } while(0)
-
-#endif
-
-#define MC_ERROR(x, ...) mc_error(x, ##__VA_ARGS__)
-
-#ifdef MC_MAINTAINER_MODE
-#define MC_SET_DEBUG(x) mc_set_debug(x)
-#define MC_GET_DEBUG() mc_get_debug()
-#define MC_SET_SYSLOG(x) mc_set_syslog(x)
-#define MC_DEBUG(x, ...) mc_debug(x, ##__VA_ARGS__)
-#define MC_INFO(x, ...) mc_info(x, ##__VA_ARGS__)
-#else
-#define MC_SET_DEBUG(x) if (0) mc_set_debug(x)
-#define MC_GET_DEBUG() (0)
-#define MC_SET_SYSLOG(x) if (0) mc_set_syslog(x)
-#define MC_DEBUG(x, ...) if (0) mc_debug(x, ##__VA_ARGS__)
-#define MC_INFO(x, ...) if (0) mc_info(x, ##__VA_ARGS__)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/include/json-c/json.h b/src/lib/install/include/json-c/json.h
deleted file mode 100644
index 4339b20..0000000
--- a/src/lib/install/include/json-c/json.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * $Id: json.h,v 1.6 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- * Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _json_h_
-#define _json_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "bits.h"
-#include "debug.h"
-#include "linkhash.h"
-#include "arraylist.h"
-#include "json_util.h"
-#include "json_object.h"
-#include "json_tokener.h"
-#include "json_object_iterator.h"
-#include "json_c_version.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/include/json-c/json_c_version.h b/src/lib/install/include/json-c/json_c_version.h
deleted file mode 100644
index 29c8ae7..0000000
--- a/src/lib/install/include/json-c/json_c_version.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2012 Eric Haszlakiewicz
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- */
-
-#ifndef _json_c_version_h_
-#define _json_c_version_h_
-
-#define JSON_C_MAJOR_VERSION 0
-#define JSON_C_MINOR_VERSION 12
-#define JSON_C_MICRO_VERSION 1
-#define JSON_C_VERSION_NUM ((JSON_C_MAJOR_VERSION << 16) | \
- (JSON_C_MINOR_VERSION << 8) | \
- JSON_C_MICRO_VERSION)
-#define JSON_C_VERSION "0.12.1"
-
-const char *json_c_version(void); /* Returns JSON_C_VERSION */
-int json_c_version_num(void); /* Returns JSON_C_VERSION_NUM */
-
-#endif
diff --git a/src/lib/install/include/json-c/json_config.h b/src/lib/install/include/json-c/json_config.h
deleted file mode 100644
index 965ff1c..0000000
--- a/src/lib/install/include/json-c/json_config.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* json_config.h. Generated from json_config.h.in by configure. */
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define JSON_C_HAVE_INTTYPES_H 1
diff --git a/src/lib/install/include/json-c/json_inttypes.h b/src/lib/install/include/json-c/json_inttypes.h
deleted file mode 100644
index 9de8d24..0000000
--- a/src/lib/install/include/json-c/json_inttypes.h
+++ /dev/null
@@ -1,28 +0,0 @@
-
-#ifndef _json_inttypes_h_
-#define _json_inttypes_h_
-
-#include "json_config.h"
-
-#if defined(_MSC_VER) && _MSC_VER <= 1700
-
-/* Anything less than Visual Studio C++ 10 is missing stdint.h and inttypes.h */
-typedef __int32 int32_t;
-#define INT32_MIN ((int32_t)_I32_MIN)
-#define INT32_MAX ((int32_t)_I32_MAX)
-typedef __int64 int64_t;
-#define INT64_MIN ((int64_t)_I64_MIN)
-#define INT64_MAX ((int64_t)_I64_MAX)
-#define PRId64 "I64d"
-#define SCNd64 "I64d"
-
-#else
-
-#ifdef JSON_C_HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-/* inttypes.h includes stdint.h */
-
-#endif
-
-#endif
diff --git a/src/lib/install/include/json-c/json_object.h b/src/lib/install/include/json-c/json_object.h
deleted file mode 100644
index e6c6a4f..0000000
--- a/src/lib/install/include/json-c/json_object.h
+++ /dev/null
@@ -1,612 +0,0 @@
-/*
- * $Id: json_object.h,v 1.12 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- * Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _json_object_h_
-#define _json_object_h_
-
-#ifdef __GNUC__
-#define THIS_FUNCTION_IS_DEPRECATED(func) func __attribute__ ((deprecated))
-#elif defined(_MSC_VER)
-#define THIS_FUNCTION_IS_DEPRECATED(func) __declspec(deprecated) func
-#else
-#define THIS_FUNCTION_IS_DEPRECATED(func) func
-#endif
-
-#include "json_inttypes.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define JSON_OBJECT_DEF_HASH_ENTRIES 16
-
-/**
- * A flag for the json_object_to_json_string_ext() and
- * json_object_to_file_ext() functions which causes the output
- * to have no extra whitespace or formatting applied.
- */
-#define JSON_C_TO_STRING_PLAIN 0
-/**
- * A flag for the json_object_to_json_string_ext() and
- * json_object_to_file_ext() functions which causes the output to have
- * minimal whitespace inserted to make things slightly more readable.
- */
-#define JSON_C_TO_STRING_SPACED (1<<0)
-/**
- * A flag for the json_object_to_json_string_ext() and
- * json_object_to_file_ext() functions which causes
- * the output to be formatted.
- *
- * See the "Two Space Tab" option at http://jsonformatter.curiousconcept.com/
- * for an example of the format.
- */
-#define JSON_C_TO_STRING_PRETTY (1<<1)
-/**
- * A flag to drop trailing zero for float values
- */
-#define JSON_C_TO_STRING_NOZERO (1<<2)
-
-#undef FALSE
-#define FALSE ((json_bool)0)
-
-#undef TRUE
-#define TRUE ((json_bool)1)
-
-extern const char *json_number_chars;
-extern const char *json_hex_chars;
-
-/* CAW: added for ANSI C iteration correctness */
-struct json_object_iter
-{
- char *key;
- struct json_object *val;
- struct lh_entry *entry;
-};
-
-/* forward structure definitions */
-
-typedef int json_bool;
-typedef struct printbuf printbuf;
-typedef struct lh_table lh_table;
-typedef struct array_list array_list;
-typedef struct json_object json_object;
-typedef struct json_object_iter json_object_iter;
-typedef struct json_tokener json_tokener;
-
-/**
- * Type of custom user delete functions. See json_object_set_serializer.
- */
-typedef void (json_object_delete_fn)(struct json_object *jso, void *userdata);
-
-/**
- * Type of a custom serialization function. See json_object_set_serializer.
- */
-typedef int (json_object_to_json_string_fn)(struct json_object *jso,
- struct printbuf *pb,
- int level,
- int flags);
-
-/* supported object types */
-
-typedef enum json_type {
- /* If you change this, be sure to update json_type_to_name() too */
- json_type_null,
- json_type_boolean,
- json_type_double,
- json_type_int,
- json_type_object,
- json_type_array,
- json_type_string,
-} json_type;
-
-/* reference counting functions */
-
-/**
- * Increment the reference count of json_object, thereby grabbing shared
- * ownership of obj.
- *
- * @param obj the json_object instance
- */
-extern struct json_object* json_object_get(struct json_object *obj);
-
-/**
- * Decrement the reference count of json_object and free if it reaches zero.
- * You must have ownership of obj prior to doing this or you will cause an
- * imbalance in the reference count.
- *
- * @param obj the json_object instance
- * @returns 1 if the object was freed.
- */
-int json_object_put(struct json_object *obj);
-
-/**
- * Check if the json_object is of a given type
- * @param obj the json_object instance
- * @param type one of:
- json_type_null (i.e. obj == NULL),
- json_type_boolean,
- json_type_double,
- json_type_int,
- json_type_object,
- json_type_array,
- json_type_string,
- */
-extern int json_object_is_type(struct json_object *obj, enum json_type type);
-
-/**
- * Get the type of the json_object. See also json_type_to_name() to turn this
- * into a string suitable, for instance, for logging.
- *
- * @param obj the json_object instance
- * @returns type being one of:
- json_type_null (i.e. obj == NULL),
- json_type_boolean,
- json_type_double,
- json_type_int,
- json_type_object,
- json_type_array,
- json_type_string,
- */
-extern enum json_type json_object_get_type(struct json_object *obj);
-
-
-/** Stringify object to json format.
- * Equivalent to json_object_to_json_string_ext(obj, JSON_C_TO_STRING_SPACED)
- * @param obj the json_object instance
- * @returns a string in JSON format
- */
-extern const char* json_object_to_json_string(struct json_object *obj);
-
-/** Stringify object to json format
- * @param obj the json_object instance
- * @param flags formatting options, see JSON_C_TO_STRING_PRETTY and other constants
- * @returns a string in JSON format
- */
-extern const char* json_object_to_json_string_ext(struct json_object *obj, int
-flags);
-
-/**
- * Set a custom serialization function to be used when this particular object
- * is converted to a string by json_object_to_json_string.
- *
- * If a custom serializer is already set on this object, any existing
- * user_delete function is called before the new one is set.
- *
- * If to_string_func is NULL, the other parameters are ignored
- * and the default behaviour is reset.
- *
- * The userdata parameter is optional and may be passed as NULL. If provided,
- * it is passed to to_string_func as-is. This parameter may be NULL even
- * if user_delete is non-NULL.
- *
- * The user_delete parameter is optional and may be passed as NULL, even if
- * the userdata parameter is non-NULL. It will be called just before the
- * json_object is deleted, after it's reference count goes to zero
- * (see json_object_put()).
- * If this is not provided, it is up to the caller to free the userdata at
- * an appropriate time. (i.e. after the json_object is deleted)
- *
- * @param jso the object to customize
- * @param to_string_func the custom serialization function
- * @param userdata an optional opaque cookie
- * @param user_delete an optional function from freeing userdata
- */
-extern void json_object_set_serializer(json_object *jso,
- json_object_to_json_string_fn to_string_func,
- void *userdata,
- json_object_delete_fn *user_delete);
-
-/**
- * Simply call free on the userdata pointer.
- * Can be used with json_object_set_serializer().
- *
- * @param jso unused
- * @param userdata the pointer that is passed to free().
- */
-json_object_delete_fn json_object_free_userdata;
-
-/**
- * Copy the jso->_userdata string over to pb as-is.
- * Can be used with json_object_set_serializer().
- *
- * @param jso The object whose _userdata is used.
- * @param pb The destination buffer.
- * @param level Ignored.
- * @param flags Ignored.
- */
-json_object_to_json_string_fn json_object_userdata_to_json_string;
-
-
-/* object type methods */
-
-/** Create a new empty object with a reference count of 1. The caller of
- * this object initially has sole ownership. Remember, when using
- * json_object_object_add or json_object_array_put_idx, ownership will
- * transfer to the object/array. Call json_object_get if you want to maintain
- * shared ownership or also add this object as a child of multiple objects or
- * arrays. Any ownerships you acquired but did not transfer must be released
- * through json_object_put.
- *
- * @returns a json_object of type json_type_object
- */
-extern struct json_object* json_object_new_object(void);
-
-/** Get the hashtable of a json_object of type json_type_object
- * @param obj the json_object instance
- * @returns a linkhash
- */
-extern struct lh_table* json_object_get_object(struct json_object *obj);
-
-/** Get the size of an object in terms of the number of fields it has.
- * @param obj the json_object whose length to return
- */
-extern int json_object_object_length(struct json_object* obj);
-
-/** Add an object field to a json_object of type json_type_object
- *
- * The reference count will *not* be incremented. This is to make adding
- * fields to objects in code more compact. If you want to retain a reference
- * to an added object, independent of the lifetime of obj, you must wrap the
- * passed object with json_object_get.
- *
- * Upon calling this, the ownership of val transfers to obj. Thus you must
- * make sure that you do in fact have ownership over this object. For instance,
- * json_object_new_object will give you ownership until you transfer it,
- * whereas json_object_object_get does not.
- *
- * @param obj the json_object instance
- * @param key the object field name (a private copy will be duplicated)
- * @param val a json_object or NULL member to associate with the given field
- */
-extern void json_object_object_add(struct json_object* obj, const char *key,
- struct json_object *val);
-
-/** Get the json_object associate with a given object field
- *
- * *No* reference counts will be changed. There is no need to manually adjust
- * reference counts through the json_object_put/json_object_get methods unless
- * you need to have the child (value) reference maintain a different lifetime
- * than the owning parent (obj). Ownership of the returned value is retained
- * by obj (do not do json_object_put unless you have done a json_object_get).
- * If you delete the value from obj (json_object_object_del) and wish to access
- * the returned reference afterwards, make sure you have first gotten shared
- * ownership through json_object_get (& don't forget to do a json_object_put
- * or transfer ownership to prevent a memory leak).
- *
- * @param obj the json_object instance
- * @param key the object field name
- * @returns the json_object associated with the given field name
- * @deprecated Please use json_object_object_get_ex
- */
-THIS_FUNCTION_IS_DEPRECATED(extern struct json_object* json_object_object_get(struct json_object* obj,
- const char *key));
-
-/** Get the json_object associated with a given object field.
- *
- * This returns true if the key is found, false in all other cases (including
- * if obj isn't a json_type_object).
- *
- * *No* reference counts will be changed. There is no need to manually adjust
- * reference counts through the json_object_put/json_object_get methods unless
- * you need to have the child (value) reference maintain a different lifetime
- * than the owning parent (obj). Ownership of value is retained by obj.
- *
- * @param obj the json_object instance
- * @param key the object field name
- * @param value a pointer where to store a reference to the json_object
- * associated with the given field name.
- *
- * It is safe to pass a NULL value.
- * @returns whether or not the key exists
- */
-extern json_bool json_object_object_get_ex(struct json_object* obj,
- const char *key,
- struct json_object **value);
-
-/** Delete the given json_object field
- *
- * The reference count will be decremented for the deleted object. If there
- * are no more owners of the value represented by this key, then the value is
- * freed. Otherwise, the reference to the value will remain in memory.
- *
- * @param obj the json_object instance
- * @param key the object field name
- */
-extern void json_object_object_del(struct json_object* obj, const char *key);
-
-/**
- * Iterate through all keys and values of an object.
- *
- * Adding keys to the object while iterating is NOT allowed.
- *
- * Deleting an existing key, or replacing an existing key with a
- * new value IS allowed.
- *
- * @param obj the json_object instance
- * @param key the local name for the char* key variable defined in the body
- * @param val the local name for the json_object* object variable defined in
- * the body
- */
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L
-
-# define json_object_object_foreach(obj,key,val) \
- char *key = NULL; \
- struct json_object *val = NULL; \
- for(struct lh_entry *entry ## key = json_object_get_object(obj)->head, *entry_next ## key = NULL; \
- ({ if(entry ## key) { \
- key = (char*)entry ## key->k; \
- val = (struct json_object*)entry ## key->v; \
- entry_next ## key = entry ## key->next; \
- } ; entry ## key; }); \
- entry ## key = entry_next ## key )
-
-#else /* ANSI C or MSC */
-
-# define json_object_object_foreach(obj,key,val) \
- char *key;\
- struct json_object *val; \
- struct lh_entry *entry ## key; \
- struct lh_entry *entry_next ## key = NULL; \
- for(entry ## key = json_object_get_object(obj)->head; \
- (entry ## key ? ( \
- key = (char*)entry ## key->k, \
- val = (struct json_object*)entry ## key->v, \
- entry_next ## key = entry ## key->next, \
- entry ## key) : 0); \
- entry ## key = entry_next ## key)
-
-#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L */
-
-/** Iterate through all keys and values of an object (ANSI C Safe)
- * @param obj the json_object instance
- * @param iter the object iterator
- */
-#define json_object_object_foreachC(obj,iter) \
- for(iter.entry = json_object_get_object(obj)->head; (iter.entry ? (iter.key = (char*)iter.entry->k, iter.val = (struct json_object*)iter.entry->v, iter.entry) : 0); iter.entry = iter.entry->next)
-
-/* Array type methods */
-
-/** Create a new empty json_object of type json_type_array
- * @returns a json_object of type json_type_array
- */
-extern struct json_object* json_object_new_array(void);
-
-/** Get the arraylist of a json_object of type json_type_array
- * @param obj the json_object instance
- * @returns an arraylist
- */
-extern struct array_list* json_object_get_array(struct json_object *obj);
-
-/** Get the length of a json_object of type json_type_array
- * @param obj the json_object instance
- * @returns an int
- */
-extern int json_object_array_length(struct json_object *obj);
-
-/** Sorts the elements of jso of type json_type_array
-*
-* Pointers to the json_object pointers will be passed as the two arguments
-* to @sort_fn
-*
-* @param obj the json_object instance
-* @param sort_fn a sorting function
-*/
-extern void json_object_array_sort(struct json_object *jso, int(*sort_fn)(const void *, const void *));
-
-/** Add an element to the end of a json_object of type json_type_array
- *
- * The reference count will *not* be incremented. This is to make adding
- * fields to objects in code more compact. If you want to retain a reference
- * to an added object you must wrap the passed object with json_object_get
- *
- * @param obj the json_object instance
- * @param val the json_object to be added
- */
-extern int json_object_array_add(struct json_object *obj,
- struct json_object *val);
-
-/** Insert or replace an element at a specified index in an array (a json_object of type json_type_array)
- *
- * The reference count will *not* be incremented. This is to make adding
- * fields to objects in code more compact. If you want to retain a reference
- * to an added object you must wrap the passed object with json_object_get
- *
- * The reference count of a replaced object will be decremented.
- *
- * The array size will be automatically be expanded to the size of the
- * index if the index is larger than the current size.
- *
- * @param obj the json_object instance
- * @param idx the index to insert the element at
- * @param val the json_object to be added
- */
-extern int json_object_array_put_idx(struct json_object *obj, int idx,
- struct json_object *val);
-
-/** Get the element at specificed index of the array (a json_object of type json_type_array)
- * @param obj the json_object instance
- * @param idx the index to get the element at
- * @returns the json_object at the specified index (or NULL)
- */
-extern struct json_object* json_object_array_get_idx(struct json_object *obj,
- int idx);
-
-/* json_bool type methods */
-
-/** Create a new empty json_object of type json_type_boolean
- * @param b a json_bool TRUE or FALSE (0 or 1)
- * @returns a json_object of type json_type_boolean
- */
-extern struct json_object* json_object_new_boolean(json_bool b);
-
-/** Get the json_bool value of a json_object
- *
- * The type is coerced to a json_bool if the passed object is not a json_bool.
- * integer and double objects will return FALSE if there value is zero
- * or TRUE otherwise. If the passed object is a string it will return
- * TRUE if it has a non zero length. If any other object type is passed
- * TRUE will be returned if the object is not NULL.
- *
- * @param obj the json_object instance
- * @returns a json_bool
- */
-extern json_bool json_object_get_boolean(struct json_object *obj);
-
-
-/* int type methods */
-
-/** Create a new empty json_object of type json_type_int
- * Note that values are stored as 64-bit values internally.
- * To ensure the full range is maintained, use json_object_new_int64 instead.
- * @param i the integer
- * @returns a json_object of type json_type_int
- */
-extern struct json_object* json_object_new_int(int32_t i);
-
-
-/** Create a new empty json_object of type json_type_int
- * @param i the integer
- * @returns a json_object of type json_type_int
- */
-extern struct json_object* json_object_new_int64(int64_t i);
-
-
-/** Get the int value of a json_object
- *
- * The type is coerced to a int if the passed object is not a int.
- * double objects will return their integer conversion. Strings will be
- * parsed as an integer. If no conversion exists then 0 is returned
- * and errno is set to EINVAL. null is equivalent to 0 (no error values set)
- *
- * Note that integers are stored internally as 64-bit values.
- * If the value of too big or too small to fit into 32-bit, INT32_MAX or
- * INT32_MIN are returned, respectively.
- *
- * @param obj the json_object instance
- * @returns an int
- */
-extern int32_t json_object_get_int(struct json_object *obj);
-
-/** Get the int value of a json_object
- *
- * The type is coerced to a int64 if the passed object is not a int64.
- * double objects will return their int64 conversion. Strings will be
- * parsed as an int64. If no conversion exists then 0 is returned.
- *
- * NOTE: Set errno to 0 directly before a call to this function to determine
- * whether or not conversion was successful (it does not clear the value for
- * you).
- *
- * @param obj the json_object instance
- * @returns an int64
- */
-extern int64_t json_object_get_int64(struct json_object *obj);
-
-
-/* double type methods */
-
-/** Create a new empty json_object of type json_type_double
- * @param d the double
- * @returns a json_object of type json_type_double
- */
-extern struct json_object* json_object_new_double(double d);
-
-/**
- * Create a new json_object of type json_type_double, using
- * the exact serialized representation of the value.
- *
- * This allows for numbers that would otherwise get displayed
- * inefficiently (e.g. 12.3 => "12.300000000000001") to be
- * serialized with the more convenient form.
- *
- * Note: this is used by json_tokener_parse_ex() to allow for
- * an exact re-serialization of a parsed object.
- *
- * An equivalent sequence of calls is:
- * @code
- * jso = json_object_new_double(d);
- * json_object_set_serializer(d, json_object_userdata_to_json_string,
- * strdup(ds), json_object_free_userdata)
- * @endcode
- *
- * @param d the numeric value of the double.
- * @param ds the string representation of the double. This will be copied.
- */
-extern struct json_object* json_object_new_double_s(double d, const char *ds);
-
-/** Get the double floating point value of a json_object
- *
- * The type is coerced to a double if the passed object is not a double.
- * integer objects will return their double conversion. Strings will be
- * parsed as a double. If no conversion exists then 0.0 is returned and
- * errno is set to EINVAL. null is equivalent to 0 (no error values set)
- *
- * If the value is too big to fit in a double, then the value is set to
- * the closest infinity with errno set to ERANGE. If strings cannot be
- * converted to their double value, then EINVAL is set & NaN is returned.
- *
- * Arrays of length 0 are interpreted as 0 (with no error flags set).
- * Arrays of length 1 are effectively cast to the equivalent object and
- * converted using the above rules. All other arrays set the error to
- * EINVAL & return NaN.
- *
- * NOTE: Set errno to 0 directly before a call to this function to
- * determine whether or not conversion was successful (it does not clear
- * the value for you).
- *
- * @param obj the json_object instance
- * @returns a double floating point number
- */
-extern double json_object_get_double(struct json_object *obj);
-
-
-/* string type methods */
-
-/** Create a new empty json_object of type json_type_string
- *
- * A copy of the string is made and the memory is managed by the json_object
- *
- * @param s the string
- * @returns a json_object of type json_type_string
- */
-extern struct json_object* json_object_new_string(const char *s);
-
-extern struct json_object* json_object_new_string_len(const char *s, int len);
-
-/** Get the string value of a json_object
- *
- * If the passed object is not of type json_type_string then the JSON
- * representation of the object is returned.
- *
- * The returned string memory is managed by the json_object and will
- * be freed when the reference count of the json_object drops to zero.
- *
- * @param obj the json_object instance
- * @returns a string
- */
-extern const char* json_object_get_string(struct json_object *obj);
-
-/** Get the string length of a json_object
- *
- * If the passed object is not of type json_type_string then zero
- * will be returned.
- *
- * @param obj the json_object instance
- * @returns int
- */
-extern int json_object_get_string_len(struct json_object *obj);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/include/json-c/json_object_iterator.h b/src/lib/install/include/json-c/json_object_iterator.h
deleted file mode 100644
index 44c9fb2..0000000
--- a/src/lib/install/include/json-c/json_object_iterator.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/**
-*******************************************************************************
-* @file json_object_iterator.h
-*
-* Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P.
-*
-* This library is free software; you can redistribute it and/or modify
-* it under the terms of the MIT license. See COPYING for details.
-*
-* @brief json-c forces clients to use its private data
-* structures for JSON Object iteration. This API
-* corrects that by abstracting the private json-c
-* details.
-*
-* API attributes: <br>
-* * Thread-safe: NO<br>
-* * Reentrant: NO
-*
-*******************************************************************************
-*/
-
-
-#ifndef JSON_OBJECT_ITERATOR_H
-#define JSON_OBJECT_ITERATOR_H
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Forward declaration for the opaque iterator information.
- */
-struct json_object_iter_info_;
-
-/**
- * The opaque iterator that references a name/value pair within
- * a JSON Object instance or the "end" iterator value.
- */
-struct json_object_iterator {
- const void* opaque_;
-};
-
-
-/**
- * forward declaration of json-c's JSON value instance structure
- */
-struct json_object;
-
-
-/**
- * Initializes an iterator structure to a "default" value that
- * is convenient for initializing an iterator variable to a
- * default state (e.g., initialization list in a class'
- * constructor).
- *
- * @code
- * struct json_object_iterator iter = json_object_iter_init_default();
- * MyClass() : iter_(json_object_iter_init_default())
- * @endcode
- *
- * @note The initialized value doesn't reference any specific
- * pair, is considered an invalid iterator, and MUST NOT
- * be passed to any json-c API that expects a valid
- * iterator.
- *
- * @note User and internal code MUST NOT make any assumptions
- * about and dependencies on the value of the "default"
- * iterator value.
- *
- * @return json_object_iterator
- */
-struct json_object_iterator
-json_object_iter_init_default(void);
-
-/** Retrieves an iterator to the first pair of the JSON Object.
- *
- * @warning Any modification of the underlying pair invalidates all
- * iterators to that pair.
- *
- * @param obj JSON Object instance (MUST be of type json_object)
- *
- * @return json_object_iterator If the JSON Object has at
- * least one pair, on return, the iterator refers
- * to the first pair. If the JSON Object doesn't
- * have any pairs, the returned iterator is
- * equivalent to the "end" iterator for the same
- * JSON Object instance.
- *
- * @code
- * struct json_object_iterator it;
- * struct json_object_iterator itEnd;
- * struct json_object* obj;
- *
- * obj = json_tokener_parse("{'first':'george', 'age':100}");
- * it = json_object_iter_begin(obj);
- * itEnd = json_object_iter_end(obj);
- *
- * while (!json_object_iter_equal(&it, &itEnd)) {
- * printf("%s\n",
- * json_object_iter_peek_name(&it));
- * json_object_iter_next(&it);
- * }
- *
- * @endcode
- */
-struct json_object_iterator
-json_object_iter_begin(struct json_object* obj);
-
-/** Retrieves the iterator that represents the position beyond the
- * last pair of the given JSON Object instance.
- *
- * @warning Do NOT write code that assumes that the "end"
- * iterator value is NULL, even if it is so in a
- * particular instance of the implementation.
- *
- * @note The reason we do not (and MUST NOT) provide
- * "json_object_iter_is_end(json_object_iterator* iter)"
- * type of API is because it would limit the underlying
- * representation of name/value containment (or force us
- * to add additional, otherwise unnecessary, fields to
- * the iterator structure). The "end" iterator and the
- * equality test method, on the other hand, permit us to
- * cleanly abstract pretty much any reasonable underlying
- * representation without burdening the iterator
- * structure with unnecessary data.
- *
- * @note For performance reasons, memorize the "end" iterator prior
- * to any loop.
- *
- * @param obj JSON Object instance (MUST be of type json_object)
- *
- * @return json_object_iterator On return, the iterator refers
- * to the "end" of the Object instance's pairs
- * (i.e., NOT the last pair, but "beyond the last
- * pair" value)
- */
-struct json_object_iterator
-json_object_iter_end(const struct json_object* obj);
-
-/** Returns an iterator to the next pair, if any
- *
- * @warning Any modification of the underlying pair
- * invalidates all iterators to that pair.
- *
- * @param iter [IN/OUT] Pointer to iterator that references a
- * name/value pair; MUST be a valid, non-end iterator.
- * WARNING: bad things will happen if invalid or "end"
- * iterator is passed. Upon return will contain the
- * reference to the next pair if there is one; if there
- * are no more pairs, will contain the "end" iterator
- * value, which may be compared against the return value
- * of json_object_iter_end() for the same JSON Object
- * instance.
- */
-void
-json_object_iter_next(struct json_object_iterator* iter);
-
-
-/** Returns a const pointer to the name of the pair referenced
- * by the given iterator.
- *
- * @param iter pointer to iterator that references a name/value
- * pair; MUST be a valid, non-end iterator.
- *
- * @warning bad things will happen if an invalid or
- * "end" iterator is passed.
- *
- * @return const char* Pointer to the name of the referenced
- * name/value pair. The name memory belongs to the
- * name/value pair, will be freed when the pair is
- * deleted or modified, and MUST NOT be modified or
- * freed by the user.
- */
-const char*
-json_object_iter_peek_name(const struct json_object_iterator* iter);
-
-
-/** Returns a pointer to the json-c instance representing the
- * value of the referenced name/value pair, without altering
- * the instance's reference count.
- *
- * @param iter pointer to iterator that references a name/value
- * pair; MUST be a valid, non-end iterator.
- *
- * @warning bad things will happen if invalid or
- * "end" iterator is passed.
- *
- * @return struct json_object* Pointer to the json-c value
- * instance of the referenced name/value pair; the
- * value's reference count is not changed by this
- * function: if you plan to hold on to this json-c node,
- * take a look at json_object_get() and
- * json_object_put(). IMPORTANT: json-c API represents
- * the JSON Null value as a NULL json_object instance
- * pointer.
- */
-struct json_object*
-json_object_iter_peek_value(const struct json_object_iterator* iter);
-
-
-/** Tests two iterators for equality. Typically used to test
- * for end of iteration by comparing an iterator to the
- * corresponding "end" iterator (that was derived from the same
- * JSON Object instance).
- *
- * @note The reason we do not (and MUST NOT) provide
- * "json_object_iter_is_end(json_object_iterator* iter)"
- * type of API is because it would limit the underlying
- * representation of name/value containment (or force us
- * to add additional, otherwise unnecessary, fields to
- * the iterator structure). The equality test method, on
- * the other hand, permits us to cleanly abstract pretty
- * much any reasonable underlying representation.
- *
- * @param iter1 Pointer to first valid, non-NULL iterator
- * @param iter2 POinter to second valid, non-NULL iterator
- *
- * @warning if a NULL iterator pointer or an uninitialized
- * or invalid iterator, or iterators derived from
- * different JSON Object instances are passed, bad things
- * will happen!
- *
- * @return json_bool non-zero if iterators are equal (i.e., both
- * reference the same name/value pair or are both at
- * "end"); zero if they are not equal.
- */
-json_bool
-json_object_iter_equal(const struct json_object_iterator* iter1,
- const struct json_object_iterator* iter2);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* JSON_OBJECT_ITERATOR_H */
diff --git a/src/lib/install/include/json-c/json_object_private.h b/src/lib/install/include/json-c/json_object_private.h
deleted file mode 100644
index 5ed791b..0000000
--- a/src/lib/install/include/json-c/json_object_private.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * $Id: json_object_private.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _json_object_private_h_
-#define _json_object_private_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (json_object_private_delete_fn)(struct json_object *o);
-
-struct json_object
-{
- enum json_type o_type;
- json_object_private_delete_fn *_delete;
- json_object_to_json_string_fn *_to_json_string;
- int _ref_count;
- struct printbuf *_pb;
- union data {
- json_bool c_boolean;
- double c_double;
- int64_t c_int64;
- struct lh_table *c_object;
- struct array_list *c_array;
- struct {
- char *str;
- int len;
- } c_string;
- } o;
- json_object_delete_fn *_user_delete;
- void *_userdata;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/include/json-c/json_tokener.h b/src/lib/install/include/json-c/json_tokener.h
deleted file mode 100644
index a72d2bd..0000000
--- a/src/lib/install/include/json-c/json_tokener.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * $Id: json_tokener.h,v 1.10 2006/07/25 03:24:50 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _json_tokener_h_
-#define _json_tokener_h_
-
-#include <stddef.h>
-#include "json_object.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum json_tokener_error {
- json_tokener_success,
- json_tokener_continue,
- json_tokener_error_depth,
- json_tokener_error_parse_eof,
- json_tokener_error_parse_unexpected,
- json_tokener_error_parse_null,
- json_tokener_error_parse_boolean,
- json_tokener_error_parse_number,
- json_tokener_error_parse_array,
- json_tokener_error_parse_object_key_name,
- json_tokener_error_parse_object_key_sep,
- json_tokener_error_parse_object_value_sep,
- json_tokener_error_parse_string,
- json_tokener_error_parse_comment,
- json_tokener_error_size
-};
-
-enum json_tokener_state {
- json_tokener_state_eatws,
- json_tokener_state_start,
- json_tokener_state_finish,
- json_tokener_state_null,
- json_tokener_state_comment_start,
- json_tokener_state_comment,
- json_tokener_state_comment_eol,
- json_tokener_state_comment_end,
- json_tokener_state_string,
- json_tokener_state_string_escape,
- json_tokener_state_escape_unicode,
- json_tokener_state_boolean,
- json_tokener_state_number,
- json_tokener_state_array,
- json_tokener_state_array_add,
- json_tokener_state_array_sep,
- json_tokener_state_object_field_start,
- json_tokener_state_object_field,
- json_tokener_state_object_field_end,
- json_tokener_state_object_value,
- json_tokener_state_object_value_add,
- json_tokener_state_object_sep,
- json_tokener_state_array_after_sep,
- json_tokener_state_object_field_start_after_sep,
- json_tokener_state_inf
-};
-
-struct json_tokener_srec
-{
- enum json_tokener_state state, saved_state;
- struct json_object *obj;
- struct json_object *current;
- char *obj_field_name;
-};
-
-#define JSON_TOKENER_DEFAULT_DEPTH 32
-
-struct json_tokener
-{
- char *str;
- struct printbuf *pb;
- int max_depth, depth, is_double, st_pos, char_offset;
- enum json_tokener_error err;
- unsigned int ucs_char;
- char quote_char;
- struct json_tokener_srec *stack;
- int flags;
-};
-
-/**
- * Be strict when parsing JSON input. Use caution with
- * this flag as what is considered valid may become more
- * restrictive from one release to the next, causing your
- * code to fail on previously working input.
- *
- * This flag is not set by default.
- *
- * @see json_tokener_set_flags()
- */
-#define JSON_TOKENER_STRICT 0x01
-
-/**
- * Given an error previously returned by json_tokener_get_error(),
- * return a human readable description of the error.
- *
- * @return a generic error message is returned if an invalid error value is provided.
- */
-const char *json_tokener_error_desc(enum json_tokener_error jerr);
-
-/**
- * Retrieve the error caused by the last call to json_tokener_parse_ex(),
- * or json_tokener_success if there is no error.
- *
- * When parsing a JSON string in pieces, if the tokener is in the middle
- * of parsing this will return json_tokener_continue.
- *
- * See also json_tokener_error_desc().
- */
-enum json_tokener_error json_tokener_get_error(struct json_tokener *tok);
-
-extern struct json_tokener* json_tokener_new(void);
-extern struct json_tokener* json_tokener_new_ex(int depth);
-extern void json_tokener_free(struct json_tokener *tok);
-extern void json_tokener_reset(struct json_tokener *tok);
-extern struct json_object* json_tokener_parse(const char *str);
-extern struct json_object* json_tokener_parse_verbose(const char *str, enum json_tokener_error *error);
-
-/**
- * Set flags that control how parsing will be done.
- */
-extern void json_tokener_set_flags(struct json_tokener *tok, int flags);
-
-/**
- * Parse a string and return a non-NULL json_object if a valid JSON value
- * is found. The string does not need to be a JSON object or array;
- * it can also be a string, number or boolean value.
- *
- * A partial JSON string can be parsed. If the parsing is incomplete,
- * NULL will be returned and json_tokener_get_error() will be return
- * json_tokener_continue.
- * json_tokener_parse_ex() can then be called with additional bytes in str
- * to continue the parsing.
- *
- * If json_tokener_parse_ex() returns NULL and the error anything other than
- * json_tokener_continue, a fatal error has occurred and parsing must be
- * halted. Then tok object must not be re-used until json_tokener_reset() is
- * called.
- *
- * When a valid JSON value is parsed, a non-NULL json_object will be
- * returned. Also, json_tokener_get_error() will return json_tokener_success.
- * Be sure to check the type with json_object_is_type() or
- * json_object_get_type() before using the object.
- *
- * @b XXX this shouldn't use internal fields:
- * Trailing characters after the parsed value do not automatically cause an
- * error. It is up to the caller to decide whether to treat this as an
- * error or to handle the additional characters, perhaps by parsing another
- * json value starting from that point.
- *
- * Extra characters can be detected by comparing the tok->char_offset against
- * the length of the last len parameter passed in.
- *
- * The tokener does \b not maintain an internal buffer so the caller is
- * responsible for calling json_tokener_parse_ex with an appropriate str
- * parameter starting with the extra characters.
- *
- * This interface is presently not 64-bit clean due to the int len argument
- * so the function limits the maximum string size to INT32_MAX (2GB).
- * If the function is called with len == -1 then strlen is called to check
- * the string length is less than INT32_MAX (2GB)
- *
- * Example:
- * @code
-json_object *jobj = NULL;
-const char *mystring = NULL;
-int stringlen = 0;
-enum json_tokener_error jerr;
-do {
- mystring = ... // get JSON string, e.g. read from file, etc...
- stringlen = strlen(mystring);
- jobj = json_tokener_parse_ex(tok, mystring, stringlen);
-} while ((jerr = json_tokener_get_error(tok)) == json_tokener_continue);
-if (jerr != json_tokener_success)
-{
- fprintf(stderr, "Error: %s\n", json_tokener_error_desc(jerr));
- // Handle errors, as appropriate for your application.
-}
-if (tok->char_offset < stringlen) // XXX shouldn't access internal fields
-{
- // Handle extra characters after parsed object as desired.
- // e.g. issue an error, parse another object from that point, etc...
-}
-// Success, use jobj here.
-
-@endcode
- *
- * @param tok a json_tokener previously allocated with json_tokener_new()
- * @param str an string with any valid JSON expression, or portion of. This does not need to be null terminated.
- * @param len the length of str
- */
-extern struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
- const char *str, int len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/include/json-c/json_util.h b/src/lib/install/include/json-c/json_util.h
deleted file mode 100644
index 1005e58..0000000
--- a/src/lib/install/include/json-c/json_util.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * $Id: json_util.h,v 1.4 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _json_util_h_
-#define _json_util_h_
-
-#include "json_object.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define JSON_FILE_BUF_SIZE 4096
-
-/* utility functions */
-extern struct json_object* json_object_from_file(const char *filename);
-extern int json_object_to_file(const char *filename, struct json_object *obj);
-extern int json_object_to_file_ext(const char *filename, struct json_object *obj, int flags);
-extern int json_parse_int64(const char *buf, int64_t *retval);
-extern int json_parse_double(const char *buf, double *retval);
-
-
-/**
- * Return a string describing the type of the object.
- * e.g. "int", or "object", etc...
- */
-extern const char *json_type_to_name(enum json_type o_type);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/include/json-c/linkhash.h b/src/lib/install/include/json-c/linkhash.h
deleted file mode 100644
index 950d09f..0000000
--- a/src/lib/install/include/json-c/linkhash.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * $Id: linkhash.h,v 1.6 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- * Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _linkhash_h_
-#define _linkhash_h_
-
-#include "json_object.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * golden prime used in hash functions
- */
-#define LH_PRIME 0x9e370001UL
-
-/**
- * The fraction of filled hash buckets until an insert will cause the table
- * to be resized.
- * This can range from just above 0 up to 1.0.
- */
-#define LH_LOAD_FACTOR 0.66
-
-/**
- * sentinel pointer value for empty slots
- */
-#define LH_EMPTY (void*)-1
-
-/**
- * sentinel pointer value for freed slots
- */
-#define LH_FREED (void*)-2
-
-struct lh_entry;
-
-/**
- * callback function prototypes
- */
-typedef void (lh_entry_free_fn) (struct lh_entry *e);
-/**
- * callback function prototypes
- */
-typedef unsigned long (lh_hash_fn) (const void *k);
-/**
- * callback function prototypes
- */
-typedef int (lh_equal_fn) (const void *k1, const void *k2);
-
-/**
- * An entry in the hash table
- */
-struct lh_entry {
- /**
- * The key.
- */
- void *k;
- /**
- * The value.
- */
- const void *v;
- /**
- * The next entry
- */
- struct lh_entry *next;
- /**
- * The previous entry.
- */
- struct lh_entry *prev;
-};
-
-
-/**
- * The hash table structure.
- */
-struct lh_table {
- /**
- * Size of our hash.
- */
- int size;
- /**
- * Numbers of entries.
- */
- int count;
-
- /**
- * Number of collisions.
- */
- int collisions;
-
- /**
- * Number of resizes.
- */
- int resizes;
-
- /**
- * Number of lookups.
- */
- int lookups;
-
- /**
- * Number of inserts.
- */
- int inserts;
-
- /**
- * Number of deletes.
- */
- int deletes;
-
- /**
- * Name of the hash table.
- */
- const char *name;
-
- /**
- * The first entry.
- */
- struct lh_entry *head;
-
- /**
- * The last entry.
- */
- struct lh_entry *tail;
-
- struct lh_entry *table;
-
- /**
- * A pointer onto the function responsible for freeing an entry.
- */
- lh_entry_free_fn *free_fn;
- lh_hash_fn *hash_fn;
- lh_equal_fn *equal_fn;
-};
-
-
-/**
- * Pre-defined hash and equality functions
- */
-extern unsigned long lh_ptr_hash(const void *k);
-extern int lh_ptr_equal(const void *k1, const void *k2);
-
-extern unsigned long lh_char_hash(const void *k);
-extern int lh_char_equal(const void *k1, const void *k2);
-
-
-/**
- * Convenience list iterator.
- */
-#define lh_foreach(table, entry) \
-for(entry = table->head; entry; entry = entry->next)
-
-/**
- * lh_foreach_safe allows calling of deletion routine while iterating.
- */
-#define lh_foreach_safe(table, entry, tmp) \
-for(entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp)
-
-
-
-/**
- * Create a new linkhash table.
- * @param size initial table size. The table is automatically resized
- * although this incurs a performance penalty.
- * @param name the table name.
- * @param free_fn callback function used to free memory for entries
- * when lh_table_free or lh_table_delete is called.
- * If NULL is provided, then memory for keys and values
- * must be freed by the caller.
- * @param hash_fn function used to hash keys. 2 standard ones are defined:
- * lh_ptr_hash and lh_char_hash for hashing pointer values
- * and C strings respectively.
- * @param equal_fn comparison function to compare keys. 2 standard ones defined:
- * lh_ptr_hash and lh_char_hash for comparing pointer values
- * and C strings respectively.
- * @return a pointer onto the linkhash table.
- */
-extern struct lh_table* lh_table_new(int size, const char *name,
- lh_entry_free_fn *free_fn,
- lh_hash_fn *hash_fn,
- lh_equal_fn *equal_fn);
-
-/**
- * Convenience function to create a new linkhash
- * table with char keys.
- * @param size initial table size.
- * @param name table name.
- * @param free_fn callback function used to free memory for entries.
- * @return a pointer onto the linkhash table.
- */
-extern struct lh_table* lh_kchar_table_new(int size, const char *name,
- lh_entry_free_fn *free_fn);
-
-
-/**
- * Convenience function to create a new linkhash
- * table with ptr keys.
- * @param size initial table size.
- * @param name table name.
- * @param free_fn callback function used to free memory for entries.
- * @return a pointer onto the linkhash table.
- */
-extern struct lh_table* lh_kptr_table_new(int size, const char *name,
- lh_entry_free_fn *free_fn);
-
-
-/**
- * Free a linkhash table.
- * If a callback free function is provided then it is called for all
- * entries in the table.
- * @param t table to free.
- */
-extern void lh_table_free(struct lh_table *t);
-
-
-/**
- * Insert a record into the table.
- * @param t the table to insert into.
- * @param k a pointer to the key to insert.
- * @param v a pointer to the value to insert.
- */
-extern int lh_table_insert(struct lh_table *t, void *k, const void *v);
-
-
-/**
- * Lookup a record into the table.
- * @param t the table to lookup
- * @param k a pointer to the key to lookup
- * @return a pointer to the record structure of the value or NULL if it does not exist.
- */
-extern struct lh_entry* lh_table_lookup_entry(struct lh_table *t, const void *k);
-
-/**
- * Lookup a record into the table
- * @param t the table to lookup
- * @param k a pointer to the key to lookup
- * @return a pointer to the found value or NULL if it does not exist.
- * @deprecated Use lh_table_lookup_ex instead.
- */
-THIS_FUNCTION_IS_DEPRECATED(extern const void* lh_table_lookup(struct lh_table *t, const void *k));
-
-/**
- * Lookup a record in the table
- * @param t the table to lookup
- * @param k a pointer to the key to lookup
- * @param v a pointer to a where to store the found value (set to NULL if it doesn't exist).
- * @return whether or not the key was found
- */
-extern json_bool lh_table_lookup_ex(struct lh_table *t, const void *k, void **v);
-
-/**
- * Delete a record from the table.
- * If a callback free function is provided then it is called for the
- * for the item being deleted.
- * @param t the table to delete from.
- * @param e a pointer to the entry to delete.
- * @return 0 if the item was deleted.
- * @return -1 if it was not found.
- */
-extern int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e);
-
-
-/**
- * Delete a record from the table.
- * If a callback free function is provided then it is called for the
- * for the item being deleted.
- * @param t the table to delete from.
- * @param k a pointer to the key to delete.
- * @return 0 if the item was deleted.
- * @return -1 if it was not found.
- */
-extern int lh_table_delete(struct lh_table *t, const void *k);
-
-extern int lh_table_length(struct lh_table *t);
-
-void lh_abort(const char *msg, ...);
-void lh_table_resize(struct lh_table *t, int new_size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/include/json-c/printbuf.h b/src/lib/install/include/json-c/printbuf.h
deleted file mode 100644
index b1bde7f..0000000
--- a/src/lib/install/include/json-c/printbuf.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * $Id: printbuf.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- *
- * Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
- * The copyrights to the contents of this file are licensed under the MIT License
- * (http://www.opensource.org/licenses/mit-license.php)
- */
-
-#ifndef _printbuf_h_
-#define _printbuf_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct printbuf {
- char *buf;
- int bpos;
- int size;
-};
-
-extern struct printbuf*
-printbuf_new(void);
-
-/* As an optimization, printbuf_memappend_fast is defined as a macro
- * that handles copying data if the buffer is large enough; otherwise
- * it invokes printbuf_memappend_real() which performs the heavy
- * lifting of realloc()ing the buffer and copying data.
- * Your code should not use printbuf_memappend directly--use
- * printbuf_memappend_fast instead.
- */
-extern int
-printbuf_memappend(struct printbuf *p, const char *buf, int size);
-
-#define printbuf_memappend_fast(p, bufptr, bufsize) \
-do { \
- if ((p->size - p->bpos) > bufsize) { \
- memcpy(p->buf + p->bpos, (bufptr), bufsize); \
- p->bpos += bufsize; \
- p->buf[p->bpos]= '\0'; \
- } else { printbuf_memappend(p, (bufptr), bufsize); } \
-} while (0)
-
-#define printbuf_length(p) ((p)->bpos)
-
-/**
- * Set len bytes of the buffer to charvalue, starting at offset offset.
- * Similar to calling memset(x, charvalue, len);
- *
- * The memory allocated for the buffer is extended as necessary.
- *
- * If offset is -1, this starts at the end of the current data in the buffer.
- */
-extern int
-printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len);
-
-extern int
-sprintbuf(struct printbuf *p, const char *msg, ...);
-
-extern void
-printbuf_reset(struct printbuf *p);
-
-extern void
-printbuf_free(struct printbuf *p);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/include/json-c/random_seed.h b/src/lib/install/include/json-c/random_seed.h
deleted file mode 100644
index 7362d67..0000000
--- a/src/lib/install/include/json-c/random_seed.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * random_seed.h
- *
- * Copyright (c) 2013 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef seed_h
-#define seed_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int json_c_get_random_seed();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/lib/install/include/yaml/yaml.h b/src/lib/install/include/yaml/yaml.h
deleted file mode 100644
index 80639c4..0000000
--- a/src/lib/install/include/yaml/yaml.h
+++ /dev/null
@@ -1,1970 +0,0 @@
-/**
- * @file yaml.h
- * @brief Public interface for libyaml.
- *
- * Include the header file with the code:
- * @code
- * #include <yaml.h>
- * @endcode
- */
-
-#ifndef YAML_H
-#define YAML_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-/**
- * @defgroup export Export Definitions
- * @{
- */
-
-/** The public API declaration. */
-
-#ifdef _WIN32
-# if defined(YAML_DECLARE_STATIC)
-# define YAML_DECLARE(type) type
-# elif defined(YAML_DECLARE_EXPORT)
-# define YAML_DECLARE(type) __declspec(dllexport) type
-# else
-# define YAML_DECLARE(type) __declspec(dllimport) type
-# endif
-#else
-# define YAML_DECLARE(type) type
-#endif
-
-/** @} */
-
-/**
- * @defgroup version Version Information
- * @{
- */
-
-/**
- * Get the library version as a string.
- *
- * @returns The function returns the pointer to a static string of the form
- * @c "X.Y.Z", where @c X is the major version number, @c Y is a minor version
- * number, and @c Z is the patch version number.
- */
-
-YAML_DECLARE(const char *)
-yaml_get_version_string(void);
-
-/**
- * Get the library version numbers.
- *
- * @param[out] major Major version number.
- * @param[out] minor Minor version number.
- * @param[out] patch Patch version number.
- */
-
-YAML_DECLARE(void)
-yaml_get_version(int *major, int *minor, int *patch);
-
-/** @} */
-
-/**
- * @defgroup basic Basic Types
- * @{
- */
-
-/** The character type (UTF-8 octet). */
-typedef unsigned char yaml_char_t;
-
-/** The version directive data. */
-typedef struct yaml_version_directive_s {
- /** The major version number. */
- int major;
- /** The minor version number. */
- int minor;
-} yaml_version_directive_t;
-
-/** The tag directive data. */
-typedef struct yaml_tag_directive_s {
- /** The tag handle. */
- yaml_char_t *handle;
- /** The tag prefix. */
- yaml_char_t *prefix;
-} yaml_tag_directive_t;
-
-/** The stream encoding. */
-typedef enum yaml_encoding_e {
- /** Let the parser choose the encoding. */
- YAML_ANY_ENCODING,
- /** The default UTF-8 encoding. */
- YAML_UTF8_ENCODING,
- /** The UTF-16-LE encoding with BOM. */
- YAML_UTF16LE_ENCODING,
- /** The UTF-16-BE encoding with BOM. */
- YAML_UTF16BE_ENCODING
-} yaml_encoding_t;
-
-/** Line break types. */
-
-typedef enum yaml_break_e {
- /** Let the parser choose the break type. */
- YAML_ANY_BREAK,
- /** Use CR for line breaks (Mac style). */
- YAML_CR_BREAK,
- /** Use LN for line breaks (Unix style). */
- YAML_LN_BREAK,
- /** Use CR LN for line breaks (DOS style). */
- YAML_CRLN_BREAK
-} yaml_break_t;
-
-/** Many bad things could happen with the parser and emitter. */
-typedef enum yaml_error_type_e {
- /** No error is produced. */
- YAML_NO_ERROR,
-
- /** Cannot allocate or reallocate a block of memory. */
- YAML_MEMORY_ERROR,
-
- /** Cannot read or decode the input stream. */
- YAML_READER_ERROR,
- /** Cannot scan the input stream. */
- YAML_SCANNER_ERROR,
- /** Cannot parse the input stream. */
- YAML_PARSER_ERROR,
- /** Cannot compose a YAML document. */
- YAML_COMPOSER_ERROR,
-
- /** Cannot write to the output stream. */
- YAML_WRITER_ERROR,
- /** Cannot emit a YAML stream. */
- YAML_EMITTER_ERROR
-} yaml_error_type_t;
-
-/** The pointer position. */
-typedef struct yaml_mark_s {
- /** The position index. */
- size_t index;
-
- /** The position line. */
- size_t line;
-
- /** The position column. */
- size_t column;
-} yaml_mark_t;
-
-/** @} */
-
-/**
- * @defgroup styles Node Styles
- * @{
- */
-
-/** Scalar styles. */
-typedef enum yaml_scalar_style_e {
- /** Let the emitter choose the style. */
- YAML_ANY_SCALAR_STYLE,
-
- /** The plain scalar style. */
- YAML_PLAIN_SCALAR_STYLE,
-
- /** The single-quoted scalar style. */
- YAML_SINGLE_QUOTED_SCALAR_STYLE,
- /** The double-quoted scalar style. */
- YAML_DOUBLE_QUOTED_SCALAR_STYLE,
-
- /** The literal scalar style. */
- YAML_LITERAL_SCALAR_STYLE,
- /** The folded scalar style. */
- YAML_FOLDED_SCALAR_STYLE
-} yaml_scalar_style_t;
-
-/** Sequence styles. */
-typedef enum yaml_sequence_style_e {
- /** Let the emitter choose the style. */
- YAML_ANY_SEQUENCE_STYLE,
-
- /** The block sequence style. */
- YAML_BLOCK_SEQUENCE_STYLE,
- /** The flow sequence style. */
- YAML_FLOW_SEQUENCE_STYLE
-} yaml_sequence_style_t;
-
-/** Mapping styles. */
-typedef enum yaml_mapping_style_e {
- /** Let the emitter choose the style. */
- YAML_ANY_MAPPING_STYLE,
-
- /** The block mapping style. */
- YAML_BLOCK_MAPPING_STYLE,
- /** The flow mapping style. */
- YAML_FLOW_MAPPING_STYLE
-/* YAML_FLOW_SET_MAPPING_STYLE */
-} yaml_mapping_style_t;
-
-/** @} */
-
-/**
- * @defgroup tokens Tokens
- * @{
- */
-
-/** Token types. */
-typedef enum yaml_token_type_e {
- /** An empty token. */
- YAML_NO_TOKEN,
-
- /** A STREAM-START token. */
- YAML_STREAM_START_TOKEN,
- /** A STREAM-END token. */
- YAML_STREAM_END_TOKEN,
-
- /** A VERSION-DIRECTIVE token. */
- YAML_VERSION_DIRECTIVE_TOKEN,
- /** A TAG-DIRECTIVE token. */
- YAML_TAG_DIRECTIVE_TOKEN,
- /** A DOCUMENT-START token. */
- YAML_DOCUMENT_START_TOKEN,
- /** A DOCUMENT-END token. */
- YAML_DOCUMENT_END_TOKEN,
-
- /** A BLOCK-SEQUENCE-START token. */
- YAML_BLOCK_SEQUENCE_START_TOKEN,
- /** A BLOCK-SEQUENCE-END token. */
- YAML_BLOCK_MAPPING_START_TOKEN,
- /** A BLOCK-END token. */
- YAML_BLOCK_END_TOKEN,
-
- /** A FLOW-SEQUENCE-START token. */
- YAML_FLOW_SEQUENCE_START_TOKEN,
- /** A FLOW-SEQUENCE-END token. */
- YAML_FLOW_SEQUENCE_END_TOKEN,
- /** A FLOW-MAPPING-START token. */
- YAML_FLOW_MAPPING_START_TOKEN,
- /** A FLOW-MAPPING-END token. */
- YAML_FLOW_MAPPING_END_TOKEN,
-
- /** A BLOCK-ENTRY token. */
- YAML_BLOCK_ENTRY_TOKEN,
- /** A FLOW-ENTRY token. */
- YAML_FLOW_ENTRY_TOKEN,
- /** A KEY token. */
- YAML_KEY_TOKEN,
- /** A VALUE token. */
- YAML_VALUE_TOKEN,
-
- /** An ALIAS token. */
- YAML_ALIAS_TOKEN,
- /** An ANCHOR token. */
- YAML_ANCHOR_TOKEN,
- /** A TAG token. */
- YAML_TAG_TOKEN,
- /** A SCALAR token. */
- YAML_SCALAR_TOKEN
-} yaml_token_type_t;
-
-/** The token structure. */
-typedef struct yaml_token_s {
-
- /** The token type. */
- yaml_token_type_t type;
-
- /** The token data. */
- union {
-
- /** The stream start (for @c YAML_STREAM_START_TOKEN). */
- struct {
- /** The stream encoding. */
- yaml_encoding_t encoding;
- } stream_start;
-
- /** The alias (for @c YAML_ALIAS_TOKEN). */
- struct {
- /** The alias value. */
- yaml_char_t *value;
- } alias;
-
- /** The anchor (for @c YAML_ANCHOR_TOKEN). */
- struct {
- /** The anchor value. */
- yaml_char_t *value;
- } anchor;
-
- /** The tag (for @c YAML_TAG_TOKEN). */
- struct {
- /** The tag handle. */
- yaml_char_t *handle;
- /** The tag suffix. */
- yaml_char_t *suffix;
- } tag;
-
- /** The scalar value (for @c YAML_SCALAR_TOKEN). */
- struct {
- /** The scalar value. */
- yaml_char_t *value;
- /** The length of the scalar value. */
- size_t length;
- /** The scalar style. */
- yaml_scalar_style_t style;
- } scalar;
-
- /** The version directive (for @c YAML_VERSION_DIRECTIVE_TOKEN). */
- struct {
- /** The major version number. */
- int major;
- /** The minor version number. */
- int minor;
- } version_directive;
-
- /** The tag directive (for @c YAML_TAG_DIRECTIVE_TOKEN). */
- struct {
- /** The tag handle. */
- yaml_char_t *handle;
- /** The tag prefix. */
- yaml_char_t *prefix;
- } tag_directive;
-
- } data;
-
- /** The beginning of the token. */
- yaml_mark_t start_mark;
- /** The end of the token. */
- yaml_mark_t end_mark;
-
-} yaml_token_t;
-
-/**
- * Free any memory allocated for a token object.
- *
- * @param[in,out] token A token object.
- */
-
-YAML_DECLARE(void)
-yaml_token_delete(yaml_token_t *token);
-
-/** @} */
-
-/**
- * @defgroup events Events
- * @{
- */
-
-/** Event types. */
-typedef enum yaml_event_type_e {
- /** An empty event. */
- YAML_NO_EVENT,
-
- /** A STREAM-START event. */
- YAML_STREAM_START_EVENT,
- /** A STREAM-END event. */
- YAML_STREAM_END_EVENT,
-
- /** A DOCUMENT-START event. */
- YAML_DOCUMENT_START_EVENT,
- /** A DOCUMENT-END event. */
- YAML_DOCUMENT_END_EVENT,
-
- /** An ALIAS event. */
- YAML_ALIAS_EVENT,
- /** A SCALAR event. */
- YAML_SCALAR_EVENT,
-
- /** A SEQUENCE-START event. */
- YAML_SEQUENCE_START_EVENT,
- /** A SEQUENCE-END event. */
- YAML_SEQUENCE_END_EVENT,
-
- /** A MAPPING-START event. */
- YAML_MAPPING_START_EVENT,
- /** A MAPPING-END event. */
- YAML_MAPPING_END_EVENT
-} yaml_event_type_t;
-
-/** The event structure. */
-typedef struct yaml_event_s {
-
- /** The event type. */
- yaml_event_type_t type;
-
- /** The event data. */
- union {
-
- /** The stream parameters (for @c YAML_STREAM_START_EVENT). */
- struct {
- /** The document encoding. */
- yaml_encoding_t encoding;
- } stream_start;
-
- /** The document parameters (for @c YAML_DOCUMENT_START_EVENT). */
- struct {
- /** The version directive. */
- yaml_version_directive_t *version_directive;
-
- /** The list of tag directives. */
- struct {
- /** The beginning of the tag directives list. */
- yaml_tag_directive_t *start;
- /** The end of the tag directives list. */
- yaml_tag_directive_t *end;
- } tag_directives;
-
- /** Is the document indicator implicit? */
- int implicit;
- } document_start;
-
- /** The document end parameters (for @c YAML_DOCUMENT_END_EVENT). */
- struct {
- /** Is the document end indicator implicit? */
- int implicit;
- } document_end;
-
- /** The alias parameters (for @c YAML_ALIAS_EVENT). */
- struct {
- /** The anchor. */
- yaml_char_t *anchor;
- } alias;
-
- /** The scalar parameters (for @c YAML_SCALAR_EVENT). */
- struct {
- /** The anchor. */
- yaml_char_t *anchor;
- /** The tag. */
- yaml_char_t *tag;
- /** The scalar value. */
- yaml_char_t *value;
- /** The length of the scalar value. */
- size_t length;
- /** Is the tag optional for the plain style? */
- int plain_implicit;
- /** Is the tag optional for any non-plain style? */
- int quoted_implicit;
- /** The scalar style. */
- yaml_scalar_style_t style;
- } scalar;
-
- /** The sequence parameters (for @c YAML_SEQUENCE_START_EVENT). */
- struct {
- /** The anchor. */
- yaml_char_t *anchor;
- /** The tag. */
- yaml_char_t *tag;
- /** Is the tag optional? */
- int implicit;
- /** The sequence style. */
- yaml_sequence_style_t style;
- } sequence_start;
-
- /** The mapping parameters (for @c YAML_MAPPING_START_EVENT). */
- struct {
- /** The anchor. */
- yaml_char_t *anchor;
- /** The tag. */
- yaml_char_t *tag;
- /** Is the tag optional? */
- int implicit;
- /** The mapping style. */
- yaml_mapping_style_t style;
- } mapping_start;
-
- } data;
-
- /** The beginning of the event. */
- yaml_mark_t start_mark;
- /** The end of the event. */
- yaml_mark_t end_mark;
-
-} yaml_event_t;
-
-/**
- * Create the STREAM-START event.
- *
- * @param[out] event An empty event object.
- * @param[in] encoding The stream encoding.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_stream_start_event_initialize(yaml_event_t *event,
- yaml_encoding_t encoding);
-
-/**
- * Create the STREAM-END event.
- *
- * @param[out] event An empty event object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_stream_end_event_initialize(yaml_event_t *event);
-
-/**
- * Create the DOCUMENT-START event.
- *
- * The @a implicit argument is considered as a stylistic parameter and may be
- * ignored by the emitter.
- *
- * @param[out] event An empty event object.
- * @param[in] version_directive The %YAML directive value or
- * @c NULL.
- * @param[in] tag_directives_start The beginning of the %TAG
- * directives list.
- * @param[in] tag_directives_end The end of the %TAG directives
- * list.
- * @param[in] implicit If the document start indicator is
- * implicit.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_document_start_event_initialize(yaml_event_t *event,
- yaml_version_directive_t *version_directive,
- yaml_tag_directive_t *tag_directives_start,
- yaml_tag_directive_t *tag_directives_end,
- int implicit);
-
-/**
- * Create the DOCUMENT-END event.
- *
- * The @a implicit argument is considered as a stylistic parameter and may be
- * ignored by the emitter.
- *
- * @param[out] event An empty event object.
- * @param[in] implicit If the document end indicator is implicit.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_document_end_event_initialize(yaml_event_t *event, int implicit);
-
-/**
- * Create an ALIAS event.
- *
- * @param[out] event An empty event object.
- * @param[in] anchor The anchor value.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor);
-
-/**
- * Create a SCALAR event.
- *
- * The @a style argument may be ignored by the emitter.
- *
- * Either the @a tag attribute or one of the @a plain_implicit and
- * @a quoted_implicit flags must be set.
- *
- * @param[out] event An empty event object.
- * @param[in] anchor The scalar anchor or @c NULL.
- * @param[in] tag The scalar tag or @c NULL.
- * @param[in] value The scalar value.
- * @param[in] length The length of the scalar value.
- * @param[in] plain_implicit If the tag may be omitted for the plain
- * style.
- * @param[in] quoted_implicit If the tag may be omitted for any
- * non-plain style.
- * @param[in] style The scalar style.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_scalar_event_initialize(yaml_event_t *event,
- yaml_char_t *anchor, yaml_char_t *tag,
- yaml_char_t *value, int length,
- int plain_implicit, int quoted_implicit,
- yaml_scalar_style_t style);
-
-/**
- * Create a SEQUENCE-START event.
- *
- * The @a style argument may be ignored by the emitter.
- *
- * Either the @a tag attribute or the @a implicit flag must be set.
- *
- * @param[out] event An empty event object.
- * @param[in] anchor The sequence anchor or @c NULL.
- * @param[in] tag The sequence tag or @c NULL.
- * @param[in] implicit If the tag may be omitted.
- * @param[in] style The sequence style.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_sequence_start_event_initialize(yaml_event_t *event,
- yaml_char_t *anchor, yaml_char_t *tag, int implicit,
- yaml_sequence_style_t style);
-
-/**
- * Create a SEQUENCE-END event.
- *
- * @param[out] event An empty event object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_sequence_end_event_initialize(yaml_event_t *event);
-
-/**
- * Create a MAPPING-START event.
- *
- * The @a style argument may be ignored by the emitter.
- *
- * Either the @a tag attribute or the @a implicit flag must be set.
- *
- * @param[out] event An empty event object.
- * @param[in] anchor The mapping anchor or @c NULL.
- * @param[in] tag The mapping tag or @c NULL.
- * @param[in] implicit If the tag may be omitted.
- * @param[in] style The mapping style.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_mapping_start_event_initialize(yaml_event_t *event,
- yaml_char_t *anchor, yaml_char_t *tag, int implicit,
- yaml_mapping_style_t style);
-
-/**
- * Create a MAPPING-END event.
- *
- * @param[out] event An empty event object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_mapping_end_event_initialize(yaml_event_t *event);
-
-/**
- * Free any memory allocated for an event object.
- *
- * @param[in,out] event An event object.
- */
-
-YAML_DECLARE(void)
-yaml_event_delete(yaml_event_t *event);
-
-/** @} */
-
-/**
- * @defgroup nodes Nodes
- * @{
- */
-
-/** The tag @c !!null with the only possible value: @c null. */
-#define YAML_NULL_TAG "tag:yaml.org,2002:null"
-/** The tag @c !!bool with the values: @c true and @c falce. */
-#define YAML_BOOL_TAG "tag:yaml.org,2002:bool"
-/** The tag @c !!str for string values. */
-#define YAML_STR_TAG "tag:yaml.org,2002:str"
-/** The tag @c !!int for integer values. */
-#define YAML_INT_TAG "tag:yaml.org,2002:int"
-/** The tag @c !!float for float values. */
-#define YAML_FLOAT_TAG "tag:yaml.org,2002:float"
-/** The tag @c !!timestamp for date and time values. */
-#define YAML_TIMESTAMP_TAG "tag:yaml.org,2002:timestamp"
-
-/** The tag @c !!seq is used to denote sequences. */
-#define YAML_SEQ_TAG "tag:yaml.org,2002:seq"
-/** The tag @c !!map is used to denote mapping. */
-#define YAML_MAP_TAG "tag:yaml.org,2002:map"
-
-/** The default scalar tag is @c !!str. */
-#define YAML_DEFAULT_SCALAR_TAG YAML_STR_TAG
-/** The default sequence tag is @c !!seq. */
-#define YAML_DEFAULT_SEQUENCE_TAG YAML_SEQ_TAG
-/** The default mapping tag is @c !!map. */
-#define YAML_DEFAULT_MAPPING_TAG YAML_MAP_TAG
-
-/** Node types. */
-typedef enum yaml_node_type_e {
- /** An empty node. */
- YAML_NO_NODE,
-
- /** A scalar node. */
- YAML_SCALAR_NODE,
- /** A sequence node. */
- YAML_SEQUENCE_NODE,
- /** A mapping node. */
- YAML_MAPPING_NODE
-} yaml_node_type_t;
-
-/** The forward definition of a document node structure. */
-typedef struct yaml_node_s yaml_node_t;
-
-/** An element of a sequence node. */
-typedef int yaml_node_item_t;
-
-/** An element of a mapping node. */
-typedef struct yaml_node_pair_s {
- /** The key of the element. */
- int key;
- /** The value of the element. */
- int value;
-} yaml_node_pair_t;
-
-/** The node structure. */
-struct yaml_node_s {
-
- /** The node type. */
- yaml_node_type_t type;
-
- /** The node tag. */
- yaml_char_t *tag;
-
- /** The node data. */
- union {
-
- /** The scalar parameters (for @c YAML_SCALAR_NODE). */
- struct {
- /** The scalar value. */
- yaml_char_t *value;
- /** The length of the scalar value. */
- size_t length;
- /** The scalar style. */
- yaml_scalar_style_t style;
- } scalar;
-
- /** The sequence parameters (for @c YAML_SEQUENCE_NODE). */
- struct {
- /** The stack of sequence items. */
- struct {
- /** The beginning of the stack. */
- yaml_node_item_t *start;
- /** The end of the stack. */
- yaml_node_item_t *end;
- /** The top of the stack. */
- yaml_node_item_t *top;
- } items;
- /** The sequence style. */
- yaml_sequence_style_t style;
- } sequence;
-
- /** The mapping parameters (for @c YAML_MAPPING_NODE). */
- struct {
- /** The stack of mapping pairs (key, value). */
- struct {
- /** The beginning of the stack. */
- yaml_node_pair_t *start;
- /** The end of the stack. */
- yaml_node_pair_t *end;
- /** The top of the stack. */
- yaml_node_pair_t *top;
- } pairs;
- /** The mapping style. */
- yaml_mapping_style_t style;
- } mapping;
-
- } data;
-
- /** The beginning of the node. */
- yaml_mark_t start_mark;
- /** The end of the node. */
- yaml_mark_t end_mark;
-
-};
-
-/** The document structure. */
-typedef struct yaml_document_s {
-
- /** The document nodes. */
- struct {
- /** The beginning of the stack. */
- yaml_node_t *start;
- /** The end of the stack. */
- yaml_node_t *end;
- /** The top of the stack. */
- yaml_node_t *top;
- } nodes;
-
- /** The version directive. */
- yaml_version_directive_t *version_directive;
-
- /** The list of tag directives. */
- struct {
- /** The beginning of the tag directives list. */
- yaml_tag_directive_t *start;
- /** The end of the tag directives list. */
- yaml_tag_directive_t *end;
- } tag_directives;
-
- /** Is the document start indicator implicit? */
- int start_implicit;
- /** Is the document end indicator implicit? */
- int end_implicit;
-
- /** The beginning of the document. */
- yaml_mark_t start_mark;
- /** The end of the document. */
- yaml_mark_t end_mark;
-
-} yaml_document_t;
-
-/**
- * Create a YAML document.
- *
- * @param[out] document An empty document object.
- * @param[in] version_directive The %YAML directive value or
- * @c NULL.
- * @param[in] tag_directives_start The beginning of the %TAG
- * directives list.
- * @param[in] tag_directives_end The end of the %TAG directives
- * list.
- * @param[in] start_implicit If the document start indicator is
- * implicit.
- * @param[in] end_implicit If the document end indicator is
- * implicit.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_document_initialize(yaml_document_t *document,
- yaml_version_directive_t *version_directive,
- yaml_tag_directive_t *tag_directives_start,
- yaml_tag_directive_t *tag_directives_end,
- int start_implicit, int end_implicit);
-
-/**
- * Delete a YAML document and all its nodes.
- *
- * @param[in,out] document A document object.
- */
-
-YAML_DECLARE(void)
-yaml_document_delete(yaml_document_t *document);
-
-/**
- * Get a node of a YAML document.
- *
- * The pointer returned by this function is valid until any of the functions
- * modifying the documents are called.
- *
- * @param[in] document A document object.
- * @param[in] index The node id.
- *
- * @returns the node objct or @c NULL if @c node_id is out of range.
- */
-
-YAML_DECLARE(yaml_node_t *)
-yaml_document_get_node(yaml_document_t *document, int index);
-
-/**
- * Get the root of a YAML document node.
- *
- * The root object is the first object added to the document.
- *
- * The pointer returned by this function is valid until any of the functions
- * modifying the documents are called.
- *
- * An empty document produced by the parser signifies the end of a YAML
- * stream.
- *
- * @param[in] document A document object.
- *
- * @returns the node object or @c NULL if the document is empty.
- */
-
-YAML_DECLARE(yaml_node_t *)
-yaml_document_get_root_node(yaml_document_t *document);
-
-/**
- * Create a SCALAR node and attach it to the document.
- *
- * The @a style argument may be ignored by the emitter.
- *
- * @param[in,out] document A document object.
- * @param[in] tag The scalar tag.
- * @param[in] value The scalar value.
- * @param[in] length The length of the scalar value.
- * @param[in] style The scalar style.
- *
- * @returns the node id or @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_document_add_scalar(yaml_document_t *document,
- yaml_char_t *tag, yaml_char_t *value, int length,
- yaml_scalar_style_t style);
-
-/**
- * Create a SEQUENCE node and attach it to the document.
- *
- * The @a style argument may be ignored by the emitter.
- *
- * @param[in,out] document A document object.
- * @param[in] tag The sequence tag.
- * @param[in] style The sequence style.
- *
- * @returns the node id or @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_document_add_sequence(yaml_document_t *document,
- yaml_char_t *tag, yaml_sequence_style_t style);
-
-/**
- * Create a MAPPING node and attach it to the document.
- *
- * The @a style argument may be ignored by the emitter.
- *
- * @param[in,out] document A document object.
- * @param[in] tag The sequence tag.
- * @param[in] style The sequence style.
- *
- * @returns the node id or @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_document_add_mapping(yaml_document_t *document,
- yaml_char_t *tag, yaml_mapping_style_t style);
-
-/**
- * Add an item to a SEQUENCE node.
- *
- * @param[in,out] document A document object.
- * @param[in] sequence The sequence node id.
- * @param[in] item The item node id.
-*
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_document_append_sequence_item(yaml_document_t *document,
- int sequence, int item);
-
-/**
- * Add a pair of a key and a value to a MAPPING node.
- *
- * @param[in,out] document A document object.
- * @param[in] mapping The mapping node id.
- * @param[in] key The key node id.
- * @param[in] value The value node id.
-*
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_document_append_mapping_pair(yaml_document_t *document,
- int mapping, int key, int value);
-
-/** @} */
-
-/**
- * @defgroup parser Parser Definitions
- * @{
- */
-
-/**
- * The prototype of a read handler.
- *
- * The read handler is called when the parser needs to read more bytes from the
- * source. The handler should write not more than @a size bytes to the @a
- * buffer. The number of written bytes should be set to the @a length variable.
- *
- * @param[in,out] data A pointer to an application data specified by
- * yaml_parser_set_input().
- * @param[out] buffer The buffer to write the data from the source.
- * @param[in] size The size of the buffer.
- * @param[out] size_read The actual number of bytes read from the source.
- *
- * @returns On success, the handler should return @c 1. If the handler failed,
- * the returned value should be @c 0. On EOF, the handler should set the
- * @a size_read to @c 0 and return @c 1.
- */
-
-typedef int yaml_read_handler_t(void *data, unsigned char *buffer, size_t size,
- size_t *size_read);
-
-/**
- * This structure holds information about a potential simple key.
- */
-
-typedef struct yaml_simple_key_s {
- /** Is a simple key possible? */
- int possible;
-
- /** Is a simple key required? */
- int required;
-
- /** The number of the token. */
- size_t token_number;
-
- /** The position mark. */
- yaml_mark_t mark;
-} yaml_simple_key_t;
-
-/**
- * The states of the parser.
- */
-typedef enum yaml_parser_state_e {
- /** Expect STREAM-START. */
- YAML_PARSE_STREAM_START_STATE,
- /** Expect the beginning of an implicit document. */
- YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE,
- /** Expect DOCUMENT-START. */
- YAML_PARSE_DOCUMENT_START_STATE,
- /** Expect the content of a document. */
- YAML_PARSE_DOCUMENT_CONTENT_STATE,
- /** Expect DOCUMENT-END. */
- YAML_PARSE_DOCUMENT_END_STATE,
- /** Expect a block node. */
- YAML_PARSE_BLOCK_NODE_STATE,
- /** Expect a block node or indentless sequence. */
- YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE,
- /** Expect a flow node. */
- YAML_PARSE_FLOW_NODE_STATE,
- /** Expect the first entry of a block sequence. */
- YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE,
- /** Expect an entry of a block sequence. */
- YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE,
- /** Expect an entry of an indentless sequence. */
- YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE,
- /** Expect the first key of a block mapping. */
- YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE,
- /** Expect a block mapping key. */
- YAML_PARSE_BLOCK_MAPPING_KEY_STATE,
- /** Expect a block mapping value. */
- YAML_PARSE_BLOCK_MAPPING_VALUE_STATE,
- /** Expect the first entry of a flow sequence. */
- YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE,
- /** Expect an entry of a flow sequence. */
- YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE,
- /** Expect a key of an ordered mapping. */
- YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE,
- /** Expect a value of an ordered mapping. */
- YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE,
- /** Expect the and of an ordered mapping entry. */
- YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE,
- /** Expect the first key of a flow mapping. */
- YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE,
- /** Expect a key of a flow mapping. */
- YAML_PARSE_FLOW_MAPPING_KEY_STATE,
- /** Expect a value of a flow mapping. */
- YAML_PARSE_FLOW_MAPPING_VALUE_STATE,
- /** Expect an empty value of a flow mapping. */
- YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE,
- /** Expect nothing. */
- YAML_PARSE_END_STATE
-} yaml_parser_state_t;
-
-/**
- * This structure holds aliases data.
- */
-
-typedef struct yaml_alias_data_s {
- /** The anchor. */
- yaml_char_t *anchor;
- /** The node id. */
- int index;
- /** The anchor mark. */
- yaml_mark_t mark;
-} yaml_alias_data_t;
-
-/**
- * The parser structure.
- *
- * All members are internal. Manage the structure using the @c yaml_parser_
- * family of functions.
- */
-
-typedef struct yaml_parser_s {
-
- /**
- * @name Error handling
- * @{
- */
-
- /** Error type. */
- yaml_error_type_t error;
- /** Error description. */
- const char *problem;
- /** The byte about which the problem occured. */
- size_t problem_offset;
- /** The problematic value (@c -1 is none). */
- int problem_value;
- /** The problem position. */
- yaml_mark_t problem_mark;
- /** The error context. */
- const char *context;
- /** The context position. */
- yaml_mark_t context_mark;
-
- /**
- * @}
- */
-
- /**
- * @name Reader stuff
- * @{
- */
-
- /** Read handler. */
- yaml_read_handler_t *read_handler;
-
- /** A pointer for passing to the read handler. */
- void *read_handler_data;
-
- /** Standard (string or file) input data. */
- union {
- /** String input data. */
- struct {
- /** The string start pointer. */
- const unsigned char *start;
- /** The string end pointer. */
- const unsigned char *end;
- /** The string current position. */
- const unsigned char *current;
- } string;
-
- /** File input data. */
- FILE *file;
- } input;
-
- /** EOF flag */
- int eof;
-
- /** The working buffer. */
- struct {
- /** The beginning of the buffer. */
- yaml_char_t *start;
- /** The end of the buffer. */
- yaml_char_t *end;
- /** The current position of the buffer. */
- yaml_char_t *pointer;
- /** The last filled position of the buffer. */
- yaml_char_t *last;
- } buffer;
-
- /* The number of unread characters in the buffer. */
- size_t unread;
-
- /** The raw buffer. */
- struct {
- /** The beginning of the buffer. */
- unsigned char *start;
- /** The end of the buffer. */
- unsigned char *end;
- /** The current position of the buffer. */
- unsigned char *pointer;
- /** The last filled position of the buffer. */
- unsigned char *last;
- } raw_buffer;
-
- /** The input encoding. */
- yaml_encoding_t encoding;
-
- /** The offset of the current position (in bytes). */
- size_t offset;
-
- /** The mark of the current position. */
- yaml_mark_t mark;
-
- /**
- * @}
- */
-
- /**
- * @name Scanner stuff
- * @{
- */
-
- /** Have we started to scan the input stream? */
- int stream_start_produced;
-
- /** Have we reached the end of the input stream? */
- int stream_end_produced;
-
- /** The number of unclosed '[' and '{' indicators. */
- int flow_level;
-
- /** The tokens queue. */
- struct {
- /** The beginning of the tokens queue. */
- yaml_token_t *start;
- /** The end of the tokens queue. */
- yaml_token_t *end;
- /** The head of the tokens queue. */
- yaml_token_t *head;
- /** The tail of the tokens queue. */
- yaml_token_t *tail;
- } tokens;
-
- /** The number of tokens fetched from the queue. */
- size_t tokens_parsed;
-
- /* Does the tokens queue contain a token ready for dequeueing. */
- int token_available;
-
- /** The indentation levels stack. */
- struct {
- /** The beginning of the stack. */
- int *start;
- /** The end of the stack. */
- int *end;
- /** The top of the stack. */
- int *top;
- } indents;
-
- /** The current indentation level. */
- int indent;
-
- /** May a simple key occur at the current position? */
- int simple_key_allowed;
-
- /** The stack of simple keys. */
- struct {
- /** The beginning of the stack. */
- yaml_simple_key_t *start;
- /** The end of the stack. */
- yaml_simple_key_t *end;
- /** The top of the stack. */
- yaml_simple_key_t *top;
- } simple_keys;
-
- /**
- * @}
- */
-
- /**
- * @name Parser stuff
- * @{
- */
-
- /** The parser states stack. */
- struct {
- /** The beginning of the stack. */
- yaml_parser_state_t *start;
- /** The end of the stack. */
- yaml_parser_state_t *end;
- /** The top of the stack. */
- yaml_parser_state_t *top;
- } states;
-
- /** The current parser state. */
- yaml_parser_state_t state;
-
- /** The stack of marks. */
- struct {
- /** The beginning of the stack. */
- yaml_mark_t *start;
- /** The end of the stack. */
- yaml_mark_t *end;
- /** The top of the stack. */
- yaml_mark_t *top;
- } marks;
-
- /** The list of TAG directives. */
- struct {
- /** The beginning of the list. */
- yaml_tag_directive_t *start;
- /** The end of the list. */
- yaml_tag_directive_t *end;
- /** The top of the list. */
- yaml_tag_directive_t *top;
- } tag_directives;
-
- /**
- * @}
- */
-
- /**
- * @name Dumper stuff
- * @{
- */
-
- /** The alias data. */
- struct {
- /** The beginning of the list. */
- yaml_alias_data_t *start;
- /** The end of the list. */
- yaml_alias_data_t *end;
- /** The top of the list. */
- yaml_alias_data_t *top;
- } aliases;
-
- /** The currently parsed document. */
- yaml_document_t *document;
-
- /**
- * @}
- */
-
-} yaml_parser_t;
-
-/**
- * Initialize a parser.
- *
- * This function creates a new parser object. An application is responsible
- * for destroying the object using the yaml_parser_delete() function.
- *
- * @param[out] parser An empty parser object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_parser_initialize(yaml_parser_t *parser);
-
-/**
- * Destroy a parser.
- *
- * @param[in,out] parser A parser object.
- */
-
-YAML_DECLARE(void)
-yaml_parser_delete(yaml_parser_t *parser);
-
-/**
- * Set a string input.
- *
- * Note that the @a input pointer must be valid while the @a parser object
- * exists. The application is responsible for destroing @a input after
- * destroying the @a parser.
- *
- * @param[in,out] parser A parser object.
- * @param[in] input A source data.
- * @param[in] size The length of the source data in bytes.
- */
-
-YAML_DECLARE(void)
-yaml_parser_set_input_string(yaml_parser_t *parser,
- const unsigned char *input, size_t size);
-
-/**
- * Set a file input.
- *
- * @a file should be a file object open for reading. The application is
- * responsible for closing the @a file.
- *
- * @param[in,out] parser A parser object.
- * @param[in] file An open file.
- */
-
-YAML_DECLARE(void)
-yaml_parser_set_input_file(yaml_parser_t *parser, FILE *file);
-
-/**
- * Set a generic input handler.
- *
- * @param[in,out] parser A parser object.
- * @param[in] handler A read handler.
- * @param[in] data Any application data for passing to the read
- * handler.
- */
-
-YAML_DECLARE(void)
-yaml_parser_set_input(yaml_parser_t *parser,
- yaml_read_handler_t *handler, void *data);
-
-/**
- * Set the source encoding.
- *
- * @param[in,out] parser A parser object.
- * @param[in] encoding The source encoding.
- */
-
-YAML_DECLARE(void)
-yaml_parser_set_encoding(yaml_parser_t *parser, yaml_encoding_t encoding);
-
-/**
- * Scan the input stream and produce the next token.
- *
- * Call the function subsequently to produce a sequence of tokens corresponding
- * to the input stream. The initial token has the type
- * @c YAML_STREAM_START_TOKEN while the ending token has the type
- * @c YAML_STREAM_END_TOKEN.
- *
- * An application is responsible for freeing any buffers associated with the
- * produced token object using the @c yaml_token_delete function.
- *
- * An application must not alternate the calls of yaml_parser_scan() with the
- * calls of yaml_parser_parse() or yaml_parser_load(). Doing this will break
- * the parser.
- *
- * @param[in,out] parser A parser object.
- * @param[out] token An empty token object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token);
-
-/**
- * Parse the input stream and produce the next parsing event.
- *
- * Call the function subsequently to produce a sequence of events corresponding
- * to the input stream. The initial event has the type
- * @c YAML_STREAM_START_EVENT while the ending event has the type
- * @c YAML_STREAM_END_EVENT.
- *
- * An application is responsible for freeing any buffers associated with the
- * produced event object using the yaml_event_delete() function.
- *
- * An application must not alternate the calls of yaml_parser_parse() with the
- * calls of yaml_parser_scan() or yaml_parser_load(). Doing this will break the
- * parser.
- *
- * @param[in,out] parser A parser object.
- * @param[out] event An empty event object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event);
-
-/**
- * Parse the input stream and produce the next YAML document.
- *
- * Call this function subsequently to produce a sequence of documents
- * constituting the input stream.
- *
- * If the produced document has no root node, it means that the document
- * end has been reached.
- *
- * An application is responsible for freeing any data associated with the
- * produced document object using the yaml_document_delete() function.
- *
- * An application must not alternate the calls of yaml_parser_load() with the
- * calls of yaml_parser_scan() or yaml_parser_parse(). Doing this will break
- * the parser.
- *
- * @param[in,out] parser A parser object.
- * @param[out] document An empty document object.
- *
- * @return @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document);
-
-/** @} */
-
-/**
- * @defgroup emitter Emitter Definitions
- * @{
- */
-
-/**
- * The prototype of a write handler.
- *
- * The write handler is called when the emitter needs to flush the accumulated
- * characters to the output. The handler should write @a size bytes of the
- * @a buffer to the output.
- *
- * @param[in,out] data A pointer to an application data specified by
- * yaml_emitter_set_output().
- * @param[in] buffer The buffer with bytes to be written.
- * @param[in] size The size of the buffer.
- *
- * @returns On success, the handler should return @c 1. If the handler failed,
- * the returned value should be @c 0.
- */
-
-typedef int yaml_write_handler_t(void *data, unsigned char *buffer, size_t size);
-
-/** The emitter states. */
-typedef enum yaml_emitter_state_e {
- /** Expect STREAM-START. */
- YAML_EMIT_STREAM_START_STATE,
- /** Expect the first DOCUMENT-START or STREAM-END. */
- YAML_EMIT_FIRST_DOCUMENT_START_STATE,
- /** Expect DOCUMENT-START or STREAM-END. */
- YAML_EMIT_DOCUMENT_START_STATE,
- /** Expect the content of a document. */
- YAML_EMIT_DOCUMENT_CONTENT_STATE,
- /** Expect DOCUMENT-END. */
- YAML_EMIT_DOCUMENT_END_STATE,
- /** Expect the first item of a flow sequence. */
- YAML_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE,
- /** Expect an item of a flow sequence. */
- YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE,
- /** Expect the first key of a flow mapping. */
- YAML_EMIT_FLOW_MAPPING_FIRST_KEY_STATE,
- /** Expect a key of a flow mapping. */
- YAML_EMIT_FLOW_MAPPING_KEY_STATE,
- /** Expect a value for a simple key of a flow mapping. */
- YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE,
- /** Expect a value of a flow mapping. */
- YAML_EMIT_FLOW_MAPPING_VALUE_STATE,
- /** Expect the first item of a block sequence. */
- YAML_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE,
- /** Expect an item of a block sequence. */
- YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE,
- /** Expect the first key of a block mapping. */
- YAML_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE,
- /** Expect the key of a block mapping. */
- YAML_EMIT_BLOCK_MAPPING_KEY_STATE,
- /** Expect a value for a simple key of a block mapping. */
- YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE,
- /** Expect a value of a block mapping. */
- YAML_EMIT_BLOCK_MAPPING_VALUE_STATE,
- /** Expect nothing. */
- YAML_EMIT_END_STATE
-} yaml_emitter_state_t;
-
-/**
- * The emitter structure.
- *
- * All members are internal. Manage the structure using the @c yaml_emitter_
- * family of functions.
- */
-
-typedef struct yaml_emitter_s {
-
- /**
- * @name Error handling
- * @{
- */
-
- /** Error type. */
- yaml_error_type_t error;
- /** Error description. */
- const char *problem;
-
- /**
- * @}
- */
-
- /**
- * @name Writer stuff
- * @{
- */
-
- /** Write handler. */
- yaml_write_handler_t *write_handler;
-
- /** A pointer for passing to the white handler. */
- void *write_handler_data;
-
- /** Standard (string or file) output data. */
- union {
- /** String output data. */
- struct {
- /** The buffer pointer. */
- unsigned char *buffer;
- /** The buffer size. */
- size_t size;
- /** The number of written bytes. */
- size_t *size_written;
- } string;
-
- /** File output data. */
- FILE *file;
- } output;
-
- /** The working buffer. */
- struct {
- /** The beginning of the buffer. */
- yaml_char_t *start;
- /** The end of the buffer. */
- yaml_char_t *end;
- /** The current position of the buffer. */
- yaml_char_t *pointer;
- /** The last filled position of the buffer. */
- yaml_char_t *last;
- } buffer;
-
- /** The raw buffer. */
- struct {
- /** The beginning of the buffer. */
- unsigned char *start;
- /** The end of the buffer. */
- unsigned char *end;
- /** The current position of the buffer. */
- unsigned char *pointer;
- /** The last filled position of the buffer. */
- unsigned char *last;
- } raw_buffer;
-
- /** The stream encoding. */
- yaml_encoding_t encoding;
-
- /**
- * @}
- */
-
- /**
- * @name Emitter stuff
- * @{
- */
-
- /** If the output is in the canonical style? */
- int canonical;
- /** The number of indentation spaces. */
- int best_indent;
- /** The preferred width of the output lines. */
- int best_width;
- /** Allow unescaped non-ASCII characters? */
- int unicode;
- /** The preferred line break. */
- yaml_break_t line_break;
-
- /** The stack of states. */
- struct {
- /** The beginning of the stack. */
- yaml_emitter_state_t *start;
- /** The end of the stack. */
- yaml_emitter_state_t *end;
- /** The top of the stack. */
- yaml_emitter_state_t *top;
- } states;
-
- /** The current emitter state. */
- yaml_emitter_state_t state;
-
- /** The event queue. */
- struct {
- /** The beginning of the event queue. */
- yaml_event_t *start;
- /** The end of the event queue. */
- yaml_event_t *end;
- /** The head of the event queue. */
- yaml_event_t *head;
- /** The tail of the event queue. */
- yaml_event_t *tail;
- } events;
-
- /** The stack of indentation levels. */
- struct {
- /** The beginning of the stack. */
- int *start;
- /** The end of the stack. */
- int *end;
- /** The top of the stack. */
- int *top;
- } indents;
-
- /** The list of tag directives. */
- struct {
- /** The beginning of the list. */
- yaml_tag_directive_t *start;
- /** The end of the list. */
- yaml_tag_directive_t *end;
- /** The top of the list. */
- yaml_tag_directive_t *top;
- } tag_directives;
-
- /** The current indentation level. */
- int indent;
-
- /** The current flow level. */
- int flow_level;
-
- /** Is it the document root context? */
- int root_context;
- /** Is it a sequence context? */
- int sequence_context;
- /** Is it a mapping context? */
- int mapping_context;
- /** Is it a simple mapping key context? */
- int simple_key_context;
-
- /** The current line. */
- int line;
- /** The current column. */
- int column;
- /** If the last character was a whitespace? */
- int whitespace;
- /** If the last character was an indentation character (' ', '-', '?', ':')? */
- int indention;
- /** If an explicit document end is required? */
- int open_ended;
-
- /** Anchor analysis. */
- struct {
- /** The anchor value. */
- yaml_char_t *anchor;
- /** The anchor length. */
- size_t anchor_length;
- /** Is it an alias? */
- int alias;
- } anchor_data;
-
- /** Tag analysis. */
- struct {
- /** The tag handle. */
- yaml_char_t *handle;
- /** The tag handle length. */
- size_t handle_length;
- /** The tag suffix. */
- yaml_char_t *suffix;
- /** The tag suffix length. */
- size_t suffix_length;
- } tag_data;
-
- /** Scalar analysis. */
- struct {
- /** The scalar value. */
- yaml_char_t *value;
- /** The scalar length. */
- size_t length;
- /** Does the scalar contain line breaks? */
- int multiline;
- /** Can the scalar be expessed in the flow plain style? */
- int flow_plain_allowed;
- /** Can the scalar be expressed in the block plain style? */
- int block_plain_allowed;
- /** Can the scalar be expressed in the single quoted style? */
- int single_quoted_allowed;
- /** Can the scalar be expressed in the literal or folded styles? */
- int block_allowed;
- /** The output style. */
- yaml_scalar_style_t style;
- } scalar_data;
-
- /**
- * @}
- */
-
- /**
- * @name Dumper stuff
- * @{
- */
-
- /** If the stream was already opened? */
- int opened;
- /** If the stream was already closed? */
- int closed;
-
- /** The information associated with the document nodes. */
- struct {
- /** The number of references. */
- int references;
- /** The anchor id. */
- int anchor;
- /** If the node has been emitted? */
- int serialized;
- } *anchors;
-
- /** The last assigned anchor id. */
- int last_anchor_id;
-
- /** The currently emitted document. */
- yaml_document_t *document;
-
- /**
- * @}
- */
-
-} yaml_emitter_t;
-
-/**
- * Initialize an emitter.
- *
- * This function creates a new emitter object. An application is responsible
- * for destroying the object using the yaml_emitter_delete() function.
- *
- * @param[out] emitter An empty parser object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_initialize(yaml_emitter_t *emitter);
-
-/**
- * Destroy an emitter.
- *
- * @param[in,out] emitter An emitter object.
- */
-
-YAML_DECLARE(void)
-yaml_emitter_delete(yaml_emitter_t *emitter);
-
-/**
- * Set a string output.
- *
- * The emitter will write the output characters to the @a output buffer of the
- * size @a size. The emitter will set @a size_written to the number of written
- * bytes. If the buffer is smaller than required, the emitter produces the
- * YAML_WRITE_ERROR error.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in] output An output buffer.
- * @param[in] size The buffer size.
- * @param[in] size_written The pointer to save the number of written
- * bytes.
- */
-
-YAML_DECLARE(void)
-yaml_emitter_set_output_string(yaml_emitter_t *emitter,
- unsigned char *output, size_t size, size_t *size_written);
-
-/**
- * Set a file output.
- *
- * @a file should be a file object open for writing. The application is
- * responsible for closing the @a file.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in] file An open file.
- */
-
-YAML_DECLARE(void)
-yaml_emitter_set_output_file(yaml_emitter_t *emitter, FILE *file);
-
-/**
- * Set a generic output handler.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in] handler A write handler.
- * @param[in] data Any application data for passing to the write
- * handler.
- */
-
-YAML_DECLARE(void)
-yaml_emitter_set_output(yaml_emitter_t *emitter,
- yaml_write_handler_t *handler, void *data);
-
-/**
- * Set the output encoding.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in] encoding The output encoding.
- */
-
-YAML_DECLARE(void)
-yaml_emitter_set_encoding(yaml_emitter_t *emitter, yaml_encoding_t encoding);
-
-/**
- * Set if the output should be in the "canonical" format as in the YAML
- * specification.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in] canonical If the output is canonical.
- */
-
-YAML_DECLARE(void)
-yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical);
-
-/**
- * Set the intendation increment.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in] indent The indentation increment (1 < . < 10).
- */
-
-YAML_DECLARE(void)
-yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent);
-
-/**
- * Set the preferred line width. @c -1 means unlimited.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in] width The preferred line width.
- */
-
-YAML_DECLARE(void)
-yaml_emitter_set_width(yaml_emitter_t *emitter, int width);
-
-/**
- * Set if unescaped non-ASCII characters are allowed.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in] unicode If unescaped Unicode characters are allowed.
- */
-
-YAML_DECLARE(void)
-yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode);
-
-/**
- * Set the preferred line break.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in] line_break The preferred line break.
- */
-
-YAML_DECLARE(void)
-yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break);
-
-/**
- * Emit an event.
- *
- * The event object may be generated using the yaml_parser_parse() function.
- * The emitter takes the responsibility for the event object and destroys its
- * content after it is emitted. The event object is destroyed even if the
- * function fails.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in,out] event An event object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event);
-
-/**
- * Start a YAML stream.
- *
- * This function should be used before yaml_emitter_dump() is called.
- *
- * @param[in,out] emitter An emitter object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_open(yaml_emitter_t *emitter);
-
-/**
- * Finish a YAML stream.
- *
- * This function should be used after yaml_emitter_dump() is called.
- *
- * @param[in,out] emitter An emitter object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_close(yaml_emitter_t *emitter);
-
-/**
- * Emit a YAML document.
- *
- * The documen object may be generated using the yaml_parser_load() function
- * or the yaml_document_initialize() function. The emitter takes the
- * responsibility for the document object and destoys its content after
- * it is emitted. The document object is destroyedeven if the function fails.
- *
- * @param[in,out] emitter An emitter object.
- * @param[in,out] document A document object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document);
-
-/**
- * Flush the accumulated characters to the output.
- *
- * @param[in,out] emitter An emitter object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_flush(yaml_emitter_t *emitter);
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* #ifndef YAML_H */
diff --git a/src/lib/ipc.c b/src/lib/ipc.c
deleted file mode 100755
index 1fea126..0000000
--- a/src/lib/ipc.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * @file ipc.c
- * @brief IPC implementation for API
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <stdbool.h>
-#include "ipc.h"
-
-#define MAXLINE 1024
-
-void ltoa(int val, char *string, int base, int str_size)
-{
- char buf[32] = {0};
- int i = 30;
- char *pos = NULL;
- for (; val && i; --i, val /= base) {
- buf[i] = "0123456789abcdef"[val%base];
- }
- if (string != NULL) {
- pos = &buf[i+1];
- snprintf(string, str_size, "%s", pos);
- }
-}
-
-int IPC_OpenServerConnection(char *server, SOCKET_HANDLE *phandle)
-{
- return IPC_SocketOpenServerConnection(server, phandle);
-}
-
-int IPC_OpenServerClose(SOCKET_HANDLE *phandle)
-{
- return IPC_SocketOpenServerClose(phandle);
-}
-
-int IPC_SendMessage(SOCKET_HANDLE *phandle, char *buf, int size)
-{
- char size_buf[32] = {0};
- char recvbuf[32] = {0};
-
- ltoa(size, size_buf, 10, sizeof(size_buf));
-
- //printf("<<IPC>> sendmessage!!\n");
- IPC_SocketSendMessage(phandle, size_buf, strlen(size_buf));
- printf("<<IPC>> SendMessage : SIZE(%d)=%s\n", (unsigned int)strlen(size_buf), size_buf);
- while (1) {
- if (IPC_SocketRecvMessage(phandle, recvbuf, 10) >= 0) {
- //printf("<<IPC>> sendmessage recvbuf=%s!!\n", recvbuf);
- break;
- }
- }
- //printf("<<IPC>> SendMessage : DATA(%d)=\n%s\n", strlen(buf), buf);
- IPC_SocketSendMessage(phandle, buf, size);
-
- return 0;
-}
-
-int IPC_RecvMessage(SOCKET_HANDLE *phandle, char *buf, int size)
-{
- IPC_SocketRecvMessage(phandle, buf, size);
- return 0;
-}
-
-int IPC_GetMessage(SOCKET_HANDLE *phandle, int *msgSize)
-{
- return IPC_SocketGetMessage(phandle, msgSize);
-}
-
-int IPC_ClientAccept(SOCKET_HANDLE *phandle)
-{
- return IPC_SocketClientAccept(phandle);
-}
-
-int IPC_OpenClientConnection(char *server, SOCKET_HANDLE *phandle)
-{
- return IPC_SocketOpenClientConnection(server, phandle);
-}
-
-int IPC_OpenClientClose(SOCKET_HANDLE *phandle)
-{
- return IPC_SocketOpenClientClose(phandle);
-}
-
-int IPC_SocketOpenServerConnection(char *server, SOCKET_HANDLE *phandle)
-{
- int state;
- int server_sockfd;
- struct sockaddr_un serveraddr;
-
- if (access(server, F_OK) == 0) {
- unlink(server);
- }
-
- if ((server_sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
- printf("<<IPC>> socket error !!! \n");
- return -1;
- }
-
- bzero(&serveraddr, sizeof(serveraddr));
- serveraddr.sun_family = AF_UNIX;
- snprintf(serveraddr.sun_path, sizeof(serveraddr.sun_path), "%s", server);
-
- state = bind(server_sockfd, (struct sockaddr *)&serveraddr, sizeof(serveraddr));
- if (state == -1) {
- printf("<<IPC>> bind error !\n");
- close(server_sockfd);
- return -1;
- }
-
- state = listen(server_sockfd, 5);
- if (state == -1) {
- printf("<<IPC>> listen error !!! \n");
- close(server_sockfd);
- return -1;
- }
-
- (phandle->server_h) = server_sockfd;
-
- return 0;
-
-}
-
-int IPC_SocketOpenServerClose(SOCKET_HANDLE *phandle)
-{
- return close(phandle->server_h);
-}
-
-int IPC_SocketOpenClientClose(SOCKET_HANDLE *phandle)
-{
- return close(phandle->client_h);
-}
-
-int IPC_SocketClientAccept(SOCKET_HANDLE *phandle)
-{
- struct sockaddr_un clientaddr;
- socklen_t client_len;
- int client_sockfd;
-
- printf("<< Accept>> server_h=%d\n", phandle->server_h);
- client_len = sizeof(clientaddr);
-
- while (1) {
- client_sockfd = accept(phandle->server_h, (struct sockaddr *)&clientaddr, &client_len);
- if (client_sockfd == -1) {
- printf("<<IPC>> [%s][%d] Error!! \n", __FUNCTION__, __LINE__);
- sleep(1);
- continue;
- }
-
- break;
- }
-
- phandle->client_h = client_sockfd;
- printf("<<IPC>> client = %d\n", phandle->client_h);
-
- return 0;
-}
-
-int IPC_SocketGetMessage(SOCKET_HANDLE *phandle, int *msgSize)
-{
- char buf[100] = {0,};
-
- IPC_SocketRecvMessage(phandle, buf, 32);
- //printf("<<IPC>> GetMessage = %s\n", buf);
- IPC_SocketSendMessage(phandle, buf, 10);
-
- (*msgSize) = atoi(buf);
- return 0;
-}
-
-int IPC_SocketRecvMessage(SOCKET_HANDLE *phandle, char * buf, int size)
-{
- int ret_size = 0;
- //printf("<<IPC>> recvMessage buf = %s\n", buf);
- while (1) {
- ret_size = read(phandle->client_h, buf, size);
- if (ret_size > 0)
- break;
- }
- //printf("<<IPC>> recvMessage = %s\n, size = %d, ret_size = %d", buf, size, ret_size);
- return 0;
-}
-
-int IPC_SocketSendMessage(SOCKET_HANDLE *phandle, char *buf, int size)
-{
- return write(phandle->client_h, buf, size);
-}
-
-
-int IPC_SocketOpenClientConnection(char *server, SOCKET_HANDLE *phandle)
-{
- struct sockaddr_un clientaddr;
- int client_sockfd;
- socklen_t client_len;
- int cnt = 0;
- bool connected = false;
- int ret = 0;
-
- client_sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
- if (client_sockfd == -1) {
- printf("<<IPC>> client error !!\n");
- return -1;
- }
-
- //bzero(&clientaddr, sizeof(clientaddr));
- memset(&clientaddr, 0, sizeof(clientaddr));
- clientaddr.sun_family = AF_UNIX;
- if (strlen(server) + 1 >= sizeof(clientaddr.sun_path)) {
- printf("<<IPC>> ERROR: server path(%d) too long >= UNIX_PATH_MAX(%d)\n", (unsigned int)strlen(server), (unsigned int)sizeof(clientaddr.sun_path));
- close(client_sockfd);
- return -1;
- } else {
- memcpy(clientaddr.sun_path, server, strlen(server) + 1);
- }
- client_len = sizeof(clientaddr);
-
- do {
- if (connect(client_sockfd, (struct sockaddr *)&clientaddr, client_len) >= 0) {
- printf("<<IPC>> server connection OK!!\n");
- connected = true;
- break;
- } else {
- printf("<<IPC>> connect error !!\n");
- sleep(1);
- }
- } while (++cnt < 3);
-
- if (false == connected) {
- printf("<<IPC>> client connect error !!\n");
- phandle->client_h = -1;
- ret = -1;
- close(client_sockfd);
- } else {
- phandle->client_h = client_sockfd;
- }
-
- return ret;
-}
diff --git a/src/lib/ipc.h b/src/lib/ipc.h
deleted file mode 100755
index e55d1d5..0000000
--- a/src/lib/ipc.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
- * @file ipc.h
- * @brief IPC implementation for API
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __IPC_H__
-#define __IPC_H__
-
-/**
- * @struct _IPC_SOCKET_HANDLE_s
- * @brief This struct contains IPC Socket handle
- *
- * The _IPC_SOCKET_HANDLE_s struct encapsulate server_h and client_h in the one data
- *
- */
- struct _IPC_SOCKET_HANDLE_s {
- int server_h;
- int client_h;
- };
- typedef struct _IPC_SOCKET_HANDLE_s SOCKET_HANDLE;
-
-/**
- * @fn int IPC_OpenServerConnection(char *server, SOCKET_HANDLE *phandle)
- * @brief This function to open server connection for IPC
- * @param *server [in] server information
- * @param *phandle [out] handle
- * @return int result of function
- */
-int IPC_OpenServerConnection(char *server, SOCKET_HANDLE * phandle);
-
-/**
- * @fn int IPC_OpenServerClose(SOCKET_HANDLE *phandle)
- * @brief This function to close server connection for IPC in server
- * @param *phandle [in] handle
- * @return int result of function
- */
-int IPC_OpenServerClose(SOCKET_HANDLE * phandle);
-
-/**
- * @fn int IPC_RecvMessage(SOCKET_HANDLE *phandle, char *buf, int size)
- * @brief This function to receive message through IPC in server
- * @param *phandle [in] handle
- * @param buf [out] buffer string
- * @param size [out] size
- * @return int result of function
- */
-int IPC_RecvMessage(SOCKET_HANDLE * phandle, char *buf, int size);
-
-/**
- * @fn int IPC_SendMessage(SOCKET_HANDLE *phandle, char *buf, int size)
- * @brief This function to send message through IPC in server
- * @param *phandle [in] handle
- * @param *buf [in] buffer string
- * @param size [in] size
- * @return int result of function
- */
-int IPC_SendMessage(SOCKET_HANDLE * phandle, char *buf, int size);
-
-/**
- * @fn int IPC_ClientAccept(SOCKET_HANDLE *phandle)
- * @brief This function to accept when it connects through IPC in server
- * @param *phandle [in] handle
- * @return int result of function
- */
-int IPC_ClientAccept(SOCKET_HANDLE * phandle);
-
-/**
- * @fn int IPC_GetMessage(SOCKET_HANDLE *phandle, int *msgSize)
- * @brief This function to get message size in server
- * @param *phandle [in] handle
- * @param *msgSize [out] message size
- * @return int result of function
- */
-int IPC_GetMessage(SOCKET_HANDLE * phandle, int *msgSize);
-
-/**
- * @fn int IPC_OpenClientConnection(char *server, SOCKET_HANDLE *phandle)
- * @brief This function to open client connection
- * @param *server [in] server information
- * @param *phandle [in] handle
- * @return int result of function
- */
-int IPC_OpenClientConnection(char *server, SOCKET_HANDLE * phandle);
-
-/**
- * @fn int IPC_OpenClientClose(SOCKET_HANDLE *phandle)
- * @brief This function to open client connection
- * @param *phandle [in] handle
- * @return int result of function
- */
-int IPC_OpenClientClose(SOCKET_HANDLE * phandle);
-
-/**
- * @fn void ltoa(int val, char *string, int base)
- * @brief This function to convert long to string
- * @param val [in] val
- * @param *string [out] converted string
- * @param base [in] base
- * @param str_size [in] string buffer size
- * @return int result of function
- */
-void ltoa(int val, char *string, int base, int str_size);
-
-/**
- * @fn int IPC_SocketOpenServerConnection(char *server, SOCKET_HANDLE *phandle)
- * @brief This function to open socket server connection
- * @param *server [in] server information
- * @param *phandle [in] handle
- * @return int result of function
- */
-int IPC_SocketOpenServerConnection(char *server, SOCKET_HANDLE * phandle);
-
-/**
- * @fn int IPC_SocketOpenServerClose(SOCKET_HANDLE *phandle)
- * @brief This function to close socket connection in server
- * @param *phandle [in] handle
- * @return int result of function
- */
-int IPC_SocketOpenServerClose(SOCKET_HANDLE * phandle);
-
-/**
- * @fn int IPC_SocketRecvMessage(SOCKET_HANDLE *phandle, char * buf, int size)
- * @brief This function to receive message from socket connection in server
- * @param *phandle [in] handle
- * @param *buf [out] buffer string
- * @param *size [out] buffer size
- * @return int result of function
- */
-int IPC_SocketRecvMessage(SOCKET_HANDLE * phandle, char *buf, int size);
-
-/**
- * @fn int IPC_SocketSendMessage(SOCKET_HANDLE *phandle, char *buf, int size)
- * @brief This function to send message from socket in client
- * @param *phandle [in] handle
- * @param *buf [in] buffer string
- * @param *size [in] buffer size
- * @return int result of function
- */
-int IPC_SocketSendMessage(SOCKET_HANDLE * phandle, char *buf, int size);
-
-/**
- * @fn int IPC_SocketServerSendMessage(SOCKET_HANDLE *phandle, char *buf, int size)
- * @brief This function to send message from socket in client
- * @param *phandle [in] handle
- * @param *buf [in] buffer string
- * @param *size [in] buffer size
- * @return int result of function
- */
-int IPC_SocketServerSendMessage(SOCKET_HANDLE * phandle, char *buf, int size);
-
-/**
- * @fn int IPC_SocketGetMessage(SOCKET_HANDLE *phandle, int *msgSize)
- * @brief This function to send message size from socket in server
- * @param *phandle [in] handle
- * @param *msgSize [in] get message size
- * @return int result of function
- */
-int IPC_SocketGetMessage(SOCKET_HANDLE * phandle, int *msgSize);
-
-/**
- * @fn int IPC_SocketClientAccept(SOCKET_HANDLE *phandle)
- * @brief This function to accept socket in client
- * @param *phandle [in] handle
- * @return int result of function
- */
-int IPC_SocketClientAccept(SOCKET_HANDLE * phandle);
-
-/**
- * @fn int IPC_SocketOpenClientConnection(char *server, SOCKET_HANDLE *phandle)
- * @brief This function to open socket connection in client
- * @param *server [in] server information
- * @param *phandle [in] handle
- * @return int result of function
- */
-int IPC_SocketOpenClientConnection(char *server, SOCKET_HANDLE * phandle);
-
-/**
- * @fn int IPC_SocketOpenClientClose(SOCKET_HANDLE *phandle);
- * @brief This function to close socket in client
- * @param *phandle [in] handle
- * @return int result of function
- */
-int IPC_SocketOpenClientClose(SOCKET_HANDLE * phandle);
-
-#endif /* __IPC_H__ */
diff --git a/src/lib/ipc_client.c b/src/lib/ipc_client.c
deleted file mode 100755
index 75027a5..0000000
--- a/src/lib/ipc_client.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/**
- * @file ipc_client.c
- * @brief client part using ipc methods
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include "json_util.h"
-#include "ipc.h"
-#include "ipc_client.h"
-#include "ipc_config.h"
-
-/**
- * @fn static int __client_open_connection(char *server, SOCKET_HANDLE* phndl)
- * @brief This function to open connection for client
- * @param *server [in] server information
- * @param *phndl [in] socket handle
- * @return int result of function
- */
-static int __client_open_connection(char *server, SOCKET_HANDLE* phndl)
-{
- int ret = 0;
-
- printf("<<Client>> __client_open_connection\n");
- ret = IPC_OpenClientConnection(server, phndl);
- if (0 == ret) {
- printf("<<Client>> phndl->client_h = %d\n", phndl->client_h);
- } else {
- printf("<<Client>> connection_init ERROR(%d) !!! {%s}\n", ret, SERVER);
- }
- return ret;
-}
-/**
- * @fn static int __client_close_connection(SOCKET_HANDLE* phndl)
- * @brief This function to close connection for client
- * @param *phndl [in] socket handle
- * @return int result of function
- */
-static int __client_close_connection(SOCKET_HANDLE* phndl)
-{
- int ret = 0;
-
- printf("<<Client>> __client_close_connection(*hndl=%p)\n", phndl);
- if (phndl)
- ret = IPC_OpenClientClose(phndl);
- return ret;
-}
-/**
- * @fn static int __client_send_data(void* data, int size, SOCKET_HANDLE* phndl)
- * @brief This function to send data in client side
- * @param *data [in] data to send
- * @param *size [in] size of data
- * @param *phndl [in] socket handle
- * @return int result of function
- */
-static int __client_send_data(void* data, int size, SOCKET_HANDLE* phndl)
-{
- int ret = 0;
-
- printf("<<Client>> __client_send_data(*hndl=%p)\n", phndl);
- if (phndl) {
- ret = IPC_SendMessage(phndl, data, size);
- printf("<<Client>> IPC_SendMessage(ret=%d)\n", ret);
- } else {
- ret = -1;
- }
- return ret;
-}
-/**
- * @fn static int __client_read__data(char** data, SOCKET_HANDLE* phndl)
- * @brief This function to send data in client side
- * @param **data [inout] buffter to copy for reading data
- * @param *phndl [in] socket handle
- * @return int result of function
- */
-static int __client_read__data(char** data, SOCKET_HANDLE* phndl)
-{
- int ret = 0;
- int msg_size = 0;
- char *buf = NULL;
-
- printf("<<Client>> __client_read__data(*hndl=%p) waiting...\n", phndl);
- if (phndl) {
- // read first message : data size
- ret = IPC_GetMessage(phndl, &msg_size);
- printf("<<Client>> IPC_GendMessage(ret=%d) : SIZE(%d)\n", ret, msg_size);
- if (msg_size > 0) {
- buf = (char *)malloc(msg_size +1);
- memset(buf, 0x00, msg_size+1);
-
- // read second message : real data buffer
- ret = IPC_RecvMessage(phndl, buf, msg_size);
- printf("<<Client>> IPC_GendMessage(ret=%d) : DATA=\n%s\n", ret, buf);
-
- *data = buf;
- }
- } else {
- ret = -1;
- }
- return ret;
-}
-
-static pthread_t callback_thread = (pthread_t) NULL;
-/**
- * @fn static char * __client_callback_thread(void * pv)
- * @brief This function to wait response when a API calls
- * @param *pv
- * @return void * result of function
- */
-static void * __client_callback_thread(void * pv)
-{
- SOCKET_HANDLE* cbhndl = NULL;
- SOCKET_HANDLE* pcbhndl = NULL;
- int ret = 0;
- char *buf = NULL;
- char *data = NULL;
-
- if (NULL == pcbhndl) {
- printf("<<Client-CB>> __client_callback_thread\n");
- cbhndl = (SOCKET_HANDLE*)malloc(sizeof(struct _IPC_SOCKET_HANDLE_s));
- if (cbhndl == NULL)
- return NULL;
-
- ret = __client_open_connection(EVENT_SERVER, cbhndl);
- if (0 == ret) {
- pcbhndl = cbhndl;
- printf("<<Client-CB>> pcbhndl->server_h = %d\n", pcbhndl->server_h);
- printf("<<Client-CB>> pcbhndl->client_h = %d\n", pcbhndl->client_h);
-
- do {
- ret = __client_read__data(&buf, cbhndl);
- if (0 == ret && buf) {
- printf("<<Client-CB>> receive {%s}\n", buf);
-
- ////////////////////////////////////////////////
- // TO-DO return real callback function~~~
- ////////////////////////////////////////////////
- typedef int(*func)(char*);
-
- data = json_getObject(buf, "callback_api");
- printf("<<Client-CB>> callback_api=%p\n", data);
- if (data) {
- (*(func)data)(buf);
- free(data);
- }
- //(*(container_update_cb)token->callback_wrap)(NULL, user_data);
-
- ////////////////////////////////////////////////
- free(buf);
- buf = NULL;
- } else {
- if (buf) {
- free(buf);
- buf = NULL;
- }
- printf("<<Client-CB>> callback receive ERROR!! (ret=%d)\n", ret);
- break;
- }
- } while (1);
- } else {
- printf("<<Client-CB>> __client_callback_thread ERROR(%d) !!! {%s}\n", ret, EVENT_SERVER);
- }
- }
-
- callback_thread = (pthread_t)NULL;
-
- __client_close_connection(cbhndl);
- if (cbhndl != NULL)
- free(cbhndl);
- return NULL;
-}
-
-int IPC_CallFunction(char * data, int size, char **retbuf)
-{
- //SOCKET_HANDLE hndl = {0, 0}; //socket handle is allocated for each function call
- SOCKET_HANDLE *hndl = NULL;
- char *buf = NULL;
- int ret = 0;
- //char *data;
- hndl = (SOCKET_HANDLE *)malloc(sizeof(struct _IPC_SOCKET_HANDLE_s));
- if (hndl == NULL)
- return -1;
-
- if ((pthread_t)NULL == callback_thread) {
- if (pthread_create(&callback_thread, NULL, &__client_callback_thread, NULL) < 0) {
- printf("<<Client>> __client_callback_thread thread create error\n");
- free(hndl);
- return -1;
- }
- }
-
- ret = __client_open_connection(SERVER, hndl);
- if (0 == ret) {
- ret = __client_send_data(data, strlen(data), hndl);
- if (0 == ret)
- ret = __client_read__data(&buf, hndl);
- } else {
- printf("<<Client>> server connection error !!\n");
- ret = -1;
- }
- if (buf)
- *retbuf = buf;
- __client_close_connection(hndl);
-
- if (hndl != NULL)
- free(hndl);
-
- return ret;
-}
diff --git a/src/lib/ipc_client.h b/src/lib/ipc_client.h
deleted file mode 100755
index f1b6e71..0000000
--- a/src/lib/ipc_client.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * @file ipc_client.h
- * @brief client part using ipc methods
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __IPC_CLIENT_H__
-#define __IPC_CLIENT_H__
-
-/**
- * @fn int IPC_CallFunction(char *data, int size, char **retbuf)
- * @brief this function to send data through IPC
- * @param *data [in] send data
- * @param size [in] size of data
- * @param **retbuf [in] return buffer string
- * @return int result of function
- */
-int IPC_CallFunction(char *data, int size, char **retbuf);
-
-/**
- * @fn int IPC_RegisterCallback(void)
- * @brief this function to register callback
- * @return int result of function
- */
-int IPC_RegisterCallback(void);
-
-#endif /* __IPC_CLIENT_H__ */
diff --git a/src/lib/ipc_config.h b/src/lib/ipc_config.h
deleted file mode 100755
index d902e5d..0000000
--- a/src/lib/ipc_config.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * @file ipc_config.h
- * @brief definition of ipc socket
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __IPC_CONFIG_H__
-#define __IPC_CONFIG_H__
-
-#define SERVER "/var/run/dockzen_launcher.sock"
-#define EVENT_SERVER "/var/run/dockzen_launcher_notify.sock"
-
-#endif
diff --git a/src/lib/json_util.c b/src/lib/json_util.c
deleted file mode 100755
index 448c972..0000000
--- a/src/lib/json_util.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * @file json_util.c
- * @brief Utility for json data, it extracts value from json
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "json_util.h"
-
-char *json_getString(char *data, char *key)
-{
- struct json_object *inputObj;
- struct json_object *bodyObj;
- enum json_type type;
- char *ret_buf = NULL;
- const char *buf = NULL;
- int i, j = 0;
-
- inputObj = json_tokener_parse(data);
- type = json_object_get_type(inputObj);
-
- if (type == json_type_object) {
- if (json_object_object_get_ex(inputObj, key, &bodyObj)) {
- buf = json_object_to_json_string_ext(bodyObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
- ret_buf = malloc(strlen(buf) - 1);
- if (ret_buf != NULL) {
- memset(ret_buf, 0x00, strlen(buf) - 1); // "<-- exclude
- for (i = 1, j = 0; i < strlen(buf) - 1; i++) { // "\ <-- exclude
- if (buf[i] == '\\')
- continue;
- ret_buf[j++] = buf[i];
- }
- }
- } else
- printf("ERROR : no data\n");
- }
- json_object_put(inputObj);
- printf("JSON>> ret_buf = %s\n", ret_buf);
-
- return ret_buf;
-}
-
-
-int json_getNumber(char *data, char *key)
-{
- struct json_object *inputObj;
- struct json_object *bodyObj;
- enum json_type type;
- int ret_num = 0;
-
- inputObj = json_tokener_parse(data);
- type = json_object_get_type(inputObj);
-
- if (type == json_type_object) {
- if (json_object_object_get_ex(inputObj, key, &bodyObj))
- ret_num = json_object_get_int(bodyObj);
- else
- printf("ERROR : no data\n");
- }
- json_object_put(inputObj);
-
- return ret_num;
-}
-
-
-char *json_getObject(char *data, char *key)
-{
- struct json_object *inputObj = NULL;
- struct json_object *bodyObj = NULL;
- const char *buf = NULL;
- char *ret_buf = NULL;
-
- inputObj = json_tokener_parse(data);
- if (inputObj != NULL) {
- if (json_object_object_get_ex(inputObj, key, &bodyObj)) {
- if (json_object_get_type(bodyObj) == json_type_object) {
- buf = json_object_to_json_string_ext(bodyObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
- ret_buf = (char *)malloc(strlen(buf) + 1);
- if (ret_buf != NULL) {
- memset(ret_buf, 0x00, strlen(buf) + 1);
- memcpy(ret_buf, buf, strlen(buf) + 1);
- }
- }
- }
- json_object_put(inputObj);
- }
- return ret_buf;
-}
-
-
-char *json_getArray(char *data, char *key)
-{
- struct json_object *inputObj, *bodyObj;
- enum json_type type;
- const char *buf = NULL;
- char *ret_buf = NULL;
-
- inputObj = json_tokener_parse(data);
- type = json_object_get_type(inputObj);
-
- if (type == json_type_object) {
- if (json_object_object_get_ex(inputObj, key, &bodyObj)) {
- type = json_object_get_type(bodyObj);
- if (type == json_type_array) {
- buf = json_object_to_json_string_ext(bodyObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
- ret_buf = malloc(strlen(buf) + 1);
- if (ret_buf != NULL) {
- memset(ret_buf, 0x00, strlen(buf) + 1);
- memcpy(ret_buf, buf, strlen(buf) + 1);
- }
- }
- }
- }
- json_object_put(inputObj);
-
- return ret_buf;
-}
-
-int json_getArrayLength(char *data)
-{
- struct json_object *inputObj;
- enum json_type type;
- int cnt = 0;
-
- inputObj = json_tokener_parse(data);
- type = json_object_get_type(inputObj);
-
- if (type == json_type_array)
- cnt = json_object_array_length(inputObj);
-
- return cnt;
-}
-
-char *json_getStringFromArray(char *data, char *arrayKey, int arrayIndex, char *key)
-{
- struct json_object *inputObj;
- struct json_object *bodyObj;
- struct json_object *arrayObj;
- struct json_object *elementObj;
- char *ret_buf = NULL;
- const char *buf = NULL;
- int i, j = 0;
-
- inputObj = json_tokener_parse(data);
- if (json_object_object_get_ex(inputObj, arrayKey, &arrayObj)) {
- elementObj = json_object_array_get_idx(arrayObj, arrayIndex);
- if (json_object_object_get_ex(elementObj, key, &bodyObj)) {
- buf = json_object_to_json_string_ext(bodyObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
- ret_buf = malloc(strlen(buf) - 1);
- if (ret_buf != NULL) {
- memset(ret_buf, 0x00, strlen(buf) - 1); // "<-- exclude
- for (i = 1, j = 0; i < strlen(buf) - 1; i++) { // "\ <-- exclude
- if (buf[i] == '\\')
- continue;
- ret_buf[j++] = buf[i];
- }
- }
- } else
- printf("ERROR : no data\n");
-
- json_object_put(inputObj);
- } else
- printf("ERROR : not found(%s)\n", arrayKey);
-
- return ret_buf;
-}
diff --git a/src/lib/json_util.h b/src/lib/json_util.h
deleted file mode 100755
index 7929b36..0000000
--- a/src/lib/json_util.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * @file json_util.h
- * @brief Utility for json data, it extracts value from json
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __JSON_UTIL_H__
-#define __JSON_UTIL_H__
-
-#include <json.h>
-
-/**
- * @fn char *json_getString(char *data, char *key)
- * @brief this function to get string from key in json data
- * @param data [in] json data
- * @param key [in] key for finding value
- * @return *char value of key
- */
-char *json_getString(char *data, char *key);
-/**
- * @fn char *json_getObject(char *data, char *key)
- * @brief this function to get object from key in json data
- * @param data [in] json data
- * @param key [in] key for finding value
- * @return *char object of key
- */
-char *json_getObject(char *data, char *key);
-/**
- * @fn int json_getNumber(char *data, char *key)
- * @brief this function to get number from key in json data
- * @param data [in] json data
- * @param key [in] key for finding value
- * @return int number of key
- */
-int json_getNumber(char *data, char *key);
-/**
- * @fn char *json_getArray(char *data, char *key)
- * @brief this function to get array from key in json data
- * @param data [in] json data
- * @param key [in] key for finding value
- * @return *char array json of key
- */
-char *json_getArray(char *data, char *key);
-/**
- * @fn int json_getArrayLength(char *data)
- * @brief this function to get number of array from key in json data
- * @param data [in] json data
- * @param key [in] key for finding value
- * @return int array count of key
- */
-int json_getArrayLength(char *data);
-/**
- * @fn char *json_getStringFromArray(char *data, char *arrayKey, int arrayIndex, char *key)
- * @brief this function to get string from array json data
- * @param data [in] json data
- * @param arrayKey [in] array key for value
- * @param arrayIndex [in] index of array
- * @param key [in] key for finding value
- * @return *char string of key
- */
-char *json_getStringFromArray(char *data, char *arrayKey, int arrayIndex, char *key);
-
-#endif /* __JSON_UTIL_H__ */
diff --git a/src/lib/test/CMakeLists.txt b/src/lib/test/CMakeLists.txt
deleted file mode 100644
index 19972f4..0000000
--- a/src/lib/test/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-SET(DOCKZEN_TEST "libdockzen_test")
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../../../include)
-FILE(GLOB DOCKZEN_TEST_SRCS *.c)
-
-ADD_EXECUTABLE(${DOCKZEN_TEST} ${DOCKZEN_TEST_SRCS})
-TARGET_LINK_LIBRARIES(${DOCKZEN_TEST} json-c)
-TARGET_LINK_LIBRARIES(${DOCKZEN_TEST} ${CMAKE_SOURCE_DIR}/../libdockzen.a)
diff --git a/src/lib/test/build.sh b/src/lib/test/build.sh
deleted file mode 100755
index 9f8e853..0000000
--- a/src/lib/test/build.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /bin/sh
-set -e
-
-# NOTE
-# build script for cli interface with cross-compile environment
-# for arm : ./build.sh arm
-# for amd64 : ./build.sh
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-
-# build
-EXECUTABLE_NAME="test"
-DOCKZEN_LIB_INCLUDE="../install/include/dockzen/"
-JSON_LIB_INCLUDE="../install/include/json-c/"
-
-if [ "$1" = "arm" ]; then
- echo "****************************"
- echo "Target Binary arch is ARM"
- echo "****************************"
- EXECUTABLE_NAME_ADD="-arm"
- BUILD_CMD="arm-linux-gnueabi-gcc-4.7"
- JSON_LIB="../install/arm/lib/"
- DOCKZEN_LIB="../install/arm/lib/"
-else
- echo "****************************"
- echo "Target Binary arch is amd64"
- echo "****************************"
- BUILD_CMD="gcc"
- JSON_LIB="../install/amd64/lib/"
- DOCKZEN_LIB="../install/amd64/lib/"
-fi
-
-$BUILD_CMD -static -g *.c -I$JSON_LIB_INCLUDE -I$DOCKZEN_LIB_INCLUDE \
--Wl,-Bstatic -L$DOCKZEN_LIB -l dockzen \
--Wl,-Bstatic -L$JSON_LIB -l json-c \
--l pthread \
--o $EXECUTABLE_NAME$EXECUTABLE_NAME_ADD
-
-echo "\033[47;34mbuilt successfully... \033[0m"
-file $EXECUTABLE_NAME$EXECUTABLE_NAME_ADD \ No newline at end of file
diff --git a/src/lib/test/client.c b/src/lib/test/client.c
deleted file mode 100755
index 7ae4b37..0000000
--- a/src/lib/test/client.c
+++ /dev/null
@@ -1,150 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "dockzen.h"
-
-#define RST printf("\033[0m")
-#define RED printf("\033[0;31m")
-#define GREEN printf("\033[0;32m")
-#define BLUE printf("\033[0;34m")
-#define IRED printf("\033[1;91m")
-#define IGREEN printf("\033[1;92m")
-#define IBLUE printf("\033[1;94m")
-#define BRED printf("\033[0;101m")
-#define BGREEN printf("\033[0;102m")
-#define BBLUE printf("\033[0;104m")
-
-#define NORMAL IRED
-#define ERR BRED
-#define DATA RED
-
-#define _D(fmt, ...) do { NORMAL; printf(fmt, ##__VA_ARGS__); RST; } while (0)
-#define _DATA(fmt, ...) do {DATA; printf(fmt, ##__VA_ARGS__); RST; } while (0)
-
-static int __client_get_containers_info_test(void)
-{
- int ret = 0;
- int index = 0;
- containers_info_s containers_info;
-
- _D("[CLIENT] call dockzen_get_containers_info~~~~~\n");
-
- ret = dockzen_get_containers_info(&containers_info);
-
- _D("[CLIENT] dockzen_get_containers_info returned(%d) !!!!\n", ret);
-
- if (!ret) {
- for (index = 0; index < containers_info.count; index++) {
- DATA;
- _DATA("[CLIENT] containers_info_s[%d] id = %s\n", index, containers_info.container[index].id);
- _DATA("[CLIENT] containers_info_s[%d] name = %s\n", index, containers_info.container[index].name);
- _DATA("[CLIENT] containers_info_s[%d] image_name = %s\n", index, containers_info.container[index].image_name);
- _DATA("[CLIENT] containers_info_s[%d] status = %s\n", index, containers_info.container[index].status);
- RST;
- }
- }
-
- for (index = 0; index < containers_info.count; index++) {
- if (containers_info.container[index].id)
- free(containers_info.container[index].id);
- if (containers_info.container[index].name)
- free(containers_info.container[index].name);
- if (containers_info.container[index].image_name)
- free(containers_info.container[index].image_name);
- if (containers_info.container[index].status)
- free(containers_info.container[index].status);
- }
-
- _D("[CLIENT] exit dockzen_get_containers_info(%d)~~~~~\n", ret);
- return ret;
-}
-
-//int dockzen_update_container(container_update_s *container_update, container_update_res_s *container_update_res, container_update_cb callback, void* user_data)
-
-//typedef void (*container_update_cb) (container_update_cb_s *status, void * user_data);
-
-static void __update_callback(container_update_cb_s * status, void *user_data)
-{
- container_update_cb callback;
- char *data;
- _D("[CLIENT] __update_callback !!!!!!!!!!!!!\n");
-
- // read status results
- _D("[CLIENT] container_name = {%s}\n", status->container_name);
- _D("[CLIENT] container_name = {%s}\n", status->image_name);
- _D("[CLIENT] container_name = {%s}\n", status->status);
-
- // read custom user_data
- _D("[CLIENT] user_data = {%s}\n", user_data);
-
-}
-
-static int __client_update_container_test(void)
-{
- int ret = 0;
- int index = 0;
- container_update_s update_info;
- container_update_res_s update_res;
- container_update_cb callback;
- void *user_data = "test";
-
- update_info.container_name = "tizen";
- update_info.image_name = "10.113.62.204:443\/headless:v0.3";
-
- _D("[CLIENT] call dockzen_update_container~~~~~\n");
- ret = dockzen_update_container(&update_info, &update_res, __update_callback, user_data);
-
- _D("[CLIENT] dockzen_update_container returned(%d) !!!!\n", ret);
- if (!ret) {
- DATA;
- _DATA("[CLIENT] update_res.container_name = %s\n", update_res.container_name);
- _DATA("[CLIENT] update_res.image_name_prev = %s\n", update_res.image_name_prev);
- _DATA("[CLIENT] update_res.image_name_new = %s\n", update_res.image_name_new);
- _DATA("[CLIENT] update_res.status = %s\n", update_res.status);
- RST;
- }
-
- if (update_res.container_name)
- free(update_res.container_name);
- if (update_res.image_name_prev)
- free(update_res.image_name_prev);
- if (update_res.image_name_new)
- free(update_res.image_name_new);
- if (update_res.status)
- free(update_res.status);
-
- _D("[CLIENT] exit dockzen_update_container(%d)~~~~~\n", ret);
- return ret;
-}
-
-void *client_thread(void *);
-
-void *client_thread(void *pv)
-{
- int num = 1;
- int ret = 0;
-
- do {
- _D("\n\n");
- _D("==================================\n");
- _D(" libdockzen test \n");
- _D("==================================\n");
- _D(" 1. dockzen_get_containers_info\n");
- _D(" 2. dockzen_update_container\n");
-
- scanf("%d", &num);
-
- switch (num) {
- case 1:
- ret = __client_get_containers_info_test();
- break;
- case 2:
- ret = __client_update_container_test();
- break;
- default:
- _D("Not support \n");
- }
- } while (1);
-
- exit(0);
-}
diff --git a/src/lib/test/server.c b/src/lib/test/server.c
deleted file mode 100755
index 104b951..0000000
--- a/src/lib/test/server.c
+++ /dev/null
@@ -1,321 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <pthread.h>
-
-#include "../ipc.h"
-#include "../ipc_config.h"
-#include "dockzen_types.h"
-
-#define RST printf("\033[0m")
-#define RED printf("\033[0;31m")
-#define GREEN printf("\033[0;32m")
-#define BLUE printf("\033[0;34m")
-#define IRED printf("\033[1;91m")
-#define IGREEN printf("\033[1;92m")
-#define IBLUE printf("\033[1;94m")
-#define BRED printf("\033[0;101m")
-#define BGREEN printf("\033[0;102m")
-#define BBLUE printf("\033[0;104m")
-
-#define NORMAL IBLUE
-#define ERR BBLUE
-#define DATA BLUE
-
-#define _D(fmt, ...) do {NORMAL; printf(fmt, ##__VA_ARGS__); RST; } while (0)
-#define _DATA(fmt, ...) do {DATA; printf(fmt, ##__VA_ARGS__); RST; } while (0)
-#define _ERR(fmt, ...) do {ERR; printf(fmt, ##__VA_ARGS__); RST; } while (0)
-
-// refer client functions
-extern void *client_thread(void *);
-// refer callback relative functions
-extern int callback_send_data(void *data);
-extern int callback_init_connection(void);
-
-// server callee parser template
-static int IPC_StartServer(char *(*pFunc) (char *, int))
-{
- SOCKET_HANDLE handle;
- int ret = 0;
- char *buf = NULL;
- int msgSize = 0;
- void *ret_buf = NULL;
-
- _D("[SERVER] dzl_server start\n");
-
- ret = IPC_OpenServerConnection(SERVER, &handle);
-
- _D("[SERVER] IPC_OpenServerConnection (ret=%d)\n", ret);
-
- if (ret >= 0) {
- while (1) {
- ret = IPC_ClientAccept(&handle);
- _D("[SERVER] IPC_ClientAccept (ret=%d)\n", ret);
-
- if (ret != -1) {
- ret = IPC_GetMessage(&handle, &msgSize);
- _D("[SERVER] msgSize = %d\n", msgSize);
-
- if (msgSize > 0) {
- buf = (char *)malloc(msgSize + 1);
- memset(buf, 0x00, msgSize + 1);
-
- IPC_RecvMessage(&handle, buf, msgSize);
- _DATA("[SERVER] recvData = %s\n", buf);
- /* Server mainloop */
- ret_buf = pFunc(buf, strlen(buf));
-
- _DATA("[SERVER] sendData = %s\n", ret_buf);
- IPC_SendMessage(&handle, ret_buf, strlen(ret_buf));
-
- if (ret_buf != NULL)
- free(ret_buf);
-
- if (buf != NULL)
- free(buf);
- _D("[SERVER] ipc completed...<<<<<<<<<<<<<<\n");
- }
- }
- }
- ret = IPC_OpenServerClose(&handle);
- } else {
- _ERR("[SERVER] server open error !!\n");
- return -1;
- }
-
- _D("[SERVER] close\n");
- return 0;
-
-}
-
-//////////////////////////////////////////////////////////////////
-// callee function body
-//////////////////////////////////////////////////////////////////
-static char *__stub_dockzen_get_containers_info(char *data)
-{
- _D("[SERVER] __stub_dockzen_get_containers_info\n");
- const char *ret_buf = "{\n" "\"count\": 2,\n" "\"container\": [\n" "{\n" "\"id\": \"iab2xuoil1qux1gsaidv5ty3v\",\n" "\"name\": \"tizen\",\n" "\"image_name\": \"10.113.62.204:443\/headless:v0.1@sha256:77e3292a583ecbb9f043185f8d439d86fb3b0325ae061986f1737991a6623d82\",\n" "\"status\": \"running\"\n" "},\n" "{\n" "\"id\": \"m1emzrg31u6tg2gkzob04s334\",\n" "\"name\": \"agent\",\n" "\"image_name\": \"10.113.62.204:443\/dockzen_agent:v1.0@sha256:32883df052ae8bd7ef3d0786e3e6e4473c113c65973bae9808fb4df42c000241\",\n" "\"status\": \"running\"\n" "}\n" "]\n" "}\n";
-
- char *p;
-
- p = malloc(strlen(ret_buf) + 1);
- memcpy(p, ret_buf, strlen(ret_buf));
-
- return p;
-}
-
-//////////////////////////////////////////////////////////////////
-// callee function body
-//////////////////////////////////////////////////////////////////
-
-struct token_struct {
- long callback_ptr;
- long user_data;
- long callback_ptr_api;
- void *callback_wrap;
-};
-
-static container_update_cb __update_container_cb(container_update_cb_s * status, void *user_data)
-{
- struct token_struct *token = (struct token_struct *)user_data;
-
- _D("[SERVER-CB] __update_container_cb called succefully~~~");
-
- _D("[SERVER-CB] token->callback_ptr = %d\n", token->callback_ptr);
- _D("[SERVER-CB] token->callback_ptr_api = %d\n", token->callback_ptr_api);
- _D("[SERVER-CB] token->user_data = %d\n", token->user_data);
-
- const char *ret_form_buf = "{\n" "\"callback\": %d,\n" "\"callback_api\": %d,\n" "\"user_data\": %d,\n" "\"container_name\": \"iab2xuoil1qux1gsaidv5ty3v\",\n" "\"image_name\": \"10.113.62.204:443\/headless:v0.1@sha256:77e3292a583ecbb9f043185f8d439d86fb3b0325ae061986f1737991a6623d82\",\n" "\"status\": \"DOCKZEN_UPDATE_STATE_STARTED\"\n" "}\n";
-
- char *p = malloc(strlen(ret_form_buf) + strlen(token->callback_ptr) + strlen(token->callback_ptr_api) + strlen(token->user_data) + 1);
- sprintf(p, ret_form_buf, token->callback_ptr, token->callback_ptr_api, token->user_data);
- _D("[SERVER-CB] event buff = \n%s\n", p);
-
- callback_send_data(p);
-
- if (user_data)
- free(user_data);
-}
-
-static void *__stub_callback_thread(void *user_data)
-{
- struct token_struct *token = (struct token_struct *)user_data;
-
- _D("[SERVER-CB] callback_thread\n");
- sleep(1);
- _D("[SERVER-CB] callback_thread\n");
- sleep(1);
- _D("[SERVER-CB] callback_thread\n");
- sleep(1);
-
- if (token->callback_wrap)
- (*(container_update_cb) token->callback_wrap) (NULL, user_data);
-
- _D("[SERVER-CB] callback_thread exit~~~~~~~~\n");
-}
-
-static char *___stub_dockzen_update_container(char *data)
-{
- _D("[SERVER] ___stub_dockzen_update_container\n");
-
- char *container_name = NULL;
- char *image_name = NULL;
- char *callback = NULL;
- char *user_data = NULL;
- char *callback_api = NULL;
- char *callback_wapper = (void *)__update_container_cb;
-
- if (data) {
- container_name = json_getString(data, "container_name");
- image_name = json_getString(data, "image_name");
- callback = json_getNumber(data, "callback");
- callback_api = json_getNumber(data, "callback_api");
- user_data = json_getNumber(data, "user_data");
- }
- _D("[SERVER] callback ptr =%d\n", callback);
- _D("[SERVER] callback_api ptr =%d\n", callback_api);
- _D("[SERVER] user_data ptr =%d\n", user_data);
-
- // stub - callback
- pthread_t thread;
- struct token_struct *token = malloc(sizeof(struct token_struct));
-
- token->callback_ptr = (int)callback;
- token->callback_ptr_api = (int)callback_api;
- token->user_data = (int)user_data;
- token->callback_wrap = (void *)callback_wapper;
- _D("[SERVER] token->callback_ptr =%p\n", token->callback_ptr);
- _D("[SERVER] token->callback_ptr_api =%p\n", token->callback_ptr_api);
- _D("[SERVER] token->user_data =%p\n", token->user_data);
- _D("[SERVER] token->callback_wrap =%p\n", token->callback_wrap);
-
- if (pthread_create(&thread, NULL, &__stub_callback_thread, (void *)token) < 0) {
- _ERR("[SERVER] __state_mainloop thread create error\n");
- return -1;
- }
- // return data buffer
- const char *ret_buf = "{\n" "\"container_name\": \"tizen\",\n" "\"image_name_prev\": \"test-version:v0.1\",\n" "\"image_name_new\": \"test-version:v0.2(update)\",\n" "\"status\": \"DOCKZEN_UPDATE_STATE_STARTED\"\n" "}\n";
-
- char *p = malloc(strlen(ret_buf) + 1);
- memcpy(p, ret_buf, strlen(ret_buf));
-
- return p;
-}
-
-//////////////////////////////////////////////////////////////////
-// callee function list structure & register
-//////////////////////////////////////////////////////////////////
-typedef char *(*cmdFunctionPtr) (char *);
-struct _cmd_table_s {
- char cmd[50];
- cmdFunctionPtr func;
-};
-typedef struct _cmd_table_s cmd_mapping_tables;
-
-cmd_mapping_tables cmd_mapping_table[] = {
- {"dockzen_get_containers_info", __stub_dockzen_get_containers_info},
-// {"GetDockerInfo", dockerlauncher_docker_info},
-// {"CreateImage", dockerlauncher_createImage},
- {"dockzen_update_container", ___stub_dockzen_update_container},
-// {"RestartContainer", dockerlauncher_restartContainer},
- {"end", NULL}
-};
-
-static char *dockzen_api_parser(char *data, int size)
-{
- char *func = NULL;
- char *param = NULL;
- char *ret_buf = NULL;
- int i = 0;
-
- _D("dockzen_api_parser\n");
-
- func = json_getString(data, "func");
- param = json_getObject(data, "param");
-
- _D("func:%s\n", func);
- _D("param:%s\n", param);
-
- while (1) {
- if (!strncmp(cmd_mapping_table[i].cmd, "end", strlen("end")))
- break;
- if (!strncmp(cmd_mapping_table[i].cmd, func, strlen(func))) {
- ret_buf = cmd_mapping_table[i].func(param);
- _D("[SERVER] ret_buf=%p\n", ret_buf);
- break;
- }
- i++;
- }
- _D("[SERVER] ret_buf=%s\n", ret_buf);
- if (func != NULL)
- free(func);
- if (param != NULL)
- free(param);
-
- _D("[SERVER] call completed...\n");
- return ret_buf;
-}
-
-static void *_server_init(void *pv)
-{
- char *(*pFunc) (char *, int) = dockzen_api_parser;
-
- _D("[SERVER] dockzen_api_init\n");
-
- if (IPC_StartServer(pFunc) < 0) {
- _ERR("[SERVER] IPC_StartServer Failed\n");
- return -1;
- }
-}
-
-//////////////////////////////////////////////////////////////////
-// server main
-//////////////////////////////////////////////////////////////////
-int main(int argc, char **argv)
-{
- pthread_attr_t attr;
- int stack_size = 1000000;
- pthread_t t_client;
- pthread_t t_server_func;
- pthread_t t_server_cb;
- int status;
- int ret;
-
- _D("[SERVER] main function...\n");
-
- pthread_attr_t tattr;
- size_t size;
- ret = pthread_attr_getstacksize(&tattr, &size);
- printf("<<<MAIN>>> ret=%d,size=%u\n", ret, size);
-
- ret = pthread_create(&t_client, NULL, &client_thread, (void *)NULL);
- if (ret < 0) {
- _ERR("[SERVER] __state_mainloop thread create error (ret=%d)\n", ret);
- return -1;
- }
-
- ret = callback_init_connection();
- if (0 != ret)
- _ERR("[SERVER] callback_init_connection error (ret=%d)\n", ret);
- /*
- if (pthread_create(&t_server_cb, NULL, &callback_thread, (void*)NULL) < 0) {
- _ERR("[SERVER] thread_server_func create error\n");
- return -1;
- }
- */
-
- _server_init(NULL);
- /*
- if (pthread_create(&t_server_func, &attr, &_server_init, (void*)NULL) < 0) {
- _ERR("[SERVER] __state_mainloop thread create error\n");
- return -1;
- }
- */
-
- //pthread_join(t_client, (void **)&status);
- pthread_join(t_server_func, (void **)&status);
- _D("[SERVER] client closed\n");
-
- return 1;
-}
diff --git a/src/lib/test/server_cb.c b/src/lib/test/server_cb.c
deleted file mode 100755
index 60d458c..0000000
--- a/src/lib/test/server_cb.c
+++ /dev/null
@@ -1,90 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <pthread.h>
-
-#include "../ipc.h"
-#include "../ipc_config.h"
-#include "dockzen_types.h"
-
-#define RST printf("\033[0m")
-#define RED printf("\033[0;31m")
-#define GREEN printf("\033[0;32m")
-#define BLUE printf("\033[0;34m")
-#define IRED printf("\033[1;91m")
-#define IGREEN printf("\033[1;92m")
-#define IBLUE printf("\033[1;94m")
-#define BRED printf("\033[0;101m")
-#define BGREEN printf("\033[0;102m")
-#define BBLUE printf("\033[0;104m")
-
-#define NORMAL IBLUE
-#define ERR BBLUE
-#define DATA BLUE
-
-#define _D(fmt, ...) do {NORMAL; printf(fmt, ##__VA_ARGS__); RST; } while (0)
-#define _DATA(fmt, ...) do {DATA; printf(fmt, ##__VA_ARGS__); RST; } while (0)
-#define _ERR(fmt, ...) do {ERR; printf(fmt, ##__VA_ARGS__); RST; } while (0)
-
-static SOCKET_HANDLE __cbhndl;
-static SOCKET_HANDLE *__pcbhndl = NULL;
-
-static int __send_callback_event(void *data)
-{
- int ret = -1;
- if (__pcbhndl && data)
- ret = IPC_SendMessage(__pcbhndl, data, strlen(data));
-
- return ret;
-}
-
-static int __open_callback_connection(void)
-{
- int ret = 0;
- char *buf = NULL;
- int msgSize = 0;
- void *ret_buf = NULL;
-
- _D("[SERVER-CB] dzl_server start\n");
-
- ret = IPC_OpenServerConnection(EVENT_SERVER, &__cbhndl);
-
- _D("[SERVER-CB] IPC_OpenServerConnection (ret=%d)\n", ret);
-
- if (ret >= 0) {
- __pcbhndl = &__cbhndl;
-
- ret = IPC_ClientAccept(__pcbhndl);
- _D("[SERVER-CB] IPC_ClientAccept (ret=%d)\n", ret);
- if (0 != ret)
- _ERR("[SERVER-CB] error (%d)\n", ret);
- } else {
- _ERR("[SERVER-CB] server open error !!\n");
- }
-
- return ret;
-
-}
-
-int callback_send_data(void *data)
-{
- int ret = 0;
- ret = __send_callback_event(data);
- if (0 != ret)
- _ERR("[SERVER-CB] __send_callback_event Failed\n");
-
- return ret;
-}
-
-int callback_init_connection(void)
-{
- int ret = 0;
- _D("[SERVER-CB] callback_thread\n");
-
- ret = __open_callback_connection();
- if (0 != ret)
- _ERR("[SERVER-CB] __open_callback_connection Failed\n");
-
- return ret;
-}
diff --git a/src/lib/test/test b/src/lib/test/test
deleted file mode 100755
index 3395d46..0000000
--- a/src/lib/test/test
+++ /dev/null
Binary files differ
diff --git a/src/lib/test/test-arm b/src/lib/test/test-arm
deleted file mode 100755
index 527fa6a..0000000
--- a/src/lib/test/test-arm
+++ /dev/null
Binary files differ
diff --git a/src/lib/yaml_util.c b/src/lib/yaml_util.c
deleted file mode 100644
index e6797c5..0000000
--- a/src/lib/yaml_util.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * @file yaml_util.c
- * @brief Utility for yaml data, it extracts value from yaml
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "yaml_util.h"
-
-#define DEBUG
-
-int yaml_getContents(char *file_name, char *contentsKey, char **retVal)
-{
- yaml_parser_t parser;
- yaml_token_t token;
- FILE *file;
- int stateYAML = YAML_NO_TOKEN;
- char *scalarTokenVal = NULL;
- int scalarTokenLen = 0;
- char keyTokenVal[256] = {0, };
- char retTmp[256];
- int retTmpLen;
- int blockSequenceCnt = 0;
-
- file = fopen(file_name, "r");
- if (file == NULL) {
- DEBUG("Failed to open file");
- return -1;
- }
- /* Initialize parser */
- if (!yaml_parser_initialize(&parser)) {
- DEBUG("Failed to initialize parser!!!");
- fclose(file);
- return -2;
- }
- /* Set input file */
- yaml_parser_set_input_file(&parser, file);
-
- /* BEGIN new code */
- do {
- yaml_parser_scan(&parser, &token);
- switch (token.type) {
-
- case YAML_KEY_TOKEN:
- DEBUG("[YAML_KEY_TOKEN]");
- stateYAML = YAML_KEY_TOKEN;
- break;
- case YAML_VALUE_TOKEN:
- DEBUG("[YAML_VALUE_TOKEN]");
- stateYAML = YAML_VALUE_TOKEN;
- break;
- case YAML_BLOCK_SEQUENCE_START_TOKEN:
- DEBUG("[YAML_BLOCK_SEQUENCE_START_TOKEN]");
- blockSequenceCnt = 0;
- memset(retTmp, 0x00, 256);
- retTmpLen = 0;
- break;
- case YAML_BLOCK_ENTRY_TOKEN:
- DEBUG("[YAML_BLOCK_ENTRY_TOKEN]");
- stateYAML = YAML_BLOCK_ENTRY_TOKEN;
- blockSequenceCnt++;
- break;
- case YAML_BLOCK_END_TOKEN:
- DEBUG("[YAML_BLOCK_END_TOKEN]");
- if (!strncmp(keyTokenVal, contentsKey, strlen(contentsKey))) {
- if (stateYAML == YAML_BLOCK_ENTRY_TOKEN) {
- *retVal = (char *)malloc(retTmpLen + 1);
- memset(*retVal, 0x00, retTmpLen + 1);
- strncpy(*retVal, retTmp, retTmpLen);
- stateYAML = YAML_BLOCK_END_TOKEN;
- }
- }
- break;
- case YAML_SCALAR_TOKEN:
- DEBUG("[YAML_SCALAR_TOKEN]: %s", token.data.scalar.value);
- scalarTokenVal = token.data.scalar.value;
- scalarTokenLen = token.data.scalar.length;
-
- if (stateYAML == YAML_KEY_TOKEN) {
- memset(keyTokenVal, 0x00, 256);
- strncpy(keyTokenVal, scalarTokenVal, scalarTokenLen);
- stateYAML = 0;
- } else if (stateYAML == YAML_VALUE_TOKEN) {
- DEBUG("keyTokenVal: %s", keyTokenVal);
- DEBUG("contentsKey: %s", contentsKey);
- if (!strncmp(keyTokenVal, contentsKey, strlen(contentsKey))) {
- *retVal = (char *)malloc(scalarTokenLen + 1);
- memset(*retVal, 0x00, scalarTokenLen + 1);
- strncpy(*retVal, scalarTokenVal, scalarTokenLen);
- DEBUG("scalarTokenVal: %s", scalarTokenVal);
- DEBUG("retVal: %s", *retVal);
- }
- stateYAML = 0;
- } else if (stateYAML == YAML_BLOCK_ENTRY_TOKEN) {
- if (blockSequenceCnt > 1) { /* from second block */
- strncat(retTmp, ",", 1);
- retTmpLen += 1;
- }
- strncat(retTmp, scalarTokenVal, scalarTokenLen);
- retTmpLen += scalarTokenLen + 1;
- DEBUG("retTmp(%d): %s", retTmpLen, retTmp);
- } else {
- DEBUG("Unrecognised!!!");
- }
- break;
- default:
- break;
- }
-
- if (token.type != YAML_STREAM_END_TOKEN)
- yaml_token_delete(&token);
-
- } while (token.type != YAML_STREAM_END_TOKEN);
-
- yaml_token_delete(&token);
- yaml_parser_delete(&parser);
- fclose(file);
- return 0;
-}
diff --git a/src/lib/yaml_util.h b/src/lib/yaml_util.h
deleted file mode 100644
index 4841a4c..0000000
--- a/src/lib/yaml_util.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * @file yaml_util.h
- * @brief Utility for yaml data, it extracts value from yaml
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#ifndef __YAML_UTIL_H__
-#define __YAML_UTIL_H__
-
-#include <yaml.h>
-
-/**
- * @fn int yaml_getContents(char *file_name, char *contentsKey, char **retVal)
- * @brief this function to get string from key in yaml file
- * @param *file_name [in] file path including name
- * @param *contentsKey [in] key for finding value
- * @param **retVal [out] value of key
- * @return int result of function
- */
-int yaml_getContents(char *file_name, char *contentsKey, char **retVal);
-
-#endif /*__YAML_UTIL_H__*/
diff --git a/src/unittest/CMakeLists.txt b/src/unittest/CMakeLists.txt
deleted file mode 100755
index df2817f..0000000
--- a/src/unittest/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-PROJECT (beluga_launcher_test)
-LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/docker)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/lib)
-
-SET(DOCKZEN_LAUNCHER_TEST "beluga_launcher_test")
-SET(DOCKZEN_LAUNCHER_TEST_SRCS "beluga_launcher_test.c")
-
-FILE(GLOB PROJECT_SRCS *.c ${CMAKE_SOURCE_DIR}/src/dzl_dockerCtl.c ${CMAKE_SOURCE_DIR}/src/dzl_lifecycle.c ${CMAKE_SOURCE_DIR}/src/dzl_monitor.c ${CMAKE_SOURCE_DIR}/src/dzl_setting.c ${CMAKE_SOURCE_DIR}/src/dzl_device.c ${CMAKE_SOURCE_DIR}/src/dzl_update.c ${CMAKE_SOURCE_DIR}/src/dzl_interface.c ${CMAKE_SOURCE_DIR}/src/dzl_server.c ${CMAKE_SOURCE_DIR}/src/docker/*.c ${CMAKE_SOURCE_DIR}/src/lib/ipc.c ${CMAKE_SOURCE_DIR}/src/lib/json_util.c)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(test_pkgs REQUIRED dlog glib-2.0 gio-2.0 libcurl json-c)
-
-INCLUDE_DIRECTORIES(${test_pkgs_INCLUDE_DIRS})
-LINK_DIRECTORIES(${test_pkgs_LIBRARY_DIRS})
-
-ADD_EXECUTABLE(${DOCKZEN_LAUNCHER_TEST} ${DOCKZEN_LAUNCHER_TEST_SRCS} ${PROJECT_SRCS})
-
-TARGET_LINK_LIBRARIES(${DOCKZEN_LAUNCHER_TEST} ${test_pkgs_LIBRARIES} ${server_pkgs_LIBRARIES} pthread
-curl
-)
diff --git a/src/unittest/beluga_launcher_test.c b/src/unittest/beluga_launcher_test.c
deleted file mode 100755
index fbf58fd..0000000
--- a/src/unittest/beluga_launcher_test.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <stdio.h>
-
-#include "../../include/dockzen_types.h"
-#include "../include/dzl_internal_types.h"
-#include "../docker/DockerIF.h"
-#include "../dzl_dockerctl.h"
-
-int main(int argc, char **argv)
-{
- int num = 1;
- int ret = 0;
- int docker_status;
-
- printf("====================================\n");
- printf(" beluga-launcher Menu \n");
- printf("====================================\n");
- printf(" 1. dzl_mon_status_monitor_cb: SM_TYPE_DOCKER_STATUS, DOCKER_STATUS_NO_ERROR\n");
- printf(" 2. dzl_mon_status_monitor_cb: SM_TYPE_DOCKER_STATUS, DOCKER_STATUS_ENGINE_FAIL\n");
-
-
- while (1) {
- scanf("%d", &num);
-
- switch (num) {
- case 1:
- docker_status = DOCKER_STATUS_NO_ERROR;
- dzl_mon_status_monitor_cb(SM_TYPE_DOCKER_STATUS, &docker_status, NULL);
- break;
- case 2:
- docker_status = DOCKER_STATUS_ENGINE_FAIL;
- dzl_mon_status_monitor_cb(SM_TYPE_DOCKER_STATUS, &docker_status, NULL);
- break;
- default:
- printf("Not support \n");
- }
- }
-
- return ret;
-}
diff --git a/src/util/JsonTools.h b/src/util/JsonTools.h
new file mode 100644
index 0000000..d357fb8
--- /dev/null
+++ b/src/util/JsonTools.h
@@ -0,0 +1,151 @@
+#ifndef __JSONTOOLS_H__
+#define __JSONTOOLS_H__
+
+#include <string>
+#include <fstream>
+#include <memory>
+#include <functional>
+#include <vector>
+#include <map>
+#include <set>
+#include <algorithm>
+#include <filesystem>
+#include <optional>
+
+#include <json/json.h>
+
+#include "internal_types.h"
+
+#include "util/log.h"
+#include "util/system.h"
+
+class JsonTools
+{
+public:
+ static bool parseFromFile(const std::string &filepath, Json::Value *root)
+ {
+ std::ifstream jsonFile(filepath);
+ Json::CharReaderBuilder builder;
+ builder["collectComments"] = false;
+ std::string errs;
+
+ if (!jsonFile.is_open()) {
+ _D("filepath: %s, no such file", filepath.c_str());
+ return false;
+ }
+
+ if (!parseFromStream(builder, jsonFile, root, &errs)) {
+ _D("filepath: %s, error: %s", filepath.c_str(), errs.c_str());
+ return false;
+ }
+ return true;
+ }
+
+ static bool parseFromString(std::string data, Json::Value *root)
+ {
+ std::string errs;
+ Json::CharReaderBuilder builder;
+
+ if (data.empty())
+ return true;
+
+ builder["collectComments"] = false;
+ data.assign(data.begin(), data.end());
+ const char *begin = data.c_str();
+ const char *end = begin + data.length();
+ if (!builder.newCharReader()->parse(begin, end, root, &errs)) {
+ _D("string: %s, error: %s", data.c_str(), errs.c_str());
+ return false;
+ }
+ return true;
+ }
+
+ static bool writeToFile(const std::string &filepath, const std::string &containername, const std::string &key,
+ const Json::Value &value)
+ {
+ Json::Value root;
+
+ if (!parseFromFile(filepath, &root))
+ return false;
+
+ root["service"][containername][key] = value;
+
+ Json::StreamWriterBuilder builder;
+ builder["commentStyle"] = "None";
+ builder["indentation"] = " ";
+
+ std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
+ std::ofstream jsonFile(filepath);
+ writer->write(root, &jsonFile);
+
+ return true;
+ }
+
+ static std::string writeToString(const Json::Value &root)
+ {
+ Json::StreamWriterBuilder writerBuilder;
+ writerBuilder["indentation"] = ""; // set whitespace-less output
+ return Json::writeString(writerBuilder, root);
+ }
+
+ static Json::Value appendArray(const Json::Value &a, const Json::Value &b)
+ {
+ Json::Value ret = a;
+ if (!b.isArray()) {
+ return ret;
+ }
+ for (const auto &it : b) {
+ ret.append(it);
+ }
+ return ret;
+ }
+
+ class Transform
+ {
+ public:
+ /* Transform From Json */
+ template <typename T> static T simpleForwarder(const Json::Value &source);
+ template <typename T> static bool simpleValidateChecker(const T &obj);
+ template <typename T>
+ static Status getJsonValue(T &destination, const Json::Value &source,
+ std::function<T(const Json::Value &)> fwd_func = simpleForwarder<T>);
+ template <typename T>
+ static Status getJsonValue(std::optional<T> &destination, const Json::Value &source,
+ std::function<T(const Json::Value &)> fwd_func = simpleForwarder<T>);
+
+ template <typename T>
+ static Status getJsonArray(std::vector<T> &destination, const Json::Value &source,
+ std::function<T(const Json::Value &)> fwd_func = simpleForwarder<T>,
+ std::function<bool(const T &)> valid_func = simpleValidateChecker<T>);
+ template <typename T>
+ static Status getJsonArray(std::set<T> &destination, const Json::Value &source,
+ std::function<T(const Json::Value &)> fwd_func = simpleForwarder<T>);
+ template <typename U, typename T>
+ static Status getJsonObject(std::map<U, T> &destination, const Json::Value &source,
+ std::function<T(const Json::Value &)> fwd_func = simpleForwarder<T>);
+
+ /* Transform and append to Json */
+ template <typename T> static Status setJsonValue(Json::Value &destination, const T &source);
+ template <typename T> static Status setJsonValue(Json::Value &destination, const std::optional<T> &source);
+ template <typename T> static Status appendJsonArray(Json::Value &destination, const std::vector<T> &source);
+ template <typename T> static Status appendJsonArray(Json::Value &destination, const std::set<T> &source);
+ template <typename U, typename T>
+ static Status appendJsonObject(Json::Value &destination, const std::map<U, T> &source);
+
+ /* Transform and set to Json */
+ template <typename T>
+ static Status setJsonValue(Json::Value &destination, const std::string &name, const T &source);
+ template <typename T>
+ static Status setJsonValue(Json::Value &destination, const std::string &name, const std::optional<T> &source);
+ template <typename T>
+ static Status setJsonArray(Json::Value &destination, const std::string &name, const std::vector<T> &source);
+ template <typename T>
+ static Status setJsonArray(Json::Value &destination, const std::string &name, const std::set<T> &source);
+ template <typename U, typename T>
+ static Status setJsonObject(Json::Value &destination, const std::string &name, const std::map<U, T> &source);
+ };
+};
+
+#include "util/JsonTools/Transform.hpp"
+
+#endif /* __JSONTOOLS_H__ */
diff --git a/src/util/JsonTools/Transform.hpp b/src/util/JsonTools/Transform.hpp
new file mode 100644
index 0000000..d8079bc
--- /dev/null
+++ b/src/util/JsonTools/Transform.hpp
@@ -0,0 +1,310 @@
+/*
+ *Transform From Json
+ */
+#include <stdexcept>
+
+template <typename T> inline T JsonTools::Transform::simpleForwarder(const Json::Value &source)
+{
+ return T(source);
+}
+template <> inline std::string JsonTools::Transform::simpleForwarder<std::string>(const Json::Value &source)
+{
+ if (unlikely(source.type() != Json::ValueType::stringValue)) {
+ throw std::invalid_argument("not matched type");
+ }
+
+ return source.asString();
+}
+template <> inline bool JsonTools::Transform::simpleForwarder<bool>(const Json::Value &source)
+{
+ if (unlikely(source.type() != Json::ValueType::booleanValue)) {
+ throw std::invalid_argument("not matched type");
+ }
+
+ return source.asBool();
+}
+template <> inline int JsonTools::Transform::simpleForwarder<int>(const Json::Value &source)
+{
+ if (unlikely(source.type() != Json::ValueType::intValue)) {
+ throw std::invalid_argument("not matched type");
+ }
+
+ return source.asInt();
+}
+template <> inline unsigned int JsonTools::Transform::simpleForwarder<unsigned int>(const Json::Value &source)
+{
+ if (unlikely(source.type() != Json::ValueType::uintValue)) {
+ throw std::invalid_argument("not matched type");
+ }
+
+ return source.asUInt();
+}
+template <>
+inline std::filesystem::path JsonTools::Transform::simpleForwarder<std::filesystem::path>(const Json::Value &source)
+{
+ if (unlikely(source.type() != Json::ValueType::stringValue)) {
+ throw std::invalid_argument("not matched type");
+ }
+
+ return source.asString();
+}
+
+#define convertBasePathForwarder(base) \
+ [&](const Json::Value &val) { return util::file::pathjoin(base, val.asString()); }
+
+template <typename T> inline bool JsonTools::Transform::simpleValidateChecker(const T &obj)
+{
+ return obj;
+}
+template <> inline bool JsonTools::Transform::simpleValidateChecker<std::string>(const std::string &obj)
+{
+ return !obj.empty();
+}
+
+template <typename T>
+inline Status JsonTools::Transform::getJsonValue(T &destination, const Json::Value &source,
+ std::function<T(const Json::Value &)> fwd_func)
+{
+ if (!source) {
+ return STATUS_NOT_FOUND;
+ }
+
+ try {
+ destination = fwd_func(source);
+ } catch (...) {
+ return STATUS_FAIL;
+ }
+ return STATUS_OK;
+}
+
+template <typename T>
+inline Status JsonTools::Transform::getJsonValue(std::optional<T> &destination, const Json::Value &source,
+ std::function<T(const Json::Value &)> fwd_func)
+{
+ if (!source) {
+ return STATUS_NOT_FOUND;
+ }
+
+ try {
+ destination = fwd_func(source);
+ } catch (...) {
+ return STATUS_FAIL;
+ }
+ return STATUS_OK;
+}
+
+template <typename T>
+inline Status JsonTools::Transform::getJsonArray(std::vector<T> &destination, const Json::Value &source,
+ std::function<T(const Json::Value &)> fwd_func,
+ std::function<bool(const T &)> valid_func)
+{
+ if (!source) {
+ return STATUS_NOT_FOUND;
+ }
+
+ destination.reserve(destination.size() + source.size());
+
+ for (const auto &obj : source) {
+ try {
+ T intermediate = fwd_func(obj);
+ if (valid_func(intermediate)) {
+ destination.push_back(std::move(intermediate));
+ }
+ } catch (std::invalid_argument &) {
+ continue;
+ } catch (...) {
+ return STATUS_FAIL;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+template <typename T>
+inline Status JsonTools::Transform::getJsonArray(std::set<T> &destination, const Json::Value &source,
+ std::function<T(const Json::Value &)> fwd_func)
+{
+ if (!source) {
+ return STATUS_NOT_FOUND;
+ }
+
+ for (const auto &obj : source) {
+ try {
+ destination.insert(std::move(fwd_func(obj)));
+ } catch (std::invalid_argument &) {
+ continue;
+ } catch (...) {
+ return STATUS_FAIL;
+ }
+ }
+
+ return STATUS_OK;
+}
+
+template <typename U, typename T>
+inline Status JsonTools::Transform::getJsonObject(std::map<U, T> &destination, const Json::Value &source,
+ std::function<T(const Json::Value &)> fwd_func)
+{
+ if (!source) {
+ return STATUS_NOT_FOUND;
+ }
+
+ for (const auto &key : source.getMemberNames()) {
+ try {
+ destination.emplace(key, fwd_func(source[key]));
+ } catch (std::invalid_argument &) {
+ continue;
+ } catch (...) {
+ return STATUS_FAIL;
+ }
+ }
+ return STATUS_OK;
+}
+
+/*
+ * Transform and append to Json
+ */
+template <typename T> inline Status JsonTools::Transform::setJsonValue(Json::Value &destination, const T &source)
+{
+ destination = T(source);
+
+ return STATUS_OK;
+}
+template <typename T>
+inline Status JsonTools::Transform::setJsonValue(Json::Value &destination, const std::optional<T> &source)
+{
+ if (!source)
+ return STATUS_NOT_FOUND;
+
+ destination = source.value();
+
+ return STATUS_OK;
+}
+
+template <typename U, typename T>
+inline Status JsonTools::Transform::appendJsonObject(Json::Value &destination, const std::map<U, T> &source)
+{
+ for (const auto &[key, value] : source) {
+ destination[key] = value.toString();
+ }
+
+ return STATUS_OK;
+}
+
+template <>
+inline Status
+JsonTools::Transform::appendJsonObject<std::string, std::string>(Json::Value &destination,
+ const std::map<std::string, std::string> &source)
+{
+ for (const auto &[key, value] : source) {
+ destination[key] = value;
+ }
+
+ return STATUS_OK;
+}
+
+template <typename T>
+inline Status JsonTools::Transform::appendJsonArray(Json::Value &destination, const std::vector<T> &source)
+{
+ for (const auto &obj : source) {
+ destination.append(obj.toString());
+ }
+
+ return STATUS_OK;
+}
+
+template <>
+inline Status JsonTools::Transform::appendJsonArray<std::string>(Json::Value &destination,
+ const std::vector<std::string> &source)
+{
+ for (const auto &str : source) {
+ destination.append(str);
+ }
+
+ return STATUS_OK;
+}
+
+template <typename T>
+inline Status JsonTools::Transform::appendJsonArray(Json::Value &destination, const std::set<T> &source)
+{
+ for (const auto &obj : source) {
+ destination.append(obj.toString());
+ }
+
+ return STATUS_OK;
+}
+
+template <>
+inline Status JsonTools::Transform::appendJsonArray<std::string>(Json::Value &destination,
+ const std::set<std::string> &source)
+{
+ for (const auto &obj : source) {
+ destination.append(obj);
+ }
+
+ return STATUS_OK;
+}
+
+/*
+ * Transform and set to Json
+ */
+template <typename T>
+inline Status JsonTools::Transform::setJsonValue(Json::Value &destination, const std::string &name, const T &source)
+{
+ if (!source) {
+ return STATUS_NOT_FOUND;
+ }
+
+ return setJsonValue<T>(name.empty() ? destination : destination[name], source);
+}
+
+template <typename T>
+inline Status JsonTools::Transform::setJsonValue(Json::Value &destination, const std::string &name,
+ const std::optional<T> &source)
+{
+ if (!source) {
+ return STATUS_NOT_FOUND;
+ }
+
+ return setJsonValue<T>(name.empty() ? destination : destination[name], source);
+}
+template <>
+inline Status JsonTools::Transform::setJsonValue<std::string>(Json::Value &destination, const std::string &name,
+ const std::string &source)
+{
+ if (source.empty()) {
+ return STATUS_NOT_FOUND;
+ }
+
+ return setJsonValue<std::string>(name.empty() ? destination : destination[name], source);
+}
+template <typename T>
+inline Status JsonTools::Transform::setJsonArray(Json::Value &destination, const std::string &name,
+ const std::vector<T> &source)
+{
+ if (source.empty()) {
+ return STATUS_NOT_FOUND;
+ }
+
+ return appendJsonArray<T>(name.empty() ? destination : destination[name], source);
+}
+template <typename T>
+inline Status JsonTools::Transform::setJsonArray(Json::Value &destination, const std::string &name,
+ const std::set<T> &source)
+{
+ if (source.empty()) {
+ return STATUS_NOT_FOUND;
+ }
+
+ return appendJsonArray<T>(name.empty() ? destination : destination[name], source);
+}
+template <typename U, typename T>
+inline Status JsonTools::Transform::setJsonObject(Json::Value &destination, const std::string &name,
+ const std::map<U, T> &source)
+{
+ if (source.empty()) {
+ return STATUS_NOT_FOUND;
+ }
+
+ return appendJsonObject<U, T>(name.empty() ? destination : destination[name], source);
+}
diff --git a/src/util/blkid.h b/src/util/blkid.h
new file mode 100644
index 0000000..8da730f
--- /dev/null
+++ b/src/util/blkid.h
@@ -0,0 +1,84 @@
+#ifndef __UTIL_BLKID_H__
+#define __UTIL_BLKID_H__
+
+#include <blkid/blkid.h>
+
+#include <string>
+#include <filesystem>
+
+#include "internal_types.h"
+
+namespace util
+{
+ class blkID
+ {
+ public:
+ blkID() = default;
+ blkID(const std::filesystem::path &path) : probe(nullptr), __path(path)
+ {
+ if (!std::filesystem::exists(path)) {
+ return;
+ }
+ probe = getProbe(__path);
+ }
+ ~blkID() {}
+
+ bool valid() const { return probe != nullptr; }
+ const std::string getLabel() { return lookup_value("LABEL"); }
+ const std::string getTypeString() { return lookup_value("TYPE"); }
+ FilesystemType getType()
+ {
+ const std::string type = lookup_value("TYPE");
+ if (type == "ext4") {
+ return FS_TYPE_EXT4;
+ }
+ if (type == "btrfs") {
+ return FS_TYPE_BTRFS;
+ }
+ if (type == "f2fs") {
+ return FS_TYPE_F2FS;
+ }
+ return FS_TYPE_UNKNOWN;
+ }
+ Status refresh()
+ {
+ probe = getProbe(__path);
+ return probe ? STATUS_OK : STATUS_FAIL;
+ }
+
+ private:
+ static std::shared_ptr<blkid_struct_probe> getProbe(const std::filesystem::path &path)
+ {
+ blkid_probe __probe = nullptr;
+ if (__probe = ::blkid_new_probe_from_filename(path.c_str()); !__probe) {
+ return nullptr;
+ }
+
+ if (int ret = ::blkid_do_safeprobe(__probe); ret != 0) {
+ ::blkid_free_probe(__probe);
+ return nullptr;
+ }
+ return std::shared_ptr<blkid_struct_probe>(__probe, [](blkid_struct_probe *p) { ::blkid_free_probe(p); });
+ }
+
+ const std::string lookup_value(const char *value)
+ {
+ if (!valid()) {
+ return "";
+ }
+
+ const char *data;
+ size_t len = 0;
+ if (int ret = ::blkid_probe_lookup_value(probe.get(), value, &data, &len); ret < 0) {
+ return "";
+ }
+ return std::string(data, 0, len);
+ }
+
+ private:
+ std::shared_ptr<blkid_struct_probe> probe = nullptr;
+ std::filesystem::path __path;
+ };
+}; // namespace util
+
+#endif /* __UTIL_BLKID_H__ */
diff --git a/src/util/error.h b/src/util/error.h
new file mode 100644
index 0000000..802a8b5
--- /dev/null
+++ b/src/util/error.h
@@ -0,0 +1,42 @@
+#ifndef __ERROR_H__
+#define __ERROR_H__
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <exception>
+#include <stdexcept>
+#include <cassert>
+#include <cstring>
+#include <string>
+#include <cerrno>
+
+#include "util/log.h"
+
+static void __print_exception(const std::exception &e, int level = 0)
+{
+ _D("%s Caught exception : %s", std::string(level, ' ').c_str(), e.what());
+ try {
+ std::rethrow_if_nested(e);
+ } catch (const std::exception &nested) {
+ __print_exception(nested, level + 1);
+ } catch (...) {
+ _D("%s Caught known exception", std::string(level, ' ').c_str());
+ }
+}
+
+#define throw_nested() \
+ catch (...) \
+ { \
+ std::string func(__func__); \
+ std::throw_with_nested(std::runtime_error(func + "failed")); \
+ }
+
+#define catch_return(ret) \
+ catch (const std::exception &__e) \
+ { \
+ __print_exception(__e); \
+ return ret; \
+ }
+
+#endif /* __ERROR_H__ */ \ No newline at end of file
diff --git a/src/util/log.h b/src/util/log.h
new file mode 100644
index 0000000..0238e64
--- /dev/null
+++ b/src/util/log.h
@@ -0,0 +1,52 @@
+#ifndef __LOG_H__
+#define __LOG_H__
+
+#include <string>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "docker-launcher"
+
+#if defined(TIZEN)
+#include <dlog.h>
+
+#define _D(fmt, arg...) \
+ do { \
+ LOGD(fmt, ##arg); \
+ } while (0)
+#define _I(fmt, arg...) \
+ do { \
+ LOGI(fmt, ##arg); \
+ } while (0)
+#define _W(fmt, arg...) \
+ do { \
+ LOGW(fmt, ##arg); \
+ } while (0)
+#define _E(fmt, arg...) \
+ do { \
+ LOGE(fmt, ##arg); \
+ } while (0)
+#else /* TIZEN */
+
+#define RST "\033[0m"
+#define RED "\033[0;31m"
+#define IRED "\033[1;91m"
+
+#define _D(fmt, ...) \
+ do { \
+ printf(RST "%s: %s[%d]\t " #fmt "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+ } while (0)
+#define _W(fmt, ...) \
+ do { \
+ printf(RED "%s: %s[%d]\t " #fmt RST "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+ } while (0)
+#define _E(fmt, ...) \
+ do { \
+ printf(IRED "%s: %s[%d]\t " #fmt RST "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+ } while (0)
+
+#endif /* ! TIZEN */
+
+#endif /* __LOG_H__ */ \ No newline at end of file
diff --git a/src/util/system.cpp b/src/util/system.cpp
new file mode 100644
index 0000000..7552230
--- /dev/null
+++ b/src/util/system.cpp
@@ -0,0 +1,207 @@
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include <cmath>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <array>
+
+#include "internal_macros.h"
+#include "internal_types.h"
+
+#include "util/error.h"
+#include "util/system.h"
+#include "util/blkid.h"
+
+using namespace util::system;
+
+#define USE_SHELL_COMMAND 1
+
+std::string subprocess::__assembleCommand()
+{
+ std::string fullcmd;
+ if (!working_dir.empty()) {
+ fullcmd += "cd " + working_dir.string() + "; "; // append change dir
+ }
+ fullcmd += cmd + " " + args + " 2>&1";
+ return fullcmd;
+}
+
+FILE *subprocess::open(const char *type)
+{
+ args += " &"; // background process
+ pipe = popen(__assembleCommand().c_str(), type);
+ if (!pipe) {
+ _E("%s execute failed!", cmd.c_str());
+ }
+ return pipe;
+}
+
+int subprocess::execute()
+{
+ return std::system(__assembleCommand().c_str());
+}
+
+int subprocess::execute(std::string &out)
+{
+ std::array<char, max_outbuf_sz> buffer;
+
+ pipe = popen(__assembleCommand().c_str(), "r");
+ if (!pipe) {
+ _E("%s execute failed!", cmd.c_str());
+ return -1;
+ }
+
+ try {
+ std::size_t bytesread;
+ while ((bytesread = std::fread(buffer.data(), sizeof(buffer.at(0)), sizeof(buffer), pipe)) != 0) {
+ out += std::string(buffer.data(), bytesread);
+ }
+ } catch (...) {
+ _E("%s execute read error", cmd.c_str());
+ }
+
+ return WEXITSTATUS(this->close());
+}
+
+Status Mount::mount()
+{
+ std::lock_guard<std::mutex> lk(lock);
+
+ if (__mount) {
+ _W("%s -> %s is already mounted", source.c_str(), target.c_str());
+ return STATUS_IGNORE;
+ }
+
+ if (unlikely(!std::filesystem::exists(source))) {
+ _E("%s is not found", source.c_str());
+ return STATUS_FAIL;
+ }
+
+ if (std::filesystem::exists(target)) {
+ if (unlikely(!std::filesystem::is_directory(target))) {
+ _E("%s is not directory", target.c_str());
+ return STATUS_FAIL;
+ }
+ } else {
+ if (std::error_code ec; unlikely(!std::filesystem::create_directories(target, ec))) {
+ _E("%s create failed : %s", target.c_str(), ec.message().c_str());
+ return STATUS_FAIL;
+ }
+ }
+
+ _D("mount %s to %s", source.c_str(), target.c_str());
+ try {
+ if (has_cap(CAP_EFFECTIVE, CAP_SYS_ADMIN)) {
+ _D("using libmount (capability effective)");
+ __do_mount();
+ } else if (has_cap(CAP_INHERITABLE, CAP_SYS_ADMIN)) {
+ _D("using command (capability inhertiable)");
+ util::system::subprocess("mount", {source.string(), target.string()}).execute();
+ } else {
+ _E("operation not permitted");
+ throw std::runtime_error("operation not permitted");
+ }
+ } catch (...) {
+ return STATUS_FAIL;
+ }
+
+ __mount = true;
+
+ return STATUS_OK;
+};
+
+Status Mount::umount()
+{
+ std::lock_guard<std::mutex> lk(lock);
+
+ if (!__mount) {
+ return STATUS_IGNORE;
+ }
+
+ _D("umount %s", target.c_str());
+ try {
+ if (has_cap(CAP_EFFECTIVE, CAP_SYS_ADMIN)) {
+ _D("using libmount (capability effective)");
+ __do_umount();
+ } else if (has_cap(CAP_INHERITABLE, CAP_SYS_ADMIN)) {
+ _D("using command (capability inhertiable)");
+ util::system::subprocess("umount", {target.string()}).execute();
+ } else {
+ _E("operation not permitted");
+ throw std::runtime_error("operation not permitted");
+ }
+ } catch (...) {
+ return STATUS_FAIL;
+ }
+
+ __mount = false;
+ return STATUS_OK;
+}
+
+static inline void __mount_force_unrestricted(libmnt_context *ctx)
+{
+#if LIBMOUNT_MAJOR_VERSION > 2 || (LIBMOUNT_MAJOR_VERSION == 2 && LIBMOUNT_MINOR_VERSION >= 35)
+ mnt_context_force_unrestricted(ctx);
+#else
+ /*
+ * because the libmount version is low, it cannot be forcibly unrestricted.
+ * I don't know what kind of problem will happen.
+ */
+ _W("mount: it cannot be forcibly unrestricted");
+#endif
+}
+
+void Mount::__do_mount()
+{
+ __ctx_init();
+ mnt_context_set_source(ctx, source.c_str());
+ mnt_context_set_target(ctx, target.c_str());
+
+ switch (std::filesystem::status(source).type()) {
+ case std::filesystem::file_type::regular:
+ __mount_force_unrestricted(ctx);
+ mnt_context_set_mflags(ctx, MS_RDONLY | MS_NOSUID | MS_NODEV | MS_NOEXEC);
+ mnt_context_set_user_mflags(ctx, MNT_MS_LOOP | MNT_MS_USERS);
+ break;
+ case std::filesystem::file_type::directory:
+ // TODO: need tests
+ mnt_context_set_mflags(ctx, MS_BIND | MS_RDONLY);
+ break;
+ default:
+ _E("%s is not invalid file", source.c_str());
+ throw std::invalid_argument(source.string() + "is not invalid file");
+ }
+
+ if (mnt_context_mount(ctx)) {
+ _E("%s mount failed(%d): %d (%s)", source.c_str(), mnt_context_get_status(ctx),
+ mnt_context_get_syscall_errno(ctx), strerror(errno));
+ throw std::runtime_error("mount failed");
+ }
+}
+
+void Mount::__do_umount()
+{
+ __ctx_init();
+ mnt_context_set_target(ctx, target.c_str());
+
+ switch (std::filesystem::status(source).type()) {
+ case std::filesystem::file_type::regular:
+ __mount_force_unrestricted(ctx);
+ mnt_context_enable_loopdel(ctx, 1);
+ break;
+ case std::filesystem::file_type::directory:
+ // TODO: need tests
+ break;
+ default:
+ _E("%s is not invalid file", source.c_str());
+ throw std::invalid_argument(source.string() + "is not invalid file");
+ }
+
+ if (mnt_context_umount(ctx)) {
+ _E("%s umount failed(%d) : %d (%s)", target.c_str(), mnt_context_get_status(ctx),
+ mnt_context_get_syscall_errno(ctx), strerror(errno));
+ throw std::runtime_error("umount failed");
+ }
+}
diff --git a/src/util/system.h b/src/util/system.h
new file mode 100644
index 0000000..fe3bc6c
--- /dev/null
+++ b/src/util/system.h
@@ -0,0 +1,154 @@
+#ifndef __SYSTEM_H__
+#define __SYSTEM_H__
+
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/capability.h>
+#include <unistd.h>
+#include <string>
+#include <vector>
+#include <filesystem>
+#include <atomic>
+#include <mutex>
+#include <libmount/libmount.h>
+#include "internal_types.h"
+
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+
+namespace util
+{
+ namespace system
+ {
+ class subprocess
+ {
+ public:
+ explicit subprocess(const std::string &cmd) : cmd(cmd) {}
+ explicit subprocess(const std::string &cmd, const std::string &args) : cmd(cmd) { addArgs(args); }
+ explicit subprocess(const std::string &cmd, const std::vector<std::string> &args) : cmd(cmd)
+ {
+ addArgs(args);
+ }
+ ~subprocess() { close(); }
+
+ void addArgs(const std::string &arg) { this->args += " " + arg; }
+ void addArgs(const std::vector<std::string> &args)
+ {
+ for (const auto &arg : args) {
+ addArgs(arg);
+ }
+ }
+ void setWorkDir(const std::string &dir) { working_dir = dir; }
+
+ FILE *open(const char *type = "r");
+ int close()
+ {
+ int ret = -1;
+ if (pipe) {
+ ret = pclose(pipe);
+ pipe = nullptr;
+ }
+ return ret;
+ }
+ int execute();
+ int execute(std::string &out);
+ FILE *getPipe() const { return pipe; }
+
+ public:
+ const std::string cmd;
+ std::string args;
+ std::filesystem::path working_dir;
+
+ private:
+ std::string __assembleCommand();
+ FILE *pipe = nullptr;
+
+ static constexpr size_t max_outbuf_sz = 128;
+ };
+
+ class Mount
+ {
+ public:
+ Mount() = default;
+ explicit Mount(const std::filesystem::path &source, const std::filesystem::path &target)
+ : source(source.lexically_normal()), target(target.lexically_normal())
+ {
+ }
+ explicit Mount(std::pair<std::string_view, std::string_view> pair) : Mount(pair.first, pair.second) {}
+
+ /*
+ * atomic and mutex are prohibited from copying/moving.
+ * Therefore, after creating a new one, copy the rest of the values first.
+ */
+ Mount(const Mount &) = delete;
+ Mount &operator=(const Mount &) = delete;
+ Mount(Mount &&other) : source(other.source), target(other.target) { __ctx_swap(other); }
+ Mount &operator=(Mount &&other)
+ {
+ if (&other == this)
+ return *this;
+
+ source = std::move(other.source);
+ target = std::move(other.target);
+
+ __ctx_swap(other);
+ return *this;
+ }
+ ~Mount()
+ {
+ umount();
+ if (ctx) {
+ mnt_free_context(ctx);
+ }
+ }
+
+ operator bool() const { return !source.empty() && !target.empty(); }
+
+ bool isMount() const { return __mount; }
+ Status mount();
+ Status umount();
+
+ private:
+ void __ctx_init()
+ {
+ // mnt_init_debug(0xffff); // uncomment when debug
+ if (!ctx) {
+ ctx = mnt_new_context();
+ } else {
+ mnt_reset_context(ctx);
+ }
+ mnt_context_disable_mtab(ctx, 1);
+ }
+ void __ctx_swap(Mount &other)
+ {
+ std::lock_guard<std::mutex> lk(other.lock);
+ __mount = other.__mount.load();
+ other.__mount = __mount.load();
+ std::swap(ctx, other.ctx);
+ }
+
+ void __do_mount();
+ void __do_umount();
+
+ libmnt_context *ctx = nullptr;
+ std::filesystem::path source;
+ std::filesystem::path target;
+ std::atomic_bool __mount = false;
+ std::mutex lock;
+ };
+
+ static inline bool has_cap(cap_flag_t flag, cap_value_t cap)
+ {
+ cap_t caps = cap_get_pid(getpid());
+ cap_flag_value_t val = CAP_CLEAR;
+ if (!cap_get_flag(caps, cap, flag, &val)) {
+ cap_free(caps);
+ return false;
+ }
+ cap_free(caps);
+ return val == CAP_SET ? true : false;
+ }
+ }; // namespace system
+}; // namespace util
+
+#endif /* __SYSTEM_H__ */ \ No newline at end of file
diff --git a/src/util/util.h b/src/util/util.h
new file mode 100644
index 0000000..1db6dda
--- /dev/null
+++ b/src/util/util.h
@@ -0,0 +1,114 @@
+#ifndef __UTIL_H__
+#define __UTIL_H__
+
+#include <string>
+#include <algorithm>
+#include <cctype>
+#include <locale>
+#include <regex>
+#include <vector>
+#include <tuple>
+#include <cmath>
+#include <array>
+#include <filesystem>
+
+namespace util
+{
+ namespace string
+ {
+ // trim from start (in place)
+ static inline std::string ltrim(std::string str)
+ {
+ str.erase(str.begin(),
+ std::find_if(str.begin(), str.end(), [](unsigned char ch) { return !std::isspace(ch); }));
+ return str;
+ }
+
+ // trim from end (in place)
+ static inline std::string rtrim(std::string str)
+ {
+ str.erase(std::find_if(str.rbegin(), str.rend(), [](unsigned char ch) { return !std::isspace(ch); }).base(),
+ str.end());
+ return str;
+ }
+
+ // trim from both ends (in place)
+ static inline std::string trim(std::string s)
+ {
+ s = ltrim(s);
+ s = rtrim(s);
+ return s;
+ }
+
+ static inline std::vector<std::string> regexSplit(const std::string &str, const std::string &regex)
+ {
+ std::regex re(regex);
+ std::sregex_token_iterator it(str.begin(), str.end(), re, -1), end;
+ return std::vector<std::string>(it, end);
+ }
+
+ static inline std::pair<std::string, std::string> split(const std::string &str, const char separator)
+ {
+ size_t pos = str.find(separator);
+ if (pos == std::string::npos) {
+ return {str, ""};
+ }
+ return {str.substr(0, pos), str.substr(pos + 1)};
+ }
+ }; // namespace string
+
+ namespace convert
+ {
+ static constexpr inline size_t alignSize(size_t sz, size_t align)
+ {
+ if (align < 2) {
+ return sz;
+ }
+ return (sz + align) - (sz % align);
+ }
+
+ static inline int64_t byteSize(const std::string &str, size_t align = 0)
+ {
+ std::array<char, 4> fmt = {'K', 'M', 'G', 'T'};
+ uint64_t ret = 0;
+
+ try {
+ double number = std::stof(str);
+ unsigned int mul = 0;
+
+ for (mul = 0; mul < fmt.size(); ++mul) {
+ if (str.find(fmt[mul]) != std::string::npos) {
+ if (str.find('i') != std::string::npos) {
+ // IEC unit (binary)
+ number *= std::pow(2, 10 * (mul + 1));
+ } else {
+ // SI unit (decimal)
+ number *= std::pow(1000, (mul + 1));
+ }
+ }
+ }
+
+ ret = alignSize(number, align);
+ } catch (...) {
+ return ret;
+ }
+
+ return ret;
+ };
+ }; // namespace convert
+
+ namespace file
+ {
+ static inline std::filesystem::path pathjoin(const std::filesystem::path &a, const std::filesystem::path &b)
+ {
+ /*
+ * in the posix, the append operator of filesystem::path is replaced
+ * when second oprand is the absolute path.
+ * So, for safely join path, always merge with relative_path
+ */
+ return (a / b.relative_path()).lexically_normal();
+ }
+ }; // namespace file
+}; // namespace util
+
+#endif /* __UTIL_H__ */ \ No newline at end of file
diff --git a/sysctl.d/99-docker-launcher.conf.in b/sysctl.d/99-docker-launcher.conf.in
new file mode 100644
index 0000000..5f2f61f
--- /dev/null
+++ b/sysctl.d/99-docker-launcher.conf.in
@@ -0,0 +1 @@
+kernel.core_pattern=|/usr/bin/crash-forwarder -p %p -P %P -i %i -I %I -c %c -d %d -e %e -E %E -u %u -g %g -H %h -s %s -t %t \ No newline at end of file
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..a03a7de
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,28 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(DOCKER_LAUNCHER_TEST "docker-launcher-test")
+
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/ ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/util)
+FILE(GLOB DOCKER_LAUNCHER_TEST_SRCS *.cpp)
+
+ADD_SUBDIRECTORY(Controller)
+ADD_SUBDIRECTORY(Volumes)
+ADD_SUBDIRECTORY(util)
+ADD_SUBDIRECTORY(lib)
+ADD_SUBDIRECTORY(Extension)
+
+set(APPROVAL_MAIN googletest_approval_main.cpp)
+
+ADD_EXECUTABLE(${DOCKER_LAUNCHER_TEST} ${APPROVAL_MAIN} ${DOCKER_LAUNCHER_TEST_SRCS})
+
+TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER_TEST}
+ PUBLIC
+ gtest
+ gtest_main
+ gmock
+ gmock_main
+ pthread
+ docker-launcher-static
+)
+
+ADD_TEST(NAME ${DOCKER_LAUNCHER_TEST} COMMAND ${DOCKER_LAUNCHER_TEST})
diff --git a/test/Controller/CMakeLists.txt b/test/Controller/CMakeLists.txt
new file mode 100644
index 0000000..ec554bb
--- /dev/null
+++ b/test/Controller/CMakeLists.txt
@@ -0,0 +1,22 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(DOCKER_LAUNCHER_CONTROLLER_TEST "docker-launcher-controller-test")
+
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/ ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/util)
+FILE(GLOB DOCKER_LAUNCHER_CONTROLLER_TEST_SRCS *.cpp)
+
+set(APPROVAL_MAIN ../googletest_approval_main.cpp)
+
+ADD_EXECUTABLE(${DOCKER_LAUNCHER_CONTROLLER_TEST} ${APPROVAL_MAIN} ${DOCKER_LAUNCHER_CONTROLLER_TEST_SRCS})
+
+TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER_CONTROLLER_TEST}
+ PUBLIC
+ gtest
+ gtest_main
+ gmock
+ gmock_main
+ pthread
+ docker-launcher-static
+)
+
+ADD_TEST(NAME ${DOCKER_LAUNCHER_CONTROLLER_TEST} COMMAND ${DOCKER_LAUNCHER_CONTROLLER_TEST})
diff --git a/test/Controller/MockRestInterface.h b/test/Controller/MockRestInterface.h
new file mode 100644
index 0000000..875fbb9
--- /dev/null
+++ b/test/Controller/MockRestInterface.h
@@ -0,0 +1,22 @@
+#ifndef __MOCK_REST_INTERFACE_H__
+#define __MOCK_REST_INTERFACE_H__
+
+#include "Controller/RestInterface.h"
+
+class MockRestInterface : public RestInterface
+{
+public:
+ MockRestInterface(const std::string_view &serverAddr, const std::string_view &socketPath)
+ : RestInterface(serverAddr, socketPath)
+ {
+ }
+ MOCK_METHOD(ResponseMessage, request, (const RestURL &, const std::string_view &, const long), (override));
+ MOCK_METHOD(ResponseMessage, request_post,
+ (const RestURL &, const void *, size_t, const std::string_view &, const long), (override));
+ MOCK_METHOD(ResponseMessage, request_post, (const RestURL &, std::ifstream *, const std::string_view &, const long),
+ (override));
+ MOCK_METHOD(ResponseMessage, request_post, (const RestURL &, FILE *, const std::string_view &, const long),
+ (override));
+};
+
+#endif /* __MOCK_REST_INTERFACE_H__ */
diff --git a/test/Controller/container-controller-test.cpp b/test/Controller/container-controller-test.cpp
new file mode 100644
index 0000000..ff2229e
--- /dev/null
+++ b/test/Controller/container-controller-test.cpp
@@ -0,0 +1,31 @@
+#include "Container.h"
+#include "Controller/ContainerController.h"
+#include <gtest/gtest.h>
+
+TEST(ContainerControllerTest, getControllerTest)
+{
+ EXPECT_NE(ContainerController::getController(CONTAINER_TYPE_DOCKER), nullptr);
+ EXPECT_NE(ContainerController::getController(CONTAINER_TYPE_NONE), nullptr);
+
+ Container *dummyContainer = new Container(CONTAINER_TYPE_NONE);
+ std::shared_ptr<Image> dummyImage;
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->init(Json::Value()), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->getImageList(), "");
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->getContainerList(), "");
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->isImageExist(dummyImage), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->isContainerRunning(dummyContainer),
+ STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->isContainerExist(dummyContainer),
+ STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->build(dummyContainer), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->load(dummyContainer), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->remove(dummyContainer), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->create(dummyContainer), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->destroy(dummyContainer), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->start(dummyContainer), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->stop(dummyContainer), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->wait(dummyContainer), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->restart(dummyContainer), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(ContainerController::getController(CONTAINER_TYPE_NONE)->update(dummyContainer), STATUS_NOT_IMPLEMENT);
+ delete dummyContainer;
+}
diff --git a/test/Controller/curl-rest-interface-test.cpp b/test/Controller/curl-rest-interface-test.cpp
new file mode 100644
index 0000000..d61e80b
--- /dev/null
+++ b/test/Controller/curl-rest-interface-test.cpp
@@ -0,0 +1,123 @@
+#include "Controller/CurlRestInterface.h"
+#include <gtest/gtest.h>
+
+using namespace testing;
+
+class CurlRestInterfaceTest : public ::testing::Test
+{
+public:
+ void SetUp() override { handle = curl_easy_init(); }
+
+ void TearDown() override
+ {
+ if (handle) {
+ curl_easy_cleanup(handle);
+ handle = nullptr;
+ }
+ }
+
+ CURL *handle;
+};
+
+TEST_F(CurlRestInterfaceTest, setURLTest)
+{
+ CurlHelper req(handle);
+ EXPECT_NO_THROW(req.setURL(""));
+ EXPECT_NO_THROW(req.setURL("http://v1.41/containers/json"));
+ curl_easy_reset(handle);
+}
+
+TEST_F(CurlRestInterfaceTest, setUnixSocketTest)
+{
+ CurlHelper req(handle);
+ EXPECT_NO_THROW(req.setUnixSocket(""));
+ EXPECT_NO_THROW(req.setUnixSocket("/var/run/docker.sock"));
+ curl_easy_reset(handle);
+}
+
+TEST_F(CurlRestInterfaceTest, setTimeoutTest)
+{
+ CurlHelper req(handle);
+ EXPECT_NO_THROW(req.setTimeout(50));
+ EXPECT_NO_THROW(req.setTimeout(-10));
+ curl_easy_reset(handle);
+}
+
+TEST_F(CurlRestInterfaceTest, setRequestTest)
+{
+ CurlHelper req(handle);
+ EXPECT_NO_THROW(req.setRequest("custom_request"));
+ curl_easy_reset(handle);
+}
+
+TEST_F(CurlRestInterfaceTest, setPostDataTest)
+{
+ CurlHelper req(handle);
+ int data[128];
+ std::pair tempPair((const void *)&data, (size_t)128);
+ EXPECT_NO_THROW(req.setPostData(std::string(HTTP_CONTENT_TYPE_XTAR), tempPair));
+ curl_easy_reset(handle);
+
+ CurlHelper req2(handle);
+ int data_large[128];
+ static size_t size_large = 2UL * 1024UL * 1024UL * 1024UL;
+ std::pair tempPair_large((const void *)&data_large, (size_t)size_large);
+ EXPECT_NO_THROW(req2.setPostData(std::string(HTTP_CONTENT_TYPE_XTAR), tempPair_large));
+ curl_easy_reset(handle);
+
+ CurlHelper req3(handle);
+ std::ifstream *test_stream = new std::ifstream();
+ EXPECT_NO_THROW(req3.setPostData(std::string(HTTP_CONTENT_TYPE_XTAR), test_stream));
+ delete test_stream;
+ curl_easy_reset(handle);
+
+ CurlHelper req4(handle);
+ FILE *test_file = new FILE();
+ EXPECT_NO_THROW(req4.setPostData(std::string(HTTP_CONTENT_TYPE_XTAR), test_file));
+ delete test_file;
+ curl_easy_reset(handle);
+}
+
+TEST_F(CurlRestInterfaceTest, performTest)
+{
+ CurlHelper req(handle);
+
+ EXPECT_EQ(req.perform().code, ResponseCode::REQUEST_FAILED);
+
+ req.setURL("http://v1.41/containers/json");
+ req.setUnixSocket("/var/run/docker.sock");
+ req.setRequest("GET");
+ EXPECT_EQ(req.perform().code, ResponseCode::OK);
+ curl_easy_reset(handle);
+}
+
+TEST_F(CurlRestInterfaceTest, request_postTest)
+{
+ std::shared_ptr<CurlRestInterface> curlRestInterface =
+ std::make_shared<CurlRestInterface>("http://v1.41", "/var/run/docker.sock");
+
+ int data[128];
+ RestURL url("/test");
+ url /= "load";
+ EXPECT_EQ(curlRestInterface->request_post(url, (const void *)&data, (size_t)128, HTTP_CONTENT_TYPE_XTAR, -1).code,
+ ResponseCode::NOT_FOUND);
+
+ std::ifstream *tempStream = new std::ifstream();
+ EXPECT_EQ(curlRestInterface->request_post(url, tempStream, HTTP_CONTENT_TYPE_XTAR, -1).code,
+ ResponseCode::NOT_FOUND);
+
+ FILE *tempFile = new FILE();
+ EXPECT_EQ(curlRestInterface->request_post(url, tempFile, HTTP_CONTENT_TYPE_XTAR, -1).code, ResponseCode::NOT_FOUND);
+}
+
+TEST_F(CurlRestInterfaceTest, requestTest)
+{
+ std::shared_ptr<CurlRestInterface> curlRestInterface =
+ std::make_shared<CurlRestInterface>("http://v1.41", "/var/run/docker.sock");
+
+ RestURL url("/containers");
+ url /= "json";
+ url.appendQuery("all", "true");
+
+ EXPECT_EQ(curlRestInterface->request(url, "GET", -1).code, ResponseCode::OK);
+}
diff --git a/test/Controller/docker-controller-test.DockerControllerTest.__generate_container_create_dataTest.approved.txt b/test/Controller/docker-controller-test.DockerControllerTest.__generate_container_create_dataTest.approved.txt
new file mode 100644
index 0000000..a34a3a9
--- /dev/null
+++ b/test/Controller/docker-controller-test.DockerControllerTest.__generate_container_create_dataTest.approved.txt
@@ -0,0 +1 @@
+{"Env":["PS1=[container] \\u@\\h:\\w\\\\$ ","container=docker"],"HostConfig":{"Binds":["/tmp:/tmp:rw","/tmp1:/test1:rw","/tmp2:/test2:ro","/tmp3:/test3:rw"],"CgroupnsMode":"private","Devices":[{"CgroupPermissions":"rwm","PathInContainer":"/dev/dri","PathOnHost":"/dev/dri"},{"CgroupPermissions":"rwm","PathInContainer":"/dev/uinput","PathOnHost":"/dev/uinput"},{"CgroupPermissions":"rwm","PathInContainer":"/dev/rfkill","PathOnHost":"/dev/rfkill"},{"CgroupPermissions":"","PathInContainer":"/dev/net/tun","PathOnHost":"/dev/net/tun"},{"CgroupPermissions":"rwm","PathInContainer":"/dev/i2c-0","PathOnHost":"/dev/i2c-0"},{"CgroupPermissions":"rwm","PathInContainer":"/dev/i2c-1","PathOnHost":"/dev/i2c-1"}],"NetworkMode":"host","Privileged":false,"SecurityOpt":["seccomp={\"archMap\":[{\"architecture\":\"SCMP_ARCH_X86_64\",\"subArchitectures\":[\"SCMP_ARCH_X86\",\"SCMP_ARCH_X32\"]},{\"architecture\":\"SCMP_ARCH_AARCH64\",\"subArchitectures\":[\"SCMP_ARCH_ARM\"]},{\"architecture\":\"SCMP_ARCH_MIPS64\",\"subArchitectures\":[\"SCMP_ARCH_MIPS\",\"SCMP_ARCH_MIPS64N32\"]},{\"architecture\":\"SCMP_ARCH_MIPS64N32\",\"subArchitectures\":[\"SCMP_ARCH_MIPS\",\"SCMP_ARCH_MIPS64\"]},{\"architecture\":\"SCMP_ARCH_MIPSEL64\",\"subArchitectures\":[\"SCMP_ARCH_MIPSEL\",\"SCMP_ARCH_MIPSEL64N32\"]},{\"architecture\":\"SCMP_ARCH_MIPSEL64N32\",\"subArchitectures\":[\"SCMP_ARCH_MIPSEL\",\"SCMP_ARCH_MIPSEL64\"]},{\"architecture\":\"SCMP_ARCH_S390X\",\"subArchitectures\":[\"SCMP_ARCH_S390\"]}],\"defaultAction\":\"SCMP_ACT_ERRNO\",\"syscalls\":[{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{},\"names\":[\"accept\",\"accept4\",\"access\",\"adjtimex\",\"alarm\",\"bind\",\"brk\",\"capget\",\"capset\",\"chdir\",\"chmod\",\"chown\",\"chown32\",\"clock_adjtime\",\"clock_adjtime64\",\"clock_getres\",\"clock_getres_time64\",\"clock_gettime\",\"clock_gettime64\",\"clock_nanosleep\",\"clock_nanosleep_time64\",\"close\",\"close_range\",\"connect\",\"copy_file_range\",\"creat\",\"dup\",\"dup2\",\"dup3\",\"epoll_create\",\"epoll_create1\",\"epoll_ctl\",\"epoll_ctl_old\",\"epoll_pwait\",\"epoll_pwait2\",\"epoll_wait\",\"epoll_wait_old\",\"eventfd\",\"eventfd2\",\"execve\",\"execveat\",\"exit\",\"exit_group\",\"faccessat\",\"faccessat2\",\"fadvise64\",\"fadvise64_64\",\"fallocate\",\"fanotify_mark\",\"fchdir\",\"fchmod\",\"fchmodat\",\"fchown\",\"fchown32\",\"fchownat\",\"fcntl\",\"fcntl64\",\"fdatasync\",\"fgetxattr\",\"flistxattr\",\"flock\",\"fork\",\"fremovexattr\",\"fsetxattr\",\"fstat\",\"fstat64\",\"fstatat64\",\"fstatfs\",\"fstatfs64\",\"fsync\",\"ftruncate\",\"ftruncate64\",\"futex\",\"futex_time64\",\"futimesat\",\"getcpu\",\"getcwd\",\"getdents\",\"getdents64\",\"getegid\",\"getegid32\",\"geteuid\",\"geteuid32\",\"getgid\",\"getgid32\",\"getgroups\",\"getgroups32\",\"getitimer\",\"getpeername\",\"getpgid\",\"getpgrp\",\"getpid\",\"getppid\",\"getpriority\",\"getrandom\",\"getresgid\",\"getresgid32\",\"getresuid\",\"getresuid32\",\"getrlimit\",\"get_robust_list\",\"getrusage\",\"getsid\",\"getsockname\",\"getsockopt\",\"get_thread_area\",\"gettid\",\"gettimeofday\",\"getuid\",\"getuid32\",\"getxattr\",\"inotify_add_watch\",\"inotify_init\",\"inotify_init1\",\"inotify_rm_watch\",\"io_cancel\",\"ioctl\",\"io_destroy\",\"io_getevents\",\"io_pgetevents\",\"io_pgetevents_time64\",\"ioprio_get\",\"ioprio_set\",\"io_setup\",\"io_submit\",\"io_uring_enter\",\"io_uring_register\",\"io_uring_setup\",\"ipc\",\"kill\",\"lchown\",\"lchown32\",\"lgetxattr\",\"link\",\"linkat\",\"listen\",\"listxattr\",\"llistxattr\",\"_llseek\",\"lremovexattr\",\"lseek\",\"lsetxattr\",\"lstat\",\"lstat64\",\"madvise\",\"membarrier\",\"memfd_create\",\"mincore\",\"mkdir\",\"mkdirat\",\"mknod\",\"mknodat\",\"mlock\",\"mlock2\",\"mlockall\",\"mmap\",\"mmap2\",\"mprotect\",\"mq_getsetattr\",\"mq_notify\",\"mq_open\",\"mq_timedreceive\",\"mq_timedreceive_time64\",\"mq_timedsend\",\"mq_timedsend_time64\",\"mq_unlink\",\"mremap\",\"msgctl\",\"msgget\",\"msgrcv\",\"msgsnd\",\"msync\",\"munlock\",\"munlockall\",\"munmap\",\"nanosleep\",\"newfstatat\",\"_newselect\",\"open\",\"openat\",\"openat2\",\"pause\",\"pidfd_open\",\"pidfd_send_signal\",\"pipe\",\"pipe2\",\"poll\",\"ppoll\",\"ppoll_time64\",\"prctl\",\"pread64\",\"preadv\",\"preadv2\",\"prlimit64\",\"pselect6\",\"pselect6_time64\",\"pwrite64\",\"pwritev\",\"pwritev2\",\"read\",\"readahead\",\"readlink\",\"readlinkat\",\"readv\",\"recv\",\"recvfrom\",\"recvmmsg\",\"recvmmsg_time64\",\"recvmsg\",\"remap_file_pages\",\"removexattr\",\"rename\",\"renameat\",\"renameat2\",\"restart_syscall\",\"rmdir\",\"rseq\",\"rt_sigaction\",\"rt_sigpending\",\"rt_sigprocmask\",\"rt_sigqueueinfo\",\"rt_sigreturn\",\"rt_sigsuspend\",\"rt_sigtimedwait\",\"rt_sigtimedwait_time64\",\"rt_tgsigqueueinfo\",\"sched_getaffinity\",\"sched_getattr\",\"sched_getparam\",\"sched_get_priority_max\",\"sched_get_priority_min\",\"sched_getscheduler\",\"sched_rr_get_interval\",\"sched_rr_get_interval_time64\",\"sched_setaffinity\",\"sched_setattr\",\"sched_setparam\",\"sched_setscheduler\",\"sched_yield\",\"seccomp\",\"select\",\"semctl\",\"semget\",\"semop\",\"semtimedop\",\"semtimedop_time64\",\"send\",\"sendfile\",\"sendfile64\",\"sendmmsg\",\"sendmsg\",\"sendto\",\"setfsgid\",\"setfsgid32\",\"setfsuid\",\"setfsuid32\",\"setgid\",\"setgid32\",\"setgroups\",\"setgroups32\",\"setitimer\",\"setpgid\",\"setpriority\",\"setregid\",\"setregid32\",\"setresgid\",\"setresgid32\",\"setresuid\",\"setresuid32\",\"setreuid\",\"setreuid32\",\"setrlimit\",\"set_robust_list\",\"setsid\",\"setsockopt\",\"set_thread_area\",\"set_tid_address\",\"setuid\",\"setuid32\",\"setxattr\",\"shmat\",\"shmctl\",\"shmdt\",\"shmget\",\"shutdown\",\"sigaltstack\",\"signalfd\",\"signalfd4\",\"sigprocmask\",\"sigreturn\",\"socket\",\"socketcall\",\"socketpair\",\"splice\",\"stat\",\"stat64\",\"statfs\",\"statfs64\",\"statx\",\"symlink\",\"symlinkat\",\"sync\",\"sync_file_range\",\"syncfs\",\"sysinfo\",\"tee\",\"tgkill\",\"time\",\"timer_create\",\"timer_delete\",\"timer_getoverrun\",\"timer_gettime\",\"timer_gettime64\",\"timer_settime\",\"timer_settime64\",\"timerfd_create\",\"timerfd_gettime\",\"timerfd_gettime64\",\"timerfd_settime\",\"timerfd_settime64\",\"times\",\"tkill\",\"truncate\",\"truncate64\",\"ugetrlimit\",\"umask\",\"uname\",\"unlink\",\"unlinkat\",\"utime\",\"utimensat\",\"utimensat_time64\",\"utimes\",\"vfork\",\"vmsplice\",\"wait4\",\"waitid\",\"waitpid\",\"write\",\"writev\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":null,\"comment\":\"\",\"excludes\":{},\"includes\":{\"minKernel\":\"4.8\"},\"names\":[\"process_vm_readv\",\"process_vm_writev\",\"ptrace\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[{\"index\":0,\"op\":\"SCMP_CMP_EQ\",\"value\":0}],\"comment\":\"\",\"excludes\":{},\"includes\":{},\"names\":[\"personality\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[{\"index\":0,\"op\":\"SCMP_CMP_EQ\",\"value\":8}],\"comment\":\"\",\"excludes\":{},\"includes\":{},\"names\":[\"personality\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[{\"index\":0,\"op\":\"SCMP_CMP_EQ\",\"value\":131072}],\"comment\":\"\",\"excludes\":{},\"includes\":{},\"names\":[\"personality\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[{\"index\":0,\"op\":\"SCMP_CMP_EQ\",\"value\":131080}],\"comment\":\"\",\"excludes\":{},\"includes\":{},\"names\":[\"personality\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[{\"index\":0,\"op\":\"SCMP_CMP_EQ\",\"value\":4294967295}],\"comment\":\"\",\"excludes\":{},\"includes\":{},\"names\":[\"personality\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"arches\":[\"ppc64le\"]},\"names\":[\"sync_file_range2\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"arches\":[\"arm\",\"arm64\"]},\"names\":[\"arm_fadvise64_64\",\"arm_sync_file_range\",\"sync_file_range2\",\"breakpoint\",\"cacheflush\",\"set_tls\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"arches\":[\"amd64\",\"x32\"]},\"names\":[\"arch_prctl\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"arches\":[\"amd64\",\"x32\",\"x86\"]},\"names\":[\"modify_ldt\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"arches\":[\"s390\",\"s390x\"]},\"names\":[\"s390_pci_mmio_read\",\"s390_pci_mmio_write\",\"s390_runtime_instr\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_DAC_READ_SEARCH\"]},\"names\":[\"open_by_handle_at\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_ADMIN\"]},\"names\":[\"bpf\",\"clone\",\"fanotify_init\",\"fsconfig\",\"fsmount\",\"fsopen\",\"fspick\",\"lookup_dcookie\",\"mount\",\"move_mount\",\"name_to_handle_at\",\"open_tree\",\"perf_event_open\",\"quotactl\",\"setdomainname\",\"sethostname\",\"setns\",\"syslog\",\"umount\",\"umount2\",\"unshare\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[{\"index\":0,\"op\":\"SCMP_CMP_MASKED_EQ\",\"value\":2114060288}],\"comment\":\"\",\"excludes\":{\"arches\":[\"s390\",\"s390x\"],\"caps\":[\"CAP_SYS_ADMIN\"]},\"includes\":{},\"names\":[\"clone\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[{\"index\":1,\"op\":\"SCMP_CMP_MASKED_EQ\",\"value\":2114060288}],\"comment\":\"s390 parameter ordering for clone is different\",\"excludes\":{\"caps\":[\"CAP_SYS_ADMIN\"]},\"includes\":{\"arches\":[\"s390\",\"s390x\"]},\"names\":[\"clone\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_BOOT\"]},\"names\":[\"reboot\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_CHROOT\"]},\"names\":[\"chroot\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_MODULE\"]},\"names\":[\"delete_module\",\"init_module\",\"finit_module\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_PACCT\"]},\"names\":[\"acct\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_PTRACE\"]},\"names\":[\"kcmp\",\"pidfd_getfd\",\"process_madvise\",\"process_vm_readv\",\"process_vm_writev\",\"ptrace\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_RAWIO\"]},\"names\":[\"iopl\",\"ioperm\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_TIME\"]},\"names\":[\"settimeofday\",\"stime\",\"clock_settime\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_TTY_CONFIG\"]},\"names\":[\"vhangup\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_NICE\"]},\"names\":[\"get_mempolicy\",\"mbind\",\"set_mempolicy\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYSLOG\"]},\"names\":[\"syslog\"]},{\"action\":\"SCMP_ACT_ALLOW\",\"args\":[],\"comment\":\"\",\"excludes\":{},\"includes\":{\"caps\":[\"CAP_SYS_CHROOT\"]},\"names\":[\"pivot_root\"]}]}"],"deviceCgroupRules":["c 226:* rw","c *:* rwm","b 1:* rwm","c 1:4 r"]},"Image":"tizen-container","Labels":{"tizen.profile":"headed","tizen.release":"0","tizen.version":"7.0"},"OpenStdin":true,"Try":true}
diff --git a/test/Controller/docker-controller-test.DockerControllerTest.__generate_image_build_dataTest.approved.txt b/test/Controller/docker-controller-test.DockerControllerTest.__generate_image_build_dataTest.approved.txt
new file mode 100644
index 0000000..f51a3a0
--- /dev/null
+++ b/test/Controller/docker-controller-test.DockerControllerTest.__generate_image_build_dataTest.approved.txt
@@ -0,0 +1 @@
+?dockerfile=./Dockerfile.tizen&t=tizen-container:latest
diff --git a/test/Controller/docker-controller-test.cpp b/test/Controller/docker-controller-test.cpp
new file mode 100644
index 0000000..600d5b4
--- /dev/null
+++ b/test/Controller/docker-controller-test.cpp
@@ -0,0 +1,411 @@
+#include "ContainerManager.h"
+#include "Controller/ContainerController.h"
+#include "Controller/DockerController.h"
+#include "DockerLauncher.h"
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "MockRestInterface.h"
+
+#include "../lib/ApprovalTests.hpp"
+
+using namespace testing;
+
+TEST(DockerControllerUnitTest, initializeTest)
+{
+ ContainerController *controller = ContainerController::getController(CONTAINER_TYPE_DOCKER);
+ EXPECT_EQ(controller->initialized(), STATUS_FAIL);
+ Json::Value config;
+ config["docker"]["socketPath"] = "/var/run/docker.sock";
+ config["docker"]["apiVersion"] = "http://v1.41";
+ controller->init(config);
+ EXPECT_EQ(controller->initialized(), STATUS_OK);
+}
+
+class DockerControllerTest : public ::testing::Test
+{
+public:
+ void SetUp() override
+ {
+ dockerLauncher = std::make_unique<DockerLauncher>();
+ mockRestInterface = std::make_shared<MockRestInterface>("http://v1.41", "/var/run/docker.sock");
+ dockerLauncher->containerManager->halDevicesPath = TARGET_ROOT + "/hal/etc/docker/devices.json";
+ dockerLauncher->initialize();
+ Json::Value configList;
+ Config::ContainerListConfigs::loadList(TARGET_ROOT + "/opt/data/container/list", configList);
+ dockerLauncher->containerManager->registryContainers(configList);
+ dockerLauncher->containerManager->findContainer("tizen-headed", container);
+ controller = ContainerController::getController(CONTAINER_TYPE_DOCKER);
+ static_cast<DockerController *>(controller)->setRestInterface(mockRestInterface);
+ static_cast<DockerContainer *>(container)->restInterface = mockRestInterface;
+ static_cast<DockerContainer *>(container)->restInterfaceForWait = mockRestInterface;
+ }
+
+ void TearDown() override
+ {
+ // For deleting mockRestInterface
+ mockRestInterface.reset();
+ }
+
+ Status __generate_image_build_data(Image *const image, RestURL &url)
+ {
+ return static_cast<DockerController *>(controller)->__generate_image_build_data(image, url);
+ }
+ Status __generate_container_create_data(Container *const container, Json::Value &config)
+ {
+ return static_cast<DockerController *>(controller)->__generate_container_create_data(container, config);
+ }
+ std::shared_ptr<RestInterface> __getRestInterface()
+ {
+ return static_cast<DockerController *>(controller)->restInterface;
+ }
+
+ std::unique_ptr<DockerLauncher> dockerLauncher;
+ std::shared_ptr<ContainerManager> manager;
+ ContainerController *controller;
+ std::shared_ptr<MockRestInterface> mockRestInterface;
+ Container *container;
+ std::string TARGET_ROOT = "../test/testfiles/rpi4";
+};
+
+TEST_F(DockerControllerTest, getRestInterfaceTest)
+{
+ EXPECT_TRUE(static_cast<DockerController *>(controller)->getRestInterface() != nullptr);
+ EXPECT_TRUE(static_cast<DockerController *>(controller)->getRestInterfaceForWait(container) != nullptr);
+}
+
+TEST_F(DockerControllerTest, setRestInterfaceTest)
+{
+ std::shared_ptr<RestInterface> restInterface =
+ std::make_shared<CurlRestInterface>("http://v1.41", "/var/run/docker.sock");
+ static_cast<DockerController *>(controller)->setRestInterface(restInterface);
+ EXPECT_EQ(__getRestInterface(), restInterface);
+
+ // Restore mock interface
+ static_cast<DockerController *>(controller)->setRestInterface(mockRestInterface);
+}
+
+TEST_F(DockerControllerTest, getContainerListTest)
+{
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "[]")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->getContainerList(), "__request_init failed.");
+ EXPECT_EQ(controller->getContainerList(), "__request_perform failed.");
+ EXPECT_EQ(controller->getContainerList(), "[]");
+}
+
+TEST_F(DockerControllerTest, getImageListTest)
+{
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "[]")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->getImageList(), "__request_init failed.");
+ EXPECT_EQ(controller->getImageList(), "__request_perform failed.");
+ EXPECT_EQ(controller->getImageList(), "[]");
+}
+
+TEST_F(DockerControllerTest, isImageExistTest)
+{
+ std::string imageList = "[{\"RepoTags\": [\"" + container->image->fingerprint.name + ":latest\"]}]";
+ std::string invalidList = "[{\"RepoTags\": [\"/invalidName\"]}]";
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, imageList)))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, invalidList)))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->isImageExist(container->image), STATUS_FAIL);
+ EXPECT_EQ(controller->isImageExist(container->image), STATUS_FAIL);
+ EXPECT_EQ(controller->isImageExist(container->image), STATUS_NOT_FOUND);
+ EXPECT_EQ(controller->isImageExist(container->image), STATUS_NOT_FOUND);
+ EXPECT_EQ(controller->isImageExist(container->image), STATUS_OK);
+}
+
+TEST_F(DockerControllerTest, isContainerRunningTest)
+{
+ std::string containerList = "[{\"Names\": [\"/" + container->fingerprint.name + "\"]}]";
+ std::string invalidList = "[{\"Names\": [\"/invalidName\"]}]";
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, containerList)))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, invalidList)))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->isContainerRunning(container), STATUS_FAIL);
+ EXPECT_EQ(controller->isContainerRunning(container), STATUS_FAIL);
+ EXPECT_EQ(controller->isContainerRunning(container), STATUS_NOT_FOUND);
+ EXPECT_EQ(controller->isContainerRunning(container), STATUS_NOT_FOUND);
+ EXPECT_EQ(controller->isContainerRunning(container), STATUS_OK);
+}
+
+TEST_F(DockerControllerTest, isContainerExistTest)
+{
+ std::string containerList = "[{\"Names\": [\"/" + container->fingerprint.name + "\"]}]";
+ std::string invalidList = "[{\"Names\": [\"/invalidName\"]}]";
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, containerList)))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, invalidList)))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->isContainerExist(container), STATUS_FAIL);
+ EXPECT_EQ(controller->isContainerExist(container), STATUS_FAIL);
+ EXPECT_EQ(controller->isContainerExist(container), STATUS_NOT_FOUND);
+ EXPECT_EQ(controller->isContainerExist(container), STATUS_NOT_FOUND);
+ EXPECT_EQ(controller->isContainerExist(container), STATUS_OK);
+}
+
+TEST_F(DockerControllerTest, buildTest)
+{
+ EXPECT_CALL(*mockRestInterface, request_post(_, A<std::basic_ifstream<char> *>(), StrEq(HTTP_CONTENT_TYPE_XTAR), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request_post(_, A<std::basic_ifstream<char> *>(), StrEq(HTTP_CONTENT_TYPE_XTAR), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request_post(_, A<std::basic_ifstream<char> *>(), StrEq(HTTP_CONTENT_TYPE_XTAR), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->build(container), STATUS_FAIL);
+ EXPECT_EQ(controller->build(container), STATUS_FAIL);
+ EXPECT_EQ(controller->build(container), STATUS_OK);
+
+ EXPECT_CALL(*mockRestInterface, request_post(_, A<FILE *>(), StrEq(HTTP_CONTENT_TYPE_XTAR), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ container->image->configs->context = TARGET_ROOT + "/opt/data/container/tizen-headed/images";
+ EXPECT_EQ(controller->build(container), STATUS_OK);
+
+ container->image->configs->context.reset();
+ EXPECT_EQ(controller->build(container), STATUS_FAIL);
+
+ container->image->configs->context = "invalid_context";
+ EXPECT_EQ(controller->build(container), STATUS_FAIL);
+
+ container->image->fingerprint.name = "";
+ EXPECT_EQ(controller->build(container), STATUS_FAIL);
+}
+
+TEST_F(DockerControllerTest, loadTest)
+{
+ EXPECT_CALL(*mockRestInterface, request_post(_, A<std::basic_ifstream<char> *>(), StrEq(HTTP_CONTENT_TYPE_XTAR), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request_post(_, A<std::basic_ifstream<char> *>(), StrEq(HTTP_CONTENT_TYPE_XTAR), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request_post(_, A<std::basic_ifstream<char> *>(), StrEq(HTTP_CONTENT_TYPE_XTAR), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+
+ // temporary setting for test
+ container->image->configs->imagedatafile = TARGET_ROOT + "/opt/data/container/tizen-headed/tizen-init.tar";
+ EXPECT_EQ(controller->load(container), STATUS_FAIL);
+ EXPECT_EQ(controller->load(container), STATUS_FAIL);
+ EXPECT_EQ(controller->load(container), STATUS_OK);
+
+ container->image->configs->imagedatafile.reset();
+ EXPECT_EQ(controller->load(container), STATUS_FAIL);
+
+ container->image->configs->imagedatafile = "invalid_datafile";
+ EXPECT_EQ(controller->load(container), STATUS_FAIL);
+}
+
+TEST_F(DockerControllerTest, removeTest)
+{
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("DELETE"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("DELETE"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("DELETE"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+
+ EXPECT_EQ(controller->remove(container), STATUS_FAIL);
+ EXPECT_EQ(controller->remove(container), STATUS_FAIL);
+ EXPECT_EQ(controller->remove(container), STATUS_OK);
+
+ container->image->fingerprint.name = "";
+ EXPECT_EQ(controller->remove(container), STATUS_FAIL);
+}
+
+TEST_F(DockerControllerTest, createTest)
+{
+ EXPECT_CALL(*mockRestInterface, request_post(_, _, _, StrEq(HTTP_CONTENT_TYPE_JSON), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::BAD_REQUEST, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request_post(_, _, _, StrEq(HTTP_CONTENT_TYPE_JSON), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request_post(_, _, _, StrEq(HTTP_CONTENT_TYPE_JSON), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request_post(_, _, _, StrEq(HTTP_CONTENT_TYPE_JSON), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->create(container), STATUS_FAIL);
+ EXPECT_EQ(controller->create(container), STATUS_FAIL);
+ EXPECT_EQ(controller->create(container), STATUS_OK);
+
+ container->containerConfig->securityOpt = "notExistPath";
+ EXPECT_EQ(controller->create(container), STATUS_FAIL);
+}
+
+TEST_F(DockerControllerTest, destroyTest)
+{
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("DELETE"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("DELETE"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("DELETE"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+
+ EXPECT_EQ(controller->destroy(container), STATUS_FAIL);
+ EXPECT_EQ(controller->destroy(container), STATUS_FAIL);
+ EXPECT_EQ(controller->destroy(container), STATUS_OK);
+
+ container->fingerprint.name = "";
+ EXPECT_EQ(controller->destroy(container), STATUS_FAIL);
+}
+
+TEST_F(DockerControllerTest, startTest)
+{
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::NOT_MODIFIED, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->start(container), STATUS_FAIL);
+ EXPECT_EQ(controller->start(container), STATUS_FAIL);
+ EXPECT_EQ(controller->start(container), STATUS_OK);
+ EXPECT_EQ(controller->start(container), STATUS_FAIL);
+
+ container->fingerprint.name = "";
+ EXPECT_EQ(controller->start(container), STATUS_FAIL);
+}
+
+TEST_F(DockerControllerTest, waitTest)
+{
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "{\"StatusCode\": 137, \"Error\": {\"message\": \"\"}}\n")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->wait(container), STATUS_FAIL);
+ EXPECT_EQ(controller->wait(container), STATUS_FAIL);
+ EXPECT_EQ(controller->wait(container), STATUS_OK);
+}
+
+TEST_F(DockerControllerTest, stopTest)
+{
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::NOT_MODIFIED, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_perform failed.")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->stop(container), STATUS_FAIL);
+ EXPECT_EQ(controller->stop(container), STATUS_FAIL);
+ EXPECT_EQ(controller->stop(container), STATUS_OK);
+ EXPECT_EQ(controller->stop(container), STATUS_FAIL);
+}
+
+TEST_F(DockerControllerTest, restartTest)
+{
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ EXPECT_EQ(controller->restart(container), STATUS_OK);
+
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::REQUEST_FAILED, "__request_init failed.")))
+ .RetiresOnSaturation();
+ EXPECT_EQ(controller->restart(container), STATUS_FAIL);
+}
+
+TEST_F(DockerControllerTest, updateTest)
+{
+ EXPECT_EQ(controller->update(container), STATUS_NOT_IMPLEMENT);
+}
+
+TEST_F(DockerControllerTest, __generate_image_build_dataTest)
+{
+ RestURL url;
+ __generate_image_build_data(container->image.get(), url);
+ ApprovalTests::Approvals::verify(url.toString());
+ container->image->fingerprint.name = "";
+ EXPECT_EQ(__generate_image_build_data(container->image.get(), url), STATUS_FAIL);
+}
+
+TEST_F(DockerControllerTest, __generate_container_create_dataTest)
+{
+ Json::Value config;
+ __generate_container_create_data(container, config);
+ ApprovalTests::Approvals::verify(JsonTools::writeToString(config));
+}
diff --git a/test/Controller/rest-interface-test.cpp b/test/Controller/rest-interface-test.cpp
new file mode 100644
index 0000000..60a85b9
--- /dev/null
+++ b/test/Controller/rest-interface-test.cpp
@@ -0,0 +1,125 @@
+#include "Controller/CurlRestInterface.h"
+#include <gtest/gtest.h>
+
+using namespace testing;
+
+class RestInterfaceTest : public ::testing::Test
+{
+public:
+ void SetUp() override
+ {
+ restInterface = std::make_shared<CurlRestInterface>("http://v1.41", "/var/run/docker.sock");
+ }
+
+ void TearDown() override {}
+
+ std::shared_ptr<RestInterface> restInterface;
+};
+
+TEST_F(RestInterfaceTest, check_responseTest)
+{
+ EXPECT_EQ(restInterface->check_response(ResponseMessage(ResponseCode::REQUEST_FAILED, "")), STATUS_FAIL);
+ EXPECT_EQ(restInterface->check_response(ResponseMessage(ResponseCode::INTERNAL_SERVER_ERROR, "")), STATUS_RETRY);
+ EXPECT_EQ(restInterface->check_response(
+ ResponseMessage(ResponseCode::NOT_MODIFIED, "{\"message\":\"same as before\"}\n")),
+ STATUS_FAIL);
+ EXPECT_EQ(restInterface->check_response(ResponseMessage(ResponseCode::OK, "")), STATUS_OK);
+}
+
+TEST_F(RestInterfaceTest, request_getTest)
+{
+ RestURL url("/containers/json");
+ ResponseMessage retMessage = restInterface->request_get(url);
+ EXPECT_EQ(restInterface->check_response(retMessage), STATUS_OK);
+ EXPECT_EQ(retMessage.code, ResponseCode::OK);
+ EXPECT_EQ(retMessage.message, "[]\n");
+}
+
+TEST_F(RestInterfaceTest, request_postTest1)
+{
+ RestURL url("/containers/invalid_id/start");
+ std::string ret_message = "{\"message\":\"No such container: invalid_id\"}\n";
+ ResponseMessage retMessage = restInterface->request_post(url);
+ EXPECT_EQ(restInterface->check_response(retMessage), STATUS_FAIL);
+ EXPECT_EQ(retMessage.code, ResponseCode::NOT_FOUND);
+ EXPECT_EQ(retMessage.message, ret_message);
+}
+
+TEST_F(RestInterfaceTest, request_postTest2)
+{
+ RestURL url("/containers/create");
+ std::string invalid_request = "{\"invalid request\": \"\"}";
+ std::string ret_message = "{\"message\":\"Config cannot be empty in order to create a container\"}\n";
+ ResponseMessage retMessage =
+ restInterface->request_post(url, invalid_request.c_str(), invalid_request.size(), HTTP_CONTENT_TYPE_JSON);
+ EXPECT_EQ(restInterface->check_response(retMessage), STATUS_FAIL);
+ EXPECT_EQ(retMessage.code, ResponseCode::BAD_REQUEST);
+ EXPECT_EQ(retMessage.message, ret_message);
+}
+
+TEST_F(RestInterfaceTest, request_deleteTest)
+{
+ RestURL url("/containers/invalid_fingerprint");
+ std::string ret_message = "{\"message\":\"No such container: invalid_fingerprint\"}\n";
+ ResponseMessage retMessage = restInterface->request_delete(url);
+ EXPECT_EQ(restInterface->check_response(retMessage), STATUS_FAIL);
+ EXPECT_EQ(retMessage.code, ResponseCode::NOT_FOUND);
+ EXPECT_EQ(retMessage.message, ret_message);
+}
+
+TEST(RestURLTest, operatorTest)
+{
+ RestURL testA;
+ RestURL testB("testB/");
+ RestURL testC("testC");
+
+ EXPECT_EQ(testA.serverUrl, "");
+ EXPECT_EQ(testB.serverUrl, "testB");
+
+ testA += "testA";
+ EXPECT_EQ(testA.serverUrl, "testA");
+
+ testA = testA + "plus";
+ EXPECT_EQ(testA.serverUrl, "testAplus");
+
+ testB /= "slash";
+ EXPECT_EQ(testB.serverUrl, "testB/slash");
+
+ testB = testB / "next";
+ EXPECT_EQ(testB.serverUrl, "testB/slash/next");
+
+ testC += std::pair("paramName", "paramValue");
+ EXPECT_EQ(testC.queryParams.count("paramName"), 1);
+ EXPECT_EQ(testC.queryParams["paramName"], "paramValue");
+
+ testC = testC + std::pair("paramNamePlus", "paramValuePlus");
+ EXPECT_EQ(testC.queryParams.count("paramNamePlus"), 1);
+ EXPECT_EQ(testC.queryParams["paramNamePlus"], "paramValuePlus");
+}
+
+TEST(RestURLTest, appendUrlTest)
+{
+ RestURL test("test");
+ test.appendUrl("");
+ EXPECT_EQ(test.serverUrl, "test");
+ test.appendUrl("Append");
+ EXPECT_EQ(test.serverUrl, "test/Append");
+}
+
+TEST(RestURLTest, appendQueryTest)
+{
+ RestURL test("test");
+ test.appendQuery("paramName", "paramValue");
+ EXPECT_EQ(test.queryParams.count("paramName"), 1);
+ EXPECT_EQ(test.queryParams["paramName"], "paramValue");
+}
+
+TEST(RestURLTest, toStringTest)
+{
+ RestURL test("test");
+ EXPECT_EQ(test.toString(), "test");
+ test.appendQuery("paramName", "paramValue");
+ EXPECT_EQ(test.toString(), "test?paramName=paramValue");
+ test.appendQuery("paramName2", "paramValue2");
+ EXPECT_EQ(test.toString(), "test?paramName=paramValue&paramName2=paramValue2");
+} \ No newline at end of file
diff --git a/test/Extension/CMakeLists.txt b/test/Extension/CMakeLists.txt
new file mode 100644
index 0000000..fe05a21
--- /dev/null
+++ b/test/Extension/CMakeLists.txt
@@ -0,0 +1,22 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(DOCKER_LAUNCHER_EXTENSIONS_TEST "docker-launcher-extensions-test")
+
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/ ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/util)
+FILE(GLOB DOCKER_LAUNCHER_EXTENSIONS_TEST_SRCS *.cpp)
+
+set(APPROVAL_MAIN ../googletest_approval_main.cpp)
+
+ADD_EXECUTABLE(${DOCKER_LAUNCHER_EXTENSIONS_TEST} ${APPROVAL_MAIN} ${DOCKER_LAUNCHER_EXTENSIONS_TEST_SRCS})
+
+TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER_EXTENSIONS_TEST}
+ PUBLIC
+ gtest
+ gtest_main
+ gmock
+ gmock_main
+ pthread
+ docker-launcher-static
+)
+
+ADD_TEST(NAME ${DOCKER_LAUNCHER_EXTENSIONS_TEST} COMMAND ${DOCKER_LAUNCHER_EXTENSIONS_TEST})
diff --git a/test/Extension/crash-forward-test.cpp b/test/Extension/crash-forward-test.cpp
new file mode 100644
index 0000000..e4806e4
--- /dev/null
+++ b/test/Extension/crash-forward-test.cpp
@@ -0,0 +1,104 @@
+#include "Container.h"
+#include "Config/Config.h"
+#include "Extension/CrashForward.h"
+
+#include <gtest/gtest.h>
+
+using namespace Extension;
+
+class ExtensionCrashForwardTest : public ::testing::Test
+{
+public:
+ void SetUp() override
+ {
+ test = std::make_unique<CrashForward>();
+ container[0] = std::make_unique<Container>(CONTAINER_TYPE_DOCKER);
+ container[0]->fingerprint.id = "testid1234567890";
+ container[0]->fingerprint.name = "testname1";
+
+ container[1] = std::make_unique<Container>(CONTAINER_TYPE_DOCKER);
+ container[1]->fingerprint.id = "1234567890testid";
+ container[1]->fingerprint.name = "testname2";
+ }
+ void TearDown() override {}
+
+ std::unique_ptr<CrashForward> test;
+ std::unique_ptr<Container> container[2];
+};
+
+TEST_F(ExtensionCrashForwardTest, constructTest)
+{
+ EXPECT_NO_THROW(test = std::make_unique<CrashForward>());
+}
+
+TEST_F(ExtensionCrashForwardTest, defaultsTest)
+{
+ {
+ Json::Value config;
+ EXPECT_EQ(test->setConfig(config), STATUS_IGNORE);
+ config["otherExt"];
+ EXPECT_EQ(test->setConfig(config), STATUS_IGNORE);
+ config["crash_forward"];
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container[0].get()), STATUS_OK);
+ }
+
+ {
+ Json::Value config;
+ config["crash_forward"] = "test";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container[0].get()), STATUS_OK);
+
+ config["crash_forward"] = "|testcmd args";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container[0].get()), STATUS_OK);
+ }
+
+ {
+ Json::Value config;
+ Json::Value value;
+ value.append("testcmd");
+ config["crash_forward"] = value;
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container[0].get()), STATUS_OK);
+
+ value.append("args");
+ config["crash_forward"] = value;
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container[0].get()), STATUS_OK);
+
+ value.append("invalid");
+ config["crash_forward"] = value;
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[0].get()), STATUS_IGNORE);
+ EXPECT_EQ(test->stopPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container[0].get()), STATUS_OK);
+ }
+
+ {
+ Json::Value config;
+ config["crash_forward"]["cmd"] = "testcmd";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container[0].get()), STATUS_OK);
+
+ config["crash_forward"]["cmd"] = "|testcmd";
+ config["crash_forward"]["args"] = "args";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container[0].get()), STATUS_OK);
+
+ config["crash_forward"]["invalid"] = "inv";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->startPost(container[1].get()), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container[0].get()), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container[1].get()), STATUS_OK);
+ }
+}
diff --git a/test/Extension/extension-test.cpp b/test/Extension/extension-test.cpp
new file mode 100644
index 0000000..04b6d76
--- /dev/null
+++ b/test/Extension/extension-test.cpp
@@ -0,0 +1,49 @@
+#include "Extension/Extension.h"
+#include <gtest/gtest.h>
+
+using namespace Extension;
+
+class ExtensionTest : public ::testing::Test
+{
+public:
+ void SetUp() override {}
+ void TearDown() override {}
+
+ ExtensionSet exts;
+};
+
+TEST_F(ExtensionTest, interfaceTest)
+{
+ struct Dummy : public Interface {
+ Dummy() : Interface() {}
+ ~Dummy() {}
+ Status setConfig(const Json::Value &config) { return STATUS_NOT_IMPLEMENT; };
+ };
+
+ std::unique_ptr<Dummy> test;
+ Json::Value emptyConfig;
+ EXPECT_NO_THROW(test = std::make_unique<Dummy>());
+ EXPECT_EQ(test->setConfig(emptyConfig), STATUS_NOT_IMPLEMENT);
+ EXPECT_EQ(test->generateCreateOptions(), emptyConfig);
+ EXPECT_EQ(test->buildPre(nullptr), STATUS_IGNORE);
+ EXPECT_EQ(test->buildPost(nullptr), STATUS_IGNORE);
+ EXPECT_EQ(test->createPre(nullptr), STATUS_IGNORE);
+ EXPECT_EQ(test->createPost(nullptr), STATUS_IGNORE);
+ EXPECT_EQ(test->startPre(nullptr), STATUS_IGNORE);
+ EXPECT_EQ(test->startPost(nullptr), STATUS_IGNORE);
+ EXPECT_EQ(test->stopPre(nullptr), STATUS_IGNORE);
+ EXPECT_EQ(test->stopPost(nullptr), STATUS_IGNORE);
+ EXPECT_NO_THROW(test.reset());
+}
+
+TEST_F(ExtensionTest, readConfigTest)
+{
+ Json::Value testConfig;
+ EXPECT_EQ(Helper::readConfigs(exts, testConfig, nullptr), STATUS_IGNORE);
+
+ testConfig["otherConfigs"] = "foo";
+ EXPECT_EQ(Helper::readConfigs(exts, testConfig, nullptr), STATUS_OK);
+
+ testConfig["ExtConfigs"];
+ EXPECT_EQ(Helper::readConfigs(exts, testConfig, nullptr), STATUS_OK);
+}
diff --git a/test/Extension/presets-test.cpp b/test/Extension/presets-test.cpp
new file mode 100644
index 0000000..64f7a64
--- /dev/null
+++ b/test/Extension/presets-test.cpp
@@ -0,0 +1,136 @@
+#include "Container.h"
+#include "Config/Config.h"
+#include "Extension/Presets.h"
+
+#include <gtest/gtest.h>
+
+using namespace Extension;
+
+class ExtensionPresetsTest : public ::testing::Test
+{
+public:
+ void SetUp() override
+ {
+ test = std::make_unique<Presets>();
+ container = std::make_unique<Container>(CONTAINER_TYPE_DOCKER);
+ container->containerConfig = std::make_unique<Config::ContainerConfigs>();
+ }
+ void TearDown() override {}
+
+ std::unique_ptr<Presets> test;
+ std::unique_ptr<Container> container;
+};
+
+TEST_F(ExtensionPresetsTest, constructTest)
+{
+ EXPECT_NO_THROW(test = std::make_unique<Presets>());
+}
+
+TEST_F(ExtensionPresetsTest, defaultsTest)
+{
+ Json::Value config;
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+}
+
+TEST_F(ExtensionPresetsTest, presetsTest)
+{
+ std::vector<std::string> presets = {"ttys", "input", "usb", "audio", "dbus"};
+ std::vector<std::string> fwdtypes = {"host", "mixed", "private", "invalid"};
+
+ for (const auto &preset : presets) {
+ Json::Value config;
+ {
+ config[preset];
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ config[preset] = true;
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ for (const auto &type : fwdtypes) {
+ config[preset] = type;
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+ }
+}
+
+TEST_F(ExtensionPresetsTest, presetInitTest)
+{
+ Json::Value config;
+ config["ttys"] = true;
+ config["input"] = "host";
+ config["usb"] = "host";
+ config["audio"] = "host";
+ config["dbus"] = "mixed";
+ {
+ config["init"];
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ config["init"] = "rootfs";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ config["init"] = "ramdisk";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ config["init"] = "ramdisk";
+ config["ramdisk"];
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ config["init"] = "ramdisk";
+ config["ramdisk"]["fwd_path"] = "test";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+}
+
+TEST_F(ExtensionPresetsTest, presetsStorageTest)
+{
+ {
+ Json::Value config;
+ config["storage"];
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+
+ config["storage"]["test"];
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ Json::Value config;
+ config["storage"]["sda1"] = "host";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ Json::Value config;
+ config["storage"]["sda"] = "host";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ Json::Value config;
+ config["storage"]["usb"] = "host";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+}
diff --git a/test/Extension/tizen-test.cpp b/test/Extension/tizen-test.cpp
new file mode 100644
index 0000000..07c7b6d
--- /dev/null
+++ b/test/Extension/tizen-test.cpp
@@ -0,0 +1,66 @@
+#include "Container.h"
+#include "Config/Config.h"
+#include "Extension/Tizen.h"
+
+#include <gtest/gtest.h>
+
+using namespace Extension;
+
+class ExtensionTizenTest : public ::testing::Test
+{
+public:
+ void SetUp() override
+ {
+ test = std::make_unique<Tizen>();
+ container = std::make_unique<Container>(CONTAINER_TYPE_DOCKER);
+ container->containerConfig = std::make_unique<Config::ContainerConfigs>();
+ }
+ void TearDown() override {}
+
+ std::unique_ptr<Tizen> test;
+ std::unique_ptr<Container> container;
+};
+
+TEST_F(ExtensionTizenTest, constructTest)
+{
+ EXPECT_NO_THROW(test = std::make_unique<Tizen>());
+}
+
+TEST_F(ExtensionTizenTest, defaultsTest)
+{
+ Json::Value config;
+ EXPECT_EQ(test->setConfig(config), STATUS_IGNORE);
+ config["otherExt"];
+ EXPECT_EQ(test->setConfig(config), STATUS_IGNORE);
+ config["tizen"];
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+}
+
+TEST_F(ExtensionTizenTest, LoggerTest)
+{
+ Json::Value config;
+ {
+ config["tizen"]["logger"];
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ config["tizen"]["logger"] = true;
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ config["tizen"]["logger"] = "host";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+
+ {
+ config["tizen"]["logger"] = "invalid";
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+ }
+}
diff --git a/test/Volumes/CMakeLists.txt b/test/Volumes/CMakeLists.txt
new file mode 100644
index 0000000..87cd221
--- /dev/null
+++ b/test/Volumes/CMakeLists.txt
@@ -0,0 +1,22 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(DOCKER_LAUNCHER_VOLUMEDRIVERS_TEST "docker-launcher-volumes-test")
+
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/ ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/util)
+FILE(GLOB DOCKER_LAUNCHER_VOLUMEDRIVERS_TEST_SRCS *.cpp)
+
+set(APPROVAL_MAIN ../googletest_approval_main.cpp)
+
+ADD_EXECUTABLE(${DOCKER_LAUNCHER_VOLUMEDRIVERS_TEST} ${APPROVAL_MAIN} ${DOCKER_LAUNCHER_VOLUMEDRIVERS_TEST_SRCS})
+
+TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER_VOLUMEDRIVERS_TEST}
+ PUBLIC
+ gtest
+ gtest_main
+ gmock
+ gmock_main
+ pthread
+ docker-launcher-static
+)
+
+ADD_TEST(NAME ${DOCKER_LAUNCHER_VOLUMEDRIVERS_TEST} COMMAND ${DOCKER_LAUNCHER_VOLUMEDRIVERS_TEST})
diff --git a/test/Volumes/MockVolume.h b/test/Volumes/MockVolume.h
new file mode 100644
index 0000000..b7d6a9f
--- /dev/null
+++ b/test/Volumes/MockVolume.h
@@ -0,0 +1,31 @@
+#include "Volume.h"
+#include "Volumes/VolumeDriver.h"
+
+class MockVolume : public Volume
+{
+public:
+ explicit MockVolume(const std::string &src, bool ret) : Volume("test")
+ {
+ __available = ret;
+ __control = ret ? VOLUME_CONTROL_DEVICE : VOLUME_CONTROL_INVALID;
+ source = src;
+ }
+ ~MockVolume() = default;
+};
+
+class MockVolumeDriver : public VolumeDriver
+{
+public:
+ explicit MockVolumeDriver() : VolumeDriver() {}
+ explicit MockVolumeDriver(const std::string &drvname, const Json::Value &config) : VolumeDriver(drvname) {}
+ ~MockVolumeDriver() = default;
+
+ virtual std::shared_ptr<Volume> createVolume(const Json::Value &value,
+ std::shared_ptr<Config::SharedConfigs> sharedConfig) override
+ {
+ return std::make_shared<MockVolume>(value["name"].asString(), value["return"].asBool());
+ }
+ virtual Status prepare(std::shared_ptr<Volume> &vol) override { return vol->avail() ? STATUS_OK : STATUS_FAIL; }
+ virtual Status setup(std::shared_ptr<Volume> &vol) override { return vol->avail() ? STATUS_OK : STATUS_FAIL; }
+ virtual Status cleanup(std::shared_ptr<Volume> &vol) override { return vol->avail() ? STATUS_OK : STATUS_FAIL; }
+};
diff --git a/test/Volumes/blockdevice-test.cpp b/test/Volumes/blockdevice-test.cpp
new file mode 100644
index 0000000..0b8b4ba
--- /dev/null
+++ b/test/Volumes/blockdevice-test.cpp
@@ -0,0 +1,125 @@
+#include <memory>
+
+#include <json/json.h>
+
+#include "Volume.h"
+#include "Volumes/BlockDevice.h"
+
+#include "util/JsonTools.h"
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+using namespace testing;
+
+static const std::string test_file = "../test/testfiles/volume-test.json";
+
+static std::unique_ptr<BlkdevDriver> driver;
+static Json::Value test_config;
+
+class BlkdevDriverEnv : public ::testing::Environment
+{
+public:
+ void SetUp() override
+ {
+ driver = std::make_unique<BlkdevDriver>("blkdev", Json::Value());
+
+ Json::Value root;
+ JsonTools::parseFromFile(test_file, &root);
+ test_config = root["volumes"]["blktest"];
+ }
+
+ void TearDown() override
+ {
+ test_config.clear();
+ driver.reset();
+ }
+};
+::testing::Environment *const env = ::testing::AddGlobalTestEnvironment(new BlkdevDriverEnv);
+
+class BlkdevDriverTest : public ::testing::Test
+{
+public:
+ std::string __get_mount_source(const std::string &mntptr) { return driver->__get_mount_source(mntptr); }
+
+ std::string getHostMountPoint(std::shared_ptr<BlkdevVolume> &blkvol) { return blkvol->hostMountPoint; }
+};
+
+TEST_F(BlkdevDriverTest, createVolumeTest)
+{
+ {
+ Json::Value dummy;
+ EXPECT_EQ(driver->createVolume(dummy, nullptr), nullptr);
+ }
+
+ {
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config["driver_opts"], nullptr);
+ EXPECT_TRUE(vol != nullptr);
+
+ std::shared_ptr<BlkdevVolume> blkvol = std::static_pointer_cast<BlkdevVolume>(vol);
+ EXPECT_EQ(getHostMountPoint(blkvol), "/");
+
+ EXPECT_NO_THROW(vol.reset());
+ }
+}
+
+TEST_F(BlkdevDriverTest, __get_mount_sourceTest)
+{
+ EXPECT_TRUE(__get_mount_source("/") != "");
+ EXPECT_EQ(__get_mount_source("/tmp"), "tmpfs");
+}
+
+TEST_F(BlkdevDriverTest, prepareTest)
+{
+ {
+ std::shared_ptr<Volume> dummy = std::make_shared<Volume>();
+ EXPECT_EQ(driver->prepare(dummy), STATUS_FAIL);
+ }
+
+ {
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config["driver_opts"], nullptr);
+ EXPECT_FALSE(vol->prepared());
+ EXPECT_EQ(driver->prepare(vol), STATUS_OK);
+ EXPECT_TRUE(vol->prepared());
+ EXPECT_EQ(driver->prepare(vol), STATUS_OK);
+ EXPECT_TRUE(vol->source != "");
+ EXPECT_NO_THROW(vol.reset());
+ }
+}
+
+TEST_F(BlkdevDriverTest, setupTest)
+{
+ {
+ std::shared_ptr<Volume> dummy = std::make_shared<Volume>();
+ EXPECT_EQ(driver->setup(dummy), STATUS_FAIL);
+ }
+ {
+ std::shared_ptr<Volume> dummy = std::make_shared<Volume>();
+ EXPECT_EQ(driver->cleanup(dummy), STATUS_FAIL);
+ }
+
+ {
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config["driver_opts"], nullptr);
+
+ // setup
+ EXPECT_FALSE(vol->avail());
+ EXPECT_EQ(driver->setup(vol), STATUS_OK);
+ EXPECT_TRUE(vol->avail());
+ EXPECT_EQ(driver->setup(vol), STATUS_OK);
+
+ // cleanup
+ EXPECT_TRUE(vol->avail());
+ EXPECT_EQ(driver->cleanup(vol), STATUS_OK);
+ EXPECT_FALSE(vol->avail());
+
+ EXPECT_NO_THROW(vol.reset());
+ }
+}
+
+TEST_F(BlkdevDriverTest, cleanupTest)
+{
+ {
+ std::shared_ptr<Volume> dummy = std::make_shared<Volume>();
+ EXPECT_EQ(driver->cleanup(dummy), STATUS_FAIL);
+ }
+}
diff --git a/test/Volumes/loopdevice-test.cpp b/test/Volumes/loopdevice-test.cpp
new file mode 100644
index 0000000..95e62b5
--- /dev/null
+++ b/test/Volumes/loopdevice-test.cpp
@@ -0,0 +1,307 @@
+#include <memory>
+
+#include <json/json.h>
+
+#include "Volume.h"
+#include "Volumes/LoopDevice.h"
+#include "util/system.h"
+#include "util/util.h"
+#include "util/blkid.h"
+#include "util/util.h"
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+using namespace testing;
+
+static const std::filesystem::path testfile_dir = "../test/testfiles";
+static const std::filesystem::path test_file = testfile_dir / "volume-test.json";
+
+static const struct {
+ struct {
+ std::filesystem::path file = testfile_dir / "lodev.img";
+ std::string label = "loopdev";
+ size_t size = 4194304; // 4MB
+ } orig;
+
+ struct {
+ std::filesystem::path file = std::filesystem::current_path() / "gen_testfiles/images/lodev.test.img";
+ std::string label = "loopdev-test";
+ size_t size = util::convert::byteSize("10MB", 512); // 10MB
+ } test;
+} image;
+
+static std::unique_ptr<LoopdevDriver> driver;
+static std::vector<Json::Value> test_config;
+static std::string next_lodev;
+
+class LoopdevDriverEnv : public ::testing::Environment
+{
+public:
+ void SetUp() override
+ {
+ driver = std::make_unique<LoopdevDriver>("loopdev", Json::Value());
+ test_config.clear();
+
+ Json::Value root;
+ JsonTools::parseFromFile(test_file, &root);
+ test_config.push_back(root["volumes"]["looptest1"]);
+ test_config.push_back(root["volumes"]["looptest2"]);
+ test_config.push_back(root["volumes"]["looptest_invalid1"]);
+ test_config.push_back(root["volumes"]["looptest_invalid2"]);
+ }
+
+ void TearDown() override
+ {
+ test_config.clear();
+ driver.reset();
+
+ std::filesystem::remove(image.test.file);
+ }
+};
+::testing::Environment *const env = ::testing::AddGlobalTestEnvironment(new LoopdevDriverEnv);
+
+class LoopdevDriverTest : public ::testing::Test
+{
+public:
+ void SetUp() override { std::filesystem::copy(image.orig.file, image.test.file); }
+ void TearDown() override { std::filesystem::remove(image.test.file); }
+
+ Status __resize(const std::string &file, const unsigned int sizeBytes) { return driver->__resize(file, sizeBytes); }
+ Status __change_label(const std::string &file, const std::string &label)
+ {
+ return driver->__change_label(file, label);
+ }
+ Status __lodev_attach(const std::string &dev, const std::string &file) { return driver->__lodev_attach(dev, file); }
+ Status __lodev_detach(const std::string &dev) { return driver->__lodev_detach(dev); }
+ std::string __next_lodev() { return driver->__next_lodev(); }
+
+ std::filesystem::path &getFile(std::shared_ptr<LoopdevVolume> &lodev) { return lodev->file; }
+ std::optional<std::string> &getLabel(std::shared_ptr<LoopdevVolume> &lodev) { return lodev->label; }
+ std::optional<uintmax_t> &getSizeBytes(std::shared_ptr<LoopdevVolume> &lodev) { return lodev->sizeBytes; }
+ std::optional<int> &getIndex(std::shared_ptr<LoopdevVolume> &lodev) { return lodev->index; }
+};
+
+TEST_F(LoopdevDriverTest, constructTest)
+{
+ Json::Value config;
+ EXPECT_NO_THROW(driver = std::make_unique<LoopdevDriver>("loopdev", config));
+ config["loopdev"];
+ EXPECT_NO_THROW(driver = std::make_unique<LoopdevDriver>("loopdev", config));
+ config["loopdev"]["node_minor_dist"] = 1;
+ EXPECT_NO_THROW(driver = std::make_unique<LoopdevDriver>("loopdev", config));
+}
+
+TEST_F(LoopdevDriverTest, createVolumeTest)
+{
+ {
+ Json::Value dummy;
+ EXPECT_EQ(driver->createVolume(dummy, nullptr), nullptr);
+ }
+
+ unsigned int testCase = 0;
+ {
+ // test 1
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[testCase]["driver_opts"], nullptr);
+ EXPECT_TRUE(vol != nullptr);
+ EXPECT_STREQ(vol->getDriverName().c_str(), LOOPDEV_DRVNAME);
+ EXPECT_EQ(vol->getControlType(), VOLUME_CONTROL_DEVICE);
+
+ std::shared_ptr<LoopdevVolume> lodev = std::static_pointer_cast<LoopdevVolume>(vol);
+ EXPECT_EQ(getFile(lodev), image.test.file);
+ EXPECT_EQ(getLabel(lodev), image.test.label);
+ EXPECT_EQ(getSizeBytes(lodev), image.test.size);
+ EXPECT_EQ(getIndex(lodev), 20);
+
+ EXPECT_NO_THROW(vol.reset());
+ }
+
+ ++testCase;
+ {
+ // test 2
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[testCase]["driver_opts"], nullptr);
+ EXPECT_TRUE(vol != nullptr);
+ EXPECT_STREQ(vol->getDriverName().c_str(), LOOPDEV_DRVNAME);
+ EXPECT_EQ(vol->getControlType(), VOLUME_CONTROL_DEVICE);
+
+ std::shared_ptr<LoopdevVolume> lodev = std::static_pointer_cast<LoopdevVolume>(vol);
+ EXPECT_EQ(getFile(lodev), image.test.file);
+ EXPECT_EQ(getLabel(lodev), image.test.label);
+ EXPECT_EQ(getSizeBytes(lodev), image.test.size);
+ EXPECT_FALSE(getIndex(lodev));
+
+ EXPECT_NO_THROW(vol.reset());
+ }
+
+ ++testCase;
+ {
+ // invalid test 1
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[testCase]["driver_opts"], nullptr);
+ std::shared_ptr<LoopdevVolume> lodev = std::static_pointer_cast<LoopdevVolume>(vol);
+ EXPECT_TRUE(getFile(lodev).empty());
+ EXPECT_FALSE(getLabel(lodev));
+ EXPECT_FALSE(getSizeBytes(lodev));
+ EXPECT_FALSE(getIndex(lodev));
+ }
+
+ ++testCase;
+ {
+ // invalid test 2
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[testCase]["driver_opts"], nullptr);
+ std::shared_ptr<LoopdevVolume> lodev = std::static_pointer_cast<LoopdevVolume>(vol);
+ EXPECT_TRUE(getFile(lodev).empty());
+ EXPECT_FALSE(getLabel(lodev));
+ EXPECT_FALSE(getSizeBytes(lodev));
+ EXPECT_FALSE(getIndex(lodev));
+ }
+}
+
+TEST_F(LoopdevDriverTest, __change_labelTest)
+{
+ {
+ EXPECT_EQ(__change_label("invalid.file", image.test.label), STATUS_FAIL);
+ }
+
+ {
+ /* label change test */
+ EXPECT_EQ(util::blkID(image.test.file).getLabel(), image.orig.label);
+ EXPECT_EQ(__change_label(image.test.file, image.test.label), STATUS_OK);
+ EXPECT_EQ(util::blkID(image.test.file).getLabel(), image.test.label);
+ }
+
+ {
+ /* same label test */
+ EXPECT_EQ(__change_label(image.test.file, image.test.label), STATUS_OK);
+ }
+}
+
+TEST_F(LoopdevDriverTest, __resizeTest)
+{
+ {
+ EXPECT_EQ(__resize("", image.test.size), STATUS_FAIL);
+ EXPECT_EQ(__resize("invalid.file", image.test.size), STATUS_FAIL);
+ EXPECT_EQ(__resize(image.test.file, 0), STATUS_FAIL);
+ }
+
+ {
+ /* size change test */
+ EXPECT_EQ(std::filesystem::file_size(image.test.file), image.orig.size);
+ EXPECT_EQ(__resize(image.test.file, image.test.size), STATUS_OK);
+ EXPECT_EQ(std::filesystem::file_size(image.test.file), image.test.size);
+ }
+
+ {
+ /* same size test */
+ EXPECT_EQ(__resize(image.test.file, image.test.size), STATUS_OK);
+ }
+}
+
+TEST_F(LoopdevDriverTest, __lodev_attachTest)
+{
+ next_lodev = __next_lodev();
+ EXPECT_EQ(__lodev_attach("", ""), STATUS_FAIL);
+ EXPECT_EQ(__lodev_attach("invalid.file", image.test.file), STATUS_FAIL);
+ EXPECT_EQ(__lodev_attach(next_lodev, "invalid.file"), STATUS_FAIL);
+ EXPECT_EQ(__lodev_attach(next_lodev, image.test.file), STATUS_OK);
+}
+
+TEST_F(LoopdevDriverTest, __lodev_detachTest)
+{
+ EXPECT_EQ(__lodev_detach(""), STATUS_IGNORE);
+ EXPECT_EQ(__lodev_detach("inviald.file"), STATUS_IGNORE);
+ EXPECT_EQ(__lodev_detach(next_lodev), STATUS_OK);
+}
+
+TEST_F(LoopdevDriverTest, prepareTest)
+{
+ {
+ std::shared_ptr<Volume> dummy = std::make_shared<Volume>();
+ EXPECT_EQ(driver->prepare(dummy), STATUS_FAIL);
+ }
+
+ {
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[2]["driver_opts"], nullptr);
+ EXPECT_FALSE(vol->prepared());
+ EXPECT_EQ(driver->prepare(vol), STATUS_FAIL);
+ EXPECT_FALSE(vol->prepared());
+ }
+ {
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[1]["driver_opts"], nullptr);
+ EXPECT_FALSE(vol->prepared());
+ EXPECT_EQ(driver->prepare(vol), STATUS_OK);
+ EXPECT_TRUE(vol->prepared());
+ EXPECT_EQ(driver->prepare(vol), STATUS_OK);
+ EXPECT_TRUE(vol->prepared());
+ EXPECT_TRUE(vol->source != "");
+ }
+ {
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[0]["driver_opts"], nullptr);
+ EXPECT_FALSE(vol->prepared());
+ EXPECT_EQ(driver->prepare(vol), STATUS_OK);
+ EXPECT_TRUE(vol->prepared());
+ EXPECT_EQ(driver->prepare(vol), STATUS_OK);
+ EXPECT_TRUE(vol->prepared());
+ EXPECT_TRUE(vol->source != "");
+ EXPECT_NO_THROW(vol.reset());
+ }
+}
+
+TEST_F(LoopdevDriverTest, setupTest)
+{
+ {
+ std::shared_ptr<Volume> dummy = std::make_shared<Volume>();
+ EXPECT_EQ(driver->setup(dummy), STATUS_FAIL);
+ }
+
+ {
+ std::shared_ptr<Volume> dummy = std::make_shared<Volume>();
+ EXPECT_EQ(driver->cleanup(dummy), STATUS_FAIL);
+ }
+
+ {
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[2]["driver_opts"], nullptr);
+ EXPECT_EQ(driver->prepare(vol), STATUS_FAIL);
+ EXPECT_FALSE(vol->avail());
+ EXPECT_EQ(driver->setup(vol), STATUS_FAIL);
+ EXPECT_FALSE(vol->avail());
+ }
+
+ {
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[0]["driver_opts"], nullptr);
+ EXPECT_EQ(driver->prepare(vol), STATUS_OK);
+ EXPECT_FALSE(vol->avail());
+ EXPECT_EQ(driver->setup(vol), STATUS_FAIL);
+ EXPECT_FALSE(vol->avail());
+ }
+
+ {
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[1]["driver_opts"], nullptr);
+ EXPECT_EQ(driver->prepare(vol), STATUS_OK);
+ EXPECT_FALSE(vol->avail());
+
+ // setup
+ EXPECT_EQ(driver->setup(vol), STATUS_OK);
+ EXPECT_TRUE(vol->avail());
+ EXPECT_EQ(driver->setup(vol), STATUS_OK);
+ EXPECT_TRUE(vol->avail());
+
+ // cleanup
+ vol->attachContainer("test");
+ EXPECT_EQ(driver->cleanup(vol), STATUS_IGNORE);
+ vol->detachContainer("test");
+ EXPECT_EQ(driver->cleanup(vol), STATUS_OK);
+ EXPECT_FALSE(vol->avail());
+ EXPECT_EQ(driver->cleanup(vol), STATUS_OK);
+ EXPECT_FALSE(vol->avail());
+
+ EXPECT_NO_THROW(vol.reset());
+ }
+}
+
+TEST_F(LoopdevDriverTest, destructTest)
+{
+ std::shared_ptr<Volume> vol = driver->createVolume(test_config[1]["driver_opts"], nullptr);
+ driver->prepare(vol);
+ driver->setup(vol);
+ EXPECT_NO_THROW(driver.reset());
+}
diff --git a/test/Volumes/volume-manager-test.cpp b/test/Volumes/volume-manager-test.cpp
new file mode 100644
index 0000000..7cac06b
--- /dev/null
+++ b/test/Volumes/volume-manager-test.cpp
@@ -0,0 +1,111 @@
+#include <memory>
+#include <json/json.h>
+
+#include "Volumes/VolumeManager.h"
+#include "Volumes/VolumeDriver.h"
+#include "Volumes/LoopDevice.h"
+#include "Volumes/BlockDevice.h"
+#include "util/JsonTools.h"
+
+#include "MockVolume.h"
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+using namespace testing;
+
+const std::vector<std::string> extConfigs = {"looptest", "blktest"};
+const std::string invalid_config = "../test/testfiles/util/system.testfile";
+const std::string empty_config = "../test/testfiles/empty.json";
+const std::string test_config = "../test/testfiles/volume-test.json";
+
+std::unique_ptr<VolumeManager> manager;
+
+class VolumeManagerEnv : public ::testing::Environment
+{
+public:
+ void SetUp() override {}
+
+ void TearDown() override {}
+};
+::testing::Environment *const env = ::testing::AddGlobalTestEnvironment(new VolumeManagerEnv);
+
+class VolumeManagerTest : public ::testing::Test
+{
+};
+
+TEST_F(VolumeManagerTest, constructTest)
+{
+ std::unique_ptr<VolumeDriver> driver;
+ std::shared_ptr<Volume> vol;
+ EXPECT_NO_THROW(driver = std::make_unique<MockVolumeDriver>());
+ EXPECT_NO_THROW(driver = std::make_unique<MockVolumeDriver>("test", Json::Value()));
+ EXPECT_STREQ(driver->drvname.c_str(), "test");
+ vol = driver->createVolume("invalid");
+ EXPECT_TRUE(vol == nullptr);
+ vol = driver->createVolume("{\"test\" : 1234}");
+ EXPECT_TRUE(vol != nullptr);
+ EXPECT_EQ(vol->setConfigs(Json::Value()), STATUS_NOT_IMPLEMENT);
+ EXPECT_NO_THROW(vol = std::make_unique<MockVolume>("dummy", true));
+ EXPECT_NO_THROW(vol.reset());
+ EXPECT_NO_THROW(driver.reset());
+ EXPECT_NO_THROW(manager = std::make_unique<VolumeManager>());
+}
+
+TEST_F(VolumeManagerTest, getTest)
+{
+ EXPECT_TRUE(VolumeManager::get() == VolumeManager::get());
+ EXPECT_FALSE(VolumeManager::get() == manager.get());
+}
+
+TEST_F(VolumeManagerTest, initDriversTest)
+{
+ EXPECT_EQ(manager->initDrivers(Json::Value()), STATUS_OK);
+}
+
+TEST_F(VolumeManagerTest, getDriverTest)
+{
+ EXPECT_EQ(manager->getDriver("testdrv"), nullptr);
+ EXPECT_TRUE(manager->getDriver(BLKDEV_DRVNAME) != nullptr);
+ EXPECT_TRUE(manager->getDriver(LOOPDEV_DRVNAME) != nullptr);
+}
+
+TEST_F(VolumeManagerTest, getVolumeTest1)
+{
+ EXPECT_EQ(manager->getVolume("dummyVolume"), nullptr);
+}
+
+TEST_F(VolumeManagerTest, registryTest)
+{
+ Json::Value dummy;
+ EXPECT_EQ(manager->registryFromConfigs(dummy, nullptr), STATUS_IGNORE);
+ dummy["test"] = "test";
+ EXPECT_EQ(manager->registryFromConfigs(dummy, nullptr), STATUS_NOT_FOUND);
+ dummy["volumes"]["test1"]["invalid"] = "invalid";
+ EXPECT_EQ(manager->registryFromConfigs(dummy, nullptr), STATUS_OK);
+ dummy["volumes"]["test1"]["driver"] = "invalid";
+ EXPECT_EQ(manager->registryFromConfigs(dummy, nullptr), STATUS_OK);
+
+ EXPECT_EQ(manager->registryFromConfigFile(invalid_config), STATUS_FAIL);
+ EXPECT_EQ(manager->registryFromConfigFile(empty_config), STATUS_IGNORE);
+ EXPECT_EQ(manager->registryFromConfigFile(test_config), STATUS_OK);
+}
+
+TEST_F(VolumeManagerTest, getVolumeTest2)
+{
+ EXPECT_TRUE(manager->getVolume("looptest1") != nullptr);
+ EXPECT_TRUE(manager->getVolume("blktest") != nullptr);
+}
+
+TEST_F(VolumeManagerTest, unregistryTest)
+{
+ EXPECT_EQ(manager->unregistry("test"), STATUS_OK);
+ EXPECT_EQ(manager->unregistry(extConfigs[0]), STATUS_OK);
+ EXPECT_EQ(manager->getVolume(extConfigs[0]), nullptr);
+ EXPECT_EQ(manager->unregistry(extConfigs[1]), STATUS_OK);
+ EXPECT_EQ(manager->getVolume(extConfigs[1]), nullptr);
+}
+
+TEST_F(VolumeManagerTest, initDestroyTest)
+{
+ EXPECT_NO_THROW(manager.reset());
+}
diff --git a/test/Volumes/volumes-ext-test.cpp b/test/Volumes/volumes-ext-test.cpp
new file mode 100644
index 0000000..4e7fc19
--- /dev/null
+++ b/test/Volumes/volumes-ext-test.cpp
@@ -0,0 +1,130 @@
+#include "Container.h"
+#include "Config/Config.h"
+#include "Volumes/VolumeManager.h"
+#include "Volumes/Volumes.h"
+#include "internal_types.h"
+
+#include "MockVolume.h"
+#include <gtest/gtest.h>
+
+using namespace Extension;
+
+class ExtensionVolumesEnv : public ::testing::Environment
+{
+public:
+ void SetUp() override
+ {
+ VolumeManager::get()->registryDriver<MockVolumeDriver>("test", Json::Value());
+ Json::Value volumeConfigs;
+ volumeConfigs["volumes"]["test_ok"]["driver"] = "test";
+ volumeConfigs["volumes"]["test_ok"]["driver_opts"]["return"] = true;
+ volumeConfigs["volumes"]["test_ok"]["driver_opts"]["name"] = "test_ok";
+ volumeConfigs["volumes"]["test_fail"]["driver"] = "test";
+ volumeConfigs["volumes"]["test_fail"]["driver_opts"]["return"] = false;
+ volumeConfigs["volumes"]["test_fail"]["driver_opts"]["name"] = "test_fail";
+ VolumeManager::get()->registryFromConfigs(volumeConfigs, nullptr);
+ }
+ void TearDown() override {}
+};
+::testing::Environment *const env = ::testing::AddGlobalTestEnvironment(new ExtensionVolumesEnv);
+
+class ExtensionVolumesTest : public ::testing::Test
+{
+public:
+ void SetUp() override
+ {
+ test = std::make_unique<Volumes>();
+ container = std::make_unique<Container>(CONTAINER_TYPE_DOCKER);
+ container->containerConfig = std::make_unique<Config::ContainerConfigs>();
+ }
+ void TearDown() override {}
+
+ std::unique_ptr<Volumes> test;
+ std::unique_ptr<Container> container;
+};
+
+TEST_F(ExtensionVolumesTest, constructTest)
+{
+ EXPECT_NO_THROW(test = std::make_unique<Volumes>());
+}
+
+TEST_F(ExtensionVolumesTest, defaultsTest)
+{
+ Json::Value config;
+ EXPECT_EQ(test->setConfig(config), STATUS_IGNORE);
+ config["otherExt"];
+ EXPECT_EQ(test->setConfig(config), STATUS_IGNORE);
+ config["volumes"];
+ EXPECT_EQ(test->setConfig(config), STATUS_FAIL);
+ config["volumes"] = "test";
+ EXPECT_EQ(test->setConfig(config), STATUS_FAIL);
+ config["volumes"] = Json::Value();
+ config["volumes"].append(1234);
+ EXPECT_EQ(test->setConfig(config), STATUS_IGNORE);
+ config["volumes"].append("test1");
+ config["volumes"].append("test2");
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+}
+
+TEST_F(ExtensionVolumesTest, createPreTest)
+{
+ Json::Value config;
+ config["volumes"];
+ config["volumes"].append(1234);
+ EXPECT_EQ(test->setConfig(config), STATUS_IGNORE);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_IGNORE);
+
+ config["volumes"].append("test_invalid");
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+
+ config["volumes"].append("test_ok");
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_OK);
+
+ config["volumes"].append("test_fail");
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->createPre(container.get()), STATUS_FAIL);
+}
+
+TEST_F(ExtensionVolumesTest, startPreTest)
+{
+ Json::Value config;
+ config["volumes"];
+ config["volumes"].append(1234);
+ EXPECT_EQ(test->setConfig(config), STATUS_IGNORE);
+ EXPECT_EQ(test->startPre(container.get()), STATUS_IGNORE);
+
+ config["volumes"].append("test_invalid");
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPre(container.get()), STATUS_OK);
+
+ config["volumes"].append("test_ok");
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPre(container.get()), STATUS_OK);
+
+ config["volumes"].append("test_fail");
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->startPre(container.get()), STATUS_FAIL);
+}
+
+TEST_F(ExtensionVolumesTest, stopPostTest)
+{
+ Json::Value config;
+ config["volumes"];
+ config["volumes"].append(1234);
+ EXPECT_EQ(test->setConfig(config), STATUS_IGNORE);
+ EXPECT_EQ(test->stopPost(container.get()), STATUS_IGNORE);
+
+ config["volumes"].append("test_invalid");
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container.get()), STATUS_OK);
+
+ config["volumes"].append("test_ok");
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container.get()), STATUS_OK);
+
+ config["volumes"].append("test_fail");
+ EXPECT_EQ(test->setConfig(config), STATUS_OK);
+ EXPECT_EQ(test->stopPost(container.get()), STATUS_FAIL);
+}
diff --git a/test/container-lifecycle-manager-test.cpp b/test/container-lifecycle-manager-test.cpp
new file mode 100644
index 0000000..2cf853b
--- /dev/null
+++ b/test/container-lifecycle-manager-test.cpp
@@ -0,0 +1,112 @@
+#include "DockerLauncher.h"
+#include "ContainerManager.h"
+#include "Volumes/VolumeManager.h"
+
+#include "Controller/DockerController.h"
+
+#include "internal_types.h"
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "Controller/MockRestInterface.h"
+
+#include <iostream>
+using namespace testing;
+
+class ContainerLifecycleManagerTest : public ::testing::Test
+{
+public:
+ void SetUp() override
+ {
+ dockerLauncher = std::make_unique<DockerLauncher>();
+ mockRestInterface = std::make_shared<MockRestInterface>("http://v1.41", "/var/run/docker.sock");
+ dockerLauncher->containerManager->halDevicesPath = TARGET_ROOT + "/hal/etc/docker/devices.json";
+ dockerLauncher->initialize();
+ Json::Value configList;
+ Config::ContainerListConfigs::loadList(TARGET_ROOT + "/opt/data/container/list", configList);
+ dockerLauncher->containerManager->registryContainers(configList);
+ dockerLauncher->containerManager->findContainer("tizen-headed", container);
+ ((DockerController *)ContainerController::getController(container->TYPE))->setRestInterface(mockRestInterface);
+ static_cast<DockerContainer *>(container)->restInterface = mockRestInterface;
+ static_cast<DockerContainer *>(container)->restInterfaceForWait = mockRestInterface;
+ }
+
+ void TearDown() override
+ {
+ // For deleting mockRestInterface
+ mockRestInterface.reset();
+ }
+
+ void resetExtConfig()
+ {
+ for (auto const &it : dockerLauncher->containerManager->__containerList) {
+ it.second->getContainer()->extConfigs.clear();
+ }
+ }
+
+ std::unique_ptr<DockerLauncher> dockerLauncher;
+ std::shared_ptr<MockRestInterface> mockRestInterface;
+ Container *container;
+ std::string TARGET_ROOT = "../test/testfiles/rpi4";
+};
+
+ACTION_P(Wait, seconds)
+{
+ sleep(seconds);
+}
+
+TEST_F(ContainerLifecycleManagerTest, ContainerStatemachineTest)
+{
+ RestURL url;
+
+ // 9. remove image
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("DELETE"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // 8. destroy
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("DELETE"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // 7. stop
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // 6. wait
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(DoAll(Wait(5), Return(ResponseMessage(ResponseCode::OK, ""))))
+ .RetiresOnSaturation();
+ // 5. start
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // 4. create
+ EXPECT_CALL(*mockRestInterface, request_post(_, _, _, StrEq(HTTP_CONTENT_TYPE_JSON), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // 3. isContainerExist
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "[]")))
+ .RetiresOnSaturation();
+
+ // 2. build
+ EXPECT_CALL(*mockRestInterface, request_post(_, A<std::basic_ifstream<char> *>(), StrEq(HTTP_CONTENT_TYPE_XTAR), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // 1. isImageExist
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "[]")))
+ .RetiresOnSaturation();
+
+ resetExtConfig();
+
+ dockerLauncher->containerManager->runContainers();
+ sleep(1); // wait for changine container state to running
+
+ dockerLauncher->containerManager->handleRemovedAdaptor("tizen-headed");
+}
diff --git a/test/container-manager-test.cpp b/test/container-manager-test.cpp
new file mode 100644
index 0000000..ff1663a
--- /dev/null
+++ b/test/container-manager-test.cpp
@@ -0,0 +1,100 @@
+#include "DockerLauncher.h"
+#include "ContainerManager.h"
+#include "Volumes/VolumeManager.h"
+
+#include "Controller/DockerController.h"
+
+#include "internal_types.h"
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "Controller/MockRestInterface.h"
+
+#include <iostream>
+using namespace testing;
+
+class ContainerManagerTest : public ::testing::Test
+{
+public:
+ void SetUp() override { dockerLauncher = std::make_unique<DockerLauncher>(); }
+
+ void TearDown() override {}
+
+ std::unique_ptr<DockerLauncher> dockerLauncher;
+ std::shared_ptr<MockRestInterface> mockRestInterface;
+ Container *container;
+ std::string TARGET_ROOT = "../test/testfiles/rpi4";
+};
+
+TEST_F(ContainerManagerTest, validNameTest)
+{
+ EXPECT_THROW(dockerLauncher->containerManager->validName(""), std::invalid_argument);
+ EXPECT_EQ(dockerLauncher->containerManager->validName("name"), STATUS_OK);
+}
+
+TEST_F(ContainerManagerTest, registryTest)
+{
+ EXPECT_EQ(dockerLauncher->containerManager->registry("invalid_path", "tizen-headed"), STATUS_FAIL);
+ EXPECT_EQ(dockerLauncher->containerManager->registry(
+ TARGET_ROOT + "/opt/data/container/tizen-headed/configs/tizen-headed.json", "tizen-headed"),
+ STATUS_OK);
+}
+
+TEST_F(ContainerManagerTest, unregistryTest)
+{
+ EXPECT_EQ(dockerLauncher->containerManager->unregistry("tizen-headed"), STATUS_FAIL);
+ dockerLauncher->containerManager->registry(
+ TARGET_ROOT + "/opt/data/container/tizen-headed/configs/tizen-headed.json", "tizen-headed");
+ EXPECT_EQ(dockerLauncher->containerManager->unregistry("tizen-headed"), STATUS_OK);
+}
+
+TEST_F(ContainerManagerTest, registryContainersTest)
+{
+ Json::Value configList;
+ Config::ContainerListConfigs::loadList(TARGET_ROOT + "/opt/data/container/list", configList);
+ EXPECT_EQ(dockerLauncher->containerManager->registryContainers(configList), STATUS_OK);
+ EXPECT_EQ(dockerLauncher->containerManager->unregistryContainers(), STATUS_OK);
+}
+
+TEST_F(ContainerManagerTest, findContainerTest)
+{
+ Container *container;
+ EXPECT_THROW(dockerLauncher->containerManager->findContainer("", container), std::invalid_argument);
+ dockerLauncher->containerManager->registry(
+ TARGET_ROOT + "/opt/data/container/tizen-headed/configs/tizen-headed.json", "tizen-headed");
+ EXPECT_EQ(dockerLauncher->containerManager->findContainer("tizen-headed-invalid-name", container),
+ STATUS_NOT_FOUND);
+ EXPECT_EQ(dockerLauncher->containerManager->findContainer("tizen-headed", container), STATUS_OK);
+}
+
+TEST_F(ContainerManagerTest, stopContainersTest)
+{
+ EXPECT_EQ(dockerLauncher->containerManager->stopContainers(), STATUS_FAIL);
+ dockerLauncher->containerManager->registry(
+ TARGET_ROOT + "/opt/data/container/tizen-headed/configs/tizen-headed.json", "tizen-headed");
+ EXPECT_EQ(dockerLauncher->containerManager->stopContainers(), STATUS_OK);
+}
+
+TEST_F(ContainerManagerTest, AdaptorListTest)
+{
+ EXPECT_EQ(dockerLauncher->containerManager->stopMonitoringInAdaptorList(), STATUS_NOT_FOUND);
+ EXPECT_EQ(
+ dockerLauncher->containerManager->findRemovedAdaptorInAdaptorList(TARGET_ROOT + "/opt/data/container/list"),
+ "");
+ EXPECT_EQ(dockerLauncher->containerManager->initMonitoringInAdaptorList(TARGET_ROOT + "/opt/data/container/list"),
+ STATUS_OK);
+ dockerLauncher->containerManager->registry(
+ TARGET_ROOT + "/opt/data/container/tizen-headed/configs/tizen-headed.json", "tizen-headed");
+ EXPECT_EQ(
+ dockerLauncher->containerManager->findRemovedAdaptorInAdaptorList(TARGET_ROOT + "/opt/data/container/list"),
+ "");
+ EXPECT_EQ(dockerLauncher->containerManager->stopMonitoringInAdaptorList(), STATUS_OK);
+ EXPECT_EQ(dockerLauncher->containerManager->stopAdaptorWatch(), STATUS_OK);
+}
+
+TEST_F(ContainerManagerTest, joinThreadTest)
+{
+ dockerLauncher->containerManager->registry(
+ TARGET_ROOT + "/opt/data/container/tizen-headed/configs/tizen-headed.json", "tizen-headed");
+ EXPECT_EQ(dockerLauncher->containerManager->joinThreads(), STATUS_OK);
+}
diff --git a/test/docker-launcher-test.cpp b/test/docker-launcher-test.cpp
new file mode 100644
index 0000000..2073bd6
--- /dev/null
+++ b/test/docker-launcher-test.cpp
@@ -0,0 +1,191 @@
+#include "ContainerManager.h"
+#include "DockerLauncher.h"
+#include "Volumes/VolumeManager.h"
+
+#include "Controller/DockerController.h"
+
+#include "internal_types.h"
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "Controller/MockRestInterface.h"
+
+#include <arpa/inet.h>
+#include <iostream>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <unistd.h>
+using namespace testing;
+
+class DockerLauncherTest : public ::testing::Test
+{
+public:
+ void SetUp() override
+ {
+ dockerLauncher = std::make_unique<DockerLauncher>();
+ mockRestInterface = std::make_shared<MockRestInterface>("http://v1.41", "/var/run/docker.sock");
+ dockerLauncher->containerManager->halDevicesPath = TARGET_ROOT + "/hal/etc/docker/devices.json";
+ dockerLauncher->initialize();
+ Json::Value configList;
+ Config::ContainerListConfigs::loadList(TARGET_ROOT + "/opt/data/container/list", configList);
+ dockerLauncher->cliSocketPath = TARGET_ROOT + "/var/run/docker_launcher.sock";
+ dockerLauncher->containerManager->registryContainers(configList);
+ dockerLauncher->containerManager->findContainer("tizen-headed", container);
+ ((DockerController *)ContainerController::getController(container->TYPE))->setRestInterface(mockRestInterface);
+ static_cast<DockerContainer *>(container)->restInterface = mockRestInterface;
+ }
+
+ void TearDown() override
+ {
+ // For deleting mockRestInterface
+ mockRestInterface.reset();
+ }
+
+ std::unique_ptr<DockerLauncher> dockerLauncher;
+ std::shared_ptr<MockRestInterface> mockRestInterface;
+ Container *container;
+ std::string TARGET_ROOT = "../test/testfiles/rpi4";
+};
+
+TEST_F(DockerLauncherTest, executeCLITest)
+{
+ std::string container_name("tizen-headed");
+ std::string containerList = "[{\"Names\": [\"/" + container->fingerprint.name + "\"]}]";
+ std::string invalidList = "[{\"Names\": [\"/invalidName\"]}]";
+ std::string imageList = "[{\"RepoTags\": [\"" + container->image->fingerprint.name + ":latest\"]}]";
+
+ // purge
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("DELETE"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, imageList)))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("DELETE"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, containerList)))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, containerList)))
+ .RetiresOnSaturation();
+
+ // is running
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, containerList)))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, invalidList)))
+ .RetiresOnSaturation();
+
+ // stop
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // start
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("POST"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // create
+ EXPECT_CALL(*mockRestInterface, request_post(_, _, _, StrEq(HTTP_CONTENT_TYPE_JSON), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // load
+ EXPECT_CALL(*mockRestInterface, request_post(_, A<std::basic_ifstream<char> *>(), StrEq(HTTP_CONTENT_TYPE_XTAR), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // build
+ EXPECT_CALL(*mockRestInterface, request_post(_, A<std::basic_ifstream<char> *>(), StrEq(HTTP_CONTENT_TYPE_XTAR), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "")))
+ .RetiresOnSaturation();
+
+ // container_info
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "[]\n")))
+ .RetiresOnSaturation();
+
+ // image_info
+ EXPECT_CALL(*mockRestInterface, request(_, StrEq("GET"), _))
+ .WillOnce(Return(ResponseMessage(ResponseCode::OK, "[]\n")))
+ .RetiresOnSaturation();
+
+ EXPECT_EQ(dockerLauncher->executeCLI("invalid_cmd", container_name), "invalid_cmd command doesn't exists");
+ EXPECT_EQ(dockerLauncher->executeCLI("image_info", container_name), "[]\n");
+ EXPECT_EQ(dockerLauncher->executeCLI("container_info", container_name), "[]\n");
+ EXPECT_EQ(dockerLauncher->executeCLI("build", "invalid_name"), "invalid_name container is not registered");
+ EXPECT_EQ(dockerLauncher->executeCLI("build", container_name), "build command ok");
+ container->image->configs->imagedatafile = TARGET_ROOT + "/opt/data/container/tizen-headed/tizen-init.tar";
+ EXPECT_EQ(dockerLauncher->executeCLI("load", container_name), "load command ok");
+ EXPECT_EQ(dockerLauncher->executeCLI("create", container_name), "create command ok");
+ EXPECT_EQ(dockerLauncher->executeCLI("start", container_name), "start command ok");
+ EXPECT_EQ(dockerLauncher->executeCLI("stop", container_name), "stop command ok");
+ EXPECT_EQ(dockerLauncher->executeCLI("is_running", container_name), container_name + " is not running");
+ EXPECT_EQ(dockerLauncher->executeCLI("is_running", container_name), container_name + " is running");
+ EXPECT_EQ(dockerLauncher->executeCLI("purge", container_name), "purge command ok");
+ EXPECT_EQ(dockerLauncher->executeCLI("update", container_name), "update command failed");
+}
+
+TEST_F(DockerLauncherTest, CLIDaemonTest)
+{
+ int client_len;
+ int client_sockfd;
+ sockaddr_un clientaddr;
+ std::string sockPath(dockerLauncher->cliSocketPath);
+
+ EXPECT_EQ(dockerLauncher->runCLIDaemon(), STATUS_OK);
+ sleep(2);
+ EXPECT_EQ(dockerLauncher->stopCLIDaemon(), STATUS_OK);
+
+ do {
+ client_sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (client_sockfd == -1) {
+ _E("client error !!\n");
+ break;
+ }
+
+ bzero(&clientaddr, sizeof(clientaddr));
+ clientaddr.sun_family = AF_UNIX;
+ strncpy(clientaddr.sun_path, sockPath.c_str(), sockPath.size());
+ client_len = sizeof(clientaddr);
+
+ if (connect(client_sockfd, (struct sockaddr *)&clientaddr, client_len) < 0) {
+ _E("client connect error !!\n");
+ break;
+ }
+
+ char buf_get[4096];
+ std::string msg = " ";
+ ssize_t read_len;
+ Json::Value root;
+
+ root["func"] = "test";
+ root["param"] = "test";
+ msg = JsonTools::writeToString(root);
+
+ if (write(client_sockfd, msg.c_str(), msg.length() + 1) < 0)
+ _E("containers info cmd write fail\n");
+
+ memset(buf_get, 0x00, 4096);
+ read_len = read(client_sockfd, buf_get, 4096 - 1);
+ if (read_len > 0) {
+ //(TODO) print info more readable
+ buf_get[(unsigned int)read_len] = '\0';
+ _D("(SERVER->CLIENT)recv: %s\n", buf_get);
+ }
+ } while (0);
+ dockerLauncher->dockerLaucherCliThread->join();
+ close(client_sockfd);
+}
+
+TEST_F(DockerLauncherTest, finalizeTest)
+{
+ EXPECT_EQ(dockerLauncher->finalize(), STATUS_OK);
+}
diff --git a/test/googletest_approval_main.cpp b/test/googletest_approval_main.cpp
new file mode 100644
index 0000000..1252805
--- /dev/null
+++ b/test/googletest_approval_main.cpp
@@ -0,0 +1,2 @@
+#define APPROVALS_GOOGLETEST
+#include "lib/ApprovalTests.hpp"
diff --git a/test/lib/ApprovalTests.hpp b/test/lib/ApprovalTests.hpp
new file mode 100644
index 0000000..6765570
--- /dev/null
+++ b/test/lib/ApprovalTests.hpp
@@ -0,0 +1 @@
+#include "ApprovalTests.v.10.12.1.hpp"
diff --git a/test/lib/ApprovalTests.v.10.12.1.hpp b/test/lib/ApprovalTests.v.10.12.1.hpp
new file mode 100644
index 0000000..9b63dd0
--- /dev/null
+++ b/test/lib/ApprovalTests.v.10.12.1.hpp
@@ -0,0 +1,6792 @@
+// ApprovalTests.cpp version v.10.12.1
+// More information at: https://github.com/approvals/ApprovalTests.cpp
+//
+// Copyright (c) 2021 Llewellyn Falco and Clare Macrae. All rights reserved.
+//
+// Distributed under the Apache 2.0 License
+// See https://opensource.org/licenses/Apache-2.0
+
+//----------------------------------------------------------------------
+// Welcome to Approval Tests.
+//
+// If you experience linker errors about missing symbols, it means
+// you have forgotten to configure your test framework for Approval Tests.
+//
+// For help with this, please see:
+// https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/TroubleshootingMisconfiguredMain.md
+//----------------------------------------------------------------------
+
+// ******************** From: ApprovalTests.hpp
+#ifndef APPROVAL_TESTS_CPP_APPROVALS_HPP
+#define APPROVAL_TESTS_CPP_APPROVALS_HPP
+
+// This file is machine-generated. Do not edit.
+
+
+// ******************** From: ApprovalTestsVersion.h
+
+#define APPROVAL_TESTS_VERSION_MAJOR 10
+#define APPROVAL_TESTS_VERSION_MINOR 12
+#define APPROVAL_TESTS_VERSION_PATCH 1
+#define APPROVAL_TESTS_VERSION_STR "10.12.1"
+
+#define APPROVAL_TESTS_VERSION \
+ (APPROVAL_TESTS_VERSION_MAJOR * 10000 + APPROVAL_TESTS_VERSION_MINOR * 100 + \
+ APPROVAL_TESTS_VERSION_PATCH)
+
+// ******************** From: Reporter.h
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class Reporter
+ {
+ public:
+ virtual ~Reporter() = default;
+ virtual bool report(std::string received, std::string approved) const = 0;
+ };
+}
+
+// ******************** From: ReporterFactory.h
+
+
+#include <functional>
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace ApprovalTests
+{
+ class ReporterFactory
+ {
+ public:
+ using Reporters =
+ std::map<std::string, std::function<std::unique_ptr<Reporter>()>>;
+
+ ReporterFactory();
+
+ std::vector<std::string> allSupportedReporterNames() const;
+
+ std::unique_ptr<Reporter> createReporter(const std::string& reporterName) const;
+
+ std::string findReporterName(const std::string& osPrefix,
+ const std::string& reporterName) const;
+
+ private:
+ static Reporters createMap();
+
+ Reporters map;
+ };
+}
+
+// ******************** From: DiffInfo.h
+
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace ApprovalTests
+{
+ enum class Type
+ {
+ TEXT,
+ IMAGE,
+ TEXT_AND_IMAGE
+ };
+
+ struct DiffInfo
+ {
+ static std::string receivedFileTemplate();
+
+ static std::string approvedFileTemplate();
+
+ static std::string programFileTemplate();
+
+ static std::string getDefaultArguments();
+
+ DiffInfo(std::string program_, Type type_);
+
+ DiffInfo(std::string program_, std::string arguments_, Type type_);
+
+ std::string program;
+ std::string arguments;
+ Type type;
+
+ static std::vector<std::string> getProgramFileLocations();
+
+ std::string getProgramForOs() const;
+ };
+}
+
+// ******************** From: DiffPrograms.h
+
+
+namespace ApprovalTests
+{
+ namespace DiffPrograms
+ {
+ namespace Mac
+ {
+ DiffInfo DIFF_MERGE();
+
+ DiffInfo ARAXIS_MERGE();
+
+ DiffInfo BEYOND_COMPARE();
+
+ DiffInfo KALEIDOSCOPE();
+
+ DiffInfo SUBLIME_MERGE();
+
+ DiffInfo KDIFF3();
+
+ DiffInfo P4MERGE();
+
+ DiffInfo TK_DIFF();
+
+ DiffInfo VS_CODE();
+
+ DiffInfo CLION();
+ }
+
+ namespace Linux
+ {
+ DiffInfo SUBLIME_MERGE_SNAP();
+
+ DiffInfo SUBLIME_MERGE_FLATPAK();
+
+ DiffInfo SUBLIME_MERGE_REPOSITORY_PACKAGE();
+
+ DiffInfo SUBLIME_MERGE_DIRECT_DOWNLOAD();
+
+ // More ideas available from: https://www.tecmint.com/best-linux-file-diff-tools-comparison/
+ DiffInfo KDIFF3();
+
+ DiffInfo MELD();
+
+ DiffInfo BEYOND_COMPARE();
+ }
+
+ namespace Windows
+ {
+ DiffInfo BEYOND_COMPARE_3();
+
+ DiffInfo BEYOND_COMPARE_4();
+
+ DiffInfo TORTOISE_IMAGE_DIFF();
+
+ DiffInfo TORTOISE_TEXT_DIFF();
+
+ DiffInfo TORTOISE_GIT_IMAGE_DIFF();
+
+ DiffInfo TORTOISE_GIT_TEXT_DIFF();
+
+ DiffInfo WIN_MERGE_REPORTER();
+
+ DiffInfo ARAXIS_MERGE();
+
+ DiffInfo CODE_COMPARE();
+
+ DiffInfo SUBLIME_MERGE();
+
+ DiffInfo KDIFF3();
+
+ DiffInfo VS_CODE();
+ }
+ }
+}
+
+// ******************** From: ConvertForCygwin.h
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class ConvertForCygwin
+ {
+ public:
+ virtual ~ConvertForCygwin() = default;
+
+ virtual std::string convertProgramForCygwin(const std::string& filePath);
+
+ virtual std::string convertFileArgumentForCygwin(const std::string& filePath);
+ };
+
+ class DoNothing : public ConvertForCygwin
+ {
+ public:
+ std::string convertProgramForCygwin(const std::string& filePath) override;
+
+ std::string convertFileArgumentForCygwin(const std::string& filePath) override;
+ };
+}
+
+// ******************** From: CommandLauncher.h
+
+#include <string>
+
+namespace ApprovalTests
+{
+ // An interface to trigger execution of a command. See also SystemLauncher
+ class CommandLauncher
+ {
+ public:
+ virtual ~CommandLauncher() = default;
+ virtual bool launch(const std::string& commandLine) = 0;
+ virtual std::string getCommandLine(const std::string& commandLine) const = 0;
+ };
+}
+
+// ******************** From: CommandReporter.h
+
+#include <utility>
+#include <memory>
+
+namespace ApprovalTests
+{
+ // Generic reporter to launch arbitrary command
+ class CommandReporter : public Reporter
+ {
+ private:
+ std::string cmd;
+ std::string arguments = DiffInfo::getDefaultArguments();
+ CommandLauncher* l;
+ std::shared_ptr<ConvertForCygwin> converter;
+
+ std::string assembleFullCommand(const std::string& received,
+ const std::string& approved) const;
+
+ protected:
+ CommandReporter(std::string command, CommandLauncher* launcher);
+
+ CommandReporter(std::string command, std::string args, CommandLauncher* launcher);
+
+ public:
+ static bool exists(const std::string& command);
+
+ bool report(std::string received, std::string approved) const override;
+
+ std::string getCommandLine(const std::string& received,
+ const std::string& approved) const;
+
+ public:
+ void checkForCygwin();
+
+ // Seam for testing
+ void useCygwinConversions(bool useCygwin);
+ };
+}
+
+// ******************** From: ApprovalsMacroDefaults.h
+
+// This file intentionally left blank.
+
+// ******************** From: Macros.h
+
+
+// Use this in places where we have parameters that are sometimes unused,
+// e.g. because of #if
+// See https://stackoverflow.com/a/1486931/104370
+#define APPROVAL_TESTS_UNUSED(expr) \
+ do \
+ { \
+ (void)(expr); \
+ } while (0)
+
+#if __cplusplus >= 201703L
+#define APPROVAL_TESTS_NO_DISCARD [[nodiscard]]
+#else
+#define APPROVAL_TESTS_NO_DISCARD
+#endif
+
+#if (__cplusplus >= 201402L)
+#define APPROVAL_TESTS_DEPRECATED(text) [[deprecated(text)]]
+#define APPROVAL_TESTS_DEPRECATED_CPP11(text)
+#else
+#define APPROVAL_TESTS_DEPRECATED(text)
+#define APPROVAL_TESTS_DEPRECATED_CPP11(text) \
+ MoreHelpMessages::deprecatedFunctionCalled(text, __FILE__, __LINE__);
+#endif
+
+#define APPROVAL_TESTS_REGISTER_MAIN_DIRECTORY \
+ auto approval_tests_registered_main_directory = \
+ ApprovalTests::TestName::registerRootDirectoryFromMainFile(__FILE__);
+
+// ******************** From: EmptyFileCreatorFactory.h
+
+#include <functional>
+#include <string>
+
+namespace ApprovalTests
+{
+ using EmptyFileCreator = std::function<void(std::string)>;
+
+ class EmptyFileCreatorFactory
+ {
+ public:
+ static void defaultCreator(std::string fullFilePath);
+ static EmptyFileCreator currentCreator;
+ };
+}
+
+// ******************** From: EmptyFileCreatorDisposer.h
+
+
+namespace ApprovalTests
+{
+ class APPROVAL_TESTS_NO_DISCARD EmptyFileCreatorDisposer
+ {
+ private:
+ EmptyFileCreator previous_result;
+
+ public:
+ explicit EmptyFileCreatorDisposer(EmptyFileCreator creator);
+ EmptyFileCreatorDisposer(const EmptyFileCreatorDisposer&) = default;
+
+ ~EmptyFileCreatorDisposer();
+ };
+}
+
+// ******************** From: FileUtils.h
+
+#include <string>
+namespace ApprovalTests
+{
+ class FileUtils
+ {
+ public:
+ static bool fileExists(const std::string& path);
+
+ static int fileSize(const std::string& path);
+
+ static EmptyFileCreatorDisposer useEmptyFileCreator(EmptyFileCreator creator);
+
+ static void ensureFileExists(const std::string& fullFilePath);
+
+ static std::string getDirectory(const std::string& filePath);
+
+ static std::string getExtensionWithDot(const std::string& filePath);
+
+ static std::string readFileThrowIfMissing(const std::string& fileName);
+
+ static std::string readFileReturnEmptyIfMissing(const std::string& fileName);
+
+ static void writeToFile(const std::string& filePath, const std::string& content);
+ };
+}
+
+// ******************** From: WinMinGWUtils.h
+
+#if (defined(__MINGW32__) || defined(__MINGW64__))
+#define APPROVAL_TESTS_MINGW
+#endif
+
+#ifdef APPROVAL_TESTS_MINGW
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <sec_api/stdlib_s.h> /* errno_t, size_t */
+
+ errno_t getenv_s(size_t* ret_required_buf_size,
+ char* buf,
+ size_t buf_size_in_bytes,
+ const char* name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // APPROVAL_TESTS_MINGW
+
+// ******************** From: StringMaker.h
+
+#include <string>
+#include <sstream>
+
+namespace ApprovalTests
+{
+ class StringMaker
+ {
+ public:
+ template <typename T> static std::string toString(const T& contents)
+ {
+ std::stringstream s;
+ s << contents;
+ return s.str();
+ }
+ };
+}
+
+// ******************** From: StringUtils.h
+
+
+
+
+#include <string>
+#include <algorithm>
+#include <sstream>
+
+namespace ApprovalTests
+{
+ class StringUtils
+ {
+ public:
+ static std::string replaceAll(std::string inText,
+ const std::string& find,
+ const std::string& replaceWith);
+
+ static bool contains(const std::string& inText, const std::string& find);
+
+ static std::string toLower(std::string inText);
+
+ static bool beginsWith(std::string value, std::string beginning);
+ static bool endsWith(std::string value, std::string ending);
+
+ template <typename T> static std::string toString(const T& contents)
+ {
+ return StringMaker::toString(contents);
+ }
+
+ static std::string leftTrim(std::string s);
+
+ static std::string rightTrim(std::string s);
+
+ static std::string trim(std::string s);
+ };
+}
+
+// ******************** From: SystemUtils.h
+
+#ifdef _WIN32
+// ReSharper disable once CppUnusedIncludeDirective
+#include <io.h>
+#include <direct.h>
+#else
+// ReSharper disable once CppUnusedIncludeDirective
+#include <unistd.h>
+#endif
+
+
+#include <stdexcept>
+
+namespace ApprovalTests
+{
+ class SystemUtils
+ {
+ public:
+ static bool isWindowsOs();
+
+ static bool isCygwin();
+
+ static bool isMacOs();
+
+ static std::string getDirectorySeparator();
+
+ // Properly cases the filename, but not the directories, on Windows.
+ static std::string checkFilenameCase(const std::string& fullPath);
+
+ static std::string safeGetEnvForWindows(char const* name);
+
+ static std::string safeGetEnvForNonWindows(char const* name);
+
+ //! Return the value of the environment variable, or an empty string if the variable is not set.
+ static std::string safeGetEnv(char const* name);
+
+ static std::string getMachineName();
+
+ static void makeDirectoryForWindows(const std::string& directory);
+
+ static void makeDirectoryForNonWindows(const std::string& directory);
+
+ static void makeDirectory(const std::string& directory);
+
+ static void ensureDirectoryExists(const std::string& fullDirectoryPath);
+
+ static void ensureParentDirectoryExists(const std::string& fullFilePath);
+
+ static void runSystemCommandOrThrow(const std::string& command,
+ bool allowNonZeroExitCodes = false);
+ };
+}
+
+// ******************** From: SystemLauncher.h
+
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class SystemLauncher : public CommandLauncher
+ {
+ private:
+ bool useWindows_ = SystemUtils::isWindowsOs();
+ bool isForeground_ = false;
+ bool allowNonZeroExitCodes_ = false;
+
+ public:
+ explicit SystemLauncher(bool isForeground = false,
+ bool allowNonZeroExitCodes = false);
+
+ bool launch(const std::string& commandLine) override;
+
+ // Seam for testing
+ void invokeForWindows(bool useWindows);
+
+ void setForeground(bool foreground);
+
+ void setAllowNonZeroExitCodes(bool allow);
+
+ bool isForeground() const;
+
+ std::string getCommandLine(const std::string& commandLine) const override;
+
+ std::string getWindowsCommandLine(const std::string& commandLine,
+ bool foreground) const;
+
+ std::string getUnixCommandLine(const std::string& commandLine,
+ bool foreground) const;
+ };
+}
+
+// ******************** From: GenericDiffReporter.h
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class GenericDiffReporter : public CommandReporter
+ {
+ public:
+ SystemLauncher launcher;
+
+ public:
+ explicit GenericDiffReporter(const std::string& program);
+
+ explicit GenericDiffReporter(const DiffInfo& info);
+ };
+}
+
+// ******************** From: QuietReporter.h
+
+
+namespace ApprovalTests
+{
+ // A reporter that does nothing. Failing tests will still fail, but nothing will be launched.
+ class QuietReporter : public Reporter
+ {
+ public:
+ bool report(std::string /*received*/, std::string /*approved*/) const override;
+ };
+}
+
+// ******************** From: TextDiffReporter.h
+
+
+#include <memory>
+#include <iosfwd>
+
+namespace ApprovalTests
+{
+ // A Reporter class that only uses text-based diff tools, with output written
+ // to the console. It provides no opportunity for interactive approving
+ // of files.
+ // It currently has a short, hard-coded list of diffing tools.
+ class TextDiffReporter : public Reporter
+ {
+ private:
+ std::unique_ptr<Reporter> m_reporter;
+ std::ostream& stream_;
+
+ public:
+ TextDiffReporter();
+ explicit TextDiffReporter(std::ostream& stream);
+
+ bool report(std::string received, std::string approved) const override;
+ };
+} // namespace ApprovalTests
+
+// ******************** From: Blocker.h
+
+namespace ApprovalTests
+{
+ class Blocker
+ {
+ public:
+ Blocker() = default;
+ Blocker(const Blocker&) = default;
+ Blocker(Blocker&&) = default;
+ Blocker& operator=(const Blocker&) = default;
+ Blocker& operator=(Blocker&&) = default;
+
+ virtual ~Blocker() = default;
+
+ virtual bool isBlockingOnThisMachine() const = 0;
+ };
+}
+
+// ******************** From: MachineBlocker.h
+
+#include <utility>
+
+namespace ApprovalTests
+{
+ class MachineBlocker : public Blocker
+ {
+ private:
+ std::string machineName;
+ bool block;
+
+ MachineBlocker() = delete;
+
+ public:
+ MachineBlocker(std::string machineName_, bool block_);
+
+ static MachineBlocker onMachineNamed(const std::string& machineName);
+
+ static MachineBlocker onMachinesNotNamed(const std::string& machineName);
+
+ virtual bool isBlockingOnThisMachine() const override;
+ };
+}
+
+// ******************** From: AutoApproveReporter.h
+
+
+namespace ApprovalTests
+{
+ class AutoApproveReporter : public Reporter
+ {
+ public:
+ bool report(std::string received, std::string approved) const override;
+ };
+}
+
+// ******************** From: Path.h
+
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class Path
+ {
+ std::string path_;
+ std::string separator_ = SystemUtils::getDirectorySeparator();
+
+ public:
+ Path(const std::string& start);
+
+ std::string toString() const;
+ std::string toString(const std::string& directoryPathSeparator) const;
+
+ Path operator+(const std::string& addition) const;
+ Path operator/(const std::string& addition) const;
+ Path operator/(const Path addition) const;
+
+ static std::string normalizeSeparators(const std::string& path);
+ std::string removeRedundantDirectorySeparators(std::string path) const;
+ };
+}
+
+// ******************** From: ApprovalNamer.h
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class ApprovalNamer
+ {
+ public:
+ virtual ~ApprovalNamer() = default;
+ virtual std::string getApprovedFile(std::string extensionWithDot) const = 0;
+ virtual std::string getReceivedFile(std::string extensionWithDot) const = 0;
+ };
+}
+
+// ******************** From: ApprovalTestNamer.h
+
+#include <vector>
+#include <stdexcept>
+
+namespace ApprovalTests
+{
+ class TestName
+ {
+ public:
+ const std::string& getFileName() const;
+ std::string getOriginalFileName();
+
+ void setFileName(const std::string& file);
+
+ private:
+ static void checkBuildConfiguration(const std::string& fileName);
+
+ public:
+ static std::string getMisconfiguredBuildHelp(const std::string& fileName);
+ static std::string checkParentDirectoriesForFile(const std::string& file);
+ static bool registerRootDirectoryFromMainFile(const std::string& file);
+ static std::string getRootDirectory();
+
+ std::vector<std::string> sections;
+ static std::string directoryPrefix;
+ static bool checkBuildConfig_;
+
+ private:
+ std::string handleBoostQuirks() const;
+ std::string findFileName(const std::string& file);
+ static std::string& rootDirectoryStorage();
+
+ std::string fileName;
+ std::string originalFileName;
+ };
+
+ class TestConfiguration
+ {
+ public:
+ std::string subdirectory;
+ };
+
+ class ApprovalTestNamer : public ApprovalNamer
+ {
+ private:
+ public:
+ ApprovalTestNamer() = default;
+
+ std::string getTestName() const;
+
+ static std::string convertToFileName(const std::string& fileName);
+
+ static TestName& getCurrentTest();
+
+ static std::string getMisconfiguredMainHelp();
+
+ // Deprecated - please use getSourceFileName
+ std::string getFileName() const;
+
+ std::string getSourceFileName() const;
+
+ std::string getTestSourceDirectory() const;
+
+ std::string getRelativeTestSourceDirectory() const;
+
+ std::string getApprovalsSubdirectory() const;
+
+ std::string getDirectory() const;
+
+ static TestName& currentTest(TestName* value = nullptr);
+
+ static TestConfiguration& testConfiguration();
+
+ virtual std::string getApprovedFile(std::string extensionWithDot) const override;
+
+ virtual std::string getReceivedFile(std::string extensionWithDot) const override;
+
+ std::string getOutputFileBaseName() const;
+
+ std::string getFullFileName(const std::string& approved,
+ const std::string& extensionWithDot) const;
+
+ static bool setCheckBuildConfig(bool enabled);
+ };
+}
+
+// ******************** From: SectionNameDisposer.h
+
+
+namespace ApprovalTests
+{
+ class APPROVAL_TESTS_NO_DISCARD SectionNameDisposer
+ {
+ public:
+ SectionNameDisposer(TestName& currentTest_, const std::string& scope_name);
+ SectionNameDisposer(const SectionNameDisposer&) = default;
+
+ ~SectionNameDisposer();
+
+ private:
+ TestName& currentTest;
+ };
+}
+
+// ******************** From: NamerFactory.h
+
+
+#include <string>
+
+namespace ApprovalTests
+{
+ struct NamerFactory
+ {
+ static SectionNameDisposer appendToOutputFilename(const std::string& sectionName);
+ };
+}
+
+// ******************** From: ApprovalUtils.h
+
+#include <iosfwd>
+#include <string>
+
+namespace ApprovalTests
+{
+ class ApprovalUtils
+ {
+ public:
+ static void writeHeader(std::ostream& stream, const std::string& header);
+ };
+}
+
+// ******************** From: ApprovalComparator.h
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class ApprovalComparator
+ {
+ public:
+ virtual ~ApprovalComparator() = default;
+
+ virtual bool contentsAreEquivalent(std::string receivedPath,
+ std::string approvedPath) const = 0;
+ };
+}
+
+// ******************** From: ComparatorDisposer.h
+
+#include <map>
+#include <memory>
+#include <utility>
+
+namespace ApprovalTests
+{
+
+ using ComparatorContainer =
+ std::map<std::string, std::shared_ptr<ApprovalComparator>>;
+
+ class APPROVAL_TESTS_NO_DISCARD ComparatorDisposer
+ {
+ public:
+ ComparatorDisposer(
+ ComparatorContainer& comparators_,
+ const std::string& extensionWithDot,
+ std::shared_ptr<ApprovalTests::ApprovalComparator> previousComparator_,
+ std::shared_ptr<ApprovalTests::ApprovalComparator> newComparator);
+
+ ComparatorDisposer(const ComparatorDisposer&) = delete;
+
+ ComparatorDisposer(ComparatorDisposer&& other) noexcept;
+
+ ~ComparatorDisposer();
+
+ private:
+ // A disposer becomes inactive when it is moved from.
+ // This is done to prevent a comparator from being disposed twice.
+ bool isActive = true;
+ ComparatorContainer& comparators;
+ std::string ext_;
+ std::shared_ptr<ApprovalTests::ApprovalComparator> previousComparator;
+ };
+}
+
+// ******************** From: ComparatorFactory.h
+
+#include <memory>
+
+namespace ApprovalTests
+{
+
+ class ComparatorFactory
+ {
+ private:
+ static ComparatorContainer& comparators();
+
+ public:
+ static ComparatorDisposer
+ registerComparator(const std::string& extensionWithDot,
+ std::shared_ptr<ApprovalComparator> comparator);
+
+ static std::shared_ptr<ApprovalComparator>
+ getComparatorForFile(const std::string& receivedPath);
+
+ static std::shared_ptr<ApprovalComparator>
+ getComparatorForFileExtensionWithDot(const std::string& fileExtensionWithDot);
+ };
+}
+
+// ******************** From: ApprovalWriter.h
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class ApprovalWriter
+ {
+ public:
+ virtual ~ApprovalWriter() = default;
+ virtual std::string getFileExtensionWithDot() const = 0;
+ virtual void write(std::string path) const = 0;
+ virtual void cleanUpReceived(std::string receivedPath) const = 0;
+ };
+}
+
+// ******************** From: StringWriter.h
+
+
+namespace ApprovalTests
+{
+ class StringWriter : public ApprovalWriter
+ {
+ private:
+ std::string s;
+ std::string ext;
+
+ public:
+ explicit StringWriter(std::string contents,
+ std::string fileExtensionWithDot = ".txt");
+
+ std::string getFileExtensionWithDot() const override;
+
+ void write(std::string path) const override;
+
+ void Write(std::ostream& out) const;
+
+ virtual void cleanUpReceived(std::string receivedPath) const override;
+ };
+}
+
+// ******************** From: FileApprover.h
+
+
+#include <memory>
+#include <functional>
+
+namespace ApprovalTests
+{
+ class FileApprover
+ {
+
+ public:
+ FileApprover() = default;
+
+ ~FileApprover() = default;
+
+ /*! \brief Register a custom comparater, which will be used to compare approved
+ * and received files with the given extension.
+ *
+ * @param extensionWithDot A file extention, such as ".jpg"
+ * @param comparator <tt>std::shared_ptr</tt> to a ApprovalTests::ApprovalComparator
+ * instance
+ * @return A "Disposable" object. The caller should hold on to this object.
+ * When it is destroyed, the customisation will be reversed.
+ *
+ * \see For more information, see
+ * \userguide{CustomComparators,Custom Comparators}
+ */
+ static ComparatorDisposer
+ registerComparatorForExtension(const std::string& extensionWithDot,
+ std::shared_ptr<ApprovalComparator> comparator);
+
+ //! This overload is an implementation detail. To add a new comparator, use registerComparatorForExtension().
+ static void verify(const std::string& receivedPath,
+ const std::string& approvedPath,
+ const ApprovalComparator& comparator);
+
+ static void verify(const std::string& receivedPath,
+ const std::string& approvedPath);
+
+ static void
+ verify(const ApprovalNamer& n, const ApprovalWriter& s, const Reporter& r);
+
+ static void reportAfterTryingFrontLoadedReporter(const std::string& receivedPath,
+ const std::string& approvedPath,
+ const Reporter& r);
+
+ using TestPassedNotification = std::function<void()>;
+ static void setTestPassedNotification(TestPassedNotification notification);
+ static void notifyTestPassed();
+
+ private:
+ static TestPassedNotification testPassedNotification_;
+ };
+}
+
+// ******************** From: FmtToString.h
+#ifdef FMT_VERSION
+namespace ApprovalTests
+{
+ class FmtToString
+ {
+ public:
+ template <typename T> static std::string toString(const T& printable)
+ {
+ (void)printable;
+ return fmt::to_string(printable);
+ }
+ };
+
+}
+#endif
+
+// ******************** From: FileNameSanitizerFactory.h
+#include <functional>
+
+namespace ApprovalTests
+{
+ using FileNameSanitizer = std::function<std::string(std::string)>;
+
+ class FileNameSanitizerFactory
+ {
+ public:
+ static bool isForbidden(char c);
+ static std::string defaultSanitizer(std::string fileName);
+ static FileNameSanitizer currentSanitizer;
+ };
+}
+
+// ******************** From: FileNameSanitizerDisposer.h
+
+
+namespace ApprovalTests
+{
+ class APPROVAL_TESTS_NO_DISCARD FileNameSanitizerDisposer
+ {
+ private:
+ FileNameSanitizer previous_result;
+
+ public:
+ explicit FileNameSanitizerDisposer(FileNameSanitizer sanitizer);
+ FileNameSanitizerDisposer(const FileNameSanitizerDisposer&) = default;
+
+ ~FileNameSanitizerDisposer();
+ };
+}
+
+// ******************** From: SubdirectoryDisposer.h
+
+
+#include <string>
+
+namespace ApprovalTests
+{
+ //! Implementation detail of Approvals::useApprovalsSubdirectory()
+ class APPROVAL_TESTS_NO_DISCARD SubdirectoryDisposer
+ {
+ private:
+ std::string previous_result;
+
+ public:
+ explicit SubdirectoryDisposer(std::string subdirectory);
+ SubdirectoryDisposer(const SubdirectoryDisposer&) = default;
+
+ ~SubdirectoryDisposer();
+ };
+}
+
+// ******************** From: DefaultReporterFactory.h
+
+
+#include <memory>
+
+namespace ApprovalTests
+{
+ //! Implementation detail of Approvals::useAsDefaultReporter()
+ class DefaultReporterFactory
+ {
+ private:
+ static std::shared_ptr<Reporter>& defaultReporter();
+
+ public:
+ static std::shared_ptr<Reporter> getDefaultReporter();
+
+ static void setDefaultReporter(const std::shared_ptr<Reporter>& reporter);
+ };
+}
+
+// ******************** From: DefaultReporterDisposer.h
+
+
+namespace ApprovalTests
+{
+ //! Implementation detail of Approvals::useAsDefaultReporter()
+ class APPROVAL_TESTS_NO_DISCARD DefaultReporterDisposer
+ {
+ private:
+ std::shared_ptr<Reporter> previous_result;
+
+ public:
+ explicit DefaultReporterDisposer(const std::shared_ptr<Reporter>& reporter);
+
+ ~DefaultReporterDisposer();
+ };
+}
+
+// ******************** From: FirstWorkingReporter.h
+
+#include <memory>
+#include <vector>
+
+namespace ApprovalTests
+{
+ class FirstWorkingReporter : public Reporter
+ {
+ private:
+ std::vector<std::shared_ptr<Reporter>> reporters;
+
+ public:
+ // Note that FirstWorkingReporter takes ownership of the given Reporter objects
+ explicit FirstWorkingReporter(const std::vector<Reporter*>& theReporters);
+
+ explicit FirstWorkingReporter(
+ const std::vector<std::shared_ptr<Reporter>>& reporters_);
+
+ bool report(std::string received, std::string approved) const override;
+ };
+}
+
+// ******************** From: DefaultFrontLoadedReporter.h
+
+
+namespace ApprovalTests
+{
+ class DefaultFrontLoadedReporter : public FirstWorkingReporter
+ {
+ public:
+ DefaultFrontLoadedReporter();
+ };
+}
+
+// ******************** From: FrontLoadedReporterFactory.h
+
+
+#include <memory>
+
+namespace ApprovalTests
+{
+ //! Implementation detail of Approvals::useAsFrontLoadedReporter()
+ class FrontLoadedReporterFactory
+ {
+ static std::shared_ptr<Reporter>& frontLoadedReporter();
+
+ public:
+ static std::shared_ptr<Reporter> getFrontLoadedReporter();
+
+ static void setFrontLoadedReporter(const std::shared_ptr<Reporter>& reporter);
+ };
+}
+
+// ******************** From: FrontLoadedReporterDisposer.h
+
+
+namespace ApprovalTests
+{
+ //! Implementation detail of Approvals::useAsFrontLoadedReporter()
+ class APPROVAL_TESTS_NO_DISCARD FrontLoadedReporterDisposer
+ {
+ private:
+ std::shared_ptr<Reporter> previous_result;
+
+ public:
+ explicit FrontLoadedReporterDisposer(const std::shared_ptr<Reporter>& reporter);
+ FrontLoadedReporterDisposer(const FrontLoadedReporterDisposer&) = default;
+
+ ~FrontLoadedReporterDisposer();
+ };
+}
+
+// ******************** From: Scrubbers.h
+
+#include <string>
+#include <functional>
+#include <regex>
+
+namespace ApprovalTests
+{
+ using Scrubber = std::function<std::string(const std::string&)>;
+ namespace Scrubbers
+ {
+ std::string doNothing(const std::string& input);
+
+ /**@name Regex-based scrubbers
+
+ See \userguide{how_tos/ScrubNonDeterministicOutput,regular-expressions-regex,Regular Expressions (regex)}
+ */
+ ///@{
+ using RegexMatch = std::sub_match<std::string::const_iterator>;
+ using RegexReplacer = std::function<std::string(const RegexMatch&)>;
+
+ std::string scrubRegex(const std::string& input,
+ const std::regex& regex,
+ const RegexReplacer& replaceFunction);
+
+ Scrubber createRegexScrubber(const std::regex& regexPattern,
+ const RegexReplacer& replacer);
+
+ Scrubber createRegexScrubber(const std::regex& regexPattern,
+ const std::string& replacementText);
+
+ Scrubber createRegexScrubber(const std::string& regexString,
+ const std::string& replacementText);
+ ///@}
+
+ std::string scrubGuid(const std::string& input);
+ }
+}
+
+// ******************** From: DefaultNamerFactory.h
+
+
+#include <memory>
+#include <functional>
+
+namespace ApprovalTests
+{
+
+ using NamerCreator = std::function<std::shared_ptr<ApprovalNamer>()>;
+
+ //! Implementation detail of Approvals::useAsDefaultNamer()
+ class DefaultNamerFactory
+ {
+ private:
+ static NamerCreator& defaultNamer();
+
+ public:
+ static NamerCreator getDefaultNamer();
+
+ static void setDefaultNamer(NamerCreator namer);
+ };
+}
+
+// ******************** From: Options.h
+
+#include <utility>
+#include <exception>
+
+
+namespace ApprovalTests
+{
+ class Options
+ {
+ public:
+ class FileOptions
+ {
+ const Options* options_ = nullptr; // set in Options::fileOptions()
+ std::string fileExtensionWithDot_ = ".txt";
+ friend class Options;
+
+ FileOptions() = default;
+
+ explicit FileOptions(std::string fileExtensionWithDot);
+
+ APPROVAL_TESTS_NO_DISCARD
+ FileOptions clone() const;
+
+ public:
+ APPROVAL_TESTS_NO_DISCARD
+ const std::string& getFileExtension() const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ Options withFileExtension(const std::string& fileExtensionWithDot) const;
+ };
+
+ private:
+ FileOptions fileOptions_;
+ Scrubber scrubber_ = Scrubbers::doNothing;
+ const Reporter& reporter_ = defaultReporter();
+ std::shared_ptr<ApprovalNamer> namer_ = DefaultNamerFactory::getDefaultNamer()();
+ bool usingDefaultScrubber_ = true;
+
+ Options(FileOptions fileOptions,
+ Scrubber scrubber,
+ const Reporter& reporter,
+ bool usingDefaultScrubber,
+ std::shared_ptr<ApprovalNamer> namer);
+
+ APPROVAL_TESTS_NO_DISCARD
+ Options clone(const FileOptions& fileOptions) const;
+
+ static const Reporter& defaultReporter();
+
+ public:
+ Options() = default;
+
+ explicit Options(Scrubber scrubber);
+
+ explicit Options(const Reporter& reporter);
+
+ APPROVAL_TESTS_NO_DISCARD
+ FileOptions fileOptions() const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ Scrubber getScrubber() const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ bool isUsingDefaultScrubber() const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ std::string scrub(const std::string& input) const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ const Reporter& getReporter() const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ Options withReporter(const Reporter& reporter) const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ Options withScrubber(Scrubber scrubber) const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ std::shared_ptr<ApprovalNamer> getNamer() const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ Options withNamer(std::shared_ptr<ApprovalNamer> namer);
+ };
+
+ namespace Detail
+ {
+ //! Helper to prevent compilation failure when types are wrongly treated as Option
+ // or Reporter:
+ template <typename T, typename R = void>
+ using EnableIfNotOptionsOrReporter = typename std::enable_if<
+ (!std::is_same<Options, typename std::decay<T>::type>::value) &&
+ (!std::is_base_of<Reporter, typename std::decay<T>::type>::value),
+ R>::type;
+
+ //! Helper to prevent compilation failure when types are wrongly treated as Option,
+ // Reporter or String:
+ template <typename T, typename R = void>
+ using EnableIfNotOptionsOrReporterOrString = typename std::enable_if<
+ (!std::is_same<Options, typename std::decay<T>::type>::value) &&
+ (!std::is_same<std::string, typename std::decay<T>::type>::value) &&
+ (!std::is_same<char*, typename std::decay<T>::type>::value) &&
+ (!std::is_same<const char*, typename std::decay<T>::type>::value) &&
+ (!std::is_base_of<Reporter, typename std::decay<T>::type>::value),
+ R>::type;
+ } // namespace Detail
+}
+
+// ******************** From: ExistingFileNamer.h
+
+#include <utility>
+
+namespace ApprovalTests
+{
+ class ExistingFileNamer : public ApprovalNamer
+ {
+ std::string filePath;
+ const Options& options_;
+
+ public:
+ explicit ExistingFileNamer(std::string filePath_, const Options& options);
+
+ virtual std::string getApprovedFile(std::string extensionWithDot) const override;
+
+ virtual std::string
+ getReceivedFile(std::string /*extensionWithDot*/) const override;
+ };
+}
+
+// ******************** From: ExistingFile.h
+
+#include <utility>
+
+namespace ApprovalTests
+{
+ class ExistingFile : public ApprovalWriter
+ {
+ std::string filePath;
+ bool deleteScrubbedFile = false;
+ const Options& options_;
+
+ std::string scrub(std::string fileName, const Options& options);
+
+ public:
+ explicit ExistingFile(std::string filePath_, const Options& options);
+ virtual std::string getFileExtensionWithDot() const override;
+ virtual void write(std::string /*path*/) const override;
+ virtual void cleanUpReceived(std::string receivedPath) const override;
+ ExistingFileNamer getNamer();
+ };
+}
+
+// ******************** From: DefaultNamerDisposer.h
+
+
+namespace ApprovalTests
+{
+ //! Implementation detail of Approvals::useAsDefaultNamer()
+ class APPROVAL_TESTS_NO_DISCARD DefaultNamerDisposer
+ {
+ private:
+ NamerCreator previous_result;
+
+ public:
+ explicit DefaultNamerDisposer(NamerCreator namerCreator);
+ DefaultNamerDisposer(const DefaultNamerDisposer&) = default;
+
+ ~DefaultNamerDisposer();
+ };
+}
+
+// ******************** From: Approvals.h
+#include <string>
+#include <functional>
+#include <exception>
+#include <utility>
+
+
+namespace ApprovalTests
+{
+
+ // TCompileTimeOptions must have a type ToStringConverter, which must have a method toString()
+ template <typename TCompileTimeOptions> class TApprovals
+ {
+ private:
+ TApprovals() = default;
+
+ ~TApprovals() = default;
+
+ public:
+ static std::shared_ptr<ApprovalNamer> getDefaultNamer()
+ {
+ return DefaultNamerFactory::getDefaultNamer()();
+ }
+
+ template <typename T>
+ using IsNotDerivedFromWriter =
+ typename std::enable_if<!std::is_base_of<ApprovalWriter, T>::value,
+ int>::type;
+
+ /**@name Verifying single objects
+
+ See \userguide{TestingSingleObjects,Testing Single Objects}
+ */
+ ///@{
+ static void verify(const std::string& contents,
+ const Options& options = Options())
+ {
+ StringWriter writer(options.scrub(contents),
+ options.fileOptions().getFileExtension());
+ FileApprover::verify(*options.getNamer(), writer, options.getReporter());
+ }
+
+ template <typename T, typename = IsNotDerivedFromWriter<T>>
+ static void verify(const T& contents, const Options& options = Options())
+ {
+ verify(TCompileTimeOptions::ToStringConverter::toString(contents), options);
+ }
+
+ template <typename T,
+ typename Function,
+ typename = Detail::EnableIfNotOptionsOrReporter<Function>>
+ static void
+ verify(const T& contents, Function converter, const Options& options = Options())
+ {
+ std::stringstream s;
+ converter(contents, s);
+ verify(s.str(), options);
+ }
+
+ /// Note that this overload ignores any scrubber in options
+ static void verify(const ApprovalWriter& writer,
+ const Options& options = Options())
+ {
+ FileApprover::verify(*options.getNamer(), writer, options.getReporter());
+ }
+ ///@}
+
+ /**@name Verifying containers of objects - supplying an iterator range
+
+ See \userguide{TestingContainers,Testing Containers}
+ */
+ ///@{
+ template <typename Iterator>
+ static void
+ verifyAll(const std::string& header,
+ const Iterator& start,
+ const Iterator& finish,
+ std::function<void(decltype(*start), std::ostream&)> converter,
+ const Options& options = Options())
+ {
+ std::stringstream s;
+ ApprovalUtils::writeHeader(s, header);
+ for (auto it = start; it != finish; ++it)
+ {
+ converter(*it, s);
+ s << '\n';
+ }
+ verify(s.str(), options);
+ }
+ ///@}
+
+ /**@name Verifying containers of objects - supplying a container
+
+ See \userguide{TestingContainers,Testing Containers}
+ */
+ ///@{
+ template <typename Container>
+ static void verifyAll(
+ const std::string& header,
+ const Container& list,
+ std::function<void(typename Container::value_type, std::ostream&)> converter,
+ const Options& options = Options())
+ {
+ verifyAll<typename Container::const_iterator>(
+ header, list.begin(), list.end(), converter, options);
+ }
+
+ template <typename Container>
+ static void verifyAll(const std::string& header,
+ const Container& list,
+ const Options& options = Options())
+ {
+ int i = 0;
+ verifyAll<Container>(
+ header,
+ list,
+ [&](typename Container::value_type e, std::ostream& s) {
+ s << "[" << i++
+ << "] = " << TCompileTimeOptions::ToStringConverter::toString(e);
+ },
+ options);
+ }
+
+ template <typename Container>
+ static void verifyAll(const Container& list, const Options& options = Options())
+ {
+ verifyAll<Container>("", list, options);
+ }
+ ///@}
+
+ /**@name Verifying containers of objects - supplying an initializer list
+
+ See \userguide{TestingContainers,Testing Containers}
+ */
+ ///@{
+ template <typename T>
+ static void
+ verifyAll(const std::string& header,
+ const std::initializer_list<T>& list,
+ std::function<void(typename std::initializer_list<T>::value_type,
+ std::ostream&)> converter,
+ const Options& options = Options())
+ {
+ verifyAll<std::initializer_list<T>>(header, list, converter, options);
+ }
+
+ template <typename T>
+ static void verifyAll(const std::string& header,
+ const std::initializer_list<T>& list,
+ const Options& options = Options())
+ {
+ verifyAll<std::initializer_list<T>>(header, list, options);
+ }
+
+ template <typename T>
+ static void verifyAll(const std::initializer_list<T>& list,
+ const Options& options = Options())
+ {
+ verifyAll<std::initializer_list<T>>("", list, options);
+ }
+ ///@}
+
+ /**@name Other verify methods
+ */
+ ///@{
+
+ /*! \brief Verify the text of an exception
+
+ See \userguide{TestingExceptions,testing-exception-messages,Testing exception messages}
+ */
+ static void
+ verifyExceptionMessage(const std::function<void(void)>& functionThatThrows,
+ const Options& options = Options())
+ {
+ std::string message = "*** no exception thrown ***";
+ try
+ {
+ functionThatThrows();
+ }
+ catch (const std::exception& e)
+ {
+ message = e.what();
+ }
+ verify(message, options);
+ }
+
+ /// Verify an existing file, that has already been written out
+ static void verifyExistingFile(const std::string& filePath,
+ const Options& options = Options())
+ {
+ ExistingFile writer(filePath, options);
+ FileApprover::verify(writer.getNamer(), writer, options.getReporter());
+ }
+ ///@}
+
+ /**@name Customising Approval Tests
+
+ These static methods customise various aspects
+ of Approval Tests behaviour.
+ */
+ ///@{
+
+ /// See \userguide{Configuration,using-sub-directories-for-approved-files,Using sub-directories for approved files}
+ static SubdirectoryDisposer
+ useApprovalsSubdirectory(const std::string& subdirectory = "approval_tests")
+ {
+ return SubdirectoryDisposer(subdirectory);
+ }
+
+ /// See \userguide{Reporters,registering-a-default-reporter,Registering a default reporter}
+ static DefaultReporterDisposer
+ useAsDefaultReporter(const std::shared_ptr<Reporter>& reporter)
+ {
+ return DefaultReporterDisposer(reporter);
+ }
+
+ /// See \userguide{Reporters,front-loaded-reporters,Front Loaded Reporters}
+ static FrontLoadedReporterDisposer
+ useAsFrontLoadedReporter(const std::shared_ptr<Reporter>& reporter)
+ {
+ return FrontLoadedReporterDisposer(reporter);
+ }
+
+ /// See \userguide{Namers,registering-a-custom-namer,Registering a Custom Namer}
+ static DefaultNamerDisposer useAsDefaultNamer(NamerCreator namerCreator)
+ {
+ return DefaultNamerDisposer(std::move(namerCreator));
+ }
+
+ /// See \userguide{Namers,converting-test-names-to-valid-filenames,Converting Test Names to Valid FileNames}
+ static FileNameSanitizerDisposer useFileNameSanitizer(FileNameSanitizer sanitizer)
+ {
+ return FileNameSanitizerDisposer(sanitizer);
+ }
+ ///@}
+ };
+
+#ifndef APPROVAL_TESTS_DEFAULT_STREAM_CONVERTER
+#define APPROVAL_TESTS_DEFAULT_STREAM_CONVERTER StringMaker
+#endif
+
+ // Warning: Do not use CompileTimeOptions directly.
+ // This interface is subject to change, as future
+ // compile-time options are added.
+ template <typename TToString> struct CompileTimeOptions
+ {
+ using ToStringConverter = TToString;
+ // more template types may be added to CompileTimeOptions in future, if we add
+ // more flexibility that requires compile-time configuration.
+ };
+
+ // Template parameter TToString must have a method toString()
+ // This interface will not change, as future compile-time options are added.
+ template <typename TToString>
+ struct ToStringCompileTimeOptions : CompileTimeOptions<TToString>
+ {
+ };
+
+ using Approvals =
+ TApprovals<ToStringCompileTimeOptions<APPROVAL_TESTS_DEFAULT_STREAM_CONVERTER>>;
+}
+
+// ******************** From: TemplatedCustomNamer.h
+
+
+namespace ApprovalTests
+{
+ class TemplatedCustomNamer : public ApprovalTests::ApprovalNamer
+ {
+ private:
+ ApprovalTests::ApprovalTestNamer namer_;
+ std::string template_;
+
+ public:
+ explicit TemplatedCustomNamer(std::string templateString);
+
+ APPROVAL_TESTS_NO_DISCARD
+ Path constructFromTemplate(const std::string& extensionWithDot,
+ const std::string& approvedOrReceived) const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ std::string getApprovedFile(std::string extensionWithDot) const override;
+
+ APPROVAL_TESTS_NO_DISCARD
+ std::string getReceivedFile(std::string extensionWithDot) const override;
+
+ APPROVAL_TESTS_NO_DISCARD
+ Path getApprovedFileAsPath(std::string extensionWithDot) const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ Path getReceivedFileAsPath(std::string extensionWithDot) const;
+
+ APPROVAL_TESTS_NO_DISCARD
+ static std::shared_ptr<TemplatedCustomNamer> create(std::string templateString);
+
+ APPROVAL_TESTS_NO_DISCARD
+ static DefaultNamerDisposer useAsDefaultNamer(std::string templateString);
+ };
+}
+
+// ******************** From: GoogleCustomizationsFactory.h
+
+
+#include <vector>
+#include <functional>
+#include <string>
+
+namespace ApprovalTests
+{
+ class GoogleCustomizationsFactory
+ {
+ public:
+ using Comparator = std::function<bool(const std::string&, const std::string&)>;
+
+ private:
+ using ComparatorContainer = std::vector<Comparator>;
+ static ComparatorContainer& comparatorContainer();
+
+ public:
+ static ComparatorContainer getEquivalencyChecks();
+
+ APPROVAL_TESTS_NO_DISCARD static bool
+ addTestCaseNameRedundancyCheck(const Comparator& comparator);
+ };
+}
+
+// ******************** From: MoreHelpMessages.h
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class MoreHelpMessages
+ {
+ public:
+ static void deprecatedFunctionCalled(const std::string& message,
+ const std::string& file,
+ int lineNumber);
+ };
+}
+
+// ******************** From: CartesianProduct.h
+
+#include <functional>
+#include <tuple>
+#include <type_traits>
+#include <utility>
+#include <vector>
+
+namespace ApprovalTests
+{
+ namespace CartesianProduct
+ {
+ namespace Detail
+ {
+
+ // C++14 compatibility
+ // See https://en.cppreference.com/w/cpp/types/enable_if
+ template <bool B, class T = void>
+ using enable_if_t = typename std::enable_if<B, T>::type;
+
+ // See https://en.cppreference.com/w/cpp/utility/integer_sequence
+ template <std::size_t... Is> struct index_sequence
+ {
+ };
+
+ template <std::size_t N, std::size_t... Is>
+ struct make_index_sequence : make_index_sequence<N - 1, N - 1, Is...>
+ {
+ };
+
+ template <std::size_t... Is>
+ struct make_index_sequence<0, Is...> : index_sequence<Is...>
+ {
+ };
+ // End of C++14 compatibility
+
+ // Return the size of a tuple - constexpr for use as a template argument
+ // See https://en.cppreference.com/w/cpp/utility/tuple/tuple_size
+ template <class Tuple> constexpr std::size_t tuple_size()
+ {
+ return std::tuple_size<
+ typename std::remove_reference<Tuple>::type>::value;
+ }
+
+ template <class Tuple>
+ using make_tuple_idxs = make_index_sequence<tuple_size<Tuple>()>;
+
+ // C++17 compatibility
+ // See https://en.cppreference.com/w/cpp/utility/apply
+ template <class F, class Tuple, std::size_t... I>
+ constexpr auto apply_impl(F&& f, Tuple&& t, index_sequence<I...>)
+ -> decltype(std::forward<F>(f)(std::get<I>(std::forward<Tuple>(t))...))
+ {
+ return std::forward<F>(f)(std::get<I>(std::forward<Tuple>(t))...);
+ }
+
+ template <class F, class Tuple>
+ auto apply(F&& f, Tuple&& t) -> decltype(apply_impl(std::forward<F>(f),
+ std::forward<Tuple>(t),
+ make_tuple_idxs<Tuple>{}))
+ {
+ return apply_impl(
+ std::forward<F>(f), std::forward<Tuple>(t), make_tuple_idxs<Tuple>{});
+ }
+ // End of C++17 compatibility
+
+ template <class Tuple, class F, std::size_t... Is>
+ void for_each_impl(Tuple&& t, F&& f, index_sequence<Is...>)
+ {
+ (void)std::initializer_list<int>{
+ (std::forward<F>(f)(std::get<Is>(std::forward<Tuple>(t))), 0)...};
+ }
+
+ template <class Tuple, class F> void for_each(Tuple&& t, F&& f)
+ {
+ for_each_impl(
+ std::forward<Tuple>(t), std::forward<F>(f), make_tuple_idxs<Tuple>{});
+ }
+
+ template <class Tuple, class F, std::size_t... Is>
+ auto transform_impl(Tuple&& t, F&& f, index_sequence<Is...>)
+ -> decltype(std::make_tuple(
+ std::forward<F>(f)(std::get<Is>(std::forward<Tuple>(t)))...))
+ {
+ return std::make_tuple(
+ std::forward<F>(f)(std::get<Is>(std::forward<Tuple>(t)))...);
+ }
+
+ template <class F, class Tuple>
+ auto transform(Tuple&& t, F&& f = {})
+ -> decltype(transform_impl(std::forward<Tuple>(t),
+ std::forward<F>(f),
+ make_tuple_idxs<Tuple>{}))
+ {
+ return transform_impl(
+ std::forward<Tuple>(t), std::forward<F>(f), make_tuple_idxs<Tuple>{});
+ }
+
+ template <class Predicate> struct find_if_body
+ {
+ const Predicate& pred;
+ std::size_t& index;
+ std::size_t currentIndex = 0;
+ bool found = false;
+
+ find_if_body(const Predicate& p, std::size_t& i) : pred(p), index(i)
+ {
+ }
+
+ template <typename T> void operator()(T&& value)
+ {
+ if (found)
+ return;
+ if (pred(std::forward<T>(value)))
+ {
+ index = currentIndex;
+ found = true;
+ }
+ ++currentIndex;
+ }
+ };
+
+ template <class Predicate, class Tuple>
+ std::size_t find_if(Tuple&& tuple, Predicate pred = {})
+ {
+ std::size_t idx = tuple_size<Tuple>();
+ for_each(std::forward<Tuple>(tuple), find_if_body<Predicate>(pred, idx));
+ return idx;
+ }
+
+ template <class Predicate, class Tuple>
+ bool any_of(Tuple&& tuple, Predicate pred = {})
+ {
+ return find_if(std::forward<Tuple>(tuple), pred) != tuple_size<Tuple>();
+ }
+
+ struct is_range_empty
+ {
+ template <class T> bool operator()(const T& range) const
+ {
+ using std::begin;
+ using std::end;
+ return begin(range) == end(range);
+ }
+ };
+
+ // Transform an iterator into a value reference which will then be passed to the visitor function:
+ struct dereference_iterator
+ {
+ template <class It>
+ auto operator()(It&& it) const -> decltype(*std::forward<It>(it))
+ {
+ return *std::forward<It>(it);
+ }
+ };
+
+ // Increment outermost iterator. If it reaches its end, we're finished and do nothing.
+ template <class Its, std::size_t I = tuple_size<Its>() - 1>
+ enable_if_t<I == 0> increment_iterator(Its& it, const Its&, const Its&)
+ {
+ ++std::get<I>(it);
+ }
+
+ // Increment inner iterator. If it reaches its end, we reset it and increment the previous iterator.
+ template <class Its, std::size_t I = tuple_size<Its>() - 1>
+ enable_if_t<I != 0>
+ increment_iterator(Its& its, const Its& begins, const Its& ends)
+ {
+ if (++std::get<I>(its) == std::get<I>(ends))
+ {
+ std::get<I>(its) = std::get<I>(begins);
+ increment_iterator<Its, I - 1>(its, begins, ends);
+ }
+ }
+ } // namespace Detail
+
+ // This is what actually loops over all the containers, one element at a time
+ // It is called with a template type F that writes the inputs, and runs the converter, which writes the result(s)
+ // all for one set of container values - when called by verifyAllCombinations()
+ // More generally, F must have an operator() that acts on one set of input values.
+ template <class F, class... Ranges>
+ void cartesian_product(F&& f, const Ranges&... ranges)
+ {
+ using std::begin;
+ using std::end;
+
+ if (Detail::any_of<Detail::is_range_empty>(std::forward_as_tuple(ranges...)))
+ return;
+
+ const auto begins = std::make_tuple(begin(ranges)...);
+ const auto ends = std::make_tuple(end(ranges)...);
+
+ for (auto its = begins; std::get<0>(its) != std::get<0>(ends);
+ Detail::increment_iterator(its, begins, ends))
+ {
+ // Command-clicking on transform in CLion 2019.2.1 hangs with CLion with high CPU
+ // 'Use clang tidy' is turned off.
+ // Power-save turned on.
+ // Mac
+ Detail::apply(std::forward<F>(f),
+ Detail::transform<Detail::dereference_iterator>(its));
+ }
+ }
+ } // namespace CartesianProduct
+} // namespace ApprovalTests
+
+// ******************** From: DefaultReporter.h
+
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class DefaultReporter : public Reporter
+ {
+ public:
+ virtual bool report(std::string received, std::string approved) const override;
+ };
+}
+
+// ******************** From: CombinationApprovals.h
+
+#include <type_traits>
+#include <utility>
+
+namespace ApprovalTests
+{
+ template <typename TCompileTimeOptions> class TCombinationApprovals
+ {
+ private:
+ // Write out second or subsequent input value, with preceding comma and space
+ struct print_input
+ {
+ std::ostream& out;
+ template <class T> void operator()(const T& input)
+ {
+ out << ", " << TCompileTimeOptions::ToStringConverter::toString(input);
+ }
+ };
+
+ // Write out one row of output
+ template <class Converter> struct serialize
+ {
+ std::ostream& out;
+ Converter converter;
+ template <class T, class... Ts> void operator()(T&& input1_, Ts&&... inputs)
+ {
+ // First value is printed without trailing comma
+ out << "(" << TCompileTimeOptions::ToStringConverter::toString(input1_);
+ // Remaining values are printed with prefix of a comma
+ CartesianProduct::Detail::for_each(std::forward_as_tuple(inputs...),
+ print_input{out});
+ out << ") => " << converter(input1_, inputs...) << '\n';
+ }
+ };
+
+ public:
+ /**@name Verifying combinations of objects
+
+ See \userguide{TestingCombinations,Testing combinations}
+ */
+ ///@{
+ template <class Converter, class Container, class... Containers>
+ static void verifyAllCombinations(const Options& options,
+ const std::string& header,
+ Converter&& converter,
+ const Container& input0,
+ const Containers&... inputs)
+ {
+ std::stringstream s;
+ ApprovalUtils::writeHeader(s, header);
+ CartesianProduct::cartesian_product(
+ serialize<Converter>{s, std::forward<Converter>(converter)},
+ input0,
+ inputs...);
+ Approvals::verify(s.str(), options);
+ }
+
+ template <class Converter, class... Containers>
+ ApprovalTests::Detail::EnableIfNotOptionsOrReporterOrString<
+ Converter> static verifyAllCombinations(const std::string& header,
+ Converter&& converter,
+ const Containers&... inputs)
+ {
+ verifyAllCombinations(
+ Options(), header, std::forward<Converter>(converter), inputs...);
+ }
+
+ template <class Converter, class... Containers>
+ ApprovalTests::Detail::EnableIfNotOptionsOrReporterOrString<
+ Converter> static verifyAllCombinations(const Options& options,
+ Converter&& converter,
+ const Containers&... inputs)
+ {
+ verifyAllCombinations(
+ options, std::string(), std::forward<Converter>(converter), inputs...);
+ }
+
+ template <class Converter, class... Containers>
+ ApprovalTests::Detail::EnableIfNotOptionsOrReporterOrString<
+ Converter> static verifyAllCombinations(Converter&& converter,
+ const Containers&... inputs)
+ {
+ verifyAllCombinations(
+ Options(), std::string(), std::forward<Converter>(converter), inputs...);
+ }
+ ///@}
+ };
+
+ using CombinationApprovals = TCombinationApprovals<
+ ToStringCompileTimeOptions<APPROVAL_TESTS_DEFAULT_STREAM_CONVERTER>>;
+
+} // namespace ApprovalTests
+
+// ******************** From: Storyboard.h
+
+#include <iosfwd>
+#include <sstream>
+#include <functional>
+
+namespace ApprovalTests
+{
+ class Storyboard
+ {
+ private:
+ std::stringstream output_;
+ int frameCount_ = 0;
+ bool addNewLineBeforeNextFrame_ = false;
+
+ public:
+ Storyboard& addDescription(const std::string& description);
+
+ Storyboard& addDescriptionWithData(const std::string& description,
+ const std::string& data);
+
+ Storyboard& addFrame(const std::string& frame);
+
+ Storyboard& addFrame(const std::string& title, const std::string& frame);
+
+ Storyboard& addFrames(int numberOfFrames,
+ const std::function<std::string(int)>& function);
+
+ friend std::ostream& operator<<(std::ostream& os, const Storyboard& board);
+ };
+}
+
+// ******************** From: TextFileComparator.h
+
+
+#include <fstream>
+
+namespace ApprovalTests
+{
+ class TextFileComparator : public ApprovalComparator
+ {
+ public:
+ static std::ifstream::int_type getNextRelevantCharacter(std::ifstream& astream);
+
+ virtual bool contentsAreEquivalent(std::string receivedPath,
+ std::string approvedPath) const override;
+ };
+}
+
+// ******************** From: ApprovalException.h
+
+#include <exception>
+#include <string>
+
+namespace ApprovalTests
+{
+ class ApprovalException : public std::exception
+ {
+ private:
+ std::string message;
+
+ public:
+ explicit ApprovalException(const std::string& msg);
+
+ virtual const char* what() const noexcept override;
+ };
+
+ class ApprovalMismatchException : public ApprovalException
+ {
+ private:
+ std::string format(const std::string& received, const std::string& approved);
+
+ public:
+ ApprovalMismatchException(const std::string& received,
+ const std::string& approved);
+ };
+
+ class ApprovalMissingException : public ApprovalException
+ {
+ private:
+ std::string format(const std::string& file);
+
+ public:
+ ApprovalMissingException(const std::string& /*received*/,
+ const std::string& approved);
+ };
+}
+
+// ******************** From: FrameworkIntegrations.h
+
+
+namespace ApprovalTests
+{
+ class FrameworkIntegrations
+ {
+ public:
+ static void
+ setTestPassedNotification(FileApprover::TestPassedNotification notification);
+
+ static void setCurrentTest(ApprovalTests::TestName* currentTest);
+ };
+}
+
+// ******************** From: BoostTestApprovals.h
+
+
+#ifdef APPROVALS_BOOSTTEST
+#define APPROVAL_TESTS_INCLUDE_CPPS
+
+namespace ApprovalTests
+{
+
+ class BoostApprovalListener : public boost::unit_test::test_observer
+ {
+ ApprovalTests::TestName currentTest;
+
+ void test_unit_start(boost::unit_test::test_unit const& test) override
+ {
+ std::string path(test.p_file_name.begin(), test.p_file_name.end());
+ currentTest.setFileName(path);
+
+ currentTest.sections.push_back(test.p_name);
+ ApprovalTests::FrameworkIntegrations::setCurrentTest(&currentTest);
+ ApprovalTests::FrameworkIntegrations::setTestPassedNotification(
+ []() { BOOST_CHECK(true); });
+ }
+
+ void test_unit_finish(boost::unit_test::test_unit const& /*test*/,
+ unsigned long) override
+ {
+ currentTest.sections.pop_back();
+ }
+ };
+
+ int register_our_listener(BoostApprovalListener& t)
+ {
+ boost::unit_test::framework::register_observer(t);
+ return 1;
+ }
+
+ BoostApprovalListener o;
+ auto dummy_variable = register_our_listener(o);
+}
+
+#endif // APPROVALS_BOOSTTEST
+
+// ******************** From: Catch2Approvals.h
+
+
+
+#if defined(APPROVALS_CATCH_EXISTING_MAIN)
+#define APPROVALS_CATCH
+#define CATCH_CONFIG_RUNNER
+#elif defined(APPROVALS_CATCH)
+#define CATCH_CONFIG_MAIN
+#endif
+
+#ifdef APPROVALS_CATCH
+#define APPROVAL_TESTS_INCLUDE_CPPS
+
+#include <catch2/catch.hpp>
+
+//namespace ApprovalTests {
+struct Catch2ApprovalListener : Catch::TestEventListenerBase
+{
+ ApprovalTests::TestName currentTest;
+ using TestEventListenerBase::
+ TestEventListenerBase; // This using allows us to use all base-class constructors
+ virtual void testCaseStarting(Catch::TestCaseInfo const& testInfo) override
+ {
+
+ currentTest.setFileName(testInfo.lineInfo.file);
+ ApprovalTests::FrameworkIntegrations::setCurrentTest(&currentTest);
+ ApprovalTests::FrameworkIntegrations::setTestPassedNotification(
+ []() { REQUIRE(true); });
+ }
+
+ virtual void testCaseEnded(Catch::TestCaseStats const& /*testCaseStats*/) override
+ {
+ while (!currentTest.sections.empty())
+ {
+ currentTest.sections.pop_back();
+ }
+ }
+
+ virtual void sectionStarting(Catch::SectionInfo const& sectionInfo) override
+ {
+ currentTest.sections.push_back(sectionInfo.name);
+ }
+
+ virtual void sectionEnded(Catch::SectionStats const& /*sectionStats*/) override
+ {
+ currentTest.sections.pop_back();
+ }
+};
+//}
+CATCH_REGISTER_LISTENER(Catch2ApprovalListener)
+
+#endif
+#ifdef TEST_COMMIT_REVERT_CATCH
+
+//namespace ApprovalTests {
+struct Catch2TestCommitRevert : Catch::TestEventListenerBase
+{
+ using TestEventListenerBase::
+ TestEventListenerBase; // This using allows us to use all base-class constructors
+ virtual void testRunEnded(Catch::TestRunStats const& testRunStats) override
+ {
+ bool commit = testRunStats.totals.testCases.allOk();
+ std::string message = "r ";
+ if (commit)
+ {
+ std::cout << "git add -A \n";
+ std::cout << "git commit -m " << message;
+ }
+ else
+ {
+ std::cout << "git clean -fd \n";
+ std::cout << "git reset --hard HEAD \n";
+ }
+ }
+};
+//}
+CATCH_REGISTER_LISTENER(Catch2TestCommitRevert)
+#endif
+
+// ******************** From: CppUTestApprovals.h
+
+
+#ifdef APPROVALS_CPPUTEST_EXISTING_MAIN
+#define APPROVALS_CPPUTEST
+#endif
+
+#ifdef APPROVALS_CPPUTEST
+#define APPROVAL_TESTS_INCLUDE_CPPS
+
+#include <CppUTest/CommandLineTestRunner.h>
+#include <CppUTest/TestPlugin.h>
+#include <CppUTest/TestRegistry.h>
+
+namespace ApprovalTests
+{
+ class ApprovalTestsCppUTestPlugin : public TestPlugin
+ {
+ private:
+ // We need to be able to delete currentTest at the end of the
+ // test, to prevent CppUTest's leak-checking from triggering,
+ // due to an undeleted std::string - so we use std::unique_ptr.
+ std::unique_ptr<ApprovalTests::TestName> currentTest;
+
+ public:
+ ApprovalTestsCppUTestPlugin() : TestPlugin("ApprovalTestsCppUTestPlugin")
+ {
+ // Turn off CppUTest's leak checks.
+ // On some platforms, CppUTest's leak-checking reports leaks
+ // in this code, because the way the platform's std::string manages life-times
+ // of string storage is not compatible with the requirements of the
+ // CppUTest leak-checks.
+ MemoryLeakWarningPlugin::turnOffNewDeleteOverloads();
+ }
+
+ APPROVAL_TESTS_NO_DISCARD static std::string
+ cppUTestToString(const SimpleString& string)
+ {
+ return std::string{string.asCharString()};
+ }
+
+ void preTestAction(UtestShell& shell, TestResult& result) override
+ {
+ currentTest.reset(new ApprovalTests::TestName);
+ currentTest->setFileName(cppUTestToString(shell.getFile()));
+
+ currentTest->sections.emplace_back(cppUTestToString(shell.getGroup()));
+ currentTest->sections.emplace_back(cppUTestToString(shell.getName()));
+
+ ApprovalTests::FrameworkIntegrations::setCurrentTest(currentTest.get());
+ ApprovalTests::FrameworkIntegrations::setTestPassedNotification(
+ []() { CHECK_TRUE(true); });
+ TestPlugin::preTestAction(shell, result);
+ }
+
+ void postTestAction(UtestShell& shell, TestResult& result) override
+ {
+ currentTest = nullptr;
+ TestPlugin::postTestAction(shell, result);
+ }
+ };
+
+ inline void initializeApprovalTestsForCppUTest()
+ {
+ static ApprovalTests::ApprovalTestsCppUTestPlugin logPlugin;
+ TestRegistry::getCurrentRegistry()->installPlugin(&logPlugin);
+ }
+}
+
+#ifndef APPROVALS_CPPUTEST_EXISTING_MAIN
+int main(int argc, char** argv)
+{
+ ApprovalTests::initializeApprovalTestsForCppUTest();
+
+ int result = CommandLineTestRunner::RunAllTests(argc, argv);
+ TestRegistry::getCurrentRegistry()->resetPlugins();
+ return result;
+}
+#endif
+
+#endif // APPROVALS_CPPUTEST
+
+// ******************** From: DocTestApprovals.h
+
+
+#if defined(APPROVALS_DOCTEST_EXISTING_MAIN)
+#define APPROVALS_DOCTEST
+#define DOCTEST_CONFIG_IMPLEMENT
+#elif defined(APPROVALS_DOCTEST)
+#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+#endif
+
+#ifdef APPROVALS_DOCTEST
+#define APPROVAL_TESTS_INCLUDE_CPPS
+
+#include <doctest/doctest.h>
+
+namespace ApprovalTests
+{
+ // anonymous namespace to prevent compiler -Wsubobject-linkage warnings
+ // This is OK as this code is only compiled on main()
+ namespace
+ {
+ struct AbstractReporter : doctest::IReporter
+ {
+ virtual void report_query(const doctest::QueryData&) override
+ {
+ }
+ // called when the whole test run starts
+ virtual void test_run_start() override
+ {
+ }
+
+ // called when the whole test run ends (caching a pointer to the input doesn't make sense here)
+ virtual void test_run_end(const doctest::TestRunStats&) override
+ {
+ }
+
+ // called when a test case is started (safe to cache a pointer to the input)
+ virtual void test_case_start(const doctest::TestCaseData&) override
+ {
+ }
+
+#if 20305 <= DOCTEST_VERSION
+ // called when a test case is reentered because of unfinished subcases (safe to cache a pointer to the input)
+ virtual void test_case_reenter(const doctest::TestCaseData&) override
+ {
+ }
+#endif
+
+ // called when a test case has ended
+ virtual void test_case_end(const doctest::CurrentTestCaseStats&) override
+ {
+ }
+
+ // called when an exception is thrown from the test case (or it crashes)
+ virtual void test_case_exception(const doctest::TestCaseException&) override
+ {
+ }
+
+ // called whenever a subcase is entered (don't cache pointers to the input)
+ virtual void subcase_start(const doctest::SubcaseSignature&) override
+ {
+ }
+
+ // called whenever a subcase is exited (don't cache pointers to the input)
+ virtual void subcase_end() override
+ {
+ }
+
+ // called for each assert (don't cache pointers to the input)
+ virtual void log_assert(const doctest::AssertData&) override
+ {
+ }
+
+ // called for each message (don't cache pointers to the input)
+ virtual void log_message(const doctest::MessageData&) override
+ {
+ }
+
+ // called when a test case is skipped either because it doesn't pass the filters, has a skip decorator
+ // or isn't in the execution range (between first and last) (safe to cache a pointer to the input)
+ virtual void test_case_skipped(const doctest::TestCaseData&) override
+ {
+ }
+ };
+
+ struct DocTestApprovalListener : AbstractReporter
+ {
+ TestName currentTest;
+
+ // constructor has to accept the ContextOptions by ref as a single argument
+ explicit DocTestApprovalListener(const doctest::ContextOptions& /*in*/)
+ {
+ }
+
+ std::string doctestToString(const doctest::String& string) const
+ {
+ return string.c_str();
+ }
+
+ std::string doctestToString(const char* string) const
+ {
+ return string;
+ }
+
+ void test_case_start(const doctest::TestCaseData& testInfo) override
+ {
+ currentTest.sections.emplace_back(testInfo.m_name);
+ currentTest.setFileName(doctestToString(testInfo.m_file));
+ ApprovalTests::FrameworkIntegrations::setCurrentTest(&currentTest);
+ ApprovalTests::FrameworkIntegrations::setTestPassedNotification(
+ []() { REQUIRE(true); });
+ }
+
+ void test_case_end(const doctest::CurrentTestCaseStats& /*in*/) override
+ {
+
+ while (!currentTest.sections.empty())
+ {
+ currentTest.sections.pop_back();
+ }
+ }
+
+ void subcase_start(const doctest::SubcaseSignature& signature) override
+ {
+ currentTest.sections.emplace_back(doctestToString(signature.m_name));
+ }
+
+ void subcase_end() override
+ {
+
+ currentTest.sections.pop_back();
+ }
+ };
+ }
+}
+
+REGISTER_LISTENER("approvals", 0, ApprovalTests::DocTestApprovalListener);
+
+#endif // APPROVALS_DOCTEST
+
+// ******************** From: FmtApprovals.h
+#ifdef FMT_VERSION
+namespace ApprovalTests
+{
+ using FmtApprovals =
+ ApprovalTests::TApprovals<ApprovalTests::ToStringCompileTimeOptions<FmtToString>>;
+}
+#endif
+
+// ******************** From: GoogleConfiguration.h
+
+
+namespace ApprovalTests
+{
+ class GoogleConfiguration
+ {
+ public:
+ // This result is not used, it is only there to allow the method to execute, when this is used outside a function.
+ APPROVAL_TESTS_NO_DISCARD static bool addTestCaseNameRedundancyCheck(
+ GoogleCustomizationsFactory::Comparator comparator);
+
+ // This result is not used, it is only there to allow the method to execute, when this is used outside a function.
+ APPROVAL_TESTS_NO_DISCARD static bool
+ addIgnorableTestCaseNameSuffix(std::string suffix);
+
+ static GoogleCustomizationsFactory::Comparator
+ createIgnorableTestCaseNameSuffixCheck(const std::string& suffix);
+ };
+}
+
+// ******************** From: GoogleTestApprovals.h
+
+
+#ifdef APPROVALS_GOOGLETEST_EXISTING_MAIN
+#define APPROVALS_GOOGLETEST
+#endif
+
+#ifdef APPROVALS_GOOGLETEST
+#define APPROVAL_TESTS_INCLUDE_CPPS
+
+#include <gtest/gtest.h>
+
+namespace ApprovalTests
+{
+ class GoogleTestListener : public testing::EmptyTestEventListener
+ {
+ TestName currentTest;
+
+ public:
+ bool isDuplicate(std::string testFileNameWithExtension, std::string testCaseName)
+ {
+ for (auto check : GoogleCustomizationsFactory::getEquivalencyChecks())
+ {
+ if (check(testFileNameWithExtension, testCaseName))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ virtual void OnTestStart(const testing::TestInfo& testInfo) override
+ {
+ currentTest.setFileName(testInfo.file());
+ currentTest.sections = {};
+ if (!isDuplicate(currentTest.getFileName(), testInfo.test_case_name()))
+ {
+ currentTest.sections.emplace_back(testInfo.test_case_name());
+ }
+ if (!std::string(testInfo.name()).empty())
+ {
+ currentTest.sections.emplace_back(testInfo.name());
+ }
+
+ ApprovalTests::FrameworkIntegrations::setCurrentTest(&currentTest);
+ ApprovalTests::FrameworkIntegrations::setTestPassedNotification(
+ []() { EXPECT_TRUE(true); });
+ }
+ };
+
+ inline void initializeApprovalTestsForGoogleTests()
+ {
+ auto& listeners = testing::UnitTest::GetInstance()->listeners();
+ listeners.Append(new GoogleTestListener);
+ }
+}
+
+#ifndef APPROVALS_GOOGLETEST_EXISTING_MAIN
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ ApprovalTests::initializeApprovalTestsForGoogleTests();
+ return RUN_ALL_TESTS();
+}
+#endif //APPROVALS_GOOGLETEST_EXISTING_MAIN
+
+#endif
+
+// ******************** From: UTApprovals.h
+
+
+#ifdef APPROVALS_UT
+#define APPROVAL_TESTS_INCLUDE_CPPS
+
+#if !(__GNUC__ >= 9 or __clang_major__ >= 9)
+#error \
+ "The [Boost].UT integration with Approval Tests requires source_location support by the compiler"
+#endif
+
+#include <boost/ut.hpp>
+
+namespace ApprovalTests
+{
+ namespace cfg
+ {
+ void notify_success();
+
+ class reporter : public boost::ut::reporter<boost::ut::printer>
+ {
+ private:
+ TestName currentTest;
+
+ public:
+ auto on(boost::ut::events::test_begin test_begin) -> void
+ {
+ std::string name = std::string(test_begin.name);
+ currentTest.sections.emplace_back(name);
+ currentTest.setFileName(test_begin.location.file_name());
+
+ ApprovalTests::FrameworkIntegrations::setCurrentTest(&currentTest);
+ ApprovalTests::FrameworkIntegrations::setTestPassedNotification(
+ []() { notify_success(); });
+ boost::ut::reporter<boost::ut::printer>::on(test_begin);
+ }
+
+ auto on(boost::ut::events::test_run test_run) -> void
+ {
+ boost::ut::reporter<boost::ut::printer>::on(test_run);
+ }
+
+ auto on(boost::ut::events::test_skip test_skip) -> void
+ {
+ boost::ut::reporter<boost::ut::printer>::on(test_skip);
+ }
+
+ auto on(boost::ut::events::test_end test_end) -> void
+ {
+ while (!currentTest.sections.empty())
+ {
+ currentTest.sections.pop_back();
+ }
+ boost::ut::reporter<boost::ut::printer>::on(test_end);
+ }
+
+ template <class TMsg> auto on(boost::ut::events::log<TMsg> log) -> void
+ {
+ boost::ut::reporter<boost::ut::printer>::on(log);
+ }
+
+ template <class TExpr>
+ auto on(boost::ut::events::assertion_pass<TExpr> location) -> void
+ {
+ boost::ut::reporter<boost::ut::printer>::on(location);
+ }
+
+ template <class TExpr>
+ auto on(boost::ut::events::assertion_fail<TExpr> fail) -> void
+ {
+ boost::ut::reporter<boost::ut::printer>::on(fail);
+ }
+
+ auto on(boost::ut::events::fatal_assertion fatal) -> void
+ {
+ boost::ut::reporter<boost::ut::printer>::on(fatal);
+ }
+
+ auto on(boost::ut::events::exception exception) -> void
+ {
+ boost::ut::reporter<boost::ut::printer>::on(exception);
+ }
+
+ auto on(boost::ut::events::summary summary) -> void
+ {
+ boost::ut::reporter<boost::ut::printer>::on(summary);
+ }
+ };
+ } // namespace cfg
+}
+
+template <>
+auto boost::ut::cfg<boost::ut::override> =
+ boost::ut::runner<ApprovalTests::cfg::reporter>{};
+
+namespace ApprovalTests
+{
+ namespace cfg
+ {
+ void notify_success()
+ {
+ // This needs to be after the registering of our custom listener,
+ // for compilation to succeed.
+ boost::ut::expect(true);
+ }
+ }
+}
+
+#endif // APPROVALS_UT
+
+// ******************** From: HelpMessages.h
+
+#include <string>
+#include <vector>
+
+namespace ApprovalTests
+{
+ class HelpMessages
+ {
+ public:
+ static std::string getMisconfiguredBuildHelp(const std::string& fileName);
+
+ static std::string getMisconfiguredMainHelp();
+
+ static std::string getUnconfiguredRootDirectory();
+
+ static std::string
+ getUnknownEnvVarReporterHelp(const std::string& envVarName,
+ const std::string& selected,
+ const std::vector<std::string>& knowns);
+ static std::string
+ getInvalidEnvVarReporterHelp(const std::string& envVarName,
+ const std::string& selected,
+ const std::vector<std::string>& knowns);
+
+ static std::string envVarErrorMessage(const std::string& envVarName,
+ const std::string& selected,
+ const std::vector<std::string>& knowns,
+ std::string& helpMessage);
+
+ static std::string topAndTailHelpMessage(const std::string& message);
+ };
+}
+
+// ******************** From: SeparateApprovedAndReceivedDirectoriesNamer.h
+
+
+namespace ApprovalTests
+{
+ class SeparateApprovedAndReceivedDirectoriesNamer : public TemplatedCustomNamer
+ {
+ public:
+ SeparateApprovedAndReceivedDirectoriesNamer();
+
+ virtual ~SeparateApprovedAndReceivedDirectoriesNamer() override = default;
+
+ static DefaultNamerDisposer useAsDefaultNamer();
+ };
+}
+
+// ******************** From: AutoApproveIfMissingReporter.h
+
+
+namespace ApprovalTests
+{
+ class AutoApproveIfMissingReporter : public Reporter
+ {
+ public:
+ bool report(std::string received, std::string approved) const override;
+ };
+}
+
+// ******************** From: BlockingReporter.h
+
+
+#include <memory>
+#include <utility>
+
+namespace ApprovalTests
+{
+ class BlockingReporter : public Reporter
+ {
+ private:
+ std::shared_ptr<Blocker> blocker;
+
+ BlockingReporter() = delete;
+
+ public:
+ explicit BlockingReporter(std::shared_ptr<Blocker> blocker_);
+
+ static std::shared_ptr<BlockingReporter>
+ onMachineNamed(const std::string& machineName);
+
+ static std::shared_ptr<BlockingReporter>
+ onMachinesNotNamed(const std::string& machineName);
+
+ virtual bool report(std::string /*received*/,
+ std::string /*approved*/) const override;
+ };
+}
+
+// ******************** From: CIBuildOnlyReporter.h
+
+
+#include <memory>
+
+namespace ApprovalTests
+{
+ // A reporter which uses the supplied reporter, if called on a supported Continuous Integration system
+ class CIBuildOnlyReporter : public Reporter
+ {
+ private:
+ std::shared_ptr<Reporter> m_reporter;
+
+ public:
+ explicit CIBuildOnlyReporter(
+ std::shared_ptr<Reporter> reporter = std::make_shared<TextDiffReporter>());
+
+ bool report(std::string received, std::string approved) const override;
+
+ static bool isRunningUnderCI();
+ };
+} // namespace ApprovalTests
+
+// ******************** From: CIBuildOnlyReporterUtils.h
+
+
+namespace ApprovalTests
+{
+ namespace CIBuildOnlyReporterUtils
+ {
+ FrontLoadedReporterDisposer
+ useAsFrontLoadedReporter(const std::shared_ptr<Reporter>& reporter);
+ }
+} // namespace ApprovalTests
+
+// ******************** From: ClipboardReporter.h
+
+
+#include <string>
+
+namespace ApprovalTests
+{
+ class ClipboardReporter : public Reporter
+ {
+ public:
+ static std::string getCommandLineFor(const std::string& received,
+ const std::string& approved,
+ bool isWindows);
+
+ virtual bool report(std::string received, std::string approved) const override;
+
+ static void copyToClipboard(const std::string& newClipboard);
+ };
+}
+
+// ******************** From: CombinationReporter.h
+
+#include <memory>
+#include <vector>
+
+namespace ApprovalTests
+{
+ class CombinationReporter : public Reporter
+ {
+ private:
+ std::vector<std::unique_ptr<Reporter>> reporters;
+
+ public:
+ // Note that CombinationReporter takes ownership of the given Reporter objects
+ explicit CombinationReporter(const std::vector<Reporter*>& theReporters);
+
+ bool report(std::string received, std::string approved) const override;
+ };
+}
+
+// ******************** From: CustomReporter.h
+
+#include <memory>
+
+namespace ApprovalTests
+{
+ class CustomReporter
+ {
+ public:
+ static std::shared_ptr<GenericDiffReporter> create(std::string path,
+ Type type = Type::TEXT);
+
+ static std::shared_ptr<GenericDiffReporter>
+ create(std::string path, std::string arguments, Type type = Type::TEXT);
+
+ static std::shared_ptr<GenericDiffReporter> createForegroundReporter(
+ std::string path, Type type = Type::TEXT, bool allowNonZeroExitCodes = false);
+
+ static std::shared_ptr<GenericDiffReporter>
+ createForegroundReporter(std::string path,
+ std::string arguments,
+ Type type = Type::TEXT,
+ bool allowNonZeroExitCodes = false);
+ };
+}
+
+// ******************** From: DiffReporter.h
+
+
+namespace ApprovalTests
+{
+ class DiffReporter : public FirstWorkingReporter
+ {
+ public:
+ DiffReporter();
+ };
+}
+
+// ******************** From: EnvironmentVariableReporter.h
+
+#include <memory>
+
+namespace ApprovalTests
+{
+ class EnvironmentVariableReporter : public Reporter
+ {
+ public:
+ bool report(std::string received, std::string approved) const override;
+
+ bool report(const std::string& envVar,
+ const std::string& received,
+ const std::string& approved) const;
+
+ static std::string environmentVariableName();
+
+ private:
+ ReporterFactory factory;
+ };
+}
+
+// ******************** From: LinuxReporters.h
+
+
+namespace ApprovalTests
+{
+ namespace Linux
+ {
+ class SublimeMergeSnapReporter : public GenericDiffReporter
+ {
+ public:
+ SublimeMergeSnapReporter();
+ };
+
+ class SublimeMergeFlatpakReporter : public GenericDiffReporter
+ {
+ public:
+ SublimeMergeFlatpakReporter();
+ };
+
+ class SublimeMergeRepositoryPackageReporter : public GenericDiffReporter
+ {
+ public:
+ SublimeMergeRepositoryPackageReporter();
+ };
+
+ class SublimeMergeDirectDownloadReporter : public GenericDiffReporter
+ {
+ public:
+ SublimeMergeDirectDownloadReporter();
+ };
+
+ class SublimeMergeReporter : public FirstWorkingReporter
+ {
+ public:
+ SublimeMergeReporter();
+ };
+
+ class KDiff3Reporter : public GenericDiffReporter
+ {
+ public:
+ KDiff3Reporter();
+ };
+
+ class MeldReporter : public GenericDiffReporter
+ {
+ public:
+ MeldReporter();
+ };
+
+ class BeyondCompareReporter : public GenericDiffReporter
+ {
+ public:
+ BeyondCompareReporter();
+ };
+
+ class LinuxDiffReporter : public FirstWorkingReporter
+ {
+ public:
+ LinuxDiffReporter();
+ };
+ }
+}
+
+// ******************** From: MacReporters.h
+
+
+namespace ApprovalTests
+{
+ namespace Mac
+ {
+ class DiffMergeReporter : public GenericDiffReporter
+ {
+ public:
+ DiffMergeReporter();
+ };
+
+ class AraxisMergeReporter : public GenericDiffReporter
+ {
+ public:
+ AraxisMergeReporter();
+ };
+
+ class VisualStudioCodeReporter : public GenericDiffReporter
+ {
+ public:
+ VisualStudioCodeReporter();
+ };
+
+ class BeyondCompareReporter : public GenericDiffReporter
+ {
+ public:
+ BeyondCompareReporter();
+ };
+
+ class KaleidoscopeReporter : public GenericDiffReporter
+ {
+ public:
+ KaleidoscopeReporter();
+ };
+
+ class SublimeMergeReporter : public GenericDiffReporter
+ {
+ public:
+ SublimeMergeReporter();
+ };
+
+ class KDiff3Reporter : public GenericDiffReporter
+ {
+ public:
+ KDiff3Reporter();
+ };
+
+ class P4MergeReporter : public GenericDiffReporter
+ {
+ public:
+ P4MergeReporter();
+ };
+
+ class TkDiffReporter : public GenericDiffReporter
+ {
+ public:
+ TkDiffReporter();
+ };
+
+ // Note that this will be found on Linux too.
+ // See https://github.com/approvals/ApprovalTests.cpp/issues/138 for limitations
+ class CLionDiffReporter : public GenericDiffReporter
+ {
+ public:
+ CLionDiffReporter();
+ };
+
+ class MacDiffReporter : public FirstWorkingReporter
+ {
+ public:
+ MacDiffReporter();
+
+ bool report(std::string received, std::string approved) const override;
+ };
+ }
+}
+
+// ******************** From: WindowsReporters.h
+
+
+namespace ApprovalTests
+{
+ namespace Windows
+ {
+
+ class VisualStudioCodeReporter : public GenericDiffReporter
+ {
+ public:
+ VisualStudioCodeReporter();
+ };
+
+ // ----------------------- Beyond Compare ----------------------------------
+ class BeyondCompare3Reporter : public GenericDiffReporter
+ {
+ public:
+ BeyondCompare3Reporter();
+ };
+
+ class BeyondCompare4Reporter : public GenericDiffReporter
+ {
+ public:
+ BeyondCompare4Reporter();
+ };
+
+ class BeyondCompareReporter : public FirstWorkingReporter
+ {
+ public:
+ BeyondCompareReporter();
+ };
+
+ // ----------------------- Tortoise SVN ------------------------------------
+ class TortoiseImageDiffReporter : public GenericDiffReporter
+ {
+ public:
+ TortoiseImageDiffReporter();
+ };
+
+ class TortoiseTextDiffReporter : public GenericDiffReporter
+ {
+ public:
+ TortoiseTextDiffReporter();
+ };
+
+ class TortoiseDiffReporter : public FirstWorkingReporter
+ {
+ public:
+ TortoiseDiffReporter();
+ };
+
+ // ----------------------- Tortoise Git ------------------------------------
+ class TortoiseGitTextDiffReporter : public GenericDiffReporter
+ {
+ public:
+ TortoiseGitTextDiffReporter();
+ };
+
+ class TortoiseGitImageDiffReporter : public GenericDiffReporter
+ {
+ public:
+ TortoiseGitImageDiffReporter();
+ };
+
+ class TortoiseGitDiffReporter : public FirstWorkingReporter
+ {
+ public:
+ TortoiseGitDiffReporter();
+ };
+
+ // -------------------------------------------------------------------------
+ class WinMergeReporter : public GenericDiffReporter
+ {
+ public:
+ WinMergeReporter();
+ };
+
+ class AraxisMergeReporter : public GenericDiffReporter
+ {
+ public:
+ AraxisMergeReporter();
+ };
+
+ class CodeCompareReporter : public GenericDiffReporter
+ {
+ public:
+ CodeCompareReporter();
+ };
+
+ class SublimeMergeReporter : public GenericDiffReporter
+ {
+ public:
+ SublimeMergeReporter();
+ };
+
+ class KDiff3Reporter : public GenericDiffReporter
+ {
+ public:
+ KDiff3Reporter();
+ };
+
+ class WindowsDiffReporter : public FirstWorkingReporter
+ {
+ public:
+ WindowsDiffReporter();
+
+ bool report(std::string received, std::string approved) const override;
+ };
+ }
+}
+
+// ******************** From: DateUtils.h
+
+#include <chrono>
+#include <string>
+
+namespace ApprovalTests
+{
+ // All values are in UTC
+ class DateUtils
+ {
+ public:
+ static std::tm
+ createTm(int year, int month, int day, int hour, int minute, int second);
+
+ static std::chrono::system_clock::time_point
+ createUtcDateTime(int year, int month, int day, int hour, int minute, int second);
+
+ static std::string toString(const std::chrono::system_clock::time_point& dateTime,
+ const std::string& format);
+
+ static std::string
+ toString(const std::chrono::system_clock::time_point& dateTime);
+
+ static time_t toUtc(std::tm& timeinfo);
+
+ static tm toUtc(time_t& tt);
+ };
+}
+
+// ******************** From: EmptyFileCreatorByType.h
+
+
+#include <map>
+#include <string>
+
+namespace ApprovalTests
+{
+ class EmptyFileCreatorByType
+ {
+ private:
+ static std::map<std::string, EmptyFileCreator> creators_;
+
+ public:
+ static void registerCreator(const std::string& extensionWithDot,
+ EmptyFileCreator creator);
+
+ static void createFile(const std::string& fileName);
+ };
+}
+
+// ******************** From: ExceptionCollector.h
+
+#include <sstream>
+#include <exception>
+#include <string>
+#include <vector>
+#include <functional>
+
+namespace ApprovalTests
+{
+ class ExceptionCollector
+ {
+ std::vector<std::string> exceptionMessages;
+
+ public:
+ void gather(std::function<void(void)> functionThatThrows);
+
+ ~ExceptionCollector();
+
+ void release();
+ };
+}
+
+// ******************** From: FileUtilsSystemSpecific.h
+
+
+namespace ApprovalTests
+{
+ class FileUtilsSystemSpecific
+ {
+ public:
+ static std::string getCommandLineForCopy(const std::string& source,
+ const std::string& destination,
+ bool isWindows);
+
+ static void copyFile(const std::string& source, const std::string& destination);
+ };
+}
+
+// ******************** From: Grid.h
+#include <sstream>
+#include <functional>
+
+namespace ApprovalTests
+{
+ class Grid
+ {
+ public:
+ static std::string print(int width,
+ int height,
+ std::function<void(int, int, std::ostream&)> printCell);
+ static std::string print(int width, int height, std::string text);
+ };
+}
+
+#ifdef APPROVAL_TESTS_INCLUDE_CPPS
+
+// ******************** From: ApprovalUtils.cpp
+
+#include <ostream>
+
+namespace ApprovalTests
+{
+ void ApprovalUtils::writeHeader(std::ostream& stream, const std::string& header)
+ {
+ if (!header.empty())
+ {
+ stream << header << "\n\n\n";
+ }
+ }
+}
+
+// ******************** From: Storyboard.cpp
+
+namespace ApprovalTests
+{
+ Storyboard& Storyboard::addDescription(const std::string& description)
+ {
+ output_ << description << "\n";
+ addNewLineBeforeNextFrame_ = true;
+ return *this;
+ }
+
+ Storyboard& Storyboard::addDescriptionWithData(const std::string& description,
+ const std::string& data)
+ {
+ output_ << description << ": " << data << "\n";
+ addNewLineBeforeNextFrame_ = true;
+ return *this;
+ }
+
+ Storyboard& Storyboard::addFrame(const std::string& frame)
+ {
+ if (frameCount_ == 0)
+ {
+ return addFrame("Initial Frame", frame);
+ }
+ else
+ {
+ return addFrame("Frame #" + std::to_string(frameCount_), frame);
+ }
+ }
+
+ Storyboard& Storyboard::addFrame(const std::string& title, const std::string& frame)
+ {
+ if (addNewLineBeforeNextFrame_)
+ {
+ output_ << '\n';
+ addNewLineBeforeNextFrame_ = false;
+ }
+ output_ << title << ":\n";
+ output_ << frame << "\n\n";
+ frameCount_ += 1;
+ return *this;
+ }
+
+ Storyboard& Storyboard::addFrames(int numberOfFrames,
+ const std::function<std::string(int)>& function)
+ {
+ for (int frame = 1; frame <= numberOfFrames; ++frame)
+ {
+ addFrame(function(frame));
+ }
+ return *this;
+ }
+
+ std::ostream& operator<<(std::ostream& os, const Storyboard& board)
+ {
+ os << board.output_.str();
+ return os;
+ }
+}
+
+// ******************** From: ComparatorDisposer.cpp
+
+namespace ApprovalTests
+{
+ ComparatorDisposer::ComparatorDisposer(
+ ComparatorContainer& comparators_,
+ const std::string& extensionWithDot,
+ std::shared_ptr<ApprovalTests::ApprovalComparator> previousComparator_,
+ std::shared_ptr<ApprovalTests::ApprovalComparator> newComparator)
+ : comparators(comparators_)
+ , ext_(extensionWithDot)
+ , previousComparator(std::move(previousComparator_))
+ {
+ comparators_[extensionWithDot] = std::move(newComparator);
+ }
+
+ ComparatorDisposer::ComparatorDisposer(ComparatorDisposer&& other) noexcept
+ : comparators(other.comparators)
+ , ext_(std::move(other.ext_))
+ , previousComparator(std::move(other.previousComparator))
+ {
+ other.isActive = false;
+ }
+
+ ComparatorDisposer::~ComparatorDisposer()
+ {
+ if (isActive)
+ {
+ comparators[ext_] = previousComparator;
+ }
+ }
+}
+
+// ******************** From: ComparatorFactory.cpp
+
+namespace ApprovalTests
+{
+ ComparatorContainer& ComparatorFactory::comparators()
+ {
+ static ComparatorContainer allComparators;
+ return allComparators;
+ }
+
+ ComparatorDisposer
+ ComparatorFactory::registerComparator(const std::string& extensionWithDot,
+ std::shared_ptr<ApprovalComparator> comparator)
+ {
+ return ComparatorDisposer(comparators(),
+ extensionWithDot,
+ getComparatorForFileExtensionWithDot(extensionWithDot),
+ comparator);
+ }
+
+ std::shared_ptr<ApprovalComparator>
+ ComparatorFactory::getComparatorForFile(const std::string& receivedPath)
+ {
+ const std::string fileExtension = FileUtils::getExtensionWithDot(receivedPath);
+ return getComparatorForFileExtensionWithDot(fileExtension);
+ }
+
+ std::shared_ptr<ApprovalComparator>
+ ComparatorFactory::getComparatorForFileExtensionWithDot(
+ const std::string& fileExtensionWithDot)
+ {
+ auto iterator = comparators().find(fileExtensionWithDot);
+ if (iterator != comparators().end())
+ {
+ return iterator->second;
+ }
+ return std::make_shared<TextFileComparator>();
+ }
+}
+
+// ******************** From: TextFileComparator.cpp
+
+#include <fstream>
+
+namespace ApprovalTests
+{
+ std::ifstream::int_type
+ TextFileComparator::getNextRelevantCharacter(std::ifstream& astream)
+ {
+ auto ch = astream.get();
+ if (ch == '\r')
+ {
+ return astream.get();
+ }
+ else
+ {
+ return ch;
+ }
+ }
+
+ bool TextFileComparator::contentsAreEquivalent(std::string receivedPath,
+ std::string approvedPath) const
+ {
+ std::ifstream astream(approvedPath.c_str(), std::ios::binary | std::ifstream::in);
+ std::ifstream rstream(receivedPath.c_str(), std::ios::binary | std::ifstream::in);
+
+ while (astream.good() && rstream.good())
+ {
+ int a = getNextRelevantCharacter(astream);
+ int r = getNextRelevantCharacter(rstream);
+
+ if (a != r)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+}
+
+// ******************** From: ApprovalException.cpp
+
+#include <sstream>
+
+namespace ApprovalTests
+{
+ ApprovalException::ApprovalException(const std::string& msg) : message(msg)
+ {
+ }
+
+ const char* ApprovalException::what() const noexcept
+ {
+ return message.c_str();
+ }
+
+ std::string ApprovalMismatchException::format(const std::string& received,
+ const std::string& approved)
+ {
+ std::stringstream s;
+ s << "Failed Approval: \n"
+ << "Received does not match approved \n"
+ << "Received : \"" << received << "\" \n"
+ << "Approved : \"" << approved << "\"";
+ return s.str();
+ }
+
+ ApprovalMismatchException::ApprovalMismatchException(const std::string& received,
+ const std::string& approved)
+ : ApprovalException(format(received, approved))
+ {
+ }
+
+ std::string ApprovalMissingException::format(const std::string& file)
+ {
+ std::stringstream s;
+ s << "Failed Approval: \n"
+ << "Approval File Not Found \n"
+ << "File: \"" << file << '"';
+ return s.str();
+ }
+
+ ApprovalMissingException::ApprovalMissingException(const std::string&,
+ const std::string& approved)
+ : ApprovalException(format(approved))
+ {
+ }
+}
+
+// ******************** From: FileApprover.cpp
+
+#include <sstream>
+
+namespace ApprovalTests
+{
+
+ ComparatorDisposer FileApprover::registerComparatorForExtension(
+ const std::string& extensionWithDot,
+ std::shared_ptr<ApprovalComparator> comparator)
+ {
+ return ComparatorFactory::registerComparator(extensionWithDot, comparator);
+ }
+
+ FileApprover::TestPassedNotification FileApprover::testPassedNotification_ = []() {};
+
+ void FileApprover::verify(const std::string& receivedPath,
+ const std::string& approvedPath,
+ const ApprovalComparator& comparator)
+ {
+ if (receivedPath == approvedPath)
+ {
+ std::stringstream s;
+ s << "Identical filenames for received and approved.\n"
+ << "Tests would spuriously pass. \n"
+ << "Please check your custom namer. \n"
+ << "Received : \"" << receivedPath << "\" \n"
+ << "Approved : \"" << approvedPath << "\"";
+ // Do not throw ApprovalException, as we don't want reporters to trigger.
+ // They would show two seemingly identical files, due to matching file name.
+ throw std::runtime_error(s.str());
+ }
+
+ if (!FileUtils::fileExists(approvedPath))
+ {
+ throw ApprovalMissingException(receivedPath, approvedPath);
+ }
+
+ if (!FileUtils::fileExists(receivedPath))
+ {
+ throw ApprovalMissingException(approvedPath, receivedPath);
+ }
+
+ if (!comparator.contentsAreEquivalent(receivedPath, approvedPath))
+ {
+ throw ApprovalMismatchException(receivedPath, approvedPath);
+ }
+ }
+
+ void FileApprover::verify(const std::string& receivedPath,
+ const std::string& approvedPath)
+ {
+ verify(receivedPath,
+ approvedPath,
+ *ComparatorFactory::getComparatorForFile(receivedPath));
+ }
+
+ void FileApprover::verify(const ApprovalNamer& n,
+ const ApprovalWriter& s,
+ const Reporter& r)
+ {
+ std::string approvedPath = n.getApprovedFile(s.getFileExtensionWithDot());
+ std::string receivedPath = n.getReceivedFile(s.getFileExtensionWithDot());
+ SystemUtils::ensureParentDirectoryExists(approvedPath);
+ SystemUtils::ensureParentDirectoryExists(receivedPath);
+ s.write(receivedPath);
+ try
+ {
+ verify(receivedPath, approvedPath);
+ s.cleanUpReceived(receivedPath);
+ notifyTestPassed();
+ }
+ catch (const ApprovalException&)
+ {
+ reportAfterTryingFrontLoadedReporter(receivedPath, approvedPath, r);
+ throw;
+ }
+ }
+
+ void
+ FileApprover::reportAfterTryingFrontLoadedReporter(const std::string& receivedPath,
+ const std::string& approvedPath,
+ const Reporter& r)
+ {
+ auto tryFirst = FrontLoadedReporterFactory::getFrontLoadedReporter();
+ if (!tryFirst->report(receivedPath, approvedPath))
+ {
+ r.report(receivedPath, approvedPath);
+ }
+ }
+
+ void FileApprover::setTestPassedNotification(
+ FileApprover::TestPassedNotification notification)
+ {
+ testPassedNotification_ = notification;
+ }
+
+ void FileApprover::notifyTestPassed()
+ {
+ testPassedNotification_();
+ }
+}
+
+// ******************** From: Options.cpp
+
+namespace ApprovalTests
+{
+ // FileOptions -----------------------------------------------------------------------
+ Options::FileOptions::FileOptions(std::string fileExtensionWithDot)
+ : fileExtensionWithDot_(std::move(fileExtensionWithDot))
+ {
+ }
+
+ Options::FileOptions Options::FileOptions::clone() const
+ {
+ // the returned options_ must be null
+ return FileOptions(fileExtensionWithDot_);
+ }
+
+ const std::string& Options::FileOptions::getFileExtension() const
+ {
+ return fileExtensionWithDot_;
+ }
+
+ Options
+ Options::FileOptions::withFileExtension(const std::string& fileExtensionWithDot) const
+ {
+ FileOptions newSelf(fileExtensionWithDot);
+ return options_->clone(newSelf);
+ }
+
+ // Options ---------------------------------------------------------------------------
+ Options::Options(Options::FileOptions fileOptions,
+ Scrubber scrubber,
+ const Reporter& reporter,
+ bool usingDefaultScrubber,
+ std::shared_ptr<ApprovalNamer> namer)
+ : fileOptions_(std::move(fileOptions))
+ , scrubber_(std::move(scrubber))
+ , reporter_(reporter)
+ , namer_(namer)
+ , usingDefaultScrubber_(usingDefaultScrubber)
+ {
+ }
+
+ Options Options::clone(const Options::FileOptions& fileOptions) const
+ {
+ // TODO error this can retain a previous Options* ???
+ return Options(fileOptions, scrubber_, reporter_, usingDefaultScrubber_, namer_);
+ }
+
+ const Reporter& Options::defaultReporter()
+ {
+ static DefaultReporter defaultReporter;
+ return defaultReporter;
+ }
+
+ Options::Options(Scrubber scrubber) : scrubber_(std::move(scrubber))
+ {
+ usingDefaultScrubber_ = false;
+ }
+
+ Options::Options(const Reporter& reporter) : reporter_(reporter)
+ {
+ }
+
+ Options::FileOptions Options::fileOptions() const
+ {
+ if (fileOptions_.options_ != nullptr)
+ {
+ throw std::logic_error(
+ "Incorrect assumption: A FileOptions has been re-used");
+ }
+ FileOptions copy = fileOptions_.clone();
+ copy.options_ = this;
+ return copy;
+ }
+
+ Scrubber Options::getScrubber() const
+ {
+ return scrubber_;
+ }
+
+ bool Options::isUsingDefaultScrubber() const
+ {
+ return usingDefaultScrubber_;
+ }
+
+ std::string Options::scrub(const std::string& input) const
+ {
+ return scrubber_(input);
+ }
+ const Reporter& Options::getReporter() const
+ {
+ return reporter_;
+ }
+
+ Options Options::withReporter(const Reporter& reporter) const
+ {
+ return Options(fileOptions_, scrubber_, reporter, usingDefaultScrubber_, namer_);
+ }
+
+ Options Options::withScrubber(Scrubber scrubber) const
+ {
+ return Options(fileOptions_, std::move(scrubber), reporter_, false, namer_);
+ }
+
+ std::shared_ptr<ApprovalNamer> Options::getNamer() const
+ {
+ return namer_;
+ }
+
+ Options Options::withNamer(std::shared_ptr<ApprovalNamer> namer)
+ {
+ return Options(
+ fileOptions_, scrubber_, reporter_, usingDefaultScrubber_, std::move(namer));
+ }
+}
+
+// ******************** From: FrameworkIntegrations.cpp
+
+namespace ApprovalTests
+{
+ void FrameworkIntegrations::setTestPassedNotification(
+ FileApprover::TestPassedNotification notification)
+ {
+ FileApprover::setTestPassedNotification(notification);
+ }
+
+ void FrameworkIntegrations::setCurrentTest(ApprovalTests::TestName* currentTest)
+ {
+ ApprovalTestNamer::currentTest(currentTest);
+ }
+}
+
+// ******************** From: GoogleConfiguration.cpp
+
+namespace ApprovalTests
+{
+ bool GoogleConfiguration::addTestCaseNameRedundancyCheck(
+ GoogleCustomizationsFactory::Comparator comparator)
+ {
+ return GoogleCustomizationsFactory::addTestCaseNameRedundancyCheck(comparator);
+ }
+
+ bool GoogleConfiguration::addIgnorableTestCaseNameSuffix(std::string suffix)
+ {
+ return addTestCaseNameRedundancyCheck(
+ createIgnorableTestCaseNameSuffixCheck(suffix));
+ }
+
+ GoogleCustomizationsFactory::Comparator
+ GoogleConfiguration::createIgnorableTestCaseNameSuffixCheck(const std::string& suffix)
+ {
+ return [suffix](std::string testFileNameWithExtension, std::string testCaseName) {
+ if (testCaseName.length() <= suffix.length() ||
+ !StringUtils::endsWith(testCaseName, suffix))
+ {
+ return false;
+ }
+
+ auto withoutSuffix =
+ testCaseName.substr(0, testCaseName.length() - suffix.length());
+ auto withFileExtension = withoutSuffix + ".";
+ return StringUtils::contains(testFileNameWithExtension, withFileExtension);
+ };
+ }
+}
+
+// ******************** From: GoogleCustomizationsFactory.cpp
+
+namespace ApprovalTests
+{
+ GoogleCustomizationsFactory::ComparatorContainer&
+ GoogleCustomizationsFactory::comparatorContainer()
+ {
+ static ComparatorContainer container;
+ if (container.empty())
+ {
+ auto exactNameMatching = [](const std::string& testFileNameWithExtension,
+ const std::string& testCaseName) {
+ return StringUtils::contains(testFileNameWithExtension,
+ testCaseName + ".");
+ };
+ container.push_back(exactNameMatching);
+ }
+ return container;
+ }
+
+ GoogleCustomizationsFactory::ComparatorContainer
+ GoogleCustomizationsFactory::getEquivalencyChecks()
+ {
+ return comparatorContainer();
+ }
+
+ bool GoogleCustomizationsFactory::addTestCaseNameRedundancyCheck(
+ const GoogleCustomizationsFactory::Comparator& comparator)
+ {
+ comparatorContainer().push_back(comparator);
+ return true;
+ }
+}
+
+// ******************** From: SystemLauncher.cpp
+
+namespace ApprovalTests
+{
+ SystemLauncher::SystemLauncher(bool isForeground, bool allowNonZeroExitCodes)
+ : isForeground_(isForeground), allowNonZeroExitCodes_(allowNonZeroExitCodes)
+ {
+ }
+
+ bool SystemLauncher::launch(const std::string& commandLine)
+ {
+ std::string launch = getCommandLine(commandLine);
+
+ SystemUtils::runSystemCommandOrThrow(launch, allowNonZeroExitCodes_);
+ return true;
+ }
+
+ void SystemLauncher::invokeForWindows(bool useWindows)
+ {
+ useWindows_ = useWindows;
+ }
+
+ void SystemLauncher::setForeground(bool foreground)
+ {
+ isForeground_ = foreground;
+ }
+
+ void SystemLauncher::setAllowNonZeroExitCodes(bool allow)
+ {
+ allowNonZeroExitCodes_ = allow;
+ }
+
+ bool SystemLauncher::isForeground() const
+ {
+ return isForeground_;
+ }
+
+ std::string SystemLauncher::getCommandLine(const std::string& commandLine) const
+ {
+ std::string launch = useWindows_
+ ? getWindowsCommandLine(commandLine, isForeground_)
+ : getUnixCommandLine(commandLine, isForeground_);
+ return launch;
+ }
+
+ std::string SystemLauncher::getWindowsCommandLine(const std::string& commandLine,
+ bool foreground) const
+ {
+ std::string launch = foreground
+ ? (std::string("cmd /S /C ") + "\"" + commandLine + "\"")
+ : ("start \"\" " + commandLine);
+
+ return launch;
+ }
+
+ std::string SystemLauncher::getUnixCommandLine(const std::string& commandLine,
+ bool foreground) const
+ {
+ std::string launch = foreground ? commandLine : (commandLine + " &");
+
+ return launch;
+ }
+}
+
+// ******************** From: ApprovalTestNamer.cpp
+
+#include <iostream>
+
+namespace ApprovalTests
+{
+ std::string TestName::directoryPrefix;
+ bool TestName::checkBuildConfig_ = true;
+
+ const std::string& TestName::getFileName() const
+ {
+ checkBuildConfiguration(fileName);
+ return fileName;
+ }
+
+ std::string TestName::getOriginalFileName()
+ {
+ return originalFileName;
+ }
+
+ void TestName::setFileName(const std::string& file)
+ {
+ originalFileName = file;
+ fileName = file.empty() ? handleBoostQuirks() : findFileName(file);
+ }
+
+ std::string TestName::findFileName(const std::string& file)
+ {
+ auto newFileName = checkParentDirectoriesForFile(file);
+ return SystemUtils::checkFilenameCase(newFileName);
+ }
+
+ std::string& TestName::rootDirectoryStorage()
+ {
+ // This method is needed to fix static initialisation order
+ static std::string rootDirectory;
+ return rootDirectory;
+ }
+
+ std::string TestName::checkParentDirectoriesForFile(const std::string& file)
+ {
+ auto newFileName = directoryPrefix + file;
+
+ if (!FileUtils::fileExists(newFileName))
+ {
+ // If the build system is Ninja, try looking several levels higher...
+ std::string backOne = ".." + SystemUtils::getDirectorySeparator();
+ std::string prefix;
+ for (int i = 0; i != 10; i++)
+ {
+ prefix += backOne;
+ auto candidateName = prefix + file;
+ if (FileUtils::fileExists(candidateName))
+ {
+ directoryPrefix = prefix;
+ return candidateName;
+ }
+ }
+ }
+ return newFileName;
+ }
+
+ bool TestName::registerRootDirectoryFromMainFile(const std::string& file)
+ {
+ std::cout << "TestName::registerRootDirectoryFromMainFile from __FILE__ " << file
+ << '\n';
+
+ if (file.empty())
+ {
+ throw std::runtime_error("Cannot register an empty path as root directory");
+ }
+
+ std::string adjustedPath = file;
+ std::cout << "TestName::registerRootDirectoryFromMainFile found parent "
+ << adjustedPath << '\n';
+
+ rootDirectoryStorage() = FileUtils::getDirectory(adjustedPath);
+ std::cout << "TestName::registerRootDirectoryFromMainFile result "
+ << rootDirectoryStorage() << '\n';
+
+ return true;
+ }
+
+ std::string TestName::getRootDirectory()
+ {
+ if (!rootDirectoryStorage().empty())
+ {
+ return rootDirectoryStorage();
+ }
+ else
+ {
+ throw std::runtime_error(HelpMessages::getUnconfiguredRootDirectory());
+ }
+ }
+
+ std::string TestName::handleBoostQuirks() const
+ {
+ return "";
+ }
+
+ void TestName::checkBuildConfiguration(const std::string& fileName)
+ {
+ if (checkBuildConfig_ && !FileUtils::fileExists(fileName))
+ {
+ throw std::runtime_error(getMisconfiguredBuildHelp(fileName));
+ }
+ }
+
+ std::string TestName::getMisconfiguredBuildHelp(const std::string& fileName)
+ {
+ return "\n\n" + HelpMessages::getMisconfiguredBuildHelp(fileName) + "\n\n";
+ }
+
+ std::string ApprovalTestNamer::getTestName() const
+ {
+ std::stringstream ext;
+ auto test = getCurrentTest();
+ for (size_t i = 0; i < test.sections.size(); i++)
+ {
+ if (0 < i)
+ {
+ ext << ".";
+ }
+ ext << test.sections[i];
+ }
+
+ return convertToFileName(ext.str());
+ }
+
+ std::string ApprovalTestNamer::convertToFileName(const std::string& fileName)
+ {
+ return FileNameSanitizerFactory::currentSanitizer(fileName);
+ }
+
+ TestName& ApprovalTestNamer::getCurrentTest()
+ {
+ try
+ {
+ return currentTest();
+ }
+ catch (const std::runtime_error&)
+ {
+ std::string helpMessage = getMisconfiguredMainHelp();
+ throw std::runtime_error(helpMessage);
+ }
+ }
+
+ std::string ApprovalTestNamer::getMisconfiguredMainHelp()
+ {
+ return "\n\n" + HelpMessages::getMisconfiguredMainHelp() + "\n\n";
+ }
+
+ std::string ApprovalTestNamer::getFileName() const
+ {
+ return getSourceFileName();
+ }
+
+ std::string ApprovalTestNamer::getSourceFileName() const
+ {
+ auto file = getCurrentTest().getFileName();
+ auto start = file.rfind(SystemUtils::getDirectorySeparator()) + 1;
+ auto end = file.rfind('.');
+ auto fileName = file.substr(start, end - start);
+ return convertToFileName(fileName);
+ }
+
+ std::string ApprovalTestNamer::getTestSourceDirectory() const
+ {
+ auto file = getCurrentTest().getFileName();
+ return FileUtils::getDirectory(file);
+ }
+
+ std::string ApprovalTestNamer::getRelativeTestSourceDirectory() const
+ {
+ // We are using the original directory - as obtained from __FILE__,
+ // as this seems to be consistent for relative paths, regardless of
+ // Ninja __FILE__ quirks
+ auto originalDir =
+ FileUtils::getDirectory(getCurrentTest().getOriginalFileName());
+ originalDir =
+ StringUtils::replaceAll(originalDir, TestName::getRootDirectory(), "");
+ return originalDir;
+ }
+
+ std::string ApprovalTestNamer::getApprovalsSubdirectory() const
+ {
+ std::string sub_directory;
+ if (!testConfiguration().subdirectory.empty())
+ {
+ sub_directory =
+ testConfiguration().subdirectory + SystemUtils::getDirectorySeparator();
+ }
+ return sub_directory;
+ }
+
+ std::string ApprovalTestNamer::getDirectory() const
+ {
+ std::string directory = getTestSourceDirectory();
+ std::string sub_directory = getApprovalsSubdirectory();
+ directory += sub_directory;
+ SystemUtils::ensureDirectoryExists(directory);
+ return directory;
+ }
+
+ TestName& ApprovalTestNamer::currentTest(TestName* value)
+ {
+ static TestName* staticValue;
+ if (value != nullptr)
+ {
+ staticValue = value;
+ }
+ if (staticValue == nullptr)
+ {
+ throw std::runtime_error("The variable in currentTest() is not initialised");
+ }
+ return *staticValue;
+ }
+
+ TestConfiguration& ApprovalTestNamer::testConfiguration()
+ {
+ static TestConfiguration configuration;
+ return configuration;
+ }
+
+ std::string ApprovalTestNamer::getApprovedFile(std::string extensionWithDot) const
+ {
+
+ return getFullFileName(".approved", extensionWithDot);
+ }
+
+ std::string ApprovalTestNamer::getReceivedFile(std::string extensionWithDot) const
+ {
+
+ return getFullFileName(".received", extensionWithDot);
+ }
+
+ std::string ApprovalTestNamer::getOutputFileBaseName() const
+ {
+ return getSourceFileName() + "." + getTestName();
+ }
+
+ std::string
+ ApprovalTestNamer::getFullFileName(const std::string& approved,
+ const std::string& extensionWithDot) const
+ {
+ std::stringstream ext;
+ ext << getDirectory() << getOutputFileBaseName() << approved << extensionWithDot;
+ return ext.str();
+ }
+
+ bool ApprovalTestNamer::setCheckBuildConfig(bool enabled)
+ {
+ auto previous = TestName::checkBuildConfig_;
+ TestName::checkBuildConfig_ = enabled;
+ return previous;
+ }
+}
+
+// ******************** From: DefaultNamerDisposer.cpp
+
+namespace ApprovalTests
+{
+ DefaultNamerDisposer::DefaultNamerDisposer(NamerCreator namerCreator)
+ {
+ previous_result = DefaultNamerFactory::getDefaultNamer();
+ DefaultNamerFactory::setDefaultNamer(std::move(namerCreator));
+ }
+
+ DefaultNamerDisposer::~DefaultNamerDisposer()
+ {
+ DefaultNamerFactory::setDefaultNamer(previous_result);
+ }
+}
+
+// ******************** From: DefaultNamerFactory.cpp
+
+namespace ApprovalTests
+{
+ NamerCreator& DefaultNamerFactory::defaultNamer()
+ {
+ static NamerCreator namer = []() {
+ return std::make_shared<ApprovalTestNamer>();
+ };
+ return namer;
+ }
+
+ NamerCreator DefaultNamerFactory::getDefaultNamer()
+ {
+ return defaultNamer();
+ }
+
+ void DefaultNamerFactory::setDefaultNamer(NamerCreator namer)
+ {
+ defaultNamer() = std::move(namer);
+ }
+}
+
+// ******************** From: ExistingFileNamer.cpp
+
+namespace ApprovalTests
+{
+ ExistingFileNamer::ExistingFileNamer(std::string filePath_, const Options& options)
+ : filePath(std::move(filePath_)), options_(options)
+ {
+ }
+
+ std::string ExistingFileNamer::getApprovedFile(std::string extensionWithDot) const
+ {
+ return options_.getNamer()->getApprovedFile(extensionWithDot);
+ }
+
+ std::string ExistingFileNamer::getReceivedFile(std::string) const
+ {
+ return filePath;
+ }
+}
+
+// ******************** From: FileNameSanitizerDisposer.cpp
+#include <sstream>
+
+namespace ApprovalTests
+{
+
+ FileNameSanitizerDisposer::FileNameSanitizerDisposer(FileNameSanitizer sanitizer)
+ {
+ previous_result = std::move(FileNameSanitizerFactory::currentSanitizer);
+ FileNameSanitizerFactory::currentSanitizer = std::move(sanitizer);
+ }
+
+ FileNameSanitizerDisposer::~FileNameSanitizerDisposer()
+ {
+ FileNameSanitizerFactory::currentSanitizer = std::move(previous_result);
+ }
+}
+
+// ******************** From: FileNameSanitizerFactory.cpp
+#include <sstream>
+namespace ApprovalTests
+{
+ bool FileNameSanitizerFactory::isForbidden(char c)
+ {
+ static std::string forbiddenChars("\\/:?\"<>|' ");
+ return std::string::npos != forbiddenChars.find(c);
+ }
+
+ std::string FileNameSanitizerFactory::defaultSanitizer(std::string fileName)
+ {
+ std::stringstream result;
+ for (auto ch : fileName)
+ {
+ if (!isForbidden(ch))
+ {
+ result << ch;
+ }
+ else
+ {
+ result << "_";
+ }
+ }
+ return result.str();
+ }
+
+ FileNameSanitizer FileNameSanitizerFactory::currentSanitizer =
+ FileNameSanitizerFactory::defaultSanitizer;
+
+}
+
+// ******************** From: HelpMessages.cpp
+
+#include <sstream>
+
+namespace ApprovalTests
+{
+
+ std::string HelpMessages::getMisconfiguredBuildHelp(const std::string& fileName)
+ {
+ std::string helpMessage = R"(* Welcome to Approval Tests.
+*
+* There seems to be a problem with your build configuration.
+* We cannot find the test source file at:
+* [fileName]
+*
+* For details on how to fix this, please visit:
+* https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/TroubleshootingMisconfiguredBuild.md
+*
+* For advanced users only:
+* If you believe you have reached this message in error, you can bypass
+* the check by calling ApprovalTestNamer::setCheckBuildConfig(false);
+)";
+ return StringUtils::replaceAll(
+ topAndTailHelpMessage(helpMessage), "[fileName]", fileName);
+ }
+
+ std::string HelpMessages::getMisconfiguredMainHelp()
+ {
+ std::string helpMessage = R"(* Welcome to Approval Tests.
+*
+* You have forgotten to configure your test framework for Approval Tests.
+*
+* To do this in Catch, add the following to your main.cpp:
+*
+* #define APPROVALS_CATCH
+* #include "ApprovalTests.hpp"
+*
+* To do this in Google Test, add the following to your main.cpp:
+*
+* #define APPROVALS_GOOGLETEST
+* #include "ApprovalTests.hpp"
+*
+* To do this in doctest, add the following to your main.cpp:
+*
+* #define APPROVALS_DOCTEST
+* #include "ApprovalTests.hpp"
+*
+* To do this in Boost.Test, add the following to your main.cpp:
+*
+* #define APPROVALS_BOOSTTEST
+* #include "ApprovalTests.hpp"
+*
+* To do this in CppUTest, add the following to your main.cpp:
+*
+* #define APPROVALS_CPPUTEST
+* #include "ApprovalTests.hpp"
+*
+* To do this in [Boost].UT, add the following to your main.cpp:
+*
+* #define APPROVALS_UT
+* #include "ApprovalTests.hpp"
+*
+* For more information, please visit:
+* https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/TroubleshootingMisconfiguredMain.md
+)";
+ return topAndTailHelpMessage(helpMessage);
+ }
+
+ std::string HelpMessages::getUnconfiguredRootDirectory()
+ {
+ std::string helpMessage = R"(* Hello from Approval Tests.
+*
+* It looks like your program is calling some code that requires knowledge of
+* the location of the main() in your source tree.
+*
+* To do this, add the following to your main.cpp file:
+*
+* APPROVAL_TESTS_REGISTER_MAIN_DIRECTORY
+*
+* Currently, this is only required if you are using TemplatedCustomNamer's
+* {RelativeTestSourceDirectory}.
+)";
+ return topAndTailHelpMessage(helpMessage);
+ }
+
+ std::string
+ HelpMessages::getUnknownEnvVarReporterHelp(const std::string& envVarName,
+ const std::string& selected,
+ const std::vector<std::string>& knowns)
+ {
+ std::string helpMessage =
+ R"(* The environment variable [envVarName] contains the value
+* [selected]
+*
+* This reporter is not recognised.
+*
+* Please unset the environment value, or change it to refer to one of the
+* known reporters:
+*
+[known]*
+* For more information, see:
+* https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/how_tos/SelectReporterWithEnvironmentVariable.md
+)";
+
+ return envVarErrorMessage(envVarName, selected, knowns, helpMessage);
+ }
+
+ std::string
+ HelpMessages::getInvalidEnvVarReporterHelp(const std::string& envVarName,
+ const std::string& selected,
+ const std::vector<std::string>& knowns)
+ {
+ std::string helpMessage =
+ R"(* The environment variable [envVarName] contains the value
+* [selected]
+*
+* This reporter is recognised, but cannot be found on this machine.
+*
+* Please unset the environment value, or change it to refer to a working
+* reporter:
+*
+[known]*
+* For more information, see:
+* https://github.com/approvals/ApprovalTests.cpp/blob/master/doc/how_tos/SelectReporterWithEnvironmentVariable.md
+)";
+
+ return envVarErrorMessage(envVarName, selected, knowns, helpMessage);
+ }
+
+ std::string HelpMessages::envVarErrorMessage(const std::string& envVarName,
+ const std::string& selected,
+ const std::vector<std::string>& knowns,
+ std::string& helpMessage)
+ {
+ std::stringstream ss;
+ for (auto& known : knowns)
+ {
+ ss << "* " << known << '\n';
+ }
+ helpMessage = StringUtils::replaceAll(helpMessage, "[selected]", selected);
+ helpMessage = StringUtils::replaceAll(helpMessage, "[envVarName]", envVarName);
+ return topAndTailHelpMessage(
+ StringUtils::replaceAll(helpMessage, "[known]", ss.str()));
+ }
+
+ std::string HelpMessages::topAndTailHelpMessage(const std::string& message)
+ {
+ const std::string lineBreak =
+ "**************************************************************"
+ "***************";
+ const std::string lineBuffer =
+ "* "
+ " *\n";
+ return lineBreak + '\n' + lineBuffer + message + lineBuffer + lineBreak;
+ }
+}
+
+// ******************** From: NamerFactory.cpp
+
+namespace ApprovalTests
+{
+ SectionNameDisposer
+ NamerFactory::appendToOutputFilename(const std::string& sectionName)
+ {
+ return SectionNameDisposer(ApprovalTestNamer::currentTest(), sectionName);
+ }
+}
+
+// ******************** From: SectionNameDisposer.cpp
+
+namespace ApprovalTests
+{
+ SectionNameDisposer::SectionNameDisposer(TestName& currentTest_,
+ const std::string& scope_name)
+ : currentTest(currentTest_)
+ {
+ // Add extra section to output filename, to allow multiple files
+ // to verified from a single test:
+ currentTest_.sections.push_back(scope_name);
+ }
+
+ SectionNameDisposer::~SectionNameDisposer()
+ {
+ // Remove the extra section we added in the constructor
+ currentTest.sections.pop_back();
+ }
+}
+
+// ******************** From: SeparateApprovedAndReceivedDirectoriesNamer.cpp
+
+namespace ApprovalTests
+{
+ // clang-format off
+ auto path = "{TestSourceDirectory}/{ApprovalsSubdirectory}/{ApprovedOrReceived}/{TestFileName}.{TestCaseName}.{FileExtension}";
+ // clang-format on
+ SeparateApprovedAndReceivedDirectoriesNamer::
+ SeparateApprovedAndReceivedDirectoriesNamer()
+ : TemplatedCustomNamer(path)
+ {
+ }
+
+ DefaultNamerDisposer SeparateApprovedAndReceivedDirectoriesNamer::useAsDefaultNamer()
+ {
+ return Approvals::useAsDefaultNamer([]() {
+ return std::make_shared<SeparateApprovedAndReceivedDirectoriesNamer>();
+ });
+ }
+}
+
+// ******************** From: SubdirectoryDisposer.cpp
+
+namespace ApprovalTests
+{
+ SubdirectoryDisposer::SubdirectoryDisposer(std::string subdirectory)
+ {
+ previous_result = ApprovalTestNamer::testConfiguration().subdirectory;
+ ApprovalTestNamer::testConfiguration().subdirectory = std::move(subdirectory);
+ }
+
+ SubdirectoryDisposer::~SubdirectoryDisposer()
+ {
+ ApprovalTestNamer::testConfiguration().subdirectory = previous_result;
+ }
+}
+
+// ******************** From: TemplatedCustomNamer.cpp
+
+#include <functional>
+#include <utility>
+
+namespace
+{
+ std::string replaceIfContains(std::string input,
+ std::string pattern,
+ std::function<std::string(void)> replacer)
+ {
+ if (!ApprovalTests::StringUtils::contains(input, pattern))
+ {
+ return input;
+ }
+ return ApprovalTests::StringUtils::replaceAll(input, pattern, replacer());
+ }
+}
+
+namespace ApprovalTests
+{
+ TemplatedCustomNamer::TemplatedCustomNamer(std::string templateString)
+ : template_(std::move(templateString))
+ {
+ if (!StringUtils::contains(template_, "{ApprovedOrReceived}"))
+ {
+ throw std::runtime_error(
+ "Template must contain `{ApprovedOrReceived}` or the received and "
+ "approved files will not be unique.\n"
+ "Template: " +
+ template_);
+ }
+ }
+
+ Path TemplatedCustomNamer::constructFromTemplate(
+ const std::string& extensionWithDot,
+ const std::string& approvedOrReceivedReplacement) const
+ {
+ std::string result = template_;
+ auto testSourceDirectory = "{TestSourceDirectory}";
+ auto relativeTestSourceDirectory = "{RelativeTestSourceDirectory}";
+ auto approvalsSubdirectory = "{ApprovalsSubdirectory}";
+ auto testFileName = "{TestFileName}";
+ auto testCaseName = "{TestCaseName}";
+ auto approvedOrReceived = "{ApprovedOrReceived}";
+ auto fileExtension = "{FileExtension}";
+
+ using namespace ApprovalTests;
+
+ // clang-format off
+ result = replaceIfContains(result, fileExtension, [&](){return extensionWithDot.substr(1);});
+ result = replaceIfContains(result, approvalsSubdirectory, [&](){return namer_.getApprovalsSubdirectory();});
+ result = replaceIfContains(result, relativeTestSourceDirectory, [&](){return namer_.getRelativeTestSourceDirectory();});
+ result = replaceIfContains(result, testFileName, [&](){return namer_.getSourceFileName();});
+ result = replaceIfContains(result, testCaseName, [&](){return namer_.getTestName();});
+ result = replaceIfContains(result, testSourceDirectory, [&](){return namer_.getTestSourceDirectory();});
+ result = replaceIfContains(result, approvedOrReceived, [&](){return approvedOrReceivedReplacement;});
+ // clang-format on
+
+ // Convert to native directory separators:
+ return Path(result);
+ }
+
+ std::string TemplatedCustomNamer::getApprovedFile(std::string extensionWithDot) const
+ {
+ return getApprovedFileAsPath(extensionWithDot).toString();
+ }
+
+ std::string TemplatedCustomNamer::getReceivedFile(std::string extensionWithDot) const
+ {
+ return getReceivedFileAsPath(extensionWithDot).toString();
+ }
+
+ Path TemplatedCustomNamer::getApprovedFileAsPath(std::string extensionWithDot) const
+ {
+ return constructFromTemplate(extensionWithDot, "approved");
+ }
+
+ Path TemplatedCustomNamer::getReceivedFileAsPath(std::string extensionWithDot) const
+ {
+ return constructFromTemplate(extensionWithDot, "received");
+ }
+
+ std::shared_ptr<TemplatedCustomNamer>
+ TemplatedCustomNamer::create(std::string templateString)
+ {
+ return std::make_shared<TemplatedCustomNamer>(templateString);
+ }
+
+ DefaultNamerDisposer
+ TemplatedCustomNamer::useAsDefaultNamer(std::string templateString)
+ {
+ return Approvals::useAsDefaultNamer([=]() { return create(templateString); });
+ }
+}
+
+// ******************** From: AutoApproveIfMissingReporter.cpp
+
+namespace ApprovalTests
+{
+ bool AutoApproveIfMissingReporter::report(std::string received,
+ std::string approved) const
+ {
+ if (FileUtils::fileExists(approved))
+ {
+ return false;
+ }
+
+ return AutoApproveReporter().report(received, approved);
+ }
+}
+
+// ******************** From: AutoApproveReporter.cpp
+
+#include <iostream>
+
+namespace ApprovalTests
+{
+ bool AutoApproveReporter::report(std::string received, std::string approved) const
+ {
+ std::cout << "file " << approved
+ << " automatically approved - next run should succeed\n";
+ FileUtilsSystemSpecific::copyFile(received, approved);
+ return true;
+ }
+}
+
+// ******************** From: BlockingReporter.cpp
+
+namespace ApprovalTests
+{
+ BlockingReporter::BlockingReporter(std::shared_ptr<Blocker> blocker_)
+ : blocker(std::move(blocker_))
+ {
+ }
+
+ std::shared_ptr<BlockingReporter>
+ BlockingReporter::onMachineNamed(const std::string& machineName)
+ {
+ auto machineBlocker =
+ std::make_shared<MachineBlocker>(MachineBlocker::onMachineNamed(machineName));
+ return std::make_shared<BlockingReporter>(machineBlocker);
+ }
+
+ std::shared_ptr<BlockingReporter>
+ BlockingReporter::onMachinesNotNamed(const std::string& machineName)
+ {
+ auto machineBlocker = std::make_shared<MachineBlocker>(
+ MachineBlocker::onMachinesNotNamed(machineName));
+ return std::make_shared<BlockingReporter>(machineBlocker);
+ }
+
+ bool BlockingReporter::report(std::string, std::string) const
+ {
+ return blocker->isBlockingOnThisMachine();
+ }
+}
+
+// ******************** From: CIBuildOnlyReporter.cpp
+
+namespace ApprovalTests
+{
+ CIBuildOnlyReporter::CIBuildOnlyReporter(std::shared_ptr<Reporter> reporter)
+ : m_reporter(reporter)
+ {
+ }
+
+ bool CIBuildOnlyReporter::report(std::string received, std::string approved) const
+ {
+ if (!isRunningUnderCI())
+ {
+ return false;
+ }
+ m_reporter->report(received, approved);
+ // Return true regardless of whether our report succeeded or not,
+ // so that no later reporters run.
+ return true;
+ }
+
+ bool CIBuildOnlyReporter::isRunningUnderCI()
+ {
+ /*
+ auto AppVeyor = {"CI", "APPVEYOR"}; // https://www.appveyor.com/docs/environment-variables/
+ auto AzurePipelines = {"TF_BUILD"}; // https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&viewFallbackFrom=vsts&tabs=yaml
+ auto GitHubActions = {"GITHUB_ACTIONS"}; // https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
+ auto GoCD = {"GO_SERVER_URL"}: // https://docs.gocd.org/current/faq/dev_use_current_revision_in_build.html
+ auto Jenkins = {"JENKINS_URL"}: // https://wiki.jenkins.io/display/JENKINS/Building+a+software+project
+ auto TeamCity = {"TEAMCITY_VERSION"}; // https://confluence.jetbrains.com/display/TCD18/Predefined+Build+Parameters
+ auto Travis = {"CI", "TRAVIS", "CONTINUOUS_INTEGRATION"}; // https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
+ auto environmentVariablesForCI = combine({
+ AppVeyor,
+ AzurePipelines,
+ GitHubActions,
+ GoCD
+ Jenkins,
+ TeamCity,
+ Travis,
+ });
+ */
+ auto environmentVariablesForCI = {
+ "CI",
+ "CONTINUOUS_INTEGRATION",
+ "GITHUB_ACTIONS",
+ "GO_SERVER_URL",
+ "JENKINS_URL",
+ "TEAMCITY_VERSION",
+ "TF_BUILD"
+ };
+ for (const auto& variable : environmentVariablesForCI)
+ {
+ if (!SystemUtils::safeGetEnv(variable).empty())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+// ******************** From: CIBuildOnlyReporterUtils.cpp
+
+namespace ApprovalTests
+{
+ FrontLoadedReporterDisposer CIBuildOnlyReporterUtils::useAsFrontLoadedReporter(
+ const std::shared_ptr<Reporter>& reporter)
+ {
+ return Approvals::useAsFrontLoadedReporter(
+ std::make_shared<ApprovalTests::CIBuildOnlyReporter>(reporter));
+ }
+}
+
+// ******************** From: ClipboardReporter.cpp
+
+namespace ApprovalTests
+{
+ std::string ClipboardReporter::getCommandLineFor(const std::string& received,
+ const std::string& approved,
+ bool isWindows)
+ {
+ if (isWindows)
+ {
+ return std::string("move /Y ") + "\"" + received + "\" \"" + approved + "\"";
+ }
+ else
+ {
+ return std::string("mv ") + "\"" + received + "\" \"" + approved + "\"";
+ }
+ }
+
+ bool ClipboardReporter::report(std::string received, std::string approved) const
+ {
+ copyToClipboard(
+ getCommandLineFor(received, approved, SystemUtils::isWindowsOs()));
+ return true;
+ }
+
+ void ClipboardReporter::copyToClipboard(const std::string& newClipboard)
+ {
+ /*
+ This will probably not work on Linux.
+
+ From https://stackoverflow.com/a/750466/104370
+ In case of X, yes, there's xclip (and others). xclip -selection c will send data to the clipboard that
+ works with Ctrl-C, Ctrl-V in most applications.
+
+ If you're trying to talk to the Mac OS X clipboard, there's pbcopy.
+
+ If you're in Linux terminal mode (no X) then maybe you need to look into gpm.
+
+ There's also GNU screen which has a clipboard. To put stuff in there, look at the screen command "readreg".
+
+ Under Windows/cygwin, use /dev/clipboard or clip for newer versions of Windows (at least Windows 10).
+ */
+
+ std::string clipboardCommand;
+ if (SystemUtils::isWindowsOs())
+ {
+ clipboardCommand = "clip";
+ }
+ else if (SystemUtils::isMacOs())
+ {
+ clipboardCommand = "pbcopy";
+ }
+ else
+ {
+ clipboardCommand = "pbclip";
+ }
+ auto cmd = std::string("echo ") + newClipboard + " | " + clipboardCommand;
+ SystemUtils::runSystemCommandOrThrow(cmd);
+ }
+}
+
+// ******************** From: CombinationReporter.cpp
+
+namespace ApprovalTests
+{
+ CombinationReporter::CombinationReporter(const std::vector<Reporter*>& theReporters)
+ {
+ for (auto r : theReporters)
+ {
+ reporters.push_back(std::unique_ptr<Reporter>(r));
+ }
+ }
+
+ bool CombinationReporter::report(std::string received, std::string approved) const
+ {
+ bool result = false;
+ for (auto& r : reporters)
+ {
+ result |= r->report(received, approved);
+ }
+ return result;
+ }
+}
+
+// ******************** From: CommandReporter.cpp
+
+namespace ApprovalTests
+{
+ std::string CommandReporter::assembleFullCommand(const std::string& received,
+ const std::string& approved) const
+ {
+ auto convertedCommand = '"' + converter->convertProgramForCygwin(cmd) + '"';
+ auto convertedReceived =
+ '"' + converter->convertFileArgumentForCygwin(received) + '"';
+ auto convertedApproved =
+ '"' + converter->convertFileArgumentForCygwin(approved) + '"';
+
+ std::string args;
+ args = StringUtils::replaceAll(
+ arguments, DiffInfo::receivedFileTemplate(), convertedReceived);
+ args = StringUtils::replaceAll(
+ args, DiffInfo::approvedFileTemplate(), convertedApproved);
+
+ return convertedCommand + ' ' + args;
+ }
+
+ CommandReporter::CommandReporter(std::string command, CommandLauncher* launcher)
+ : cmd(std::move(command)), l(launcher)
+ {
+ checkForCygwin();
+ }
+
+ CommandReporter::CommandReporter(std::string command,
+ std::string args,
+ CommandLauncher* launcher)
+ : cmd(std::move(command)), arguments(std::move(args)), l(launcher)
+ {
+ checkForCygwin();
+ }
+
+ bool CommandReporter::exists(const std::string& command)
+ {
+ bool foundByWhich = false;
+ if (!SystemUtils::isWindowsOs())
+ {
+ std::string which = "which " + command + " > /dev/null 2>&1";
+ int result = system(which.c_str());
+ foundByWhich = (result == 0);
+ }
+ return foundByWhich || FileUtils::fileExists(command);
+ }
+
+ bool CommandReporter::report(std::string received, std::string approved) const
+ {
+ if (!exists(cmd))
+ {
+ return false;
+ }
+ FileUtils::ensureFileExists(approved);
+ return l->launch(assembleFullCommand(received, approved));
+ }
+
+ std::string CommandReporter::getCommandLine(const std::string& received,
+ const std::string& approved) const
+ {
+ return l->getCommandLine(assembleFullCommand(received, approved));
+ }
+
+ void CommandReporter::checkForCygwin()
+ {
+ useCygwinConversions(SystemUtils::isCygwin());
+ }
+
+ void CommandReporter::useCygwinConversions(bool useCygwin)
+ {
+ if (useCygwin)
+ {
+ converter = std::make_shared<ConvertForCygwin>();
+ }
+ else
+ {
+ converter = std::make_shared<DoNothing>();
+ }
+ }
+}
+
+// ******************** From: ConvertForCygwin.cpp
+
+namespace ApprovalTests
+{
+ std::string ConvertForCygwin::convertProgramForCygwin(const std::string& filePath)
+ {
+ return "$(cygpath '" + filePath + "')";
+ }
+
+ std::string
+ ConvertForCygwin::convertFileArgumentForCygwin(const std::string& filePath)
+ {
+ return "$(cygpath -aw '" + filePath + "')";
+ }
+
+ std::string DoNothing::convertProgramForCygwin(const std::string& filePath)
+ {
+ return filePath;
+ }
+
+ std::string DoNothing::convertFileArgumentForCygwin(const std::string& filePath)
+ {
+ return filePath;
+ }
+}
+
+// ******************** From: CustomReporter.cpp
+
+namespace ApprovalTests
+{
+ std::shared_ptr<GenericDiffReporter> CustomReporter::create(std::string path,
+ Type type)
+ {
+ return create(std::move(path), DiffInfo::getDefaultArguments(), type);
+ }
+
+ std::shared_ptr<GenericDiffReporter>
+ CustomReporter::create(std::string path, std::string arguments, Type type)
+ {
+ DiffInfo info(std::move(path), std::move(arguments), type);
+ return std::make_shared<GenericDiffReporter>(info);
+ }
+
+ std::shared_ptr<GenericDiffReporter> CustomReporter::createForegroundReporter(
+ std::string path, Type type, bool allowNonZeroExitCodes)
+ {
+ return createForegroundReporter(std::move(path),
+ DiffInfo::getDefaultArguments(),
+ type,
+ allowNonZeroExitCodes);
+ }
+
+ std::shared_ptr<GenericDiffReporter> CustomReporter::createForegroundReporter(
+ std::string path, std::string arguments, Type type, bool allowNonZeroExitCodes)
+ {
+ DiffInfo info(std::move(path), std::move(arguments), type);
+ auto reporter = std::make_shared<GenericDiffReporter>(info);
+ reporter->launcher.setForeground(true);
+ reporter->launcher.setAllowNonZeroExitCodes(allowNonZeroExitCodes);
+ return reporter;
+ }
+}
+
+// ******************** From: DefaultFrontLoadedReporter.cpp
+
+namespace ApprovalTests
+{
+ DefaultFrontLoadedReporter::DefaultFrontLoadedReporter()
+ : FirstWorkingReporter({new CIBuildOnlyReporter()})
+ {
+ }
+}
+
+// ******************** From: DefaultReporter.cpp
+
+namespace ApprovalTests
+{
+ bool DefaultReporter::report(std::string received, std::string approved) const
+ {
+ return DefaultReporterFactory::getDefaultReporter()->report(received, approved);
+ }
+}
+
+// ******************** From: DefaultReporterDisposer.cpp
+
+namespace ApprovalTests
+{
+ DefaultReporterDisposer::DefaultReporterDisposer(
+ const std::shared_ptr<Reporter>& reporter)
+ {
+ previous_result = DefaultReporterFactory::getDefaultReporter();
+ DefaultReporterFactory::setDefaultReporter(reporter);
+ }
+
+ DefaultReporterDisposer::~DefaultReporterDisposer()
+ {
+ DefaultReporterFactory::setDefaultReporter(previous_result);
+ }
+}
+
+// ******************** From: DefaultReporterFactory.cpp
+
+namespace ApprovalTests
+{
+ std::shared_ptr<Reporter>& DefaultReporterFactory::defaultReporter()
+ {
+ static std::shared_ptr<Reporter> reporter = std::make_shared<DiffReporter>();
+ return reporter;
+ }
+
+ std::shared_ptr<Reporter> DefaultReporterFactory::getDefaultReporter()
+ {
+ return defaultReporter();
+ }
+
+ void
+ DefaultReporterFactory::setDefaultReporter(const std::shared_ptr<Reporter>& reporter)
+ {
+ defaultReporter() = reporter;
+ }
+}
+
+// ******************** From: DiffInfo.cpp
+
+namespace ApprovalTests
+{
+ std::string DiffInfo::receivedFileTemplate()
+ {
+ return "{Received}";
+ }
+
+ std::string DiffInfo::approvedFileTemplate()
+ {
+ return "{Approved}";
+ }
+
+ std::string DiffInfo::programFileTemplate()
+ {
+ return "{ProgramFiles}";
+ }
+
+ std::string DiffInfo::getDefaultArguments()
+ {
+ return receivedFileTemplate() + ' ' + approvedFileTemplate();
+ }
+
+ DiffInfo::DiffInfo(std::string program_, Type type_)
+ : program(std::move(program_)), arguments(getDefaultArguments()), type(type_)
+ {
+ }
+
+ DiffInfo::DiffInfo(std::string program_, std::string arguments_, Type type_)
+ : program(std::move(program_)), arguments(std::move(arguments_)), type(type_)
+ {
+ }
+
+ std::vector<std::string> DiffInfo::getProgramFileLocations()
+ {
+ std::vector<std::string> possibleWindowsPaths;
+ const std::vector<const char*> envVars = {
+ "ProgramFiles", "ProgramW6432", "ProgramFiles(x86)"};
+
+ for (const auto& envVar : envVars)
+ {
+ std::string envVarValue = SystemUtils::safeGetEnv(envVar);
+ if (!envVarValue.empty())
+ {
+ envVarValue += '\\';
+ possibleWindowsPaths.push_back(envVarValue);
+ }
+ }
+ return possibleWindowsPaths;
+ }
+
+ std::string DiffInfo::getProgramForOs() const
+ {
+ std::string result = program;
+ if (result.rfind(programFileTemplate(), 0) == 0)
+ {
+ std::vector<std::string> possibleWindowsPaths = getProgramFileLocations();
+ for (const auto& path : possibleWindowsPaths)
+ {
+ auto result1 =
+ StringUtils::replaceAll(result, programFileTemplate(), path);
+ if (FileUtils::fileExists(result1))
+ {
+ return result1;
+ }
+ }
+ }
+ return result;
+ }
+}
+
+// ******************** From: DiffPrograms.cpp
+
+///////////////////////////////////////////////////////////////////////////////
+#define APPROVAL_TESTS_MACROS_ENTRY(name, defaultValue) \
+ DiffInfo name() \
+ { \
+ return defaultValue; \
+ }
+///////////////////////////////////////////////////////////////////////////////
+
+namespace ApprovalTests
+{
+ namespace DiffPrograms
+ {
+
+ namespace Mac
+ {
+ APPROVAL_TESTS_MACROS_ENTRY(
+ DIFF_MERGE,
+ DiffInfo("/Applications/DiffMerge.app/Contents/MacOS/DiffMerge",
+ "{Received} {Approved} -nosplash",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ ARAXIS_MERGE,
+ DiffInfo("/Applications/Araxis Merge.app/Contents/Utilities/compare",
+ Type::TEXT_AND_IMAGE))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ BEYOND_COMPARE,
+ DiffInfo("/Applications/Beyond Compare.app/Contents/MacOS/bcomp",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ KALEIDOSCOPE,
+ DiffInfo("/Applications/Kaleidoscope.app/Contents/MacOS/ksdiff",
+ Type::TEXT_AND_IMAGE))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ SUBLIME_MERGE,
+ DiffInfo("/Applications/Sublime "
+ "Merge.app/Contents/SharedSupport/bin/smerge",
+ "mergetool --no-wait {Received} {Approved} -o {Approved}",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ KDIFF3,
+ DiffInfo("/Applications/kdiff3.app/Contents/MacOS/kdiff3",
+ "{Received} {Approved} -m -o {Approved}",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ P4MERGE,
+ DiffInfo("/Applications/p4merge.app/Contents/MacOS/p4merge",
+ Type::TEXT_AND_IMAGE))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ TK_DIFF,
+ DiffInfo("/Applications/TkDiff.app/Contents/MacOS/tkdiff", Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ VS_CODE,
+ DiffInfo("/Applications/Visual Studio "
+ "Code.app/Contents/Resources/app/bin/code",
+ "-d {Received} {Approved}",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(CLION,
+ DiffInfo("clion",
+ "nosplash diff {Received} {Approved}",
+ Type::TEXT))
+ }
+
+ namespace Linux
+ {
+ APPROVAL_TESTS_MACROS_ENTRY(
+ SUBLIME_MERGE_SNAP,
+ DiffInfo("/snap/bin/sublime-merge",
+ "mergetool --no-wait {Received} {Approved} -o {Approved}",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ SUBLIME_MERGE_FLATPAK,
+ DiffInfo("/var/lib/flatpak/exports/bin/com.sublimemerge.App",
+ "mergetool --no-wait {Received} {Approved} -o {Approved}",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ SUBLIME_MERGE_REPOSITORY_PACKAGE,
+ DiffInfo("smerge",
+ "mergetool --no-wait {Received} {Approved} -o {Approved}",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ SUBLIME_MERGE_DIRECT_DOWNLOAD,
+ DiffInfo("/opt/sublime_merge/sublime_merge",
+ "mergetool --no-wait {Received} {Approved} -o {Approved}",
+ Type::TEXT))
+
+ // More ideas available from: https://www.tecmint.com/best-linux-file-diff-tools-comparison/
+ APPROVAL_TESTS_MACROS_ENTRY(KDIFF3,
+ DiffInfo("kdiff3",
+ "{Received} {Approved} -m -o {Approved}",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(MELD, DiffInfo("meld", Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(BEYOND_COMPARE,
+ DiffInfo("bcompare", Type::TEXT_AND_IMAGE))
+ }
+
+ namespace Windows
+ {
+ APPROVAL_TESTS_MACROS_ENTRY(
+ BEYOND_COMPARE_3,
+ DiffInfo("{ProgramFiles}Beyond Compare 3\\BCompare.exe",
+ Type::TEXT_AND_IMAGE))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ BEYOND_COMPARE_4,
+ DiffInfo("{ProgramFiles}Beyond Compare 4\\BCompare.exe",
+ Type::TEXT_AND_IMAGE))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ TORTOISE_IMAGE_DIFF,
+ DiffInfo("{ProgramFiles}TortoiseSVN\\bin\\TortoiseIDiff.exe",
+ "/left:{Received} /right:{Approved}",
+ Type::IMAGE))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ TORTOISE_TEXT_DIFF,
+ DiffInfo("{ProgramFiles}TortoiseSVN\\bin\\TortoiseMerge.exe", Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ TORTOISE_GIT_IMAGE_DIFF,
+ DiffInfo("{ProgramFiles}TortoiseGit\\bin\\TortoiseGitIDiff.exe",
+ "/left:{Received} /right:{Approved}",
+ Type::IMAGE))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ TORTOISE_GIT_TEXT_DIFF,
+ DiffInfo("{ProgramFiles}TortoiseGit\\bin\\TortoiseGitMerge.exe",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(WIN_MERGE_REPORTER,
+ DiffInfo("{ProgramFiles}WinMerge\\WinMergeU.exe",
+ Type::TEXT_AND_IMAGE))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ ARAXIS_MERGE,
+ DiffInfo("{ProgramFiles}Araxis\\Araxis Merge\\Compare.exe",
+ Type::TEXT_AND_IMAGE))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ CODE_COMPARE,
+ DiffInfo("{ProgramFiles}Devart\\Code Compare\\CodeCompare.exe",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ SUBLIME_MERGE,
+ DiffInfo("{ProgramFiles}Sublime Merge\\smerge.exe",
+ "mergetool --no-wait {Received} {Approved} -o {Approved}",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(KDIFF3,
+ DiffInfo("{ProgramFiles}KDiff3\\bin\\kdiff3.exe",
+ "{Received} {Approved} -m -o {Approved}",
+ Type::TEXT))
+
+ APPROVAL_TESTS_MACROS_ENTRY(
+ VS_CODE,
+ DiffInfo("{ProgramFiles}Microsoft VS Code\\Code.exe",
+ "-d {Received} {Approved}",
+ Type::TEXT))
+ }
+
+ }
+}
+
+// ******************** From: DiffReporter.cpp
+
+
+namespace ApprovalTests
+{
+ DiffReporter::DiffReporter()
+ : FirstWorkingReporter({new EnvironmentVariableReporter(),
+ new Mac::MacDiffReporter(),
+ new Linux::LinuxDiffReporter(),
+ new Windows::WindowsDiffReporter()})
+ {
+ }
+}
+
+// ******************** From: EnvironmentVariableReporter.cpp
+
+namespace ApprovalTests
+{
+ bool EnvironmentVariableReporter::report(std::string received,
+ std::string approved) const
+ {
+ // Get the env var
+ const auto envVarName = environmentVariableName();
+ const auto envVar = SystemUtils::safeGetEnv(envVarName.c_str());
+ return report(envVar, received, approved);
+ }
+
+ bool EnvironmentVariableReporter::report(const std::string& envVar,
+ const std::string& received,
+ const std::string& approved) const
+ {
+ if (envVar.empty())
+ {
+ return false;
+ }
+
+ auto reporter = factory.createReporter(envVar);
+ auto known = factory.allSupportedReporterNames();
+
+ if (!reporter)
+ {
+ auto message = HelpMessages::getUnknownEnvVarReporterHelp(
+ EnvironmentVariableReporter::environmentVariableName(), envVar, known);
+ throw std::runtime_error(message);
+ }
+
+ auto reporter_worked = reporter->report(received, approved);
+
+ if (!reporter_worked)
+ {
+ auto message = HelpMessages::getInvalidEnvVarReporterHelp(
+ EnvironmentVariableReporter::environmentVariableName(), envVar, known);
+ throw std::runtime_error(message);
+ }
+
+ return reporter_worked;
+ }
+
+ std::string EnvironmentVariableReporter::environmentVariableName()
+ {
+ return "APPROVAL_TESTS_USE_REPORTER";
+ }
+}
+
+// ******************** From: FirstWorkingReporter.cpp
+
+namespace ApprovalTests
+{
+ FirstWorkingReporter::FirstWorkingReporter(const std::vector<Reporter*>& theReporters)
+ {
+ for (auto r : theReporters)
+ {
+ reporters.push_back(std::shared_ptr<Reporter>(r));
+ }
+ }
+
+ FirstWorkingReporter::FirstWorkingReporter(
+ const std::vector<std::shared_ptr<Reporter>>& reporters_)
+ {
+ this->reporters = reporters_;
+ }
+
+ bool FirstWorkingReporter::report(std::string received, std::string approved) const
+ {
+ for (auto& r : reporters)
+ {
+ if (r->report(received, approved))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+// ******************** From: FrontLoadedReporterDisposer.cpp
+
+namespace ApprovalTests
+{
+ FrontLoadedReporterDisposer::FrontLoadedReporterDisposer(
+ const std::shared_ptr<Reporter>& reporter)
+ {
+ previous_result = FrontLoadedReporterFactory::getFrontLoadedReporter();
+ FrontLoadedReporterFactory::setFrontLoadedReporter(reporter);
+ }
+
+ FrontLoadedReporterDisposer::~FrontLoadedReporterDisposer()
+ {
+ FrontLoadedReporterFactory::setFrontLoadedReporter(previous_result);
+ }
+}
+
+// ******************** From: FrontLoadedReporterFactory.cpp
+
+namespace ApprovalTests
+{
+ std::shared_ptr<Reporter>& FrontLoadedReporterFactory::frontLoadedReporter()
+ {
+ static std::shared_ptr<Reporter> reporter =
+ std::make_shared<DefaultFrontLoadedReporter>();
+ return reporter;
+ }
+
+ std::shared_ptr<Reporter> FrontLoadedReporterFactory::getFrontLoadedReporter()
+ {
+ return frontLoadedReporter();
+ }
+
+ void FrontLoadedReporterFactory::setFrontLoadedReporter(
+ const std::shared_ptr<Reporter>& reporter)
+ {
+ frontLoadedReporter() = reporter;
+ }
+}
+
+// ******************** From: GenericDiffReporter.cpp
+
+namespace ApprovalTests
+{
+ GenericDiffReporter::GenericDiffReporter(const std::string& program)
+ : CommandReporter(program, &launcher)
+ {
+ }
+
+ GenericDiffReporter::GenericDiffReporter(const DiffInfo& info)
+ : CommandReporter(info.getProgramForOs(), info.arguments, &launcher)
+ {
+ }
+}
+
+// ******************** From: LinuxReporters.cpp
+
+namespace ApprovalTests
+{
+ namespace Linux
+ {
+ SublimeMergeSnapReporter::SublimeMergeSnapReporter()
+ : GenericDiffReporter(DiffPrograms::Linux::SUBLIME_MERGE_SNAP())
+ {
+ launcher.setForeground(true);
+ }
+
+ SublimeMergeFlatpakReporter::SublimeMergeFlatpakReporter()
+ : GenericDiffReporter(DiffPrograms::Linux::SUBLIME_MERGE_FLATPAK())
+ {
+ launcher.setForeground(true);
+ }
+
+ SublimeMergeRepositoryPackageReporter::SublimeMergeRepositoryPackageReporter()
+ : GenericDiffReporter(DiffPrograms::Linux::SUBLIME_MERGE_REPOSITORY_PACKAGE())
+ {
+ launcher.setForeground(true);
+ }
+
+ SublimeMergeDirectDownloadReporter::SublimeMergeDirectDownloadReporter()
+ : GenericDiffReporter(DiffPrograms::Linux::SUBLIME_MERGE_DIRECT_DOWNLOAD())
+ {
+ launcher.setForeground(true);
+ }
+
+ SublimeMergeReporter::SublimeMergeReporter()
+ : FirstWorkingReporter({new SublimeMergeSnapReporter(),
+ new SublimeMergeFlatpakReporter(),
+ new SublimeMergeRepositoryPackageReporter(),
+ new SublimeMergeDirectDownloadReporter()})
+ {
+ }
+
+ KDiff3Reporter::KDiff3Reporter()
+ : GenericDiffReporter(DiffPrograms::Linux::KDIFF3())
+ {
+ }
+
+ MeldReporter::MeldReporter() : GenericDiffReporter(DiffPrograms::Linux::MELD())
+ {
+ }
+
+ BeyondCompareReporter::BeyondCompareReporter()
+ : GenericDiffReporter(DiffPrograms::Linux::BEYOND_COMPARE())
+ {
+ }
+
+ LinuxDiffReporter::LinuxDiffReporter()
+ : FirstWorkingReporter({
+ new BeyondCompareReporter(),
+ new MeldReporter(),
+ new SublimeMergeReporter(),
+ new KDiff3Reporter()
+ })
+ {
+ }
+ }
+}
+
+// ******************** From: MacReporters.cpp
+
+
+namespace ApprovalTests
+{
+ namespace Mac
+ {
+ DiffMergeReporter::DiffMergeReporter()
+ : GenericDiffReporter(DiffPrograms::Mac::DIFF_MERGE())
+ {
+ }
+
+ AraxisMergeReporter::AraxisMergeReporter()
+ : GenericDiffReporter(DiffPrograms::Mac::ARAXIS_MERGE())
+ {
+ }
+
+ VisualStudioCodeReporter::VisualStudioCodeReporter()
+ : GenericDiffReporter(DiffPrograms::Mac::VS_CODE())
+ {
+ }
+
+ BeyondCompareReporter::BeyondCompareReporter()
+ : GenericDiffReporter(DiffPrograms::Mac::BEYOND_COMPARE())
+ {
+ }
+
+ KaleidoscopeReporter::KaleidoscopeReporter()
+ : GenericDiffReporter(DiffPrograms::Mac::KALEIDOSCOPE())
+ {
+ }
+
+ SublimeMergeReporter::SublimeMergeReporter()
+ : GenericDiffReporter(DiffPrograms::Mac::SUBLIME_MERGE())
+ {
+ launcher.setForeground(true);
+ }
+
+ KDiff3Reporter::KDiff3Reporter()
+ : GenericDiffReporter(DiffPrograms::Mac::KDIFF3())
+ {
+ }
+
+ P4MergeReporter::P4MergeReporter()
+ : GenericDiffReporter(DiffPrograms::Mac::P4MERGE())
+ {
+ }
+ TkDiffReporter::TkDiffReporter()
+ : GenericDiffReporter(DiffPrograms::Mac::TK_DIFF())
+ {
+ }
+
+ CLionDiffReporter::CLionDiffReporter()
+ : GenericDiffReporter(DiffPrograms::Mac::CLION())
+ {
+ }
+
+ MacDiffReporter::MacDiffReporter()
+ : FirstWorkingReporter({
+ new AraxisMergeReporter(),
+ new BeyondCompareReporter(),
+ new DiffMergeReporter(),
+ new KaleidoscopeReporter(),
+ new P4MergeReporter(),
+ new SublimeMergeReporter(),
+ new KDiff3Reporter(),
+ new TkDiffReporter(),
+ new VisualStudioCodeReporter(),
+ new CLionDiffReporter()
+ })
+ {
+ }
+
+ bool MacDiffReporter::report(std::string received, std::string approved) const
+ {
+ if (!SystemUtils::isMacOs())
+ {
+ return false;
+ }
+ return FirstWorkingReporter::report(received, approved);
+ }
+ }
+}
+
+// ******************** From: QuietReporter.cpp
+
+namespace ApprovalTests
+{
+ bool QuietReporter::report(std::string, std::string) const
+ {
+ return true;
+ }
+}
+
+// ******************** From: ReporterFactory.cpp
+
+
+#include <map>
+#include <functional>
+
+#define APPROVAL_TESTS_REGISTER_REPORTER(name) \
+ map[#name] = []() { return std::unique_ptr<Reporter>(new name); }
+
+namespace ApprovalTests
+{
+
+ std::string getOsPrefix()
+ {
+ if (SystemUtils::isMacOs())
+ {
+ return "Mac::";
+ }
+
+ if (SystemUtils::isWindowsOs())
+ {
+ return "Windows::";
+ }
+
+ return "Linux::";
+ }
+
+ ReporterFactory::ReporterFactory() : map(createMap())
+ {
+ }
+
+ ReporterFactory::Reporters ReporterFactory::createMap()
+ {
+ Reporters map;
+
+ APPROVAL_TESTS_REGISTER_REPORTER(AutoApproveIfMissingReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(AutoApproveReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(CIBuildOnlyReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(ClipboardReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(DefaultFrontLoadedReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(DefaultReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(DiffReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(EnvironmentVariableReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(QuietReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(TextDiffReporter);
+
+ APPROVAL_TESTS_REGISTER_REPORTER(Linux::BeyondCompareReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Linux::MeldReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Linux::SublimeMergeReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Linux::KDiff3Reporter);
+
+ APPROVAL_TESTS_REGISTER_REPORTER(Mac::AraxisMergeReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Mac::BeyondCompareReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Mac::DiffMergeReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Mac::KaleidoscopeReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Mac::P4MergeReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Mac::SublimeMergeReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Mac::KDiff3Reporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Mac::TkDiffReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Mac::VisualStudioCodeReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Mac::CLionDiffReporter);
+
+ APPROVAL_TESTS_REGISTER_REPORTER(Windows::TortoiseDiffReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Windows::TortoiseGitDiffReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Windows::BeyondCompareReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Windows::WinMergeReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Windows::AraxisMergeReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Windows::CodeCompareReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Windows::SublimeMergeReporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Windows::KDiff3Reporter);
+ APPROVAL_TESTS_REGISTER_REPORTER(Windows::VisualStudioCodeReporter);
+
+ return map;
+ }
+
+ std::unique_ptr<Reporter>
+ ReporterFactory::createReporter(const std::string& reporterName) const
+ {
+ auto osPrefix = getOsPrefix();
+
+ auto key = findReporterName(osPrefix, reporterName);
+
+ if (!key.empty())
+ {
+ return map.at(key)();
+ }
+
+ return std::unique_ptr<Reporter>();
+ }
+
+ std::vector<std::string> ReporterFactory::allSupportedReporterNames() const
+ {
+ std::vector<std::string> result;
+
+ for (auto& p : map)
+ {
+ result.push_back(p.first);
+ }
+
+ return result;
+ }
+
+ std::string ReporterFactory::findReporterName(const std::string& osPrefix,
+ const std::string& reporterName) const
+ {
+ auto trimmedReporterName = StringUtils::trim(reporterName);
+ trimmedReporterName = StringUtils::toLower(trimmedReporterName);
+
+ std::vector<std::string> candidateNames = {
+ trimmedReporterName,
+ // Allow program names to be specified without Reporter suffix
+ trimmedReporterName + "reporter",
+ // Allow names without os namespace
+ StringUtils::toLower(osPrefix) + trimmedReporterName,
+ StringUtils::toLower(osPrefix) + trimmedReporterName + "reporter",
+ };
+
+ for (auto& candidateName : candidateNames)
+ {
+ auto iter = std::find_if(
+ map.begin(), map.end(), [&](const Reporters::value_type pair) {
+ return StringUtils::toLower(pair.first) == candidateName;
+ });
+
+ if (iter != map.end())
+ {
+ return iter->first;
+ }
+ }
+
+ return std::string{};
+ }
+}
+
+// ******************** From: TextDiffReporter.cpp
+
+#include <iostream>
+
+namespace ApprovalTests
+{
+ TextDiffReporter::TextDiffReporter() : TextDiffReporter(std::cout)
+ {
+ }
+
+ TextDiffReporter::TextDiffReporter(std::ostream& stream) : stream_(stream)
+ {
+ std::vector<std::shared_ptr<Reporter>> reporters = {
+ CustomReporter::createForegroundReporter("diff", Type::TEXT, true),
+ CustomReporter::createForegroundReporter(
+ "C:/Windows/System32/fc.exe", Type::TEXT_AND_IMAGE, true)};
+ m_reporter = std::unique_ptr<Reporter>(new FirstWorkingReporter(reporters));
+ }
+
+ bool TextDiffReporter::report(std::string received, std::string approved) const
+ {
+ stream_ << "Comparing files:" << std::endl;
+ stream_ << "received: " << received << std::endl;
+ stream_ << "approved: " << approved << std::endl;
+ const bool result = m_reporter->report(received, approved);
+ if (!result)
+ {
+ stream_ << "TextDiffReporter did not find a working diff "
+ "program\n\n";
+ }
+
+ return result;
+ }
+}
+
+// ******************** From: WindowsReporters.cpp
+
+
+namespace ApprovalTests
+{
+ namespace Windows
+ {
+ VisualStudioCodeReporter::VisualStudioCodeReporter()
+ : GenericDiffReporter(DiffPrograms::Windows::VS_CODE())
+ {
+ }
+
+ // ----------------------- Beyond Compare ----------------------------------
+ BeyondCompare3Reporter::BeyondCompare3Reporter()
+ : GenericDiffReporter(DiffPrograms::Windows::BEYOND_COMPARE_3())
+ {
+ }
+
+ BeyondCompare4Reporter::BeyondCompare4Reporter()
+ : GenericDiffReporter(DiffPrograms::Windows::BEYOND_COMPARE_4())
+ {
+ }
+
+ BeyondCompareReporter::BeyondCompareReporter()
+ : FirstWorkingReporter(
+ {new BeyondCompare4Reporter(), new BeyondCompare3Reporter()})
+ {
+ }
+
+ // ----------------------- Tortoise SVN ------------------------------------
+ TortoiseImageDiffReporter::TortoiseImageDiffReporter()
+ : GenericDiffReporter(DiffPrograms::Windows::TORTOISE_IMAGE_DIFF())
+ {
+ }
+
+ TortoiseTextDiffReporter::TortoiseTextDiffReporter()
+ : GenericDiffReporter(DiffPrograms::Windows::TORTOISE_TEXT_DIFF())
+ {
+ }
+
+ TortoiseDiffReporter::TortoiseDiffReporter()
+ : FirstWorkingReporter(
+ {new TortoiseTextDiffReporter(), new TortoiseImageDiffReporter()})
+ {
+ }
+
+ // ----------------------- Tortoise Git ------------------------------------
+ TortoiseGitTextDiffReporter::TortoiseGitTextDiffReporter()
+ : GenericDiffReporter(DiffPrograms::Windows::TORTOISE_GIT_TEXT_DIFF())
+ {
+ }
+
+ TortoiseGitImageDiffReporter::TortoiseGitImageDiffReporter()
+ : GenericDiffReporter(DiffPrograms::Windows::TORTOISE_GIT_IMAGE_DIFF())
+ {
+ }
+
+ TortoiseGitDiffReporter::TortoiseGitDiffReporter()
+ : FirstWorkingReporter(
+ {new TortoiseGitTextDiffReporter(), new TortoiseGitImageDiffReporter()})
+ {
+ }
+
+ // -------------------------------------------------------------------------
+ WinMergeReporter::WinMergeReporter()
+ : GenericDiffReporter(DiffPrograms::Windows::WIN_MERGE_REPORTER())
+ {
+ }
+
+ AraxisMergeReporter::AraxisMergeReporter()
+ : GenericDiffReporter(DiffPrograms::Windows::ARAXIS_MERGE())
+ {
+ }
+
+ CodeCompareReporter::CodeCompareReporter()
+ : GenericDiffReporter(DiffPrograms::Windows::CODE_COMPARE())
+ {
+ }
+
+ SublimeMergeReporter::SublimeMergeReporter()
+ : GenericDiffReporter(DiffPrograms::Windows::SUBLIME_MERGE())
+ {
+ launcher.setForeground(true);
+ }
+
+ KDiff3Reporter::KDiff3Reporter()
+ : GenericDiffReporter(DiffPrograms::Windows::KDIFF3())
+ {
+ }
+
+ WindowsDiffReporter::WindowsDiffReporter()
+ : FirstWorkingReporter({
+ new TortoiseDiffReporter(), // Note that this uses Tortoise SVN Diff
+ new TortoiseGitDiffReporter(),
+ new BeyondCompareReporter(),
+ new WinMergeReporter(),
+ new AraxisMergeReporter(),
+ new CodeCompareReporter(),
+ new SublimeMergeReporter(),
+ new KDiff3Reporter(),
+ new VisualStudioCodeReporter(),
+ })
+ {
+ }
+
+ bool WindowsDiffReporter::report(std::string received, std::string approved) const
+ {
+ if (!SystemUtils::isWindowsOs())
+ {
+ return false;
+ }
+ return FirstWorkingReporter::report(received, approved);
+ }
+ }
+}
+
+// ******************** From: Scrubbers.cpp
+
+#include <string>
+#include <functional>
+#include <regex>
+#include <map>
+
+namespace ApprovalTests
+{
+ namespace Scrubbers
+ {
+ std::string doNothing(const std::string& input)
+ {
+ return input;
+ }
+ std::string scrubRegex(const std::string& input,
+ const std::regex& regex,
+ const RegexReplacer& replaceFunction)
+ {
+ std::string result;
+ std::string remainder = input;
+ std::smatch m;
+ while (std::regex_search(remainder, m, regex))
+ {
+ auto match = m[0];
+ auto original_matched_text = match.str();
+ auto replacement = replaceFunction(match);
+ result += std::string(m.prefix()) + replacement;
+ remainder = m.suffix();
+ }
+ result += remainder;
+ return result;
+ }
+
+ Scrubber createRegexScrubber(const std::regex& regexPattern,
+ const RegexReplacer& replacer)
+ {
+ return [=](const std::string& input) {
+ return scrubRegex(input, regexPattern, replacer);
+ };
+ }
+
+ Scrubber createRegexScrubber(const std::regex& regexPattern,
+ const std::string& replacementText)
+ {
+ return createRegexScrubber(
+ regexPattern, [=](const RegexMatch&) { return replacementText; });
+ }
+
+ Scrubber createRegexScrubber(const std::string& regexString,
+ const std::string& replacementText)
+ {
+ if (regexString.empty())
+ {
+ return doNothing;
+ }
+ return createRegexScrubber(std::regex(regexString), replacementText);
+ }
+
+ std::string scrubGuid(const std::string& input)
+ {
+ static const std::regex regex("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-["
+ "0-9a-fA-F]{4}-[0-9a-fA-F]{12}");
+
+ int matchNumber = 0;
+ std::map<std::string, int> matchIndices;
+ return scrubRegex(input, regex, [&](const RegexMatch& m) {
+ auto guid_match = m.str();
+
+ if (matchIndices[guid_match] == 0)
+ {
+ matchIndices[guid_match] = ++matchNumber;
+ }
+ return "guid_" + std::to_string(matchIndices[guid_match]);
+ });
+ }
+ }
+}
+
+// ******************** From: DateUtils.cpp
+
+#include <sstream>
+#include <iomanip>
+
+namespace ApprovalTests
+{
+ std::tm
+ DateUtils::createTm(int year, int month, int day, int hour, int minute, int second)
+ {
+ std::tm timeinfo = tm();
+ timeinfo.tm_year = year - 1900;
+ timeinfo.tm_mon = month - 1;
+ timeinfo.tm_mday = day;
+ timeinfo.tm_hour = hour;
+ timeinfo.tm_min = minute;
+ timeinfo.tm_sec = second;
+ return timeinfo;
+ }
+
+ std::chrono::system_clock::time_point
+ DateUtils::createUtcDateTime(int year,
+ int month,
+ int day,
+ int hour,
+ int minute,
+ int second) // these are UTC values
+ {
+ tm timeinfo = createTm(year, month, day, hour, minute, second);
+ time_t tt = toUtc(timeinfo);
+ return std::chrono::system_clock::from_time_t(tt);
+ }
+
+ std::string DateUtils::toString(const std::chrono::system_clock::time_point& dateTime)
+ {
+ return toString(dateTime, "%a %Y-%m-%d %H:%M:%S UTC");
+ }
+
+ std::string DateUtils::toString(const std::chrono::system_clock::time_point& dateTime,
+ const std::string& format)
+ {
+ time_t tt = std::chrono::system_clock::to_time_t(dateTime);
+ tm tm_value = toUtc(tt);
+
+ return StringUtils::toString(std::put_time(&tm_value, format.c_str()));
+ }
+
+ time_t DateUtils::toUtc(std::tm& timeinfo)
+ {
+#ifdef _WIN32
+ std::time_t tt = _mkgmtime(&timeinfo);
+#else
+ time_t tt = timegm(&timeinfo);
+#endif
+ return tt;
+ }
+
+ tm DateUtils::toUtc(time_t& tt)
+ {
+#ifdef _MSC_VER // Visual Studio compiler
+ std::tm tm_value = {};
+ gmtime_s(&tm_value, &tt);
+#else
+ tm tm_value = *gmtime(&tt);
+#endif
+ return tm_value;
+ }
+}
+
+// ******************** From: EmptyFileCreatorByType.cpp
+
+namespace
+{
+ std::map<std::string, ApprovalTests::EmptyFileCreator>
+ defaultEmptyFileCreatorByTypeCreators()
+ {
+ std::map<std::string, ApprovalTests::EmptyFileCreator> creators;
+ ApprovalTests::EmptyFileCreator wibbleCreator = [](std::string fileName) {
+ ApprovalTests::StringWriter s("{}");
+ s.write(fileName);
+ };
+ creators[".json"] = wibbleCreator;
+ return creators;
+ }
+}
+
+namespace ApprovalTests
+{
+ std::map<std::string, ApprovalTests::EmptyFileCreator>
+ EmptyFileCreatorByType::creators_ = defaultEmptyFileCreatorByTypeCreators();
+
+ void EmptyFileCreatorByType::registerCreator(const std::string& extensionWithDot,
+ EmptyFileCreator creator)
+ {
+ creators_[extensionWithDot] = std::move(creator);
+ }
+
+ void EmptyFileCreatorByType::createFile(const std::string& fileName)
+ {
+ for (const auto& creator : creators_)
+ {
+ if (StringUtils::endsWith(fileName, creator.first))
+ {
+ creator.second(fileName);
+ return;
+ }
+ }
+ EmptyFileCreatorFactory::defaultCreator(fileName);
+ }
+}
+
+// ******************** From: EmptyFileCreatorDisposer.cpp
+#include <sstream>
+
+namespace ApprovalTests
+{
+
+ EmptyFileCreatorDisposer::EmptyFileCreatorDisposer(EmptyFileCreator creator)
+ {
+ previous_result = std::move(EmptyFileCreatorFactory::currentCreator);
+ EmptyFileCreatorFactory::currentCreator = std::move(creator);
+ }
+
+ EmptyFileCreatorDisposer::~EmptyFileCreatorDisposer()
+ {
+ EmptyFileCreatorFactory::currentCreator = std::move(previous_result);
+ }
+}
+
+// ******************** From: EmptyFileCreatorFactory.cpp
+namespace ApprovalTests
+{
+
+ void EmptyFileCreatorFactory::defaultCreator(std::string fullFilePath)
+ {
+ StringWriter s("", "");
+ s.write(fullFilePath);
+ }
+
+ EmptyFileCreator EmptyFileCreatorFactory::currentCreator =
+ EmptyFileCreatorByType::createFile;
+}
+
+// ******************** From: ExceptionCollector.cpp
+
+namespace ApprovalTests
+{
+ void ExceptionCollector::gather(std::function<void(void)> functionThatThrows)
+ {
+ try
+ {
+ functionThatThrows();
+ }
+ catch (const std::exception& e)
+ {
+ exceptionMessages.emplace_back(e.what());
+ }
+ }
+
+ ExceptionCollector::~ExceptionCollector()
+ {
+ if (!exceptionMessages.empty())
+ {
+ exceptionMessages.emplace_back("ERROR: Calling code forgot to call "
+ "exceptionCollector.release()");
+ }
+ release();
+ }
+
+ void ExceptionCollector::release()
+ {
+ if (!exceptionMessages.empty())
+ {
+ std::stringstream s;
+ s << exceptionMessages.size() << " exceptions were thrown:\n\n";
+ int count = 1;
+ for (const auto& error : exceptionMessages)
+ {
+ s << count++ << ") " << error << '\n';
+ }
+ exceptionMessages.clear();
+ throw std::runtime_error(s.str());
+ }
+ }
+}
+
+// ******************** From: FileUtils.cpp
+
+#include <fstream>
+#include <sys/stat.h>
+#include <sstream>
+
+namespace ApprovalTests
+{
+ bool FileUtils::fileExists(const std::string& path)
+ {
+ struct stat info
+ {
+ };
+ return stat(path.c_str(), &info) == 0;
+ }
+
+ int FileUtils::fileSize(const std::string& path)
+ {
+ struct stat statbuf
+ {
+ };
+ int stat_ok = stat(path.c_str(), &statbuf);
+
+ if (stat_ok == -1)
+ {
+ return -1;
+ }
+
+ return int(statbuf.st_size);
+ }
+
+ EmptyFileCreatorDisposer FileUtils::useEmptyFileCreator(EmptyFileCreator creator)
+ {
+ return EmptyFileCreatorDisposer(creator);
+ }
+
+ void FileUtils::ensureFileExists(const std::string& fullFilePath)
+ {
+ if (!fileExists(fullFilePath))
+ {
+ EmptyFileCreatorFactory::currentCreator(fullFilePath);
+ }
+ }
+
+ std::string FileUtils::getDirectory(const std::string& filePath)
+ {
+ auto end = filePath.rfind(SystemUtils::getDirectorySeparator()) + 1;
+ auto directory = filePath.substr(0, end);
+ return directory;
+ }
+
+ std::string FileUtils::getExtensionWithDot(const std::string& filePath)
+ {
+ std::size_t found = filePath.find_last_of('.');
+ return filePath.substr(found);
+ }
+
+ std::string FileUtils::readFileThrowIfMissing(const std::string& fileName)
+ {
+ std::ifstream in(fileName.c_str(), std::ios_base::in);
+ if (!in)
+ {
+ throw std::runtime_error("File does not exist: " + fileName);
+ }
+ std::stringstream written;
+ written << in.rdbuf();
+ in.close();
+
+ std::string text = written.str();
+ return text;
+ }
+
+ std::string FileUtils::readFileReturnEmptyIfMissing(const std::string& fileName)
+ {
+ if (FileUtils::fileExists(fileName))
+ {
+ return readFileThrowIfMissing(fileName);
+ }
+ else
+ {
+ return std::string();
+ }
+ }
+
+ void FileUtils::writeToFile(const std::string& filePath, const std::string& content)
+ {
+ std::ofstream out(filePath.c_str(), std::ios::binary | std::ofstream::out);
+ if (!out)
+ {
+ throw std::runtime_error("Unable to write file: " + filePath);
+ }
+ out << content;
+ }
+
+}
+
+// ******************** From: FileUtilsSystemSpecific.cpp
+
+namespace ApprovalTests
+{
+ std::string FileUtilsSystemSpecific::getCommandLineForCopy(
+ const std::string& source, const std::string& destination, bool isWindows)
+ {
+ if (isWindows)
+ {
+ return std::string("copy /Y ") + "\"" + source + "\" \"" + destination + "\"";
+ }
+ else
+ {
+ return std::string("cp ") + "\"" + source + "\" \"" + destination + "\"";
+ }
+ }
+
+ void FileUtilsSystemSpecific::copyFile(const std::string& source,
+ const std::string& destination)
+ {
+ auto cmd = getCommandLineForCopy(source, destination, SystemUtils::isWindowsOs());
+ SystemUtils::runSystemCommandOrThrow(cmd);
+ }
+}
+
+// ******************** From: Grid.cpp
+namespace ApprovalTests
+{
+ std::string Grid::print(int width,
+ int height,
+ std::function<void(int, int, std::ostream&)> printCell)
+ {
+ std::stringstream s;
+ for (int y = 0; y < height; ++y)
+ {
+ for (int x = 0; x < width; ++x)
+ {
+ printCell(x, y, s);
+ }
+ s << '\n';
+ }
+ return s.str();
+ }
+ std::string Grid::print(int width, int height, std::string text)
+ {
+ return print(
+ width, height, [&](int /*x*/, int /*y*/, std::ostream& os) { os << text; });
+ }
+}
+
+// ******************** From: MachineBlocker.cpp
+
+namespace ApprovalTests
+{
+ MachineBlocker::MachineBlocker(std::string machineName_, bool block_)
+ : machineName(std::move(machineName_)), block(block_)
+ {
+ }
+
+ MachineBlocker MachineBlocker::onMachineNamed(const std::string& machineName)
+ {
+ return MachineBlocker(machineName, true);
+ }
+
+ MachineBlocker MachineBlocker::onMachinesNotNamed(const std::string& machineName)
+ {
+ return MachineBlocker(machineName, false);
+ }
+
+ bool MachineBlocker::isBlockingOnThisMachine() const
+ {
+ const auto isMachine = (SystemUtils::getMachineName() == machineName);
+ return isMachine == block;
+ }
+}
+
+// ******************** From: MoreHelpMessages.cpp
+
+#include <iostream>
+
+namespace ApprovalTests
+{
+ void MoreHelpMessages::deprecatedFunctionCalled(const std::string& message,
+ const std::string& file,
+ int lineNumber)
+ {
+ std::cout << "\n***************** Deprecation Warning: ***************\n"
+ << "*\n"
+ << "* " << message << '\n'
+ << "*\n"
+ << "* Deprecated method:\n"
+ << "* " << file << ":" << lineNumber << '\n'
+ << "* Called from:\n"
+ << "* " << ApprovalTestNamer::getCurrentTest().getFileName() << '\n'
+ << "*\n"
+ << "******************************************************\n\n";
+ }
+}
+
+// ******************** From: Path.cpp
+
+namespace ApprovalTests
+{
+
+ Path::Path(const std::string& start) : path_(normalizeSeparators(start))
+ {
+ }
+
+ std::string Path::toString() const
+ {
+ return toString(separator_);
+ }
+
+ std::string Path::toString(const std::string& directoryPathSeparator) const
+ {
+ std::string path = removeRedundantDirectorySeparators(path_);
+
+ if (separator_ == directoryPathSeparator)
+ {
+ return path;
+ }
+ return StringUtils::replaceAll(path, separator_, directoryPathSeparator);
+ }
+
+ std::string Path::removeRedundantDirectorySeparators(std::string path) const
+ {
+ bool changed = true;
+ while (changed)
+ {
+ std::string reducePath = path;
+ reducePath = StringUtils::replaceAll(reducePath, "//", "/");
+ reducePath = StringUtils::replaceAll(reducePath, "\\\\", "\\");
+ changed = (reducePath != path);
+ path = reducePath;
+ };
+ return path;
+ }
+
+ Path Path::operator+(const std::string& addition) const
+ {
+ return Path(path_ + addition);
+ }
+
+ Path Path::operator/(const std::string& addition) const
+ {
+ auto first = path_;
+ if (StringUtils::endsWith(first, separator_))
+ {
+ first = first.substr(0, path_.size() - 1);
+ }
+
+ auto second = addition;
+ if (StringUtils::beginsWith(second, separator_))
+ {
+ second = second.substr(1);
+ }
+
+ return Path(first + separator_ + second);
+ }
+
+ Path Path::operator/(const Path addition) const
+ {
+ return *this / addition.path_;
+ }
+
+ std::string Path::normalizeSeparators(const std::string& path)
+ {
+ auto separator = SystemUtils::getDirectorySeparator();
+ auto otherSeparator = (separator == "/" ? "\\" : "/");
+ return StringUtils::replaceAll(path, otherSeparator, separator);
+ }
+}
+
+// ******************** From: StringUtils.cpp
+
+#include <cctype>
+
+namespace ApprovalTests
+{
+ APPROVAL_TESTS_NO_DISCARD
+ std::string StringUtils::replaceAll(std::string inText,
+ const std::string& find,
+ const std::string& replaceWith)
+ {
+ size_t start_pos = 0;
+ while ((start_pos = inText.find(find, start_pos)) != std::string::npos)
+ {
+ inText.replace(start_pos, find.length(), replaceWith);
+ start_pos +=
+ replaceWith.length(); // Handles case where 'to' is a substring of 'from'
+ }
+ return inText;
+ }
+
+ APPROVAL_TESTS_NO_DISCARD
+ bool StringUtils::contains(const std::string& inText, const std::string& find)
+ {
+ return inText.find(find, 0) != std::string::npos;
+ }
+
+ APPROVAL_TESTS_NO_DISCARD
+ std::string StringUtils::toLower(std::string inText)
+ {
+ std::string copy(inText);
+ std::transform(inText.begin(), inText.end(), copy.begin(), [](char c) {
+ return static_cast<char>(tolower(c));
+ });
+ return copy;
+ }
+
+ APPROVAL_TESTS_NO_DISCARD
+ bool StringUtils::beginsWith(std::string value, std::string beginning)
+ {
+ if (value.size() < beginning.size())
+ {
+ return false;
+ }
+ return std::equal(beginning.begin(), beginning.end(), value.begin());
+ }
+
+ APPROVAL_TESTS_NO_DISCARD
+ bool StringUtils::endsWith(std::string value, std::string ending)
+ {
+ if (value.size() < ending.size())
+ {
+ return false;
+ }
+ return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
+ }
+
+ APPROVAL_TESTS_NO_DISCARD
+ std::string StringUtils::leftTrim(std::string s)
+ {
+
+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
+ return !std::isspace(ch);
+ }));
+ return s;
+ }
+
+ APPROVAL_TESTS_NO_DISCARD
+ std::string StringUtils::rightTrim(std::string s)
+ {
+ s.erase(std::find_if(s.rbegin(),
+ s.rend(),
+ [](unsigned char ch) { return !std::isspace(ch); })
+ .base(),
+ s.end());
+ return s;
+ }
+
+ APPROVAL_TESTS_NO_DISCARD
+ std::string StringUtils::trim(std::string s)
+ {
+ s = leftTrim(s);
+ s = rightTrim(s);
+ return s;
+ }
+}
+
+// ******************** From: SystemUtils.cpp
+
+#include <sys/stat.h>
+
+namespace ApprovalTests
+{
+ bool SystemUtils::isWindowsOs()
+ {
+#ifdef _WIN32
+ return true;
+#else
+ return false;
+#endif
+ }
+
+ bool SystemUtils::isCygwin()
+ {
+#ifdef __CYGWIN__
+ return true;
+#else
+ return false;
+#endif
+ }
+
+ bool SystemUtils::isMacOs()
+ {
+#ifdef __APPLE__
+ return true;
+#else
+ return false;
+#endif
+ }
+ std::string SystemUtils::getDirectorySeparator()
+ {
+ return isWindowsOs() ? "\\" : "/";
+ }
+
+ std::string SystemUtils::checkFilenameCase(const std::string& fullPath)
+ {
+ if (!isWindowsOs() || !FileUtils::fileExists(fullPath))
+ {
+ return fullPath;
+ }
+#ifdef _WIN32
+
+ _finddata_t findFileData;
+ auto hFind = _findfirst(fullPath.c_str(), &findFileData);
+
+ if (hFind != -1)
+ {
+ const std::string fixedFilename = findFileData.name;
+ const std::string fixedPath = StringUtils::replaceAll(
+ fullPath, StringUtils::toLower(fixedFilename), fixedFilename);
+ _findclose(hFind);
+ return fixedPath;
+ }
+
+#endif
+ return fullPath;
+ }
+
+ std::string SystemUtils::safeGetEnvForWindows(const char* name)
+ {
+ APPROVAL_TESTS_UNUSED(name);
+#ifdef _WIN32
+ // We use getenv_s on Windows, as use of getenv there gives:
+ // warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead.
+ // To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
+
+ size_t size;
+ getenv_s(&size, nullptr, 0, name);
+
+ if (size != 0)
+ {
+ std::string result;
+ result.resize(size);
+ getenv_s(&size, &*result.begin(), size, name);
+ result.pop_back();
+ return result;
+ }
+#endif
+ return std::string();
+ }
+
+ std::string SystemUtils::safeGetEnvForNonWindows(const char* name)
+ {
+ APPROVAL_TESTS_UNUSED(name);
+ char* p = nullptr;
+#ifndef _WIN32
+ p = getenv(name);
+#endif
+ return (p != nullptr) ? p : std::string();
+ }
+
+ std::string SystemUtils::safeGetEnv(const char* name)
+ {
+ return isWindowsOs() ? safeGetEnvForWindows(name) : safeGetEnvForNonWindows(name);
+ }
+
+ std::string SystemUtils::getMachineName()
+ {
+ auto name = safeGetEnv("COMPUTERNAME");
+ if (!name.empty())
+ {
+ return name;
+ }
+
+ name = safeGetEnv("HOSTNAME");
+ if (!name.empty())
+ {
+ return name;
+ }
+
+ return "Unknown Computer";
+ }
+
+ void SystemUtils::makeDirectoryForWindows(const std::string& directory)
+ {
+ APPROVAL_TESTS_UNUSED(directory);
+#ifdef _WIN32
+ int nError = _mkdir(directory.c_str());
+ if (nError != 0)
+ {
+ std::string helpMessage =
+ std::string("Unable to create directory: ") + directory;
+ throw std::runtime_error(helpMessage);
+ }
+#endif
+ }
+
+ void SystemUtils::makeDirectoryForNonWindows(const std::string& directory)
+ {
+ APPROVAL_TESTS_UNUSED(directory);
+#ifndef _WIN32
+ mode_t nMode = 0733; // UNIX style permissions
+ int nError = mkdir(directory.c_str(), nMode);
+ if (nError != 0)
+ {
+ std::string helpMessage =
+ std::string("Unable to create directory: ") + directory;
+ throw std::runtime_error(helpMessage);
+ }
+#endif
+ }
+
+ void SystemUtils::makeDirectory(const std::string& directory)
+ {
+ makeDirectoryForWindows(directory);
+ makeDirectoryForNonWindows(directory);
+ }
+
+ void SystemUtils::ensureDirectoryExists(const std::string& fullDirectoryPath)
+ {
+ if (!FileUtils::fileExists(fullDirectoryPath))
+ {
+ makeDirectory(fullDirectoryPath);
+ }
+ }
+
+ void SystemUtils::ensureParentDirectoryExists(const std::string& fullFilePath)
+ {
+ const std::string parentDirectory = FileUtils::getDirectory(fullFilePath);
+ if (!parentDirectory.empty())
+ {
+ SystemUtils::ensureDirectoryExists(parentDirectory);
+ }
+ }
+
+ void SystemUtils::runSystemCommandOrThrow(const std::string& command,
+ bool allowNonZeroExitCodes)
+ {
+ int exitCode = system(command.c_str());
+
+ if (!allowNonZeroExitCodes && exitCode != 0)
+ {
+ throw std::runtime_error(command + ": failed with exit code " +
+ std::to_string(exitCode));
+ }
+ }
+}
+
+// ******************** From: ExistingFile.cpp
+
+namespace ApprovalTests
+{
+ std::string ExistingFile::scrub(std::string fileName, const Options& options)
+ {
+ if (options.isUsingDefaultScrubber())
+ {
+ return fileName;
+ }
+ auto content = FileUtils::readFileThrowIfMissing(fileName);
+ const auto scrubbedContent = options.scrub(content);
+ if (content == scrubbedContent)
+ {
+ deleteScrubbedFile = false;
+ return fileName;
+ }
+ else
+ {
+ std::size_t found = fileName.find_last_of('.');
+ auto fileExtension = fileName.substr(found);
+ std::string baseName = fileName.substr(0, found);
+
+ auto newFileName = baseName + ".scrubbed.received" + fileExtension;
+ FileUtils::writeToFile(newFileName, scrubbedContent);
+ deleteScrubbedFile = true;
+ return newFileName;
+ }
+ }
+
+ ExistingFile::ExistingFile(std::string filePath_, const Options& options)
+ : options_(options)
+ {
+ filePath = scrub(filePath_, options);
+ }
+
+ std::string ExistingFile::getFileExtensionWithDot() const
+ {
+ return FileUtils::getExtensionWithDot(filePath);
+ }
+
+ void ExistingFile::write(std::string) const
+ {
+ // do nothing
+ }
+
+ void ExistingFile::cleanUpReceived(std::string receivedPath) const
+ {
+ if (deleteScrubbedFile && (receivedPath == filePath))
+ {
+ remove(receivedPath.c_str());
+ }
+ }
+
+ ExistingFileNamer ExistingFile::getNamer()
+ {
+ return ExistingFileNamer(filePath, options_);
+ }
+}
+
+// ******************** From: StringWriter.cpp
+
+#include <utility>
+#include <fstream>
+
+namespace ApprovalTests
+{
+ StringWriter::StringWriter(std::string contents, std::string fileExtensionWithDot)
+ : s(std::move(contents)), ext(std::move(fileExtensionWithDot))
+ {
+ }
+
+ std::string StringWriter::getFileExtensionWithDot() const
+ {
+ return ext;
+ }
+
+ void StringWriter::write(std::string path) const
+ {
+ std::ofstream out(path.c_str(), std::ofstream::out);
+ if (!out)
+ {
+ throw std::runtime_error("Unable to write file: " + path);
+ }
+ this->Write(out);
+ out.close();
+ }
+
+ void StringWriter::Write(std::ostream& out) const
+ {
+ out << s << "\n";
+ }
+
+ void StringWriter::cleanUpReceived(std::string receivedPath) const
+ {
+ remove(receivedPath.c_str());
+ }
+}
+#endif // APPROVAL_TESTS_INCLUDE_CPPS
+
+#endif // APPROVAL_TESTS_CPP_APPROVALS_HPP
diff --git a/test/lib/CMakeLists.txt b/test/lib/CMakeLists.txt
new file mode 100644
index 0000000..af5f9f3
--- /dev/null
+++ b/test/lib/CMakeLists.txt
@@ -0,0 +1,6 @@
+if(NOT TARGET ApprovalTests)
+ set(LIB_NAME ApprovalTests)
+ add_library(${LIB_NAME} INTERFACE)
+ target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
+ add_library(${LIB_NAME}::${LIB_NAME} ALIAS ${LIB_NAME})
+endif()
diff --git a/test/run_test.sh b/test/run_test.sh
new file mode 100755
index 0000000..527775d
--- /dev/null
+++ b/test/run_test.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+source ./test/testfiles/prepare.sh
+
+cd build
+
+__image_prepare
+
+./test/docker-launcher-test
+./test/util/docker-launcher-util-test
+./test/Controller/docker-launcher-controller-test
+./test/Volumes/docker-launcher-volumes-test
+./test/Extension/docker-launcher-extensions-test
+
+lcov --rc lcov_branch_coverage=1 --capture --directory ./ --output-file generated.info
+lcov --remove generated.info */c++/* */jsoncpp/* */test/* */gmock/* */gtest/* -o generated.info
+genhtml generated.info --branch-coverage --output-directory result
diff --git a/test/testfiles/empty.json b/test/testfiles/empty.json
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/test/testfiles/empty.json
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/test/testfiles/invalid.json b/test/testfiles/invalid.json
new file mode 100644
index 0000000..13b7f07
--- /dev/null
+++ b/test/testfiles/invalid.json
@@ -0,0 +1 @@
+This file is for system unittest.
diff --git a/test/testfiles/lodev.img b/test/testfiles/lodev.img
new file mode 100644
index 0000000..cb5fccd
--- /dev/null
+++ b/test/testfiles/lodev.img
Binary files differ
diff --git a/test/testfiles/prepare.sh b/test/testfiles/prepare.sh
new file mode 100755
index 0000000..b4c282c
--- /dev/null
+++ b/test/testfiles/prepare.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+TESTFILE_IMG_DIR=./gen_testfiles/images
+TESTFILE_IMG_LABEL="BlockImageTest"
+TESTFILE_EXT4_IMG=$TESTFILE_IMG_DIR/blktest.ext4.img
+TESTFILE_F2FS_IMG=$TESTFILE_IMG_DIR/blktest.f2fs.img
+TESTFILE_BTRFS_IMG=$TESTFILE_IMG_DIR/blktest.btrfs.img
+
+function __create_images() {
+ mkdir -p $TESTFILE_IMG_DIR
+
+ if [ ! -f $TESTFILE_EXT4_IMG ]; then
+ dd if=/dev/zero of=$TESTFILE_EXT4_IMG bs=1M count=64
+ mkfs.ext4 -L $TESTFILE_IMG_LABEL $TESTFILE_EXT4_IMG
+ fi
+
+ if [ ! -f $TESTFILE_F2FS_IMG ]; then
+ dd if=/dev/zero of=$TESTFILE_F2FS_IMG bs=1M count=64
+ mkfs.f2fs $TESTFILE_F2FS_IMG -l $TESTFILE_IMG_LABEL
+ fi
+
+ if [ ! -f $TESTFILE_BTRFS_IMG ]; then
+ dd if=/dev/zero of=$TESTFILE_BTRFS_IMG bs=1M count=128
+ mkfs.btrfs $TESTFILE_BTRFS_IMG -L $TESTFILE_IMG_LABEL
+ fi
+}
+
+function __remove_images() {
+ if [ -f $TESTFILE_EXT4_IMG ]; then
+ rm $TESTFILE_EXT4_IMG
+ fi
+
+ if [ -f $TESTFILE_F2FS_IMG ]; then
+ rm $TESTFILE_F2FS_IMG
+ fi
+
+ if [ -f $TESTFILE_BTRFS_IMG ]; then
+ rm $TESTFILE_BTRFS_IMG
+ fi
+
+ rm -r $TESTFILE_IMG_DIR
+}
+
+function __image_prepare() {
+ echo ">>> generate block images"
+ echo ""
+
+ __remove_images > /dev/null
+ __create_images > /dev/null
+
+ echo ""
+ echo ">>> done"
+} \ No newline at end of file
diff --git a/test/testfiles/rpi4/hal/etc/docker/devices.json b/test/testfiles/rpi4/hal/etc/docker/devices.json
new file mode 100644
index 0000000..18751cd
--- /dev/null
+++ b/test/testfiles/rpi4/hal/etc/docker/devices.json
@@ -0,0 +1,34 @@
+{
+ "Devices": [
+ {
+ "PathOnHost": "/dev/i2c-0",
+ "PathInContainer": "/dev/i2c-0",
+ "CgroupPermissions": "rwm"
+ },
+ {
+ "PathOnHost": "/dev/i2c-1",
+ "PathInContainer": "/dev/i2c-1",
+ "CgroupPermissions": "rwm"
+ },
+ {
+ "PathOnHost": "/dev/i2c-10",
+ "PathInContainer": "/dev/i2c-10",
+ "CgroupPermissions": "rwm"
+ },
+ {
+ "PathOnHost": "/dev/i2c-20",
+ "PathInContainer": "/dev/i2c-20",
+ "CgroupPermissions": "rwm"
+ },
+ {
+ "PathOnHost": "/dev/i2c-21",
+ "PathInContainer": "/dev/i2c-21",
+ "CgroupPermissions": "rwm"
+ },
+ {
+ "PathOnHost": "/dev/i2c-22",
+ "PathInContainer": "/dev/i2c-22",
+ "CgroupPermissions": "rwm"
+ }
+ ]
+}
diff --git a/test/testfiles/rpi4/opt/data/container/list/config-tizen-headed.json b/test/testfiles/rpi4/opt/data/container/list/config-tizen-headed.json
new file mode 100644
index 0000000..59e7abe
--- /dev/null
+++ b/test/testfiles/rpi4/opt/data/container/list/config-tizen-headed.json
@@ -0,0 +1,5 @@
+{
+ "ContainerPath": "../test/testfiles/rpi4/opt/data/container/tizen-headed/configs/tizen-headed.json",
+ "ContainerName": "tizen-headed",
+ "Create": true
+} \ No newline at end of file
diff --git a/test/testfiles/rpi4/opt/data/container/tizen-headed/configs/seccomp-tizen.json b/test/testfiles/rpi4/opt/data/container/tizen-headed/configs/seccomp-tizen.json
new file mode 100644
index 0000000..1287099
--- /dev/null
+++ b/test/testfiles/rpi4/opt/data/container/tizen-headed/configs/seccomp-tizen.json
@@ -0,0 +1,842 @@
+{
+ "defaultAction": "SCMP_ACT_ERRNO",
+ "archMap": [
+ {
+ "architecture": "SCMP_ARCH_X86_64",
+ "subArchitectures": [
+ "SCMP_ARCH_X86",
+ "SCMP_ARCH_X32"
+ ]
+ },
+ {
+ "architecture": "SCMP_ARCH_AARCH64",
+ "subArchitectures": [
+ "SCMP_ARCH_ARM"
+ ]
+ },
+ {
+ "architecture": "SCMP_ARCH_MIPS64",
+ "subArchitectures": [
+ "SCMP_ARCH_MIPS",
+ "SCMP_ARCH_MIPS64N32"
+ ]
+ },
+ {
+ "architecture": "SCMP_ARCH_MIPS64N32",
+ "subArchitectures": [
+ "SCMP_ARCH_MIPS",
+ "SCMP_ARCH_MIPS64"
+ ]
+ },
+ {
+ "architecture": "SCMP_ARCH_MIPSEL64",
+ "subArchitectures": [
+ "SCMP_ARCH_MIPSEL",
+ "SCMP_ARCH_MIPSEL64N32"
+ ]
+ },
+ {
+ "architecture": "SCMP_ARCH_MIPSEL64N32",
+ "subArchitectures": [
+ "SCMP_ARCH_MIPSEL",
+ "SCMP_ARCH_MIPSEL64"
+ ]
+ },
+ {
+ "architecture": "SCMP_ARCH_S390X",
+ "subArchitectures": [
+ "SCMP_ARCH_S390"
+ ]
+ }
+ ],
+ "syscalls": [
+ {
+ "names": [
+ "accept",
+ "accept4",
+ "access",
+ "adjtimex",
+ "alarm",
+ "bind",
+ "brk",
+ "capget",
+ "capset",
+ "chdir",
+ "chmod",
+ "chown",
+ "chown32",
+ "clock_adjtime",
+ "clock_adjtime64",
+ "clock_getres",
+ "clock_getres_time64",
+ "clock_gettime",
+ "clock_gettime64",
+ "clock_nanosleep",
+ "clock_nanosleep_time64",
+ "close",
+ "close_range",
+ "connect",
+ "copy_file_range",
+ "creat",
+ "dup",
+ "dup2",
+ "dup3",
+ "epoll_create",
+ "epoll_create1",
+ "epoll_ctl",
+ "epoll_ctl_old",
+ "epoll_pwait",
+ "epoll_pwait2",
+ "epoll_wait",
+ "epoll_wait_old",
+ "eventfd",
+ "eventfd2",
+ "execve",
+ "execveat",
+ "exit",
+ "exit_group",
+ "faccessat",
+ "faccessat2",
+ "fadvise64",
+ "fadvise64_64",
+ "fallocate",
+ "fanotify_mark",
+ "fchdir",
+ "fchmod",
+ "fchmodat",
+ "fchown",
+ "fchown32",
+ "fchownat",
+ "fcntl",
+ "fcntl64",
+ "fdatasync",
+ "fgetxattr",
+ "flistxattr",
+ "flock",
+ "fork",
+ "fremovexattr",
+ "fsetxattr",
+ "fstat",
+ "fstat64",
+ "fstatat64",
+ "fstatfs",
+ "fstatfs64",
+ "fsync",
+ "ftruncate",
+ "ftruncate64",
+ "futex",
+ "futex_time64",
+ "futimesat",
+ "getcpu",
+ "getcwd",
+ "getdents",
+ "getdents64",
+ "getegid",
+ "getegid32",
+ "geteuid",
+ "geteuid32",
+ "getgid",
+ "getgid32",
+ "getgroups",
+ "getgroups32",
+ "getitimer",
+ "getpeername",
+ "getpgid",
+ "getpgrp",
+ "getpid",
+ "getppid",
+ "getpriority",
+ "getrandom",
+ "getresgid",
+ "getresgid32",
+ "getresuid",
+ "getresuid32",
+ "getrlimit",
+ "get_robust_list",
+ "getrusage",
+ "getsid",
+ "getsockname",
+ "getsockopt",
+ "get_thread_area",
+ "gettid",
+ "gettimeofday",
+ "getuid",
+ "getuid32",
+ "getxattr",
+ "inotify_add_watch",
+ "inotify_init",
+ "inotify_init1",
+ "inotify_rm_watch",
+ "io_cancel",
+ "ioctl",
+ "io_destroy",
+ "io_getevents",
+ "io_pgetevents",
+ "io_pgetevents_time64",
+ "ioprio_get",
+ "ioprio_set",
+ "io_setup",
+ "io_submit",
+ "io_uring_enter",
+ "io_uring_register",
+ "io_uring_setup",
+ "ipc",
+ "kill",
+ "lchown",
+ "lchown32",
+ "lgetxattr",
+ "link",
+ "linkat",
+ "listen",
+ "listxattr",
+ "llistxattr",
+ "_llseek",
+ "lremovexattr",
+ "lseek",
+ "lsetxattr",
+ "lstat",
+ "lstat64",
+ "madvise",
+ "membarrier",
+ "memfd_create",
+ "mincore",
+ "mkdir",
+ "mkdirat",
+ "mknod",
+ "mknodat",
+ "mlock",
+ "mlock2",
+ "mlockall",
+ "mmap",
+ "mmap2",
+ "mprotect",
+ "mq_getsetattr",
+ "mq_notify",
+ "mq_open",
+ "mq_timedreceive",
+ "mq_timedreceive_time64",
+ "mq_timedsend",
+ "mq_timedsend_time64",
+ "mq_unlink",
+ "mremap",
+ "msgctl",
+ "msgget",
+ "msgrcv",
+ "msgsnd",
+ "msync",
+ "munlock",
+ "munlockall",
+ "munmap",
+ "nanosleep",
+ "newfstatat",
+ "_newselect",
+ "open",
+ "openat",
+ "openat2",
+ "pause",
+ "pidfd_open",
+ "pidfd_send_signal",
+ "pipe",
+ "pipe2",
+ "poll",
+ "ppoll",
+ "ppoll_time64",
+ "prctl",
+ "pread64",
+ "preadv",
+ "preadv2",
+ "prlimit64",
+ "pselect6",
+ "pselect6_time64",
+ "pwrite64",
+ "pwritev",
+ "pwritev2",
+ "read",
+ "readahead",
+ "readlink",
+ "readlinkat",
+ "readv",
+ "recv",
+ "recvfrom",
+ "recvmmsg",
+ "recvmmsg_time64",
+ "recvmsg",
+ "remap_file_pages",
+ "removexattr",
+ "rename",
+ "renameat",
+ "renameat2",
+ "restart_syscall",
+ "rmdir",
+ "rseq",
+ "rt_sigaction",
+ "rt_sigpending",
+ "rt_sigprocmask",
+ "rt_sigqueueinfo",
+ "rt_sigreturn",
+ "rt_sigsuspend",
+ "rt_sigtimedwait",
+ "rt_sigtimedwait_time64",
+ "rt_tgsigqueueinfo",
+ "sched_getaffinity",
+ "sched_getattr",
+ "sched_getparam",
+ "sched_get_priority_max",
+ "sched_get_priority_min",
+ "sched_getscheduler",
+ "sched_rr_get_interval",
+ "sched_rr_get_interval_time64",
+ "sched_setaffinity",
+ "sched_setattr",
+ "sched_setparam",
+ "sched_setscheduler",
+ "sched_yield",
+ "seccomp",
+ "select",
+ "semctl",
+ "semget",
+ "semop",
+ "semtimedop",
+ "semtimedop_time64",
+ "send",
+ "sendfile",
+ "sendfile64",
+ "sendmmsg",
+ "sendmsg",
+ "sendto",
+ "setfsgid",
+ "setfsgid32",
+ "setfsuid",
+ "setfsuid32",
+ "setgid",
+ "setgid32",
+ "setgroups",
+ "setgroups32",
+ "setitimer",
+ "setpgid",
+ "setpriority",
+ "setregid",
+ "setregid32",
+ "setresgid",
+ "setresgid32",
+ "setresuid",
+ "setresuid32",
+ "setreuid",
+ "setreuid32",
+ "setrlimit",
+ "set_robust_list",
+ "setsid",
+ "setsockopt",
+ "set_thread_area",
+ "set_tid_address",
+ "setuid",
+ "setuid32",
+ "setxattr",
+ "shmat",
+ "shmctl",
+ "shmdt",
+ "shmget",
+ "shutdown",
+ "sigaltstack",
+ "signalfd",
+ "signalfd4",
+ "sigprocmask",
+ "sigreturn",
+ "socket",
+ "socketcall",
+ "socketpair",
+ "splice",
+ "stat",
+ "stat64",
+ "statfs",
+ "statfs64",
+ "statx",
+ "symlink",
+ "symlinkat",
+ "sync",
+ "sync_file_range",
+ "syncfs",
+ "sysinfo",
+ "tee",
+ "tgkill",
+ "time",
+ "timer_create",
+ "timer_delete",
+ "timer_getoverrun",
+ "timer_gettime",
+ "timer_gettime64",
+ "timer_settime",
+ "timer_settime64",
+ "timerfd_create",
+ "timerfd_gettime",
+ "timerfd_gettime64",
+ "timerfd_settime",
+ "timerfd_settime64",
+ "times",
+ "tkill",
+ "truncate",
+ "truncate64",
+ "ugetrlimit",
+ "umask",
+ "uname",
+ "unlink",
+ "unlinkat",
+ "utime",
+ "utimensat",
+ "utimensat_time64",
+ "utimes",
+ "vfork",
+ "vmsplice",
+ "wait4",
+ "waitid",
+ "waitpid",
+ "write",
+ "writev"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {},
+ "excludes": {}
+ },
+ {
+ "names": [
+ "process_vm_readv",
+ "process_vm_writev",
+ "ptrace"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": null,
+ "comment": "",
+ "includes": {
+ "minKernel": "4.8"
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "personality"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [
+ {
+ "index": 0,
+ "value": 0,
+ "op": "SCMP_CMP_EQ"
+ }
+ ],
+ "comment": "",
+ "includes": {},
+ "excludes": {}
+ },
+ {
+ "names": [
+ "personality"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [
+ {
+ "index": 0,
+ "value": 8,
+ "op": "SCMP_CMP_EQ"
+ }
+ ],
+ "comment": "",
+ "includes": {},
+ "excludes": {}
+ },
+ {
+ "names": [
+ "personality"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [
+ {
+ "index": 0,
+ "value": 131072,
+ "op": "SCMP_CMP_EQ"
+ }
+ ],
+ "comment": "",
+ "includes": {},
+ "excludes": {}
+ },
+ {
+ "names": [
+ "personality"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [
+ {
+ "index": 0,
+ "value": 131080,
+ "op": "SCMP_CMP_EQ"
+ }
+ ],
+ "comment": "",
+ "includes": {},
+ "excludes": {}
+ },
+ {
+ "names": [
+ "personality"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [
+ {
+ "index": 0,
+ "value": 4294967295,
+ "op": "SCMP_CMP_EQ"
+ }
+ ],
+ "comment": "",
+ "includes": {},
+ "excludes": {}
+ },
+ {
+ "names": [
+ "sync_file_range2"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "arches": [
+ "ppc64le"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "arm_fadvise64_64",
+ "arm_sync_file_range",
+ "sync_file_range2",
+ "breakpoint",
+ "cacheflush",
+ "set_tls"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "arches": [
+ "arm",
+ "arm64"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "arch_prctl"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "arches": [
+ "amd64",
+ "x32"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "modify_ldt"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "arches": [
+ "amd64",
+ "x32",
+ "x86"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "s390_pci_mmio_read",
+ "s390_pci_mmio_write",
+ "s390_runtime_instr"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "arches": [
+ "s390",
+ "s390x"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "open_by_handle_at"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_DAC_READ_SEARCH"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "bpf",
+ "clone",
+ "fanotify_init",
+ "fsconfig",
+ "fsmount",
+ "fsopen",
+ "fspick",
+ "lookup_dcookie",
+ "mount",
+ "move_mount",
+ "name_to_handle_at",
+ "open_tree",
+ "perf_event_open",
+ "quotactl",
+ "setdomainname",
+ "sethostname",
+ "setns",
+ "syslog",
+ "umount",
+ "umount2",
+ "unshare"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_ADMIN"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "clone"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [
+ {
+ "index": 0,
+ "value": 2114060288,
+ "op": "SCMP_CMP_MASKED_EQ"
+ }
+ ],
+ "comment": "",
+ "includes": {},
+ "excludes": {
+ "caps": [
+ "CAP_SYS_ADMIN"
+ ],
+ "arches": [
+ "s390",
+ "s390x"
+ ]
+ }
+ },
+ {
+ "names": [
+ "clone"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [
+ {
+ "index": 1,
+ "value": 2114060288,
+ "op": "SCMP_CMP_MASKED_EQ"
+ }
+ ],
+ "comment": "s390 parameter ordering for clone is different",
+ "includes": {
+ "arches": [
+ "s390",
+ "s390x"
+ ]
+ },
+ "excludes": {
+ "caps": [
+ "CAP_SYS_ADMIN"
+ ]
+ }
+ },
+ {
+ "names": [
+ "reboot"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_BOOT"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "chroot"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_CHROOT"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "delete_module",
+ "init_module",
+ "finit_module"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_MODULE"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "acct"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_PACCT"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "kcmp",
+ "pidfd_getfd",
+ "process_madvise",
+ "process_vm_readv",
+ "process_vm_writev",
+ "ptrace"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_PTRACE"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "iopl",
+ "ioperm"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_RAWIO"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "settimeofday",
+ "stime",
+ "clock_settime"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_TIME"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "vhangup"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_TTY_CONFIG"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "get_mempolicy",
+ "mbind",
+ "set_mempolicy"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_NICE"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names": [
+ "syslog"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYSLOG"
+ ]
+ },
+ "excludes": {}
+ },
+ {
+ "names" : [
+ "pivot_root"
+ ],
+ "action": "SCMP_ACT_ALLOW",
+ "args": [],
+ "comment": "",
+ "includes": {
+ "caps": [
+ "CAP_SYS_CHROOT"
+ ]
+ },
+ "excludes": {}
+ }
+ ]
+}
diff --git a/test/testfiles/rpi4/opt/data/container/tizen-headed/configs/tizen-headed.json b/test/testfiles/rpi4/opt/data/container/tizen-headed/configs/tizen-headed.json
new file mode 100644
index 0000000..ad9224a
--- /dev/null
+++ b/test/testfiles/rpi4/opt/data/container/tizen-headed/configs/tizen-headed.json
@@ -0,0 +1,123 @@
+{
+ "version": "2",
+ "rootpath": "../",
+ "services": {
+ "tizen-headed": {
+ "ImageName": "tizen-container",
+ "build": {
+ "dockerfile": "./Dockerfile.tizen",
+ "context": "./tizen-init.tar"
+ },
+ "SecurityOpt": "./configs/seccomp-tizen.json",
+ "NetworkMode": "host",
+ "Privileged": false,
+ "CgroupnsMode": "private",
+ "OpenStdin": true,
+ "Tty": true,
+ "StartOnBoot": false,
+ "environment": ["PS1=[container] \\u@\\h:\\w\\\\$ "],
+ "Labels": {
+ "tizen.version": "7.0",
+ "tizen.release": "0",
+ "tizen.profile": "headed"
+ },
+ "Devices": [
+ ["/dev/dri", "/dev/dri", "rwm", true],
+ ["/dev/uinput"],
+ ["/dev/rfkill", "/dev/rfkill"],
+ ["/dev/net/tun", "/dev/net/tun", ""],
+ ["invalid", "invalid", "rw", "invalid"],
+ ["invalid", "invalid", "rw", "invalid", "inval"],
+ "",
+ 1234,
+ { "PathOnHost": "foo" },
+ { "PathInContainer": "invalid" }
+ ],
+ "Binds": [
+ "/tmp",
+ "/tmp1:/test1",
+ "/tmp2:/test2:ro",
+ "/tmp3:/test3:rw",
+ "/tmp3:/test3:rw:1234"
+ ],
+ "DeviceCgroupRules": [
+ "c 226:* rw",
+ ["c", "*"],
+ ["c", "*", "*"],
+ ["b", "1", "*"],
+ ["t", "1", "*"],
+ ["c", "1", "4", "r"],
+ ["t", "1", "4", "r"],
+ { "invalid": "teset" }
+ ],
+ "AppendHalDevices": true,
+ "ExtConfigs": {
+ "volumes": ["rootfs", "sysdata", "user", "hal", "modules"],
+ "tizen": {
+ "crash_forward": true
+ },
+
+ "ttys": true,
+ "input": "host",
+ "audio": "host",
+ "dbus": "mixed",
+
+ "init": "ramdisk",
+ "ramdisk": {
+ "fwd_path": "/host"
+ },
+
+ "disable_cgroup_watchdog": true,
+ "crash_forward": [
+ "|/usr/bin/crash-manager",
+ "-E %E -p %p -u %u -g %g -s %s -t %t -i %i"
+ ]
+ }
+ }
+ },
+ "volumes": {
+ "rootfs": {
+ "driver": "loopdev",
+ "driver_opts": {
+ "file": "./images/rootfs.img",
+ "label": "contain-rootfs",
+ "size": "2GB",
+ "device_index": 1
+ }
+ },
+ "sysdata": {
+ "driver": "loopdev",
+ "driver_opts": {
+ "file": "./images/system-data.img",
+ "label": "contain-sysdata",
+ "size": "512MB",
+ "device_index": 2
+ }
+ },
+ "user": {
+ "driver": "loopdev",
+ "driver_opts": {
+ "file": "./images/user.img",
+ "label": "contain-user",
+ "size": "1.5GB",
+ "device_index": 3
+ }
+ },
+
+ "hal": {
+ "driver": "loopdev",
+ "driver_opts": {
+ "file": "./images/hal.img",
+ "label": "hal",
+ "size": "128MB",
+ "device_index": 4
+ }
+ },
+ "modules": {
+ "driver": "blkdev",
+ "driver_opts": {
+ "hostMountPoint": "/lib/modules"
+ }
+ }
+ }
+}
diff --git a/test/testfiles/rpi4/opt/data/container/tizen-headed/images/ramdisk.img b/test/testfiles/rpi4/opt/data/container/tizen-headed/images/ramdisk.img
new file mode 100644
index 0000000..0faa38e
--- /dev/null
+++ b/test/testfiles/rpi4/opt/data/container/tizen-headed/images/ramdisk.img
@@ -0,0 +1 @@
+ramdisk.img file for test \ No newline at end of file
diff --git a/unittest/pre/beluga/setup-adaptor/images/beluga-agent.tar b/test/testfiles/rpi4/opt/data/container/tizen-headed/tizen-init.tar
index fff923f..da274be 100755..100644
--- a/unittest/pre/beluga/setup-adaptor/images/beluga-agent.tar
+++ b/test/testfiles/rpi4/opt/data/container/tizen-headed/tizen-init.tar
Binary files differ
diff --git a/test/testfiles/system.testfile b/test/testfiles/system.testfile
new file mode 100644
index 0000000..13b7f07
--- /dev/null
+++ b/test/testfiles/system.testfile
@@ -0,0 +1 @@
+This file is for system unittest.
diff --git a/test/testfiles/testfile.txt b/test/testfiles/testfile.txt
new file mode 100644
index 0000000..d6029b0
--- /dev/null
+++ b/test/testfiles/testfile.txt
@@ -0,0 +1 @@
+This file is for container manager unittest.
diff --git a/test/testfiles/volume-test.json b/test/testfiles/volume-test.json
new file mode 100644
index 0000000..07e0ce7
--- /dev/null
+++ b/test/testfiles/volume-test.json
@@ -0,0 +1,46 @@
+{
+ "volumes": {
+ "looptest1": {
+ "driver": "loopdev",
+ "driver_opts": {
+ "file": "./gen_testfiles/images/lodev.test.img",
+ "label": "loopdev-test",
+ "size": 10000000,
+ "device_index": 20
+ }
+ },
+ "looptest2": {
+ "driver": "loopdev",
+ "driver_opts": {
+ "file": "./gen_testfiles/images/lodev.test.img",
+ "label": "loopdev-test",
+ "size": "10MB"
+ }
+ },
+ "looptest_invalid1": {
+ "driver": "loopdev",
+ "driver_opts": {
+ "filewrong": "./gen_testfiles/images/lodev.test.img",
+ "label.inval": "loopdev-test",
+ "size-str": "10MB",
+ "device_ind": 10
+ }
+ },
+ "looptest_invalid2": {
+ "driver": "loopdev",
+ "driver_opts": {
+ "file": 1234,
+ "label": 5678,
+ "size": "invliad size",
+ "device_index": 99999999999
+ }
+ },
+ "blktest": {
+ "driver": "blkdev",
+ "driver_opts": {
+ "hostMountPoint": "/",
+ "invalidopt": "ignore"
+ }
+ }
+ }
+}
diff --git a/test/util/CMakeLists.txt b/test/util/CMakeLists.txt
new file mode 100644
index 0000000..0e634f2
--- /dev/null
+++ b/test/util/CMakeLists.txt
@@ -0,0 +1,22 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(DOCKER_LAUNCHER_UTIL_TEST "docker-launcher-util-test")
+
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/ ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/util)
+FILE(GLOB DOCKER_LAUNCHER_UTIL_TEST_SRCS *.cpp)
+
+set(APPROVAL_MAIN ../googletest_approval_main.cpp)
+
+ADD_EXECUTABLE(${DOCKER_LAUNCHER_UTIL_TEST} ${APPROVAL_MAIN} ${DOCKER_LAUNCHER_UTIL_TEST_SRCS})
+
+TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER_UTIL_TEST}
+ PUBLIC
+ gtest
+ gtest_main
+ gmock
+ gmock_main
+ pthread
+ docker-launcher-static
+)
+
+ADD_TEST(NAME ${DOCKER_LAUNCHER_UTIL_TEST} COMMAND ${DOCKER_LAUNCHER_UTIL_TEST})
diff --git a/test/util/blkid-test.cpp b/test/util/blkid-test.cpp
new file mode 100644
index 0000000..cbe456e
--- /dev/null
+++ b/test/util/blkid-test.cpp
@@ -0,0 +1,54 @@
+#include "util/blkid.h"
+#include <gtest/gtest.h>
+
+using namespace testing;
+
+TEST(blkIDTest, invalidBlockTest)
+{
+ util::blkID blk;
+
+ blk = util::blkID("./invalid_path");
+ EXPECT_FALSE(blk.valid());
+ EXPECT_EQ(blk.getLabel(), "");
+ EXPECT_EQ(blk.getTypeString(), "");
+ EXPECT_EQ(blk.getType(), FS_TYPE_UNKNOWN);
+
+ blk = util::blkID("./gen_testfiles/images/testfile.txt");
+ EXPECT_FALSE(blk.valid());
+ EXPECT_EQ(blk.getLabel(), "");
+ EXPECT_EQ(blk.getTypeString(), "");
+ EXPECT_EQ(blk.getType(), FS_TYPE_UNKNOWN);
+}
+
+TEST(blkIDTest, ext4BlockImage)
+{
+ util::blkID blk;
+
+ blk = util::blkID("./gen_testfiles/images/blktest.ext4.img");
+ EXPECT_TRUE(blk.valid());
+ EXPECT_STREQ(blk.getLabel().c_str(), "BlockImageTest");
+ EXPECT_STREQ(blk.getTypeString().c_str(), "ext4");
+ EXPECT_EQ(blk.getType(), FS_TYPE_EXT4);
+}
+
+TEST(blkIDTest, f2fsBlockImage)
+{
+ util::blkID blk;
+
+ blk = util::blkID("./gen_testfiles/images/blktest.f2fs.img");
+ EXPECT_TRUE(blk.valid());
+ EXPECT_STREQ(blk.getLabel().c_str(), "BlockImageTest");
+ EXPECT_STREQ(blk.getTypeString().c_str(), "f2fs");
+ EXPECT_EQ(blk.getType(), FS_TYPE_F2FS);
+}
+
+TEST(blkIDTest, btrfsBlockImage)
+{
+ util::blkID blk;
+
+ blk = util::blkID("./gen_testfiles/images/blktest.btrfs.img");
+ EXPECT_TRUE(blk.valid());
+ EXPECT_STREQ(blk.getLabel().c_str(), "BlockImageTest");
+ EXPECT_STREQ(blk.getTypeString().c_str(), "btrfs");
+ EXPECT_EQ(blk.getType(), FS_TYPE_BTRFS);
+}
diff --git a/test/util/error-test.cpp b/test/util/error-test.cpp
new file mode 100644
index 0000000..bda0cfe
--- /dev/null
+++ b/test/util/error-test.cpp
@@ -0,0 +1,28 @@
+#include "util/error.h"
+#include <gtest/gtest.h>
+#include "../lib/ApprovalTests.hpp"
+
+static void execptionTestFunc()
+{
+ try {
+ try {
+ try {
+ throw "invalid exception";
+ }
+ throw_nested();
+ throw std::invalid_argument("test exception");
+ }
+ throw_nested()
+
+ } catch (std::exception &e) {
+ EXPECT_NO_THROW(__print_exception(e, 0));
+ } catch (...) {
+ return;
+ }
+ return;
+}
+TEST(ErrorTest, __print_exceptionTest)
+{
+ EXPECT_NO_THROW(__print_exception(std::invalid_argument("test exception"), 0));
+ EXPECT_NO_THROW(execptionTestFunc());
+}
diff --git a/test/util/jsontools-test.JsonToolsTest.parseFromFileTests.approved.txt b/test/util/jsontools-test.JsonToolsTest.parseFromFileTests.approved.txt
new file mode 100644
index 0000000..9da91a0
--- /dev/null
+++ b/test/util/jsontools-test.JsonToolsTest.parseFromFileTests.approved.txt
@@ -0,0 +1,5 @@
+{
+ "ContainerName" : "tizen-headed",
+ "ContainerPath" : "../test/testfiles/rpi4/opt/data/container/tizen-headed/configs/tizen-headed.json",
+ "Create" : true
+}
diff --git a/test/util/jsontools-test.JsonToolsTest.parseFromStringTests.approved.txt b/test/util/jsontools-test.JsonToolsTest.parseFromStringTests.approved.txt
new file mode 100644
index 0000000..9da91a0
--- /dev/null
+++ b/test/util/jsontools-test.JsonToolsTest.parseFromStringTests.approved.txt
@@ -0,0 +1,5 @@
+{
+ "ContainerName" : "tizen-headed",
+ "ContainerPath" : "../test/testfiles/rpi4/opt/data/container/tizen-headed/configs/tizen-headed.json",
+ "Create" : true
+}
diff --git a/test/util/jsontools-test.JsonToolsTest.writeToStringTests.approved.txt b/test/util/jsontools-test.JsonToolsTest.writeToStringTests.approved.txt
new file mode 100644
index 0000000..2e9cadd
--- /dev/null
+++ b/test/util/jsontools-test.JsonToolsTest.writeToStringTests.approved.txt
@@ -0,0 +1 @@
+{"ContainerName":"tizen-headed","ContainerPath":"../test/testfiles/rpi4/opt/data/container/tizen-headed/configs/tizen-headed.json","Create":true}
diff --git a/test/util/jsontools-test.cpp b/test/util/jsontools-test.cpp
new file mode 100644
index 0000000..68cc907
--- /dev/null
+++ b/test/util/jsontools-test.cpp
@@ -0,0 +1,34 @@
+#include "util/JsonTools.h"
+#include <gtest/gtest.h>
+
+#include "../lib/ApprovalTests.hpp"
+
+TEST(JsonToolsTest, parseFromFileTests)
+{
+ Json::Value root;
+ EXPECT_EQ(JsonTools::parseFromFile("../test/testfiles/invalid.json", &root), false);
+ EXPECT_EQ(JsonTools::parseFromFile("../test/testfiles/system.testfile", &root), false);
+ JsonTools::parseFromFile("../test/testfiles/rpi4/opt/data/container/list/config-tizen-headed.json", &root);
+ ApprovalTests::Approvals::verify(root);
+}
+
+TEST(JsonToolsTest, writeToStringTests)
+{
+ Json::Value root;
+ std::string json_string;
+ JsonTools::parseFromFile("../test/testfiles/rpi4/opt/data/container/list/config-tizen-headed.json", &root);
+ json_string = JsonTools::writeToString(root);
+ ApprovalTests::Approvals::verify(json_string);
+}
+
+TEST(JsonToolsTest, parseFromStringTests)
+{
+ Json::Value root, new_root;
+ std::string json_string;
+ JsonTools::parseFromFile("../test/testfiles/rpi4/opt/data/container/list/config-tizen-headed.json", &root);
+ json_string = JsonTools::writeToString(root);
+ EXPECT_EQ(JsonTools::parseFromString("", &new_root), true);
+ EXPECT_EQ(JsonTools::parseFromString("!@#$", &new_root), false);
+ JsonTools::parseFromString(json_string, &new_root);
+ ApprovalTests::Approvals::verify(new_root);
+}
diff --git a/test/util/system-test.cpp b/test/util/system-test.cpp
new file mode 100644
index 0000000..8864b3b
--- /dev/null
+++ b/test/util/system-test.cpp
@@ -0,0 +1,153 @@
+#include "util/system.h"
+#include <gtest/gtest.h>
+#include "../lib/ApprovalTests.hpp"
+
+using namespace testing;
+
+class systemTestSubProcess : public ::testing::Test
+{
+public:
+ void SetUp() override {}
+ void TearDown() override {}
+
+ const std::string invalidCmd = "invalidCommand";
+ const std::string testCmdRead = "/bin/cat";
+ const std::string testCmdWrite = "/bin/tee";
+ const std::string testPath = "../test/testfiles";
+ const std::string testFile = "system.testfile";
+ const std::string testFilePath = testPath + "/" + testFile;
+};
+
+TEST_F(systemTestSubProcess, basicArgsTest)
+{
+ const char *argTestCmd = "argtest";
+ const char *arg[] = {"test", "1234", "foo", "bar"};
+ const char *workdir = "workdir";
+
+ {
+ util::system::subprocess argTest(argTestCmd);
+ EXPECT_STREQ(argTest.cmd.c_str(), argTestCmd);
+ argTest.addArgs(arg[0]);
+ EXPECT_STREQ(argTest.args.c_str(), " test");
+ argTest.addArgs(arg[1]);
+ EXPECT_STREQ(argTest.args.c_str(), " test 1234");
+ std::vector<std::string> argv = {arg[2], arg[3]};
+ argTest.addArgs(argv);
+ EXPECT_STREQ(argTest.args.c_str(), " test 1234 foo bar");
+ argTest.setWorkDir(workdir);
+ EXPECT_STREQ(argTest.working_dir.c_str(), workdir);
+ }
+
+ {
+ util::system::subprocess argTest(argTestCmd, arg[0]);
+ EXPECT_STREQ(argTest.args.c_str(), " test");
+ std::vector<std::string> argv = {arg[1], arg[2], arg[3]};
+ argTest.addArgs(argv);
+ EXPECT_STREQ(argTest.args.c_str(), " test 1234 foo bar");
+ }
+
+ {
+ std::vector<std::string> argv = {arg[0], arg[1], arg[2], arg[3]};
+ util::system::subprocess argTest(argTestCmd, argv);
+ EXPECT_STREQ(argTest.args.c_str(), " test 1234 foo bar");
+ }
+}
+
+TEST_F(systemTestSubProcess, executeTest)
+{
+ EXPECT_NE(util::system::subprocess(invalidCmd).execute(), 0);
+ EXPECT_NE(util::system::subprocess(testFile).execute(), 0);
+
+ EXPECT_EQ(util::system::subprocess(testCmdRead, testFilePath).execute(), 0);
+ EXPECT_NE(util::system::subprocess(testCmdRead, invalidCmd).execute(), 0);
+ {
+ std::string result;
+ EXPECT_EQ(util::system::subprocess(testCmdRead, testFilePath).execute(result), 0);
+ ApprovalTests::Approvals::verify(result);
+ }
+ {
+ util::system::subprocess execTest(testCmdRead, testFile);
+ execTest.setWorkDir(testPath);
+ std::string result;
+ EXPECT_EQ(execTest.execute(result), 0);
+ ApprovalTests::Approvals::verify(result);
+ }
+}
+
+#include <stdio.h>
+TEST_F(systemTestSubProcess, pipeTest)
+{
+ std::array<char, 16> readBuffer;
+ {
+ EXPECT_EQ(util::system::subprocess(invalidCmd, testFilePath).close(), -1);
+ }
+
+ {
+ util::system::subprocess pipeCmd(invalidCmd, testFilePath);
+ FILE *f = pipeCmd.open();
+ EXPECT_NE(f, nullptr);
+ EXPECT_EQ(pipeCmd.close(), 0);
+ }
+
+ {
+ util::system::subprocess pipeCmd(testCmdRead, testFilePath);
+ FILE *f = pipeCmd.open("r");
+ ::fread(readBuffer.data(), 1, readBuffer.size(), f);
+ EXPECT_EQ(pipeCmd.close(), 0);
+ ApprovalTests::Approvals::verify(readBuffer.data());
+ }
+}
+
+TEST(systemCapabilityTest, hasCapTest)
+{
+ EXPECT_FALSE(util::system::has_cap(CAP_EFFECTIVE, CAP_SYS_ADMIN));
+ EXPECT_FALSE(util::system::has_cap(CAP_INHERITABLE, CAP_SYS_ADMIN));
+}
+
+class systemMountTest : public ::testing::Test
+{
+public:
+ void SetUp() override {}
+
+ void TearDown() override { std::filesystem::remove(mntTestDir); }
+
+ const std::filesystem::path mntTestDir = "./mntTestDir";
+ const std::filesystem::path mntTestFile = "./test/testfiles/testfile.txt";
+ const std::filesystem::path blkTestImg = "../test/testfiles/images/blktest.ext4.img";
+};
+
+TEST_F(systemMountTest, mountTest)
+{
+ util::system::Mount mntTest;
+
+ mntTest = util::system::Mount("./invalidSource", mntTestDir);
+ EXPECT_FALSE(mntTest.isMount());
+ EXPECT_EQ(mntTest.mount(), STATUS_FAIL);
+ EXPECT_EQ(mntTest.umount(), STATUS_IGNORE);
+
+ mntTest = util::system::Mount(mntTestFile, mntTestFile);
+ EXPECT_EQ(mntTest.mount(), STATUS_FAIL);
+ EXPECT_FALSE(mntTest.isMount());
+}
+
+TEST_F(systemMountTest, blockMountTest)
+{
+ util::system::Mount mntTest(blkTestImg, mntTestDir);
+
+ /*
+ * mount needs cap_sys_admin.
+ * test is executed in the user permission, this test is based on false return.
+ */
+ if (util::system::has_cap(CAP_EFFECTIVE, CAP_SYS_ADMIN) || util::system::has_cap(CAP_INHERITABLE, CAP_SYS_ADMIN)) {
+ EXPECT_EQ(mntTest.mount(), STATUS_OK);
+ EXPECT_TRUE(mntTest.isMount());
+ EXPECT_EQ(mntTest.mount(), STATUS_IGNORE);
+ EXPECT_EQ(mntTest.umount(), STATUS_OK);
+ EXPECT_FALSE(mntTest.isMount());
+ } else {
+ EXPECT_EQ(mntTest.mount(), STATUS_FAIL);
+ EXPECT_FALSE(mntTest.isMount());
+ EXPECT_EQ(mntTest.umount(), STATUS_IGNORE);
+ EXPECT_FALSE(mntTest.isMount());
+ }
+}
diff --git a/test/util/system-test.systemTestSubProcess.executeTest.approved.txt b/test/util/system-test.systemTestSubProcess.executeTest.approved.txt
new file mode 100644
index 0000000..335811c
--- /dev/null
+++ b/test/util/system-test.systemTestSubProcess.executeTest.approved.txt
@@ -0,0 +1,2 @@
+This file is for system unittest.
+
diff --git a/test/util/system-test.systemTestSubProcess.pipeTest.approved.txt b/test/util/system-test.systemTestSubProcess.pipeTest.approved.txt
new file mode 100644
index 0000000..a8b9b39
--- /dev/null
+++ b/test/util/system-test.systemTestSubProcess.pipeTest.approved.txt
@@ -0,0 +1 @@
+This file is for
diff --git a/test/util/util-test.cpp b/test/util/util-test.cpp
new file mode 100644
index 0000000..31f8ed4
--- /dev/null
+++ b/test/util/util-test.cpp
@@ -0,0 +1,79 @@
+#include "util/util.h"
+
+#include <gtest/gtest.h>
+
+TEST(UtilStringTest, ltrimTest)
+{
+ std::string testStr = "\n\t\r Test String \n\t\r";
+ std::string trimStr = "Test String \n\t\r";
+ EXPECT_EQ(util::string::ltrim(testStr), trimStr);
+}
+
+TEST(UtilStringTest, rtrimTest)
+{
+ std::string testStr = "\n\t\r Test String \n\t\r";
+ std::string trimStr = "\n\t\r Test String";
+ EXPECT_EQ(util::string::rtrim(testStr), trimStr);
+}
+
+TEST(UtilStringTest, trimTest)
+{
+ std::string testStr = "\n\t\r Test String \n\t\r";
+ std::string trimStr = "Test String";
+ EXPECT_EQ(util::string::trim(testStr), trimStr);
+}
+
+TEST(UtilStringTest, regexSplit)
+{
+ std::string testStr = "Test String : Test String2";
+ std::vector<std::string> splitStr = {"Test", "String", "Test", "String2"};
+ std::string delimiters = "\\s*:\\s*|\\s+";
+
+ std::vector<std::string> out = util::string::regexSplit(testStr, delimiters);
+
+ EXPECT_EQ(splitStr.size(), out.size());
+
+ for (unsigned int i = 0; i < out.size(); ++i) {
+ EXPECT_EQ(splitStr[i], out[i]);
+ }
+}
+
+TEST(UtilStringTest, split)
+{
+ std::string testStr = "Test String : Test String2";
+ std::pair<std::string, std::string> splitStr = {"Test String ", " Test String2"};
+ std::string delimiters = ":";
+
+ auto [a, b] = util::string::split(testStr, ':');
+
+ EXPECT_EQ(a, splitStr.first);
+ EXPECT_EQ(b, splitStr.second);
+
+ auto [c, d] = util::string::split(testStr, ',');
+ EXPECT_EQ(c, testStr);
+ EXPECT_EQ(d, std::string(""));
+}
+
+TEST(UtilConvertTest, convertByteSizeTest)
+{
+ EXPECT_EQ(util::convert::byteSize("2.5G"), 2500000000);
+ EXPECT_EQ(util::convert::byteSize("2.5GB"), 2500000000);
+ EXPECT_EQ(util::convert::byteSize("2.5GiB"), 2684354560);
+
+ EXPECT_EQ(util::convert::byteSize("2.5G", 512), 2500000256UL);
+ EXPECT_EQ(util::convert::byteSize("2.5GB", 512), 2500000256UL);
+ EXPECT_EQ(util::convert::byteSize("2.5GiB", 512), 2684355072UL);
+}
+
+TEST(UtilFileTeset, pathjoin)
+{
+ EXPECT_EQ(util::file::pathjoin("/abcd", "./efg"), std::filesystem::path("/abcd/efg"));
+ EXPECT_EQ(util::file::pathjoin("/abcd", "/efg"), std::filesystem::path("/abcd/efg"));
+ EXPECT_EQ(util::file::pathjoin("/abcd", "efg"), std::filesystem::path("/abcd/efg"));
+ EXPECT_EQ(util::file::pathjoin("/abcd", "../efg"), std::filesystem::path("/efg"));
+
+ EXPECT_EQ(util::file::pathjoin("abcd", "./efg"), std::filesystem::path("abcd/efg"));
+ EXPECT_EQ(util::file::pathjoin("abcd", "/efg"), std::filesystem::path("abcd/efg"));
+ EXPECT_EQ(util::file::pathjoin("abcd", "efg"), std::filesystem::path("abcd/efg"));
+ EXPECT_EQ(util::file::pathjoin("abcd", "../efg"), std::filesystem::path("efg"));
+}
diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt
index 9dda982..bcdbd04 100644
--- a/tool/CMakeLists.txt
+++ b/tool/CMakeLists.txt
@@ -1,17 +1,13 @@
-PROJECT (beluga-launcher-cli)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/util)
-SET(DOCKER_LAUNCHER_CLIENT_SERVER "dockerl")
-FILE(GLOB DOCKER_LAUNCHER_CLIENT_SERVER_SRCS *.c )
+SET(DOCKER_LAUNCHER_CLI "dlauncher")
+FILE(GLOB DOCKER_LAUNCHER_CLI_SRCS DockerLauncherCli.cpp )
-INCLUDE(FindPkgConfig)
-pkg_check_modules(project_pkgs REQUIRED dlog gio-2.0 glib-2.0 json-c)
+INCLUDE_DIRECTORIES(${pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${pkgs_LIBRARY_DIRS})
-INCLUDE_DIRECTORIES(${project_pkgs_INCLUDE_DIRS})
-LINK_DIRECTORIES(${project_pkgs_LIBRARY_DIRS})
+ADD_EXECUTABLE(${DOCKER_LAUNCHER_CLI} ${DOCKER_LAUNCHER_CLI_SRCS})
+TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER_CLI} ${pkgs_LIBRARIES})
-
-ADD_EXECUTABLE(${DOCKER_LAUNCHER_CLIENT_SERVER} ${DOCKER_LAUNCHER_CLIENT_SERVER_SRCS})
-TARGET_LINK_LIBRARIES(${DOCKER_LAUNCHER_CLIENT_SERVER} ${project_pkgs_LIBRARIES})
-INSTALL(TARGETS ${DOCKER_LAUNCHER_CLIENT_SERVER} DESTINATION ${BIN_INSTALL_DIR})
+INSTALL(TARGETS ${DOCKER_LAUNCHER_CLI} DESTINATION ${BIN_INSTALL_DIR}) \ No newline at end of file
diff --git a/tool/DockerLauncherCli.cpp b/tool/DockerLauncherCli.cpp
new file mode 100644
index 0000000..3f7b430
--- /dev/null
+++ b/tool/DockerLauncherCli.cpp
@@ -0,0 +1,155 @@
+/**
+ * @file DockerLauncherCli.cpp
+ * @brief command line tool to call API
+
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * This software is the confidential and proprietary information
+ * of Samsung Electronics, Inc. ("Confidential Information"). You
+ * shall not disclose such Confidential Information and shall use
+ * it only in accordance with the terms of the license agreement
+ * you entered into with Samsung.
+ */
+
+#include <arpa/inet.h>
+#include <iostream>
+#include <map>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <unistd.h>
+
+#include "internal_types.h"
+
+#include "util/error.h"
+#include "util/log.h"
+
+#include "util/JsonTools.h"
+
+#define MAXBUF 4096
+#define DLAUNCHER_SOCKET "/var/run/docker_launcher.sock"
+
+std::map<std::string, CLICommandType> __CLICmdTable = {
+ {"image_info", CLI_CMD_IMAGE_INFO},
+ {"container_info", CLI_CMD_CONTAINER_INFO},
+ {"build", CLI_CMD_IMAGE_BUILD},
+ {"load", CLI_CMD_IMAGE_LOAD},
+ {"create", CLI_CMD_CONTAINER_CREATE},
+ {"start", CLI_CMD_CONTAINER_START},
+ {"stop", CLI_CMD_CONTAINER_STOP},
+ {"purge", CLI_CMD_CONTAINER_PURGE},
+ {"is_running", CLI_CMD_CONTAINER_RUNNING},
+ {"update", CLI_CMD_CONTAINER_UPDATE},
+};
+
+CLICommandType parseCommand(const std::string &commandName)
+{
+ if (!__CLICmdTable.count(commandName))
+ return CLI_CMD_NONE;
+
+ return __CLICmdTable[commandName];
+}
+
+void dlauncherSendCommand(int sockfd, std::string &cmd, std::string &param)
+{
+ char buf_get[MAXBUF];
+ std::string msg = " ";
+ ssize_t read_len;
+ Json::Value root;
+
+ root["func"] = cmd;
+ root["param"] = param;
+ msg = JsonTools::writeToString(root);
+
+ if (write(sockfd, msg.c_str(), msg.length() + 1) < 0)
+ printf("containers info cmd write fail\n");
+
+ printf("(CLIENT->SERVER): %s\n", msg.c_str());
+
+ while (1) {
+
+ memset(buf_get, 0x00, MAXBUF);
+ read_len = read(sockfd, buf_get, MAXBUF - 1);
+ if (read_len > 0) {
+ //(TODO) print info more readable
+ buf_get[(unsigned int)read_len] = '\0';
+ printf("(SERVER->CLIENT)recv: %s\n", buf_get);
+ break;
+ }
+ }
+}
+
+void printHelp()
+{
+ printf("Usage : dlauncher COMMAND [OPTION]\n");
+ printf(" command option:\n");
+ printf(" image_info Display docker images information\n");
+ printf(" container_info Display docker containers information\n");
+ printf(" build imageName Build a new image \n");
+ printf(" load imageName Load a new image \n");
+ printf(" create containerName Create a new container \n");
+ printf(" start containerName Start container \n");
+ printf(" stop containerName Stop container \n");
+ printf(" is_running containerName check container running state \n");
+ printf(" purge containerName cleanup container/image\n");
+ printf(" update containerName Update container\n");
+}
+
+int main(int argc, char *argv[])
+{
+ int client_len;
+ int client_sockfd;
+ sockaddr_un clientaddr;
+ CLICommandType cmd_idx;
+
+ std::string cmd, param;
+
+ if (argc < 2) {
+ printHelp();
+ return 0;
+ }
+
+ cmd_idx = parseCommand(std::string(argv[1]));
+
+ if (cmd_idx == CLI_CMD_IMAGE_INFO || cmd_idx == CLI_CMD_CONTAINER_INFO) {
+
+ if (argc != 2) {
+ printHelp();
+ return 0;
+ }
+ param = "all";
+ } else {
+ if (argc != 3) {
+ printHelp();
+ return 0;
+ }
+ param = argv[2];
+ }
+ cmd = argv[1];
+
+ if (cmd_idx > CLI_CMD_NONE && cmd_idx < CLI_CMD_END) {
+
+ client_sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (client_sockfd == -1) {
+ printf("client error !!\n");
+ return -1;
+ }
+
+ bzero(&clientaddr, sizeof(clientaddr));
+ clientaddr.sun_family = AF_UNIX;
+ strncpy(clientaddr.sun_path, DLAUNCHER_SOCKET, std::string(DLAUNCHER_SOCKET).size());
+ client_len = sizeof(clientaddr);
+
+ if (connect(client_sockfd, (struct sockaddr *)&clientaddr, client_len) < 0) {
+ printf("client connect error !!\n");
+ return -1;
+ }
+
+ dlauncherSendCommand(client_sockfd, cmd, param);
+
+ close(client_sockfd);
+ } else {
+ printf("%s is not support\n", argv[1]);
+ printHelp();
+ }
+
+ return 0;
+}
diff --git a/tool/dockzen_launcher_cli.c b/tool/dockzen_launcher_cli.c
deleted file mode 100644
index 107d5db..0000000
--- a/tool/dockzen_launcher_cli.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/**
- * @file dockzen_launcher_cli.c
- * @brief command line tool to call API
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include "dzl_internal_types.h"
-#include "dockzen_launcher_json.h"
-
-
-#define MAXLINE 1024
-#define SERVER "/var/run/dockzen_launcher.sock"
-
-typedef struct stContainer_s
-{
- char containerID[128];
- char Image[128];
- char command[128];
- char status[128];
- char ports[128];
- char names[128];
-}stcontainer;
-
-
-int dockerl_info(int client_sockfd, char *cmd)
-{
- return 0;
-}
-
-
-void dockerl_create(int client_sockfd, char *cmd, int count, char *argv[])
-{
- char cmd_line[MAXLINE];
- char *cmd_line_ptr;
- char buf_get[MAXLINE];
- char buf_set[10];
- int i = 0;
-
- cmd_line_ptr = cmd_line;
-
- sprintf(cmd_line, "%s", cmd);
- cmd_line_ptr = cmd_line_ptr + strlen(cmd);
-
- for(i = 2; i<count; i++)
- {
- //printf("argv[%d] = %s, cmd_line=%s\n", i, argv[i], cmd_line);
- sprintf(cmd_line_ptr, " %s", argv[i]);
- cmd_line_ptr = cmd_line_ptr + strlen(argv[i]) + 1;
-
- }
-
- _D("client> %s\n", cmd_line);
-
- sprintf(buf_set, "%d ", strlen(cmd_line));
- write(client_sockfd, buf_set, strlen(buf_set));
- write(client_sockfd, cmd_line, strlen(cmd_line));
-
- _D("server read!!\n");
-
-#if 0
- while(1)
- {
- memset(buf_get, 0x00, MAXLINE);
- read(client_sockfd, buf_get, MAXLINE);
- printf("%s", buf_get);
-
- if(!strncmp(buf_get + (strlen(buf_get) - strlen("end")), "end", strlen("end")))
- {
- break;
- }
- }
-#endif
-
- return 0;
-
-}
-
-int dockerl_docker_info(int client_sockfd, char *cmd)
-{
- char buf_get[5012];
- char buf_set[MAXLINE];
- int i;
-
- sprintf(buf_set, "%d ", strlen(cmd));
- write(client_sockfd, buf_set, strlen(buf_set));
-
- sprintf(buf_set, "%s", cmd);
- write(client_sockfd, buf_set, strlen(buf_set));
-
- printf("client> %s\n", buf_set);
-
- printf("server read!!\n");
-
- while(1)
- {
- memset(buf_get, 0x00, MAXLINE);
- if(read(client_sockfd, buf_get, 5012) <= 0)
- {
- continue;
- }
-
- printf("data-> %s\n", buf_get);
-
- //if(!strncmp(buf_get + (strlen(buf_get) - strlen("end")), "end", strlen("end")))
- {
- break;
- }
-
- }
-
- return 0;
-
-}
-
-
-int getStringSize(char * buf)
-{
- int size;
- int i = 0;
-
- size = strlen(buf);
-
- for(i = 0; i<size; i++)
- {
- if(buf[i] == ' ')
- break;
- }
- i++;
-
- return strlen(buf+i);
-
-}
-
-void dockerl_containersInfo(int client_sockfd, char *cmd)
-{
- char buf_get[MAXLINE];
- char buf_set[MAXLINE];
- stcontainer container;
- int size = 0;
- int i = 0;
- int string_size;
- int command_size;
- int buf_size = 0;
- int buf_size_length;
- int read_size;
-
- sprintf(buf_set, "{\"Cmd\":\"%s\"}", cmd);
- write(client_sockfd, buf_set, strlen(buf_set));
-
- printf("client> %s\n", buf_set);
-
- printf("server read!!!\n");
-
- //memset(buf_get, 0x00, MAXLINE);
- buf_get[MAXLINE-1] = '\0';
-
- while(1)
- {
- if(read(client_sockfd, buf_get, MAXLINE) <= 0)
- {
- continue;
- }
-
- printf("SERVER-> %s", buf_get);
-#if 0
- while(1)
- {
- if(read(client_sockfd, buf_get, MAXLINE) <=0)
- break;
-
- printf("%s", buf_get);
- }
-#if 0
- string_size = atoi(buf_get);
- command_size = getStringSize(buf_get);
- buf_size = strlen(buf_get);
- buf_size_length = buf_size - command_size;
-
- printf("string_size = %d, command_size = %d, buf_size = %d\n", string_size, command_size, buf_size);
- printf("%s", buf_get + buf_size_length);
-
- while(1)
- {
- if(command_size > MAXLINE)
- command_size = MAXLINE - buf_size_length;
-
- if(command_size >= string_size)
- break;
-
- read_size = read(client_sockfd, buf_get, MAXLINE);
- command_size += read_size;
- printf("buf_size = %d\n", read_size);
- printf("%s", buf_get);
- }
-#endif
-#endif
- printf("\n");
-
- break;
- }
-
- return 0;
-
-}
-
-void dockerl_restartContainer(int client_sockfd, char * cmd, char *containerID)
-{
- char buf_get[MAXLINE];
- char cmd_line[MAXLINE];
-
- printf("client> %s, containerid = %s\n", cmd, containerID);
-
- sprintf(cmd_line, "%s %s", cmd, containerID);
-
- printf("cmd_line = %s\n", cmd_line);
-
- write(client_sockfd, cmd_line, strlen(cmd_line));
-
- while(1)
- {
- memset(buf_get, 0x00, MAXLINE);
- read(client_sockfd, buf_get, MAXLINE);
- printf("%s", buf_get);
-
- if(!strncmp(buf_get + (strlen(buf_get) - strlen("end")), "end", strlen("end")))
- {
- break;
- }
- }
-
-
- return 0;
-
-}
-
-
-void dockerl_update(int sockfd, char *cmd, char *image, char *service)
-{
- char buf_get[MAXLINE];
- stcontainer container;
- int size = 0;
- int i = 0;
- int string_size;
- int command_size;
- int buf_size = 0;
- int buf_size_length;
- int read_size;
- char *buf_set = NULL;
-
- buf_set = makeUpdateJSON(image, service);
-
- write(sockfd, buf_set, strlen(buf_set));
-
- printf("client> %s\n", buf_set);
-
- printf("server read!!!\n");
-
- buf_get[MAXLINE-1] = '\0';
-
- while(1)
- {
- if(read(sockfd, buf_get, MAXLINE) > 0)
- {
- break;
- }
- }
-
- printf("SERVER-> %s", buf_get);
-
- if(buf_set != NULL)
- free(buf_set);
-
- return 0;
-}
-
-void dockerl_ls(void)
-{
-}
-
-void dockerl_rm(void)
-{
-}
-
-int main(int argc, char *argv[])
-{
-
- int client_len;
- int client_sockfd;
- FILE *fp_in;
- struct sockaddr_un clientaddr;
-
- if(argc < 2)
- {
- printf("Usage : dockerl COMMAND\n");
- printf("commands:\n");
- printf(" info Display docker launcher information\n");
- printf(" dockerinfo Display docker information\n");
- printf(" create Create a new service \n");
- printf(" update Update a service\n");
- printf(" ls List services\n");
- printf(" rm Remove one or more services\n");
- //printf(" containers Containers info\n");
- return 0;
- }
-
- client_sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
- if(client_sockfd == -1)
- {
- printf("client error !!\n");
- return -1;
- }
-
- bzero(&clientaddr, sizeof(clientaddr));
- clientaddr.sun_family = AF_UNIX;
- strcpy(clientaddr.sun_path, SERVER);
- client_len = sizeof(clientaddr);
-
- if(connect(client_sockfd, (struct sockaddr *)&clientaddr, client_len) < 0)
- {
- printf("client connect error !!\n");
- return -1;
- }
-
- if(!strncmp(argv[1], "info", strlen("info")))
- {
- dockerl_info(client_sockfd, "getLauncherInfo");
- }
- else if(!strncmp(argv[1], "dockerinfo", strlen("dockerinfo")))
- {
- dockerl_docker_info(client_sockfd, "getDockerInfo");
- }
- else if(!strncmp(argv[1], "create", strlen("create")))
- {
- dockerl_create(client_sockfd, "createImage", argc, argv);
- }
- else if(!strncmp(argv[1], "update", strlen("update")))
- {
- dockerl_update(client_sockfd, "UpdateImage", argv[2],argv[3]);
- }
- else if(!strncmp(argv[1], "containers", strlen("containers")))
- {
- dockerl_containersInfo(client_sockfd, "GetContainersInfo");
- }
- else if(!strncmp(argv[1], "restart", strlen("restart")))
- {
- dockerl_restartContainer(client_sockfd, "restartContainer", argv[2]);
- }
- else if(!strncmp(argv[1], "ls", strlen("ls")))
- {
- dockerl_ls();
- }
- else if(!strncmp(argv[1], "rm", strlen("rm")))
- {
- dockerl_rm();
- }
-
- close(client_sockfd);
-
-
- return 0;
-}
diff --git a/tool/dockzen_launcher_json.c b/tool/dockzen_launcher_json.c
deleted file mode 100644
index 9ca8994..0000000
--- a/tool/dockzen_launcher_json.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @file dockzen_launcher_json.c
- * @brief Generation of json data
-
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- * This software is the confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "dzl_internal_types.h"
-#include "dockzen_launcher_json.h"
-#include "json_util.h"
-
-char *makeUpdateJSON(char *imageName, char *containerName)
-{
- struct json_object *inputObj, *paramObj;
- char *ret_buf = NULL;
- const char *buf = NULL;
-
- inputObj = json_object_new_object();
- paramObj = json_object_new_object();
-
- json_object_object_add(paramObj, "ImageName", json_object_new_string(imageName));
- json_object_object_add(paramObj, "ContainerName", json_object_new_string(containerName));
-
- json_object_object_add(inputObj, "Cmd", json_object_new_string("UpdateImage"));
- json_object_object_add(inputObj, "UpdateParam", paramObj);
-
- buf = json_object_to_json_string_ext(inputObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
- ret_buf = (char*)malloc(strlen(buf)+1);
-
- if(ret_buf != NULL)
- {
- memset(ret_buf, 0x00, strlen(buf)+1);
- memcpy(ret_buf, buf, strlen(buf));
- }
-
- json_object_put(inputObj);
-
- return ret_buf;
-
-}
-
-
diff --git a/unit-test.sh b/unit-test.sh
deleted file mode 100755
index 5960230..0000000
--- a/unit-test.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-#set -e
-
-echo "unitest test script"
-./unittest/pre/test_condition.sh
-
-./build.sh -t amd64
-sudo build/amd64/gtest-beluga-launcher
-lcov -c -d unittest/CMakeFiles/gtest-beluga-launcher.dir/__/src/ -o beluga-launcher.info
-genhtml beluga-launcher.info -o out
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
deleted file mode 100755
index 701c4ec..0000000
--- a/unittest/CMakeLists.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# @file CMakeLists.txt
-# @author
-# @author
-# @brief Cmake for tests
-#
-
-LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/lib)
-
-SET(TARGET_GTEST_TESTS "gtest-beluga-launcher")
-
-FILE(GLOB TARGET_GTEST_TESTS_SRCS
- beluga-launcher_dzl_dockerctl.cpp
- beluga-launcher_dzl_dockerform.cpp
- beluga-launcher_dzl_lifecycle.cpp
- beluga-launcher_dzl_setting.cpp
- beluga-launcher_main.cpp
- ${CMAKE_SOURCE_DIR}/src/dzl_dockerform.c
- ${CMAKE_SOURCE_DIR}/src/dzl_lifecycle.c
- ${CMAKE_SOURCE_DIR}/src/dzl_dockercomm.c
- ${CMAKE_SOURCE_DIR}/src/dzl_dockerctl.c
- ${CMAKE_SOURCE_DIR}/src/dzl_setting.c
- ${CMAKE_SOURCE_DIR}/src/lib/json_util.c
- ${CMAKE_SOURCE_DIR}/src/lib/yaml_util.c)
-
-INCLUDE(FindPkgConfig)
-
-IF(NONE_GBS_BUILD)
- INCLUDE_DIRECTORIES(${LINK_LIB_INCLUDE})
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fprofile-arcs -ftest-coverage")
- set(CMAKE_EXE_LINKER_FLAGS ${LINK_FLAG})
-ELSE(NONE_GBS_BUILD)
- pkg_check_modules(gtest_pkgs REQUIRED dlog glib-2.0 libcurl json-c gmock)
-ENDIF(NONE_GBS_BUILD)
-
-INCLUDE_DIRECTORIES(${gtest_pkgs_INCLUDE_DIRS})
-LINK_DIRECTORIES(${gtest_pkgs_LIBRARY_DIRS})
-
-ADD_EXECUTABLE(${TARGET_GTEST_TESTS} ${TARGET_GTEST_TESTS_SRCS})
-
-TARGET_LINK_LIBRARIES(${TARGET_GTEST_TESTS} ${gtest_pkgs_LIBRARIES} gmock json-c curl pthread yaml gcov --coverage)
-INSTALL(TARGETS ${TARGET_GTEST_TESTS} DESTINATION ${BIN_INSTALL_DIR})
diff --git a/unittest/beluga-launcher_dzl_dockerctl.cpp b/unittest/beluga-launcher_dzl_dockerctl.cpp
deleted file mode 100755
index e1a661b..0000000
--- a/unittest/beluga-launcher_dzl_dockerctl.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtest/gtest.h>
-
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "dzl_dockerctl.h"
-#include "dzl_setting.h"
-
-
-TEST(belugalauncher_dockerctl, belugalauncher_dzl_dockerctl_enable_swarm_service){
- int nRetVal = DOCKER_STATUS_NO_ERROR;
-
- nRetVal = dzl_dockerctl_enable_swarm_service();
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-}
-
-TEST(belugalauncher_dockerctl, belugalauncher_dzl_mon_get_containers_info){
- int nRetVal = DOCKER_STATUS_NO_ERROR;
-
- containers_info_s containers_info_h;
- container_update_s container_update;
- container_update_res_s container_update_res;
- container_status_e state;
-
- nRetVal = dzl_mon_get_containers_info(&containers_info_h);
-
- if(containers_info_h.count > 0) {
- container_update.container_name = containers_info_h.container[0].name;
- container_update.image_name = containers_info_h.container[0].image_name;
-
- nRetVal = dzl_update_update_container(container_update, &container_update_res);
-
- state = docker_interface_get_container_state(containers_info_h.container[0].name);
- }
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-}
-
-TEST(belugalauncher_dockerctl, belugalauncher_dzl_dockerctl_docker_start){
- int nRetVal = DOCKER_STATUS_NO_ERROR;
-
- nRetVal = dzl_dockerctl_docker_start();
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-}
-
-TEST(belugalauncher_dockerctl, belugalauncher_docker_interface_pull_image){
- int nRetVal = DOCKER_STATUS_NO_ERROR;
-
- nRetVal = docker_interface_pull_image("hello-world");
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-}
-
-TEST(belugalauncher_dockerctl, belugalauncher_dzl_dockerctl_system_agent_init){
- int nRetVal = DOCKER_STATUS_NO_ERROR;
-
- nRetVal = dzl_dockerctl_system_agent_init();
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-}
diff --git a/unittest/beluga-launcher_dzl_dockerform.cpp b/unittest/beluga-launcher_dzl_dockerform.cpp
deleted file mode 100755
index e62b322..0000000
--- a/unittest/beluga-launcher_dzl_dockerform.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtest/gtest.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "dzl_dockerform.h"
-
-using ::testing::InitGoogleTest;
-
-TEST(belugalauncher_dockerform, belugalauncher_dockerform_generate_url){
- char version[10]="v2.6";
- char url[10]="tasks";
- char newUrl[128]={0,};
- int nRetVal = DOCKER_STATUS_NO_ERROR;
-
- nRetVal = dockerform_generate_url(version, url, newUrl, sizeof(newUrl));
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-}
-
-TEST(belugalauncher_dockerform, belugalauncher_dockerform_genetate_docker_cmd){
- char command[128] = {0, };
- int nRetVal = DOCKER_STATUS_NO_ERROR;
- docker_control_info_s *ctl_docker_p;
- int str_len = 0;
-
- ctl_docker_p = (docker_control_info_s*)malloc(sizeof(docker_control_info_s));
- if (ctl_docker_p != NULL)
- {
- memset(ctl_docker_p, 0x00, sizeof(docker_control_info_s));
-
- str_len = strlen("/usr/bin");
- ctl_docker_p->path = (char*)malloc(str_len+1);
- if (ctl_docker_p->path != NULL)
- {
- strncpy(ctl_docker_p->path, "/usr/bin", str_len);
- ctl_docker_p->path[str_len] = '\0';
-
- str_len = strlen("overlay2");
- ctl_docker_p->opt_cmd = (char*)malloc(str_len+1);
- if (ctl_docker_p->opt_cmd != NULL)
- {
- strncpy(ctl_docker_p->opt_cmd, "overlay2", str_len);
- ctl_docker_p->opt_cmd[str_len] = '\0';
-
- nRetVal = dockerform_genetate_docker_cmd(ctl_docker_p,"dockerd",command, sizeof(command));
- free(ctl_docker_p->opt_cmd);
- }
- else
- {
- nRetVal = DOCKZEN_ERROR_OUT_OF_MEMORY;
- }
- free(ctl_docker_p->path);
- }
- else
- {
- nRetVal = DOCKZEN_ERROR_OUT_OF_MEMORY;
- }
- free(ctl_docker_p);
- }
- else
- {
- nRetVal = DOCKZEN_ERROR_OUT_OF_MEMORY;
- }
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-}
-
-TEST(belugalauncher_dockerform, belugalauncher_dockerform_check_response){
- char message1[128] = {"{\"message\": \"No such container: c2ada9df5af8\"}"};
- char message2[128] = {"{ }"};
- int nRetVal = DOCKER_STATUS_NO_ERROR;
-
- nRetVal = dockerform_check_response(message1);
- EXPECT_EQ(1, nRetVal);
-
- nRetVal = dockerform_check_response(message2);
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-}
-
-TEST(belugalauncher_dockerform, belugalauncher_dockerform_generate_imagecreate_data){
- container_create_info_s *createInfo;
- char name[10] = {"tizen"};
- char image[10] = {"headless"};
- char entry_cmd[15] = {"/bin/bash"};
- char net_mode[10] = {"host"};
- char *data = NULL;
- int data_size = 0;
-
- createInfo = (container_create_info_s *)malloc(sizeof(container_create_info_s));
- if (createInfo != NULL)
- {
- memset(createInfo, 0x00, sizeof(container_create_info_s));
- createInfo->name = name;
- createInfo->image = image;
- createInfo->entry_cmd = entry_cmd;
- createInfo->net_mode = net_mode;
-
- data_size = dockerform_generate_imagecreate_data(createInfo, &data);
- free(createInfo);
- }
- EXPECT_STRNE(NULL, data);
-
- if (data != NULL)
- {
- free(data);
- }
-}
-
-TEST(belugalauncher_dockerform, belugalauncher_dockerform_generate_swarm_init){
- char *data = NULL;
- int data_size = 0;
-
- data_size = dockerform_generate_swarm_init(&data);
-
- EXPECT_STRNE(NULL, data);
-
- if (data != NULL)
- {
- free(data);
- }
-}
-
-TEST(belugalauncher_dockerform, belugalauncher_dockerform_generate_servicesinfo){
- int nRetVal = DOCKER_STATUS_NO_ERROR;
- dzl_dockerctl_ServicesInfo *pstServicesInfo;
- char data[1024] = {"[{\
- \"ID\": \"9mnpnzenvg8p8tdbtq4wvbkcz\",\
- \"Spec\": {\
- \"Name\": \"hopeful_cori\",\
- \"TaskTemplate\": {\
- \"ContainerSpec\": {\
- \"Image\": \"redis\"\
- },\
- \"Resources\": {\
- \"Limits\": {},\
- \"Reservations\": {}\
- },\
- \"RestartPolicy\": {\
- \"Condition\": \"any\",\
- \"MaxAttempts\": 0\
- },\
- \"Placement\": {},\
- \"ForceUpdate\": 0\
- },\
- \"Mode\": {\
- \"Replicated\": {\
- \"Replicas\": 1\
- }\
- },\
- },\
- }]"};
-
- pstServicesInfo = (dzl_dockerctl_ServicesInfo *)malloc(sizeof(dzl_dockerctl_ServicesInfo));
- if (pstServicesInfo != NULL)
- {
- memset(pstServicesInfo, 0x00, sizeof(dzl_dockerctl_ServicesInfo));
- nRetVal = dockerform_generate_servicesinfo(data, pstServicesInfo);
- }
- else
- {
- nRetVal = -1;
- }
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
- EXPECT_EQ(1, pstServicesInfo->count);
-
- if (pstServicesInfo != NULL)
- {
- free(pstServicesInfo);
- }
-}
-
-TEST(belugalauncher_dockerform, belugalauncher_dockerform_generate_tasksinfo){
- dzl_dockerctl_TasksInfo *pstTasksInfo;
- int nRetVal = DOCKER_STATUS_NO_ERROR;
- char data[1024] = {"[\
- {\
- \"ID\": \"0kzzo1i0y4jz6027t0k7aezc7\",\
- \"ServiceID\": \"9mnpnzenvg8p8tdbtq4wvbkcz\",\
- \"DesiredState\": \"running\",\
- },\
- {\
- \"ID\": \"1yljwbmlr8er2waf8orvqpwms\",\
- \"ServiceID\": \"9mnpnzenvg8p8tdbtq4wvbkcz\",\
- \"DesiredState\": \"shutdown\",\
- }\
- ]"};
-
- pstTasksInfo = (dzl_dockerctl_TasksInfo *)malloc(sizeof(dzl_dockerctl_TasksInfo));
- if (pstTasksInfo != NULL)
- {
- memset(pstTasksInfo, 0x00, sizeof(dzl_dockerctl_TasksInfo));
- nRetVal = dockerform_generate_tasksinfo(data, pstTasksInfo);
- }
- else
- {
- nRetVal = -1;
- }
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
- EXPECT_EQ(2, pstTasksInfo->count);
-
- if (pstTasksInfo != NULL)
- {
- free(pstTasksInfo);
- }
-}
-
-TEST(belugalauncher_dockerform, belugalauncher_dockerform_generate_service_withid_info){
- dzl_dockerctl_serviceinfo_s *info;
- int nRetVal = DOCKER_STATUS_NO_ERROR;
- char data[1024] = {"[\
- {\
- \"ID\": \"9mnpnzenvg8p8tdbtq4wvbkcz\",\
- \"Version\": {\
- \"Index\": 19\
- },\
- }\
- ]"};
-
- info = (dzl_dockerctl_serviceinfo_s *)malloc(sizeof(dzl_dockerctl_serviceinfo_s));
- if (info != NULL)
- {
- nRetVal = dockerform_generate_service_withid_info(data, info);
- }
- else
- {
- nRetVal = -1;
- }
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-
- if (info != NULL)
- {
- free(info);
- }
-}
-
-TEST(belugalauncher_dockerform, belugalauncher_dockerform_generate_updateinfo){
- char * data = NULL;
- int data_size = 0;
- dzl_dockerctl_serviceinfo_s service_info = {0,};
- char imageName[128] = {"headless:v2.0"};
- char id[125] = {"9mnpnzenvg8p8tdbtq4wvbkcz"};
- char spec[1024] = {"{\"TaskTemplate\": {\
- \"ContainerSpec\": {\
- \"Image\": \"redis\"\
- },\
- },\
- }"};
-
- service_info.spec_config = spec;
- service_info.id = id;
- service_info.version = 19;
- data_size = dockerform_generate_updateinfo(&service_info, imageName, &data);
-
- EXPECT_STRNE(NULL, data);
-
- if (data != NULL)
- {
- free(data);
- }
-}
-
-TEST(belugalauncher_dockerform, belugalauncher_dockerform_parse_container_info){
- int nRetVal = DOCKER_STATUS_NO_ERROR;
- dzl_dockerctl_Task task_info = { 0, };
- char data[1024] = {"{\
- \"Type\": \"container\",\
- \"Action\": \"create\",\
- \"Actor\": {\
- \"ID\": \"ede54ee1afd\",\
- \"Attributes\": {\
- \"com.example.some-label\": \"some-label-value\",\
- \"image\": \"alpine\",\
- \"name\": \"my-container\"\
- }\
- },\
- \"time\": 1461943101\
- }"};
-
- nRetVal = dockerform_parse_container_info(data, &task_info);
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-}
diff --git a/unittest/beluga-launcher_dzl_interface.cpp b/unittest/beluga-launcher_dzl_interface.cpp
deleted file mode 100755
index 2099d5f..0000000
--- a/unittest/beluga-launcher_dzl_interface.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtest/gtest.h>
-
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "dzl_interface.h"
-
-using ::testing::InitGoogleTest;
-
-TEST(belugalauncher_interface, DISABLED_belugalauncher_dzl_interface_init){
- int nRetVal = 0;
-
- nRetVal = dzl_interface_init();
-
- EXPECT_EQ(0, nRetVal);
-}
diff --git a/unittest/beluga-launcher_dzl_lifecycle.cpp b/unittest/beluga-launcher_dzl_lifecycle.cpp
deleted file mode 100755
index b302925..0000000
--- a/unittest/beluga-launcher_dzl_lifecycle.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtest/gtest.h>
-
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "dzl_lifecycle.h"
-
-using ::testing::InitGoogleTest;
-
-TEST(belugalauncher_lifecycle, DISABLED_belugalauncher_dzl_lifecycle_start){
- int nRetVal = 0;
-
- nRetVal = dzl_lifecycle_start();
-
- EXPECT_EQ(0, nRetVal);
-}
-
-TEST(belugalauncher_lifecycle, belugalauncher_dzl_lifecycle_init_factory_service){
- int nRetVal = 0;
-
- nRetVal = dzl_lifecycle_init_factory_service();
-
- EXPECT_EQ(0, nRetVal);
-}
-
-TEST(belugalauncher_lifecycle, belugalauncher_dzl_lifecycle_state_init){
- state_machine_e state = STATEMACHINE_END;
-
- dzl_lifecycle_state_init();
- state = dzl_lifecycle_get_current_state();
-
- EXPECT_GE(STATEMACHINE_IDLE, state);
-}
-
-TEST(belugalauncher_lifecycle, belugalauncher_dzl_lifecycle_get_current_state){
- state_machine_e state = STATEMACHINE_IDLE;
-
- // set state as STATEMACHINE_IDLE
- dzl_lifecycle_set_state(state);
- // get state
- state = dzl_lifecycle_get_current_state();
-
- EXPECT_EQ(STATEMACHINE_IDLE, state);
-}
-
-TEST(belugalauncher_lifecycle, belugalauncher_dzl_lifecycle_set_state){
- state_machine_e state = STATEMACHINE_RECOVERY;
-
- // set state as STATEMACHINE_IDLE
- dzl_lifecycle_set_state(state);
- // get state
- state = dzl_lifecycle_get_current_state();
-
- EXPECT_EQ(STATEMACHINE_RECOVERY, state);
-}
-
-TEST(belugalauncher_lifecycle, belugalauncher_dzl_lifecycle_restart_dockerd){
- state_machine_e state = STATEMACHINE_END;
-
- dzl_lifecycle_restart_dockerd();
- // get state
- state = dzl_lifecycle_get_current_state();
-
- EXPECT_EQ(0, state);
-}
-
-TEST(belugalauncher_lifecycle, belugalauncher_dzl_lifecycle_stop_dockerd){
- int nRetVal = 0;
-
- dzl_lifecycle_stop_dockerd();
-
- EXPECT_EQ(0, nRetVal);
-} \ No newline at end of file
diff --git a/unittest/beluga-launcher_dzl_setting.cpp b/unittest/beluga-launcher_dzl_setting.cpp
deleted file mode 100755
index c2c6c1f..0000000
--- a/unittest/beluga-launcher_dzl_setting.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtest/gtest.h>
-
-#include "dockzen_types.h"
-#include "dzl_internal_types.h"
-#include "dzl_setting.h"
-
-
-TEST(belugalauncher_setting, belugalauncher_dzl_setting_set_factory_init_done){
- int nRetVal = DOCKER_STATUS_NO_ERROR;
-
- nRetVal = dzl_setting_set_factory_init_done(1);
-
- EXPECT_EQ(DOCKER_STATUS_NO_ERROR, nRetVal);
-}
-
-TEST(belugalauncher_setting, belugalauncher_dzl_setting_get_factory_init_done){
- int nRetVal = DOCKER_STATUS_NO_ERROR;
- nRetVal = dzl_setting_get_factory_init_done();
- EXPECT_NE(-1, nRetVal);
-}
diff --git a/unittest/beluga-launcher_main.cpp b/unittest/beluga-launcher_main.cpp
deleted file mode 100755
index b74dff5..0000000
--- a/unittest/beluga-launcher_main.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-//#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <unistd.h>
-
-using ::testing::InitGoogleTest;
-
-int main(int argc, char **argv){
- InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/unittest/dockzen_api/CMakeLists.txt b/unittest/dockzen_api/CMakeLists.txt
deleted file mode 100755
index a6834bd..0000000
--- a/unittest/dockzen_api/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# @file CMakeLists.txt
-# @author
-# @author
-# @brief Cmake for tests
-#
-LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/lib/install/include/beluga)
-
-SET(TARGET_GTEST_TESTS "gtest-dockzen_api")
-SET(GTEST_TESTS_SOURCES
- dzl_interface.cpp)
-
-FILE(GLOB GTEST_TESTS_SOURCES
- GTEST_TESTS_SOURCES *.cpp)
-
-INCLUDE(FindPkgConfig)
-IF(NONE_GBS_BUILD)
- INCLUDE_DIRECTORIES(${LINK_LIB_INCLUDE})
- set(CMAKE_EXE_LINKER_FLAGS ${LINK_FLAG})
-ELSE(NONE_GBS_BUILD)
-pkg_check_modules(test_pkgs REQUIRED
- dlog
- glib-2.0
- gio-2.0)
-ENDIF(NONE_GBS_BUILD)
-
-INCLUDE_DIRECTORIES(${test_pkgs_INCLUDE_DIRS})
-LINK_DIRECTORIES(${test_pkgs_LIBRARY_DIRS})
-
-ADD_EXECUTABLE(${TARGET_GTEST_TESTS}
- ${GTEST_TESTS_SOURCES})
-
-TARGET_LINK_LIBRARIES(${TARGET_GTEST_TESTS}
- ${test_pkgs_LIBRARIES}
- gmock
- beluga
- pthread
- json-c)
-
-INSTALL(TARGETS ${TARGET_GTEST_TESTS} DESTINATION ${BIN_INSTALL_DIR})
diff --git a/unittest/dockzen_api/dzl_interface.cpp b/unittest/dockzen_api/dzl_interface.cpp
deleted file mode 100644
index 4326a6a..0000000
--- a/unittest/dockzen_api/dzl_interface.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-#include <stdio.h>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include "dockzen_types.h"
-#include "dockzen.h"
-
-using ::testing::InitGoogleTest;
-using ::testing::Test;
-using ::testing::TestCase;
-
-
-namespace testing {
- namespace internal {
- enum GTestColor {
- COLOR_DEFAULT,
- COLOR_RED,
- COLOR_GREEN,
- COLOR_YELLOW
- };
- extern void ColoredPrintf(GTestColor color, const char* fmt, ...);
- }
-}
-#define PRINTF(...) do {\
- testing::internal::ColoredPrintf(testing::internal::COLOR_GREEN, "[INFO ] ");\
- testing::internal::ColoredPrintf(testing::internal::COLOR_YELLOW, __VA_ARGS__);\
- } while(0)
-
-TEST(dockzen_API, dockzen_API_dockzen_get_containers_info)
-{
- int ret = DOCKZEN_ERROR_NOT_SUPPORTED;
- int index = 0;
- int error = 0;
- int result = -1;
- containers_info_s containers_info = {0, };
-
- ret = dockzen_get_containers_info(&containers_info);
-
- if (ret == DOCKZEN_ERROR_NONE) {
-
- for (index = 0; index < containers_info.count; index++) {
-
- if ((containers_info.container[index].id == NULL) ||
- (containers_info.container[index].name == NULL) ||
- (containers_info.container[index].image_name == NULL) ||
- (containers_info.container[index].status == NULL)) {
-
- error = 1;
- } else {
- PRINTF("container[%d].id: %s\n", index, containers_info.container[index].id);
- PRINTF("container[%d].name: %s\n", index, containers_info.container[index].name);
- PRINTF("container[%d].image_name: %s\n", index, containers_info.container[index].image_name);
- PRINTF("container[%d].status: %s\n", index, containers_info.container[index].status);
- }
- }
-
- if (error == 0) {
- result = DOCKZEN_ERROR_NONE;
- }
- }
-
- ASSERT_EQ(DOCKZEN_ERROR_NONE, result);
-}
-
-static void __update_container_cb(container_update_cb_s *status, void *user_data)
-{
- PRINTF("container_update_cb\n");
-}
-
-TEST(dockzen_API, dockzen_API_dockzen_update_container)
-{
- int error = 0;
- int result = -1;
- int ret = DOCKZEN_ERROR_NOT_SUPPORTED;
- const char *const_container_name = "tizen";
- const char *const_image_name = "10.113.62.204:443/headless:v0.2";
- const char *const_user_data = "test";
- void (*callback)(container_update_cb_s *, void *) = __update_container_cb;
- char *user_data = NULL;
- container_update_s container_update = {0, };
- container_update_res_s container_update_res = {0, };
-
- container_update.container_name = (char *)malloc(strlen(const_container_name) + 1);
- container_update.image_name = (char *)malloc(strlen(const_image_name) + 1);
- user_data = (char *)malloc(strlen(const_user_data) + 1);
- memset(container_update.container_name, 0x00, strlen(const_container_name) + 1);
- memset(container_update.image_name, 0x00, strlen(const_image_name) + 1);
- strncpy(container_update.container_name, const_container_name, strlen(const_container_name));
- strncpy(container_update.image_name, const_image_name, strlen(const_image_name));
- strncpy(user_data, const_user_data, strlen(const_user_data));
-
- ret = dockzen_update_container(&container_update, &container_update_res, callback, user_data);
-
- if (!ret) {
- if ((container_update_res.container_name == NULL) ||
- (container_update_res.image_name_prev == NULL) ||
- (container_update_res.image_name_new == NULL) ||
- (container_update_res.status == NULL)) {
-
- error = 1;
- } else {
- PRINTF("container_name: %s\n", container_update_res.container_name);
- PRINTF("image_name_prev: %s\n", container_update_res.image_name_prev);
- PRINTF("image_name_new: %s\n", container_update_res.image_name_new);
- PRINTF("status: %s\n", container_update_res.status);
- }
-
- if (error == 0) {
- result = DOCKZEN_ERROR_NONE;
- }
- }
-
- free(container_update.container_name);
- free(container_update.image_name);
-
- ASSERT_EQ(DOCKZEN_ERROR_NONE, result);
-}
-
-int main(int argc, char **argv)
-{
- InitGoogleTest(&argc, argv);
-
- return RUN_ALL_TESTS();
-}
diff --git a/unittest/gtest-beluga-launcher b/unittest/gtest-beluga-launcher
deleted file mode 100755
index bb1806c..0000000
--- a/unittest/gtest-beluga-launcher
+++ /dev/null
Binary files differ
diff --git a/unittest/pre/beluga/setup-adaptor/cert/SRnD+Web+Proxy.crt b/unittest/pre/beluga/setup-adaptor/cert/SRnD+Web+Proxy.crt
deleted file mode 100755
index 6d02635..0000000
--- a/unittest/pre/beluga/setup-adaptor/cert/SRnD+Web+Proxy.crt
+++ /dev/null
@@ -1,25 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIEIzCCAwugAwIBAgIBADANBgkqhkiG9w0BAQUFADCBqzELMAkGA1UEBhMCa3Ix
-DjAMBgNVBAgMBVNlb3VsMRwwGgYDVQQKDBNTYW1zdW5nIEVsZWN0cm9uaWNzMRkw
-FwYDVQQDDBBTZW91bCBSJkQgQ2FtcHVzMRIwEAYDVQQHDAlTZW9jaG8tZ3UxGTAX
-BgNVBAsMEFNlb3VsIFImRCBDYW1wdXMxJDAiBgkqhkiG9w0BCQEWFXByb3h5LnNl
-bEBzYW1zdW5nLmNvbTAeFw0xNTEwMTQwODU5MDlaFw0zNTEwMTUwODU5MDlaMIGr
-MQswCQYDVQQGEwJrcjEOMAwGA1UECAwFU2VvdWwxHDAaBgNVBAoME1NhbXN1bmcg
-RWxlY3Ryb25pY3MxGTAXBgNVBAMMEFNlb3VsIFImRCBDYW1wdXMxEjAQBgNVBAcM
-CVNlb2Noby1ndTEZMBcGA1UECwwQU2VvdWwgUiZEIENhbXB1czEkMCIGCSqGSIb3
-DQEJARYVcHJveHkuc2VsQHNhbXN1bmcuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEAvgEjYbjS/8XZHwu1Vdq0iDNbLNuzmFQb+GPdWYQlWqXOZb+K
-V0xrHqaYeThIdcmaMmJDsCpXeXGQn8kz54iNIrVB25ZfyLhVNjr+A1FUnbq2N9xL
-TH3fssovccghEuqT5TCMghjt2q2239SJ4AEFBQHkNvyrTzHy8itOD4AZiJZXIFNm
-HCpzO4oi88A/3AXZ7Y2FjVLSTfbcA0gH3Jaf/TLwOqwj4/2y6gbMt/OPerek/kDH
-AAWdGZCmJYwCtB+55Tl/iX8kelvJjVWMK9pZ9/naKW71ZkKmEXQ6O0arFP0HEYAR
-5kxCKUxlHzQRRpmTsSAi2ri9Dg41RgGsQystjQIDAQABo1AwTjAdBgNVHQ4EFgQU
-j9qoT6I0gGeg/93PMLb/OaGiRmMwHwYDVR0jBBgwFoAUj9qoT6I0gGeg/93PMLb/
-OaGiRmMwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAN3SatWdZXhJA
-7UIFoEqhiVMdKhzvu9nI3rIuAZzYMAtNsiSWqNgxC2JL/cS2YayjzXMuiJwPVDvs
-6uyb02AmBj25ztA2Y1BHLBbEDhqdiuUUzxdELx0wWwZqU+ovD/jNz51OuL72mh4b
-LxoUFQ+pmdtRUdqr0UGyC+28y3jw1DsvAQZBFWTS2AOxq57KpHBkOUcg1AT9xrYF
-8FCKeSJwgt65GqYbSxmG3s5PXIp0pmQgDFbAdWc+ioQeR45eDUL4wY+k2xZTPrZO
-vSsa1G1vxjAuzMthR4NvKi+vnTOLY1O8KvZ4oNhLbJoJvx/5zLvAll4pHR7ylu4g
-phRAhQcRxA==
------END CERTIFICATE----- \ No newline at end of file
diff --git a/unittest/pre/beluga/setup-adaptor/config/config.json b/unittest/pre/beluga/setup-adaptor/config/config.json
deleted file mode 100755
index 8fab02a..0000000
--- a/unittest/pre/beluga/setup-adaptor/config/config.json
+++ /dev/null
@@ -1 +0,0 @@
-{"wifi":{"ssid":"iot_kt","password":"iot1234!","enabled":false,"dhcpEnabled":true,"ipAddress":"127.0.0.1","netmask":"127.0.0.1","defaultGateway":"127.0.0.1","primaryDNSServer":"127.0.0.1"},"ethernet":{"enabled":true,"dhcpEnabled":false,"ipAddress":"10.113.80.66","netmask":"255.255.255.0","defaultGateway":"10.113.80.1","primaryDnsServer":"10.32.192.11"},"httpProxy":"10.112.1.184:8080","httpsProxy":"","deviceName":"artik530","insecureRegistries":["10.113.80.72:443","52.78.68.250:5000","docker.sec.samsung.net:5000"]} \ No newline at end of file
diff --git a/unittest/pre/beluga/setup-adaptor/config/set_eth_config.sh b/unittest/pre/beluga/setup-adaptor/config/set_eth_config.sh
deleted file mode 100755
index c3f7778..0000000
--- a/unittest/pre/beluga/setup-adaptor/config/set_eth_config.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-
-file="/var/lib/connman/ethernet.config"
-service_name="service_home_ethernet"
-
-
-create_file()
-{
- if [ -f "$file" ] ; then
- echo "remove existing file"
- rm "$file"
- fi
- touch "$file"
-}
-
-add_ip_address()
-{
- if [ -n "$IP" ] && [ -n "$NETMASK" ] && [ -n "$GATEWAY" ]; then
- ipv4="$IP"/"$NETMASK"/"$GATEWAY"
- else
- echo -e "\nenter [ipAddress] [netmask] [gateway]"
- ipv4=""
- fi
-
- if [ -n "$ipv4" ]; then
- echo "IPv4 = ${ipv4}" >> "$file"
- echo -e "SET ==>> IPv4 = ${ipv4}"
- else
- rm "$file"
- echo -e "file write error"
- exit 1
- fi
-}
-
-add_dns_server()
-{
- if [ -n "$DNS1" ] && [ -n "$DNS2" ]; then
- dns_server="$DNS1","$DNS2"
- elif [ -n "$DNS1" ] && [ -z "$DNS2" ]; then
- dns_server="$DNS1"
- else
- dns_server=""
- fi
-
- if [ -n "$dns_server" ]; then
- echo "Nameservers = ${dns_server}" >> "$file"
- echo "SET ==>> Nameservers = ${dns_server}"
- fi
-}
-
-#start to write config file
-echo "create config file ${file}"
-create_file
-
-echo "[${service_name}]" >> "$file"
-echo "Type = ethernet" >> "$file"
-
-add_ip_address
-add_dns_server
-
-#change file mode
-chmod +x "$file"
-echo -e "complete to write...\n"
-
-
-#disable ethernet service
-connmanctl disable ethernet
-
-#enable ethernet service
-connmanctl enable ethernet
-
-cat ${file}
diff --git a/unittest/pre/beluga/setup-adaptor/config/set_wifi_config.sh b/unittest/pre/beluga/setup-adaptor/config/set_wifi_config.sh
deleted file mode 100755
index 8e3aab6..0000000
--- a/unittest/pre/beluga/setup-adaptor/config/set_wifi_config.sh
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/bash
-
-file="/var/lib/connman/wifi.config"
-service_name="service_home_wifi"
-
-
-create_file()
-{
- if [ -f "$file" ] ; then
- echo "remove existing file"
- rm "$file"
- fi
- touch "$file"
-}
-
-add_ssid_pw()
-{
- echo "Name = ${SSID}" >> "$file"
- echo "Passphrase = ${PASSWORD}" >> "$file"
-
- echo -e "SET ==>> Name = ${SSID}"
- echo -e "SET ==>> Passphrase = ${PASSWORD}"
-}
-
-add_ip_address()
-{
- if [ -n "$IP" ] && [ -n "$NETMASK" ] && [ -n "$GATEWAY" ]; then
- ipv4="$IP"/"$NETMASK"/"$GATEWAY"
- elif [ -n "$DHCP" ]; then
- ipv4="dhcp"
- else
- ipv4=""
- fi
-
- if [ -n "$ipv4" ]; then
- echo "IPv4 = ${ipv4}" >> "$file"
- echo -e "SET ==>> IPv4 = ${ipv4}"
- fi
-}
-
-add_dns_server()
-{
- if [ -n "$DNS1" ] && [ -n "$DNS2" ]; then
- dns_server="$DNS1","$DNS2"
- elif [ -n "$DNS1" ] && [ -z "$DNS2" ]; then
- dns_server="$DNS1"
- else
- dns_server=""
- fi
-
- if [ -n "$dns_server" ]; then
- echo "Nameservers = ${dns_server}" >> "$file"
- echo "SET ==>> Nameservers = ${dns_server}"
- fi
-}
-
-
-#start to write config file
-echo "create config file ${file}"
-create_file
-
-echo "[${service_name}]" >> "$file"
-echo "Type = wifi" >> "$file"
-
-add_ssid_pw
-add_ip_address
-add_dns_server
-
-#change file mode
-chmod +x "$file"
-echo -e "complete to write...\n"
-
-#disable wifi service
-connmanctl disable wifi
-
-#enable wifi service
-connmanctl enable wifi
-
-cat ${file}
diff --git a/unittest/pre/beluga/setup-adaptor/container/config-agent.yml b/unittest/pre/beluga/setup-adaptor/container/config-agent.yml
deleted file mode 100755
index 08a746c..0000000
--- a/unittest/pre/beluga/setup-adaptor/container/config-agent.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-## agent containers spec
-version: '2'
-services:
- beluga-agent:
- image: docker.sec.samsung.net:5000/beluga/armhf/beluga-agent:v0.5.3
- ports:
- - "9090:9090"
- container_name: beluga-agent
- volumes:
- - /var/run:/var/run:ro
- - /etc/dockzen/sc:/data/ip:rw
- - /opt/beluga/setup-adaptor:/target:rw
- net_mode: bridge
- privileged: true
- enable: true
diff --git a/unittest/pre/beluga/setup-adaptor/container/config-service.yml b/unittest/pre/beluga/setup-adaptor/container/config-service.yml
deleted file mode 100755
index b11129d..0000000
--- a/unittest/pre/beluga/setup-adaptor/container/config-service.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-## app containers spec
-version: '2'
-services:
- pharos-node:
- image: docker.sec.samsung.net:5000/edge/system-pharos-node-go/rpi_arm:latest
- ports:
- - "48098:48098"
- container_name: pharos-node
- environment:
- - ANCHOR_ADDRESS=10.113.80.65
- - NODE_ADDRESS=10.113.80.66
- volumes:
- - /opt/beluga/uc:/data/db
- - /var/run/docker.sock:/var/run/docker.sock
diff --git a/unittest/pre/beluga/setup-adaptor/images/pharos-node-artik530.tar b/unittest/pre/beluga/setup-adaptor/images/pharos-node-artik530.tar
deleted file mode 100755
index 3b923fd..0000000
--- a/unittest/pre/beluga/setup-adaptor/images/pharos-node-artik530.tar
+++ /dev/null
Binary files differ
diff --git a/unittest/pre/beluga/system/docker/dockerd_start.json b/unittest/pre/beluga/system/docker/dockerd_start.json
deleted file mode 100755
index 8879151..0000000
--- a/unittest/pre/beluga/system/docker/dockerd_start.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-"opt_cmd" : "-s overlay2 --data-root=/opt/beluga/var/lib/docker --userland-proxy=false -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375"
-}
-
-
-
diff --git a/unittest/pre/beluga/system/env/environment b/unittest/pre/beluga/system/env/environment
deleted file mode 100755
index e69de29..0000000
--- a/unittest/pre/beluga/system/env/environment
+++ /dev/null
diff --git a/unittest/pre/beluga/system/env/factory_init.json b/unittest/pre/beluga/system/env/factory_init.json
deleted file mode 100755
index c27e836..0000000
--- a/unittest/pre/beluga/system/env/factory_init.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "worked": 0 } \ No newline at end of file
diff --git a/unittest/pre/beluga/system/release/beluga-release b/unittest/pre/beluga/system/release/beluga-release
deleted file mode 100755
index b4d8fea..0000000
--- a/unittest/pre/beluga/system/release/beluga-release
+++ /dev/null
@@ -1,2 +0,0 @@
-VERSION="Beluga 1.0.0"
-BUILD_DATE=20180711
diff --git a/unittest/pre/beluga/system/tools/agent_config.sh b/unittest/pre/beluga/system/tools/agent_config.sh
deleted file mode 100755
index c449941..0000000
--- a/unittest/pre/beluga/system/tools/agent_config.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#! /bin/sh
-#set -e
-
-WORK_DIR=/etc/dockzen/sc
-AGENT_JSON=$WORK_DIR/dockzen_agent.json
-INIT_JSON=$WORK_DIR/factory_init.json
-
-stop() {
- echo "Stop docker service of dockzen-agent"
- if [ ! -z "$(docker service ls -q)" ]; then
- docker service rm $(docker service ls -q)
- fi
- docker system prune -f
- echo "Stop dockzen-launcher.service"
- systemctl status dockzen-launcher.service | grep Active
- systemctl stop dockzen-launcher.service
- systemctl status dockzen-launcher.service | grep Active
- echo "Change symbolic link of dockzen_agent.json"
- rm $AGENT_JSON
- echo "Clear init flag"
- rm $INIT_JSON
- echo "Start dockzen-launcher.service"
- systemctl start dockzen-launcher.service
- echo "Done"
-}
-
-restart() {
- echo "Start dockzen-launcher.service"
- systemctl start dockzen-launcher.service
-}
-
-if [ "$1" == "noop" ]; then
- echo "---------------------------------------------------"
- echo " clear agent as no-operation"
- echo "---------------------------------------------------"
- stop
- restart
- echo "Cleared !!!"
-elif [ "$1" == "show" ]; then
- echo "---------------------------------------------------"
- echo " show current agent"
- echo "---------------------------------------------------"
- if [ -f "$AGENT_JSON" ]; then
- readlink $AGENT_JSON
- else
- echo "empty file ($AGENT_JSON)"
- fi
- echo "Completed !!!"
-elif [ -f "$1" ]; then
- echo "---------------------------------------------------"
- echo " change agent target"
- echo "---------------------------------------------------"
- stop
- echo "Change symbolic link of dockzen_agent.json(-->$1)"
- ln -s $1 $AGENT_JSON
- restart
- echo "Done !!! linked to \"$(readlink $AGENT_JSON)\""
-else
- echo "check input parameter"
- echo "Usage 1 : ./agent_set noop (disable agent)"
- echo "Usage 2 : ./agent_set show (display current agent config file)"
- echo "Usage 3 : ./agent_set [json file] (set agent config file)"
-fi
- \ No newline at end of file
diff --git a/unittest/pre/beluga/system/tools/agent_reset.sh b/unittest/pre/beluga/system/tools/agent_reset.sh
deleted file mode 100755
index 795b0e5..0000000
--- a/unittest/pre/beluga/system/tools/agent_reset.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#! /bin/bash
-#set -e
-
-echo "Stop docker services"
-if [ ! -z "$(docker service ls -q)" ]; then
- docker service rm $(docker service ls -q)
-fi
-
-echo "Remove container lists"
-if [ ! -z "$(docker ps -a -q)" ]; then
- docker rm $(docker ps -a -q) -f
-fi
-
-echo "Remove image lists"
-if [ ! -z "$(docker images -q)" ]; then
- docker rmi $(docker images -q) -f
-fi
-
-echo "Do prune"
-docker system prune -f
-
-echo "Stop dockzen-launcher.service"
-systemctl stop dockzen-launcher.service
-
-echo "Delete /var/lib/docker folder"
-rm /var/lib/docker/ -rf
-
-echo "Clear init flag"
-rm /etc/dockzen/sc/factory_init.json
-
-reboot -f \ No newline at end of file
diff --git a/unittest/pre/beluga/system/tools/availables-dockerd/dockerd_start-default.json b/unittest/pre/beluga/system/tools/availables-dockerd/dockerd_start-default.json
deleted file mode 100755
index 6b7bc0d..0000000
--- a/unittest/pre/beluga/system/tools/availables-dockerd/dockerd_start-default.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-"opt_cmd" : "-s overlay2 --data-root=/opt/beluga/var/lib/docker --userland-proxy=false -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375"
-}
-
diff --git a/unittest/pre/beluga/system/tools/dockerd_start.json b/unittest/pre/beluga/system/tools/dockerd_start.json
deleted file mode 100755
index 8d0715e..0000000
--- a/unittest/pre/beluga/system/tools/dockerd_start.json
+++ /dev/null
Binary files differ
diff --git a/unittest/pre/beluga/system/tools/dockzen_agent-default.json b/unittest/pre/beluga/system/tools/dockzen_agent-default.json
deleted file mode 100755
index 8ff75ac..0000000
--- a/unittest/pre/beluga/system/tools/dockzen_agent-default.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-"name" : "dockzen-agent",
-"image" : "docker.sec.samsung.net:5000/dockzen/armhf/dockzen-agent:v1.8.2",
-"volume" : "/var/run:/var/run:rw,/etc/dockzen/sc:/data/ip:rw",
-"port" : "9090:9090",
-"net_mode" : "bridge",
-"privileged" : false,
-"enable" : true
-}
-
diff --git a/unittest/pre/beluga/system/tools/dockzen_agent-headed-iiot.json b/unittest/pre/beluga/system/tools/dockzen_agent-headed-iiot.json
deleted file mode 100755
index 569b631..0000000
--- a/unittest/pre/beluga/system/tools/dockzen_agent-headed-iiot.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-"name" : "dockzen-agent",
-"image" : "docker.sec.samsung.net:5000/dockzen/armhf/dockzen-agent:v1.8.0-headed-iiot",
-"volume" : "/var/run:/var/run:rw,/etc/dockzen/sc:/data/ip:rw",
-"port" : "9090:9090",
-"net_mode" : "bridge",
-"privileged" : false,
-"enable" : true
-}
-
diff --git a/unittest/pre/beluga/system/tools/dockzen_agent-headed.json b/unittest/pre/beluga/system/tools/dockzen_agent-headed.json
deleted file mode 100755
index 56d8aee..0000000
--- a/unittest/pre/beluga/system/tools/dockzen_agent-headed.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-"name" : "dockzen-agent",
-"image" : "docker.sec.samsung.net:5000/dockzen/armhf/dockzen-agent:v1.8.0-headed",
-"volume" : "/var/run:/var/run:rw,/etc/dockzen/sc:/data/ip:rw",
-"port" : "9090:9090",
-"net_mode" : "bridge",
-"privileged" : false,
-"enable" : true
-}
-
diff --git a/unittest/pre/beluga/system/tools/dockzen_agent-headless-iiot.json b/unittest/pre/beluga/system/tools/dockzen_agent-headless-iiot.json
deleted file mode 100755
index f839c86..0000000
--- a/unittest/pre/beluga/system/tools/dockzen_agent-headless-iiot.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-"name" : "dockzen-agent",
-"image" : "docker.sec.samsung.net:5000/dockzen/armhf/dockzen-agent:v1.8.0-headless-iiot",
-"volume" : "/var/run:/var/run:rw",
-"port" : "9090:9090",
-"net_mode" : "bridge",
-"privileged" : false,
-"enable" : true
-}
-
diff --git a/unittest/pre/beluga/system/tools/dockzen_agent-headless.json b/unittest/pre/beluga/system/tools/dockzen_agent-headless.json
deleted file mode 100755
index 3179a8d..0000000
--- a/unittest/pre/beluga/system/tools/dockzen_agent-headless.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-"name" : "dockzen-agent",
-"image" : "docker.sec.samsung.net:5000/dockzen/armhf/dockzen-agent:v1.8.0-headless",
-"volume" : "/var/run:/var/run:rw",
-"port" : "9090:9090",
-"net_mode" : "bridge",
-"privileged" : false,
-"enable" : true
-}
-
diff --git a/unittest/pre/test_condition.sh b/unittest/pre/test_condition.sh
deleted file mode 100755
index 362c093..0000000
--- a/unittest/pre/test_condition.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-set -e
-
-echo "copy beluga working files"
-sudo cp -rf ./unittest/pre/beluga/ /opt/ \ No newline at end of file