rj_schema 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (614) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rj_schema/rapidjson/CHANGELOG.md +158 -0
  3. data/ext/rj_schema/rapidjson/CMakeLists.txt +226 -0
  4. data/ext/rj_schema/rapidjson/CMakeModules/FindGTestSrc.cmake +30 -0
  5. data/ext/rj_schema/rapidjson/RapidJSON.pc.in +7 -0
  6. data/ext/rj_schema/rapidjson/RapidJSONConfig.cmake.in +25 -0
  7. data/ext/rj_schema/rapidjson/RapidJSONConfigVersion.cmake.in +10 -0
  8. data/ext/rj_schema/rapidjson/appveyor.yml +54 -0
  9. data/ext/rj_schema/rapidjson/bin/data/abcde.txt +1 -0
  10. data/ext/rj_schema/rapidjson/bin/data/glossary.json +22 -0
  11. data/ext/rj_schema/rapidjson/bin/data/menu.json +27 -0
  12. data/ext/rj_schema/rapidjson/bin/data/readme.txt +1 -0
  13. data/ext/rj_schema/rapidjson/bin/data/sample.json +3315 -0
  14. data/ext/rj_schema/rapidjson/bin/data/webapp.json +88 -0
  15. data/ext/rj_schema/rapidjson/bin/data/widget.json +26 -0
  16. data/ext/rj_schema/rapidjson/bin/draft-04/schema +150 -0
  17. data/ext/rj_schema/rapidjson/bin/encodings/utf16be.json +0 -0
  18. data/ext/rj_schema/rapidjson/bin/encodings/utf16bebom.json +0 -0
  19. data/ext/rj_schema/rapidjson/bin/encodings/utf16le.json +0 -0
  20. data/ext/rj_schema/rapidjson/bin/encodings/utf16lebom.json +0 -0
  21. data/ext/rj_schema/rapidjson/bin/encodings/utf32be.json +0 -0
  22. data/ext/rj_schema/rapidjson/bin/encodings/utf32bebom.json +0 -0
  23. data/ext/rj_schema/rapidjson/bin/encodings/utf32le.json +0 -0
  24. data/ext/rj_schema/rapidjson/bin/encodings/utf32lebom.json +0 -0
  25. data/ext/rj_schema/rapidjson/bin/encodings/utf8.json +7 -0
  26. data/ext/rj_schema/rapidjson/bin/encodings/utf8bom.json +7 -0
  27. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail1.json +1 -0
  28. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail10.json +1 -0
  29. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail11.json +1 -0
  30. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail12.json +1 -0
  31. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail13.json +1 -0
  32. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail14.json +1 -0
  33. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail15.json +1 -0
  34. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail16.json +1 -0
  35. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail17.json +1 -0
  36. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail18.json +1 -0
  37. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail19.json +1 -0
  38. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail2.json +1 -0
  39. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail20.json +1 -0
  40. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail21.json +1 -0
  41. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail22.json +1 -0
  42. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail23.json +1 -0
  43. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail24.json +1 -0
  44. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail25.json +1 -0
  45. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail26.json +1 -0
  46. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail27.json +2 -0
  47. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail28.json +2 -0
  48. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail29.json +1 -0
  49. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail3.json +1 -0
  50. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail30.json +1 -0
  51. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail31.json +1 -0
  52. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail32.json +1 -0
  53. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail33.json +1 -0
  54. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail4.json +1 -0
  55. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail5.json +1 -0
  56. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail6.json +1 -0
  57. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail7.json +1 -0
  58. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail8.json +1 -0
  59. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail9.json +1 -0
  60. data/ext/rj_schema/rapidjson/bin/jsonchecker/pass1.json +58 -0
  61. data/ext/rj_schema/rapidjson/bin/jsonchecker/pass2.json +1 -0
  62. data/ext/rj_schema/rapidjson/bin/jsonchecker/pass3.json +6 -0
  63. data/ext/rj_schema/rapidjson/bin/jsonchecker/readme.txt +3 -0
  64. data/ext/rj_schema/rapidjson/bin/jsonschema/LICENSE +19 -0
  65. data/ext/rj_schema/rapidjson/bin/jsonschema/README.md +148 -0
  66. data/ext/rj_schema/rapidjson/bin/jsonschema/bin/jsonschema_suite +283 -0
  67. data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/folder/folderInteger.json +3 -0
  68. data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/integer.json +3 -0
  69. data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/subSchemas.json +8 -0
  70. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/additionalItems.json +82 -0
  71. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/additionalProperties.json +88 -0
  72. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/default.json +49 -0
  73. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/dependencies.json +108 -0
  74. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/disallow.json +80 -0
  75. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/divisibleBy.json +60 -0
  76. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/enum.json +71 -0
  77. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/extends.json +94 -0
  78. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/items.json +46 -0
  79. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maxItems.json +28 -0
  80. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maxLength.json +33 -0
  81. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maximum.json +42 -0
  82. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minItems.json +28 -0
  83. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minLength.json +33 -0
  84. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minimum.json +42 -0
  85. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/bignum.json +107 -0
  86. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/format.json +222 -0
  87. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/jsregex.json +18 -0
  88. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/zeroTerminatedFloats.json +15 -0
  89. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/pattern.json +34 -0
  90. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/patternProperties.json +110 -0
  91. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/properties.json +92 -0
  92. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/ref.json +159 -0
  93. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/refRemote.json +74 -0
  94. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/required.json +53 -0
  95. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/type.json +474 -0
  96. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/uniqueItems.json +79 -0
  97. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/additionalItems.json +82 -0
  98. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/additionalProperties.json +88 -0
  99. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/allOf.json +112 -0
  100. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/anyOf.json +68 -0
  101. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/default.json +49 -0
  102. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/definitions.json +32 -0
  103. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/dependencies.json +113 -0
  104. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/enum.json +72 -0
  105. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/items.json +46 -0
  106. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxItems.json +28 -0
  107. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxLength.json +33 -0
  108. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxProperties.json +28 -0
  109. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maximum.json +42 -0
  110. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minItems.json +28 -0
  111. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minLength.json +33 -0
  112. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minProperties.json +28 -0
  113. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minimum.json +42 -0
  114. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/multipleOf.json +60 -0
  115. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/not.json +96 -0
  116. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/oneOf.json +68 -0
  117. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/bignum.json +107 -0
  118. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/format.json +148 -0
  119. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/zeroTerminatedFloats.json +15 -0
  120. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/pattern.json +34 -0
  121. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/patternProperties.json +110 -0
  122. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/properties.json +92 -0
  123. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/ref.json +159 -0
  124. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/refRemote.json +74 -0
  125. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/required.json +39 -0
  126. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/type.json +330 -0
  127. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/uniqueItems.json +79 -0
  128. data/ext/rj_schema/rapidjson/bin/jsonschema/tox.ini +8 -0
  129. data/ext/rj_schema/rapidjson/bin/types/booleans.json +102 -0
  130. data/ext/rj_schema/rapidjson/bin/types/floats.json +102 -0
  131. data/ext/rj_schema/rapidjson/bin/types/guids.json +102 -0
  132. data/ext/rj_schema/rapidjson/bin/types/integers.json +102 -0
  133. data/ext/rj_schema/rapidjson/bin/types/mixed.json +592 -0
  134. data/ext/rj_schema/rapidjson/bin/types/nulls.json +102 -0
  135. data/ext/rj_schema/rapidjson/bin/types/paragraphs.json +102 -0
  136. data/ext/rj_schema/rapidjson/bin/types/readme.txt +1 -0
  137. data/ext/rj_schema/rapidjson/contrib/natvis/LICENSE +45 -0
  138. data/ext/rj_schema/rapidjson/contrib/natvis/README.md +7 -0
  139. data/ext/rj_schema/rapidjson/contrib/natvis/rapidjson.natvis +38 -0
  140. data/ext/rj_schema/rapidjson/doc/CMakeLists.txt +27 -0
  141. data/ext/rj_schema/rapidjson/doc/Doxyfile.in +2369 -0
  142. data/ext/rj_schema/rapidjson/doc/Doxyfile.zh-cn.in +2369 -0
  143. data/ext/rj_schema/rapidjson/doc/diagram/architecture.dot +50 -0
  144. data/ext/rj_schema/rapidjson/doc/diagram/architecture.png +0 -0
  145. data/ext/rj_schema/rapidjson/doc/diagram/insituparsing.dot +65 -0
  146. data/ext/rj_schema/rapidjson/doc/diagram/insituparsing.png +0 -0
  147. data/ext/rj_schema/rapidjson/doc/diagram/iterative-parser-states-diagram.dot +62 -0
  148. data/ext/rj_schema/rapidjson/doc/diagram/iterative-parser-states-diagram.png +0 -0
  149. data/ext/rj_schema/rapidjson/doc/diagram/makefile +8 -0
  150. data/ext/rj_schema/rapidjson/doc/diagram/move1.dot +47 -0
  151. data/ext/rj_schema/rapidjson/doc/diagram/move1.png +0 -0
  152. data/ext/rj_schema/rapidjson/doc/diagram/move2.dot +62 -0
  153. data/ext/rj_schema/rapidjson/doc/diagram/move2.png +0 -0
  154. data/ext/rj_schema/rapidjson/doc/diagram/move3.dot +60 -0
  155. data/ext/rj_schema/rapidjson/doc/diagram/move3.png +0 -0
  156. data/ext/rj_schema/rapidjson/doc/diagram/normalparsing.dot +56 -0
  157. data/ext/rj_schema/rapidjson/doc/diagram/normalparsing.png +0 -0
  158. data/ext/rj_schema/rapidjson/doc/diagram/simpledom.dot +54 -0
  159. data/ext/rj_schema/rapidjson/doc/diagram/simpledom.png +0 -0
  160. data/ext/rj_schema/rapidjson/doc/diagram/tutorial.dot +58 -0
  161. data/ext/rj_schema/rapidjson/doc/diagram/tutorial.png +0 -0
  162. data/ext/rj_schema/rapidjson/doc/diagram/utilityclass.dot +73 -0
  163. data/ext/rj_schema/rapidjson/doc/diagram/utilityclass.png +0 -0
  164. data/ext/rj_schema/rapidjson/doc/dom.md +281 -0
  165. data/ext/rj_schema/rapidjson/doc/dom.zh-cn.md +285 -0
  166. data/ext/rj_schema/rapidjson/doc/encoding.md +146 -0
  167. data/ext/rj_schema/rapidjson/doc/encoding.zh-cn.md +152 -0
  168. data/ext/rj_schema/rapidjson/doc/faq.md +289 -0
  169. data/ext/rj_schema/rapidjson/doc/faq.zh-cn.md +290 -0
  170. data/ext/rj_schema/rapidjson/doc/features.md +104 -0
  171. data/ext/rj_schema/rapidjson/doc/features.zh-cn.md +103 -0
  172. data/ext/rj_schema/rapidjson/doc/internals.md +368 -0
  173. data/ext/rj_schema/rapidjson/doc/internals.zh-cn.md +363 -0
  174. data/ext/rj_schema/rapidjson/doc/logo/rapidjson.png +0 -0
  175. data/ext/rj_schema/rapidjson/doc/logo/rapidjson.svg +119 -0
  176. data/ext/rj_schema/rapidjson/doc/misc/DoxygenLayout.xml +194 -0
  177. data/ext/rj_schema/rapidjson/doc/misc/doxygenextra.css +274 -0
  178. data/ext/rj_schema/rapidjson/doc/misc/footer.html +11 -0
  179. data/ext/rj_schema/rapidjson/doc/misc/header.html +24 -0
  180. data/ext/rj_schema/rapidjson/doc/npm.md +31 -0
  181. data/ext/rj_schema/rapidjson/doc/performance.md +26 -0
  182. data/ext/rj_schema/rapidjson/doc/performance.zh-cn.md +26 -0
  183. data/ext/rj_schema/rapidjson/doc/pointer.md +234 -0
  184. data/ext/rj_schema/rapidjson/doc/pointer.zh-cn.md +234 -0
  185. data/ext/rj_schema/rapidjson/doc/sax.md +509 -0
  186. data/ext/rj_schema/rapidjson/doc/sax.zh-cn.md +487 -0
  187. data/ext/rj_schema/rapidjson/doc/schema.md +505 -0
  188. data/ext/rj_schema/rapidjson/doc/schema.zh-cn.md +237 -0
  189. data/ext/rj_schema/rapidjson/doc/stream.md +429 -0
  190. data/ext/rj_schema/rapidjson/doc/stream.zh-cn.md +429 -0
  191. data/ext/rj_schema/rapidjson/doc/tutorial.md +536 -0
  192. data/ext/rj_schema/rapidjson/doc/tutorial.zh-cn.md +535 -0
  193. data/ext/rj_schema/rapidjson/docker/debian/Dockerfile +8 -0
  194. data/ext/rj_schema/rapidjson/example/CMakeLists.txt +46 -0
  195. data/ext/rj_schema/rapidjson/example/archiver/archiver.cpp +292 -0
  196. data/ext/rj_schema/rapidjson/example/archiver/archiver.h +145 -0
  197. data/ext/rj_schema/rapidjson/example/archiver/archivertest.cpp +287 -0
  198. data/ext/rj_schema/rapidjson/example/capitalize/capitalize.cpp +67 -0
  199. data/ext/rj_schema/rapidjson/example/condense/condense.cpp +32 -0
  200. data/ext/rj_schema/rapidjson/example/filterkey/filterkey.cpp +135 -0
  201. data/ext/rj_schema/rapidjson/example/filterkeydom/filterkeydom.cpp +170 -0
  202. data/ext/rj_schema/rapidjson/example/jsonx/jsonx.cpp +207 -0
  203. data/ext/rj_schema/rapidjson/example/lookaheadparser/lookaheadparser.cpp +350 -0
  204. data/ext/rj_schema/rapidjson/example/messagereader/messagereader.cpp +105 -0
  205. data/ext/rj_schema/rapidjson/example/parsebyparts/parsebyparts.cpp +176 -0
  206. data/ext/rj_schema/rapidjson/example/pretty/pretty.cpp +30 -0
  207. data/ext/rj_schema/rapidjson/example/prettyauto/prettyauto.cpp +56 -0
  208. data/ext/rj_schema/rapidjson/example/schemavalidator/schemavalidator.cpp +78 -0
  209. data/ext/rj_schema/rapidjson/example/serialize/serialize.cpp +173 -0
  210. data/ext/rj_schema/rapidjson/example/simpledom/simpledom.cpp +29 -0
  211. data/ext/rj_schema/rapidjson/example/simplepullreader/simplepullreader.cpp +53 -0
  212. data/ext/rj_schema/rapidjson/example/simplereader/simplereader.cpp +42 -0
  213. data/ext/rj_schema/rapidjson/example/simplewriter/simplewriter.cpp +36 -0
  214. data/ext/rj_schema/rapidjson/example/sortkeys/sortkeys.cpp +62 -0
  215. data/ext/rj_schema/rapidjson/example/tutorial/tutorial.cpp +151 -0
  216. data/ext/rj_schema/rapidjson/include/rapidjson/allocators.h +284 -0
  217. data/ext/rj_schema/rapidjson/include/rapidjson/cursorstreamwrapper.h +78 -0
  218. data/ext/rj_schema/rapidjson/include/rapidjson/document.h +2732 -0
  219. data/ext/rj_schema/rapidjson/include/rapidjson/encodedstream.h +299 -0
  220. data/ext/rj_schema/rapidjson/include/rapidjson/encodings.h +716 -0
  221. data/ext/rj_schema/rapidjson/include/rapidjson/error/en.h +74 -0
  222. data/ext/rj_schema/rapidjson/include/rapidjson/error/error.h +161 -0
  223. data/ext/rj_schema/rapidjson/include/rapidjson/filereadstream.h +99 -0
  224. data/ext/rj_schema/rapidjson/include/rapidjson/filewritestream.h +104 -0
  225. data/ext/rj_schema/rapidjson/include/rapidjson/fwd.h +151 -0
  226. data/ext/rj_schema/rapidjson/include/rapidjson/internal/biginteger.h +290 -0
  227. data/ext/rj_schema/rapidjson/include/rapidjson/internal/clzll.h +71 -0
  228. data/ext/rj_schema/rapidjson/include/rapidjson/internal/diyfp.h +257 -0
  229. data/ext/rj_schema/rapidjson/include/rapidjson/internal/dtoa.h +245 -0
  230. data/ext/rj_schema/rapidjson/include/rapidjson/internal/ieee754.h +78 -0
  231. data/ext/rj_schema/rapidjson/include/rapidjson/internal/itoa.h +308 -0
  232. data/ext/rj_schema/rapidjson/include/rapidjson/internal/meta.h +186 -0
  233. data/ext/rj_schema/rapidjson/include/rapidjson/internal/pow10.h +55 -0
  234. data/ext/rj_schema/rapidjson/include/rapidjson/internal/regex.h +739 -0
  235. data/ext/rj_schema/rapidjson/include/rapidjson/internal/stack.h +232 -0
  236. data/ext/rj_schema/rapidjson/include/rapidjson/internal/strfunc.h +69 -0
  237. data/ext/rj_schema/rapidjson/include/rapidjson/internal/strtod.h +290 -0
  238. data/ext/rj_schema/rapidjson/include/rapidjson/internal/swap.h +46 -0
  239. data/ext/rj_schema/rapidjson/include/rapidjson/istreamwrapper.h +128 -0
  240. data/ext/rj_schema/rapidjson/include/rapidjson/memorybuffer.h +70 -0
  241. data/ext/rj_schema/rapidjson/include/rapidjson/memorystream.h +71 -0
  242. data/ext/rj_schema/rapidjson/include/rapidjson/msinttypes/inttypes.h +316 -0
  243. data/ext/rj_schema/rapidjson/include/rapidjson/msinttypes/stdint.h +300 -0
  244. data/ext/rj_schema/rapidjson/include/rapidjson/ostreamwrapper.h +81 -0
  245. data/ext/rj_schema/rapidjson/include/rapidjson/pointer.h +1415 -0
  246. data/ext/rj_schema/rapidjson/include/rapidjson/prettywriter.h +277 -0
  247. data/ext/rj_schema/rapidjson/include/rapidjson/rapidjson.h +676 -0
  248. data/ext/rj_schema/rapidjson/include/rapidjson/reader.h +2236 -0
  249. data/ext/rj_schema/rapidjson/include/rapidjson/schema.h +2496 -0
  250. data/ext/rj_schema/rapidjson/include/rapidjson/stream.h +223 -0
  251. data/ext/rj_schema/rapidjson/include/rapidjson/stringbuffer.h +121 -0
  252. data/ext/rj_schema/rapidjson/include/rapidjson/writer.h +710 -0
  253. data/ext/rj_schema/rapidjson/include_dirs.js +2 -0
  254. data/ext/rj_schema/rapidjson/library.json +15 -0
  255. data/ext/rj_schema/rapidjson/license.txt +57 -0
  256. data/ext/rj_schema/rapidjson/package.json +24 -0
  257. data/ext/rj_schema/rapidjson/rapidjson.autopkg +77 -0
  258. data/ext/rj_schema/rapidjson/readme.md +210 -0
  259. data/ext/rj_schema/rapidjson/readme.zh-cn.md +152 -0
  260. data/ext/rj_schema/rapidjson/test/CMakeLists.txt +20 -0
  261. data/ext/rj_schema/rapidjson/test/perftest/CMakeLists.txt +28 -0
  262. data/ext/rj_schema/rapidjson/test/perftest/misctest.cpp +974 -0
  263. data/ext/rj_schema/rapidjson/test/perftest/perftest.cpp +24 -0
  264. data/ext/rj_schema/rapidjson/test/perftest/perftest.h +185 -0
  265. data/ext/rj_schema/rapidjson/test/perftest/platformtest.cpp +166 -0
  266. data/ext/rj_schema/rapidjson/test/perftest/rapidjsontest.cpp +546 -0
  267. data/ext/rj_schema/rapidjson/test/perftest/schematest.cpp +223 -0
  268. data/ext/rj_schema/rapidjson/test/unittest/CMakeLists.txt +92 -0
  269. data/ext/rj_schema/rapidjson/test/unittest/allocatorstest.cpp +100 -0
  270. data/ext/rj_schema/rapidjson/test/unittest/bigintegertest.cpp +138 -0
  271. data/ext/rj_schema/rapidjson/test/unittest/cursorstreamwrappertest.cpp +115 -0
  272. data/ext/rj_schema/rapidjson/test/unittest/documenttest.cpp +672 -0
  273. data/ext/rj_schema/rapidjson/test/unittest/dtoatest.cpp +98 -0
  274. data/ext/rj_schema/rapidjson/test/unittest/encodedstreamtest.cpp +313 -0
  275. data/ext/rj_schema/rapidjson/test/unittest/encodingstest.cpp +451 -0
  276. data/ext/rj_schema/rapidjson/test/unittest/filestreamtest.cpp +155 -0
  277. data/ext/rj_schema/rapidjson/test/unittest/fwdtest.cpp +230 -0
  278. data/ext/rj_schema/rapidjson/test/unittest/istreamwrappertest.cpp +181 -0
  279. data/ext/rj_schema/rapidjson/test/unittest/itoatest.cpp +160 -0
  280. data/ext/rj_schema/rapidjson/test/unittest/jsoncheckertest.cpp +143 -0
  281. data/ext/rj_schema/rapidjson/test/unittest/namespacetest.cpp +70 -0
  282. data/ext/rj_schema/rapidjson/test/unittest/ostreamwrappertest.cpp +92 -0
  283. data/ext/rj_schema/rapidjson/test/unittest/pointertest.cpp +1638 -0
  284. data/ext/rj_schema/rapidjson/test/unittest/prettywritertest.cpp +373 -0
  285. data/ext/rj_schema/rapidjson/test/unittest/readertest.cpp +2225 -0
  286. data/ext/rj_schema/rapidjson/test/unittest/regextest.cpp +639 -0
  287. data/ext/rj_schema/rapidjson/test/unittest/schematest.cpp +2072 -0
  288. data/ext/rj_schema/rapidjson/test/unittest/simdtest.cpp +219 -0
  289. data/ext/rj_schema/rapidjson/test/unittest/strfunctest.cpp +30 -0
  290. data/ext/rj_schema/rapidjson/test/unittest/stringbuffertest.cpp +192 -0
  291. data/ext/rj_schema/rapidjson/test/unittest/strtodtest.cpp +132 -0
  292. data/ext/rj_schema/rapidjson/test/unittest/unittest.cpp +51 -0
  293. data/ext/rj_schema/rapidjson/test/unittest/unittest.h +143 -0
  294. data/ext/rj_schema/rapidjson/test/unittest/valuetest.cpp +1851 -0
  295. data/ext/rj_schema/rapidjson/test/unittest/writertest.cpp +598 -0
  296. data/ext/rj_schema/rapidjson/test/valgrind.supp +17 -0
  297. data/ext/rj_schema/rapidjson/thirdparty/gtest/BUILD.bazel +175 -0
  298. data/ext/rj_schema/rapidjson/thirdparty/gtest/CMakeLists.txt +33 -0
  299. data/ext/rj_schema/rapidjson/thirdparty/gtest/CONTRIBUTING.md +160 -0
  300. data/ext/rj_schema/rapidjson/thirdparty/gtest/LICENSE +28 -0
  301. data/ext/rj_schema/rapidjson/thirdparty/gtest/Makefile.am +14 -0
  302. data/ext/rj_schema/rapidjson/thirdparty/gtest/README.md +122 -0
  303. data/ext/rj_schema/rapidjson/thirdparty/gtest/WORKSPACE +8 -0
  304. data/ext/rj_schema/rapidjson/thirdparty/gtest/appveyor.yml +104 -0
  305. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-autotools.sh +44 -0
  306. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-bazel.sh +36 -0
  307. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-linux.sh +41 -0
  308. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-osx.sh +40 -0
  309. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/get-nprocessors.sh +48 -0
  310. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-linux.sh +49 -0
  311. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-osx.sh +39 -0
  312. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/log-config.sh +51 -0
  313. data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/travis.sh +44 -0
  314. data/ext/rj_schema/rapidjson/thirdparty/gtest/configure.ac +16 -0
  315. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CHANGES +126 -0
  316. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt +242 -0
  317. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CONTRIBUTORS +40 -0
  318. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/LICENSE +28 -0
  319. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/Makefile.am +224 -0
  320. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/README.md +344 -0
  321. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock.pc.in +9 -0
  322. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock_main.pc.in +9 -0
  323. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/configure.ac +146 -0
  324. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CheatSheet.md +564 -0
  325. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CookBook.md +3660 -0
  326. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DesignDoc.md +280 -0
  327. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/Documentation.md +15 -0
  328. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/ForDummies.md +447 -0
  329. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/FrequentlyAskedQuestions.md +627 -0
  330. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/KnownIssues.md +19 -0
  331. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-actions.h +1262 -0
  332. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-cardinalities.h +147 -0
  333. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h +2571 -0
  334. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +833 -0
  335. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +1379 -0
  336. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +347 -0
  337. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h +2258 -0
  338. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +675 -0
  339. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +458 -0
  340. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +178 -0
  341. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h +5255 -0
  342. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-actions.h +246 -0
  343. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h +91 -0
  344. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h +1918 -0
  345. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock.h +95 -0
  346. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +8 -0
  347. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +10 -0
  348. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h +38 -0
  349. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-port.h +46 -0
  350. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +286 -0
  351. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump +136 -0
  352. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h +574 -0
  353. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h +87 -0
  354. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/make/Makefile +101 -0
  355. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.sln +32 -0
  356. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.vcproj +191 -0
  357. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_config.vsprops +15 -0
  358. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_main.vcproj +187 -0
  359. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_test.vcproj +201 -0
  360. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.sln +46 -0
  361. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.vcxproj +145 -0
  362. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_config.props +19 -0
  363. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_main.vcxproj +151 -0
  364. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_test.vcxproj +176 -0
  365. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.sln +46 -0
  366. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.vcxproj +145 -0
  367. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_config.props +19 -0
  368. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_main.vcxproj +151 -0
  369. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_test.vcxproj +176 -0
  370. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/fuse_gmock_files.py +240 -0
  371. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/LICENSE +203 -0
  372. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README +34 -0
  373. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README.cppclean +115 -0
  374. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/__init__.py +0 -0
  375. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/ast.py +1733 -0
  376. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class.py +227 -0
  377. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class_test.py +448 -0
  378. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/keywords.py +59 -0
  379. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/tokenize.py +287 -0
  380. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/utils.py +41 -0
  381. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/gmock_gen.py +31 -0
  382. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock-config.in +303 -0
  383. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock_doctor.py +640 -0
  384. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload.py +1387 -0
  385. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload_gmock.py +78 -0
  386. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-all.cc +47 -0
  387. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-cardinalities.cc +156 -0
  388. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-internal-utils.cc +204 -0
  389. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-matchers.cc +573 -0
  390. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-spec-builders.cc +883 -0
  391. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock.cc +205 -0
  392. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock_main.cc +54 -0
  393. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/BUILD.bazel +123 -0
  394. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-actions_test.cc +1575 -0
  395. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-cardinalities_test.cc +428 -0
  396. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-actions_test.cc +1230 -0
  397. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-function-mockers_test.cc +647 -0
  398. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc +129 -0
  399. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc +1341 -0
  400. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-internal-utils_test.cc +718 -0
  401. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-matchers_test.cc +6767 -0
  402. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-more-actions_test.cc +710 -0
  403. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-nice-strict_test.cc +511 -0
  404. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-port_test.cc +43 -0
  405. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-spec-builders_test.cc +2771 -0
  406. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_all_test.cc +51 -0
  407. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_ex_test.cc +81 -0
  408. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test.py +108 -0
  409. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test_.cc +100 -0
  410. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link2_test.cc +40 -0
  411. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.cc +40 -0
  412. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.h +691 -0
  413. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test.py +183 -0
  414. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_.cc +310 -0
  415. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_golden.txt +317 -0
  416. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_stress_test.cc +323 -0
  417. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test.cc +262 -0
  418. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test_utils.py +110 -0
  419. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CHANGES +157 -0
  420. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt +312 -0
  421. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CONTRIBUTORS +37 -0
  422. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/LICENSE +28 -0
  423. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/Makefile.am +339 -0
  424. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/README.md +341 -0
  425. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest.pc.in +9 -0
  426. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest_main.pc.in +10 -0
  427. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/internal_utils.cmake +280 -0
  428. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.cbproj +138 -0
  429. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.groupproj +54 -0
  430. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_all.cc +38 -0
  431. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_link.cc +40 -0
  432. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_main.cbproj +82 -0
  433. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_unittest.cbproj +88 -0
  434. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/configure.ac +68 -0
  435. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Pkgconfig.md +146 -0
  436. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/PumpManual.md +177 -0
  437. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/XcodeGuide.md +93 -0
  438. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/advanced.md +2416 -0
  439. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/faq.md +1092 -0
  440. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/primer.md +536 -0
  441. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/samples.md +14 -0
  442. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-death-test.h +342 -0
  443. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-message.h +249 -0
  444. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h +1438 -0
  445. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h.pump +501 -0
  446. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-printers.h +1082 -0
  447. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-spi.h +231 -0
  448. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-test-part.h +179 -0
  449. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h +264 -0
  450. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest.h +2332 -0
  451. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h +357 -0
  452. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_prod.h +61 -0
  453. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h +70 -0
  454. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-printers.h +42 -0
  455. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h +45 -0
  456. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h +275 -0
  457. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h +205 -0
  458. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h +1277 -0
  459. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-linked_ptr.h +243 -0
  460. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h +5139 -0
  461. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +279 -0
  462. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h +723 -0
  463. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h +100 -0
  464. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h +2687 -0
  465. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h +167 -0
  466. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h +1020 -0
  467. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h.pump +347 -0
  468. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h +3347 -0
  469. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump +313 -0
  470. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/acx_pthread.m4 +363 -0
  471. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/gtest.m4 +74 -0
  472. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/make/Makefile +82 -0
  473. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.sln +55 -0
  474. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj +149 -0
  475. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj.filters +18 -0
  476. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.sln +55 -0
  477. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj +149 -0
  478. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj.filters +18 -0
  479. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj +154 -0
  480. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj.filters +18 -0
  481. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj +162 -0
  482. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj.filters +18 -0
  483. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj +199 -0
  484. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters +26 -0
  485. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj +191 -0
  486. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters +26 -0
  487. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj +188 -0
  488. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters +18 -0
  489. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj +180 -0
  490. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj.filters +18 -0
  491. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/prime_tables.h +127 -0
  492. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.cc +68 -0
  493. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.h +43 -0
  494. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample10_unittest.cc +140 -0
  495. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1_unittest.cc +154 -0
  496. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.cc +56 -0
  497. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.h +85 -0
  498. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2_unittest.cc +110 -0
  499. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3-inl.h +172 -0
  500. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3_unittest.cc +152 -0
  501. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.cc +46 -0
  502. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.h +53 -0
  503. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4_unittest.cc +49 -0
  504. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample5_unittest.cc +199 -0
  505. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample6_unittest.cc +225 -0
  506. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample7_unittest.cc +118 -0
  507. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample8_unittest.cc +174 -0
  508. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample9_unittest.cc +157 -0
  509. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/common.py +83 -0
  510. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/fuse_gtest_files.py +253 -0
  511. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gen_gtest_pred_impl.py +730 -0
  512. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gtest-config.in +274 -0
  513. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/pump.py +855 -0
  514. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/release_docs.py +158 -0
  515. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/test/Makefile +59 -0
  516. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload.py +1387 -0
  517. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload_gtest.py +78 -0
  518. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-all.cc +48 -0
  519. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-death-test.cc +1536 -0
  520. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-filepath.cc +385 -0
  521. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-internal-inl.h +1175 -0
  522. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-port.cc +1277 -0
  523. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-printers.cc +458 -0
  524. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-test-part.cc +102 -0
  525. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-typed-test.cc +119 -0
  526. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest.cc +5846 -0
  527. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest_main.cc +38 -0
  528. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/BUILD.bazel +396 -0
  529. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_ex_test.cc +93 -0
  530. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_test.cc +1424 -0
  531. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-filepath_test.cc +652 -0
  532. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-linked_ptr_test.cc +154 -0
  533. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-listener_test.cc +311 -0
  534. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-message_test.cc +159 -0
  535. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-options_test.cc +213 -0
  536. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test2_test.cc +61 -0
  537. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.cc +1110 -0
  538. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.h +53 -0
  539. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-port_test.cc +1303 -0
  540. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-printers_test.cc +1737 -0
  541. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-test-part_test.cc +208 -0
  542. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-tuple_test.cc +320 -0
  543. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test2_test.cc +45 -0
  544. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.cc +380 -0
  545. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.h +66 -0
  546. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-unittest-api_test.cc +341 -0
  547. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_all_test.cc +47 -0
  548. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_assert_by_exception_test.cc +119 -0
  549. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest.py +210 -0
  550. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest_.cc +87 -0
  551. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test.py +235 -0
  552. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test_.cc +311 -0
  553. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test.py +129 -0
  554. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test_.cc +63 -0
  555. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test.py +119 -0
  556. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test_.cc +124 -0
  557. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_environment_test.cc +189 -0
  558. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest.py +638 -0
  559. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest_.cc +138 -0
  560. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test.py +172 -0
  561. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test_.cc +46 -0
  562. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_outfiles_test.py +162 -0
  563. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_output_unittest.py +611 -0
  564. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_test_utils.py +60 -0
  565. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest.py +207 -0
  566. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest_.cc +157 -0
  567. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_main_unittest.cc +45 -0
  568. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_no_test_unittest.cc +56 -0
  569. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test.py +344 -0
  570. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_.cc +1067 -0
  571. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_golden_lin.txt +781 -0
  572. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_pred_impl_unittest.cc +2427 -0
  573. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_premature_exit_test.cc +127 -0
  574. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_prod_test.cc +57 -0
  575. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_repeat_test.cc +236 -0
  576. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test.py +325 -0
  577. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test_.cc +103 -0
  578. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_sole_header_test.cc +57 -0
  579. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_stress_test.cc +250 -0
  580. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_test_utils.py +318 -0
  581. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test.py +65 -0
  582. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test_.cc +44 -0
  583. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_ex_test.cc +92 -0
  584. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test.py +171 -0
  585. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test_.cc +72 -0
  586. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test.py +69 -0
  587. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test_.cc +43 -0
  588. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_unittest.cc +7797 -0
  589. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile1_test_.cc +48 -0
  590. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile2_test_.cc +48 -0
  591. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfiles_test.py +140 -0
  592. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest.py +378 -0
  593. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest_.cc +179 -0
  594. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_test_utils.py +196 -0
  595. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.cc +36 -0
  596. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.h +55 -0
  597. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/DebugProject.xcconfig +30 -0
  598. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/FrameworkTarget.xcconfig +17 -0
  599. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/General.xcconfig +41 -0
  600. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/ReleaseProject.xcconfig +32 -0
  601. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/StaticLibraryTarget.xcconfig +18 -0
  602. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/TestTarget.xcconfig +8 -0
  603. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Resources/Info.plist +30 -0
  604. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/Info.plist +28 -0
  605. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj +457 -0
  606. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/runtests.sh +62 -0
  607. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.cc +63 -0
  608. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.h +59 -0
  609. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget_test.cc +68 -0
  610. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/runtests.sh +65 -0
  611. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/versiongenerate.py +100 -0
  612. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj +1182 -0
  613. data/ext/rj_schema/rapidjson/travis-doxygen.sh +128 -0
  614. metadata +613 -1
@@ -0,0 +1,1424 @@
1
+ // Copyright 2005, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // Author: wan@google.com (Zhanyong Wan)
31
+ //
32
+ // Tests for death tests.
33
+
34
+ #include "gtest/gtest-death-test.h"
35
+ #include "gtest/gtest.h"
36
+ #include "gtest/internal/gtest-filepath.h"
37
+
38
+ using testing::internal::AlwaysFalse;
39
+ using testing::internal::AlwaysTrue;
40
+
41
+ #if GTEST_HAS_DEATH_TEST
42
+
43
+ # if GTEST_OS_WINDOWS
44
+ # include <direct.h> // For chdir().
45
+ # else
46
+ # include <unistd.h>
47
+ # include <sys/wait.h> // For waitpid.
48
+ # endif // GTEST_OS_WINDOWS
49
+
50
+ # include <limits.h>
51
+ # include <signal.h>
52
+ # include <stdio.h>
53
+
54
+ # if GTEST_OS_LINUX
55
+ # include <sys/time.h>
56
+ # endif // GTEST_OS_LINUX
57
+
58
+ # include "gtest/gtest-spi.h"
59
+ # include "src/gtest-internal-inl.h"
60
+
61
+ namespace posix = ::testing::internal::posix;
62
+
63
+ using testing::Message;
64
+ using testing::internal::DeathTest;
65
+ using testing::internal::DeathTestFactory;
66
+ using testing::internal::FilePath;
67
+ using testing::internal::GetLastErrnoDescription;
68
+ using testing::internal::GetUnitTestImpl;
69
+ using testing::internal::InDeathTestChild;
70
+ using testing::internal::ParseNaturalNumber;
71
+
72
+ namespace testing {
73
+ namespace internal {
74
+
75
+ // A helper class whose objects replace the death test factory for a
76
+ // single UnitTest object during their lifetimes.
77
+ class ReplaceDeathTestFactory {
78
+ public:
79
+ explicit ReplaceDeathTestFactory(DeathTestFactory* new_factory)
80
+ : unit_test_impl_(GetUnitTestImpl()) {
81
+ old_factory_ = unit_test_impl_->death_test_factory_.release();
82
+ unit_test_impl_->death_test_factory_.reset(new_factory);
83
+ }
84
+
85
+ ~ReplaceDeathTestFactory() {
86
+ unit_test_impl_->death_test_factory_.release();
87
+ unit_test_impl_->death_test_factory_.reset(old_factory_);
88
+ }
89
+ private:
90
+ // Prevents copying ReplaceDeathTestFactory objects.
91
+ ReplaceDeathTestFactory(const ReplaceDeathTestFactory&);
92
+ void operator=(const ReplaceDeathTestFactory&);
93
+
94
+ UnitTestImpl* unit_test_impl_;
95
+ DeathTestFactory* old_factory_;
96
+ };
97
+
98
+ } // namespace internal
99
+ } // namespace testing
100
+
101
+ void DieWithMessage(const ::std::string& message) {
102
+ fprintf(stderr, "%s", message.c_str());
103
+ fflush(stderr); // Make sure the text is printed before the process exits.
104
+
105
+ // We call _exit() instead of exit(), as the former is a direct
106
+ // system call and thus safer in the presence of threads. exit()
107
+ // will invoke user-defined exit-hooks, which may do dangerous
108
+ // things that conflict with death tests.
109
+ //
110
+ // Some compilers can recognize that _exit() never returns and issue the
111
+ // 'unreachable code' warning for code following this function, unless
112
+ // fooled by a fake condition.
113
+ if (AlwaysTrue())
114
+ _exit(1);
115
+ }
116
+
117
+ void DieInside(const ::std::string& function) {
118
+ DieWithMessage("death inside " + function + "().");
119
+ }
120
+
121
+ // Tests that death tests work.
122
+
123
+ class TestForDeathTest : public testing::Test {
124
+ protected:
125
+ TestForDeathTest() : original_dir_(FilePath::GetCurrentDir()) {}
126
+
127
+ virtual ~TestForDeathTest() {
128
+ posix::ChDir(original_dir_.c_str());
129
+ }
130
+
131
+ // A static member function that's expected to die.
132
+ static void StaticMemberFunction() { DieInside("StaticMemberFunction"); }
133
+
134
+ // A method of the test fixture that may die.
135
+ void MemberFunction() {
136
+ if (should_die_)
137
+ DieInside("MemberFunction");
138
+ }
139
+
140
+ // True iff MemberFunction() should die.
141
+ bool should_die_;
142
+ const FilePath original_dir_;
143
+ };
144
+
145
+ // A class with a member function that may die.
146
+ class MayDie {
147
+ public:
148
+ explicit MayDie(bool should_die) : should_die_(should_die) {}
149
+
150
+ // A member function that may die.
151
+ void MemberFunction() const {
152
+ if (should_die_)
153
+ DieInside("MayDie::MemberFunction");
154
+ }
155
+
156
+ private:
157
+ // True iff MemberFunction() should die.
158
+ bool should_die_;
159
+ };
160
+
161
+ // A global function that's expected to die.
162
+ void GlobalFunction() { DieInside("GlobalFunction"); }
163
+
164
+ // A non-void function that's expected to die.
165
+ int NonVoidFunction() {
166
+ DieInside("NonVoidFunction");
167
+ return 1;
168
+ }
169
+
170
+ // A unary function that may die.
171
+ void DieIf(bool should_die) {
172
+ if (should_die)
173
+ DieInside("DieIf");
174
+ }
175
+
176
+ // A binary function that may die.
177
+ bool DieIfLessThan(int x, int y) {
178
+ if (x < y) {
179
+ DieInside("DieIfLessThan");
180
+ }
181
+ return true;
182
+ }
183
+
184
+ // Tests that ASSERT_DEATH can be used outside a TEST, TEST_F, or test fixture.
185
+ void DeathTestSubroutine() {
186
+ EXPECT_DEATH(GlobalFunction(), "death.*GlobalFunction");
187
+ ASSERT_DEATH(GlobalFunction(), "death.*GlobalFunction");
188
+ }
189
+
190
+ // Death in dbg, not opt.
191
+ int DieInDebugElse12(int* sideeffect) {
192
+ if (sideeffect) *sideeffect = 12;
193
+
194
+ # ifndef NDEBUG
195
+
196
+ DieInside("DieInDebugElse12");
197
+
198
+ # endif // NDEBUG
199
+
200
+ return 12;
201
+ }
202
+
203
+ # if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA
204
+
205
+ // Tests the ExitedWithCode predicate.
206
+ TEST(ExitStatusPredicateTest, ExitedWithCode) {
207
+ // On Windows, the process's exit code is the same as its exit status,
208
+ // so the predicate just compares the its input with its parameter.
209
+ EXPECT_TRUE(testing::ExitedWithCode(0)(0));
210
+ EXPECT_TRUE(testing::ExitedWithCode(1)(1));
211
+ EXPECT_TRUE(testing::ExitedWithCode(42)(42));
212
+ EXPECT_FALSE(testing::ExitedWithCode(0)(1));
213
+ EXPECT_FALSE(testing::ExitedWithCode(1)(0));
214
+ }
215
+
216
+ # else
217
+
218
+ // Returns the exit status of a process that calls _exit(2) with a
219
+ // given exit code. This is a helper function for the
220
+ // ExitStatusPredicateTest test suite.
221
+ static int NormalExitStatus(int exit_code) {
222
+ pid_t child_pid = fork();
223
+ if (child_pid == 0) {
224
+ _exit(exit_code);
225
+ }
226
+ int status;
227
+ waitpid(child_pid, &status, 0);
228
+ return status;
229
+ }
230
+
231
+ // Returns the exit status of a process that raises a given signal.
232
+ // If the signal does not cause the process to die, then it returns
233
+ // instead the exit status of a process that exits normally with exit
234
+ // code 1. This is a helper function for the ExitStatusPredicateTest
235
+ // test suite.
236
+ static int KilledExitStatus(int signum) {
237
+ pid_t child_pid = fork();
238
+ if (child_pid == 0) {
239
+ raise(signum);
240
+ _exit(1);
241
+ }
242
+ int status;
243
+ waitpid(child_pid, &status, 0);
244
+ return status;
245
+ }
246
+
247
+ // Tests the ExitedWithCode predicate.
248
+ TEST(ExitStatusPredicateTest, ExitedWithCode) {
249
+ const int status0 = NormalExitStatus(0);
250
+ const int status1 = NormalExitStatus(1);
251
+ const int status42 = NormalExitStatus(42);
252
+ const testing::ExitedWithCode pred0(0);
253
+ const testing::ExitedWithCode pred1(1);
254
+ const testing::ExitedWithCode pred42(42);
255
+ EXPECT_PRED1(pred0, status0);
256
+ EXPECT_PRED1(pred1, status1);
257
+ EXPECT_PRED1(pred42, status42);
258
+ EXPECT_FALSE(pred0(status1));
259
+ EXPECT_FALSE(pred42(status0));
260
+ EXPECT_FALSE(pred1(status42));
261
+ }
262
+
263
+ // Tests the KilledBySignal predicate.
264
+ TEST(ExitStatusPredicateTest, KilledBySignal) {
265
+ const int status_segv = KilledExitStatus(SIGSEGV);
266
+ const int status_kill = KilledExitStatus(SIGKILL);
267
+ const testing::KilledBySignal pred_segv(SIGSEGV);
268
+ const testing::KilledBySignal pred_kill(SIGKILL);
269
+ EXPECT_PRED1(pred_segv, status_segv);
270
+ EXPECT_PRED1(pred_kill, status_kill);
271
+ EXPECT_FALSE(pred_segv(status_kill));
272
+ EXPECT_FALSE(pred_kill(status_segv));
273
+ }
274
+
275
+ # endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA
276
+
277
+ // Tests that the death test macros expand to code which may or may not
278
+ // be followed by operator<<, and that in either case the complete text
279
+ // comprises only a single C++ statement.
280
+ TEST_F(TestForDeathTest, SingleStatement) {
281
+ if (AlwaysFalse())
282
+ // This would fail if executed; this is a compilation test only
283
+ ASSERT_DEATH(return, "");
284
+
285
+ if (AlwaysTrue())
286
+ EXPECT_DEATH(_exit(1), "");
287
+ else
288
+ // This empty "else" branch is meant to ensure that EXPECT_DEATH
289
+ // doesn't expand into an "if" statement without an "else"
290
+ ;
291
+
292
+ if (AlwaysFalse())
293
+ ASSERT_DEATH(return, "") << "did not die";
294
+
295
+ if (AlwaysFalse())
296
+ ;
297
+ else
298
+ EXPECT_DEATH(_exit(1), "") << 1 << 2 << 3;
299
+ }
300
+
301
+ void DieWithEmbeddedNul() {
302
+ fprintf(stderr, "Hello%cmy null world.\n", '\0');
303
+ fflush(stderr);
304
+ _exit(1);
305
+ }
306
+
307
+ # if GTEST_USES_PCRE
308
+
309
+ // Tests that EXPECT_DEATH and ASSERT_DEATH work when the error
310
+ // message has a NUL character in it.
311
+ TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
312
+ EXPECT_DEATH(DieWithEmbeddedNul(), "my null world");
313
+ ASSERT_DEATH(DieWithEmbeddedNul(), "my null world");
314
+ }
315
+
316
+ # endif // GTEST_USES_PCRE
317
+
318
+ // Tests that death test macros expand to code which interacts well with switch
319
+ // statements.
320
+ TEST_F(TestForDeathTest, SwitchStatement) {
321
+ // Microsoft compiler usually complains about switch statements without
322
+ // case labels. We suppress that warning for this test.
323
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4065)
324
+
325
+ switch (0)
326
+ default:
327
+ ASSERT_DEATH(_exit(1), "") << "exit in default switch handler";
328
+
329
+ switch (0)
330
+ case 0:
331
+ EXPECT_DEATH(_exit(1), "") << "exit in switch case";
332
+
333
+ GTEST_DISABLE_MSC_WARNINGS_POP_()
334
+ }
335
+
336
+ // Tests that a static member function can be used in a "fast" style
337
+ // death test.
338
+ TEST_F(TestForDeathTest, StaticMemberFunctionFastStyle) {
339
+ testing::GTEST_FLAG(death_test_style) = "fast";
340
+ ASSERT_DEATH(StaticMemberFunction(), "death.*StaticMember");
341
+ }
342
+
343
+ // Tests that a method of the test fixture can be used in a "fast"
344
+ // style death test.
345
+ TEST_F(TestForDeathTest, MemberFunctionFastStyle) {
346
+ testing::GTEST_FLAG(death_test_style) = "fast";
347
+ should_die_ = true;
348
+ EXPECT_DEATH(MemberFunction(), "inside.*MemberFunction");
349
+ }
350
+
351
+ void ChangeToRootDir() { posix::ChDir(GTEST_PATH_SEP_); }
352
+
353
+ // Tests that death tests work even if the current directory has been
354
+ // changed.
355
+ TEST_F(TestForDeathTest, FastDeathTestInChangedDir) {
356
+ testing::GTEST_FLAG(death_test_style) = "fast";
357
+
358
+ ChangeToRootDir();
359
+ EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
360
+
361
+ ChangeToRootDir();
362
+ ASSERT_DEATH(_exit(1), "");
363
+ }
364
+
365
+ # if GTEST_OS_LINUX
366
+ void SigprofAction(int, siginfo_t*, void*) { /* no op */ }
367
+
368
+ // Sets SIGPROF action and ITIMER_PROF timer (interval: 1ms).
369
+ void SetSigprofActionAndTimer() {
370
+ struct itimerval timer;
371
+ timer.it_interval.tv_sec = 0;
372
+ timer.it_interval.tv_usec = 1;
373
+ timer.it_value = timer.it_interval;
374
+ ASSERT_EQ(0, setitimer(ITIMER_PROF, &timer, NULL));
375
+ struct sigaction signal_action;
376
+ memset(&signal_action, 0, sizeof(signal_action));
377
+ sigemptyset(&signal_action.sa_mask);
378
+ signal_action.sa_sigaction = SigprofAction;
379
+ signal_action.sa_flags = SA_RESTART | SA_SIGINFO;
380
+ ASSERT_EQ(0, sigaction(SIGPROF, &signal_action, NULL));
381
+ }
382
+
383
+ // Disables ITIMER_PROF timer and ignores SIGPROF signal.
384
+ void DisableSigprofActionAndTimer(struct sigaction* old_signal_action) {
385
+ struct itimerval timer;
386
+ timer.it_interval.tv_sec = 0;
387
+ timer.it_interval.tv_usec = 0;
388
+ timer.it_value = timer.it_interval;
389
+ ASSERT_EQ(0, setitimer(ITIMER_PROF, &timer, NULL));
390
+ struct sigaction signal_action;
391
+ memset(&signal_action, 0, sizeof(signal_action));
392
+ sigemptyset(&signal_action.sa_mask);
393
+ signal_action.sa_handler = SIG_IGN;
394
+ ASSERT_EQ(0, sigaction(SIGPROF, &signal_action, old_signal_action));
395
+ }
396
+
397
+ // Tests that death tests work when SIGPROF handler and timer are set.
398
+ TEST_F(TestForDeathTest, FastSigprofActionSet) {
399
+ testing::GTEST_FLAG(death_test_style) = "fast";
400
+ SetSigprofActionAndTimer();
401
+ EXPECT_DEATH(_exit(1), "");
402
+ struct sigaction old_signal_action;
403
+ DisableSigprofActionAndTimer(&old_signal_action);
404
+ EXPECT_TRUE(old_signal_action.sa_sigaction == SigprofAction);
405
+ }
406
+
407
+ TEST_F(TestForDeathTest, ThreadSafeSigprofActionSet) {
408
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
409
+ SetSigprofActionAndTimer();
410
+ EXPECT_DEATH(_exit(1), "");
411
+ struct sigaction old_signal_action;
412
+ DisableSigprofActionAndTimer(&old_signal_action);
413
+ EXPECT_TRUE(old_signal_action.sa_sigaction == SigprofAction);
414
+ }
415
+ # endif // GTEST_OS_LINUX
416
+
417
+ // Repeats a representative sample of death tests in the "threadsafe" style:
418
+
419
+ TEST_F(TestForDeathTest, StaticMemberFunctionThreadsafeStyle) {
420
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
421
+ ASSERT_DEATH(StaticMemberFunction(), "death.*StaticMember");
422
+ }
423
+
424
+ TEST_F(TestForDeathTest, MemberFunctionThreadsafeStyle) {
425
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
426
+ should_die_ = true;
427
+ EXPECT_DEATH(MemberFunction(), "inside.*MemberFunction");
428
+ }
429
+
430
+ TEST_F(TestForDeathTest, ThreadsafeDeathTestInLoop) {
431
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
432
+
433
+ for (int i = 0; i < 3; ++i)
434
+ EXPECT_EXIT(_exit(i), testing::ExitedWithCode(i), "") << ": i = " << i;
435
+ }
436
+
437
+ TEST_F(TestForDeathTest, ThreadsafeDeathTestInChangedDir) {
438
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
439
+
440
+ ChangeToRootDir();
441
+ EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
442
+
443
+ ChangeToRootDir();
444
+ ASSERT_DEATH(_exit(1), "");
445
+ }
446
+
447
+ TEST_F(TestForDeathTest, MixedStyles) {
448
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
449
+ EXPECT_DEATH(_exit(1), "");
450
+ testing::GTEST_FLAG(death_test_style) = "fast";
451
+ EXPECT_DEATH(_exit(1), "");
452
+ }
453
+
454
+ # if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
455
+
456
+ namespace {
457
+
458
+ bool pthread_flag;
459
+
460
+ void SetPthreadFlag() {
461
+ pthread_flag = true;
462
+ }
463
+
464
+ } // namespace
465
+
466
+ TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
467
+ if (!testing::GTEST_FLAG(death_test_use_fork)) {
468
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
469
+ pthread_flag = false;
470
+ ASSERT_EQ(0, pthread_atfork(&SetPthreadFlag, NULL, NULL));
471
+ ASSERT_DEATH(_exit(1), "");
472
+ ASSERT_FALSE(pthread_flag);
473
+ }
474
+ }
475
+
476
+ # endif // GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
477
+
478
+ // Tests that a method of another class can be used in a death test.
479
+ TEST_F(TestForDeathTest, MethodOfAnotherClass) {
480
+ const MayDie x(true);
481
+ ASSERT_DEATH(x.MemberFunction(), "MayDie\\:\\:MemberFunction");
482
+ }
483
+
484
+ // Tests that a global function can be used in a death test.
485
+ TEST_F(TestForDeathTest, GlobalFunction) {
486
+ EXPECT_DEATH(GlobalFunction(), "GlobalFunction");
487
+ }
488
+
489
+ // Tests that any value convertible to an RE works as a second
490
+ // argument to EXPECT_DEATH.
491
+ TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {
492
+ static const char regex_c_str[] = "GlobalFunction";
493
+ EXPECT_DEATH(GlobalFunction(), regex_c_str);
494
+
495
+ const testing::internal::RE regex(regex_c_str);
496
+ EXPECT_DEATH(GlobalFunction(), regex);
497
+
498
+ # if GTEST_HAS_GLOBAL_STRING
499
+
500
+ const ::string regex_str(regex_c_str);
501
+ EXPECT_DEATH(GlobalFunction(), regex_str);
502
+
503
+ # endif // GTEST_HAS_GLOBAL_STRING
504
+
505
+ # if !GTEST_USES_PCRE
506
+
507
+ const ::std::string regex_std_str(regex_c_str);
508
+ EXPECT_DEATH(GlobalFunction(), regex_std_str);
509
+
510
+ # endif // !GTEST_USES_PCRE
511
+ }
512
+
513
+ // Tests that a non-void function can be used in a death test.
514
+ TEST_F(TestForDeathTest, NonVoidFunction) {
515
+ ASSERT_DEATH(NonVoidFunction(), "NonVoidFunction");
516
+ }
517
+
518
+ // Tests that functions that take parameter(s) can be used in a death test.
519
+ TEST_F(TestForDeathTest, FunctionWithParameter) {
520
+ EXPECT_DEATH(DieIf(true), "DieIf\\(\\)");
521
+ EXPECT_DEATH(DieIfLessThan(2, 3), "DieIfLessThan");
522
+ }
523
+
524
+ // Tests that ASSERT_DEATH can be used outside a TEST, TEST_F, or test fixture.
525
+ TEST_F(TestForDeathTest, OutsideFixture) {
526
+ DeathTestSubroutine();
527
+ }
528
+
529
+ // Tests that death tests can be done inside a loop.
530
+ TEST_F(TestForDeathTest, InsideLoop) {
531
+ for (int i = 0; i < 5; i++) {
532
+ EXPECT_DEATH(DieIfLessThan(-1, i), "DieIfLessThan") << "where i == " << i;
533
+ }
534
+ }
535
+
536
+ // Tests that a compound statement can be used in a death test.
537
+ TEST_F(TestForDeathTest, CompoundStatement) {
538
+ EXPECT_DEATH({ // NOLINT
539
+ const int x = 2;
540
+ const int y = x + 1;
541
+ DieIfLessThan(x, y);
542
+ },
543
+ "DieIfLessThan");
544
+ }
545
+
546
+ // Tests that code that doesn't die causes a death test to fail.
547
+ TEST_F(TestForDeathTest, DoesNotDie) {
548
+ EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(DieIf(false), "DieIf"),
549
+ "failed to die");
550
+ }
551
+
552
+ // Tests that a death test fails when the error message isn't expected.
553
+ TEST_F(TestForDeathTest, ErrorMessageMismatch) {
554
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
555
+ EXPECT_DEATH(DieIf(true), "DieIfLessThan") << "End of death test message.";
556
+ }, "died but not with expected error");
557
+ }
558
+
559
+ // On exit, *aborted will be true iff the EXPECT_DEATH() statement
560
+ // aborted the function.
561
+ void ExpectDeathTestHelper(bool* aborted) {
562
+ *aborted = true;
563
+ EXPECT_DEATH(DieIf(false), "DieIf"); // This assertion should fail.
564
+ *aborted = false;
565
+ }
566
+
567
+ // Tests that EXPECT_DEATH doesn't abort the test on failure.
568
+ TEST_F(TestForDeathTest, EXPECT_DEATH) {
569
+ bool aborted = true;
570
+ EXPECT_NONFATAL_FAILURE(ExpectDeathTestHelper(&aborted),
571
+ "failed to die");
572
+ EXPECT_FALSE(aborted);
573
+ }
574
+
575
+ // Tests that ASSERT_DEATH does abort the test on failure.
576
+ TEST_F(TestForDeathTest, ASSERT_DEATH) {
577
+ static bool aborted;
578
+ EXPECT_FATAL_FAILURE({ // NOLINT
579
+ aborted = true;
580
+ ASSERT_DEATH(DieIf(false), "DieIf"); // This assertion should fail.
581
+ aborted = false;
582
+ }, "failed to die");
583
+ EXPECT_TRUE(aborted);
584
+ }
585
+
586
+ // Tests that EXPECT_DEATH evaluates the arguments exactly once.
587
+ TEST_F(TestForDeathTest, SingleEvaluation) {
588
+ int x = 3;
589
+ EXPECT_DEATH(DieIf((++x) == 4), "DieIf");
590
+
591
+ const char* regex = "DieIf";
592
+ const char* regex_save = regex;
593
+ EXPECT_DEATH(DieIfLessThan(3, 4), regex++);
594
+ EXPECT_EQ(regex_save + 1, regex);
595
+ }
596
+
597
+ // Tests that run-away death tests are reported as failures.
598
+ TEST_F(TestForDeathTest, RunawayIsFailure) {
599
+ EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(static_cast<void>(0), "Foo"),
600
+ "failed to die.");
601
+ }
602
+
603
+ // Tests that death tests report executing 'return' in the statement as
604
+ // failure.
605
+ TEST_F(TestForDeathTest, ReturnIsFailure) {
606
+ EXPECT_FATAL_FAILURE(ASSERT_DEATH(return, "Bar"),
607
+ "illegal return in test statement.");
608
+ }
609
+
610
+ // Tests that EXPECT_DEBUG_DEATH works as expected, that is, you can stream a
611
+ // message to it, and in debug mode it:
612
+ // 1. Asserts on death.
613
+ // 2. Has no side effect.
614
+ //
615
+ // And in opt mode, it:
616
+ // 1. Has side effects but does not assert.
617
+ TEST_F(TestForDeathTest, TestExpectDebugDeath) {
618
+ int sideeffect = 0;
619
+
620
+ // Put the regex in a local variable to make sure we don't get an "unused"
621
+ // warning in opt mode.
622
+ const char* regex = "death.*DieInDebugElse12";
623
+
624
+ EXPECT_DEBUG_DEATH(DieInDebugElse12(&sideeffect), regex)
625
+ << "Must accept a streamed message";
626
+
627
+ # ifdef NDEBUG
628
+
629
+ // Checks that the assignment occurs in opt mode (sideeffect).
630
+ EXPECT_EQ(12, sideeffect);
631
+
632
+ # else
633
+
634
+ // Checks that the assignment does not occur in dbg mode (no sideeffect).
635
+ EXPECT_EQ(0, sideeffect);
636
+
637
+ # endif
638
+ }
639
+
640
+ // Tests that ASSERT_DEBUG_DEATH works as expected, that is, you can stream a
641
+ // message to it, and in debug mode it:
642
+ // 1. Asserts on death.
643
+ // 2. Has no side effect.
644
+ //
645
+ // And in opt mode, it:
646
+ // 1. Has side effects but does not assert.
647
+ TEST_F(TestForDeathTest, TestAssertDebugDeath) {
648
+ int sideeffect = 0;
649
+
650
+ ASSERT_DEBUG_DEATH(DieInDebugElse12(&sideeffect), "death.*DieInDebugElse12")
651
+ << "Must accept a streamed message";
652
+
653
+ # ifdef NDEBUG
654
+
655
+ // Checks that the assignment occurs in opt mode (sideeffect).
656
+ EXPECT_EQ(12, sideeffect);
657
+
658
+ # else
659
+
660
+ // Checks that the assignment does not occur in dbg mode (no sideeffect).
661
+ EXPECT_EQ(0, sideeffect);
662
+
663
+ # endif
664
+ }
665
+
666
+ # ifndef NDEBUG
667
+
668
+ void ExpectDebugDeathHelper(bool* aborted) {
669
+ *aborted = true;
670
+ EXPECT_DEBUG_DEATH(return, "") << "This is expected to fail.";
671
+ *aborted = false;
672
+ }
673
+
674
+ # if GTEST_OS_WINDOWS
675
+ TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {
676
+ printf("This test should be considered failing if it shows "
677
+ "any pop-up dialogs.\n");
678
+ fflush(stdout);
679
+
680
+ EXPECT_DEATH({
681
+ testing::GTEST_FLAG(catch_exceptions) = false;
682
+ abort();
683
+ }, "");
684
+ }
685
+ # endif // GTEST_OS_WINDOWS
686
+
687
+ // Tests that EXPECT_DEBUG_DEATH in debug mode does not abort
688
+ // the function.
689
+ TEST_F(TestForDeathTest, ExpectDebugDeathDoesNotAbort) {
690
+ bool aborted = true;
691
+ EXPECT_NONFATAL_FAILURE(ExpectDebugDeathHelper(&aborted), "");
692
+ EXPECT_FALSE(aborted);
693
+ }
694
+
695
+ void AssertDebugDeathHelper(bool* aborted) {
696
+ *aborted = true;
697
+ GTEST_LOG_(INFO) << "Before ASSERT_DEBUG_DEATH";
698
+ ASSERT_DEBUG_DEATH(GTEST_LOG_(INFO) << "In ASSERT_DEBUG_DEATH"; return, "")
699
+ << "This is expected to fail.";
700
+ GTEST_LOG_(INFO) << "After ASSERT_DEBUG_DEATH";
701
+ *aborted = false;
702
+ }
703
+
704
+ // Tests that ASSERT_DEBUG_DEATH in debug mode aborts the function on
705
+ // failure.
706
+ TEST_F(TestForDeathTest, AssertDebugDeathAborts) {
707
+ static bool aborted;
708
+ aborted = false;
709
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
710
+ EXPECT_TRUE(aborted);
711
+ }
712
+
713
+ TEST_F(TestForDeathTest, AssertDebugDeathAborts2) {
714
+ static bool aborted;
715
+ aborted = false;
716
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
717
+ EXPECT_TRUE(aborted);
718
+ }
719
+
720
+ TEST_F(TestForDeathTest, AssertDebugDeathAborts3) {
721
+ static bool aborted;
722
+ aborted = false;
723
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
724
+ EXPECT_TRUE(aborted);
725
+ }
726
+
727
+ TEST_F(TestForDeathTest, AssertDebugDeathAborts4) {
728
+ static bool aborted;
729
+ aborted = false;
730
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
731
+ EXPECT_TRUE(aborted);
732
+ }
733
+
734
+ TEST_F(TestForDeathTest, AssertDebugDeathAborts5) {
735
+ static bool aborted;
736
+ aborted = false;
737
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
738
+ EXPECT_TRUE(aborted);
739
+ }
740
+
741
+ TEST_F(TestForDeathTest, AssertDebugDeathAborts6) {
742
+ static bool aborted;
743
+ aborted = false;
744
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
745
+ EXPECT_TRUE(aborted);
746
+ }
747
+
748
+ TEST_F(TestForDeathTest, AssertDebugDeathAborts7) {
749
+ static bool aborted;
750
+ aborted = false;
751
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
752
+ EXPECT_TRUE(aborted);
753
+ }
754
+
755
+ TEST_F(TestForDeathTest, AssertDebugDeathAborts8) {
756
+ static bool aborted;
757
+ aborted = false;
758
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
759
+ EXPECT_TRUE(aborted);
760
+ }
761
+
762
+ TEST_F(TestForDeathTest, AssertDebugDeathAborts9) {
763
+ static bool aborted;
764
+ aborted = false;
765
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
766
+ EXPECT_TRUE(aborted);
767
+ }
768
+
769
+ TEST_F(TestForDeathTest, AssertDebugDeathAborts10) {
770
+ static bool aborted;
771
+ aborted = false;
772
+ EXPECT_FATAL_FAILURE(AssertDebugDeathHelper(&aborted), "");
773
+ EXPECT_TRUE(aborted);
774
+ }
775
+
776
+ # endif // _NDEBUG
777
+
778
+ // Tests the *_EXIT family of macros, using a variety of predicates.
779
+ static void TestExitMacros() {
780
+ EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
781
+ ASSERT_EXIT(_exit(42), testing::ExitedWithCode(42), "");
782
+
783
+ # if GTEST_OS_WINDOWS
784
+
785
+ // Of all signals effects on the process exit code, only those of SIGABRT
786
+ // are documented on Windows.
787
+ // See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx.
788
+ EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "") << "b_ar";
789
+
790
+ # elif !GTEST_OS_FUCHSIA
791
+
792
+ // Fuchsia has no unix signals.
793
+ EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo";
794
+ ASSERT_EXIT(raise(SIGUSR2), testing::KilledBySignal(SIGUSR2), "") << "bar";
795
+
796
+ EXPECT_FATAL_FAILURE({ // NOLINT
797
+ ASSERT_EXIT(_exit(0), testing::KilledBySignal(SIGSEGV), "")
798
+ << "This failure is expected, too.";
799
+ }, "This failure is expected, too.");
800
+
801
+ # endif // GTEST_OS_WINDOWS
802
+
803
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
804
+ EXPECT_EXIT(raise(SIGSEGV), testing::ExitedWithCode(0), "")
805
+ << "This failure is expected.";
806
+ }, "This failure is expected.");
807
+ }
808
+
809
+ TEST_F(TestForDeathTest, ExitMacros) {
810
+ TestExitMacros();
811
+ }
812
+
813
+ TEST_F(TestForDeathTest, ExitMacrosUsingFork) {
814
+ testing::GTEST_FLAG(death_test_use_fork) = true;
815
+ TestExitMacros();
816
+ }
817
+
818
+ TEST_F(TestForDeathTest, InvalidStyle) {
819
+ testing::GTEST_FLAG(death_test_style) = "rococo";
820
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
821
+ EXPECT_DEATH(_exit(0), "") << "This failure is expected.";
822
+ }, "This failure is expected.");
823
+ }
824
+
825
+ TEST_F(TestForDeathTest, DeathTestFailedOutput) {
826
+ testing::GTEST_FLAG(death_test_style) = "fast";
827
+ EXPECT_NONFATAL_FAILURE(
828
+ EXPECT_DEATH(DieWithMessage("death\n"),
829
+ "expected message"),
830
+ "Actual msg:\n"
831
+ "[ DEATH ] death\n");
832
+ }
833
+
834
+ TEST_F(TestForDeathTest, DeathTestUnexpectedReturnOutput) {
835
+ testing::GTEST_FLAG(death_test_style) = "fast";
836
+ EXPECT_NONFATAL_FAILURE(
837
+ EXPECT_DEATH({
838
+ fprintf(stderr, "returning\n");
839
+ fflush(stderr);
840
+ return;
841
+ }, ""),
842
+ " Result: illegal return in test statement.\n"
843
+ " Error msg:\n"
844
+ "[ DEATH ] returning\n");
845
+ }
846
+
847
+ TEST_F(TestForDeathTest, DeathTestBadExitCodeOutput) {
848
+ testing::GTEST_FLAG(death_test_style) = "fast";
849
+ EXPECT_NONFATAL_FAILURE(
850
+ EXPECT_EXIT(DieWithMessage("exiting with rc 1\n"),
851
+ testing::ExitedWithCode(3),
852
+ "expected message"),
853
+ " Result: died but not with expected exit code:\n"
854
+ " Exited with exit status 1\n"
855
+ "Actual msg:\n"
856
+ "[ DEATH ] exiting with rc 1\n");
857
+ }
858
+
859
+ TEST_F(TestForDeathTest, DeathTestMultiLineMatchFail) {
860
+ testing::GTEST_FLAG(death_test_style) = "fast";
861
+ EXPECT_NONFATAL_FAILURE(
862
+ EXPECT_DEATH(DieWithMessage("line 1\nline 2\nline 3\n"),
863
+ "line 1\nxyz\nline 3\n"),
864
+ "Actual msg:\n"
865
+ "[ DEATH ] line 1\n"
866
+ "[ DEATH ] line 2\n"
867
+ "[ DEATH ] line 3\n");
868
+ }
869
+
870
+ TEST_F(TestForDeathTest, DeathTestMultiLineMatchPass) {
871
+ testing::GTEST_FLAG(death_test_style) = "fast";
872
+ EXPECT_DEATH(DieWithMessage("line 1\nline 2\nline 3\n"),
873
+ "line 1\nline 2\nline 3\n");
874
+ }
875
+
876
+ // A DeathTestFactory that returns MockDeathTests.
877
+ class MockDeathTestFactory : public DeathTestFactory {
878
+ public:
879
+ MockDeathTestFactory();
880
+ virtual bool Create(const char* statement,
881
+ const ::testing::internal::RE* regex,
882
+ const char* file, int line, DeathTest** test);
883
+
884
+ // Sets the parameters for subsequent calls to Create.
885
+ void SetParameters(bool create, DeathTest::TestRole role,
886
+ int status, bool passed);
887
+
888
+ // Accessors.
889
+ int AssumeRoleCalls() const { return assume_role_calls_; }
890
+ int WaitCalls() const { return wait_calls_; }
891
+ size_t PassedCalls() const { return passed_args_.size(); }
892
+ bool PassedArgument(int n) const { return passed_args_[n]; }
893
+ size_t AbortCalls() const { return abort_args_.size(); }
894
+ DeathTest::AbortReason AbortArgument(int n) const {
895
+ return abort_args_[n];
896
+ }
897
+ bool TestDeleted() const { return test_deleted_; }
898
+
899
+ private:
900
+ friend class MockDeathTest;
901
+ // If true, Create will return a MockDeathTest; otherwise it returns
902
+ // NULL.
903
+ bool create_;
904
+ // The value a MockDeathTest will return from its AssumeRole method.
905
+ DeathTest::TestRole role_;
906
+ // The value a MockDeathTest will return from its Wait method.
907
+ int status_;
908
+ // The value a MockDeathTest will return from its Passed method.
909
+ bool passed_;
910
+
911
+ // Number of times AssumeRole was called.
912
+ int assume_role_calls_;
913
+ // Number of times Wait was called.
914
+ int wait_calls_;
915
+ // The arguments to the calls to Passed since the last call to
916
+ // SetParameters.
917
+ std::vector<bool> passed_args_;
918
+ // The arguments to the calls to Abort since the last call to
919
+ // SetParameters.
920
+ std::vector<DeathTest::AbortReason> abort_args_;
921
+ // True if the last MockDeathTest returned by Create has been
922
+ // deleted.
923
+ bool test_deleted_;
924
+ };
925
+
926
+
927
+ // A DeathTest implementation useful in testing. It returns values set
928
+ // at its creation from its various inherited DeathTest methods, and
929
+ // reports calls to those methods to its parent MockDeathTestFactory
930
+ // object.
931
+ class MockDeathTest : public DeathTest {
932
+ public:
933
+ MockDeathTest(MockDeathTestFactory *parent,
934
+ TestRole role, int status, bool passed) :
935
+ parent_(parent), role_(role), status_(status), passed_(passed) {
936
+ }
937
+ virtual ~MockDeathTest() {
938
+ parent_->test_deleted_ = true;
939
+ }
940
+ virtual TestRole AssumeRole() {
941
+ ++parent_->assume_role_calls_;
942
+ return role_;
943
+ }
944
+ virtual int Wait() {
945
+ ++parent_->wait_calls_;
946
+ return status_;
947
+ }
948
+ virtual bool Passed(bool exit_status_ok) {
949
+ parent_->passed_args_.push_back(exit_status_ok);
950
+ return passed_;
951
+ }
952
+ virtual void Abort(AbortReason reason) {
953
+ parent_->abort_args_.push_back(reason);
954
+ }
955
+
956
+ private:
957
+ MockDeathTestFactory* const parent_;
958
+ const TestRole role_;
959
+ const int status_;
960
+ const bool passed_;
961
+ };
962
+
963
+
964
+ // MockDeathTestFactory constructor.
965
+ MockDeathTestFactory::MockDeathTestFactory()
966
+ : create_(true),
967
+ role_(DeathTest::OVERSEE_TEST),
968
+ status_(0),
969
+ passed_(true),
970
+ assume_role_calls_(0),
971
+ wait_calls_(0),
972
+ passed_args_(),
973
+ abort_args_() {
974
+ }
975
+
976
+
977
+ // Sets the parameters for subsequent calls to Create.
978
+ void MockDeathTestFactory::SetParameters(bool create,
979
+ DeathTest::TestRole role,
980
+ int status, bool passed) {
981
+ create_ = create;
982
+ role_ = role;
983
+ status_ = status;
984
+ passed_ = passed;
985
+
986
+ assume_role_calls_ = 0;
987
+ wait_calls_ = 0;
988
+ passed_args_.clear();
989
+ abort_args_.clear();
990
+ }
991
+
992
+
993
+ // Sets test to NULL (if create_ is false) or to the address of a new
994
+ // MockDeathTest object with parameters taken from the last call
995
+ // to SetParameters (if create_ is true). Always returns true.
996
+ bool MockDeathTestFactory::Create(const char* /*statement*/,
997
+ const ::testing::internal::RE* /*regex*/,
998
+ const char* /*file*/,
999
+ int /*line*/,
1000
+ DeathTest** test) {
1001
+ test_deleted_ = false;
1002
+ if (create_) {
1003
+ *test = new MockDeathTest(this, role_, status_, passed_);
1004
+ } else {
1005
+ *test = NULL;
1006
+ }
1007
+ return true;
1008
+ }
1009
+
1010
+ // A test fixture for testing the logic of the GTEST_DEATH_TEST_ macro.
1011
+ // It installs a MockDeathTestFactory that is used for the duration
1012
+ // of the test case.
1013
+ class MacroLogicDeathTest : public testing::Test {
1014
+ protected:
1015
+ static testing::internal::ReplaceDeathTestFactory* replacer_;
1016
+ static MockDeathTestFactory* factory_;
1017
+
1018
+ static void SetUpTestCase() {
1019
+ factory_ = new MockDeathTestFactory;
1020
+ replacer_ = new testing::internal::ReplaceDeathTestFactory(factory_);
1021
+ }
1022
+
1023
+ static void TearDownTestCase() {
1024
+ delete replacer_;
1025
+ replacer_ = NULL;
1026
+ delete factory_;
1027
+ factory_ = NULL;
1028
+ }
1029
+
1030
+ // Runs a death test that breaks the rules by returning. Such a death
1031
+ // test cannot be run directly from a test routine that uses a
1032
+ // MockDeathTest, or the remainder of the routine will not be executed.
1033
+ static void RunReturningDeathTest(bool* flag) {
1034
+ ASSERT_DEATH({ // NOLINT
1035
+ *flag = true;
1036
+ return;
1037
+ }, "");
1038
+ }
1039
+ };
1040
+
1041
+ testing::internal::ReplaceDeathTestFactory* MacroLogicDeathTest::replacer_
1042
+ = NULL;
1043
+ MockDeathTestFactory* MacroLogicDeathTest::factory_ = NULL;
1044
+
1045
+
1046
+ // Test that nothing happens when the factory doesn't return a DeathTest:
1047
+ TEST_F(MacroLogicDeathTest, NothingHappens) {
1048
+ bool flag = false;
1049
+ factory_->SetParameters(false, DeathTest::OVERSEE_TEST, 0, true);
1050
+ EXPECT_DEATH(flag = true, "");
1051
+ EXPECT_FALSE(flag);
1052
+ EXPECT_EQ(0, factory_->AssumeRoleCalls());
1053
+ EXPECT_EQ(0, factory_->WaitCalls());
1054
+ EXPECT_EQ(0U, factory_->PassedCalls());
1055
+ EXPECT_EQ(0U, factory_->AbortCalls());
1056
+ EXPECT_FALSE(factory_->TestDeleted());
1057
+ }
1058
+
1059
+ // Test that the parent process doesn't run the death test code,
1060
+ // and that the Passed method returns false when the (simulated)
1061
+ // child process exits with status 0:
1062
+ TEST_F(MacroLogicDeathTest, ChildExitsSuccessfully) {
1063
+ bool flag = false;
1064
+ factory_->SetParameters(true, DeathTest::OVERSEE_TEST, 0, true);
1065
+ EXPECT_DEATH(flag = true, "");
1066
+ EXPECT_FALSE(flag);
1067
+ EXPECT_EQ(1, factory_->AssumeRoleCalls());
1068
+ EXPECT_EQ(1, factory_->WaitCalls());
1069
+ ASSERT_EQ(1U, factory_->PassedCalls());
1070
+ EXPECT_FALSE(factory_->PassedArgument(0));
1071
+ EXPECT_EQ(0U, factory_->AbortCalls());
1072
+ EXPECT_TRUE(factory_->TestDeleted());
1073
+ }
1074
+
1075
+ // Tests that the Passed method was given the argument "true" when
1076
+ // the (simulated) child process exits with status 1:
1077
+ TEST_F(MacroLogicDeathTest, ChildExitsUnsuccessfully) {
1078
+ bool flag = false;
1079
+ factory_->SetParameters(true, DeathTest::OVERSEE_TEST, 1, true);
1080
+ EXPECT_DEATH(flag = true, "");
1081
+ EXPECT_FALSE(flag);
1082
+ EXPECT_EQ(1, factory_->AssumeRoleCalls());
1083
+ EXPECT_EQ(1, factory_->WaitCalls());
1084
+ ASSERT_EQ(1U, factory_->PassedCalls());
1085
+ EXPECT_TRUE(factory_->PassedArgument(0));
1086
+ EXPECT_EQ(0U, factory_->AbortCalls());
1087
+ EXPECT_TRUE(factory_->TestDeleted());
1088
+ }
1089
+
1090
+ // Tests that the (simulated) child process executes the death test
1091
+ // code, and is aborted with the correct AbortReason if it
1092
+ // executes a return statement.
1093
+ TEST_F(MacroLogicDeathTest, ChildPerformsReturn) {
1094
+ bool flag = false;
1095
+ factory_->SetParameters(true, DeathTest::EXECUTE_TEST, 0, true);
1096
+ RunReturningDeathTest(&flag);
1097
+ EXPECT_TRUE(flag);
1098
+ EXPECT_EQ(1, factory_->AssumeRoleCalls());
1099
+ EXPECT_EQ(0, factory_->WaitCalls());
1100
+ EXPECT_EQ(0U, factory_->PassedCalls());
1101
+ EXPECT_EQ(1U, factory_->AbortCalls());
1102
+ EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,
1103
+ factory_->AbortArgument(0));
1104
+ EXPECT_TRUE(factory_->TestDeleted());
1105
+ }
1106
+
1107
+ // Tests that the (simulated) child process is aborted with the
1108
+ // correct AbortReason if it does not die.
1109
+ TEST_F(MacroLogicDeathTest, ChildDoesNotDie) {
1110
+ bool flag = false;
1111
+ factory_->SetParameters(true, DeathTest::EXECUTE_TEST, 0, true);
1112
+ EXPECT_DEATH(flag = true, "");
1113
+ EXPECT_TRUE(flag);
1114
+ EXPECT_EQ(1, factory_->AssumeRoleCalls());
1115
+ EXPECT_EQ(0, factory_->WaitCalls());
1116
+ EXPECT_EQ(0U, factory_->PassedCalls());
1117
+ // This time there are two calls to Abort: one since the test didn't
1118
+ // die, and another from the ReturnSentinel when it's destroyed. The
1119
+ // sentinel normally isn't destroyed if a test doesn't die, since
1120
+ // _exit(2) is called in that case by ForkingDeathTest, but not by
1121
+ // our MockDeathTest.
1122
+ ASSERT_EQ(2U, factory_->AbortCalls());
1123
+ EXPECT_EQ(DeathTest::TEST_DID_NOT_DIE,
1124
+ factory_->AbortArgument(0));
1125
+ EXPECT_EQ(DeathTest::TEST_ENCOUNTERED_RETURN_STATEMENT,
1126
+ factory_->AbortArgument(1));
1127
+ EXPECT_TRUE(factory_->TestDeleted());
1128
+ }
1129
+
1130
+ // Tests that a successful death test does not register a successful
1131
+ // test part.
1132
+ TEST(SuccessRegistrationDeathTest, NoSuccessPart) {
1133
+ EXPECT_DEATH(_exit(1), "");
1134
+ EXPECT_EQ(0, GetUnitTestImpl()->current_test_result()->total_part_count());
1135
+ }
1136
+
1137
+ TEST(StreamingAssertionsDeathTest, DeathTest) {
1138
+ EXPECT_DEATH(_exit(1), "") << "unexpected failure";
1139
+ ASSERT_DEATH(_exit(1), "") << "unexpected failure";
1140
+ EXPECT_NONFATAL_FAILURE({ // NOLINT
1141
+ EXPECT_DEATH(_exit(0), "") << "expected failure";
1142
+ }, "expected failure");
1143
+ EXPECT_FATAL_FAILURE({ // NOLINT
1144
+ ASSERT_DEATH(_exit(0), "") << "expected failure";
1145
+ }, "expected failure");
1146
+ }
1147
+
1148
+ // Tests that GetLastErrnoDescription returns an empty string when the
1149
+ // last error is 0 and non-empty string when it is non-zero.
1150
+ TEST(GetLastErrnoDescription, GetLastErrnoDescriptionWorks) {
1151
+ errno = ENOENT;
1152
+ EXPECT_STRNE("", GetLastErrnoDescription().c_str());
1153
+ errno = 0;
1154
+ EXPECT_STREQ("", GetLastErrnoDescription().c_str());
1155
+ }
1156
+
1157
+ # if GTEST_OS_WINDOWS
1158
+ TEST(AutoHandleTest, AutoHandleWorks) {
1159
+ HANDLE handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
1160
+ ASSERT_NE(INVALID_HANDLE_VALUE, handle);
1161
+
1162
+ // Tests that the AutoHandle is correctly initialized with a handle.
1163
+ testing::internal::AutoHandle auto_handle(handle);
1164
+ EXPECT_EQ(handle, auto_handle.Get());
1165
+
1166
+ // Tests that Reset assigns INVALID_HANDLE_VALUE.
1167
+ // Note that this cannot verify whether the original handle is closed.
1168
+ auto_handle.Reset();
1169
+ EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle.Get());
1170
+
1171
+ // Tests that Reset assigns the new handle.
1172
+ // Note that this cannot verify whether the original handle is closed.
1173
+ handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
1174
+ ASSERT_NE(INVALID_HANDLE_VALUE, handle);
1175
+ auto_handle.Reset(handle);
1176
+ EXPECT_EQ(handle, auto_handle.Get());
1177
+
1178
+ // Tests that AutoHandle contains INVALID_HANDLE_VALUE by default.
1179
+ testing::internal::AutoHandle auto_handle2;
1180
+ EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle2.Get());
1181
+ }
1182
+ # endif // GTEST_OS_WINDOWS
1183
+
1184
+ # if GTEST_OS_WINDOWS
1185
+ typedef unsigned __int64 BiggestParsable;
1186
+ typedef signed __int64 BiggestSignedParsable;
1187
+ # else
1188
+ typedef unsigned long long BiggestParsable;
1189
+ typedef signed long long BiggestSignedParsable;
1190
+ # endif // GTEST_OS_WINDOWS
1191
+
1192
+ // We cannot use std::numeric_limits<T>::max() as it clashes with the
1193
+ // max() macro defined by <windows.h>.
1194
+ const BiggestParsable kBiggestParsableMax = ULLONG_MAX;
1195
+ const BiggestSignedParsable kBiggestSignedParsableMax = LLONG_MAX;
1196
+
1197
+ TEST(ParseNaturalNumberTest, RejectsInvalidFormat) {
1198
+ BiggestParsable result = 0;
1199
+
1200
+ // Rejects non-numbers.
1201
+ EXPECT_FALSE(ParseNaturalNumber("non-number string", &result));
1202
+
1203
+ // Rejects numbers with whitespace prefix.
1204
+ EXPECT_FALSE(ParseNaturalNumber(" 123", &result));
1205
+
1206
+ // Rejects negative numbers.
1207
+ EXPECT_FALSE(ParseNaturalNumber("-123", &result));
1208
+
1209
+ // Rejects numbers starting with a plus sign.
1210
+ EXPECT_FALSE(ParseNaturalNumber("+123", &result));
1211
+ errno = 0;
1212
+ }
1213
+
1214
+ TEST(ParseNaturalNumberTest, RejectsOverflownNumbers) {
1215
+ BiggestParsable result = 0;
1216
+
1217
+ EXPECT_FALSE(ParseNaturalNumber("99999999999999999999999", &result));
1218
+
1219
+ signed char char_result = 0;
1220
+ EXPECT_FALSE(ParseNaturalNumber("200", &char_result));
1221
+ errno = 0;
1222
+ }
1223
+
1224
+ TEST(ParseNaturalNumberTest, AcceptsValidNumbers) {
1225
+ BiggestParsable result = 0;
1226
+
1227
+ result = 0;
1228
+ ASSERT_TRUE(ParseNaturalNumber("123", &result));
1229
+ EXPECT_EQ(123U, result);
1230
+
1231
+ // Check 0 as an edge case.
1232
+ result = 1;
1233
+ ASSERT_TRUE(ParseNaturalNumber("0", &result));
1234
+ EXPECT_EQ(0U, result);
1235
+
1236
+ result = 1;
1237
+ ASSERT_TRUE(ParseNaturalNumber("00000", &result));
1238
+ EXPECT_EQ(0U, result);
1239
+ }
1240
+
1241
+ TEST(ParseNaturalNumberTest, AcceptsTypeLimits) {
1242
+ Message msg;
1243
+ msg << kBiggestParsableMax;
1244
+
1245
+ BiggestParsable result = 0;
1246
+ EXPECT_TRUE(ParseNaturalNumber(msg.GetString(), &result));
1247
+ EXPECT_EQ(kBiggestParsableMax, result);
1248
+
1249
+ Message msg2;
1250
+ msg2 << kBiggestSignedParsableMax;
1251
+
1252
+ BiggestSignedParsable signed_result = 0;
1253
+ EXPECT_TRUE(ParseNaturalNumber(msg2.GetString(), &signed_result));
1254
+ EXPECT_EQ(kBiggestSignedParsableMax, signed_result);
1255
+
1256
+ Message msg3;
1257
+ msg3 << INT_MAX;
1258
+
1259
+ int int_result = 0;
1260
+ EXPECT_TRUE(ParseNaturalNumber(msg3.GetString(), &int_result));
1261
+ EXPECT_EQ(INT_MAX, int_result);
1262
+
1263
+ Message msg4;
1264
+ msg4 << UINT_MAX;
1265
+
1266
+ unsigned int uint_result = 0;
1267
+ EXPECT_TRUE(ParseNaturalNumber(msg4.GetString(), &uint_result));
1268
+ EXPECT_EQ(UINT_MAX, uint_result);
1269
+ }
1270
+
1271
+ TEST(ParseNaturalNumberTest, WorksForShorterIntegers) {
1272
+ short short_result = 0;
1273
+ ASSERT_TRUE(ParseNaturalNumber("123", &short_result));
1274
+ EXPECT_EQ(123, short_result);
1275
+
1276
+ signed char char_result = 0;
1277
+ ASSERT_TRUE(ParseNaturalNumber("123", &char_result));
1278
+ EXPECT_EQ(123, char_result);
1279
+ }
1280
+
1281
+ # if GTEST_OS_WINDOWS
1282
+ TEST(EnvironmentTest, HandleFitsIntoSizeT) {
1283
+ // TODO(vladl@google.com): Remove this test after this condition is verified
1284
+ // in a static assertion in gtest-death-test.cc in the function
1285
+ // GetStatusFileDescriptor.
1286
+ ASSERT_TRUE(sizeof(HANDLE) <= sizeof(size_t));
1287
+ }
1288
+ # endif // GTEST_OS_WINDOWS
1289
+
1290
+ // Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED trigger
1291
+ // failures when death tests are available on the system.
1292
+ TEST(ConditionalDeathMacrosDeathTest, ExpectsDeathWhenDeathTestsAvailable) {
1293
+ EXPECT_DEATH_IF_SUPPORTED(DieInside("CondDeathTestExpectMacro"),
1294
+ "death inside CondDeathTestExpectMacro");
1295
+ ASSERT_DEATH_IF_SUPPORTED(DieInside("CondDeathTestAssertMacro"),
1296
+ "death inside CondDeathTestAssertMacro");
1297
+
1298
+ // Empty statement will not crash, which must trigger a failure.
1299
+ EXPECT_NONFATAL_FAILURE(EXPECT_DEATH_IF_SUPPORTED(;, ""), "");
1300
+ EXPECT_FATAL_FAILURE(ASSERT_DEATH_IF_SUPPORTED(;, ""), "");
1301
+ }
1302
+
1303
+ TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInFastStyle) {
1304
+ testing::GTEST_FLAG(death_test_style) = "fast";
1305
+ EXPECT_FALSE(InDeathTestChild());
1306
+ EXPECT_DEATH({
1307
+ fprintf(stderr, InDeathTestChild() ? "Inside" : "Outside");
1308
+ fflush(stderr);
1309
+ _exit(1);
1310
+ }, "Inside");
1311
+ }
1312
+
1313
+ TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInThreadSafeStyle) {
1314
+ testing::GTEST_FLAG(death_test_style) = "threadsafe";
1315
+ EXPECT_FALSE(InDeathTestChild());
1316
+ EXPECT_DEATH({
1317
+ fprintf(stderr, InDeathTestChild() ? "Inside" : "Outside");
1318
+ fflush(stderr);
1319
+ _exit(1);
1320
+ }, "Inside");
1321
+ }
1322
+
1323
+ #else // !GTEST_HAS_DEATH_TEST follows
1324
+
1325
+ using testing::internal::CaptureStderr;
1326
+ using testing::internal::GetCapturedStderr;
1327
+
1328
+ // Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED are still
1329
+ // defined but do not trigger failures when death tests are not available on
1330
+ // the system.
1331
+ TEST(ConditionalDeathMacrosTest, WarnsWhenDeathTestsNotAvailable) {
1332
+ // Empty statement will not crash, but that should not trigger a failure
1333
+ // when death tests are not supported.
1334
+ CaptureStderr();
1335
+ EXPECT_DEATH_IF_SUPPORTED(;, "");
1336
+ std::string output = GetCapturedStderr();
1337
+ ASSERT_TRUE(NULL != strstr(output.c_str(),
1338
+ "Death tests are not supported on this platform"));
1339
+ ASSERT_TRUE(NULL != strstr(output.c_str(), ";"));
1340
+
1341
+ // The streamed message should not be printed as there is no test failure.
1342
+ CaptureStderr();
1343
+ EXPECT_DEATH_IF_SUPPORTED(;, "") << "streamed message";
1344
+ output = GetCapturedStderr();
1345
+ ASSERT_TRUE(NULL == strstr(output.c_str(), "streamed message"));
1346
+
1347
+ CaptureStderr();
1348
+ ASSERT_DEATH_IF_SUPPORTED(;, ""); // NOLINT
1349
+ output = GetCapturedStderr();
1350
+ ASSERT_TRUE(NULL != strstr(output.c_str(),
1351
+ "Death tests are not supported on this platform"));
1352
+ ASSERT_TRUE(NULL != strstr(output.c_str(), ";"));
1353
+
1354
+ CaptureStderr();
1355
+ ASSERT_DEATH_IF_SUPPORTED(;, "") << "streamed message"; // NOLINT
1356
+ output = GetCapturedStderr();
1357
+ ASSERT_TRUE(NULL == strstr(output.c_str(), "streamed message"));
1358
+ }
1359
+
1360
+ void FuncWithAssert(int* n) {
1361
+ ASSERT_DEATH_IF_SUPPORTED(return;, "");
1362
+ (*n)++;
1363
+ }
1364
+
1365
+ // Tests that ASSERT_DEATH_IF_SUPPORTED does not return from the current
1366
+ // function (as ASSERT_DEATH does) if death tests are not supported.
1367
+ TEST(ConditionalDeathMacrosTest, AssertDeatDoesNotReturnhIfUnsupported) {
1368
+ int n = 0;
1369
+ FuncWithAssert(&n);
1370
+ EXPECT_EQ(1, n);
1371
+ }
1372
+
1373
+ #endif // !GTEST_HAS_DEATH_TEST
1374
+
1375
+ // Tests that the death test macros expand to code which may or may not
1376
+ // be followed by operator<<, and that in either case the complete text
1377
+ // comprises only a single C++ statement.
1378
+ //
1379
+ // The syntax should work whether death tests are available or not.
1380
+ TEST(ConditionalDeathMacrosSyntaxDeathTest, SingleStatement) {
1381
+ if (AlwaysFalse())
1382
+ // This would fail if executed; this is a compilation test only
1383
+ ASSERT_DEATH_IF_SUPPORTED(return, "");
1384
+
1385
+ if (AlwaysTrue())
1386
+ EXPECT_DEATH_IF_SUPPORTED(_exit(1), "");
1387
+ else
1388
+ // This empty "else" branch is meant to ensure that EXPECT_DEATH
1389
+ // doesn't expand into an "if" statement without an "else"
1390
+ ; // NOLINT
1391
+
1392
+ if (AlwaysFalse())
1393
+ ASSERT_DEATH_IF_SUPPORTED(return, "") << "did not die";
1394
+
1395
+ if (AlwaysFalse())
1396
+ ; // NOLINT
1397
+ else
1398
+ EXPECT_DEATH_IF_SUPPORTED(_exit(1), "") << 1 << 2 << 3;
1399
+ }
1400
+
1401
+ // Tests that conditional death test macros expand to code which interacts
1402
+ // well with switch statements.
1403
+ TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {
1404
+ // Microsoft compiler usually complains about switch statements without
1405
+ // case labels. We suppress that warning for this test.
1406
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4065)
1407
+
1408
+ switch (0)
1409
+ default:
1410
+ ASSERT_DEATH_IF_SUPPORTED(_exit(1), "")
1411
+ << "exit in default switch handler";
1412
+
1413
+ switch (0)
1414
+ case 0:
1415
+ EXPECT_DEATH_IF_SUPPORTED(_exit(1), "") << "exit in switch case";
1416
+
1417
+ GTEST_DISABLE_MSC_WARNINGS_POP_()
1418
+ }
1419
+
1420
+ // Tests that a test case whose name ends with "DeathTest" works fine
1421
+ // on Windows.
1422
+ TEST(NotADeathTest, Test) {
1423
+ SUCCEED();
1424
+ }