@eosrio/node-abieos 2.1.0-beta.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (740) hide show
  1. package/README.md +4 -1
  2. package/dist/abieos.node +0 -0
  3. package/lib/abieos.d.ts +19 -0
  4. package/lib/abieos.d.ts.map +1 -0
  5. package/lib/abieos.js +100 -0
  6. package/lib/abieos.ts +107 -0
  7. package/package.json +13 -8
  8. package/.gitmodules +0 -6
  9. package/.idea/misc.xml +0 -6
  10. package/.idea/modules.xml +0 -8
  11. package/.idea/node-abieos.iml +0 -12
  12. package/.idea/vcs.xml +0 -9
  13. package/.idea/workspace.xml +0 -266
  14. package/CMakeLists.txt +0 -35
  15. package/abieos.d.ts +0 -21
  16. package/abieos.js +0 -59
  17. package/eosio.json +0 -1596
  18. package/external/date/CMakeLists.txt +0 -175
  19. package/external/date/LICENSE.txt +0 -31
  20. package/external/date/README.md +0 -61
  21. package/external/date/compile_fail.sh +0 -16
  22. package/external/date/include/date/chrono_io.h +0 -34
  23. package/external/date/include/date/date.h +0 -8335
  24. package/external/date/include/date/ios.h +0 -50
  25. package/external/date/include/date/islamic.h +0 -3031
  26. package/external/date/include/date/iso_week.h +0 -1745
  27. package/external/date/include/date/julian.h +0 -3046
  28. package/external/date/include/date/ptz.h +0 -592
  29. package/external/date/include/date/tz.h +0 -2760
  30. package/external/date/include/date/tz_private.h +0 -318
  31. package/external/date/src/ios.mm +0 -337
  32. package/external/date/src/tz.cpp +0 -3801
  33. package/external/date/test/clock_cast_test/custom_clock.pass.cpp +0 -213
  34. package/external/date/test/clock_cast_test/deprecated.pass.cpp +0 -90
  35. package/external/date/test/clock_cast_test/local_t.pass.cpp +0 -132
  36. package/external/date/test/clock_cast_test/noncastable.pass.cpp +0 -251
  37. package/external/date/test/clock_cast_test/normal_clocks.pass.cpp +0 -102
  38. package/external/date/test/clock_cast_test/to_sys_return_int.fail.cpp +0 -49
  39. package/external/date/test/clock_cast_test/to_sys_return_reference.fail.cpp +0 -51
  40. package/external/date/test/clock_cast_test/to_sys_return_utc_time.fail.cpp +0 -49
  41. package/external/date/test/date_test/day.pass.cpp +0 -143
  42. package/external/date/test/date_test/daypday.fail.cpp +0 -32
  43. package/external/date/test/date_test/daysmday.fail.cpp +0 -32
  44. package/external/date/test/date_test/daysmweekday.fail.cpp +0 -32
  45. package/external/date/test/date_test/detail/decimal_format_seconds.pass.cpp +0 -145
  46. package/external/date/test/date_test/detail/make_precision.pass.cpp +0 -63
  47. package/external/date/test/date_test/detail/static_pow10.pass.cpp +0 -50
  48. package/external/date/test/date_test/detail/width.pass.cpp +0 -64
  49. package/external/date/test/date_test/durations.pass.cpp +0 -62
  50. package/external/date/test/date_test/durations_output.pass.cpp +0 -328
  51. package/external/date/test/date_test/format/century.pass.cpp +0 -117
  52. package/external/date/test/date_test/format/misc.pass.cpp +0 -52
  53. package/external/date/test/date_test/format/range.pass.cpp +0 -78
  54. package/external/date/test/date_test/format/two_dight_year.pass.cpp +0 -121
  55. package/external/date/test/date_test/last.pass.cpp +0 -34
  56. package/external/date/test/date_test/make_time.pass.cpp +0 -164
  57. package/external/date/test/date_test/month.pass.cpp +0 -181
  58. package/external/date/test/date_test/month_day.pass.cpp +0 -82
  59. package/external/date/test/date_test/month_day_last.pass.cpp +0 -75
  60. package/external/date/test/date_test/month_weekday.pass.cpp +0 -77
  61. package/external/date/test/date_test/month_weekday_last.pass.cpp +0 -77
  62. package/external/date/test/date_test/month_weekday_last_less.fail.cpp +0 -34
  63. package/external/date/test/date_test/month_weekday_less.fail.cpp +0 -34
  64. package/external/date/test/date_test/monthpmonth.fail.cpp +0 -32
  65. package/external/date/test/date_test/months_m_year_month.fail.cpp +0 -33
  66. package/external/date/test/date_test/months_m_year_month_day.fail.cpp +0 -33
  67. package/external/date/test/date_test/monthsmmonth.fail.cpp +0 -32
  68. package/external/date/test/date_test/multi_year_duration_addition.pass.cpp +0 -297
  69. package/external/date/test/date_test/op_div_day_day.fail.cpp +0 -33
  70. package/external/date/test/date_test/op_div_int_month.fail.cpp +0 -33
  71. package/external/date/test/date_test/op_div_int_year.fail.cpp +0 -33
  72. package/external/date/test/date_test/op_div_last_last.fail.cpp +0 -33
  73. package/external/date/test/date_test/op_div_month_day.pass.cpp +0 -41
  74. package/external/date/test/date_test/op_div_month_day_last.pass.cpp +0 -39
  75. package/external/date/test/date_test/op_div_month_day_month_day.fail.cpp +0 -33
  76. package/external/date/test/date_test/op_div_month_month.fail.cpp +0 -33
  77. package/external/date/test/date_test/op_div_month_weekday.pass.cpp +0 -39
  78. package/external/date/test/date_test/op_div_month_weekday_last.pass.cpp +0 -39
  79. package/external/date/test/date_test/op_div_month_year.fail.cpp +0 -33
  80. package/external/date/test/date_test/op_div_survey.pass.cpp +0 -437
  81. package/external/date/test/date_test/op_div_weekday_indexed_weekday_indexed.fail.cpp +0 -33
  82. package/external/date/test/date_test/op_div_weekday_last_weekday_last.fail.cpp +0 -33
  83. package/external/date/test/date_test/op_div_year_month.pass.cpp +0 -35
  84. package/external/date/test/date_test/op_div_year_month_day.pass.cpp +0 -43
  85. package/external/date/test/date_test/op_div_year_month_day_last.pass.cpp +0 -41
  86. package/external/date/test/date_test/op_div_year_month_weekday.pass.cpp +0 -41
  87. package/external/date/test/date_test/op_div_year_month_weekday_last.pass.cpp +0 -41
  88. package/external/date/test/date_test/op_div_year_month_year_month.fail.cpp +0 -33
  89. package/external/date/test/date_test/op_div_year_year.fail.cpp +0 -33
  90. package/external/date/test/date_test/parse.pass.cpp +0 -904
  91. package/external/date/test/date_test/sizeof.pass.cpp +0 -62
  92. package/external/date/test/date_test/time_of_day_hours.pass.cpp +0 -104
  93. package/external/date/test/date_test/time_of_day_microfortnights.pass.cpp +0 -119
  94. package/external/date/test/date_test/time_of_day_milliseconds.pass.cpp +0 -126
  95. package/external/date/test/date_test/time_of_day_minutes.pass.cpp +0 -110
  96. package/external/date/test/date_test/time_of_day_nanoseconds.pass.cpp +0 -126
  97. package/external/date/test/date_test/time_of_day_seconds.pass.cpp +0 -116
  98. package/external/date/test/date_test/weekday.pass.cpp +0 -201
  99. package/external/date/test/date_test/weekday_indexed.pass.cpp +0 -70
  100. package/external/date/test/date_test/weekday_last.pass.cpp +0 -66
  101. package/external/date/test/date_test/weekday_lessthan.fail.cpp +0 -32
  102. package/external/date/test/date_test/weekday_sum.fail.cpp +0 -32
  103. package/external/date/test/date_test/year.pass.cpp +0 -146
  104. package/external/date/test/date_test/year_month.pass.cpp +0 -142
  105. package/external/date/test/date_test/year_month_day.pass.cpp +0 -244
  106. package/external/date/test/date_test/year_month_day_last.pass.cpp +0 -177
  107. package/external/date/test/date_test/year_month_day_m_year_month_day.fail.cpp +0 -33
  108. package/external/date/test/date_test/year_month_day_p_year_month_day.fail.cpp +0 -33
  109. package/external/date/test/date_test/year_month_p_year_month.fail.cpp +0 -33
  110. package/external/date/test/date_test/year_month_weekday.pass.cpp +0 -178
  111. package/external/date/test/date_test/year_month_weekday_last.pass.cpp +0 -169
  112. package/external/date/test/date_test/year_p_year.fail.cpp +0 -32
  113. package/external/date/test/date_test/years_m_year.fail.cpp +0 -32
  114. package/external/date/test/date_test/years_m_year_month.fail.cpp +0 -33
  115. package/external/date/test/date_test/years_m_year_month_day.fail.cpp +0 -33
  116. package/external/date/test/iso_week/last.pass.cpp +0 -34
  117. package/external/date/test/iso_week/lastweek_weekday.pass.cpp +0 -82
  118. package/external/date/test/iso_week/op_div_survey.pass.cpp +0 -196
  119. package/external/date/test/iso_week/weekday.pass.cpp +0 -227
  120. package/external/date/test/iso_week/weekday_lessthan.fail.cpp +0 -32
  121. package/external/date/test/iso_week/weekday_sum.fail.cpp +0 -32
  122. package/external/date/test/iso_week/weeknum.pass.cpp +0 -121
  123. package/external/date/test/iso_week/weeknum_p_weeknum.fail.cpp +0 -32
  124. package/external/date/test/iso_week/weeknum_weekday.pass.cpp +0 -86
  125. package/external/date/test/iso_week/year.pass.cpp +0 -120
  126. package/external/date/test/iso_week/year_lastweek.pass.cpp +0 -97
  127. package/external/date/test/iso_week/year_lastweek_weekday.pass.cpp +0 -129
  128. package/external/date/test/iso_week/year_p_year.fail.cpp +0 -32
  129. package/external/date/test/iso_week/year_weeknum.pass.cpp +0 -97
  130. package/external/date/test/iso_week/year_weeknum_weekday.pass.cpp +0 -139
  131. package/external/date/test/iso_week/years_m_year.fail.cpp +0 -32
  132. package/external/date/test/just.pass.cpp +0 -26
  133. package/external/date/test/testit +0 -177
  134. package/external/date/test/tz_test/OffsetZone.pass.cpp +0 -81
  135. package/external/date/test/tz_test/README.md +0 -22
  136. package/external/date/test/tz_test/tzdata2015e.txt.zip +0 -0
  137. package/external/date/test/tz_test/tzdata2015f.txt.zip +0 -0
  138. package/external/date/test/tz_test/tzdata2016c.txt.zip +0 -0
  139. package/external/date/test/tz_test/tzdata2016d.txt.zip +0 -0
  140. package/external/date/test/tz_test/tzdata2016e.txt.zip +0 -0
  141. package/external/date/test/tz_test/tzdata2016f.txt.zip +0 -0
  142. package/external/date/test/tz_test/validate.cpp +0 -165
  143. package/external/date/test/tz_test/zone.pass.cpp +0 -37
  144. package/external/date/test/tz_test/zoned_time.pass.cpp +0 -464
  145. package/external/date/test_fail.sh +0 -10
  146. package/external/rapidjson/.gitattributes +0 -22
  147. package/external/rapidjson/.gitmodules +0 -3
  148. package/external/rapidjson/.travis.yml +0 -99
  149. package/external/rapidjson/CHANGELOG.md +0 -158
  150. package/external/rapidjson/CMakeLists.txt +0 -221
  151. package/external/rapidjson/CMakeModules/FindGTestSrc.cmake +0 -30
  152. package/external/rapidjson/RapidJSON.pc.in +0 -7
  153. package/external/rapidjson/RapidJSONConfig.cmake.in +0 -15
  154. package/external/rapidjson/RapidJSONConfigVersion.cmake.in +0 -10
  155. package/external/rapidjson/appveyor.yml +0 -54
  156. package/external/rapidjson/bin/data/glossary.json +0 -22
  157. package/external/rapidjson/bin/data/menu.json +0 -27
  158. package/external/rapidjson/bin/data/readme.txt +0 -1
  159. package/external/rapidjson/bin/data/sample.json +0 -3315
  160. package/external/rapidjson/bin/data/webapp.json +0 -88
  161. package/external/rapidjson/bin/data/widget.json +0 -26
  162. package/external/rapidjson/bin/encodings/utf16be.json +0 -0
  163. package/external/rapidjson/bin/encodings/utf16bebom.json +0 -0
  164. package/external/rapidjson/bin/encodings/utf16le.json +0 -0
  165. package/external/rapidjson/bin/encodings/utf16lebom.json +0 -0
  166. package/external/rapidjson/bin/encodings/utf32be.json +0 -0
  167. package/external/rapidjson/bin/encodings/utf32bebom.json +0 -0
  168. package/external/rapidjson/bin/encodings/utf32le.json +0 -0
  169. package/external/rapidjson/bin/encodings/utf32lebom.json +0 -0
  170. package/external/rapidjson/bin/encodings/utf8.json +0 -7
  171. package/external/rapidjson/bin/encodings/utf8bom.json +0 -7
  172. package/external/rapidjson/bin/jsonchecker/fail1.json +0 -1
  173. package/external/rapidjson/bin/jsonchecker/fail10.json +0 -1
  174. package/external/rapidjson/bin/jsonchecker/fail11.json +0 -1
  175. package/external/rapidjson/bin/jsonchecker/fail12.json +0 -1
  176. package/external/rapidjson/bin/jsonchecker/fail13.json +0 -1
  177. package/external/rapidjson/bin/jsonchecker/fail14.json +0 -1
  178. package/external/rapidjson/bin/jsonchecker/fail15.json +0 -1
  179. package/external/rapidjson/bin/jsonchecker/fail16.json +0 -1
  180. package/external/rapidjson/bin/jsonchecker/fail17.json +0 -1
  181. package/external/rapidjson/bin/jsonchecker/fail18.json +0 -1
  182. package/external/rapidjson/bin/jsonchecker/fail19.json +0 -1
  183. package/external/rapidjson/bin/jsonchecker/fail2.json +0 -1
  184. package/external/rapidjson/bin/jsonchecker/fail20.json +0 -1
  185. package/external/rapidjson/bin/jsonchecker/fail21.json +0 -1
  186. package/external/rapidjson/bin/jsonchecker/fail22.json +0 -1
  187. package/external/rapidjson/bin/jsonchecker/fail23.json +0 -1
  188. package/external/rapidjson/bin/jsonchecker/fail24.json +0 -1
  189. package/external/rapidjson/bin/jsonchecker/fail25.json +0 -1
  190. package/external/rapidjson/bin/jsonchecker/fail26.json +0 -1
  191. package/external/rapidjson/bin/jsonchecker/fail27.json +0 -2
  192. package/external/rapidjson/bin/jsonchecker/fail28.json +0 -2
  193. package/external/rapidjson/bin/jsonchecker/fail29.json +0 -1
  194. package/external/rapidjson/bin/jsonchecker/fail3.json +0 -1
  195. package/external/rapidjson/bin/jsonchecker/fail30.json +0 -1
  196. package/external/rapidjson/bin/jsonchecker/fail31.json +0 -1
  197. package/external/rapidjson/bin/jsonchecker/fail32.json +0 -1
  198. package/external/rapidjson/bin/jsonchecker/fail33.json +0 -1
  199. package/external/rapidjson/bin/jsonchecker/fail4.json +0 -1
  200. package/external/rapidjson/bin/jsonchecker/fail5.json +0 -1
  201. package/external/rapidjson/bin/jsonchecker/fail6.json +0 -1
  202. package/external/rapidjson/bin/jsonchecker/fail7.json +0 -1
  203. package/external/rapidjson/bin/jsonchecker/fail8.json +0 -1
  204. package/external/rapidjson/bin/jsonchecker/fail9.json +0 -1
  205. package/external/rapidjson/bin/jsonchecker/pass1.json +0 -58
  206. package/external/rapidjson/bin/jsonchecker/pass2.json +0 -1
  207. package/external/rapidjson/bin/jsonchecker/pass3.json +0 -6
  208. package/external/rapidjson/bin/jsonchecker/readme.txt +0 -3
  209. package/external/rapidjson/bin/types/booleans.json +0 -102
  210. package/external/rapidjson/bin/types/floats.json +0 -102
  211. package/external/rapidjson/bin/types/guids.json +0 -102
  212. package/external/rapidjson/bin/types/integers.json +0 -102
  213. package/external/rapidjson/bin/types/mixed.json +0 -592
  214. package/external/rapidjson/bin/types/nulls.json +0 -102
  215. package/external/rapidjson/bin/types/paragraphs.json +0 -102
  216. package/external/rapidjson/bin/types/readme.txt +0 -1
  217. package/external/rapidjson/contrib/natvis/LICENSE +0 -45
  218. package/external/rapidjson/contrib/natvis/README.md +0 -7
  219. package/external/rapidjson/contrib/natvis/rapidjson.natvis +0 -38
  220. package/external/rapidjson/doc/CMakeLists.txt +0 -27
  221. package/external/rapidjson/doc/Doxyfile.in +0 -2369
  222. package/external/rapidjson/doc/Doxyfile.zh-cn.in +0 -2369
  223. package/external/rapidjson/doc/diagram/architecture.dot +0 -50
  224. package/external/rapidjson/doc/diagram/architecture.png +0 -0
  225. package/external/rapidjson/doc/diagram/insituparsing.dot +0 -65
  226. package/external/rapidjson/doc/diagram/insituparsing.png +0 -0
  227. package/external/rapidjson/doc/diagram/iterative-parser-states-diagram.dot +0 -62
  228. package/external/rapidjson/doc/diagram/iterative-parser-states-diagram.png +0 -0
  229. package/external/rapidjson/doc/diagram/move1.dot +0 -47
  230. package/external/rapidjson/doc/diagram/move1.png +0 -0
  231. package/external/rapidjson/doc/diagram/move2.dot +0 -62
  232. package/external/rapidjson/doc/diagram/move2.png +0 -0
  233. package/external/rapidjson/doc/diagram/move3.dot +0 -60
  234. package/external/rapidjson/doc/diagram/move3.png +0 -0
  235. package/external/rapidjson/doc/diagram/normalparsing.dot +0 -56
  236. package/external/rapidjson/doc/diagram/normalparsing.png +0 -0
  237. package/external/rapidjson/doc/diagram/simpledom.dot +0 -54
  238. package/external/rapidjson/doc/diagram/simpledom.png +0 -0
  239. package/external/rapidjson/doc/diagram/tutorial.dot +0 -58
  240. package/external/rapidjson/doc/diagram/tutorial.png +0 -0
  241. package/external/rapidjson/doc/diagram/utilityclass.dot +0 -73
  242. package/external/rapidjson/doc/diagram/utilityclass.png +0 -0
  243. package/external/rapidjson/doc/dom.md +0 -280
  244. package/external/rapidjson/doc/dom.zh-cn.md +0 -284
  245. package/external/rapidjson/doc/encoding.md +0 -146
  246. package/external/rapidjson/doc/encoding.zh-cn.md +0 -152
  247. package/external/rapidjson/doc/faq.md +0 -289
  248. package/external/rapidjson/doc/faq.zh-cn.md +0 -290
  249. package/external/rapidjson/doc/features.md +0 -104
  250. package/external/rapidjson/doc/features.zh-cn.md +0 -103
  251. package/external/rapidjson/doc/internals.md +0 -368
  252. package/external/rapidjson/doc/internals.zh-cn.md +0 -363
  253. package/external/rapidjson/doc/logo/rapidjson.png +0 -0
  254. package/external/rapidjson/doc/logo/rapidjson.svg +0 -119
  255. package/external/rapidjson/doc/misc/DoxygenLayout.xml +0 -194
  256. package/external/rapidjson/doc/misc/doxygenextra.css +0 -274
  257. package/external/rapidjson/doc/misc/footer.html +0 -11
  258. package/external/rapidjson/doc/misc/header.html +0 -24
  259. package/external/rapidjson/doc/npm.md +0 -31
  260. package/external/rapidjson/doc/performance.md +0 -26
  261. package/external/rapidjson/doc/performance.zh-cn.md +0 -26
  262. package/external/rapidjson/doc/pointer.md +0 -234
  263. package/external/rapidjson/doc/pointer.zh-cn.md +0 -234
  264. package/external/rapidjson/doc/sax.md +0 -509
  265. package/external/rapidjson/doc/sax.zh-cn.md +0 -487
  266. package/external/rapidjson/doc/schema.md +0 -505
  267. package/external/rapidjson/doc/schema.zh-cn.md +0 -237
  268. package/external/rapidjson/doc/stream.md +0 -429
  269. package/external/rapidjson/doc/stream.zh-cn.md +0 -429
  270. package/external/rapidjson/doc/tutorial.md +0 -536
  271. package/external/rapidjson/doc/tutorial.zh-cn.md +0 -535
  272. package/external/rapidjson/docker/debian/Dockerfile +0 -8
  273. package/external/rapidjson/example/CMakeLists.txt +0 -45
  274. package/external/rapidjson/example/archiver/archiver.cpp +0 -292
  275. package/external/rapidjson/example/archiver/archiver.h +0 -145
  276. package/external/rapidjson/example/archiver/archivertest.cpp +0 -287
  277. package/external/rapidjson/example/capitalize/capitalize.cpp +0 -67
  278. package/external/rapidjson/example/condense/condense.cpp +0 -32
  279. package/external/rapidjson/example/filterkey/filterkey.cpp +0 -135
  280. package/external/rapidjson/example/filterkeydom/filterkeydom.cpp +0 -170
  281. package/external/rapidjson/example/jsonx/jsonx.cpp +0 -207
  282. package/external/rapidjson/example/lookaheadparser/lookaheadparser.cpp +0 -350
  283. package/external/rapidjson/example/messagereader/messagereader.cpp +0 -105
  284. package/external/rapidjson/example/parsebyparts/parsebyparts.cpp +0 -176
  285. package/external/rapidjson/example/pretty/pretty.cpp +0 -30
  286. package/external/rapidjson/example/prettyauto/prettyauto.cpp +0 -56
  287. package/external/rapidjson/example/schemavalidator/schemavalidator.cpp +0 -78
  288. package/external/rapidjson/example/serialize/serialize.cpp +0 -173
  289. package/external/rapidjson/example/simpledom/simpledom.cpp +0 -29
  290. package/external/rapidjson/example/simplepullreader/simplepullreader.cpp +0 -53
  291. package/external/rapidjson/example/simplereader/simplereader.cpp +0 -42
  292. package/external/rapidjson/example/simplewriter/simplewriter.cpp +0 -36
  293. package/external/rapidjson/example/tutorial/tutorial.cpp +0 -151
  294. package/external/rapidjson/include/rapidjson/allocators.h +0 -284
  295. package/external/rapidjson/include/rapidjson/cursorstreamwrapper.h +0 -78
  296. package/external/rapidjson/include/rapidjson/document.h +0 -2646
  297. package/external/rapidjson/include/rapidjson/encodedstream.h +0 -299
  298. package/external/rapidjson/include/rapidjson/encodings.h +0 -716
  299. package/external/rapidjson/include/rapidjson/error/en.h +0 -74
  300. package/external/rapidjson/include/rapidjson/error/error.h +0 -161
  301. package/external/rapidjson/include/rapidjson/filereadstream.h +0 -99
  302. package/external/rapidjson/include/rapidjson/filewritestream.h +0 -104
  303. package/external/rapidjson/include/rapidjson/fwd.h +0 -151
  304. package/external/rapidjson/include/rapidjson/internal/biginteger.h +0 -290
  305. package/external/rapidjson/include/rapidjson/internal/diyfp.h +0 -271
  306. package/external/rapidjson/include/rapidjson/internal/dtoa.h +0 -245
  307. package/external/rapidjson/include/rapidjson/internal/ieee754.h +0 -78
  308. package/external/rapidjson/include/rapidjson/internal/itoa.h +0 -308
  309. package/external/rapidjson/include/rapidjson/internal/meta.h +0 -186
  310. package/external/rapidjson/include/rapidjson/internal/pow10.h +0 -55
  311. package/external/rapidjson/include/rapidjson/internal/regex.h +0 -732
  312. package/external/rapidjson/include/rapidjson/internal/stack.h +0 -231
  313. package/external/rapidjson/include/rapidjson/internal/strfunc.h +0 -69
  314. package/external/rapidjson/include/rapidjson/internal/strtod.h +0 -290
  315. package/external/rapidjson/include/rapidjson/internal/swap.h +0 -46
  316. package/external/rapidjson/include/rapidjson/istreamwrapper.h +0 -113
  317. package/external/rapidjson/include/rapidjson/memorybuffer.h +0 -70
  318. package/external/rapidjson/include/rapidjson/memorystream.h +0 -71
  319. package/external/rapidjson/include/rapidjson/msinttypes/inttypes.h +0 -316
  320. package/external/rapidjson/include/rapidjson/msinttypes/stdint.h +0 -300
  321. package/external/rapidjson/include/rapidjson/ostreamwrapper.h +0 -81
  322. package/external/rapidjson/include/rapidjson/pointer.h +0 -1357
  323. package/external/rapidjson/include/rapidjson/prettywriter.h +0 -277
  324. package/external/rapidjson/include/rapidjson/rapidjson.h +0 -654
  325. package/external/rapidjson/include/rapidjson/reader.h +0 -2230
  326. package/external/rapidjson/include/rapidjson/schema.h +0 -2494
  327. package/external/rapidjson/include/rapidjson/stream.h +0 -223
  328. package/external/rapidjson/include/rapidjson/stringbuffer.h +0 -121
  329. package/external/rapidjson/include/rapidjson/writer.h +0 -710
  330. package/external/rapidjson/include_dirs.js +0 -2
  331. package/external/rapidjson/library.json +0 -15
  332. package/external/rapidjson/license.txt +0 -57
  333. package/external/rapidjson/package.json +0 -24
  334. package/external/rapidjson/rapidjson.autopkg +0 -77
  335. package/external/rapidjson/readme.md +0 -160
  336. package/external/rapidjson/readme.zh-cn.md +0 -152
  337. package/external/rapidjson/test/CMakeLists.txt +0 -20
  338. package/external/rapidjson/test/perftest/CMakeLists.txt +0 -28
  339. package/external/rapidjson/test/perftest/misctest.cpp +0 -974
  340. package/external/rapidjson/test/perftest/perftest.cpp +0 -24
  341. package/external/rapidjson/test/perftest/perftest.h +0 -185
  342. package/external/rapidjson/test/perftest/platformtest.cpp +0 -166
  343. package/external/rapidjson/test/perftest/rapidjsontest.cpp +0 -472
  344. package/external/rapidjson/test/perftest/schematest.cpp +0 -223
  345. package/external/rapidjson/test/unittest/CMakeLists.txt +0 -92
  346. package/external/rapidjson/test/unittest/allocatorstest.cpp +0 -100
  347. package/external/rapidjson/test/unittest/bigintegertest.cpp +0 -138
  348. package/external/rapidjson/test/unittest/cursorstreamwrappertest.cpp +0 -115
  349. package/external/rapidjson/test/unittest/documenttest.cpp +0 -672
  350. package/external/rapidjson/test/unittest/dtoatest.cpp +0 -98
  351. package/external/rapidjson/test/unittest/encodedstreamtest.cpp +0 -313
  352. package/external/rapidjson/test/unittest/encodingstest.cpp +0 -451
  353. package/external/rapidjson/test/unittest/filestreamtest.cpp +0 -112
  354. package/external/rapidjson/test/unittest/fwdtest.cpp +0 -230
  355. package/external/rapidjson/test/unittest/istreamwrappertest.cpp +0 -181
  356. package/external/rapidjson/test/unittest/itoatest.cpp +0 -160
  357. package/external/rapidjson/test/unittest/jsoncheckertest.cpp +0 -143
  358. package/external/rapidjson/test/unittest/namespacetest.cpp +0 -70
  359. package/external/rapidjson/test/unittest/ostreamwrappertest.cpp +0 -92
  360. package/external/rapidjson/test/unittest/pointertest.cpp +0 -1529
  361. package/external/rapidjson/test/unittest/prettywritertest.cpp +0 -373
  362. package/external/rapidjson/test/unittest/readertest.cpp +0 -2190
  363. package/external/rapidjson/test/unittest/regextest.cpp +0 -638
  364. package/external/rapidjson/test/unittest/schematest.cpp +0 -2072
  365. package/external/rapidjson/test/unittest/simdtest.cpp +0 -219
  366. package/external/rapidjson/test/unittest/strfunctest.cpp +0 -30
  367. package/external/rapidjson/test/unittest/stringbuffertest.cpp +0 -192
  368. package/external/rapidjson/test/unittest/strtodtest.cpp +0 -132
  369. package/external/rapidjson/test/unittest/unittest.cpp +0 -51
  370. package/external/rapidjson/test/unittest/unittest.h +0 -140
  371. package/external/rapidjson/test/unittest/valuetest.cpp +0 -1851
  372. package/external/rapidjson/test/unittest/writertest.cpp +0 -598
  373. package/external/rapidjson/test/valgrind.supp +0 -17
  374. package/external/rapidjson/thirdparty/gtest/.travis.yml +0 -81
  375. package/external/rapidjson/thirdparty/gtest/BUILD.bazel +0 -175
  376. package/external/rapidjson/thirdparty/gtest/CMakeLists.txt +0 -33
  377. package/external/rapidjson/thirdparty/gtest/CONTRIBUTING.md +0 -160
  378. package/external/rapidjson/thirdparty/gtest/LICENSE +0 -28
  379. package/external/rapidjson/thirdparty/gtest/Makefile.am +0 -14
  380. package/external/rapidjson/thirdparty/gtest/README.md +0 -122
  381. package/external/rapidjson/thirdparty/gtest/WORKSPACE +0 -8
  382. package/external/rapidjson/thirdparty/gtest/appveyor.yml +0 -104
  383. package/external/rapidjson/thirdparty/gtest/ci/build-linux-autotools.sh +0 -44
  384. package/external/rapidjson/thirdparty/gtest/ci/build-linux-bazel.sh +0 -36
  385. package/external/rapidjson/thirdparty/gtest/ci/env-linux.sh +0 -41
  386. package/external/rapidjson/thirdparty/gtest/ci/env-osx.sh +0 -40
  387. package/external/rapidjson/thirdparty/gtest/ci/get-nprocessors.sh +0 -48
  388. package/external/rapidjson/thirdparty/gtest/ci/install-linux.sh +0 -49
  389. package/external/rapidjson/thirdparty/gtest/ci/install-osx.sh +0 -39
  390. package/external/rapidjson/thirdparty/gtest/ci/log-config.sh +0 -51
  391. package/external/rapidjson/thirdparty/gtest/ci/travis.sh +0 -44
  392. package/external/rapidjson/thirdparty/gtest/configure.ac +0 -16
  393. package/external/rapidjson/thirdparty/gtest/googlemock/CHANGES +0 -126
  394. package/external/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt +0 -242
  395. package/external/rapidjson/thirdparty/gtest/googlemock/CONTRIBUTORS +0 -40
  396. package/external/rapidjson/thirdparty/gtest/googlemock/LICENSE +0 -28
  397. package/external/rapidjson/thirdparty/gtest/googlemock/Makefile.am +0 -224
  398. package/external/rapidjson/thirdparty/gtest/googlemock/README.md +0 -344
  399. package/external/rapidjson/thirdparty/gtest/googlemock/build-aux/.keep +0 -0
  400. package/external/rapidjson/thirdparty/gtest/googlemock/cmake/gmock.pc.in +0 -9
  401. package/external/rapidjson/thirdparty/gtest/googlemock/cmake/gmock_main.pc.in +0 -9
  402. package/external/rapidjson/thirdparty/gtest/googlemock/configure.ac +0 -146
  403. package/external/rapidjson/thirdparty/gtest/googlemock/docs/CheatSheet.md +0 -564
  404. package/external/rapidjson/thirdparty/gtest/googlemock/docs/CookBook.md +0 -3660
  405. package/external/rapidjson/thirdparty/gtest/googlemock/docs/DesignDoc.md +0 -280
  406. package/external/rapidjson/thirdparty/gtest/googlemock/docs/Documentation.md +0 -15
  407. package/external/rapidjson/thirdparty/gtest/googlemock/docs/ForDummies.md +0 -447
  408. package/external/rapidjson/thirdparty/gtest/googlemock/docs/FrequentlyAskedQuestions.md +0 -627
  409. package/external/rapidjson/thirdparty/gtest/googlemock/docs/KnownIssues.md +0 -19
  410. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-actions.h +0 -1262
  411. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-cardinalities.h +0 -147
  412. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h +0 -2571
  413. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +0 -833
  414. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +0 -1379
  415. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +0 -347
  416. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h +0 -2258
  417. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +0 -675
  418. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +0 -458
  419. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +0 -178
  420. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h +0 -5255
  421. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-actions.h +0 -246
  422. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h +0 -91
  423. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h +0 -1918
  424. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock.h +0 -95
  425. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +0 -8
  426. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +0 -10
  427. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h +0 -38
  428. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-port.h +0 -46
  429. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +0 -286
  430. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump +0 -136
  431. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h +0 -574
  432. package/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h +0 -87
  433. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.sln +0 -32
  434. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.vcproj +0 -191
  435. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_config.vsprops +0 -15
  436. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_main.vcproj +0 -187
  437. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_test.vcproj +0 -201
  438. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.sln +0 -46
  439. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.vcxproj +0 -145
  440. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_config.props +0 -19
  441. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_main.vcxproj +0 -151
  442. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_test.vcxproj +0 -176
  443. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.sln +0 -46
  444. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.vcxproj +0 -145
  445. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_config.props +0 -19
  446. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_main.vcxproj +0 -151
  447. package/external/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_test.vcxproj +0 -176
  448. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/fuse_gmock_files.py +0 -240
  449. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/LICENSE +0 -203
  450. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README +0 -34
  451. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README.cppclean +0 -115
  452. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/__init__.py +0 -0
  453. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/ast.py +0 -1733
  454. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class.py +0 -227
  455. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class_test.py +0 -448
  456. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/keywords.py +0 -59
  457. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/tokenize.py +0 -287
  458. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/utils.py +0 -41
  459. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/generator/gmock_gen.py +0 -31
  460. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/gmock-config.in +0 -303
  461. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/gmock_doctor.py +0 -640
  462. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/upload.py +0 -1387
  463. package/external/rapidjson/thirdparty/gtest/googlemock/scripts/upload_gmock.py +0 -78
  464. package/external/rapidjson/thirdparty/gtest/googlemock/src/gmock-all.cc +0 -47
  465. package/external/rapidjson/thirdparty/gtest/googlemock/src/gmock-cardinalities.cc +0 -156
  466. package/external/rapidjson/thirdparty/gtest/googlemock/src/gmock-internal-utils.cc +0 -204
  467. package/external/rapidjson/thirdparty/gtest/googlemock/src/gmock-matchers.cc +0 -573
  468. package/external/rapidjson/thirdparty/gtest/googlemock/src/gmock-spec-builders.cc +0 -883
  469. package/external/rapidjson/thirdparty/gtest/googlemock/src/gmock.cc +0 -205
  470. package/external/rapidjson/thirdparty/gtest/googlemock/src/gmock_main.cc +0 -54
  471. package/external/rapidjson/thirdparty/gtest/googlemock/test/BUILD.bazel +0 -123
  472. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-actions_test.cc +0 -1575
  473. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-cardinalities_test.cc +0 -428
  474. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-actions_test.cc +0 -1230
  475. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-function-mockers_test.cc +0 -647
  476. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc +0 -129
  477. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc +0 -1341
  478. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-internal-utils_test.cc +0 -718
  479. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-matchers_test.cc +0 -6767
  480. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-more-actions_test.cc +0 -710
  481. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-nice-strict_test.cc +0 -511
  482. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-port_test.cc +0 -43
  483. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock-spec-builders_test.cc +0 -2771
  484. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_all_test.cc +0 -51
  485. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_ex_test.cc +0 -81
  486. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test.py +0 -108
  487. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test_.cc +0 -100
  488. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_link2_test.cc +0 -40
  489. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.cc +0 -40
  490. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.h +0 -691
  491. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test.py +0 -183
  492. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_.cc +0 -310
  493. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_golden.txt +0 -317
  494. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_stress_test.cc +0 -323
  495. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_test.cc +0 -262
  496. package/external/rapidjson/thirdparty/gtest/googlemock/test/gmock_test_utils.py +0 -110
  497. package/external/rapidjson/thirdparty/gtest/googletest/CHANGES +0 -157
  498. package/external/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt +0 -312
  499. package/external/rapidjson/thirdparty/gtest/googletest/CONTRIBUTORS +0 -37
  500. package/external/rapidjson/thirdparty/gtest/googletest/LICENSE +0 -28
  501. package/external/rapidjson/thirdparty/gtest/googletest/Makefile.am +0 -339
  502. package/external/rapidjson/thirdparty/gtest/googletest/README.md +0 -341
  503. package/external/rapidjson/thirdparty/gtest/googletest/cmake/gtest.pc.in +0 -9
  504. package/external/rapidjson/thirdparty/gtest/googletest/cmake/gtest_main.pc.in +0 -10
  505. package/external/rapidjson/thirdparty/gtest/googletest/cmake/internal_utils.cmake +0 -280
  506. package/external/rapidjson/thirdparty/gtest/googletest/codegear/gtest.cbproj +0 -138
  507. package/external/rapidjson/thirdparty/gtest/googletest/codegear/gtest.groupproj +0 -54
  508. package/external/rapidjson/thirdparty/gtest/googletest/codegear/gtest_all.cc +0 -38
  509. package/external/rapidjson/thirdparty/gtest/googletest/codegear/gtest_link.cc +0 -40
  510. package/external/rapidjson/thirdparty/gtest/googletest/codegear/gtest_main.cbproj +0 -82
  511. package/external/rapidjson/thirdparty/gtest/googletest/codegear/gtest_unittest.cbproj +0 -88
  512. package/external/rapidjson/thirdparty/gtest/googletest/configure.ac +0 -68
  513. package/external/rapidjson/thirdparty/gtest/googletest/docs/Pkgconfig.md +0 -146
  514. package/external/rapidjson/thirdparty/gtest/googletest/docs/PumpManual.md +0 -177
  515. package/external/rapidjson/thirdparty/gtest/googletest/docs/XcodeGuide.md +0 -93
  516. package/external/rapidjson/thirdparty/gtest/googletest/docs/advanced.md +0 -2416
  517. package/external/rapidjson/thirdparty/gtest/googletest/docs/faq.md +0 -1092
  518. package/external/rapidjson/thirdparty/gtest/googletest/docs/primer.md +0 -536
  519. package/external/rapidjson/thirdparty/gtest/googletest/docs/samples.md +0 -14
  520. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-death-test.h +0 -342
  521. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-message.h +0 -249
  522. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h +0 -1438
  523. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h.pump +0 -501
  524. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-printers.h +0 -1082
  525. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-spi.h +0 -231
  526. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-test-part.h +0 -179
  527. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h +0 -264
  528. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest.h +0 -2332
  529. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h +0 -357
  530. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_prod.h +0 -61
  531. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h +0 -70
  532. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-printers.h +0 -42
  533. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h +0 -45
  534. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h +0 -275
  535. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h +0 -205
  536. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h +0 -1277
  537. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-linked_ptr.h +0 -243
  538. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h +0 -5139
  539. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -279
  540. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h +0 -723
  541. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h +0 -100
  542. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h +0 -2687
  543. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h +0 -167
  544. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h +0 -1020
  545. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h.pump +0 -347
  546. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h +0 -3347
  547. package/external/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump +0 -313
  548. package/external/rapidjson/thirdparty/gtest/googletest/m4/acx_pthread.m4 +0 -363
  549. package/external/rapidjson/thirdparty/gtest/googletest/m4/gtest.m4 +0 -74
  550. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.sln +0 -55
  551. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj +0 -149
  552. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj.filters +0 -18
  553. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.sln +0 -55
  554. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj +0 -149
  555. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj.filters +0 -18
  556. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj +0 -154
  557. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj.filters +0 -18
  558. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj +0 -162
  559. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj.filters +0 -18
  560. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj +0 -199
  561. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters +0 -26
  562. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj +0 -191
  563. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters +0 -26
  564. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj +0 -188
  565. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters +0 -18
  566. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj +0 -180
  567. package/external/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj.filters +0 -18
  568. package/external/rapidjson/thirdparty/gtest/googletest/samples/prime_tables.h +0 -127
  569. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample1.cc +0 -68
  570. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample1.h +0 -43
  571. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample10_unittest.cc +0 -140
  572. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample1_unittest.cc +0 -154
  573. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample2.cc +0 -56
  574. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample2.h +0 -85
  575. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample2_unittest.cc +0 -110
  576. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample3-inl.h +0 -172
  577. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample3_unittest.cc +0 -152
  578. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample4.cc +0 -46
  579. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample4.h +0 -53
  580. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample4_unittest.cc +0 -49
  581. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample5_unittest.cc +0 -199
  582. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample6_unittest.cc +0 -225
  583. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample7_unittest.cc +0 -118
  584. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample8_unittest.cc +0 -174
  585. package/external/rapidjson/thirdparty/gtest/googletest/samples/sample9_unittest.cc +0 -157
  586. package/external/rapidjson/thirdparty/gtest/googletest/scripts/common.py +0 -83
  587. package/external/rapidjson/thirdparty/gtest/googletest/scripts/fuse_gtest_files.py +0 -253
  588. package/external/rapidjson/thirdparty/gtest/googletest/scripts/gen_gtest_pred_impl.py +0 -730
  589. package/external/rapidjson/thirdparty/gtest/googletest/scripts/gtest-config.in +0 -274
  590. package/external/rapidjson/thirdparty/gtest/googletest/scripts/pump.py +0 -855
  591. package/external/rapidjson/thirdparty/gtest/googletest/scripts/release_docs.py +0 -158
  592. package/external/rapidjson/thirdparty/gtest/googletest/scripts/upload.py +0 -1387
  593. package/external/rapidjson/thirdparty/gtest/googletest/scripts/upload_gtest.py +0 -78
  594. package/external/rapidjson/thirdparty/gtest/googletest/src/gtest-all.cc +0 -48
  595. package/external/rapidjson/thirdparty/gtest/googletest/src/gtest-death-test.cc +0 -1536
  596. package/external/rapidjson/thirdparty/gtest/googletest/src/gtest-filepath.cc +0 -385
  597. package/external/rapidjson/thirdparty/gtest/googletest/src/gtest-internal-inl.h +0 -1175
  598. package/external/rapidjson/thirdparty/gtest/googletest/src/gtest-port.cc +0 -1277
  599. package/external/rapidjson/thirdparty/gtest/googletest/src/gtest-printers.cc +0 -458
  600. package/external/rapidjson/thirdparty/gtest/googletest/src/gtest-test-part.cc +0 -102
  601. package/external/rapidjson/thirdparty/gtest/googletest/src/gtest-typed-test.cc +0 -119
  602. package/external/rapidjson/thirdparty/gtest/googletest/src/gtest.cc +0 -5846
  603. package/external/rapidjson/thirdparty/gtest/googletest/src/gtest_main.cc +0 -38
  604. package/external/rapidjson/thirdparty/gtest/googletest/test/BUILD.bazel +0 -396
  605. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_ex_test.cc +0 -93
  606. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_test.cc +0 -1424
  607. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-filepath_test.cc +0 -652
  608. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-linked_ptr_test.cc +0 -154
  609. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-listener_test.cc +0 -311
  610. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-message_test.cc +0 -159
  611. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-options_test.cc +0 -213
  612. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test2_test.cc +0 -61
  613. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.cc +0 -1110
  614. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.h +0 -53
  615. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-port_test.cc +0 -1303
  616. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-printers_test.cc +0 -1737
  617. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-test-part_test.cc +0 -208
  618. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-tuple_test.cc +0 -320
  619. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test2_test.cc +0 -45
  620. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.cc +0 -380
  621. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.h +0 -66
  622. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest-unittest-api_test.cc +0 -341
  623. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_all_test.cc +0 -47
  624. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_assert_by_exception_test.cc +0 -119
  625. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest.py +0 -210
  626. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest_.cc +0 -87
  627. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test.py +0 -235
  628. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test_.cc +0 -311
  629. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test.py +0 -129
  630. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test_.cc +0 -63
  631. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test.py +0 -119
  632. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test_.cc +0 -124
  633. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_environment_test.cc +0 -189
  634. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest.py +0 -638
  635. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest_.cc +0 -138
  636. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test.py +0 -172
  637. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test_.cc +0 -46
  638. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_json_outfiles_test.py +0 -162
  639. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_json_output_unittest.py +0 -611
  640. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_json_test_utils.py +0 -60
  641. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest.py +0 -207
  642. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest_.cc +0 -157
  643. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_main_unittest.cc +0 -45
  644. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_no_test_unittest.cc +0 -56
  645. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test.py +0 -344
  646. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_.cc +0 -1067
  647. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_golden_lin.txt +0 -781
  648. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_pred_impl_unittest.cc +0 -2427
  649. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_premature_exit_test.cc +0 -127
  650. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_prod_test.cc +0 -57
  651. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_repeat_test.cc +0 -236
  652. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test.py +0 -325
  653. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test_.cc +0 -103
  654. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_sole_header_test.cc +0 -57
  655. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_stress_test.cc +0 -250
  656. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_test_utils.py +0 -318
  657. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test.py +0 -65
  658. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test_.cc +0 -44
  659. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_ex_test.cc +0 -92
  660. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test.py +0 -171
  661. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test_.cc +0 -72
  662. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test.py +0 -69
  663. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test_.cc +0 -43
  664. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_unittest.cc +0 -7797
  665. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile1_test_.cc +0 -48
  666. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile2_test_.cc +0 -48
  667. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfiles_test.py +0 -140
  668. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest.py +0 -378
  669. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest_.cc +0 -179
  670. package/external/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_test_utils.py +0 -196
  671. package/external/rapidjson/thirdparty/gtest/googletest/test/production.cc +0 -36
  672. package/external/rapidjson/thirdparty/gtest/googletest/test/production.h +0 -55
  673. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Config/DebugProject.xcconfig +0 -30
  674. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Config/FrameworkTarget.xcconfig +0 -17
  675. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Config/General.xcconfig +0 -41
  676. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Config/ReleaseProject.xcconfig +0 -32
  677. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Config/StaticLibraryTarget.xcconfig +0 -18
  678. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Config/TestTarget.xcconfig +0 -8
  679. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Resources/Info.plist +0 -30
  680. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/Info.plist +0 -28
  681. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj +0 -457
  682. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/runtests.sh +0 -62
  683. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.cc +0 -63
  684. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.h +0 -59
  685. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget_test.cc +0 -68
  686. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/runtests.sh +0 -65
  687. package/external/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/versiongenerate.py +0 -100
  688. package/external/rapidjson/thirdparty/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj +0 -1182
  689. package/external/rapidjson/travis-doxygen.sh +0 -121
  690. package/include/.clang-format +0 -76
  691. package/include/eosio/abi.hpp +0 -286
  692. package/include/eosio/asset.hpp +0 -458
  693. package/include/eosio/bytes.hpp +0 -27
  694. package/include/eosio/chain_conversions.hpp +0 -450
  695. package/include/eosio/chain_types.hpp +0 -14
  696. package/include/eosio/check.hpp +0 -178
  697. package/include/eosio/convert.hpp +0 -95
  698. package/include/eosio/crypto.hpp +0 -147
  699. package/include/eosio/eosio_outcome.hpp +0 -41
  700. package/include/eosio/fixed_bytes.hpp +0 -246
  701. package/include/eosio/float.hpp +0 -35
  702. package/include/eosio/for_each_field.hpp +0 -48
  703. package/include/eosio/fpconv.c +0 -336
  704. package/include/eosio/fpconv.h +0 -41
  705. package/include/eosio/fpconv.license +0 -23
  706. package/include/eosio/from_bin.hpp +0 -272
  707. package/include/eosio/from_json.hpp +0 -737
  708. package/include/eosio/from_string.hpp +0 -28
  709. package/include/eosio/map_macro.h +0 -64
  710. package/include/eosio/murmur.hpp +0 -55
  711. package/include/eosio/name.hpp +0 -174
  712. package/include/eosio/opaque.hpp +0 -108
  713. package/include/eosio/operators.hpp +0 -71
  714. package/include/eosio/powers.h +0 -76
  715. package/include/eosio/reflection.hpp +0 -61
  716. package/include/eosio/ship_protocol.hpp +0 -850
  717. package/include/eosio/stream.hpp +0 -231
  718. package/include/eosio/symbol.hpp +0 -300
  719. package/include/eosio/time.hpp +0 -264
  720. package/include/eosio/to_bin.hpp +0 -189
  721. package/include/eosio/to_json.hpp +0 -279
  722. package/include/eosio/to_key.hpp +0 -298
  723. package/include/eosio/types.hpp +0 -97
  724. package/include/eosio/varint.hpp +0 -452
  725. package/include/outcome-basic.hpp +0 -6836
  726. package/src/abi.cpp +0 -297
  727. package/src/abieos.cpp +0 -263
  728. package/src/abieos.h +0 -76
  729. package/src/abieos.hpp +0 -1010
  730. package/src/abieos_exception.hpp +0 -89
  731. package/src/abieos_numeric.hpp +0 -94
  732. package/src/abieos_ripemd160.hpp +0 -417
  733. package/src/crypto.cpp +0 -215
  734. package/src/key_test.cpp +0 -218
  735. package/src/main.cpp +0 -242
  736. package/src/reflect_test.cpp +0 -28
  737. package/src/template_test.cpp +0 -240
  738. package/src/test.cpp +0 -940
  739. package/tools/CMakeLists.txt +0 -9
  740. package/tools/name.cpp +0 -86
@@ -1,1918 +0,0 @@
1
- // Copyright 2007, 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
- // Google Mock - a framework for writing C++ mock classes.
33
- //
34
- // This file implements the ON_CALL() and EXPECT_CALL() macros.
35
- //
36
- // A user can use the ON_CALL() macro to specify the default action of
37
- // a mock method. The syntax is:
38
- //
39
- // ON_CALL(mock_object, Method(argument-matchers))
40
- // .With(multi-argument-matcher)
41
- // .WillByDefault(action);
42
- //
43
- // where the .With() clause is optional.
44
- //
45
- // A user can use the EXPECT_CALL() macro to specify an expectation on
46
- // a mock method. The syntax is:
47
- //
48
- // EXPECT_CALL(mock_object, Method(argument-matchers))
49
- // .With(multi-argument-matchers)
50
- // .Times(cardinality)
51
- // .InSequence(sequences)
52
- // .After(expectations)
53
- // .WillOnce(action)
54
- // .WillRepeatedly(action)
55
- // .RetiresOnSaturation();
56
- //
57
- // where all clauses are optional, and .InSequence()/.After()/
58
- // .WillOnce() can appear any number of times.
59
-
60
- #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
61
- #define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
62
-
63
- #include <map>
64
- #include <set>
65
- #include <sstream>
66
- #include <string>
67
- #include <vector>
68
- #include "gmock/gmock-actions.h"
69
- #include "gmock/gmock-cardinalities.h"
70
- #include "gmock/gmock-matchers.h"
71
- #include "gmock/internal/gmock-internal-utils.h"
72
- #include "gmock/internal/gmock-port.h"
73
- #include "gtest/gtest.h"
74
-
75
- #if GTEST_HAS_EXCEPTIONS
76
- # include <stdexcept> // NOLINT
77
- #endif
78
-
79
- namespace testing {
80
-
81
- // An abstract handle of an expectation.
82
- class Expectation;
83
-
84
- // A set of expectation handles.
85
- class ExpectationSet;
86
-
87
- // Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
88
- // and MUST NOT BE USED IN USER CODE!!!
89
- namespace internal {
90
-
91
- // Implements a mock function.
92
- template <typename F> class FunctionMocker;
93
-
94
- // Base class for expectations.
95
- class ExpectationBase;
96
-
97
- // Implements an expectation.
98
- template <typename F> class TypedExpectation;
99
-
100
- // Helper class for testing the Expectation class template.
101
- class ExpectationTester;
102
-
103
- // Base class for function mockers.
104
- template <typename F> class FunctionMockerBase;
105
-
106
- // Protects the mock object registry (in class Mock), all function
107
- // mockers, and all expectations.
108
- //
109
- // The reason we don't use more fine-grained protection is: when a
110
- // mock function Foo() is called, it needs to consult its expectations
111
- // to see which one should be picked. If another thread is allowed to
112
- // call a mock function (either Foo() or a different one) at the same
113
- // time, it could affect the "retired" attributes of Foo()'s
114
- // expectations when InSequence() is used, and thus affect which
115
- // expectation gets picked. Therefore, we sequence all mock function
116
- // calls to ensure the integrity of the mock objects' states.
117
- GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex);
118
-
119
- // Untyped base class for ActionResultHolder<R>.
120
- class UntypedActionResultHolderBase;
121
-
122
- // Abstract base class of FunctionMockerBase. This is the
123
- // type-agnostic part of the function mocker interface. Its pure
124
- // virtual methods are implemented by FunctionMockerBase.
125
- class GTEST_API_ UntypedFunctionMockerBase {
126
- public:
127
- UntypedFunctionMockerBase();
128
- virtual ~UntypedFunctionMockerBase();
129
-
130
- // Verifies that all expectations on this mock function have been
131
- // satisfied. Reports one or more Google Test non-fatal failures
132
- // and returns false if not.
133
- bool VerifyAndClearExpectationsLocked()
134
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
135
-
136
- // Clears the ON_CALL()s set on this mock function.
137
- virtual void ClearDefaultActionsLocked()
138
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) = 0;
139
-
140
- // In all of the following Untyped* functions, it's the caller's
141
- // responsibility to guarantee the correctness of the arguments'
142
- // types.
143
-
144
- // Performs the default action with the given arguments and returns
145
- // the action's result. The call description string will be used in
146
- // the error message to describe the call in the case the default
147
- // action fails.
148
- // L = *
149
- virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
150
- void* untyped_args, const std::string& call_description) const = 0;
151
-
152
- // Performs the given action with the given arguments and returns
153
- // the action's result.
154
- // L = *
155
- virtual UntypedActionResultHolderBase* UntypedPerformAction(
156
- const void* untyped_action, void* untyped_args) const = 0;
157
-
158
- // Writes a message that the call is uninteresting (i.e. neither
159
- // explicitly expected nor explicitly unexpected) to the given
160
- // ostream.
161
- virtual void UntypedDescribeUninterestingCall(
162
- const void* untyped_args,
163
- ::std::ostream* os) const
164
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0;
165
-
166
- // Returns the expectation that matches the given function arguments
167
- // (or NULL is there's no match); when a match is found,
168
- // untyped_action is set to point to the action that should be
169
- // performed (or NULL if the action is "do default"), and
170
- // is_excessive is modified to indicate whether the call exceeds the
171
- // expected number.
172
- virtual const ExpectationBase* UntypedFindMatchingExpectation(
173
- const void* untyped_args,
174
- const void** untyped_action, bool* is_excessive,
175
- ::std::ostream* what, ::std::ostream* why)
176
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0;
177
-
178
- // Prints the given function arguments to the ostream.
179
- virtual void UntypedPrintArgs(const void* untyped_args,
180
- ::std::ostream* os) const = 0;
181
-
182
- // Sets the mock object this mock method belongs to, and registers
183
- // this information in the global mock registry. Will be called
184
- // whenever an EXPECT_CALL() or ON_CALL() is executed on this mock
185
- // method.
186
- // TODO(wan@google.com): rename to SetAndRegisterOwner().
187
- void RegisterOwner(const void* mock_obj)
188
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
189
-
190
- // Sets the mock object this mock method belongs to, and sets the
191
- // name of the mock function. Will be called upon each invocation
192
- // of this mock function.
193
- void SetOwnerAndName(const void* mock_obj, const char* name)
194
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
195
-
196
- // Returns the mock object this mock method belongs to. Must be
197
- // called after RegisterOwner() or SetOwnerAndName() has been
198
- // called.
199
- const void* MockObject() const
200
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
201
-
202
- // Returns the name of this mock method. Must be called after
203
- // SetOwnerAndName() has been called.
204
- const char* Name() const
205
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
206
-
207
- // Returns the result of invoking this mock function with the given
208
- // arguments. This function can be safely called from multiple
209
- // threads concurrently. The caller is responsible for deleting the
210
- // result.
211
- UntypedActionResultHolderBase* UntypedInvokeWith(void* untyped_args)
212
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
213
-
214
- protected:
215
- typedef std::vector<const void*> UntypedOnCallSpecs;
216
-
217
- typedef std::vector<internal::linked_ptr<ExpectationBase> >
218
- UntypedExpectations;
219
-
220
- // Returns an Expectation object that references and co-owns exp,
221
- // which must be an expectation on this mock function.
222
- Expectation GetHandleOf(ExpectationBase* exp);
223
-
224
- // Address of the mock object this mock method belongs to. Only
225
- // valid after this mock method has been called or
226
- // ON_CALL/EXPECT_CALL has been invoked on it.
227
- const void* mock_obj_; // Protected by g_gmock_mutex.
228
-
229
- // Name of the function being mocked. Only valid after this mock
230
- // method has been called.
231
- const char* name_; // Protected by g_gmock_mutex.
232
-
233
- // All default action specs for this function mocker.
234
- UntypedOnCallSpecs untyped_on_call_specs_;
235
-
236
- // All expectations for this function mocker.
237
- //
238
- // It's undefined behavior to interleave expectations (EXPECT_CALLs
239
- // or ON_CALLs) and mock function calls. Also, the order of
240
- // expectations is important. Therefore it's a logic race condition
241
- // to read/write untyped_expectations_ concurrently. In order for
242
- // tools like tsan to catch concurrent read/write accesses to
243
- // untyped_expectations, we deliberately leave accesses to it
244
- // unprotected.
245
- UntypedExpectations untyped_expectations_;
246
- }; // class UntypedFunctionMockerBase
247
-
248
- // Untyped base class for OnCallSpec<F>.
249
- class UntypedOnCallSpecBase {
250
- public:
251
- // The arguments are the location of the ON_CALL() statement.
252
- UntypedOnCallSpecBase(const char* a_file, int a_line)
253
- : file_(a_file), line_(a_line), last_clause_(kNone) {}
254
-
255
- // Where in the source file was the default action spec defined?
256
- const char* file() const { return file_; }
257
- int line() const { return line_; }
258
-
259
- protected:
260
- // Gives each clause in the ON_CALL() statement a name.
261
- enum Clause {
262
- // Do not change the order of the enum members! The run-time
263
- // syntax checking relies on it.
264
- kNone,
265
- kWith,
266
- kWillByDefault
267
- };
268
-
269
- // Asserts that the ON_CALL() statement has a certain property.
270
- void AssertSpecProperty(bool property,
271
- const std::string& failure_message) const {
272
- Assert(property, file_, line_, failure_message);
273
- }
274
-
275
- // Expects that the ON_CALL() statement has a certain property.
276
- void ExpectSpecProperty(bool property,
277
- const std::string& failure_message) const {
278
- Expect(property, file_, line_, failure_message);
279
- }
280
-
281
- const char* file_;
282
- int line_;
283
-
284
- // The last clause in the ON_CALL() statement as seen so far.
285
- // Initially kNone and changes as the statement is parsed.
286
- Clause last_clause_;
287
- }; // class UntypedOnCallSpecBase
288
-
289
- // This template class implements an ON_CALL spec.
290
- template <typename F>
291
- class OnCallSpec : public UntypedOnCallSpecBase {
292
- public:
293
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
294
- typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
295
-
296
- // Constructs an OnCallSpec object from the information inside
297
- // the parenthesis of an ON_CALL() statement.
298
- OnCallSpec(const char* a_file, int a_line,
299
- const ArgumentMatcherTuple& matchers)
300
- : UntypedOnCallSpecBase(a_file, a_line),
301
- matchers_(matchers),
302
- // By default, extra_matcher_ should match anything. However,
303
- // we cannot initialize it with _ as that triggers a compiler
304
- // bug in Symbian's C++ compiler (cannot decide between two
305
- // overloaded constructors of Matcher<const ArgumentTuple&>).
306
- extra_matcher_(A<const ArgumentTuple&>()) {
307
- }
308
-
309
- // Implements the .With() clause.
310
- OnCallSpec& With(const Matcher<const ArgumentTuple&>& m) {
311
- // Makes sure this is called at most once.
312
- ExpectSpecProperty(last_clause_ < kWith,
313
- ".With() cannot appear "
314
- "more than once in an ON_CALL().");
315
- last_clause_ = kWith;
316
-
317
- extra_matcher_ = m;
318
- return *this;
319
- }
320
-
321
- // Implements the .WillByDefault() clause.
322
- OnCallSpec& WillByDefault(const Action<F>& action) {
323
- ExpectSpecProperty(last_clause_ < kWillByDefault,
324
- ".WillByDefault() must appear "
325
- "exactly once in an ON_CALL().");
326
- last_clause_ = kWillByDefault;
327
-
328
- ExpectSpecProperty(!action.IsDoDefault(),
329
- "DoDefault() cannot be used in ON_CALL().");
330
- action_ = action;
331
- return *this;
332
- }
333
-
334
- // Returns true iff the given arguments match the matchers.
335
- bool Matches(const ArgumentTuple& args) const {
336
- return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
337
- }
338
-
339
- // Returns the action specified by the user.
340
- const Action<F>& GetAction() const {
341
- AssertSpecProperty(last_clause_ == kWillByDefault,
342
- ".WillByDefault() must appear exactly "
343
- "once in an ON_CALL().");
344
- return action_;
345
- }
346
-
347
- private:
348
- // The information in statement
349
- //
350
- // ON_CALL(mock_object, Method(matchers))
351
- // .With(multi-argument-matcher)
352
- // .WillByDefault(action);
353
- //
354
- // is recorded in the data members like this:
355
- //
356
- // source file that contains the statement => file_
357
- // line number of the statement => line_
358
- // matchers => matchers_
359
- // multi-argument-matcher => extra_matcher_
360
- // action => action_
361
- ArgumentMatcherTuple matchers_;
362
- Matcher<const ArgumentTuple&> extra_matcher_;
363
- Action<F> action_;
364
- }; // class OnCallSpec
365
-
366
- // Possible reactions on uninteresting calls.
367
- enum CallReaction {
368
- kAllow,
369
- kWarn,
370
- kFail,
371
- };
372
-
373
- } // namespace internal
374
-
375
- // Utilities for manipulating mock objects.
376
- class GTEST_API_ Mock {
377
- public:
378
- // The following public methods can be called concurrently.
379
-
380
- // Tells Google Mock to ignore mock_obj when checking for leaked
381
- // mock objects.
382
- static void AllowLeak(const void* mock_obj)
383
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
384
-
385
- // Verifies and clears all expectations on the given mock object.
386
- // If the expectations aren't satisfied, generates one or more
387
- // Google Test non-fatal failures and returns false.
388
- static bool VerifyAndClearExpectations(void* mock_obj)
389
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
390
-
391
- // Verifies all expectations on the given mock object and clears its
392
- // default actions and expectations. Returns true iff the
393
- // verification was successful.
394
- static bool VerifyAndClear(void* mock_obj)
395
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
396
-
397
- private:
398
- friend class internal::UntypedFunctionMockerBase;
399
-
400
- // Needed for a function mocker to register itself (so that we know
401
- // how to clear a mock object).
402
- template <typename F>
403
- friend class internal::FunctionMockerBase;
404
-
405
- template <typename M>
406
- friend class NiceMock;
407
-
408
- template <typename M>
409
- friend class NaggyMock;
410
-
411
- template <typename M>
412
- friend class StrictMock;
413
-
414
- // Tells Google Mock to allow uninteresting calls on the given mock
415
- // object.
416
- static void AllowUninterestingCalls(const void* mock_obj)
417
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
418
-
419
- // Tells Google Mock to warn the user about uninteresting calls on
420
- // the given mock object.
421
- static void WarnUninterestingCalls(const void* mock_obj)
422
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
423
-
424
- // Tells Google Mock to fail uninteresting calls on the given mock
425
- // object.
426
- static void FailUninterestingCalls(const void* mock_obj)
427
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
428
-
429
- // Tells Google Mock the given mock object is being destroyed and
430
- // its entry in the call-reaction table should be removed.
431
- static void UnregisterCallReaction(const void* mock_obj)
432
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
433
-
434
- // Returns the reaction Google Mock will have on uninteresting calls
435
- // made on the given mock object.
436
- static internal::CallReaction GetReactionOnUninterestingCalls(
437
- const void* mock_obj)
438
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
439
-
440
- // Verifies that all expectations on the given mock object have been
441
- // satisfied. Reports one or more Google Test non-fatal failures
442
- // and returns false if not.
443
- static bool VerifyAndClearExpectationsLocked(void* mock_obj)
444
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
445
-
446
- // Clears all ON_CALL()s set on the given mock object.
447
- static void ClearDefaultActionsLocked(void* mock_obj)
448
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
449
-
450
- // Registers a mock object and a mock method it owns.
451
- static void Register(
452
- const void* mock_obj,
453
- internal::UntypedFunctionMockerBase* mocker)
454
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
455
-
456
- // Tells Google Mock where in the source code mock_obj is used in an
457
- // ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this
458
- // information helps the user identify which object it is.
459
- static void RegisterUseByOnCallOrExpectCall(
460
- const void* mock_obj, const char* file, int line)
461
- GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
462
-
463
- // Unregisters a mock method; removes the owning mock object from
464
- // the registry when the last mock method associated with it has
465
- // been unregistered. This is called only in the destructor of
466
- // FunctionMockerBase.
467
- static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker)
468
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
469
- }; // class Mock
470
-
471
- // An abstract handle of an expectation. Useful in the .After()
472
- // clause of EXPECT_CALL() for setting the (partial) order of
473
- // expectations. The syntax:
474
- //
475
- // Expectation e1 = EXPECT_CALL(...)...;
476
- // EXPECT_CALL(...).After(e1)...;
477
- //
478
- // sets two expectations where the latter can only be matched after
479
- // the former has been satisfied.
480
- //
481
- // Notes:
482
- // - This class is copyable and has value semantics.
483
- // - Constness is shallow: a const Expectation object itself cannot
484
- // be modified, but the mutable methods of the ExpectationBase
485
- // object it references can be called via expectation_base().
486
- // - The constructors and destructor are defined out-of-line because
487
- // the Symbian WINSCW compiler wants to otherwise instantiate them
488
- // when it sees this class definition, at which point it doesn't have
489
- // ExpectationBase available yet, leading to incorrect destruction
490
- // in the linked_ptr (or compilation errors if using a checking
491
- // linked_ptr).
492
- class GTEST_API_ Expectation {
493
- public:
494
- // Constructs a null object that doesn't reference any expectation.
495
- Expectation();
496
-
497
- ~Expectation();
498
-
499
- // This single-argument ctor must not be explicit, in order to support the
500
- // Expectation e = EXPECT_CALL(...);
501
- // syntax.
502
- //
503
- // A TypedExpectation object stores its pre-requisites as
504
- // Expectation objects, and needs to call the non-const Retire()
505
- // method on the ExpectationBase objects they reference. Therefore
506
- // Expectation must receive a *non-const* reference to the
507
- // ExpectationBase object.
508
- Expectation(internal::ExpectationBase& exp); // NOLINT
509
-
510
- // The compiler-generated copy ctor and operator= work exactly as
511
- // intended, so we don't need to define our own.
512
-
513
- // Returns true iff rhs references the same expectation as this object does.
514
- bool operator==(const Expectation& rhs) const {
515
- return expectation_base_ == rhs.expectation_base_;
516
- }
517
-
518
- bool operator!=(const Expectation& rhs) const { return !(*this == rhs); }
519
-
520
- private:
521
- friend class ExpectationSet;
522
- friend class Sequence;
523
- friend class ::testing::internal::ExpectationBase;
524
- friend class ::testing::internal::UntypedFunctionMockerBase;
525
-
526
- template <typename F>
527
- friend class ::testing::internal::FunctionMockerBase;
528
-
529
- template <typename F>
530
- friend class ::testing::internal::TypedExpectation;
531
-
532
- // This comparator is needed for putting Expectation objects into a set.
533
- class Less {
534
- public:
535
- bool operator()(const Expectation& lhs, const Expectation& rhs) const {
536
- return lhs.expectation_base_.get() < rhs.expectation_base_.get();
537
- }
538
- };
539
-
540
- typedef ::std::set<Expectation, Less> Set;
541
-
542
- Expectation(
543
- const internal::linked_ptr<internal::ExpectationBase>& expectation_base);
544
-
545
- // Returns the expectation this object references.
546
- const internal::linked_ptr<internal::ExpectationBase>&
547
- expectation_base() const {
548
- return expectation_base_;
549
- }
550
-
551
- // A linked_ptr that co-owns the expectation this handle references.
552
- internal::linked_ptr<internal::ExpectationBase> expectation_base_;
553
- };
554
-
555
- // A set of expectation handles. Useful in the .After() clause of
556
- // EXPECT_CALL() for setting the (partial) order of expectations. The
557
- // syntax:
558
- //
559
- // ExpectationSet es;
560
- // es += EXPECT_CALL(...)...;
561
- // es += EXPECT_CALL(...)...;
562
- // EXPECT_CALL(...).After(es)...;
563
- //
564
- // sets three expectations where the last one can only be matched
565
- // after the first two have both been satisfied.
566
- //
567
- // This class is copyable and has value semantics.
568
- class ExpectationSet {
569
- public:
570
- // A bidirectional iterator that can read a const element in the set.
571
- typedef Expectation::Set::const_iterator const_iterator;
572
-
573
- // An object stored in the set. This is an alias of Expectation.
574
- typedef Expectation::Set::value_type value_type;
575
-
576
- // Constructs an empty set.
577
- ExpectationSet() {}
578
-
579
- // This single-argument ctor must not be explicit, in order to support the
580
- // ExpectationSet es = EXPECT_CALL(...);
581
- // syntax.
582
- ExpectationSet(internal::ExpectationBase& exp) { // NOLINT
583
- *this += Expectation(exp);
584
- }
585
-
586
- // This single-argument ctor implements implicit conversion from
587
- // Expectation and thus must not be explicit. This allows either an
588
- // Expectation or an ExpectationSet to be used in .After().
589
- ExpectationSet(const Expectation& e) { // NOLINT
590
- *this += e;
591
- }
592
-
593
- // The compiler-generator ctor and operator= works exactly as
594
- // intended, so we don't need to define our own.
595
-
596
- // Returns true iff rhs contains the same set of Expectation objects
597
- // as this does.
598
- bool operator==(const ExpectationSet& rhs) const {
599
- return expectations_ == rhs.expectations_;
600
- }
601
-
602
- bool operator!=(const ExpectationSet& rhs) const { return !(*this == rhs); }
603
-
604
- // Implements the syntax
605
- // expectation_set += EXPECT_CALL(...);
606
- ExpectationSet& operator+=(const Expectation& e) {
607
- expectations_.insert(e);
608
- return *this;
609
- }
610
-
611
- int size() const { return static_cast<int>(expectations_.size()); }
612
-
613
- const_iterator begin() const { return expectations_.begin(); }
614
- const_iterator end() const { return expectations_.end(); }
615
-
616
- private:
617
- Expectation::Set expectations_;
618
- };
619
-
620
-
621
- // Sequence objects are used by a user to specify the relative order
622
- // in which the expectations should match. They are copyable (we rely
623
- // on the compiler-defined copy constructor and assignment operator).
624
- class GTEST_API_ Sequence {
625
- public:
626
- // Constructs an empty sequence.
627
- Sequence() : last_expectation_(new Expectation) {}
628
-
629
- // Adds an expectation to this sequence. The caller must ensure
630
- // that no other thread is accessing this Sequence object.
631
- void AddExpectation(const Expectation& expectation) const;
632
-
633
- private:
634
- // The last expectation in this sequence. We use a linked_ptr here
635
- // because Sequence objects are copyable and we want the copies to
636
- // be aliases. The linked_ptr allows the copies to co-own and share
637
- // the same Expectation object.
638
- internal::linked_ptr<Expectation> last_expectation_;
639
- }; // class Sequence
640
-
641
- // An object of this type causes all EXPECT_CALL() statements
642
- // encountered in its scope to be put in an anonymous sequence. The
643
- // work is done in the constructor and destructor. You should only
644
- // create an InSequence object on the stack.
645
- //
646
- // The sole purpose for this class is to support easy definition of
647
- // sequential expectations, e.g.
648
- //
649
- // {
650
- // InSequence dummy; // The name of the object doesn't matter.
651
- //
652
- // // The following expectations must match in the order they appear.
653
- // EXPECT_CALL(a, Bar())...;
654
- // EXPECT_CALL(a, Baz())...;
655
- // ...
656
- // EXPECT_CALL(b, Xyz())...;
657
- // }
658
- //
659
- // You can create InSequence objects in multiple threads, as long as
660
- // they are used to affect different mock objects. The idea is that
661
- // each thread can create and set up its own mocks as if it's the only
662
- // thread. However, for clarity of your tests we recommend you to set
663
- // up mocks in the main thread unless you have a good reason not to do
664
- // so.
665
- class GTEST_API_ InSequence {
666
- public:
667
- InSequence();
668
- ~InSequence();
669
- private:
670
- bool sequence_created_;
671
-
672
- GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT
673
- } GTEST_ATTRIBUTE_UNUSED_;
674
-
675
- namespace internal {
676
-
677
- // Points to the implicit sequence introduced by a living InSequence
678
- // object (if any) in the current thread or NULL.
679
- GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
680
-
681
- // Base class for implementing expectations.
682
- //
683
- // There are two reasons for having a type-agnostic base class for
684
- // Expectation:
685
- //
686
- // 1. We need to store collections of expectations of different
687
- // types (e.g. all pre-requisites of a particular expectation, all
688
- // expectations in a sequence). Therefore these expectation objects
689
- // must share a common base class.
690
- //
691
- // 2. We can avoid binary code bloat by moving methods not depending
692
- // on the template argument of Expectation to the base class.
693
- //
694
- // This class is internal and mustn't be used by user code directly.
695
- class GTEST_API_ ExpectationBase {
696
- public:
697
- // source_text is the EXPECT_CALL(...) source that created this Expectation.
698
- ExpectationBase(const char* file, int line, const std::string& source_text);
699
-
700
- virtual ~ExpectationBase();
701
-
702
- // Where in the source file was the expectation spec defined?
703
- const char* file() const { return file_; }
704
- int line() const { return line_; }
705
- const char* source_text() const { return source_text_.c_str(); }
706
- // Returns the cardinality specified in the expectation spec.
707
- const Cardinality& cardinality() const { return cardinality_; }
708
-
709
- // Describes the source file location of this expectation.
710
- void DescribeLocationTo(::std::ostream* os) const {
711
- *os << FormatFileLocation(file(), line()) << " ";
712
- }
713
-
714
- // Describes how many times a function call matching this
715
- // expectation has occurred.
716
- void DescribeCallCountTo(::std::ostream* os) const
717
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
718
-
719
- // If this mock method has an extra matcher (i.e. .With(matcher)),
720
- // describes it to the ostream.
721
- virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) = 0;
722
-
723
- protected:
724
- friend class ::testing::Expectation;
725
- friend class UntypedFunctionMockerBase;
726
-
727
- enum Clause {
728
- // Don't change the order of the enum members!
729
- kNone,
730
- kWith,
731
- kTimes,
732
- kInSequence,
733
- kAfter,
734
- kWillOnce,
735
- kWillRepeatedly,
736
- kRetiresOnSaturation
737
- };
738
-
739
- typedef std::vector<const void*> UntypedActions;
740
-
741
- // Returns an Expectation object that references and co-owns this
742
- // expectation.
743
- virtual Expectation GetHandle() = 0;
744
-
745
- // Asserts that the EXPECT_CALL() statement has the given property.
746
- void AssertSpecProperty(bool property,
747
- const std::string& failure_message) const {
748
- Assert(property, file_, line_, failure_message);
749
- }
750
-
751
- // Expects that the EXPECT_CALL() statement has the given property.
752
- void ExpectSpecProperty(bool property,
753
- const std::string& failure_message) const {
754
- Expect(property, file_, line_, failure_message);
755
- }
756
-
757
- // Explicitly specifies the cardinality of this expectation. Used
758
- // by the subclasses to implement the .Times() clause.
759
- void SpecifyCardinality(const Cardinality& cardinality);
760
-
761
- // Returns true iff the user specified the cardinality explicitly
762
- // using a .Times().
763
- bool cardinality_specified() const { return cardinality_specified_; }
764
-
765
- // Sets the cardinality of this expectation spec.
766
- void set_cardinality(const Cardinality& a_cardinality) {
767
- cardinality_ = a_cardinality;
768
- }
769
-
770
- // The following group of methods should only be called after the
771
- // EXPECT_CALL() statement, and only when g_gmock_mutex is held by
772
- // the current thread.
773
-
774
- // Retires all pre-requisites of this expectation.
775
- void RetireAllPreRequisites()
776
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
777
-
778
- // Returns true iff this expectation is retired.
779
- bool is_retired() const
780
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
781
- g_gmock_mutex.AssertHeld();
782
- return retired_;
783
- }
784
-
785
- // Retires this expectation.
786
- void Retire()
787
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
788
- g_gmock_mutex.AssertHeld();
789
- retired_ = true;
790
- }
791
-
792
- // Returns true iff this expectation is satisfied.
793
- bool IsSatisfied() const
794
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
795
- g_gmock_mutex.AssertHeld();
796
- return cardinality().IsSatisfiedByCallCount(call_count_);
797
- }
798
-
799
- // Returns true iff this expectation is saturated.
800
- bool IsSaturated() const
801
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
802
- g_gmock_mutex.AssertHeld();
803
- return cardinality().IsSaturatedByCallCount(call_count_);
804
- }
805
-
806
- // Returns true iff this expectation is over-saturated.
807
- bool IsOverSaturated() const
808
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
809
- g_gmock_mutex.AssertHeld();
810
- return cardinality().IsOverSaturatedByCallCount(call_count_);
811
- }
812
-
813
- // Returns true iff all pre-requisites of this expectation are satisfied.
814
- bool AllPrerequisitesAreSatisfied() const
815
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
816
-
817
- // Adds unsatisfied pre-requisites of this expectation to 'result'.
818
- void FindUnsatisfiedPrerequisites(ExpectationSet* result) const
819
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
820
-
821
- // Returns the number this expectation has been invoked.
822
- int call_count() const
823
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
824
- g_gmock_mutex.AssertHeld();
825
- return call_count_;
826
- }
827
-
828
- // Increments the number this expectation has been invoked.
829
- void IncrementCallCount()
830
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
831
- g_gmock_mutex.AssertHeld();
832
- call_count_++;
833
- }
834
-
835
- // Checks the action count (i.e. the number of WillOnce() and
836
- // WillRepeatedly() clauses) against the cardinality if this hasn't
837
- // been done before. Prints a warning if there are too many or too
838
- // few actions.
839
- void CheckActionCountIfNotDone() const
840
- GTEST_LOCK_EXCLUDED_(mutex_);
841
-
842
- friend class ::testing::Sequence;
843
- friend class ::testing::internal::ExpectationTester;
844
-
845
- template <typename Function>
846
- friend class TypedExpectation;
847
-
848
- // Implements the .Times() clause.
849
- void UntypedTimes(const Cardinality& a_cardinality);
850
-
851
- // This group of fields are part of the spec and won't change after
852
- // an EXPECT_CALL() statement finishes.
853
- const char* file_; // The file that contains the expectation.
854
- int line_; // The line number of the expectation.
855
- const std::string source_text_; // The EXPECT_CALL(...) source text.
856
- // True iff the cardinality is specified explicitly.
857
- bool cardinality_specified_;
858
- Cardinality cardinality_; // The cardinality of the expectation.
859
- // The immediate pre-requisites (i.e. expectations that must be
860
- // satisfied before this expectation can be matched) of this
861
- // expectation. We use linked_ptr in the set because we want an
862
- // Expectation object to be co-owned by its FunctionMocker and its
863
- // successors. This allows multiple mock objects to be deleted at
864
- // different times.
865
- ExpectationSet immediate_prerequisites_;
866
-
867
- // This group of fields are the current state of the expectation,
868
- // and can change as the mock function is called.
869
- int call_count_; // How many times this expectation has been invoked.
870
- bool retired_; // True iff this expectation has retired.
871
- UntypedActions untyped_actions_;
872
- bool extra_matcher_specified_;
873
- bool repeated_action_specified_; // True if a WillRepeatedly() was specified.
874
- bool retires_on_saturation_;
875
- Clause last_clause_;
876
- mutable bool action_count_checked_; // Under mutex_.
877
- mutable Mutex mutex_; // Protects action_count_checked_.
878
-
879
- GTEST_DISALLOW_ASSIGN_(ExpectationBase);
880
- }; // class ExpectationBase
881
-
882
- // Impements an expectation for the given function type.
883
- template <typename F>
884
- class TypedExpectation : public ExpectationBase {
885
- public:
886
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
887
- typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
888
- typedef typename Function<F>::Result Result;
889
-
890
- TypedExpectation(FunctionMockerBase<F>* owner, const char* a_file, int a_line,
891
- const std::string& a_source_text,
892
- const ArgumentMatcherTuple& m)
893
- : ExpectationBase(a_file, a_line, a_source_text),
894
- owner_(owner),
895
- matchers_(m),
896
- // By default, extra_matcher_ should match anything. However,
897
- // we cannot initialize it with _ as that triggers a compiler
898
- // bug in Symbian's C++ compiler (cannot decide between two
899
- // overloaded constructors of Matcher<const ArgumentTuple&>).
900
- extra_matcher_(A<const ArgumentTuple&>()),
901
- repeated_action_(DoDefault()) {}
902
-
903
- virtual ~TypedExpectation() {
904
- // Check the validity of the action count if it hasn't been done
905
- // yet (for example, if the expectation was never used).
906
- CheckActionCountIfNotDone();
907
- for (UntypedActions::const_iterator it = untyped_actions_.begin();
908
- it != untyped_actions_.end(); ++it) {
909
- delete static_cast<const Action<F>*>(*it);
910
- }
911
- }
912
-
913
- // Implements the .With() clause.
914
- TypedExpectation& With(const Matcher<const ArgumentTuple&>& m) {
915
- if (last_clause_ == kWith) {
916
- ExpectSpecProperty(false,
917
- ".With() cannot appear "
918
- "more than once in an EXPECT_CALL().");
919
- } else {
920
- ExpectSpecProperty(last_clause_ < kWith,
921
- ".With() must be the first "
922
- "clause in an EXPECT_CALL().");
923
- }
924
- last_clause_ = kWith;
925
-
926
- extra_matcher_ = m;
927
- extra_matcher_specified_ = true;
928
- return *this;
929
- }
930
-
931
- // Implements the .Times() clause.
932
- TypedExpectation& Times(const Cardinality& a_cardinality) {
933
- ExpectationBase::UntypedTimes(a_cardinality);
934
- return *this;
935
- }
936
-
937
- // Implements the .Times() clause.
938
- TypedExpectation& Times(int n) {
939
- return Times(Exactly(n));
940
- }
941
-
942
- // Implements the .InSequence() clause.
943
- TypedExpectation& InSequence(const Sequence& s) {
944
- ExpectSpecProperty(last_clause_ <= kInSequence,
945
- ".InSequence() cannot appear after .After(),"
946
- " .WillOnce(), .WillRepeatedly(), or "
947
- ".RetiresOnSaturation().");
948
- last_clause_ = kInSequence;
949
-
950
- s.AddExpectation(GetHandle());
951
- return *this;
952
- }
953
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2) {
954
- return InSequence(s1).InSequence(s2);
955
- }
956
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
957
- const Sequence& s3) {
958
- return InSequence(s1, s2).InSequence(s3);
959
- }
960
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
961
- const Sequence& s3, const Sequence& s4) {
962
- return InSequence(s1, s2, s3).InSequence(s4);
963
- }
964
- TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2,
965
- const Sequence& s3, const Sequence& s4,
966
- const Sequence& s5) {
967
- return InSequence(s1, s2, s3, s4).InSequence(s5);
968
- }
969
-
970
- // Implements that .After() clause.
971
- TypedExpectation& After(const ExpectationSet& s) {
972
- ExpectSpecProperty(last_clause_ <= kAfter,
973
- ".After() cannot appear after .WillOnce(),"
974
- " .WillRepeatedly(), or "
975
- ".RetiresOnSaturation().");
976
- last_clause_ = kAfter;
977
-
978
- for (ExpectationSet::const_iterator it = s.begin(); it != s.end(); ++it) {
979
- immediate_prerequisites_ += *it;
980
- }
981
- return *this;
982
- }
983
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2) {
984
- return After(s1).After(s2);
985
- }
986
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
987
- const ExpectationSet& s3) {
988
- return After(s1, s2).After(s3);
989
- }
990
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
991
- const ExpectationSet& s3, const ExpectationSet& s4) {
992
- return After(s1, s2, s3).After(s4);
993
- }
994
- TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2,
995
- const ExpectationSet& s3, const ExpectationSet& s4,
996
- const ExpectationSet& s5) {
997
- return After(s1, s2, s3, s4).After(s5);
998
- }
999
-
1000
- // Implements the .WillOnce() clause.
1001
- TypedExpectation& WillOnce(const Action<F>& action) {
1002
- ExpectSpecProperty(last_clause_ <= kWillOnce,
1003
- ".WillOnce() cannot appear after "
1004
- ".WillRepeatedly() or .RetiresOnSaturation().");
1005
- last_clause_ = kWillOnce;
1006
-
1007
- untyped_actions_.push_back(new Action<F>(action));
1008
- if (!cardinality_specified()) {
1009
- set_cardinality(Exactly(static_cast<int>(untyped_actions_.size())));
1010
- }
1011
- return *this;
1012
- }
1013
-
1014
- // Implements the .WillRepeatedly() clause.
1015
- TypedExpectation& WillRepeatedly(const Action<F>& action) {
1016
- if (last_clause_ == kWillRepeatedly) {
1017
- ExpectSpecProperty(false,
1018
- ".WillRepeatedly() cannot appear "
1019
- "more than once in an EXPECT_CALL().");
1020
- } else {
1021
- ExpectSpecProperty(last_clause_ < kWillRepeatedly,
1022
- ".WillRepeatedly() cannot appear "
1023
- "after .RetiresOnSaturation().");
1024
- }
1025
- last_clause_ = kWillRepeatedly;
1026
- repeated_action_specified_ = true;
1027
-
1028
- repeated_action_ = action;
1029
- if (!cardinality_specified()) {
1030
- set_cardinality(AtLeast(static_cast<int>(untyped_actions_.size())));
1031
- }
1032
-
1033
- // Now that no more action clauses can be specified, we check
1034
- // whether their count makes sense.
1035
- CheckActionCountIfNotDone();
1036
- return *this;
1037
- }
1038
-
1039
- // Implements the .RetiresOnSaturation() clause.
1040
- TypedExpectation& RetiresOnSaturation() {
1041
- ExpectSpecProperty(last_clause_ < kRetiresOnSaturation,
1042
- ".RetiresOnSaturation() cannot appear "
1043
- "more than once.");
1044
- last_clause_ = kRetiresOnSaturation;
1045
- retires_on_saturation_ = true;
1046
-
1047
- // Now that no more action clauses can be specified, we check
1048
- // whether their count makes sense.
1049
- CheckActionCountIfNotDone();
1050
- return *this;
1051
- }
1052
-
1053
- // Returns the matchers for the arguments as specified inside the
1054
- // EXPECT_CALL() macro.
1055
- const ArgumentMatcherTuple& matchers() const {
1056
- return matchers_;
1057
- }
1058
-
1059
- // Returns the matcher specified by the .With() clause.
1060
- const Matcher<const ArgumentTuple&>& extra_matcher() const {
1061
- return extra_matcher_;
1062
- }
1063
-
1064
- // Returns the action specified by the .WillRepeatedly() clause.
1065
- const Action<F>& repeated_action() const { return repeated_action_; }
1066
-
1067
- // If this mock method has an extra matcher (i.e. .With(matcher)),
1068
- // describes it to the ostream.
1069
- virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) {
1070
- if (extra_matcher_specified_) {
1071
- *os << " Expected args: ";
1072
- extra_matcher_.DescribeTo(os);
1073
- *os << "\n";
1074
- }
1075
- }
1076
-
1077
- private:
1078
- template <typename Function>
1079
- friend class FunctionMockerBase;
1080
-
1081
- // Returns an Expectation object that references and co-owns this
1082
- // expectation.
1083
- virtual Expectation GetHandle() {
1084
- return owner_->GetHandleOf(this);
1085
- }
1086
-
1087
- // The following methods will be called only after the EXPECT_CALL()
1088
- // statement finishes and when the current thread holds
1089
- // g_gmock_mutex.
1090
-
1091
- // Returns true iff this expectation matches the given arguments.
1092
- bool Matches(const ArgumentTuple& args) const
1093
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
1094
- g_gmock_mutex.AssertHeld();
1095
- return TupleMatches(matchers_, args) && extra_matcher_.Matches(args);
1096
- }
1097
-
1098
- // Returns true iff this expectation should handle the given arguments.
1099
- bool ShouldHandleArguments(const ArgumentTuple& args) const
1100
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
1101
- g_gmock_mutex.AssertHeld();
1102
-
1103
- // In case the action count wasn't checked when the expectation
1104
- // was defined (e.g. if this expectation has no WillRepeatedly()
1105
- // or RetiresOnSaturation() clause), we check it when the
1106
- // expectation is used for the first time.
1107
- CheckActionCountIfNotDone();
1108
- return !is_retired() && AllPrerequisitesAreSatisfied() && Matches(args);
1109
- }
1110
-
1111
- // Describes the result of matching the arguments against this
1112
- // expectation to the given ostream.
1113
- void ExplainMatchResultTo(
1114
- const ArgumentTuple& args,
1115
- ::std::ostream* os) const
1116
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
1117
- g_gmock_mutex.AssertHeld();
1118
-
1119
- if (is_retired()) {
1120
- *os << " Expected: the expectation is active\n"
1121
- << " Actual: it is retired\n";
1122
- } else if (!Matches(args)) {
1123
- if (!TupleMatches(matchers_, args)) {
1124
- ExplainMatchFailureTupleTo(matchers_, args, os);
1125
- }
1126
- StringMatchResultListener listener;
1127
- if (!extra_matcher_.MatchAndExplain(args, &listener)) {
1128
- *os << " Expected args: ";
1129
- extra_matcher_.DescribeTo(os);
1130
- *os << "\n Actual: don't match";
1131
-
1132
- internal::PrintIfNotEmpty(listener.str(), os);
1133
- *os << "\n";
1134
- }
1135
- } else if (!AllPrerequisitesAreSatisfied()) {
1136
- *os << " Expected: all pre-requisites are satisfied\n"
1137
- << " Actual: the following immediate pre-requisites "
1138
- << "are not satisfied:\n";
1139
- ExpectationSet unsatisfied_prereqs;
1140
- FindUnsatisfiedPrerequisites(&unsatisfied_prereqs);
1141
- int i = 0;
1142
- for (ExpectationSet::const_iterator it = unsatisfied_prereqs.begin();
1143
- it != unsatisfied_prereqs.end(); ++it) {
1144
- it->expectation_base()->DescribeLocationTo(os);
1145
- *os << "pre-requisite #" << i++ << "\n";
1146
- }
1147
- *os << " (end of pre-requisites)\n";
1148
- } else {
1149
- // This line is here just for completeness' sake. It will never
1150
- // be executed as currently the ExplainMatchResultTo() function
1151
- // is called only when the mock function call does NOT match the
1152
- // expectation.
1153
- *os << "The call matches the expectation.\n";
1154
- }
1155
- }
1156
-
1157
- // Returns the action that should be taken for the current invocation.
1158
- const Action<F>& GetCurrentAction(
1159
- const FunctionMockerBase<F>* mocker,
1160
- const ArgumentTuple& args) const
1161
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
1162
- g_gmock_mutex.AssertHeld();
1163
- const int count = call_count();
1164
- Assert(count >= 1, __FILE__, __LINE__,
1165
- "call_count() is <= 0 when GetCurrentAction() is "
1166
- "called - this should never happen.");
1167
-
1168
- const int action_count = static_cast<int>(untyped_actions_.size());
1169
- if (action_count > 0 && !repeated_action_specified_ &&
1170
- count > action_count) {
1171
- // If there is at least one WillOnce() and no WillRepeatedly(),
1172
- // we warn the user when the WillOnce() clauses ran out.
1173
- ::std::stringstream ss;
1174
- DescribeLocationTo(&ss);
1175
- ss << "Actions ran out in " << source_text() << "...\n"
1176
- << "Called " << count << " times, but only "
1177
- << action_count << " WillOnce()"
1178
- << (action_count == 1 ? " is" : "s are") << " specified - ";
1179
- mocker->DescribeDefaultActionTo(args, &ss);
1180
- Log(kWarning, ss.str(), 1);
1181
- }
1182
-
1183
- return count <= action_count ?
1184
- *static_cast<const Action<F>*>(untyped_actions_[count - 1]) :
1185
- repeated_action();
1186
- }
1187
-
1188
- // Given the arguments of a mock function call, if the call will
1189
- // over-saturate this expectation, returns the default action;
1190
- // otherwise, returns the next action in this expectation. Also
1191
- // describes *what* happened to 'what', and explains *why* Google
1192
- // Mock does it to 'why'. This method is not const as it calls
1193
- // IncrementCallCount(). A return value of NULL means the default
1194
- // action.
1195
- const Action<F>* GetActionForArguments(
1196
- const FunctionMockerBase<F>* mocker,
1197
- const ArgumentTuple& args,
1198
- ::std::ostream* what,
1199
- ::std::ostream* why)
1200
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
1201
- g_gmock_mutex.AssertHeld();
1202
- if (IsSaturated()) {
1203
- // We have an excessive call.
1204
- IncrementCallCount();
1205
- *what << "Mock function called more times than expected - ";
1206
- mocker->DescribeDefaultActionTo(args, what);
1207
- DescribeCallCountTo(why);
1208
-
1209
- // TODO(wan@google.com): allow the user to control whether
1210
- // unexpected calls should fail immediately or continue using a
1211
- // flag --gmock_unexpected_calls_are_fatal.
1212
- return NULL;
1213
- }
1214
-
1215
- IncrementCallCount();
1216
- RetireAllPreRequisites();
1217
-
1218
- if (retires_on_saturation_ && IsSaturated()) {
1219
- Retire();
1220
- }
1221
-
1222
- // Must be done after IncrementCount()!
1223
- *what << "Mock function call matches " << source_text() <<"...\n";
1224
- return &(GetCurrentAction(mocker, args));
1225
- }
1226
-
1227
- // All the fields below won't change once the EXPECT_CALL()
1228
- // statement finishes.
1229
- FunctionMockerBase<F>* const owner_;
1230
- ArgumentMatcherTuple matchers_;
1231
- Matcher<const ArgumentTuple&> extra_matcher_;
1232
- Action<F> repeated_action_;
1233
-
1234
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TypedExpectation);
1235
- }; // class TypedExpectation
1236
-
1237
- // A MockSpec object is used by ON_CALL() or EXPECT_CALL() for
1238
- // specifying the default behavior of, or expectation on, a mock
1239
- // function.
1240
-
1241
- // Note: class MockSpec really belongs to the ::testing namespace.
1242
- // However if we define it in ::testing, MSVC will complain when
1243
- // classes in ::testing::internal declare it as a friend class
1244
- // template. To workaround this compiler bug, we define MockSpec in
1245
- // ::testing::internal and import it into ::testing.
1246
-
1247
- // Logs a message including file and line number information.
1248
- GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
1249
- const char* file, int line,
1250
- const std::string& message);
1251
-
1252
- template <typename F>
1253
- class MockSpec {
1254
- public:
1255
- typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
1256
- typedef typename internal::Function<F>::ArgumentMatcherTuple
1257
- ArgumentMatcherTuple;
1258
-
1259
- // Constructs a MockSpec object, given the function mocker object
1260
- // that the spec is associated with.
1261
- MockSpec(internal::FunctionMockerBase<F>* function_mocker,
1262
- const ArgumentMatcherTuple& matchers)
1263
- : function_mocker_(function_mocker), matchers_(matchers) {}
1264
-
1265
- // Adds a new default action spec to the function mocker and returns
1266
- // the newly created spec.
1267
- internal::OnCallSpec<F>& InternalDefaultActionSetAt(
1268
- const char* file, int line, const char* obj, const char* call) {
1269
- LogWithLocation(internal::kInfo, file, line,
1270
- std::string("ON_CALL(") + obj + ", " + call + ") invoked");
1271
- return function_mocker_->AddNewOnCallSpec(file, line, matchers_);
1272
- }
1273
-
1274
- // Adds a new expectation spec to the function mocker and returns
1275
- // the newly created spec.
1276
- internal::TypedExpectation<F>& InternalExpectedAt(
1277
- const char* file, int line, const char* obj, const char* call) {
1278
- const std::string source_text(std::string("EXPECT_CALL(") + obj + ", " +
1279
- call + ")");
1280
- LogWithLocation(internal::kInfo, file, line, source_text + " invoked");
1281
- return function_mocker_->AddNewExpectation(
1282
- file, line, source_text, matchers_);
1283
- }
1284
-
1285
- // This operator overload is used to swallow the superfluous parameter list
1286
- // introduced by the ON/EXPECT_CALL macros. See the macro comments for more
1287
- // explanation.
1288
- MockSpec<F>& operator()(const internal::WithoutMatchers&, void* const) {
1289
- return *this;
1290
- }
1291
-
1292
- private:
1293
- template <typename Function>
1294
- friend class internal::FunctionMocker;
1295
-
1296
- // The function mocker that owns this spec.
1297
- internal::FunctionMockerBase<F>* const function_mocker_;
1298
- // The argument matchers specified in the spec.
1299
- ArgumentMatcherTuple matchers_;
1300
-
1301
- GTEST_DISALLOW_ASSIGN_(MockSpec);
1302
- }; // class MockSpec
1303
-
1304
- // Wrapper type for generically holding an ordinary value or lvalue reference.
1305
- // If T is not a reference type, it must be copyable or movable.
1306
- // ReferenceOrValueWrapper<T> is movable, and will also be copyable unless
1307
- // T is a move-only value type (which means that it will always be copyable
1308
- // if the current platform does not support move semantics).
1309
- //
1310
- // The primary template defines handling for values, but function header
1311
- // comments describe the contract for the whole template (including
1312
- // specializations).
1313
- template <typename T>
1314
- class ReferenceOrValueWrapper {
1315
- public:
1316
- // Constructs a wrapper from the given value/reference.
1317
- explicit ReferenceOrValueWrapper(T value)
1318
- : value_(::testing::internal::move(value)) {
1319
- }
1320
-
1321
- // Unwraps and returns the underlying value/reference, exactly as
1322
- // originally passed. The behavior of calling this more than once on
1323
- // the same object is unspecified.
1324
- T Unwrap() { return ::testing::internal::move(value_); }
1325
-
1326
- // Provides nondestructive access to the underlying value/reference.
1327
- // Always returns a const reference (more precisely,
1328
- // const RemoveReference<T>&). The behavior of calling this after
1329
- // calling Unwrap on the same object is unspecified.
1330
- const T& Peek() const {
1331
- return value_;
1332
- }
1333
-
1334
- private:
1335
- T value_;
1336
- };
1337
-
1338
- // Specialization for lvalue reference types. See primary template
1339
- // for documentation.
1340
- template <typename T>
1341
- class ReferenceOrValueWrapper<T&> {
1342
- public:
1343
- // Workaround for debatable pass-by-reference lint warning (c-library-team
1344
- // policy precludes NOLINT in this context)
1345
- typedef T& reference;
1346
- explicit ReferenceOrValueWrapper(reference ref)
1347
- : value_ptr_(&ref) {}
1348
- T& Unwrap() { return *value_ptr_; }
1349
- const T& Peek() const { return *value_ptr_; }
1350
-
1351
- private:
1352
- T* value_ptr_;
1353
- };
1354
-
1355
- // MSVC warns about using 'this' in base member initializer list, so
1356
- // we need to temporarily disable the warning. We have to do it for
1357
- // the entire class to suppress the warning, even though it's about
1358
- // the constructor only.
1359
-
1360
- #ifdef _MSC_VER
1361
- # pragma warning(push) // Saves the current warning state.
1362
- # pragma warning(disable:4355) // Temporarily disables warning 4355.
1363
- #endif // _MSV_VER
1364
-
1365
- // C++ treats the void type specially. For example, you cannot define
1366
- // a void-typed variable or pass a void value to a function.
1367
- // ActionResultHolder<T> holds a value of type T, where T must be a
1368
- // copyable type or void (T doesn't need to be default-constructable).
1369
- // It hides the syntactic difference between void and other types, and
1370
- // is used to unify the code for invoking both void-returning and
1371
- // non-void-returning mock functions.
1372
-
1373
- // Untyped base class for ActionResultHolder<T>.
1374
- class UntypedActionResultHolderBase {
1375
- public:
1376
- virtual ~UntypedActionResultHolderBase() {}
1377
-
1378
- // Prints the held value as an action's result to os.
1379
- virtual void PrintAsActionResult(::std::ostream* os) const = 0;
1380
- };
1381
-
1382
- // This generic definition is used when T is not void.
1383
- template <typename T>
1384
- class ActionResultHolder : public UntypedActionResultHolderBase {
1385
- public:
1386
- // Returns the held value. Must not be called more than once.
1387
- T Unwrap() {
1388
- return result_.Unwrap();
1389
- }
1390
-
1391
- // Prints the held value as an action's result to os.
1392
- virtual void PrintAsActionResult(::std::ostream* os) const {
1393
- *os << "\n Returns: ";
1394
- // T may be a reference type, so we don't use UniversalPrint().
1395
- UniversalPrinter<T>::Print(result_.Peek(), os);
1396
- }
1397
-
1398
- // Performs the given mock function's default action and returns the
1399
- // result in a new-ed ActionResultHolder.
1400
- template <typename F>
1401
- static ActionResultHolder* PerformDefaultAction(
1402
- const FunctionMockerBase<F>* func_mocker,
1403
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
1404
- const std::string& call_description) {
1405
- return new ActionResultHolder(Wrapper(func_mocker->PerformDefaultAction(
1406
- internal::move(args), call_description)));
1407
- }
1408
-
1409
- // Performs the given action and returns the result in a new-ed
1410
- // ActionResultHolder.
1411
- template <typename F>
1412
- static ActionResultHolder* PerformAction(
1413
- const Action<F>& action,
1414
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args) {
1415
- return new ActionResultHolder(
1416
- Wrapper(action.Perform(internal::move(args))));
1417
- }
1418
-
1419
- private:
1420
- typedef ReferenceOrValueWrapper<T> Wrapper;
1421
-
1422
- explicit ActionResultHolder(Wrapper result)
1423
- : result_(::testing::internal::move(result)) {
1424
- }
1425
-
1426
- Wrapper result_;
1427
-
1428
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder);
1429
- };
1430
-
1431
- // Specialization for T = void.
1432
- template <>
1433
- class ActionResultHolder<void> : public UntypedActionResultHolderBase {
1434
- public:
1435
- void Unwrap() { }
1436
-
1437
- virtual void PrintAsActionResult(::std::ostream* /* os */) const {}
1438
-
1439
- // Performs the given mock function's default action and returns ownership
1440
- // of an empty ActionResultHolder*.
1441
- template <typename F>
1442
- static ActionResultHolder* PerformDefaultAction(
1443
- const FunctionMockerBase<F>* func_mocker,
1444
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
1445
- const std::string& call_description) {
1446
- func_mocker->PerformDefaultAction(internal::move(args), call_description);
1447
- return new ActionResultHolder;
1448
- }
1449
-
1450
- // Performs the given action and returns ownership of an empty
1451
- // ActionResultHolder*.
1452
- template <typename F>
1453
- static ActionResultHolder* PerformAction(
1454
- const Action<F>& action,
1455
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args) {
1456
- action.Perform(internal::move(args));
1457
- return new ActionResultHolder;
1458
- }
1459
-
1460
- private:
1461
- ActionResultHolder() {}
1462
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder);
1463
- };
1464
-
1465
- // The base of the function mocker class for the given function type.
1466
- // We put the methods in this class instead of its child to avoid code
1467
- // bloat.
1468
- template <typename F>
1469
- class FunctionMockerBase : public UntypedFunctionMockerBase {
1470
- public:
1471
- typedef typename Function<F>::Result Result;
1472
- typedef typename Function<F>::ArgumentTuple ArgumentTuple;
1473
- typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
1474
-
1475
- FunctionMockerBase() {}
1476
-
1477
- // The destructor verifies that all expectations on this mock
1478
- // function have been satisfied. If not, it will report Google Test
1479
- // non-fatal failures for the violations.
1480
- virtual ~FunctionMockerBase()
1481
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
1482
- MutexLock l(&g_gmock_mutex);
1483
- VerifyAndClearExpectationsLocked();
1484
- Mock::UnregisterLocked(this);
1485
- ClearDefaultActionsLocked();
1486
- }
1487
-
1488
- // Returns the ON_CALL spec that matches this mock function with the
1489
- // given arguments; returns NULL if no matching ON_CALL is found.
1490
- // L = *
1491
- const OnCallSpec<F>* FindOnCallSpec(
1492
- const ArgumentTuple& args) const {
1493
- for (UntypedOnCallSpecs::const_reverse_iterator it
1494
- = untyped_on_call_specs_.rbegin();
1495
- it != untyped_on_call_specs_.rend(); ++it) {
1496
- const OnCallSpec<F>* spec = static_cast<const OnCallSpec<F>*>(*it);
1497
- if (spec->Matches(args))
1498
- return spec;
1499
- }
1500
-
1501
- return NULL;
1502
- }
1503
-
1504
- // Performs the default action of this mock function on the given
1505
- // arguments and returns the result. Asserts (or throws if
1506
- // exceptions are enabled) with a helpful call descrption if there
1507
- // is no valid return value. This method doesn't depend on the
1508
- // mutable state of this object, and thus can be called concurrently
1509
- // without locking.
1510
- // L = *
1511
- Result PerformDefaultAction(
1512
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
1513
- const std::string& call_description) const {
1514
- const OnCallSpec<F>* const spec =
1515
- this->FindOnCallSpec(args);
1516
- if (spec != NULL) {
1517
- return spec->GetAction().Perform(internal::move(args));
1518
- }
1519
- const std::string message =
1520
- call_description +
1521
- "\n The mock function has no default action "
1522
- "set, and its return type has no default value set.";
1523
- #if GTEST_HAS_EXCEPTIONS
1524
- if (!DefaultValue<Result>::Exists()) {
1525
- throw std::runtime_error(message);
1526
- }
1527
- #else
1528
- Assert(DefaultValue<Result>::Exists(), "", -1, message);
1529
- #endif
1530
- return DefaultValue<Result>::Get();
1531
- }
1532
-
1533
- // Performs the default action with the given arguments and returns
1534
- // the action's result. The call description string will be used in
1535
- // the error message to describe the call in the case the default
1536
- // action fails. The caller is responsible for deleting the result.
1537
- // L = *
1538
- virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
1539
- void* untyped_args, // must point to an ArgumentTuple
1540
- const std::string& call_description) const {
1541
- ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
1542
- return ResultHolder::PerformDefaultAction(this, internal::move(*args),
1543
- call_description);
1544
- }
1545
-
1546
- // Performs the given action with the given arguments and returns
1547
- // the action's result. The caller is responsible for deleting the
1548
- // result.
1549
- // L = *
1550
- virtual UntypedActionResultHolderBase* UntypedPerformAction(
1551
- const void* untyped_action, void* untyped_args) const {
1552
- // Make a copy of the action before performing it, in case the
1553
- // action deletes the mock object (and thus deletes itself).
1554
- const Action<F> action = *static_cast<const Action<F>*>(untyped_action);
1555
- ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
1556
- return ResultHolder::PerformAction(action, internal::move(*args));
1557
- }
1558
-
1559
- // Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
1560
- // clears the ON_CALL()s set on this mock function.
1561
- virtual void ClearDefaultActionsLocked()
1562
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
1563
- g_gmock_mutex.AssertHeld();
1564
-
1565
- // Deleting our default actions may trigger other mock objects to be
1566
- // deleted, for example if an action contains a reference counted smart
1567
- // pointer to that mock object, and that is the last reference. So if we
1568
- // delete our actions within the context of the global mutex we may deadlock
1569
- // when this method is called again. Instead, make a copy of the set of
1570
- // actions to delete, clear our set within the mutex, and then delete the
1571
- // actions outside of the mutex.
1572
- UntypedOnCallSpecs specs_to_delete;
1573
- untyped_on_call_specs_.swap(specs_to_delete);
1574
-
1575
- g_gmock_mutex.Unlock();
1576
- for (UntypedOnCallSpecs::const_iterator it =
1577
- specs_to_delete.begin();
1578
- it != specs_to_delete.end(); ++it) {
1579
- delete static_cast<const OnCallSpec<F>*>(*it);
1580
- }
1581
-
1582
- // Lock the mutex again, since the caller expects it to be locked when we
1583
- // return.
1584
- g_gmock_mutex.Lock();
1585
- }
1586
-
1587
- protected:
1588
- template <typename Function>
1589
- friend class MockSpec;
1590
-
1591
- typedef ActionResultHolder<Result> ResultHolder;
1592
-
1593
- // Returns the result of invoking this mock function with the given
1594
- // arguments. This function can be safely called from multiple
1595
- // threads concurrently.
1596
- Result InvokeWith(
1597
- typename RvalueRef<typename Function<F>::ArgumentTuple>::type args)
1598
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
1599
- // const_cast is required since in C++98 we still pass ArgumentTuple around
1600
- // by const& instead of rvalue reference.
1601
- void* untyped_args = const_cast<void*>(static_cast<const void*>(&args));
1602
- scoped_ptr<ResultHolder> holder(
1603
- DownCast_<ResultHolder*>(this->UntypedInvokeWith(untyped_args)));
1604
- return holder->Unwrap();
1605
- }
1606
-
1607
- // Adds and returns a default action spec for this mock function.
1608
- OnCallSpec<F>& AddNewOnCallSpec(
1609
- const char* file, int line,
1610
- const ArgumentMatcherTuple& m)
1611
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
1612
- Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
1613
- OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m);
1614
- untyped_on_call_specs_.push_back(on_call_spec);
1615
- return *on_call_spec;
1616
- }
1617
-
1618
- // Adds and returns an expectation spec for this mock function.
1619
- TypedExpectation<F>& AddNewExpectation(const char* file, int line,
1620
- const std::string& source_text,
1621
- const ArgumentMatcherTuple& m)
1622
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
1623
- Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
1624
- TypedExpectation<F>* const expectation =
1625
- new TypedExpectation<F>(this, file, line, source_text, m);
1626
- const linked_ptr<ExpectationBase> untyped_expectation(expectation);
1627
- // See the definition of untyped_expectations_ for why access to
1628
- // it is unprotected here.
1629
- untyped_expectations_.push_back(untyped_expectation);
1630
-
1631
- // Adds this expectation into the implicit sequence if there is one.
1632
- Sequence* const implicit_sequence = g_gmock_implicit_sequence.get();
1633
- if (implicit_sequence != NULL) {
1634
- implicit_sequence->AddExpectation(Expectation(untyped_expectation));
1635
- }
1636
-
1637
- return *expectation;
1638
- }
1639
-
1640
- private:
1641
- template <typename Func> friend class TypedExpectation;
1642
-
1643
- // Some utilities needed for implementing UntypedInvokeWith().
1644
-
1645
- // Describes what default action will be performed for the given
1646
- // arguments.
1647
- // L = *
1648
- void DescribeDefaultActionTo(const ArgumentTuple& args,
1649
- ::std::ostream* os) const {
1650
- const OnCallSpec<F>* const spec = FindOnCallSpec(args);
1651
-
1652
- if (spec == NULL) {
1653
- *os << (internal::type_equals<Result, void>::value ?
1654
- "returning directly.\n" :
1655
- "returning default value.\n");
1656
- } else {
1657
- *os << "taking default action specified at:\n"
1658
- << FormatFileLocation(spec->file(), spec->line()) << "\n";
1659
- }
1660
- }
1661
-
1662
- // Writes a message that the call is uninteresting (i.e. neither
1663
- // explicitly expected nor explicitly unexpected) to the given
1664
- // ostream.
1665
- virtual void UntypedDescribeUninterestingCall(
1666
- const void* untyped_args,
1667
- ::std::ostream* os) const
1668
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
1669
- const ArgumentTuple& args =
1670
- *static_cast<const ArgumentTuple*>(untyped_args);
1671
- *os << "Uninteresting mock function call - ";
1672
- DescribeDefaultActionTo(args, os);
1673
- *os << " Function call: " << Name();
1674
- UniversalPrint(args, os);
1675
- }
1676
-
1677
- // Returns the expectation that matches the given function arguments
1678
- // (or NULL is there's no match); when a match is found,
1679
- // untyped_action is set to point to the action that should be
1680
- // performed (or NULL if the action is "do default"), and
1681
- // is_excessive is modified to indicate whether the call exceeds the
1682
- // expected number.
1683
- //
1684
- // Critical section: We must find the matching expectation and the
1685
- // corresponding action that needs to be taken in an ATOMIC
1686
- // transaction. Otherwise another thread may call this mock
1687
- // method in the middle and mess up the state.
1688
- //
1689
- // However, performing the action has to be left out of the critical
1690
- // section. The reason is that we have no control on what the
1691
- // action does (it can invoke an arbitrary user function or even a
1692
- // mock function) and excessive locking could cause a dead lock.
1693
- virtual const ExpectationBase* UntypedFindMatchingExpectation(
1694
- const void* untyped_args,
1695
- const void** untyped_action, bool* is_excessive,
1696
- ::std::ostream* what, ::std::ostream* why)
1697
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
1698
- const ArgumentTuple& args =
1699
- *static_cast<const ArgumentTuple*>(untyped_args);
1700
- MutexLock l(&g_gmock_mutex);
1701
- TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args);
1702
- if (exp == NULL) { // A match wasn't found.
1703
- this->FormatUnexpectedCallMessageLocked(args, what, why);
1704
- return NULL;
1705
- }
1706
-
1707
- // This line must be done before calling GetActionForArguments(),
1708
- // which will increment the call count for *exp and thus affect
1709
- // its saturation status.
1710
- *is_excessive = exp->IsSaturated();
1711
- const Action<F>* action = exp->GetActionForArguments(this, args, what, why);
1712
- if (action != NULL && action->IsDoDefault())
1713
- action = NULL; // Normalize "do default" to NULL.
1714
- *untyped_action = action;
1715
- return exp;
1716
- }
1717
-
1718
- // Prints the given function arguments to the ostream.
1719
- virtual void UntypedPrintArgs(const void* untyped_args,
1720
- ::std::ostream* os) const {
1721
- const ArgumentTuple& args =
1722
- *static_cast<const ArgumentTuple*>(untyped_args);
1723
- UniversalPrint(args, os);
1724
- }
1725
-
1726
- // Returns the expectation that matches the arguments, or NULL if no
1727
- // expectation matches them.
1728
- TypedExpectation<F>* FindMatchingExpectationLocked(
1729
- const ArgumentTuple& args) const
1730
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
1731
- g_gmock_mutex.AssertHeld();
1732
- // See the definition of untyped_expectations_ for why access to
1733
- // it is unprotected here.
1734
- for (typename UntypedExpectations::const_reverse_iterator it =
1735
- untyped_expectations_.rbegin();
1736
- it != untyped_expectations_.rend(); ++it) {
1737
- TypedExpectation<F>* const exp =
1738
- static_cast<TypedExpectation<F>*>(it->get());
1739
- if (exp->ShouldHandleArguments(args)) {
1740
- return exp;
1741
- }
1742
- }
1743
- return NULL;
1744
- }
1745
-
1746
- // Returns a message that the arguments don't match any expectation.
1747
- void FormatUnexpectedCallMessageLocked(
1748
- const ArgumentTuple& args,
1749
- ::std::ostream* os,
1750
- ::std::ostream* why) const
1751
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
1752
- g_gmock_mutex.AssertHeld();
1753
- *os << "\nUnexpected mock function call - ";
1754
- DescribeDefaultActionTo(args, os);
1755
- PrintTriedExpectationsLocked(args, why);
1756
- }
1757
-
1758
- // Prints a list of expectations that have been tried against the
1759
- // current mock function call.
1760
- void PrintTriedExpectationsLocked(
1761
- const ArgumentTuple& args,
1762
- ::std::ostream* why) const
1763
- GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
1764
- g_gmock_mutex.AssertHeld();
1765
- const int count = static_cast<int>(untyped_expectations_.size());
1766
- *why << "Google Mock tried the following " << count << " "
1767
- << (count == 1 ? "expectation, but it didn't match" :
1768
- "expectations, but none matched")
1769
- << ":\n";
1770
- for (int i = 0; i < count; i++) {
1771
- TypedExpectation<F>* const expectation =
1772
- static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get());
1773
- *why << "\n";
1774
- expectation->DescribeLocationTo(why);
1775
- if (count > 1) {
1776
- *why << "tried expectation #" << i << ": ";
1777
- }
1778
- *why << expectation->source_text() << "...\n";
1779
- expectation->ExplainMatchResultTo(args, why);
1780
- expectation->DescribeCallCountTo(why);
1781
- }
1782
- }
1783
-
1784
- // There is no generally useful and implementable semantics of
1785
- // copying a mock object, so copying a mock is usually a user error.
1786
- // Thus we disallow copying function mockers. If the user really
1787
- // wants to copy a mock object, they should implement their own copy
1788
- // operation, for example:
1789
- //
1790
- // class MockFoo : public Foo {
1791
- // public:
1792
- // // Defines a copy constructor explicitly.
1793
- // MockFoo(const MockFoo& src) {}
1794
- // ...
1795
- // };
1796
- GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase);
1797
- }; // class FunctionMockerBase
1798
-
1799
- #ifdef _MSC_VER
1800
- # pragma warning(pop) // Restores the warning state.
1801
- #endif // _MSV_VER
1802
-
1803
- // Implements methods of FunctionMockerBase.
1804
-
1805
- // Verifies that all expectations on this mock function have been
1806
- // satisfied. Reports one or more Google Test non-fatal failures and
1807
- // returns false if not.
1808
-
1809
- // Reports an uninteresting call (whose description is in msg) in the
1810
- // manner specified by 'reaction'.
1811
- void ReportUninterestingCall(CallReaction reaction, const std::string& msg);
1812
-
1813
- } // namespace internal
1814
-
1815
- // The style guide prohibits "using" statements in a namespace scope
1816
- // inside a header file. However, the MockSpec class template is
1817
- // meant to be defined in the ::testing namespace. The following line
1818
- // is just a trick for working around a bug in MSVC 8.0, which cannot
1819
- // handle it if we define MockSpec in ::testing.
1820
- using internal::MockSpec;
1821
-
1822
- // Const(x) is a convenient function for obtaining a const reference
1823
- // to x. This is useful for setting expectations on an overloaded
1824
- // const mock method, e.g.
1825
- //
1826
- // class MockFoo : public FooInterface {
1827
- // public:
1828
- // MOCK_METHOD0(Bar, int());
1829
- // MOCK_CONST_METHOD0(Bar, int&());
1830
- // };
1831
- //
1832
- // MockFoo foo;
1833
- // // Expects a call to non-const MockFoo::Bar().
1834
- // EXPECT_CALL(foo, Bar());
1835
- // // Expects a call to const MockFoo::Bar().
1836
- // EXPECT_CALL(Const(foo), Bar());
1837
- template <typename T>
1838
- inline const T& Const(const T& x) { return x; }
1839
-
1840
- // Constructs an Expectation object that references and co-owns exp.
1841
- inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
1842
- : expectation_base_(exp.GetHandle().expectation_base()) {}
1843
-
1844
- } // namespace testing
1845
-
1846
- // Implementation for ON_CALL and EXPECT_CALL macros. A separate macro is
1847
- // required to avoid compile errors when the name of the method used in call is
1848
- // a result of macro expansion. See CompilesWithMethodNameExpandedFromMacro
1849
- // tests in internal/gmock-spec-builders_test.cc for more details.
1850
- //
1851
- // This macro supports statements both with and without parameter matchers. If
1852
- // the parameter list is omitted, gMock will accept any parameters, which allows
1853
- // tests to be written that don't need to encode the number of method
1854
- // parameter. This technique may only be used for non-overloaded methods.
1855
- //
1856
- // // These are the same:
1857
- // ON_CALL(mock, NoArgsMethod()).WillByDefault(…);
1858
- // ON_CALL(mock, NoArgsMethod).WillByDefault(…);
1859
- //
1860
- // // As are these:
1861
- // ON_CALL(mock, TwoArgsMethod(_, _)).WillByDefault(…);
1862
- // ON_CALL(mock, TwoArgsMethod).WillByDefault(…);
1863
- //
1864
- // // Can also specify args if you want, of course:
1865
- // ON_CALL(mock, TwoArgsMethod(_, 45)).WillByDefault(…);
1866
- //
1867
- // // Overloads work as long as you specify parameters:
1868
- // ON_CALL(mock, OverloadedMethod(_)).WillByDefault(…);
1869
- // ON_CALL(mock, OverloadedMethod(_, _)).WillByDefault(…);
1870
- //
1871
- // // Oops! Which overload did you want?
1872
- // ON_CALL(mock, OverloadedMethod).WillByDefault(…);
1873
- // => ERROR: call to member function 'gmock_OverloadedMethod' is ambiguous
1874
- //
1875
- // How this works: The mock class uses two overloads of the gmock_Method
1876
- // expectation setter method plus an operator() overload on the MockSpec object.
1877
- // In the matcher list form, the macro expands to:
1878
- //
1879
- // // This statement:
1880
- // ON_CALL(mock, TwoArgsMethod(_, 45))…
1881
- //
1882
- // // …expands to:
1883
- // mock.gmock_TwoArgsMethod(_, 45)(WithoutMatchers(), nullptr)…
1884
- // |-------------v---------------||------------v-------------|
1885
- // invokes first overload swallowed by operator()
1886
- //
1887
- // // …which is essentially:
1888
- // mock.gmock_TwoArgsMethod(_, 45)…
1889
- //
1890
- // Whereas the form without a matcher list:
1891
- //
1892
- // // This statement:
1893
- // ON_CALL(mock, TwoArgsMethod)…
1894
- //
1895
- // // …expands to:
1896
- // mock.gmock_TwoArgsMethod(WithoutMatchers(), nullptr)…
1897
- // |-----------------------v--------------------------|
1898
- // invokes second overload
1899
- //
1900
- // // …which is essentially:
1901
- // mock.gmock_TwoArgsMethod(_, _)…
1902
- //
1903
- // The WithoutMatchers() argument is used to disambiguate overloads and to
1904
- // block the caller from accidentally invoking the second overload directly. The
1905
- // second argument is an internal type derived from the method signature. The
1906
- // failure to disambiguate two overloads of this method in the ON_CALL statement
1907
- // is how we block callers from setting expectations on overloaded methods.
1908
- #define GMOCK_ON_CALL_IMPL_(mock_expr, Setter, call) \
1909
- ((mock_expr).gmock_##call)(::testing::internal::GetWithoutMatchers(), NULL) \
1910
- .Setter(__FILE__, __LINE__, #mock_expr, #call)
1911
-
1912
- #define ON_CALL(obj, call) \
1913
- GMOCK_ON_CALL_IMPL_(obj, InternalDefaultActionSetAt, call)
1914
-
1915
- #define EXPECT_CALL(obj, call) \
1916
- GMOCK_ON_CALL_IMPL_(obj, InternalExpectedAt, call)
1917
-
1918
- #endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_