rj_schema 0.2.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rj_schema/rapidjson/CMakeLists.txt +9 -4
  3. data/ext/rj_schema/rapidjson/RapidJSONConfig.cmake.in +10 -0
  4. data/ext/rj_schema/rapidjson/appveyor.yml +22 -9
  5. data/ext/rj_schema/rapidjson/bin/data/abcde.txt +1 -0
  6. data/ext/rj_schema/rapidjson/bin/unittestschema/address.json +139 -0
  7. data/ext/rj_schema/rapidjson/bin/unittestschema/allOf_address.json +7 -0
  8. data/ext/rj_schema/rapidjson/bin/unittestschema/anyOf_address.json +7 -0
  9. data/ext/rj_schema/rapidjson/bin/unittestschema/oneOf_address.json +7 -0
  10. data/ext/rj_schema/rapidjson/contrib/natvis/rapidjson.natvis +2 -2
  11. data/ext/rj_schema/rapidjson/doc/dom.md +1 -0
  12. data/ext/rj_schema/rapidjson/doc/dom.zh-cn.md +1 -0
  13. data/ext/rj_schema/rapidjson/doc/faq.md +3 -3
  14. data/ext/rj_schema/rapidjson/doc/faq.zh-cn.md +8 -8
  15. data/ext/rj_schema/rapidjson/doc/internals.md +1 -1
  16. data/ext/rj_schema/rapidjson/doc/internals.zh-cn.md +2 -2
  17. data/ext/rj_schema/rapidjson/doc/pointer.zh-cn.md +1 -1
  18. data/ext/rj_schema/rapidjson/doc/sax.md +1 -1
  19. data/ext/rj_schema/rapidjson/doc/sax.zh-cn.md +2 -2
  20. data/ext/rj_schema/rapidjson/doc/stream.md +1 -1
  21. data/ext/rj_schema/rapidjson/doc/tutorial.md +1 -1
  22. data/ext/rj_schema/rapidjson/doc/tutorial.zh-cn.md +7 -6
  23. data/ext/rj_schema/rapidjson/example/CMakeLists.txt +1 -0
  24. data/ext/rj_schema/rapidjson/example/schemavalidator/schemavalidator.cpp +118 -0
  25. data/ext/rj_schema/rapidjson/example/sortkeys/sortkeys.cpp +62 -0
  26. data/ext/rj_schema/rapidjson/example/tutorial/tutorial.cpp +1 -1
  27. data/ext/rj_schema/rapidjson/include/rapidjson/allocators.h +6 -6
  28. data/ext/rj_schema/rapidjson/include/rapidjson/cursorstreamwrapper.h +1 -1
  29. data/ext/rj_schema/rapidjson/include/rapidjson/document.h +124 -35
  30. data/ext/rj_schema/rapidjson/include/rapidjson/encodedstream.h +1 -1
  31. data/ext/rj_schema/rapidjson/include/rapidjson/encodings.h +1 -1
  32. data/ext/rj_schema/rapidjson/include/rapidjson/error/en.h +49 -1
  33. data/ext/rj_schema/rapidjson/include/rapidjson/error/error.h +56 -1
  34. data/ext/rj_schema/rapidjson/include/rapidjson/filereadstream.h +2 -2
  35. data/ext/rj_schema/rapidjson/include/rapidjson/filewritestream.h +1 -1
  36. data/ext/rj_schema/rapidjson/include/rapidjson/fwd.h +2 -2
  37. data/ext/rj_schema/rapidjson/include/rapidjson/internal/biginteger.h +2 -2
  38. data/ext/rj_schema/rapidjson/include/rapidjson/internal/clzll.h +71 -0
  39. data/ext/rj_schema/rapidjson/include/rapidjson/internal/diyfp.h +3 -17
  40. data/ext/rj_schema/rapidjson/include/rapidjson/internal/dtoa.h +1 -1
  41. data/ext/rj_schema/rapidjson/include/rapidjson/internal/ieee754.h +1 -1
  42. data/ext/rj_schema/rapidjson/include/rapidjson/internal/itoa.h +1 -1
  43. data/ext/rj_schema/rapidjson/include/rapidjson/internal/meta.h +1 -1
  44. data/ext/rj_schema/rapidjson/include/rapidjson/internal/pow10.h +1 -1
  45. data/ext/rj_schema/rapidjson/include/rapidjson/internal/regex.h +20 -13
  46. data/ext/rj_schema/rapidjson/include/rapidjson/internal/stack.h +4 -3
  47. data/ext/rj_schema/rapidjson/include/rapidjson/internal/strfunc.h +1 -1
  48. data/ext/rj_schema/rapidjson/include/rapidjson/internal/strtod.h +1 -1
  49. data/ext/rj_schema/rapidjson/include/rapidjson/internal/swap.h +1 -1
  50. data/ext/rj_schema/rapidjson/include/rapidjson/istreamwrapper.h +50 -35
  51. data/ext/rj_schema/rapidjson/include/rapidjson/memorybuffer.h +1 -1
  52. data/ext/rj_schema/rapidjson/include/rapidjson/memorystream.h +1 -1
  53. data/ext/rj_schema/rapidjson/include/rapidjson/ostreamwrapper.h +1 -1
  54. data/ext/rj_schema/rapidjson/include/rapidjson/pointer.h +63 -5
  55. data/ext/rj_schema/rapidjson/include/rapidjson/prettywriter.h +2 -2
  56. data/ext/rj_schema/rapidjson/include/rapidjson/rapidjson.h +63 -1
  57. data/ext/rj_schema/rapidjson/include/rapidjson/reader.h +67 -53
  58. data/ext/rj_schema/rapidjson/include/rapidjson/schema.h +318 -164
  59. data/ext/rj_schema/rapidjson/include/rapidjson/stream.h +1 -1
  60. data/ext/rj_schema/rapidjson/include/rapidjson/stringbuffer.h +1 -1
  61. data/ext/rj_schema/rapidjson/include/rapidjson/writer.h +10 -10
  62. data/ext/rj_schema/rapidjson/readme.md +51 -1
  63. data/ext/rj_schema/rapidjson/readme.zh-cn.md +2 -2
  64. data/ext/rj_schema/rapidjson/test/perftest/misctest.cpp +1 -1
  65. data/ext/rj_schema/rapidjson/test/perftest/perftest.cpp +1 -1
  66. data/ext/rj_schema/rapidjson/test/perftest/perftest.h +1 -1
  67. data/ext/rj_schema/rapidjson/test/perftest/platformtest.cpp +2 -2
  68. data/ext/rj_schema/rapidjson/test/perftest/rapidjsontest.cpp +75 -1
  69. data/ext/rj_schema/rapidjson/test/unittest/CMakeLists.txt +1 -0
  70. data/ext/rj_schema/rapidjson/test/unittest/allocatorstest.cpp +1 -1
  71. data/ext/rj_schema/rapidjson/test/unittest/bigintegertest.cpp +1 -1
  72. data/ext/rj_schema/rapidjson/test/unittest/clzlltest.cpp +34 -0
  73. data/ext/rj_schema/rapidjson/test/unittest/cursorstreamwrappertest.cpp +19 -19
  74. data/ext/rj_schema/rapidjson/test/unittest/documenttest.cpp +1 -1
  75. data/ext/rj_schema/rapidjson/test/unittest/dtoatest.cpp +1 -1
  76. data/ext/rj_schema/rapidjson/test/unittest/encodedstreamtest.cpp +1 -1
  77. data/ext/rj_schema/rapidjson/test/unittest/encodingstest.cpp +1 -1
  78. data/ext/rj_schema/rapidjson/test/unittest/filestreamtest.cpp +45 -2
  79. data/ext/rj_schema/rapidjson/test/unittest/fwdtest.cpp +1 -1
  80. data/ext/rj_schema/rapidjson/test/unittest/istreamwrappertest.cpp +10 -10
  81. data/ext/rj_schema/rapidjson/test/unittest/itoatest.cpp +8 -8
  82. data/ext/rj_schema/rapidjson/test/unittest/jsoncheckertest.cpp +1 -1
  83. data/ext/rj_schema/rapidjson/test/unittest/namespacetest.cpp +1 -1
  84. data/ext/rj_schema/rapidjson/test/unittest/ostreamwrappertest.cpp +1 -1
  85. data/ext/rj_schema/rapidjson/test/unittest/pointertest.cpp +157 -16
  86. data/ext/rj_schema/rapidjson/test/unittest/prettywritertest.cpp +1 -1
  87. data/ext/rj_schema/rapidjson/test/unittest/readertest.cpp +113 -75
  88. data/ext/rj_schema/rapidjson/test/unittest/regextest.cpp +2 -1
  89. data/ext/rj_schema/rapidjson/test/unittest/schematest.cpp +593 -78
  90. data/ext/rj_schema/rapidjson/test/unittest/simdtest.cpp +1 -1
  91. data/ext/rj_schema/rapidjson/test/unittest/strfunctest.cpp +1 -1
  92. data/ext/rj_schema/rapidjson/test/unittest/stringbuffertest.cpp +5 -5
  93. data/ext/rj_schema/rapidjson/test/unittest/strtodtest.cpp +1 -1
  94. data/ext/rj_schema/rapidjson/test/unittest/unittest.cpp +1 -1
  95. data/ext/rj_schema/rapidjson/test/unittest/unittest.h +4 -1
  96. data/ext/rj_schema/rapidjson/test/unittest/valuetest.cpp +12 -12
  97. data/ext/rj_schema/rapidjson/test/unittest/writertest.cpp +1 -1
  98. data/ext/rj_schema/rapidjson/thirdparty/gtest/BUILD.bazel +175 -0
  99. data/ext/rj_schema/rapidjson/thirdparty/gtest/CMakeLists.txt +18 -1
  100. data/ext/rj_schema/rapidjson/thirdparty/gtest/CONTRIBUTING.md +160 -0
  101. data/ext/rj_schema/rapidjson/thirdparty/gtest/LICENSE +28 -0
  102. data/ext/rj_schema/rapidjson/thirdparty/gtest/Makefile.am +14 -0
  103. data/ext/rj_schema/rapidjson/thirdparty/gtest/README.md +16 -35
  104. data/ext/rj_schema/rapidjson/thirdparty/gtest/WORKSPACE +8 -0
  105. data/ext/rj_schema/rapidjson/thirdparty/gtest/appveyor.yml +104 -0
  106. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-autotools.sh +44 -0
  107. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-bazel.sh +36 -0
  108. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-linux.sh +41 -0
  109. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-osx.sh +40 -0
  110. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/get-nprocessors.sh +48 -0
  111. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-linux.sh +49 -0
  112. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-osx.sh +39 -0
  113. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/log-config.sh +51 -0
  114. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/travis.sh +44 -0
  115. data/ext/rj_schema/rapidjson/thirdparty/gtest/configure.ac +16 -0
  116. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CHANGES +1 -1
  117. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt +72 -32
  118. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/README.md +53 -42
  119. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock.pc.in +9 -0
  120. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock_main.pc.in +9 -0
  121. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/configure.ac +4 -4
  122. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CheatSheet.md +6 -4
  123. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CookBook.md +117 -132
  124. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/Documentation.md +7 -4
  125. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/ForDummies.md +20 -12
  126. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/FrequentlyAskedQuestions.md +1 -2
  127. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-actions.h +83 -26
  128. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h +262 -68
  129. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +45 -6
  130. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +650 -366
  131. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +76 -20
  132. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h +308 -229
  133. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +18 -15
  134. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +87 -26
  135. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +33 -16
  136. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h +1209 -353
  137. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h +33 -0
  138. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h +159 -88
  139. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock.h +2 -1
  140. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +1 -1
  141. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h +3 -4
  142. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +16 -9
  143. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h +71 -8
  144. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h +7 -11
  145. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.sln +14 -0
  146. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.vcxproj +69 -6
  147. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_config.props +2 -2
  148. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_main.vcxproj +69 -6
  149. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_test.vcxproj +83 -8
  150. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.sln +14 -0
  151. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.vcxproj +63 -2
  152. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_main.vcxproj +63 -2
  153. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_test.vcxproj +76 -3
  154. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/fuse_gmock_files.py +1 -1
  155. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README +4 -5
  156. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/ast.py +3 -3
  157. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-cardinalities.cc +1 -1
  158. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-internal-utils.cc +36 -6
  159. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-matchers.cc +210 -135
  160. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-spec-builders.cc +108 -48
  161. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock.cc +23 -1
  162. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/BUILD.bazel +123 -0
  163. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-actions_test.cc +166 -2
  164. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-cardinalities_test.cc +1 -1
  165. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-actions_test.cc +64 -62
  166. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-function-mockers_test.cc +43 -18
  167. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc +11 -9
  168. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc +91 -36
  169. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-internal-utils_test.cc +33 -14
  170. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-matchers_test.cc +1286 -167
  171. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-more-actions_test.cc +85 -83
  172. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-nice-strict_test.cc +102 -15
  173. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-spec-builders_test.cc +136 -9
  174. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link2_test.cc +1 -1
  175. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.cc +1 -1
  176. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.h +24 -2
  177. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test.py +8 -5
  178. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_.cc +20 -1
  179. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_golden.txt +8 -1
  180. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_stress_test.cc +3 -2
  181. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test.cc +44 -2
  182. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test_utils.py +5 -7
  183. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt +40 -14
  184. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/Makefile.am +60 -31
  185. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/README.md +232 -171
  186. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest.pc.in +9 -0
  187. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest_main.pc.in +10 -0
  188. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/internal_utils.cmake +54 -16
  189. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/configure.ac +1 -1
  190. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Pkgconfig.md +146 -0
  191. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/PumpManual.md +2 -2
  192. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/XcodeGuide.md +6 -6
  193. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{AdvancedGuide.md → advanced.md} +260 -26
  194. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{FAQ.md → faq.md} +62 -57
  195. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{Primer.md → primer.md} +43 -9
  196. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/{Samples.md → samples.md} +0 -0
  197. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-death-test.h +53 -5
  198. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-message.h +1 -2
  199. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h +30 -36
  200. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h.pump +8 -17
  201. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-printers.h +140 -51
  202. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-spi.h +2 -3
  203. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h +4 -3
  204. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest.h +126 -30
  205. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h +6 -7
  206. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_prod.h +8 -5
  207. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h +6 -5
  208. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h +4 -0
  209. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h +13 -57
  210. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h +1 -2
  211. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h +98 -59
  212. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h +34 -41
  213. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +3 -10
  214. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h +9 -17
  215. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h +8 -1
  216. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h +232 -99
  217. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h +3 -3
  218. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h +17 -1
  219. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump +17 -1
  220. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.sln +55 -0
  221. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj +149 -0
  222. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj.filters +18 -0
  223. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.sln +55 -0
  224. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj +149 -0
  225. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj.filters +18 -0
  226. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj +154 -0
  227. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj.filters +18 -0
  228. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj +162 -0
  229. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj.filters +18 -0
  230. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj +199 -0
  231. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters +26 -0
  232. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj +191 -0
  233. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters +26 -0
  234. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj +188 -0
  235. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters +18 -0
  236. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj +180 -0
  237. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj.filters +18 -0
  238. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/prime_tables.h +6 -2
  239. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.cc +1 -1
  240. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample10_unittest.cc +0 -4
  241. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1_unittest.cc +2 -1
  242. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2_unittest.cc +2 -1
  243. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3_unittest.cc +7 -6
  244. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4_unittest.cc +5 -1
  245. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample5_unittest.cc +3 -3
  246. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample6_unittest.cc +2 -1
  247. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample7_unittest.cc +10 -22
  248. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample8_unittest.cc +2 -1
  249. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample9_unittest.cc +0 -3
  250. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/fuse_gtest_files.py +1 -1
  251. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gen_gtest_pred_impl.py +10 -10
  252. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload.py +1 -1
  253. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-all.cc +1 -1
  254. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-death-test.cc +226 -32
  255. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-filepath.cc +5 -7
  256. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-internal-inl.h +21 -29
  257. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-port.cc +85 -67
  258. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-printers.cc +93 -8
  259. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-test-part.cc +1 -9
  260. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-typed-test.cc +1 -0
  261. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest.cc +622 -164
  262. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest_main.cc +1 -1
  263. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/BUILD.bazel +396 -0
  264. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_test.cc +12 -15
  265. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-filepath_test.cc +2 -12
  266. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-listener_test.cc +1 -1
  267. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-options_test.cc +6 -8
  268. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test2_test.cc +1 -5
  269. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.cc +84 -29
  270. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.h +1 -5
  271. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-port_test.cc +11 -12
  272. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-printers_test.cc +165 -63
  273. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test2_test.cc +1 -1
  274. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.cc +1 -1
  275. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-unittest-api_test.cc +1 -1
  276. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_all_test.cc +13 -13
  277. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_assert_by_exception_test.cc +119 -0
  278. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest.py +1 -3
  279. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest_.cc +1 -2
  280. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test.py +0 -2
  281. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test_.cc +1 -1
  282. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test.py +1 -2
  283. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test_.cc +0 -8
  284. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test.py +6 -4
  285. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test_.cc +0 -2
  286. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_environment_test.cc +0 -3
  287. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest.py +20 -18
  288. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest_.cc +0 -2
  289. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test.py +1 -1
  290. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_outfiles_test.py +162 -0
  291. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_output_unittest.py +611 -0
  292. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_test_utils.py +60 -0
  293. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest.py +4 -4
  294. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_main_unittest.cc +2 -2
  295. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test.py +11 -7
  296. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_.cc +17 -12
  297. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_golden_lin.txt +104 -66
  298. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_pred_impl_unittest.cc +1 -1
  299. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_prod_test.cc +2 -2
  300. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_repeat_test.cc +2 -19
  301. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_stress_test.cc +0 -6
  302. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_test_utils.py +12 -14
  303. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test.py +65 -0
  304. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test_.cc +44 -0
  305. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test.py +1 -1
  306. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test.py +4 -5
  307. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test_.cc +2 -2
  308. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_unittest.cc +240 -149
  309. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile1_test_.cc +0 -1
  310. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile2_test_.cc +0 -1
  311. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfiles_test.py +15 -7
  312. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest.py +100 -30
  313. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest_.cc +0 -2
  314. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_test_utils.py +25 -23
  315. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.cc +1 -1
  316. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.h +1 -1
  317. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/versiongenerate.py +4 -4
  318. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj +47 -0
  319. data/ext/rj_schema/rapidjson/travis-doxygen.sh +13 -6
  320. data/ext/rj_schema/rj_schema.cpp +161 -17
  321. data/lib/rj_schema.rb +1 -1
  322. metadata +63 -58
  323. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DevGuide.md +0 -132
  324. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CheatSheet.md +0 -525
  325. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CookBook.md +0 -3250
  326. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/Documentation.md +0 -11
  327. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/ForDummies.md +0 -439
  328. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/FrequentlyAskedQuestions.md +0 -624
  329. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CheatSheet.md +0 -534
  330. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CookBook.md +0 -3342
  331. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/Documentation.md +0 -12
  332. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/ForDummies.md +0 -439
  333. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/FrequentlyAskedQuestions.md +0 -628
  334. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CheatSheet.md +0 -556
  335. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CookBook.md +0 -3432
  336. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/Documentation.md +0 -12
  337. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/ForDummies.md +0 -439
  338. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/FrequentlyAskedQuestions.md +0 -628
  339. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/DevGuide.md +0 -126
  340. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Documentation.md +0 -14
  341. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_AdvancedGuide.md +0 -2096
  342. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Documentation.md +0 -12
  343. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_FAQ.md +0 -886
  344. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Primer.md +0 -497
  345. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_PumpManual.md +0 -177
  346. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_XcodeGuide.md +0 -93
  347. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_AdvancedGuide.md +0 -2178
  348. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Documentation.md +0 -14
  349. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_FAQ.md +0 -1038
  350. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Primer.md +0 -501
  351. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_PumpManual.md +0 -177
  352. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Samples.md +0 -14
  353. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_XcodeGuide.md +0 -93
  354. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_AdvancedGuide.md +0 -2181
  355. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Documentation.md +0 -14
  356. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_FAQ.md +0 -1082
  357. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Primer.md +0 -501
  358. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_PumpManual.md +0 -177
  359. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Samples.md +0 -14
  360. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_XcodeGuide.md +0 -93
  361. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.sln +0 -45
  362. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.vcproj +0 -126
  363. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.sln +0 -45
  364. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.vcproj +0 -126
  365. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main-md.vcproj +0 -129
  366. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main.vcproj +0 -129
  367. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test-md.vcproj +0 -164
  368. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test.vcproj +0 -164
  369. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest-md.vcproj +0 -147
  370. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest.vcproj +0 -147
  371. data/ext/rj_schema/rapidjson/thirdparty/gtest/travis.sh +0 -15
@@ -41,6 +41,7 @@
41
41
  #include <map>
42
42
  #include <set>
43
43
  #include <string>
44
+ #include <vector>
44
45
  #include "gmock/gmock.h"
45
46
  #include "gtest/gtest.h"
46
47
 
@@ -48,6 +49,15 @@
48
49
  # include <unistd.h> // NOLINT
49
50
  #endif
50
51
 
52
+ // Silence C4800 (C4800: 'int *const ': forcing value
53
+ // to bool 'true' or 'false') for MSVC 14,15
54
+ #ifdef _MSC_VER
55
+ #if _MSC_VER <= 1900
56
+ # pragma warning(push)
57
+ # pragma warning(disable:4800)
58
+ #endif
59
+ #endif
60
+
51
61
  namespace testing {
52
62
  namespace internal {
53
63
 
@@ -58,16 +68,15 @@ GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_gmock_mutex);
58
68
  // Logs a message including file and line number information.
59
69
  GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
60
70
  const char* file, int line,
61
- const string& message) {
71
+ const std::string& message) {
62
72
  ::std::ostringstream s;
63
73
  s << file << ":" << line << ": " << message << ::std::endl;
64
74
  Log(severity, s.str(), 0);
65
75
  }
66
76
 
67
77
  // Constructs an ExpectationBase object.
68
- ExpectationBase::ExpectationBase(const char* a_file,
69
- int a_line,
70
- const string& a_source_text)
78
+ ExpectationBase::ExpectationBase(const char* a_file, int a_line,
79
+ const std::string& a_source_text)
71
80
  : file_(a_file),
72
81
  line_(a_line),
73
82
  source_text_(a_source_text),
@@ -100,12 +109,19 @@ void ExpectationBase::RetireAllPreRequisites()
100
109
  return;
101
110
  }
102
111
 
103
- for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
104
- it != immediate_prerequisites_.end(); ++it) {
105
- ExpectationBase* const prerequisite = it->expectation_base().get();
106
- if (!prerequisite->is_retired()) {
107
- prerequisite->RetireAllPreRequisites();
108
- prerequisite->Retire();
112
+ ::std::vector<ExpectationBase*> expectations(1, this);
113
+ while (!expectations.empty()) {
114
+ ExpectationBase* exp = expectations.back();
115
+ expectations.pop_back();
116
+
117
+ for (ExpectationSet::const_iterator it =
118
+ exp->immediate_prerequisites_.begin();
119
+ it != exp->immediate_prerequisites_.end(); ++it) {
120
+ ExpectationBase* next = it->expectation_base().get();
121
+ if (!next->is_retired()) {
122
+ next->Retire();
123
+ expectations.push_back(next);
124
+ }
109
125
  }
110
126
  }
111
127
  }
@@ -115,11 +131,18 @@ void ExpectationBase::RetireAllPreRequisites()
115
131
  bool ExpectationBase::AllPrerequisitesAreSatisfied() const
116
132
  GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
117
133
  g_gmock_mutex.AssertHeld();
118
- for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
119
- it != immediate_prerequisites_.end(); ++it) {
120
- if (!(it->expectation_base()->IsSatisfied()) ||
121
- !(it->expectation_base()->AllPrerequisitesAreSatisfied()))
122
- return false;
134
+ ::std::vector<const ExpectationBase*> expectations(1, this);
135
+ while (!expectations.empty()) {
136
+ const ExpectationBase* exp = expectations.back();
137
+ expectations.pop_back();
138
+
139
+ for (ExpectationSet::const_iterator it =
140
+ exp->immediate_prerequisites_.begin();
141
+ it != exp->immediate_prerequisites_.end(); ++it) {
142
+ const ExpectationBase* next = it->expectation_base().get();
143
+ if (!next->IsSatisfied()) return false;
144
+ expectations.push_back(next);
145
+ }
123
146
  }
124
147
  return true;
125
148
  }
@@ -128,19 +151,28 @@ bool ExpectationBase::AllPrerequisitesAreSatisfied() const
128
151
  void ExpectationBase::FindUnsatisfiedPrerequisites(ExpectationSet* result) const
129
152
  GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
130
153
  g_gmock_mutex.AssertHeld();
131
- for (ExpectationSet::const_iterator it = immediate_prerequisites_.begin();
132
- it != immediate_prerequisites_.end(); ++it) {
133
- if (it->expectation_base()->IsSatisfied()) {
134
- // If *it is satisfied and has a call count of 0, some of its
135
- // pre-requisites may not be satisfied yet.
136
- if (it->expectation_base()->call_count_ == 0) {
137
- it->expectation_base()->FindUnsatisfiedPrerequisites(result);
154
+ ::std::vector<const ExpectationBase*> expectations(1, this);
155
+ while (!expectations.empty()) {
156
+ const ExpectationBase* exp = expectations.back();
157
+ expectations.pop_back();
158
+
159
+ for (ExpectationSet::const_iterator it =
160
+ exp->immediate_prerequisites_.begin();
161
+ it != exp->immediate_prerequisites_.end(); ++it) {
162
+ const ExpectationBase* next = it->expectation_base().get();
163
+
164
+ if (next->IsSatisfied()) {
165
+ // If *it is satisfied and has a call count of 0, some of its
166
+ // pre-requisites may not be satisfied yet.
167
+ if (next->call_count_ == 0) {
168
+ expectations.push_back(next);
169
+ }
170
+ } else {
171
+ // Now that we know next is unsatisfied, we are not so interested
172
+ // in whether its pre-requisites are satisfied. Therefore we
173
+ // don't iterate into it here.
174
+ *result += *it;
138
175
  }
139
- } else {
140
- // Now that we know *it is unsatisfied, we are not so interested
141
- // in whether its pre-requisites are satisfied. Therefore we
142
- // don't recursively call FindUnsatisfiedPrerequisites() here.
143
- *result += *it;
144
176
  }
145
177
  }
146
178
  }
@@ -244,7 +276,7 @@ GTEST_API_ ThreadLocal<Sequence*> g_gmock_implicit_sequence;
244
276
 
245
277
  // Reports an uninteresting call (whose description is in msg) in the
246
278
  // manner specified by 'reaction'.
247
- void ReportUninterestingCall(CallReaction reaction, const string& msg) {
279
+ void ReportUninterestingCall(CallReaction reaction, const std::string& msg) {
248
280
  // Include a stack trace only if --gmock_verbose=info is specified.
249
281
  const int stack_frames_to_skip =
250
282
  GMOCK_FLAG(verbose) == kInfoVerbosity ? 3 : -1;
@@ -255,11 +287,13 @@ void ReportUninterestingCall(CallReaction reaction, const string& msg) {
255
287
  case kWarn:
256
288
  Log(kWarning,
257
289
  msg +
258
- "\nNOTE: You can safely ignore the above warning unless this "
259
- "call should not happen. Do not suppress it by blindly adding "
260
- "an EXPECT_CALL() if you don't mean to enforce the call. "
261
- "See https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#"
262
- "knowing-when-to-expect for details.\n",
290
+ "\nNOTE: You can safely ignore the above warning unless this "
291
+ "call should not happen. Do not suppress it by blindly adding "
292
+ "an EXPECT_CALL() if you don't mean to enforce the call. "
293
+ "See "
294
+ "https://github.com/google/googletest/blob/master/googlemock/"
295
+ "docs/CookBook.md#"
296
+ "knowing-when-to-expect for details.\n",
263
297
  stack_frames_to_skip);
264
298
  break;
265
299
  default: // FAIL
@@ -335,9 +369,10 @@ const char* UntypedFunctionMockerBase::Name() const
335
369
  // Calculates the result of invoking this mock function with the given
336
370
  // arguments, prints it, and returns it. The caller is responsible
337
371
  // for deleting the result.
338
- UntypedActionResultHolderBase*
339
- UntypedFunctionMockerBase::UntypedInvokeWith(const void* const untyped_args)
340
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
372
+ UntypedActionResultHolderBase* UntypedFunctionMockerBase::UntypedInvokeWith(
373
+ void* const untyped_args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
374
+ // See the definition of untyped_expectations_ for why access to it
375
+ // is unprotected here.
341
376
  if (untyped_expectations_.size() == 0) {
342
377
  // No expectation is set on this mock method - we have an
343
378
  // uninteresting call.
@@ -354,18 +389,21 @@ UntypedFunctionMockerBase::UntypedInvokeWith(const void* const untyped_args)
354
389
  // the behavior of ReportUninterestingCall().
355
390
  const bool need_to_report_uninteresting_call =
356
391
  // If the user allows this uninteresting call, we print it
357
- // only when he wants informational messages.
392
+ // only when they want informational messages.
358
393
  reaction == kAllow ? LogIsVisible(kInfo) :
359
- // If the user wants this to be a warning, we print it only
360
- // when he wants to see warnings.
361
- reaction == kWarn ? LogIsVisible(kWarning) :
362
- // Otherwise, the user wants this to be an error, and we
363
- // should always print detailed information in the error.
364
- true;
394
+ // If the user wants this to be a warning, we print
395
+ // it only when they want to see warnings.
396
+ reaction == kWarn
397
+ ? LogIsVisible(kWarning)
398
+ :
399
+ // Otherwise, the user wants this to be an error, and we
400
+ // should always print detailed information in the error.
401
+ true;
365
402
 
366
403
  if (!need_to_report_uninteresting_call) {
367
404
  // Perform the action without printing the call information.
368
- return this->UntypedPerformDefaultAction(untyped_args, "");
405
+ return this->UntypedPerformDefaultAction(
406
+ untyped_args, "Function call: " + std::string(Name()));
369
407
  }
370
408
 
371
409
  // Warns about the uninteresting call.
@@ -447,6 +485,8 @@ UntypedFunctionMockerBase::UntypedInvokeWith(const void* const untyped_args)
447
485
  // Returns an Expectation object that references and co-owns exp,
448
486
  // which must be an expectation on this mock function.
449
487
  Expectation UntypedFunctionMockerBase::GetHandleOf(ExpectationBase* exp) {
488
+ // See the definition of untyped_expectations_ for why access to it
489
+ // is unprotected here.
450
490
  for (UntypedExpectations::const_iterator it =
451
491
  untyped_expectations_.begin();
452
492
  it != untyped_expectations_.end(); ++it) {
@@ -509,6 +549,13 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
509
549
  return expectations_met;
510
550
  }
511
551
 
552
+ CallReaction intToCallReaction(int mock_behavior) {
553
+ if (mock_behavior >= kAllow && mock_behavior <= kFail) {
554
+ return static_cast<internal::CallReaction>(mock_behavior);
555
+ }
556
+ return kWarn;
557
+ }
558
+
512
559
  } // namespace internal
513
560
 
514
561
  // Class Mock.
@@ -576,9 +623,15 @@ class MockObjectRegistry {
576
623
  leaked_count++;
577
624
  }
578
625
  if (leaked_count > 0) {
579
- std::cout << "\nERROR: " << leaked_count
580
- << " leaked mock " << (leaked_count == 1 ? "object" : "objects")
581
- << " found at program exit.\n";
626
+ std::cout << "\nERROR: " << leaked_count << " leaked mock "
627
+ << (leaked_count == 1 ? "object" : "objects")
628
+ << " found at program exit. Expectations on a mock object is "
629
+ "verified when the object is destructed. Leaking a mock "
630
+ "means that its expectations aren't verified, which is "
631
+ "usually a test bug. If you really intend to leak a mock, "
632
+ "you can suppress this error using "
633
+ "testing::Mock::AllowLeak(mock_object), or you may use a "
634
+ "fake or stub instead of a mock.\n";
582
635
  std::cout.flush();
583
636
  ::std::cerr.flush();
584
637
  // RUN_ALL_TESTS() has already returned when this destructor is
@@ -649,7 +702,8 @@ internal::CallReaction Mock::GetReactionOnUninterestingCalls(
649
702
  GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
650
703
  internal::MutexLock l(&internal::g_gmock_mutex);
651
704
  return (g_uninteresting_call_reaction.count(mock_obj) == 0) ?
652
- internal::kDefault : g_uninteresting_call_reaction[mock_obj];
705
+ internal::intToCallReaction(GMOCK_FLAG(default_mock_behavior)) :
706
+ g_uninteresting_call_reaction[mock_obj];
653
707
  }
654
708
 
655
709
  // Tells Google Mock to ignore mock_obj when checking for leaked mock
@@ -821,3 +875,9 @@ InSequence::~InSequence() {
821
875
  }
822
876
 
823
877
  } // namespace testing
878
+
879
+ #ifdef _MSC_VER
880
+ #if _MSC_VER <= 1900
881
+ # pragma warning(pop)
882
+ #endif
883
+ #endif
@@ -48,6 +48,13 @@ GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity,
48
48
  " warning - prints warnings and errors.\n"
49
49
  " error - prints errors only.");
50
50
 
51
+ GMOCK_DEFINE_int32_(default_mock_behavior, 1,
52
+ "Controls the default behavior of mocks."
53
+ " Valid values:\n"
54
+ " 0 - by default, mocks act as NiceMocks.\n"
55
+ " 1 - by default, mocks act as NaggyMocks.\n"
56
+ " 2 - by default, mocks act as StrictMocks.");
57
+
51
58
  namespace internal {
52
59
 
53
60
  // Parses a string as a command line flag. The string should have the
@@ -120,6 +127,19 @@ static bool ParseGoogleMockStringFlag(const char* str, const char* flag,
120
127
  return true;
121
128
  }
122
129
 
130
+ static bool ParseGoogleMockIntFlag(const char* str, const char* flag,
131
+ int* value) {
132
+ // Gets the value of the flag as a string.
133
+ const char* const value_str = ParseGoogleMockFlagValue(str, flag, true);
134
+
135
+ // Aborts if the parsing failed.
136
+ if (value_str == NULL) return false;
137
+
138
+ // Sets *value to the value of the flag.
139
+ return ParseInt32(Message() << "The value of flag --" << flag,
140
+ value_str, value);
141
+ }
142
+
123
143
  // The internal implementation of InitGoogleMock().
124
144
  //
125
145
  // The type parameter CharType can be instantiated to either char or
@@ -138,7 +158,9 @@ void InitGoogleMockImpl(int* argc, CharType** argv) {
138
158
  // Do we see a Google Mock flag?
139
159
  if (ParseGoogleMockBoolFlag(arg, "catch_leaked_mocks",
140
160
  &GMOCK_FLAG(catch_leaked_mocks)) ||
141
- ParseGoogleMockStringFlag(arg, "verbose", &GMOCK_FLAG(verbose))) {
161
+ ParseGoogleMockStringFlag(arg, "verbose", &GMOCK_FLAG(verbose)) ||
162
+ ParseGoogleMockIntFlag(arg, "default_mock_behavior",
163
+ &GMOCK_FLAG(default_mock_behavior))) {
142
164
  // Yes. Shift the remainder of the argv list left by one. Note
143
165
  // that argv has (*argc + 1) elements, the last one always being
144
166
  // NULL. The following loop moves the trailing NULL element as
@@ -0,0 +1,123 @@
1
+ # Copyright 2017 Google Inc.
2
+ # All Rights Reserved.
3
+ #
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are
7
+ # met:
8
+ #
9
+ # * Redistributions of source code must retain the above copyright
10
+ # notice, this list of conditions and the following disclaimer.
11
+ # * Redistributions in binary form must reproduce the above
12
+ # copyright notice, this list of conditions and the following disclaimer
13
+ # in the documentation and/or other materials provided with the
14
+ # distribution.
15
+ # * Neither the name of Google Inc. nor the names of its
16
+ # contributors may be used to endorse or promote products derived from
17
+ # this software without specific prior written permission.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ #
31
+ # Author: misterg@google.com (Gennadiy Civil)
32
+ #
33
+ # Bazel Build for Google C++ Testing Framework(Google Test)-googlemock
34
+
35
+ licenses(["notice"])
36
+
37
+ """ gmock own tests """
38
+
39
+ cc_test(
40
+ name = "gmock_all_test",
41
+ size = "small",
42
+ srcs = glob(
43
+ include = [
44
+ "gmock-*.cc",
45
+ ],
46
+ ),
47
+ linkopts = select({
48
+ "//:windows": [],
49
+ "//:windows_msvc": [],
50
+ "//conditions:default": [
51
+ "-pthread",
52
+ ],
53
+ }),
54
+ deps = ["//:gtest"],
55
+ )
56
+
57
+ # Py tests
58
+
59
+ py_library(
60
+ name = "gmock_test_utils",
61
+ testonly = 1,
62
+ srcs = ["gmock_test_utils.py"],
63
+ )
64
+
65
+ cc_binary(
66
+ name = "gmock_leak_test_",
67
+ testonly = 1,
68
+ srcs = ["gmock_leak_test_.cc"],
69
+ deps = [
70
+ "//:gtest_main",
71
+ ],
72
+ )
73
+
74
+ py_test(
75
+ name = "gmock_leak_test",
76
+ size = "medium",
77
+ srcs = ["gmock_leak_test.py"],
78
+ data = [
79
+ ":gmock_leak_test_",
80
+ ":gmock_test_utils",
81
+ ],
82
+ )
83
+
84
+ cc_test(
85
+ name = "gmock_link_test",
86
+ size = "small",
87
+ srcs = [
88
+ "gmock_link2_test.cc",
89
+ "gmock_link_test.cc",
90
+ "gmock_link_test.h",
91
+ ],
92
+ deps = [
93
+ "//:gtest_main",
94
+ ],
95
+ )
96
+
97
+ cc_binary(
98
+ name = "gmock_output_test_",
99
+ srcs = ["gmock_output_test_.cc"],
100
+ deps = [
101
+ "//:gtest",
102
+ ],
103
+ )
104
+
105
+ py_test(
106
+ name = "gmock_output_test",
107
+ size = "medium",
108
+ srcs = ["gmock_output_test.py"],
109
+ data = [
110
+ ":gmock_output_test_",
111
+ ":gmock_output_test_golden.txt",
112
+ ],
113
+ deps = [":gmock_test_utils"],
114
+ )
115
+
116
+ cc_test(
117
+ name = "gmock_test",
118
+ size = "small",
119
+ srcs = ["gmock_test.cc"],
120
+ deps = [
121
+ "//:gtest_main",
122
+ ],
123
+ )
@@ -33,6 +33,15 @@
33
33
  //
34
34
  // This file tests the built-in actions.
35
35
 
36
+ // Silence C4800 (C4800: 'int *const ': forcing value
37
+ // to bool 'true' or 'false') for MSVC 14,15
38
+ #ifdef _MSC_VER
39
+ #if _MSC_VER <= 1900
40
+ # pragma warning(push)
41
+ # pragma warning(disable:4800)
42
+ #endif
43
+ #endif
44
+
36
45
  #include "gmock/gmock-actions.h"
37
46
  #include <algorithm>
38
47
  #include <iterator>
@@ -65,6 +74,7 @@ using testing::ReturnRef;
65
74
  using testing::ReturnRefOfCopy;
66
75
  using testing::SetArgPointee;
67
76
  using testing::SetArgumentPointee;
77
+ using testing::Unused;
68
78
  using testing::_;
69
79
  using testing::get;
70
80
  using testing::internal::BuiltInDefaultValue;
@@ -107,7 +117,11 @@ TEST(BuiltInDefaultValueTest, IsZeroForNumericTypes) {
107
117
  EXPECT_EQ(0, BuiltInDefaultValue<signed wchar_t>::Get());
108
118
  #endif
109
119
  #if GMOCK_WCHAR_T_IS_NATIVE_
120
+ #if !defined(__WCHAR_UNSIGNED__)
110
121
  EXPECT_EQ(0, BuiltInDefaultValue<wchar_t>::Get());
122
+ #else
123
+ EXPECT_EQ(0U, BuiltInDefaultValue<wchar_t>::Get());
124
+ #endif
111
125
  #endif
112
126
  EXPECT_EQ(0U, BuiltInDefaultValue<unsigned short>::Get()); // NOLINT
113
127
  EXPECT_EQ(0, BuiltInDefaultValue<signed short>::Get()); // NOLINT
@@ -214,7 +228,7 @@ class MyNonDefaultConstructible {
214
228
  int value_;
215
229
  };
216
230
 
217
- #if GTEST_HAS_STD_TYPE_TRAITS_
231
+ #if GTEST_LANG_CXX11
218
232
 
219
233
  TEST(BuiltInDefaultValueTest, ExistsForDefaultConstructibleType) {
220
234
  EXPECT_TRUE(BuiltInDefaultValue<MyDefaultConstructible>::Exists());
@@ -224,7 +238,7 @@ TEST(BuiltInDefaultValueTest, IsDefaultConstructedForDefaultConstructibleType) {
224
238
  EXPECT_EQ(42, BuiltInDefaultValue<MyDefaultConstructible>::Get().value());
225
239
  }
226
240
 
227
- #endif // GTEST_HAS_STD_TYPE_TRAITS_
241
+ #endif // GTEST_LANG_CXX11
228
242
 
229
243
  TEST(BuiltInDefaultValueTest, DoesNotExistForNonDefaultConstructibleType) {
230
244
  EXPECT_FALSE(BuiltInDefaultValue<MyNonDefaultConstructible>::Exists());
@@ -700,6 +714,9 @@ class MockClass {
700
714
  MOCK_METHOD0(MakeUnique, std::unique_ptr<int>());
701
715
  MOCK_METHOD0(MakeUniqueBase, std::unique_ptr<Base>());
702
716
  MOCK_METHOD0(MakeVectorUnique, std::vector<std::unique_ptr<int>>());
717
+ MOCK_METHOD1(TakeUnique, int(std::unique_ptr<int>));
718
+ MOCK_METHOD2(TakeUnique,
719
+ int(const std::unique_ptr<int>&, std::unique_ptr<int>));
703
720
  #endif
704
721
 
705
722
  private:
@@ -1406,6 +1423,153 @@ TEST(MockMethodTest, CanReturnMoveOnlyValue_Invoke) {
1406
1423
  EXPECT_EQ(7, *vresult[0]);
1407
1424
  }
1408
1425
 
1426
+ TEST(MockMethodTest, CanTakeMoveOnlyValue) {
1427
+ MockClass mock;
1428
+ auto make = [](int i) { return std::unique_ptr<int>(new int(i)); };
1429
+
1430
+ EXPECT_CALL(mock, TakeUnique(_)).WillRepeatedly([](std::unique_ptr<int> i) {
1431
+ return *i;
1432
+ });
1433
+ // DoAll() does not compile, since it would move from its arguments twice.
1434
+ // EXPECT_CALL(mock, TakeUnique(_, _))
1435
+ // .WillRepeatedly(DoAll(Invoke([](std::unique_ptr<int> j) {}),
1436
+ // Return(1)));
1437
+ EXPECT_CALL(mock, TakeUnique(testing::Pointee(7)))
1438
+ .WillOnce(Return(-7))
1439
+ .RetiresOnSaturation();
1440
+ EXPECT_CALL(mock, TakeUnique(testing::IsNull()))
1441
+ .WillOnce(Return(-1))
1442
+ .RetiresOnSaturation();
1443
+
1444
+ EXPECT_EQ(5, mock.TakeUnique(make(5)));
1445
+ EXPECT_EQ(-7, mock.TakeUnique(make(7)));
1446
+ EXPECT_EQ(7, mock.TakeUnique(make(7)));
1447
+ EXPECT_EQ(7, mock.TakeUnique(make(7)));
1448
+ EXPECT_EQ(-1, mock.TakeUnique({}));
1449
+
1450
+ // Some arguments are moved, some passed by reference.
1451
+ auto lvalue = make(6);
1452
+ EXPECT_CALL(mock, TakeUnique(_, _))
1453
+ .WillOnce([](const std::unique_ptr<int>& i, std::unique_ptr<int> j) {
1454
+ return *i * *j;
1455
+ });
1456
+ EXPECT_EQ(42, mock.TakeUnique(lvalue, make(7)));
1457
+
1458
+ // The unique_ptr can be saved by the action.
1459
+ std::unique_ptr<int> saved;
1460
+ EXPECT_CALL(mock, TakeUnique(_)).WillOnce([&saved](std::unique_ptr<int> i) {
1461
+ saved = std::move(i);
1462
+ return 0;
1463
+ });
1464
+ EXPECT_EQ(0, mock.TakeUnique(make(42)));
1465
+ EXPECT_EQ(42, *saved);
1466
+ }
1467
+
1409
1468
  #endif // GTEST_HAS_STD_UNIQUE_PTR_
1410
1469
 
1470
+ #if GTEST_LANG_CXX11
1471
+ // Tests for std::function based action.
1472
+
1473
+ int Add(int val, int& ref, int* ptr) { // NOLINT
1474
+ int result = val + ref + *ptr;
1475
+ ref = 42;
1476
+ *ptr = 43;
1477
+ return result;
1478
+ }
1479
+
1480
+ int Deref(std::unique_ptr<int> ptr) { return *ptr; }
1481
+
1482
+ struct Double {
1483
+ template <typename T>
1484
+ T operator()(T t) { return 2 * t; }
1485
+ };
1486
+
1487
+ std::unique_ptr<int> UniqueInt(int i) {
1488
+ return std::unique_ptr<int>(new int(i));
1489
+ }
1490
+
1491
+ TEST(FunctorActionTest, ActionFromFunction) {
1492
+ Action<int(int, int&, int*)> a = &Add;
1493
+ int x = 1, y = 2, z = 3;
1494
+ EXPECT_EQ(6, a.Perform(std::forward_as_tuple(x, y, &z)));
1495
+ EXPECT_EQ(42, y);
1496
+ EXPECT_EQ(43, z);
1497
+
1498
+ Action<int(std::unique_ptr<int>)> a1 = &Deref;
1499
+ EXPECT_EQ(7, a1.Perform(std::make_tuple(UniqueInt(7))));
1500
+ }
1501
+
1502
+ TEST(FunctorActionTest, ActionFromLambda) {
1503
+ Action<int(bool, int)> a1 = [](bool b, int i) { return b ? i : 0; };
1504
+ EXPECT_EQ(5, a1.Perform(make_tuple(true, 5)));
1505
+ EXPECT_EQ(0, a1.Perform(make_tuple(false, 5)));
1506
+
1507
+ std::unique_ptr<int> saved;
1508
+ Action<void(std::unique_ptr<int>)> a2 = [&saved](std::unique_ptr<int> p) {
1509
+ saved = std::move(p);
1510
+ };
1511
+ a2.Perform(make_tuple(UniqueInt(5)));
1512
+ EXPECT_EQ(5, *saved);
1513
+ }
1514
+
1515
+ TEST(FunctorActionTest, PolymorphicFunctor) {
1516
+ Action<int(int)> ai = Double();
1517
+ EXPECT_EQ(2, ai.Perform(make_tuple(1)));
1518
+ Action<double(double)> ad = Double(); // Double? Double double!
1519
+ EXPECT_EQ(3.0, ad.Perform(make_tuple(1.5)));
1520
+ }
1521
+
1522
+ TEST(FunctorActionTest, TypeConversion) {
1523
+ // Numeric promotions are allowed.
1524
+ const Action<bool(int)> a1 = [](int i) { return i > 1; };
1525
+ const Action<int(bool)> a2 = Action<int(bool)>(a1);
1526
+ EXPECT_EQ(1, a1.Perform(make_tuple(42)));
1527
+ EXPECT_EQ(0, a2.Perform(make_tuple(42)));
1528
+
1529
+ // Implicit constructors are allowed.
1530
+ const Action<bool(std::string)> s1 = [](std::string s) { return !s.empty(); };
1531
+ const Action<int(const char*)> s2 = Action<int(const char*)>(s1);
1532
+ EXPECT_EQ(0, s2.Perform(make_tuple("")));
1533
+ EXPECT_EQ(1, s2.Perform(make_tuple("hello")));
1534
+
1535
+ // Also between the lambda and the action itself.
1536
+ const Action<bool(std::string)> x = [](Unused) { return 42; };
1537
+ EXPECT_TRUE(x.Perform(make_tuple("hello")));
1538
+ }
1539
+
1540
+ TEST(FunctorActionTest, UnusedArguments) {
1541
+ // Verify that users can ignore uninteresting arguments.
1542
+ Action<int(int, double y, double z)> a =
1543
+ [](int i, Unused, Unused) { return 2 * i; };
1544
+ tuple<int, double, double> dummy = make_tuple(3, 7.3, 9.44);
1545
+ EXPECT_EQ(6, a.Perform(dummy));
1546
+ }
1547
+
1548
+ // Test that basic built-in actions work with move-only arguments.
1549
+ // TODO(rburny): Currently, almost all ActionInterface-based actions will not
1550
+ // work, even if they only try to use other, copyable arguments. Implement them
1551
+ // if necessary (but note that DoAll cannot work on non-copyable types anyway -
1552
+ // so maybe it's better to make users use lambdas instead.
1553
+ TEST(MoveOnlyArgumentsTest, ReturningActions) {
1554
+ Action<int(std::unique_ptr<int>)> a = Return(1);
1555
+ EXPECT_EQ(1, a.Perform(make_tuple(nullptr)));
1556
+
1557
+ a = testing::WithoutArgs([]() { return 7; });
1558
+ EXPECT_EQ(7, a.Perform(make_tuple(nullptr)));
1559
+
1560
+ Action<void(std::unique_ptr<int>, int*)> a2 = testing::SetArgPointee<1>(3);
1561
+ int x = 0;
1562
+ a2.Perform(make_tuple(nullptr, &x));
1563
+ EXPECT_EQ(x, 3);
1564
+ }
1565
+
1566
+ #endif // GTEST_LANG_CXX11
1567
+
1411
1568
  } // Unnamed namespace
1569
+
1570
+ #ifdef _MSC_VER
1571
+ #if _MSC_VER == 1900
1572
+ # pragma warning(pop)
1573
+ #endif
1574
+ #endif
1575
+