rj_schema 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (323) hide show
  1. checksums.yaml +5 -5
  2. data/Rakefile +4 -0
  3. data/ext/rj_schema/rapidjson/thirdparty/gtest/CMakeLists.txt +16 -0
  4. data/ext/rj_schema/rapidjson/thirdparty/gtest/README.md +141 -0
  5. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CHANGES +126 -0
  6. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt +202 -0
  7. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CONTRIBUTORS +40 -0
  8. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/LICENSE +28 -0
  9. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/Makefile.am +224 -0
  10. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/README.md +333 -0
  11. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/configure.ac +146 -0
  12. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CheatSheet.md +562 -0
  13. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CookBook.md +3675 -0
  14. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DesignDoc.md +280 -0
  15. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DevGuide.md +132 -0
  16. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/Documentation.md +12 -0
  17. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/ForDummies.md +439 -0
  18. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/FrequentlyAskedQuestions.md +628 -0
  19. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/KnownIssues.md +19 -0
  20. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CheatSheet.md +525 -0
  21. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CookBook.md +3250 -0
  22. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/Documentation.md +11 -0
  23. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/ForDummies.md +439 -0
  24. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/FrequentlyAskedQuestions.md +624 -0
  25. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CheatSheet.md +534 -0
  26. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CookBook.md +3342 -0
  27. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/Documentation.md +12 -0
  28. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/ForDummies.md +439 -0
  29. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/FrequentlyAskedQuestions.md +628 -0
  30. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CheatSheet.md +556 -0
  31. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CookBook.md +3432 -0
  32. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/Documentation.md +12 -0
  33. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/ForDummies.md +439 -0
  34. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/FrequentlyAskedQuestions.md +628 -0
  35. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-actions.h +1205 -0
  36. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-cardinalities.h +147 -0
  37. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h +2377 -0
  38. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +794 -0
  39. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +1095 -0
  40. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +291 -0
  41. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h +2179 -0
  42. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +672 -0
  43. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +397 -0
  44. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +161 -0
  45. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h +4399 -0
  46. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-actions.h +246 -0
  47. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h +58 -0
  48. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h +1847 -0
  49. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock.h +94 -0
  50. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +8 -0
  51. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +10 -0
  52. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h +39 -0
  53. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-port.h +46 -0
  54. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +279 -0
  55. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump +136 -0
  56. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h +511 -0
  57. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h +91 -0
  58. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/make/Makefile +101 -0
  59. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.sln +32 -0
  60. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.vcproj +191 -0
  61. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_config.vsprops +15 -0
  62. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_main.vcproj +187 -0
  63. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_test.vcproj +201 -0
  64. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.sln +32 -0
  65. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.vcxproj +82 -0
  66. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_config.props +19 -0
  67. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_main.vcxproj +88 -0
  68. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_test.vcxproj +101 -0
  69. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.sln +32 -0
  70. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.vcxproj +84 -0
  71. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_config.props +19 -0
  72. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_main.vcxproj +90 -0
  73. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_test.vcxproj +103 -0
  74. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/fuse_gmock_files.py +240 -0
  75. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/LICENSE +203 -0
  76. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README +35 -0
  77. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README.cppclean +115 -0
  78. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/__init__.py +0 -0
  79. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/ast.py +1733 -0
  80. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class.py +227 -0
  81. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class_test.py +448 -0
  82. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/keywords.py +59 -0
  83. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/tokenize.py +287 -0
  84. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/utils.py +41 -0
  85. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/gmock_gen.py +31 -0
  86. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock-config.in +303 -0
  87. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock_doctor.py +640 -0
  88. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload.py +1387 -0
  89. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload_gmock.py +78 -0
  90. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-all.cc +47 -0
  91. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-cardinalities.cc +156 -0
  92. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-internal-utils.cc +174 -0
  93. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-matchers.cc +498 -0
  94. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-spec-builders.cc +823 -0
  95. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock.cc +183 -0
  96. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock_main.cc +54 -0
  97. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-actions_test.cc +1411 -0
  98. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-cardinalities_test.cc +428 -0
  99. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-actions_test.cc +1228 -0
  100. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-function-mockers_test.cc +622 -0
  101. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc +127 -0
  102. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc +1286 -0
  103. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-internal-utils_test.cc +699 -0
  104. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-matchers_test.cc +5648 -0
  105. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-more-actions_test.cc +708 -0
  106. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-nice-strict_test.cc +424 -0
  107. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-port_test.cc +43 -0
  108. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-spec-builders_test.cc +2644 -0
  109. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_all_test.cc +51 -0
  110. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_ex_test.cc +81 -0
  111. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test.py +108 -0
  112. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test_.cc +100 -0
  113. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link2_test.cc +40 -0
  114. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.cc +40 -0
  115. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.h +669 -0
  116. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test.py +180 -0
  117. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_.cc +291 -0
  118. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_golden.txt +310 -0
  119. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_stress_test.cc +322 -0
  120. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test.cc +220 -0
  121. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test_utils.py +112 -0
  122. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CHANGES +157 -0
  123. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt +286 -0
  124. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CONTRIBUTORS +37 -0
  125. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/LICENSE +28 -0
  126. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/Makefile.am +310 -0
  127. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/README.md +280 -0
  128. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/internal_utils.cmake +242 -0
  129. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.cbproj +138 -0
  130. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.groupproj +54 -0
  131. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_all.cc +38 -0
  132. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_link.cc +40 -0
  133. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_main.cbproj +82 -0
  134. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_unittest.cbproj +88 -0
  135. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/configure.ac +68 -0
  136. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/AdvancedGuide.md +2182 -0
  137. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/DevGuide.md +126 -0
  138. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Documentation.md +14 -0
  139. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/FAQ.md +1087 -0
  140. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Primer.md +502 -0
  141. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/PumpManual.md +177 -0
  142. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Samples.md +14 -0
  143. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_AdvancedGuide.md +2096 -0
  144. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Documentation.md +12 -0
  145. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_FAQ.md +886 -0
  146. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Primer.md +497 -0
  147. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_PumpManual.md +177 -0
  148. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_XcodeGuide.md +93 -0
  149. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_AdvancedGuide.md +2178 -0
  150. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Documentation.md +14 -0
  151. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_FAQ.md +1038 -0
  152. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Primer.md +501 -0
  153. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_PumpManual.md +177 -0
  154. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Samples.md +14 -0
  155. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_XcodeGuide.md +93 -0
  156. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_AdvancedGuide.md +2181 -0
  157. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Documentation.md +14 -0
  158. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_FAQ.md +1082 -0
  159. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Primer.md +501 -0
  160. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_PumpManual.md +177 -0
  161. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Samples.md +14 -0
  162. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_XcodeGuide.md +93 -0
  163. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/XcodeGuide.md +93 -0
  164. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-death-test.h +294 -0
  165. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-message.h +250 -0
  166. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h +1444 -0
  167. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h.pump +510 -0
  168. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-printers.h +993 -0
  169. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-spi.h +232 -0
  170. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-test-part.h +179 -0
  171. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h +263 -0
  172. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest.h +2236 -0
  173. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h +358 -0
  174. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_prod.h +58 -0
  175. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h +69 -0
  176. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-printers.h +42 -0
  177. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h +41 -0
  178. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h +319 -0
  179. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h +206 -0
  180. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h +1238 -0
  181. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-linked_ptr.h +243 -0
  182. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h +5146 -0
  183. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +286 -0
  184. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h +731 -0
  185. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h +93 -0
  186. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h +2554 -0
  187. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h +167 -0
  188. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h +1020 -0
  189. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h.pump +347 -0
  190. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h +3331 -0
  191. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump +297 -0
  192. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/acx_pthread.m4 +363 -0
  193. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/gtest.m4 +74 -0
  194. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/make/Makefile +82 -0
  195. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.sln +45 -0
  196. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.vcproj +126 -0
  197. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.sln +45 -0
  198. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.vcproj +126 -0
  199. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main-md.vcproj +129 -0
  200. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main.vcproj +129 -0
  201. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test-md.vcproj +164 -0
  202. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test.vcproj +164 -0
  203. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest-md.vcproj +147 -0
  204. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest.vcproj +147 -0
  205. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/prime_tables.h +123 -0
  206. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.cc +68 -0
  207. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.h +43 -0
  208. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample10_unittest.cc +144 -0
  209. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1_unittest.cc +153 -0
  210. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.cc +56 -0
  211. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.h +85 -0
  212. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2_unittest.cc +109 -0
  213. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3-inl.h +172 -0
  214. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3_unittest.cc +151 -0
  215. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.cc +46 -0
  216. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.h +53 -0
  217. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4_unittest.cc +45 -0
  218. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample5_unittest.cc +199 -0
  219. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample6_unittest.cc +224 -0
  220. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample7_unittest.cc +130 -0
  221. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample8_unittest.cc +173 -0
  222. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample9_unittest.cc +160 -0
  223. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/common.py +83 -0
  224. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/fuse_gtest_files.py +253 -0
  225. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gen_gtest_pred_impl.py +730 -0
  226. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gtest-config.in +274 -0
  227. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/pump.py +855 -0
  228. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/release_docs.py +158 -0
  229. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/test/Makefile +59 -0
  230. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload.py +1387 -0
  231. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload_gtest.py +78 -0
  232. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-all.cc +48 -0
  233. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-death-test.cc +1342 -0
  234. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-filepath.cc +387 -0
  235. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-internal-inl.h +1183 -0
  236. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-port.cc +1259 -0
  237. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-printers.cc +373 -0
  238. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-test-part.cc +110 -0
  239. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-typed-test.cc +118 -0
  240. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest.cc +5388 -0
  241. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest_main.cc +38 -0
  242. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_ex_test.cc +93 -0
  243. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_test.cc +1427 -0
  244. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-filepath_test.cc +662 -0
  245. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-linked_ptr_test.cc +154 -0
  246. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-listener_test.cc +311 -0
  247. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-message_test.cc +159 -0
  248. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-options_test.cc +215 -0
  249. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test2_test.cc +65 -0
  250. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.cc +1055 -0
  251. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.h +57 -0
  252. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-port_test.cc +1304 -0
  253. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-printers_test.cc +1635 -0
  254. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-test-part_test.cc +208 -0
  255. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-tuple_test.cc +320 -0
  256. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test2_test.cc +45 -0
  257. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.cc +380 -0
  258. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.h +66 -0
  259. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-unittest-api_test.cc +341 -0
  260. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_all_test.cc +47 -0
  261. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest.py +212 -0
  262. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest_.cc +88 -0
  263. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test.py +237 -0
  264. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test_.cc +311 -0
  265. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test.py +130 -0
  266. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test_.cc +71 -0
  267. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test.py +117 -0
  268. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test_.cc +126 -0
  269. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_environment_test.cc +192 -0
  270. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest.py +636 -0
  271. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest_.cc +140 -0
  272. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test.py +172 -0
  273. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test_.cc +46 -0
  274. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest.py +207 -0
  275. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest_.cc +157 -0
  276. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_main_unittest.cc +45 -0
  277. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_no_test_unittest.cc +56 -0
  278. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test.py +340 -0
  279. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_.cc +1062 -0
  280. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_golden_lin.txt +743 -0
  281. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_pred_impl_unittest.cc +2427 -0
  282. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_premature_exit_test.cc +127 -0
  283. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_prod_test.cc +57 -0
  284. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_repeat_test.cc +253 -0
  285. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test.py +325 -0
  286. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test_.cc +103 -0
  287. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_sole_header_test.cc +57 -0
  288. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_stress_test.cc +256 -0
  289. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_test_utils.py +320 -0
  290. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_ex_test.cc +92 -0
  291. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test.py +171 -0
  292. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test_.cc +72 -0
  293. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test.py +70 -0
  294. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test_.cc +43 -0
  295. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_unittest.cc +7706 -0
  296. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile1_test_.cc +49 -0
  297. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile2_test_.cc +49 -0
  298. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfiles_test.py +132 -0
  299. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest.py +308 -0
  300. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest_.cc +181 -0
  301. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_test_utils.py +194 -0
  302. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.cc +36 -0
  303. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.h +55 -0
  304. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/DebugProject.xcconfig +30 -0
  305. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/FrameworkTarget.xcconfig +17 -0
  306. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/General.xcconfig +41 -0
  307. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/ReleaseProject.xcconfig +32 -0
  308. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/StaticLibraryTarget.xcconfig +18 -0
  309. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/TestTarget.xcconfig +8 -0
  310. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Resources/Info.plist +30 -0
  311. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/Info.plist +28 -0
  312. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj +457 -0
  313. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/runtests.sh +62 -0
  314. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.cc +63 -0
  315. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.h +59 -0
  316. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget_test.cc +68 -0
  317. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/runtests.sh +65 -0
  318. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/versiongenerate.py +100 -0
  319. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj +1135 -0
  320. data/ext/rj_schema/rapidjson/thirdparty/gtest/travis.sh +15 -0
  321. data/ext/rj_schema/rj_schema.cpp +64 -41
  322. data/lib/rj_schema.rb +1 -1
  323. metadata +378 -5
@@ -0,0 +1,159 @@
1
+ // Copyright 2005, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // Author: wan@google.com (Zhanyong Wan)
31
+ //
32
+ // Tests for the Message class.
33
+
34
+ #include "gtest/gtest-message.h"
35
+
36
+ #include "gtest/gtest.h"
37
+
38
+ namespace {
39
+
40
+ using ::testing::Message;
41
+
42
+ // Tests the testing::Message class
43
+
44
+ // Tests the default constructor.
45
+ TEST(MessageTest, DefaultConstructor) {
46
+ const Message msg;
47
+ EXPECT_EQ("", msg.GetString());
48
+ }
49
+
50
+ // Tests the copy constructor.
51
+ TEST(MessageTest, CopyConstructor) {
52
+ const Message msg1("Hello");
53
+ const Message msg2(msg1);
54
+ EXPECT_EQ("Hello", msg2.GetString());
55
+ }
56
+
57
+ // Tests constructing a Message from a C-string.
58
+ TEST(MessageTest, ConstructsFromCString) {
59
+ Message msg("Hello");
60
+ EXPECT_EQ("Hello", msg.GetString());
61
+ }
62
+
63
+ // Tests streaming a float.
64
+ TEST(MessageTest, StreamsFloat) {
65
+ const std::string s = (Message() << 1.23456F << " " << 2.34567F).GetString();
66
+ // Both numbers should be printed with enough precision.
67
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "1.234560", s.c_str());
68
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, " 2.345669", s.c_str());
69
+ }
70
+
71
+ // Tests streaming a double.
72
+ TEST(MessageTest, StreamsDouble) {
73
+ const std::string s = (Message() << 1260570880.4555497 << " "
74
+ << 1260572265.1954534).GetString();
75
+ // Both numbers should be printed with enough precision.
76
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, "1260570880.45", s.c_str());
77
+ EXPECT_PRED_FORMAT2(testing::IsSubstring, " 1260572265.19", s.c_str());
78
+ }
79
+
80
+ // Tests streaming a non-char pointer.
81
+ TEST(MessageTest, StreamsPointer) {
82
+ int n = 0;
83
+ int* p = &n;
84
+ EXPECT_NE("(null)", (Message() << p).GetString());
85
+ }
86
+
87
+ // Tests streaming a NULL non-char pointer.
88
+ TEST(MessageTest, StreamsNullPointer) {
89
+ int* p = NULL;
90
+ EXPECT_EQ("(null)", (Message() << p).GetString());
91
+ }
92
+
93
+ // Tests streaming a C string.
94
+ TEST(MessageTest, StreamsCString) {
95
+ EXPECT_EQ("Foo", (Message() << "Foo").GetString());
96
+ }
97
+
98
+ // Tests streaming a NULL C string.
99
+ TEST(MessageTest, StreamsNullCString) {
100
+ char* p = NULL;
101
+ EXPECT_EQ("(null)", (Message() << p).GetString());
102
+ }
103
+
104
+ // Tests streaming std::string.
105
+ TEST(MessageTest, StreamsString) {
106
+ const ::std::string str("Hello");
107
+ EXPECT_EQ("Hello", (Message() << str).GetString());
108
+ }
109
+
110
+ // Tests that we can output strings containing embedded NULs.
111
+ TEST(MessageTest, StreamsStringWithEmbeddedNUL) {
112
+ const char char_array_with_nul[] =
113
+ "Here's a NUL\0 and some more string";
114
+ const ::std::string string_with_nul(char_array_with_nul,
115
+ sizeof(char_array_with_nul) - 1);
116
+ EXPECT_EQ("Here's a NUL\\0 and some more string",
117
+ (Message() << string_with_nul).GetString());
118
+ }
119
+
120
+ // Tests streaming a NUL char.
121
+ TEST(MessageTest, StreamsNULChar) {
122
+ EXPECT_EQ("\\0", (Message() << '\0').GetString());
123
+ }
124
+
125
+ // Tests streaming int.
126
+ TEST(MessageTest, StreamsInt) {
127
+ EXPECT_EQ("123", (Message() << 123).GetString());
128
+ }
129
+
130
+ // Tests that basic IO manipulators (endl, ends, and flush) can be
131
+ // streamed to Message.
132
+ TEST(MessageTest, StreamsBasicIoManip) {
133
+ EXPECT_EQ("Line 1.\nA NUL char \\0 in line 2.",
134
+ (Message() << "Line 1." << std::endl
135
+ << "A NUL char " << std::ends << std::flush
136
+ << " in line 2.").GetString());
137
+ }
138
+
139
+ // Tests Message::GetString()
140
+ TEST(MessageTest, GetString) {
141
+ Message msg;
142
+ msg << 1 << " lamb";
143
+ EXPECT_EQ("1 lamb", msg.GetString());
144
+ }
145
+
146
+ // Tests streaming a Message object to an ostream.
147
+ TEST(MessageTest, StreamsToOStream) {
148
+ Message msg("Hello");
149
+ ::std::stringstream ss;
150
+ ss << msg;
151
+ EXPECT_EQ("Hello", testing::internal::StringStreamToString(&ss));
152
+ }
153
+
154
+ // Tests that a Message object doesn't take up too much stack space.
155
+ TEST(MessageTest, DoesNotTakeUpMuchStackSpace) {
156
+ EXPECT_LE(sizeof(Message), 16U);
157
+ }
158
+
159
+ } // namespace
@@ -0,0 +1,215 @@
1
+ // Copyright 2008, 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
+ // Authors: keith.ray@gmail.com (Keith Ray)
31
+ //
32
+ // Google Test UnitTestOptions tests
33
+ //
34
+ // This file tests classes and functions used internally by
35
+ // Google Test. They are subject to change without notice.
36
+ //
37
+ // This file is #included from gtest.cc, to avoid changing build or
38
+ // make-files on Windows and other platforms. Do not #include this file
39
+ // anywhere else!
40
+
41
+ #include "gtest/gtest.h"
42
+
43
+ #if GTEST_OS_WINDOWS_MOBILE
44
+ # include <windows.h>
45
+ #elif GTEST_OS_WINDOWS
46
+ # include <direct.h>
47
+ #endif // GTEST_OS_WINDOWS_MOBILE
48
+
49
+ // Indicates that this translation unit is part of Google Test's
50
+ // implementation. It must come before gtest-internal-inl.h is
51
+ // included, or there will be a compiler error. This trick is to
52
+ // prevent a user from accidentally including gtest-internal-inl.h in
53
+ // his code.
54
+ #define GTEST_IMPLEMENTATION_ 1
55
+ #include "src/gtest-internal-inl.h"
56
+ #undef GTEST_IMPLEMENTATION_
57
+
58
+ namespace testing {
59
+ namespace internal {
60
+ namespace {
61
+
62
+ // Turns the given relative path into an absolute path.
63
+ FilePath GetAbsolutePathOf(const FilePath& relative_path) {
64
+ return FilePath::ConcatPaths(FilePath::GetCurrentDir(), relative_path);
65
+ }
66
+
67
+ // Testing UnitTestOptions::GetOutputFormat/GetOutputFile.
68
+
69
+ TEST(XmlOutputTest, GetOutputFormatDefault) {
70
+ GTEST_FLAG(output) = "";
71
+ EXPECT_STREQ("", UnitTestOptions::GetOutputFormat().c_str());
72
+ }
73
+
74
+ TEST(XmlOutputTest, GetOutputFormat) {
75
+ GTEST_FLAG(output) = "xml:filename";
76
+ EXPECT_STREQ("xml", UnitTestOptions::GetOutputFormat().c_str());
77
+ }
78
+
79
+ TEST(XmlOutputTest, GetOutputFileDefault) {
80
+ GTEST_FLAG(output) = "";
81
+ EXPECT_EQ(GetAbsolutePathOf(FilePath("test_detail.xml")).string(),
82
+ UnitTestOptions::GetAbsolutePathToOutputFile());
83
+ }
84
+
85
+ TEST(XmlOutputTest, GetOutputFileSingleFile) {
86
+ GTEST_FLAG(output) = "xml:filename.abc";
87
+ EXPECT_EQ(GetAbsolutePathOf(FilePath("filename.abc")).string(),
88
+ UnitTestOptions::GetAbsolutePathToOutputFile());
89
+ }
90
+
91
+ TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
92
+ GTEST_FLAG(output) = "xml:path" GTEST_PATH_SEP_;
93
+ const std::string expected_output_file =
94
+ GetAbsolutePathOf(
95
+ FilePath(std::string("path") + GTEST_PATH_SEP_ +
96
+ GetCurrentExecutableName().string() + ".xml")).string();
97
+ const std::string& output_file =
98
+ UnitTestOptions::GetAbsolutePathToOutputFile();
99
+ #if GTEST_OS_WINDOWS
100
+ EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());
101
+ #else
102
+ EXPECT_EQ(expected_output_file, output_file.c_str());
103
+ #endif
104
+ }
105
+
106
+ TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
107
+ const std::string exe_str = GetCurrentExecutableName().string();
108
+ #if GTEST_OS_WINDOWS
109
+ const bool success =
110
+ _strcmpi("gtest-options_test", exe_str.c_str()) == 0 ||
111
+ _strcmpi("gtest-options-ex_test", exe_str.c_str()) == 0 ||
112
+ _strcmpi("gtest_all_test", exe_str.c_str()) == 0 ||
113
+ _strcmpi("gtest_dll_test", exe_str.c_str()) == 0;
114
+ #else
115
+ // TODO(wan@google.com): remove the hard-coded "lt-" prefix when
116
+ // Chandler Carruth's libtool replacement is ready.
117
+ const bool success =
118
+ exe_str == "gtest-options_test" ||
119
+ exe_str == "gtest_all_test" ||
120
+ exe_str == "lt-gtest_all_test" ||
121
+ exe_str == "gtest_dll_test";
122
+ #endif // GTEST_OS_WINDOWS
123
+ if (!success)
124
+ FAIL() << "GetCurrentExecutableName() returns " << exe_str;
125
+ }
126
+
127
+ class XmlOutputChangeDirTest : public Test {
128
+ protected:
129
+ virtual void SetUp() {
130
+ original_working_dir_ = FilePath::GetCurrentDir();
131
+ posix::ChDir("..");
132
+ // This will make the test fail if run from the root directory.
133
+ EXPECT_NE(original_working_dir_.string(),
134
+ FilePath::GetCurrentDir().string());
135
+ }
136
+
137
+ virtual void TearDown() {
138
+ posix::ChDir(original_working_dir_.string().c_str());
139
+ }
140
+
141
+ FilePath original_working_dir_;
142
+ };
143
+
144
+ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefault) {
145
+ GTEST_FLAG(output) = "";
146
+ EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_,
147
+ FilePath("test_detail.xml")).string(),
148
+ UnitTestOptions::GetAbsolutePathToOutputFile());
149
+ }
150
+
151
+ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefaultXML) {
152
+ GTEST_FLAG(output) = "xml";
153
+ EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_,
154
+ FilePath("test_detail.xml")).string(),
155
+ UnitTestOptions::GetAbsolutePathToOutputFile());
156
+ }
157
+
158
+ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativeFile) {
159
+ GTEST_FLAG(output) = "xml:filename.abc";
160
+ EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_,
161
+ FilePath("filename.abc")).string(),
162
+ UnitTestOptions::GetAbsolutePathToOutputFile());
163
+ }
164
+
165
+ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {
166
+ GTEST_FLAG(output) = "xml:path" GTEST_PATH_SEP_;
167
+ const std::string expected_output_file =
168
+ FilePath::ConcatPaths(
169
+ original_working_dir_,
170
+ FilePath(std::string("path") + GTEST_PATH_SEP_ +
171
+ GetCurrentExecutableName().string() + ".xml")).string();
172
+ const std::string& output_file =
173
+ UnitTestOptions::GetAbsolutePathToOutputFile();
174
+ #if GTEST_OS_WINDOWS
175
+ EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());
176
+ #else
177
+ EXPECT_EQ(expected_output_file, output_file.c_str());
178
+ #endif
179
+ }
180
+
181
+ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsoluteFile) {
182
+ #if GTEST_OS_WINDOWS
183
+ GTEST_FLAG(output) = "xml:c:\\tmp\\filename.abc";
184
+ EXPECT_EQ(FilePath("c:\\tmp\\filename.abc").string(),
185
+ UnitTestOptions::GetAbsolutePathToOutputFile());
186
+ #else
187
+ GTEST_FLAG(output) ="xml:/tmp/filename.abc";
188
+ EXPECT_EQ(FilePath("/tmp/filename.abc").string(),
189
+ UnitTestOptions::GetAbsolutePathToOutputFile());
190
+ #endif
191
+ }
192
+
193
+ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) {
194
+ #if GTEST_OS_WINDOWS
195
+ const std::string path = "c:\\tmp\\";
196
+ #else
197
+ const std::string path = "/tmp/";
198
+ #endif
199
+
200
+ GTEST_FLAG(output) = "xml:" + path;
201
+ const std::string expected_output_file =
202
+ path + GetCurrentExecutableName().string() + ".xml";
203
+ const std::string& output_file =
204
+ UnitTestOptions::GetAbsolutePathToOutputFile();
205
+
206
+ #if GTEST_OS_WINDOWS
207
+ EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str());
208
+ #else
209
+ EXPECT_EQ(expected_output_file, output_file.c_str());
210
+ #endif
211
+ }
212
+
213
+ } // namespace
214
+ } // namespace internal
215
+ } // namespace testing
@@ -0,0 +1,65 @@
1
+ // Copyright 2008, 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: vladl@google.com (Vlad Losev)
31
+ //
32
+ // Tests for Google Test itself. This verifies that the basic constructs of
33
+ // Google Test work.
34
+
35
+ #include "gtest/gtest.h"
36
+
37
+ #include "test/gtest-param-test_test.h"
38
+
39
+ #if GTEST_HAS_PARAM_TEST
40
+
41
+ using ::testing::Values;
42
+ using ::testing::internal::ParamGenerator;
43
+
44
+ // Tests that generators defined in a different translation unit
45
+ // are functional. The test using extern_gen is defined
46
+ // in gtest-param-test_test.cc.
47
+ ParamGenerator<int> extern_gen = Values(33);
48
+
49
+ // Tests that a parameterized test case can be defined in one translation unit
50
+ // and instantiated in another. The test is defined in gtest-param-test_test.cc
51
+ // and ExternalInstantiationTest fixture class is defined in
52
+ // gtest-param-test_test.h.
53
+ INSTANTIATE_TEST_CASE_P(MultiplesOf33,
54
+ ExternalInstantiationTest,
55
+ Values(33, 66));
56
+
57
+ // Tests that a parameterized test case can be instantiated
58
+ // in multiple translation units. Another instantiation is defined
59
+ // in gtest-param-test_test.cc and InstantiationInMultipleTranslaionUnitsTest
60
+ // fixture is defined in gtest-param-test_test.h
61
+ INSTANTIATE_TEST_CASE_P(Sequence2,
62
+ InstantiationInMultipleTranslaionUnitsTest,
63
+ Values(42*3, 42*4, 42*5));
64
+
65
+ #endif // GTEST_HAS_PARAM_TEST
@@ -0,0 +1,1055 @@
1
+ // Copyright 2008, 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: vladl@google.com (Vlad Losev)
31
+ //
32
+ // Tests for Google Test itself. This file verifies that the parameter
33
+ // generators objects produce correct parameter sequences and that
34
+ // Google Test runtime instantiates correct tests from those sequences.
35
+
36
+ #include "gtest/gtest.h"
37
+
38
+ #if GTEST_HAS_PARAM_TEST
39
+
40
+ # include <algorithm>
41
+ # include <iostream>
42
+ # include <list>
43
+ # include <sstream>
44
+ # include <string>
45
+ # include <vector>
46
+
47
+ // To include gtest-internal-inl.h.
48
+ # define GTEST_IMPLEMENTATION_ 1
49
+ # include "src/gtest-internal-inl.h" // for UnitTestOptions
50
+ # undef GTEST_IMPLEMENTATION_
51
+
52
+ # include "test/gtest-param-test_test.h"
53
+
54
+ using ::std::vector;
55
+ using ::std::sort;
56
+
57
+ using ::testing::AddGlobalTestEnvironment;
58
+ using ::testing::Bool;
59
+ using ::testing::Message;
60
+ using ::testing::Range;
61
+ using ::testing::TestWithParam;
62
+ using ::testing::Values;
63
+ using ::testing::ValuesIn;
64
+
65
+ # if GTEST_HAS_COMBINE
66
+ using ::testing::Combine;
67
+ using ::testing::get;
68
+ using ::testing::make_tuple;
69
+ using ::testing::tuple;
70
+ # endif // GTEST_HAS_COMBINE
71
+
72
+ using ::testing::internal::ParamGenerator;
73
+ using ::testing::internal::UnitTestOptions;
74
+
75
+ // Prints a value to a string.
76
+ //
77
+ // TODO(wan@google.com): remove PrintValue() when we move matchers and
78
+ // EXPECT_THAT() from Google Mock to Google Test. At that time, we
79
+ // can write EXPECT_THAT(x, Eq(y)) to compare two tuples x and y, as
80
+ // EXPECT_THAT() and the matchers know how to print tuples.
81
+ template <typename T>
82
+ ::std::string PrintValue(const T& value) {
83
+ ::std::stringstream stream;
84
+ stream << value;
85
+ return stream.str();
86
+ }
87
+
88
+ # if GTEST_HAS_COMBINE
89
+
90
+ // These overloads allow printing tuples in our tests. We cannot
91
+ // define an operator<< for tuples, as that definition needs to be in
92
+ // the std namespace in order to be picked up by Google Test via
93
+ // Argument-Dependent Lookup, yet defining anything in the std
94
+ // namespace in non-STL code is undefined behavior.
95
+
96
+ template <typename T1, typename T2>
97
+ ::std::string PrintValue(const tuple<T1, T2>& value) {
98
+ ::std::stringstream stream;
99
+ stream << "(" << get<0>(value) << ", " << get<1>(value) << ")";
100
+ return stream.str();
101
+ }
102
+
103
+ template <typename T1, typename T2, typename T3>
104
+ ::std::string PrintValue(const tuple<T1, T2, T3>& value) {
105
+ ::std::stringstream stream;
106
+ stream << "(" << get<0>(value) << ", " << get<1>(value)
107
+ << ", "<< get<2>(value) << ")";
108
+ return stream.str();
109
+ }
110
+
111
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
112
+ typename T6, typename T7, typename T8, typename T9, typename T10>
113
+ ::std::string PrintValue(
114
+ const tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& value) {
115
+ ::std::stringstream stream;
116
+ stream << "(" << get<0>(value) << ", " << get<1>(value)
117
+ << ", "<< get<2>(value) << ", " << get<3>(value)
118
+ << ", "<< get<4>(value) << ", " << get<5>(value)
119
+ << ", "<< get<6>(value) << ", " << get<7>(value)
120
+ << ", "<< get<8>(value) << ", " << get<9>(value) << ")";
121
+ return stream.str();
122
+ }
123
+
124
+ # endif // GTEST_HAS_COMBINE
125
+
126
+ // Verifies that a sequence generated by the generator and accessed
127
+ // via the iterator object matches the expected one using Google Test
128
+ // assertions.
129
+ template <typename T, size_t N>
130
+ void VerifyGenerator(const ParamGenerator<T>& generator,
131
+ const T (&expected_values)[N]) {
132
+ typename ParamGenerator<T>::iterator it = generator.begin();
133
+ for (size_t i = 0; i < N; ++i) {
134
+ ASSERT_FALSE(it == generator.end())
135
+ << "At element " << i << " when accessing via an iterator "
136
+ << "created with the copy constructor.\n";
137
+ // We cannot use EXPECT_EQ() here as the values may be tuples,
138
+ // which don't support <<.
139
+ EXPECT_TRUE(expected_values[i] == *it)
140
+ << "where i is " << i
141
+ << ", expected_values[i] is " << PrintValue(expected_values[i])
142
+ << ", *it is " << PrintValue(*it)
143
+ << ", and 'it' is an iterator created with the copy constructor.\n";
144
+ it++;
145
+ }
146
+ EXPECT_TRUE(it == generator.end())
147
+ << "At the presumed end of sequence when accessing via an iterator "
148
+ << "created with the copy constructor.\n";
149
+
150
+ // Test the iterator assignment. The following lines verify that
151
+ // the sequence accessed via an iterator initialized via the
152
+ // assignment operator (as opposed to a copy constructor) matches
153
+ // just the same.
154
+ it = generator.begin();
155
+ for (size_t i = 0; i < N; ++i) {
156
+ ASSERT_FALSE(it == generator.end())
157
+ << "At element " << i << " when accessing via an iterator "
158
+ << "created with the assignment operator.\n";
159
+ EXPECT_TRUE(expected_values[i] == *it)
160
+ << "where i is " << i
161
+ << ", expected_values[i] is " << PrintValue(expected_values[i])
162
+ << ", *it is " << PrintValue(*it)
163
+ << ", and 'it' is an iterator created with the copy constructor.\n";
164
+ it++;
165
+ }
166
+ EXPECT_TRUE(it == generator.end())
167
+ << "At the presumed end of sequence when accessing via an iterator "
168
+ << "created with the assignment operator.\n";
169
+ }
170
+
171
+ template <typename T>
172
+ void VerifyGeneratorIsEmpty(const ParamGenerator<T>& generator) {
173
+ typename ParamGenerator<T>::iterator it = generator.begin();
174
+ EXPECT_TRUE(it == generator.end());
175
+
176
+ it = generator.begin();
177
+ EXPECT_TRUE(it == generator.end());
178
+ }
179
+
180
+ // Generator tests. They test that each of the provided generator functions
181
+ // generates an expected sequence of values. The general test pattern
182
+ // instantiates a generator using one of the generator functions,
183
+ // checks the sequence produced by the generator using its iterator API,
184
+ // and then resets the iterator back to the beginning of the sequence
185
+ // and checks the sequence again.
186
+
187
+ // Tests that iterators produced by generator functions conform to the
188
+ // ForwardIterator concept.
189
+ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {
190
+ const ParamGenerator<int> gen = Range(0, 10);
191
+ ParamGenerator<int>::iterator it = gen.begin();
192
+
193
+ // Verifies that iterator initialization works as expected.
194
+ ParamGenerator<int>::iterator it2 = it;
195
+ EXPECT_TRUE(*it == *it2) << "Initialized iterators must point to the "
196
+ << "element same as its source points to";
197
+
198
+ // Verifies that iterator assignment works as expected.
199
+ it++;
200
+ EXPECT_FALSE(*it == *it2);
201
+ it2 = it;
202
+ EXPECT_TRUE(*it == *it2) << "Assigned iterators must point to the "
203
+ << "element same as its source points to";
204
+
205
+ // Verifies that prefix operator++() returns *this.
206
+ EXPECT_EQ(&it, &(++it)) << "Result of the prefix operator++ must be "
207
+ << "refer to the original object";
208
+
209
+ // Verifies that the result of the postfix operator++ points to the value
210
+ // pointed to by the original iterator.
211
+ int original_value = *it; // Have to compute it outside of macro call to be
212
+ // unaffected by the parameter evaluation order.
213
+ EXPECT_EQ(original_value, *(it++));
214
+
215
+ // Verifies that prefix and postfix operator++() advance an iterator
216
+ // all the same.
217
+ it2 = it;
218
+ it++;
219
+ ++it2;
220
+ EXPECT_TRUE(*it == *it2);
221
+ }
222
+
223
+ // Tests that Range() generates the expected sequence.
224
+ TEST(RangeTest, IntRangeWithDefaultStep) {
225
+ const ParamGenerator<int> gen = Range(0, 3);
226
+ const int expected_values[] = {0, 1, 2};
227
+ VerifyGenerator(gen, expected_values);
228
+ }
229
+
230
+ // Edge case. Tests that Range() generates the single element sequence
231
+ // as expected when provided with range limits that are equal.
232
+ TEST(RangeTest, IntRangeSingleValue) {
233
+ const ParamGenerator<int> gen = Range(0, 1);
234
+ const int expected_values[] = {0};
235
+ VerifyGenerator(gen, expected_values);
236
+ }
237
+
238
+ // Edge case. Tests that Range() with generates empty sequence when
239
+ // supplied with an empty range.
240
+ TEST(RangeTest, IntRangeEmpty) {
241
+ const ParamGenerator<int> gen = Range(0, 0);
242
+ VerifyGeneratorIsEmpty(gen);
243
+ }
244
+
245
+ // Tests that Range() with custom step (greater then one) generates
246
+ // the expected sequence.
247
+ TEST(RangeTest, IntRangeWithCustomStep) {
248
+ const ParamGenerator<int> gen = Range(0, 9, 3);
249
+ const int expected_values[] = {0, 3, 6};
250
+ VerifyGenerator(gen, expected_values);
251
+ }
252
+
253
+ // Tests that Range() with custom step (greater then one) generates
254
+ // the expected sequence when the last element does not fall on the
255
+ // upper range limit. Sequences generated by Range() must not have
256
+ // elements beyond the range limits.
257
+ TEST(RangeTest, IntRangeWithCustomStepOverUpperBound) {
258
+ const ParamGenerator<int> gen = Range(0, 4, 3);
259
+ const int expected_values[] = {0, 3};
260
+ VerifyGenerator(gen, expected_values);
261
+ }
262
+
263
+ // Verifies that Range works with user-defined types that define
264
+ // copy constructor, operator=(), operator+(), and operator<().
265
+ class DogAdder {
266
+ public:
267
+ explicit DogAdder(const char* a_value) : value_(a_value) {}
268
+ DogAdder(const DogAdder& other) : value_(other.value_.c_str()) {}
269
+
270
+ DogAdder operator=(const DogAdder& other) {
271
+ if (this != &other)
272
+ value_ = other.value_;
273
+ return *this;
274
+ }
275
+ DogAdder operator+(const DogAdder& other) const {
276
+ Message msg;
277
+ msg << value_.c_str() << other.value_.c_str();
278
+ return DogAdder(msg.GetString().c_str());
279
+ }
280
+ bool operator<(const DogAdder& other) const {
281
+ return value_ < other.value_;
282
+ }
283
+ const std::string& value() const { return value_; }
284
+
285
+ private:
286
+ std::string value_;
287
+ };
288
+
289
+ TEST(RangeTest, WorksWithACustomType) {
290
+ const ParamGenerator<DogAdder> gen =
291
+ Range(DogAdder("cat"), DogAdder("catdogdog"), DogAdder("dog"));
292
+ ParamGenerator<DogAdder>::iterator it = gen.begin();
293
+
294
+ ASSERT_FALSE(it == gen.end());
295
+ EXPECT_STREQ("cat", it->value().c_str());
296
+
297
+ ASSERT_FALSE(++it == gen.end());
298
+ EXPECT_STREQ("catdog", it->value().c_str());
299
+
300
+ EXPECT_TRUE(++it == gen.end());
301
+ }
302
+
303
+ class IntWrapper {
304
+ public:
305
+ explicit IntWrapper(int a_value) : value_(a_value) {}
306
+ IntWrapper(const IntWrapper& other) : value_(other.value_) {}
307
+
308
+ IntWrapper operator=(const IntWrapper& other) {
309
+ value_ = other.value_;
310
+ return *this;
311
+ }
312
+ // operator+() adds a different type.
313
+ IntWrapper operator+(int other) const { return IntWrapper(value_ + other); }
314
+ bool operator<(const IntWrapper& other) const {
315
+ return value_ < other.value_;
316
+ }
317
+ int value() const { return value_; }
318
+
319
+ private:
320
+ int value_;
321
+ };
322
+
323
+ TEST(RangeTest, WorksWithACustomTypeWithDifferentIncrementType) {
324
+ const ParamGenerator<IntWrapper> gen = Range(IntWrapper(0), IntWrapper(2));
325
+ ParamGenerator<IntWrapper>::iterator it = gen.begin();
326
+
327
+ ASSERT_FALSE(it == gen.end());
328
+ EXPECT_EQ(0, it->value());
329
+
330
+ ASSERT_FALSE(++it == gen.end());
331
+ EXPECT_EQ(1, it->value());
332
+
333
+ EXPECT_TRUE(++it == gen.end());
334
+ }
335
+
336
+ // Tests that ValuesIn() with an array parameter generates
337
+ // the expected sequence.
338
+ TEST(ValuesInTest, ValuesInArray) {
339
+ int array[] = {3, 5, 8};
340
+ const ParamGenerator<int> gen = ValuesIn(array);
341
+ VerifyGenerator(gen, array);
342
+ }
343
+
344
+ // Tests that ValuesIn() with a const array parameter generates
345
+ // the expected sequence.
346
+ TEST(ValuesInTest, ValuesInConstArray) {
347
+ const int array[] = {3, 5, 8};
348
+ const ParamGenerator<int> gen = ValuesIn(array);
349
+ VerifyGenerator(gen, array);
350
+ }
351
+
352
+ // Edge case. Tests that ValuesIn() with an array parameter containing a
353
+ // single element generates the single element sequence.
354
+ TEST(ValuesInTest, ValuesInSingleElementArray) {
355
+ int array[] = {42};
356
+ const ParamGenerator<int> gen = ValuesIn(array);
357
+ VerifyGenerator(gen, array);
358
+ }
359
+
360
+ // Tests that ValuesIn() generates the expected sequence for an STL
361
+ // container (vector).
362
+ TEST(ValuesInTest, ValuesInVector) {
363
+ typedef ::std::vector<int> ContainerType;
364
+ ContainerType values;
365
+ values.push_back(3);
366
+ values.push_back(5);
367
+ values.push_back(8);
368
+ const ParamGenerator<int> gen = ValuesIn(values);
369
+
370
+ const int expected_values[] = {3, 5, 8};
371
+ VerifyGenerator(gen, expected_values);
372
+ }
373
+
374
+ // Tests that ValuesIn() generates the expected sequence.
375
+ TEST(ValuesInTest, ValuesInIteratorRange) {
376
+ typedef ::std::vector<int> ContainerType;
377
+ ContainerType values;
378
+ values.push_back(3);
379
+ values.push_back(5);
380
+ values.push_back(8);
381
+ const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());
382
+
383
+ const int expected_values[] = {3, 5, 8};
384
+ VerifyGenerator(gen, expected_values);
385
+ }
386
+
387
+ // Edge case. Tests that ValuesIn() provided with an iterator range specifying a
388
+ // single value generates a single-element sequence.
389
+ TEST(ValuesInTest, ValuesInSingleElementIteratorRange) {
390
+ typedef ::std::vector<int> ContainerType;
391
+ ContainerType values;
392
+ values.push_back(42);
393
+ const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());
394
+
395
+ const int expected_values[] = {42};
396
+ VerifyGenerator(gen, expected_values);
397
+ }
398
+
399
+ // Edge case. Tests that ValuesIn() provided with an empty iterator range
400
+ // generates an empty sequence.
401
+ TEST(ValuesInTest, ValuesInEmptyIteratorRange) {
402
+ typedef ::std::vector<int> ContainerType;
403
+ ContainerType values;
404
+ const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());
405
+
406
+ VerifyGeneratorIsEmpty(gen);
407
+ }
408
+
409
+ // Tests that the Values() generates the expected sequence.
410
+ TEST(ValuesTest, ValuesWorks) {
411
+ const ParamGenerator<int> gen = Values(3, 5, 8);
412
+
413
+ const int expected_values[] = {3, 5, 8};
414
+ VerifyGenerator(gen, expected_values);
415
+ }
416
+
417
+ // Tests that Values() generates the expected sequences from elements of
418
+ // different types convertible to ParamGenerator's parameter type.
419
+ TEST(ValuesTest, ValuesWorksForValuesOfCompatibleTypes) {
420
+ const ParamGenerator<double> gen = Values(3, 5.0f, 8.0);
421
+
422
+ const double expected_values[] = {3.0, 5.0, 8.0};
423
+ VerifyGenerator(gen, expected_values);
424
+ }
425
+
426
+ TEST(ValuesTest, ValuesWorksForMaxLengthList) {
427
+ const ParamGenerator<int> gen = Values(
428
+ 10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
429
+ 110, 120, 130, 140, 150, 160, 170, 180, 190, 200,
430
+ 210, 220, 230, 240, 250, 260, 270, 280, 290, 300,
431
+ 310, 320, 330, 340, 350, 360, 370, 380, 390, 400,
432
+ 410, 420, 430, 440, 450, 460, 470, 480, 490, 500);
433
+
434
+ const int expected_values[] = {
435
+ 10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
436
+ 110, 120, 130, 140, 150, 160, 170, 180, 190, 200,
437
+ 210, 220, 230, 240, 250, 260, 270, 280, 290, 300,
438
+ 310, 320, 330, 340, 350, 360, 370, 380, 390, 400,
439
+ 410, 420, 430, 440, 450, 460, 470, 480, 490, 500};
440
+ VerifyGenerator(gen, expected_values);
441
+ }
442
+
443
+ // Edge case test. Tests that single-parameter Values() generates the sequence
444
+ // with the single value.
445
+ TEST(ValuesTest, ValuesWithSingleParameter) {
446
+ const ParamGenerator<int> gen = Values(42);
447
+
448
+ const int expected_values[] = {42};
449
+ VerifyGenerator(gen, expected_values);
450
+ }
451
+
452
+ // Tests that Bool() generates sequence (false, true).
453
+ TEST(BoolTest, BoolWorks) {
454
+ const ParamGenerator<bool> gen = Bool();
455
+
456
+ const bool expected_values[] = {false, true};
457
+ VerifyGenerator(gen, expected_values);
458
+ }
459
+
460
+ # if GTEST_HAS_COMBINE
461
+
462
+ // Tests that Combine() with two parameters generates the expected sequence.
463
+ TEST(CombineTest, CombineWithTwoParameters) {
464
+ const char* foo = "foo";
465
+ const char* bar = "bar";
466
+ const ParamGenerator<tuple<const char*, int> > gen =
467
+ Combine(Values(foo, bar), Values(3, 4));
468
+
469
+ tuple<const char*, int> expected_values[] = {
470
+ make_tuple(foo, 3), make_tuple(foo, 4),
471
+ make_tuple(bar, 3), make_tuple(bar, 4)};
472
+ VerifyGenerator(gen, expected_values);
473
+ }
474
+
475
+ // Tests that Combine() with three parameters generates the expected sequence.
476
+ TEST(CombineTest, CombineWithThreeParameters) {
477
+ const ParamGenerator<tuple<int, int, int> > gen = Combine(Values(0, 1),
478
+ Values(3, 4),
479
+ Values(5, 6));
480
+ tuple<int, int, int> expected_values[] = {
481
+ make_tuple(0, 3, 5), make_tuple(0, 3, 6),
482
+ make_tuple(0, 4, 5), make_tuple(0, 4, 6),
483
+ make_tuple(1, 3, 5), make_tuple(1, 3, 6),
484
+ make_tuple(1, 4, 5), make_tuple(1, 4, 6)};
485
+ VerifyGenerator(gen, expected_values);
486
+ }
487
+
488
+ // Tests that the Combine() with the first parameter generating a single value
489
+ // sequence generates a sequence with the number of elements equal to the
490
+ // number of elements in the sequence generated by the second parameter.
491
+ TEST(CombineTest, CombineWithFirstParameterSingleValue) {
492
+ const ParamGenerator<tuple<int, int> > gen = Combine(Values(42),
493
+ Values(0, 1));
494
+
495
+ tuple<int, int> expected_values[] = {make_tuple(42, 0), make_tuple(42, 1)};
496
+ VerifyGenerator(gen, expected_values);
497
+ }
498
+
499
+ // Tests that the Combine() with the second parameter generating a single value
500
+ // sequence generates a sequence with the number of elements equal to the
501
+ // number of elements in the sequence generated by the first parameter.
502
+ TEST(CombineTest, CombineWithSecondParameterSingleValue) {
503
+ const ParamGenerator<tuple<int, int> > gen = Combine(Values(0, 1),
504
+ Values(42));
505
+
506
+ tuple<int, int> expected_values[] = {make_tuple(0, 42), make_tuple(1, 42)};
507
+ VerifyGenerator(gen, expected_values);
508
+ }
509
+
510
+ // Tests that when the first parameter produces an empty sequence,
511
+ // Combine() produces an empty sequence, too.
512
+ TEST(CombineTest, CombineWithFirstParameterEmptyRange) {
513
+ const ParamGenerator<tuple<int, int> > gen = Combine(Range(0, 0),
514
+ Values(0, 1));
515
+ VerifyGeneratorIsEmpty(gen);
516
+ }
517
+
518
+ // Tests that when the second parameter produces an empty sequence,
519
+ // Combine() produces an empty sequence, too.
520
+ TEST(CombineTest, CombineWithSecondParameterEmptyRange) {
521
+ const ParamGenerator<tuple<int, int> > gen = Combine(Values(0, 1),
522
+ Range(1, 1));
523
+ VerifyGeneratorIsEmpty(gen);
524
+ }
525
+
526
+ // Edge case. Tests that combine works with the maximum number
527
+ // of parameters supported by Google Test (currently 10).
528
+ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
529
+ const char* foo = "foo";
530
+ const char* bar = "bar";
531
+ const ParamGenerator<tuple<const char*, int, int, int, int, int, int, int,
532
+ int, int> > gen = Combine(Values(foo, bar),
533
+ Values(1), Values(2),
534
+ Values(3), Values(4),
535
+ Values(5), Values(6),
536
+ Values(7), Values(8),
537
+ Values(9));
538
+
539
+ tuple<const char*, int, int, int, int, int, int, int, int, int>
540
+ expected_values[] = {make_tuple(foo, 1, 2, 3, 4, 5, 6, 7, 8, 9),
541
+ make_tuple(bar, 1, 2, 3, 4, 5, 6, 7, 8, 9)};
542
+ VerifyGenerator(gen, expected_values);
543
+ }
544
+
545
+ # endif // GTEST_HAS_COMBINE
546
+
547
+ // Tests that an generator produces correct sequence after being
548
+ // assigned from another generator.
549
+ TEST(ParamGeneratorTest, AssignmentWorks) {
550
+ ParamGenerator<int> gen = Values(1, 2);
551
+ const ParamGenerator<int> gen2 = Values(3, 4);
552
+ gen = gen2;
553
+
554
+ const int expected_values[] = {3, 4};
555
+ VerifyGenerator(gen, expected_values);
556
+ }
557
+
558
+ // This test verifies that the tests are expanded and run as specified:
559
+ // one test per element from the sequence produced by the generator
560
+ // specified in INSTANTIATE_TEST_CASE_P. It also verifies that the test's
561
+ // fixture constructor, SetUp(), and TearDown() have run and have been
562
+ // supplied with the correct parameters.
563
+
564
+ // The use of environment object allows detection of the case where no test
565
+ // case functionality is run at all. In this case TestCaseTearDown will not
566
+ // be able to detect missing tests, naturally.
567
+ template <int kExpectedCalls>
568
+ class TestGenerationEnvironment : public ::testing::Environment {
569
+ public:
570
+ static TestGenerationEnvironment* Instance() {
571
+ static TestGenerationEnvironment* instance = new TestGenerationEnvironment;
572
+ return instance;
573
+ }
574
+
575
+ void FixtureConstructorExecuted() { fixture_constructor_count_++; }
576
+ void SetUpExecuted() { set_up_count_++; }
577
+ void TearDownExecuted() { tear_down_count_++; }
578
+ void TestBodyExecuted() { test_body_count_++; }
579
+
580
+ virtual void TearDown() {
581
+ // If all MultipleTestGenerationTest tests have been de-selected
582
+ // by the filter flag, the following checks make no sense.
583
+ bool perform_check = false;
584
+
585
+ for (int i = 0; i < kExpectedCalls; ++i) {
586
+ Message msg;
587
+ msg << "TestsExpandedAndRun/" << i;
588
+ if (UnitTestOptions::FilterMatchesTest(
589
+ "TestExpansionModule/MultipleTestGenerationTest",
590
+ msg.GetString().c_str())) {
591
+ perform_check = true;
592
+ }
593
+ }
594
+ if (perform_check) {
595
+ EXPECT_EQ(kExpectedCalls, fixture_constructor_count_)
596
+ << "Fixture constructor of ParamTestGenerationTest test case "
597
+ << "has not been run as expected.";
598
+ EXPECT_EQ(kExpectedCalls, set_up_count_)
599
+ << "Fixture SetUp method of ParamTestGenerationTest test case "
600
+ << "has not been run as expected.";
601
+ EXPECT_EQ(kExpectedCalls, tear_down_count_)
602
+ << "Fixture TearDown method of ParamTestGenerationTest test case "
603
+ << "has not been run as expected.";
604
+ EXPECT_EQ(kExpectedCalls, test_body_count_)
605
+ << "Test in ParamTestGenerationTest test case "
606
+ << "has not been run as expected.";
607
+ }
608
+ }
609
+
610
+ private:
611
+ TestGenerationEnvironment() : fixture_constructor_count_(0), set_up_count_(0),
612
+ tear_down_count_(0), test_body_count_(0) {}
613
+
614
+ int fixture_constructor_count_;
615
+ int set_up_count_;
616
+ int tear_down_count_;
617
+ int test_body_count_;
618
+
619
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationEnvironment);
620
+ };
621
+
622
+ const int test_generation_params[] = {36, 42, 72};
623
+
624
+ class TestGenerationTest : public TestWithParam<int> {
625
+ public:
626
+ enum {
627
+ PARAMETER_COUNT =
628
+ sizeof(test_generation_params)/sizeof(test_generation_params[0])
629
+ };
630
+
631
+ typedef TestGenerationEnvironment<PARAMETER_COUNT> Environment;
632
+
633
+ TestGenerationTest() {
634
+ Environment::Instance()->FixtureConstructorExecuted();
635
+ current_parameter_ = GetParam();
636
+ }
637
+ virtual void SetUp() {
638
+ Environment::Instance()->SetUpExecuted();
639
+ EXPECT_EQ(current_parameter_, GetParam());
640
+ }
641
+ virtual void TearDown() {
642
+ Environment::Instance()->TearDownExecuted();
643
+ EXPECT_EQ(current_parameter_, GetParam());
644
+ }
645
+
646
+ static void SetUpTestCase() {
647
+ bool all_tests_in_test_case_selected = true;
648
+
649
+ for (int i = 0; i < PARAMETER_COUNT; ++i) {
650
+ Message test_name;
651
+ test_name << "TestsExpandedAndRun/" << i;
652
+ if ( !UnitTestOptions::FilterMatchesTest(
653
+ "TestExpansionModule/MultipleTestGenerationTest",
654
+ test_name.GetString())) {
655
+ all_tests_in_test_case_selected = false;
656
+ }
657
+ }
658
+ EXPECT_TRUE(all_tests_in_test_case_selected)
659
+ << "When running the TestGenerationTest test case all of its tests\n"
660
+ << "must be selected by the filter flag for the test case to pass.\n"
661
+ << "If not all of them are enabled, we can't reliably conclude\n"
662
+ << "that the correct number of tests have been generated.";
663
+
664
+ collected_parameters_.clear();
665
+ }
666
+
667
+ static void TearDownTestCase() {
668
+ vector<int> expected_values(test_generation_params,
669
+ test_generation_params + PARAMETER_COUNT);
670
+ // Test execution order is not guaranteed by Google Test,
671
+ // so the order of values in collected_parameters_ can be
672
+ // different and we have to sort to compare.
673
+ sort(expected_values.begin(), expected_values.end());
674
+ sort(collected_parameters_.begin(), collected_parameters_.end());
675
+
676
+ EXPECT_TRUE(collected_parameters_ == expected_values);
677
+ }
678
+
679
+ protected:
680
+ int current_parameter_;
681
+ static vector<int> collected_parameters_;
682
+
683
+ private:
684
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationTest);
685
+ };
686
+ vector<int> TestGenerationTest::collected_parameters_;
687
+
688
+ TEST_P(TestGenerationTest, TestsExpandedAndRun) {
689
+ Environment::Instance()->TestBodyExecuted();
690
+ EXPECT_EQ(current_parameter_, GetParam());
691
+ collected_parameters_.push_back(GetParam());
692
+ }
693
+ INSTANTIATE_TEST_CASE_P(TestExpansionModule, TestGenerationTest,
694
+ ValuesIn(test_generation_params));
695
+
696
+ // This test verifies that the element sequence (third parameter of
697
+ // INSTANTIATE_TEST_CASE_P) is evaluated in InitGoogleTest() and neither at
698
+ // the call site of INSTANTIATE_TEST_CASE_P nor in RUN_ALL_TESTS(). For
699
+ // that, we declare param_value_ to be a static member of
700
+ // GeneratorEvaluationTest and initialize it to 0. We set it to 1 in
701
+ // main(), just before invocation of InitGoogleTest(). After calling
702
+ // InitGoogleTest(), we set the value to 2. If the sequence is evaluated
703
+ // before or after InitGoogleTest, INSTANTIATE_TEST_CASE_P will create a
704
+ // test with parameter other than 1, and the test body will fail the
705
+ // assertion.
706
+ class GeneratorEvaluationTest : public TestWithParam<int> {
707
+ public:
708
+ static int param_value() { return param_value_; }
709
+ static void set_param_value(int param_value) { param_value_ = param_value; }
710
+
711
+ private:
712
+ static int param_value_;
713
+ };
714
+ int GeneratorEvaluationTest::param_value_ = 0;
715
+
716
+ TEST_P(GeneratorEvaluationTest, GeneratorsEvaluatedInMain) {
717
+ EXPECT_EQ(1, GetParam());
718
+ }
719
+ INSTANTIATE_TEST_CASE_P(GenEvalModule,
720
+ GeneratorEvaluationTest,
721
+ Values(GeneratorEvaluationTest::param_value()));
722
+
723
+ // Tests that generators defined in a different translation unit are
724
+ // functional. Generator extern_gen is defined in gtest-param-test_test2.cc.
725
+ extern ParamGenerator<int> extern_gen;
726
+ class ExternalGeneratorTest : public TestWithParam<int> {};
727
+ TEST_P(ExternalGeneratorTest, ExternalGenerator) {
728
+ // Sequence produced by extern_gen contains only a single value
729
+ // which we verify here.
730
+ EXPECT_EQ(GetParam(), 33);
731
+ }
732
+ INSTANTIATE_TEST_CASE_P(ExternalGeneratorModule,
733
+ ExternalGeneratorTest,
734
+ extern_gen);
735
+
736
+ // Tests that a parameterized test case can be defined in one translation
737
+ // unit and instantiated in another. This test will be instantiated in
738
+ // gtest-param-test_test2.cc. ExternalInstantiationTest fixture class is
739
+ // defined in gtest-param-test_test.h.
740
+ TEST_P(ExternalInstantiationTest, IsMultipleOf33) {
741
+ EXPECT_EQ(0, GetParam() % 33);
742
+ }
743
+
744
+ // Tests that a parameterized test case can be instantiated with multiple
745
+ // generators.
746
+ class MultipleInstantiationTest : public TestWithParam<int> {};
747
+ TEST_P(MultipleInstantiationTest, AllowsMultipleInstances) {
748
+ }
749
+ INSTANTIATE_TEST_CASE_P(Sequence1, MultipleInstantiationTest, Values(1, 2));
750
+ INSTANTIATE_TEST_CASE_P(Sequence2, MultipleInstantiationTest, Range(3, 5));
751
+
752
+ // Tests that a parameterized test case can be instantiated
753
+ // in multiple translation units. This test will be instantiated
754
+ // here and in gtest-param-test_test2.cc.
755
+ // InstantiationInMultipleTranslationUnitsTest fixture class
756
+ // is defined in gtest-param-test_test.h.
757
+ TEST_P(InstantiationInMultipleTranslaionUnitsTest, IsMultipleOf42) {
758
+ EXPECT_EQ(0, GetParam() % 42);
759
+ }
760
+ INSTANTIATE_TEST_CASE_P(Sequence1,
761
+ InstantiationInMultipleTranslaionUnitsTest,
762
+ Values(42, 42*2));
763
+
764
+ // Tests that each iteration of parameterized test runs in a separate test
765
+ // object.
766
+ class SeparateInstanceTest : public TestWithParam<int> {
767
+ public:
768
+ SeparateInstanceTest() : count_(0) {}
769
+
770
+ static void TearDownTestCase() {
771
+ EXPECT_GE(global_count_, 2)
772
+ << "If some (but not all) SeparateInstanceTest tests have been "
773
+ << "filtered out this test will fail. Make sure that all "
774
+ << "GeneratorEvaluationTest are selected or de-selected together "
775
+ << "by the test filter.";
776
+ }
777
+
778
+ protected:
779
+ int count_;
780
+ static int global_count_;
781
+ };
782
+ int SeparateInstanceTest::global_count_ = 0;
783
+
784
+ TEST_P(SeparateInstanceTest, TestsRunInSeparateInstances) {
785
+ EXPECT_EQ(0, count_++);
786
+ global_count_++;
787
+ }
788
+ INSTANTIATE_TEST_CASE_P(FourElemSequence, SeparateInstanceTest, Range(1, 4));
789
+
790
+ // Tests that all instantiations of a test have named appropriately. Test
791
+ // defined with TEST_P(TestCaseName, TestName) and instantiated with
792
+ // INSTANTIATE_TEST_CASE_P(SequenceName, TestCaseName, generator) must be named
793
+ // SequenceName/TestCaseName.TestName/i, where i is the 0-based index of the
794
+ // sequence element used to instantiate the test.
795
+ class NamingTest : public TestWithParam<int> {};
796
+
797
+ TEST_P(NamingTest, TestsReportCorrectNamesAndParameters) {
798
+ const ::testing::TestInfo* const test_info =
799
+ ::testing::UnitTest::GetInstance()->current_test_info();
800
+
801
+ EXPECT_STREQ("ZeroToFiveSequence/NamingTest", test_info->test_case_name());
802
+
803
+ Message index_stream;
804
+ index_stream << "TestsReportCorrectNamesAndParameters/" << GetParam();
805
+ EXPECT_STREQ(index_stream.GetString().c_str(), test_info->name());
806
+
807
+ EXPECT_EQ(::testing::PrintToString(GetParam()), test_info->value_param());
808
+ }
809
+
810
+ INSTANTIATE_TEST_CASE_P(ZeroToFiveSequence, NamingTest, Range(0, 5));
811
+
812
+ // Tests that user supplied custom parameter names are working correctly.
813
+ // Runs the test with a builtin helper method which uses PrintToString,
814
+ // as well as a custom function and custom functor to ensure all possible
815
+ // uses work correctly.
816
+ class CustomFunctorNamingTest : public TestWithParam<std::string> {};
817
+ TEST_P(CustomFunctorNamingTest, CustomTestNames) {}
818
+
819
+ struct CustomParamNameFunctor {
820
+ std::string operator()(const ::testing::TestParamInfo<std::string>& info) {
821
+ return info.param;
822
+ }
823
+ };
824
+
825
+ INSTANTIATE_TEST_CASE_P(CustomParamNameFunctor,
826
+ CustomFunctorNamingTest,
827
+ Values(std::string("FunctorName")),
828
+ CustomParamNameFunctor());
829
+
830
+ INSTANTIATE_TEST_CASE_P(AllAllowedCharacters,
831
+ CustomFunctorNamingTest,
832
+ Values("abcdefghijklmnopqrstuvwxyz",
833
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
834
+ "01234567890_"),
835
+ CustomParamNameFunctor());
836
+
837
+ inline std::string CustomParamNameFunction(
838
+ const ::testing::TestParamInfo<std::string>& info) {
839
+ return info.param;
840
+ }
841
+
842
+ class CustomFunctionNamingTest : public TestWithParam<std::string> {};
843
+ TEST_P(CustomFunctionNamingTest, CustomTestNames) {}
844
+
845
+ INSTANTIATE_TEST_CASE_P(CustomParamNameFunction,
846
+ CustomFunctionNamingTest,
847
+ Values(std::string("FunctionName")),
848
+ CustomParamNameFunction);
849
+
850
+ #if GTEST_LANG_CXX11
851
+
852
+ // Test custom naming with a lambda
853
+
854
+ class CustomLambdaNamingTest : public TestWithParam<std::string> {};
855
+ TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
856
+
857
+ INSTANTIATE_TEST_CASE_P(CustomParamNameLambda,
858
+ CustomLambdaNamingTest,
859
+ Values(std::string("LambdaName")),
860
+ [](const ::testing::TestParamInfo<std::string>& info) {
861
+ return info.param;
862
+ });
863
+
864
+ #endif // GTEST_LANG_CXX11
865
+
866
+ TEST(CustomNamingTest, CheckNameRegistry) {
867
+ ::testing::UnitTest* unit_test = ::testing::UnitTest::GetInstance();
868
+ std::set<std::string> test_names;
869
+ for (int case_num = 0;
870
+ case_num < unit_test->total_test_case_count();
871
+ ++case_num) {
872
+ const ::testing::TestCase* test_case = unit_test->GetTestCase(case_num);
873
+ for (int test_num = 0;
874
+ test_num < test_case->total_test_count();
875
+ ++test_num) {
876
+ const ::testing::TestInfo* test_info = test_case->GetTestInfo(test_num);
877
+ test_names.insert(std::string(test_info->name()));
878
+ }
879
+ }
880
+ EXPECT_EQ(1u, test_names.count("CustomTestNames/FunctorName"));
881
+ EXPECT_EQ(1u, test_names.count("CustomTestNames/FunctionName"));
882
+ #if GTEST_LANG_CXX11
883
+ EXPECT_EQ(1u, test_names.count("CustomTestNames/LambdaName"));
884
+ #endif // GTEST_LANG_CXX11
885
+ }
886
+
887
+ // Test a numeric name to ensure PrintToStringParamName works correctly.
888
+
889
+ class CustomIntegerNamingTest : public TestWithParam<int> {};
890
+
891
+ TEST_P(CustomIntegerNamingTest, TestsReportCorrectNames) {
892
+ const ::testing::TestInfo* const test_info =
893
+ ::testing::UnitTest::GetInstance()->current_test_info();
894
+ Message test_name_stream;
895
+ test_name_stream << "TestsReportCorrectNames/" << GetParam();
896
+ EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
897
+ }
898
+
899
+ INSTANTIATE_TEST_CASE_P(PrintToString,
900
+ CustomIntegerNamingTest,
901
+ Range(0, 5),
902
+ ::testing::PrintToStringParamName());
903
+
904
+ // Test a custom struct with PrintToString.
905
+
906
+ struct CustomStruct {
907
+ explicit CustomStruct(int value) : x(value) {}
908
+ int x;
909
+ };
910
+
911
+ std::ostream& operator<<(std::ostream& stream, const CustomStruct& val) {
912
+ stream << val.x;
913
+ return stream;
914
+ }
915
+
916
+ class CustomStructNamingTest : public TestWithParam<CustomStruct> {};
917
+
918
+ TEST_P(CustomStructNamingTest, TestsReportCorrectNames) {
919
+ const ::testing::TestInfo* const test_info =
920
+ ::testing::UnitTest::GetInstance()->current_test_info();
921
+ Message test_name_stream;
922
+ test_name_stream << "TestsReportCorrectNames/" << GetParam();
923
+ EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
924
+ }
925
+
926
+ INSTANTIATE_TEST_CASE_P(PrintToString,
927
+ CustomStructNamingTest,
928
+ Values(CustomStruct(0), CustomStruct(1)),
929
+ ::testing::PrintToStringParamName());
930
+
931
+ // Test that using a stateful parameter naming function works as expected.
932
+
933
+ struct StatefulNamingFunctor {
934
+ StatefulNamingFunctor() : sum(0) {}
935
+ std::string operator()(const ::testing::TestParamInfo<int>& info) {
936
+ int value = info.param + sum;
937
+ sum += info.param;
938
+ return ::testing::PrintToString(value);
939
+ }
940
+ int sum;
941
+ };
942
+
943
+ class StatefulNamingTest : public ::testing::TestWithParam<int> {
944
+ protected:
945
+ StatefulNamingTest() : sum_(0) {}
946
+ int sum_;
947
+ };
948
+
949
+ TEST_P(StatefulNamingTest, TestsReportCorrectNames) {
950
+ const ::testing::TestInfo* const test_info =
951
+ ::testing::UnitTest::GetInstance()->current_test_info();
952
+ sum_ += GetParam();
953
+ Message test_name_stream;
954
+ test_name_stream << "TestsReportCorrectNames/" << sum_;
955
+ EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
956
+ }
957
+
958
+ INSTANTIATE_TEST_CASE_P(StatefulNamingFunctor,
959
+ StatefulNamingTest,
960
+ Range(0, 5),
961
+ StatefulNamingFunctor());
962
+
963
+ // Class that cannot be streamed into an ostream. It needs to be copyable
964
+ // (and, in case of MSVC, also assignable) in order to be a test parameter
965
+ // type. Its default copy constructor and assignment operator do exactly
966
+ // what we need.
967
+ class Unstreamable {
968
+ public:
969
+ explicit Unstreamable(int value) : value_(value) {}
970
+
971
+ private:
972
+ int value_;
973
+ };
974
+
975
+ class CommentTest : public TestWithParam<Unstreamable> {};
976
+
977
+ TEST_P(CommentTest, TestsCorrectlyReportUnstreamableParams) {
978
+ const ::testing::TestInfo* const test_info =
979
+ ::testing::UnitTest::GetInstance()->current_test_info();
980
+
981
+ EXPECT_EQ(::testing::PrintToString(GetParam()), test_info->value_param());
982
+ }
983
+
984
+ INSTANTIATE_TEST_CASE_P(InstantiationWithComments,
985
+ CommentTest,
986
+ Values(Unstreamable(1)));
987
+
988
+ // Verify that we can create a hierarchy of test fixtures, where the base
989
+ // class fixture is not parameterized and the derived class is. In this case
990
+ // ParameterizedDerivedTest inherits from NonParameterizedBaseTest. We
991
+ // perform simple tests on both.
992
+ class NonParameterizedBaseTest : public ::testing::Test {
993
+ public:
994
+ NonParameterizedBaseTest() : n_(17) { }
995
+ protected:
996
+ int n_;
997
+ };
998
+
999
+ class ParameterizedDerivedTest : public NonParameterizedBaseTest,
1000
+ public ::testing::WithParamInterface<int> {
1001
+ protected:
1002
+ ParameterizedDerivedTest() : count_(0) { }
1003
+ int count_;
1004
+ static int global_count_;
1005
+ };
1006
+
1007
+ int ParameterizedDerivedTest::global_count_ = 0;
1008
+
1009
+ TEST_F(NonParameterizedBaseTest, FixtureIsInitialized) {
1010
+ EXPECT_EQ(17, n_);
1011
+ }
1012
+
1013
+ TEST_P(ParameterizedDerivedTest, SeesSequence) {
1014
+ EXPECT_EQ(17, n_);
1015
+ EXPECT_EQ(0, count_++);
1016
+ EXPECT_EQ(GetParam(), global_count_++);
1017
+ }
1018
+
1019
+ class ParameterizedDeathTest : public ::testing::TestWithParam<int> { };
1020
+
1021
+ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
1022
+ EXPECT_DEATH_IF_SUPPORTED(GetParam(),
1023
+ ".* value-parameterized test .*");
1024
+ }
1025
+
1026
+ INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5));
1027
+
1028
+ #endif // GTEST_HAS_PARAM_TEST
1029
+
1030
+ TEST(CompileTest, CombineIsDefinedOnlyWhenGtestHasParamTestIsDefined) {
1031
+ #if GTEST_HAS_COMBINE && !GTEST_HAS_PARAM_TEST
1032
+ FAIL() << "GTEST_HAS_COMBINE is defined while GTEST_HAS_PARAM_TEST is not\n"
1033
+ #endif
1034
+ }
1035
+
1036
+ int main(int argc, char **argv) {
1037
+ #if GTEST_HAS_PARAM_TEST
1038
+ // Used in TestGenerationTest test case.
1039
+ AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());
1040
+ // Used in GeneratorEvaluationTest test case. Tests that the updated value
1041
+ // will be picked up for instantiating tests in GeneratorEvaluationTest.
1042
+ GeneratorEvaluationTest::set_param_value(1);
1043
+ #endif // GTEST_HAS_PARAM_TEST
1044
+
1045
+ ::testing::InitGoogleTest(&argc, argv);
1046
+
1047
+ #if GTEST_HAS_PARAM_TEST
1048
+ // Used in GeneratorEvaluationTest test case. Tests that value updated
1049
+ // here will NOT be used for instantiating tests in
1050
+ // GeneratorEvaluationTest.
1051
+ GeneratorEvaluationTest::set_param_value(2);
1052
+ #endif // GTEST_HAS_PARAM_TEST
1053
+
1054
+ return RUN_ALL_TESTS();
1055
+ }