rj_schema 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rj_schema/rapidjson/CHANGELOG.md +158 -0
- data/ext/rj_schema/rapidjson/CMakeLists.txt +226 -0
- data/ext/rj_schema/rapidjson/CMakeModules/FindGTestSrc.cmake +30 -0
- data/ext/rj_schema/rapidjson/RapidJSON.pc.in +7 -0
- data/ext/rj_schema/rapidjson/RapidJSONConfig.cmake.in +25 -0
- data/ext/rj_schema/rapidjson/RapidJSONConfigVersion.cmake.in +10 -0
- data/ext/rj_schema/rapidjson/appveyor.yml +54 -0
- data/ext/rj_schema/rapidjson/bin/data/abcde.txt +1 -0
- data/ext/rj_schema/rapidjson/bin/data/glossary.json +22 -0
- data/ext/rj_schema/rapidjson/bin/data/menu.json +27 -0
- data/ext/rj_schema/rapidjson/bin/data/readme.txt +1 -0
- data/ext/rj_schema/rapidjson/bin/data/sample.json +3315 -0
- data/ext/rj_schema/rapidjson/bin/data/webapp.json +88 -0
- data/ext/rj_schema/rapidjson/bin/data/widget.json +26 -0
- data/ext/rj_schema/rapidjson/bin/draft-04/schema +150 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf16be.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf16bebom.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf16le.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf16lebom.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf32be.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf32bebom.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf32le.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf32lebom.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf8.json +7 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf8bom.json +7 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail1.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail10.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail11.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail12.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail13.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail14.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail15.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail16.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail17.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail18.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail19.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail2.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail20.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail21.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail22.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail23.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail24.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail25.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail26.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail27.json +2 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail28.json +2 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail29.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail3.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail30.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail31.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail32.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail33.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail4.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail5.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail6.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail7.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail8.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail9.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/pass1.json +58 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/pass2.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/pass3.json +6 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/readme.txt +3 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/LICENSE +19 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/README.md +148 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/bin/jsonschema_suite +283 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/folder/folderInteger.json +3 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/integer.json +3 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/subSchemas.json +8 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/additionalItems.json +82 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/additionalProperties.json +88 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/default.json +49 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/dependencies.json +108 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/disallow.json +80 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/divisibleBy.json +60 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/enum.json +71 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/extends.json +94 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/items.json +46 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maxItems.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maxLength.json +33 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maximum.json +42 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minItems.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minLength.json +33 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minimum.json +42 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/bignum.json +107 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/format.json +222 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/jsregex.json +18 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/zeroTerminatedFloats.json +15 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/pattern.json +34 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/patternProperties.json +110 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/properties.json +92 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/ref.json +159 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/refRemote.json +74 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/required.json +53 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/type.json +474 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/uniqueItems.json +79 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/additionalItems.json +82 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/additionalProperties.json +88 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/allOf.json +112 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/anyOf.json +68 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/default.json +49 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/definitions.json +32 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/dependencies.json +113 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/enum.json +72 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/items.json +46 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxItems.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxLength.json +33 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxProperties.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maximum.json +42 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minItems.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minLength.json +33 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minProperties.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minimum.json +42 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/multipleOf.json +60 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/not.json +96 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/oneOf.json +68 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/bignum.json +107 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/format.json +148 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/zeroTerminatedFloats.json +15 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/pattern.json +34 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/patternProperties.json +110 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/properties.json +92 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/ref.json +159 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/refRemote.json +74 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/required.json +39 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/type.json +330 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/uniqueItems.json +79 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tox.ini +8 -0
- data/ext/rj_schema/rapidjson/bin/types/booleans.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/floats.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/guids.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/integers.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/mixed.json +592 -0
- data/ext/rj_schema/rapidjson/bin/types/nulls.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/paragraphs.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/readme.txt +1 -0
- data/ext/rj_schema/rapidjson/contrib/natvis/LICENSE +45 -0
- data/ext/rj_schema/rapidjson/contrib/natvis/README.md +7 -0
- data/ext/rj_schema/rapidjson/contrib/natvis/rapidjson.natvis +38 -0
- data/ext/rj_schema/rapidjson/doc/CMakeLists.txt +27 -0
- data/ext/rj_schema/rapidjson/doc/Doxyfile.in +2369 -0
- data/ext/rj_schema/rapidjson/doc/Doxyfile.zh-cn.in +2369 -0
- data/ext/rj_schema/rapidjson/doc/diagram/architecture.dot +50 -0
- data/ext/rj_schema/rapidjson/doc/diagram/architecture.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/insituparsing.dot +65 -0
- data/ext/rj_schema/rapidjson/doc/diagram/insituparsing.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/iterative-parser-states-diagram.dot +62 -0
- data/ext/rj_schema/rapidjson/doc/diagram/iterative-parser-states-diagram.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/makefile +8 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move1.dot +47 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move1.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move2.dot +62 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move2.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move3.dot +60 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move3.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/normalparsing.dot +56 -0
- data/ext/rj_schema/rapidjson/doc/diagram/normalparsing.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/simpledom.dot +54 -0
- data/ext/rj_schema/rapidjson/doc/diagram/simpledom.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/tutorial.dot +58 -0
- data/ext/rj_schema/rapidjson/doc/diagram/tutorial.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/utilityclass.dot +73 -0
- data/ext/rj_schema/rapidjson/doc/diagram/utilityclass.png +0 -0
- data/ext/rj_schema/rapidjson/doc/dom.md +281 -0
- data/ext/rj_schema/rapidjson/doc/dom.zh-cn.md +285 -0
- data/ext/rj_schema/rapidjson/doc/encoding.md +146 -0
- data/ext/rj_schema/rapidjson/doc/encoding.zh-cn.md +152 -0
- data/ext/rj_schema/rapidjson/doc/faq.md +289 -0
- data/ext/rj_schema/rapidjson/doc/faq.zh-cn.md +290 -0
- data/ext/rj_schema/rapidjson/doc/features.md +104 -0
- data/ext/rj_schema/rapidjson/doc/features.zh-cn.md +103 -0
- data/ext/rj_schema/rapidjson/doc/internals.md +368 -0
- data/ext/rj_schema/rapidjson/doc/internals.zh-cn.md +363 -0
- data/ext/rj_schema/rapidjson/doc/logo/rapidjson.png +0 -0
- data/ext/rj_schema/rapidjson/doc/logo/rapidjson.svg +119 -0
- data/ext/rj_schema/rapidjson/doc/misc/DoxygenLayout.xml +194 -0
- data/ext/rj_schema/rapidjson/doc/misc/doxygenextra.css +274 -0
- data/ext/rj_schema/rapidjson/doc/misc/footer.html +11 -0
- data/ext/rj_schema/rapidjson/doc/misc/header.html +24 -0
- data/ext/rj_schema/rapidjson/doc/npm.md +31 -0
- data/ext/rj_schema/rapidjson/doc/performance.md +26 -0
- data/ext/rj_schema/rapidjson/doc/performance.zh-cn.md +26 -0
- data/ext/rj_schema/rapidjson/doc/pointer.md +234 -0
- data/ext/rj_schema/rapidjson/doc/pointer.zh-cn.md +234 -0
- data/ext/rj_schema/rapidjson/doc/sax.md +509 -0
- data/ext/rj_schema/rapidjson/doc/sax.zh-cn.md +487 -0
- data/ext/rj_schema/rapidjson/doc/schema.md +505 -0
- data/ext/rj_schema/rapidjson/doc/schema.zh-cn.md +237 -0
- data/ext/rj_schema/rapidjson/doc/stream.md +429 -0
- data/ext/rj_schema/rapidjson/doc/stream.zh-cn.md +429 -0
- data/ext/rj_schema/rapidjson/doc/tutorial.md +536 -0
- data/ext/rj_schema/rapidjson/doc/tutorial.zh-cn.md +535 -0
- data/ext/rj_schema/rapidjson/docker/debian/Dockerfile +8 -0
- data/ext/rj_schema/rapidjson/example/CMakeLists.txt +46 -0
- data/ext/rj_schema/rapidjson/example/archiver/archiver.cpp +292 -0
- data/ext/rj_schema/rapidjson/example/archiver/archiver.h +145 -0
- data/ext/rj_schema/rapidjson/example/archiver/archivertest.cpp +287 -0
- data/ext/rj_schema/rapidjson/example/capitalize/capitalize.cpp +67 -0
- data/ext/rj_schema/rapidjson/example/condense/condense.cpp +32 -0
- data/ext/rj_schema/rapidjson/example/filterkey/filterkey.cpp +135 -0
- data/ext/rj_schema/rapidjson/example/filterkeydom/filterkeydom.cpp +170 -0
- data/ext/rj_schema/rapidjson/example/jsonx/jsonx.cpp +207 -0
- data/ext/rj_schema/rapidjson/example/lookaheadparser/lookaheadparser.cpp +350 -0
- data/ext/rj_schema/rapidjson/example/messagereader/messagereader.cpp +105 -0
- data/ext/rj_schema/rapidjson/example/parsebyparts/parsebyparts.cpp +176 -0
- data/ext/rj_schema/rapidjson/example/pretty/pretty.cpp +30 -0
- data/ext/rj_schema/rapidjson/example/prettyauto/prettyauto.cpp +56 -0
- data/ext/rj_schema/rapidjson/example/schemavalidator/schemavalidator.cpp +78 -0
- data/ext/rj_schema/rapidjson/example/serialize/serialize.cpp +173 -0
- data/ext/rj_schema/rapidjson/example/simpledom/simpledom.cpp +29 -0
- data/ext/rj_schema/rapidjson/example/simplepullreader/simplepullreader.cpp +53 -0
- data/ext/rj_schema/rapidjson/example/simplereader/simplereader.cpp +42 -0
- data/ext/rj_schema/rapidjson/example/simplewriter/simplewriter.cpp +36 -0
- data/ext/rj_schema/rapidjson/example/sortkeys/sortkeys.cpp +62 -0
- data/ext/rj_schema/rapidjson/example/tutorial/tutorial.cpp +151 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/allocators.h +284 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/cursorstreamwrapper.h +78 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/document.h +2732 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/encodedstream.h +299 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/encodings.h +716 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/error/en.h +74 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/error/error.h +161 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/filereadstream.h +99 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/filewritestream.h +104 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/fwd.h +151 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/biginteger.h +290 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/clzll.h +71 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/diyfp.h +257 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/dtoa.h +245 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/ieee754.h +78 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/itoa.h +308 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/meta.h +186 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/pow10.h +55 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/regex.h +739 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/stack.h +232 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/strfunc.h +69 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/strtod.h +290 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/swap.h +46 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/istreamwrapper.h +128 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/memorybuffer.h +70 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/memorystream.h +71 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/msinttypes/inttypes.h +316 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/msinttypes/stdint.h +300 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/ostreamwrapper.h +81 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/pointer.h +1415 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/prettywriter.h +277 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/rapidjson.h +676 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/reader.h +2236 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/schema.h +2496 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/stream.h +223 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/stringbuffer.h +121 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/writer.h +710 -0
- data/ext/rj_schema/rapidjson/include_dirs.js +2 -0
- data/ext/rj_schema/rapidjson/library.json +15 -0
- data/ext/rj_schema/rapidjson/license.txt +57 -0
- data/ext/rj_schema/rapidjson/package.json +24 -0
- data/ext/rj_schema/rapidjson/rapidjson.autopkg +77 -0
- data/ext/rj_schema/rapidjson/readme.md +210 -0
- data/ext/rj_schema/rapidjson/readme.zh-cn.md +152 -0
- data/ext/rj_schema/rapidjson/test/CMakeLists.txt +20 -0
- data/ext/rj_schema/rapidjson/test/perftest/CMakeLists.txt +28 -0
- data/ext/rj_schema/rapidjson/test/perftest/misctest.cpp +974 -0
- data/ext/rj_schema/rapidjson/test/perftest/perftest.cpp +24 -0
- data/ext/rj_schema/rapidjson/test/perftest/perftest.h +185 -0
- data/ext/rj_schema/rapidjson/test/perftest/platformtest.cpp +166 -0
- data/ext/rj_schema/rapidjson/test/perftest/rapidjsontest.cpp +546 -0
- data/ext/rj_schema/rapidjson/test/perftest/schematest.cpp +223 -0
- data/ext/rj_schema/rapidjson/test/unittest/CMakeLists.txt +92 -0
- data/ext/rj_schema/rapidjson/test/unittest/allocatorstest.cpp +100 -0
- data/ext/rj_schema/rapidjson/test/unittest/bigintegertest.cpp +138 -0
- data/ext/rj_schema/rapidjson/test/unittest/cursorstreamwrappertest.cpp +115 -0
- data/ext/rj_schema/rapidjson/test/unittest/documenttest.cpp +672 -0
- data/ext/rj_schema/rapidjson/test/unittest/dtoatest.cpp +98 -0
- data/ext/rj_schema/rapidjson/test/unittest/encodedstreamtest.cpp +313 -0
- data/ext/rj_schema/rapidjson/test/unittest/encodingstest.cpp +451 -0
- data/ext/rj_schema/rapidjson/test/unittest/filestreamtest.cpp +155 -0
- data/ext/rj_schema/rapidjson/test/unittest/fwdtest.cpp +230 -0
- data/ext/rj_schema/rapidjson/test/unittest/istreamwrappertest.cpp +181 -0
- data/ext/rj_schema/rapidjson/test/unittest/itoatest.cpp +160 -0
- data/ext/rj_schema/rapidjson/test/unittest/jsoncheckertest.cpp +143 -0
- data/ext/rj_schema/rapidjson/test/unittest/namespacetest.cpp +70 -0
- data/ext/rj_schema/rapidjson/test/unittest/ostreamwrappertest.cpp +92 -0
- data/ext/rj_schema/rapidjson/test/unittest/pointertest.cpp +1638 -0
- data/ext/rj_schema/rapidjson/test/unittest/prettywritertest.cpp +373 -0
- data/ext/rj_schema/rapidjson/test/unittest/readertest.cpp +2225 -0
- data/ext/rj_schema/rapidjson/test/unittest/regextest.cpp +639 -0
- data/ext/rj_schema/rapidjson/test/unittest/schematest.cpp +2072 -0
- data/ext/rj_schema/rapidjson/test/unittest/simdtest.cpp +219 -0
- data/ext/rj_schema/rapidjson/test/unittest/strfunctest.cpp +30 -0
- data/ext/rj_schema/rapidjson/test/unittest/stringbuffertest.cpp +192 -0
- data/ext/rj_schema/rapidjson/test/unittest/strtodtest.cpp +132 -0
- data/ext/rj_schema/rapidjson/test/unittest/unittest.cpp +51 -0
- data/ext/rj_schema/rapidjson/test/unittest/unittest.h +143 -0
- data/ext/rj_schema/rapidjson/test/unittest/valuetest.cpp +1851 -0
- data/ext/rj_schema/rapidjson/test/unittest/writertest.cpp +598 -0
- data/ext/rj_schema/rapidjson/test/valgrind.supp +17 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/BUILD.bazel +175 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/CMakeLists.txt +33 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/CONTRIBUTING.md +160 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/LICENSE +28 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/Makefile.am +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/README.md +122 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/WORKSPACE +8 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/appveyor.yml +104 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-autotools.sh +44 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/build-linux-bazel.sh +36 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-linux.sh +41 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/env-osx.sh +40 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/get-nprocessors.sh +48 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-linux.sh +49 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/install-osx.sh +39 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/log-config.sh +51 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/ci/travis.sh +44 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/configure.ac +16 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CHANGES +126 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt +242 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CONTRIBUTORS +40 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/LICENSE +28 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/Makefile.am +224 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/README.md +344 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock.pc.in +9 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/cmake/gmock_main.pc.in +9 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/configure.ac +146 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CheatSheet.md +564 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CookBook.md +3660 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DesignDoc.md +280 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/Documentation.md +15 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/ForDummies.md +447 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/FrequentlyAskedQuestions.md +627 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/KnownIssues.md +19 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-actions.h +1262 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-cardinalities.h +147 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h +2571 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +833 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +1379 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +347 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h +2258 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +675 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +458 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +178 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h +5255 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-actions.h +246 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h +91 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h +1918 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock.h +95 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +8 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +10 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h +38 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-port.h +46 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +286 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump +136 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h +574 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h +87 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/make/Makefile +101 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.sln +32 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.vcproj +191 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_config.vsprops +15 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_main.vcproj +187 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_test.vcproj +201 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.sln +46 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.vcxproj +145 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_config.props +19 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_main.vcxproj +151 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_test.vcxproj +176 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.sln +46 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.vcxproj +145 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_config.props +19 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_main.vcxproj +151 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_test.vcxproj +176 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/fuse_gmock_files.py +240 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/LICENSE +203 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README +34 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README.cppclean +115 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/__init__.py +0 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/ast.py +1733 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class.py +227 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class_test.py +448 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/keywords.py +59 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/tokenize.py +287 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/utils.py +41 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/gmock_gen.py +31 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock-config.in +303 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock_doctor.py +640 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload.py +1387 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload_gmock.py +78 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-all.cc +47 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-cardinalities.cc +156 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-internal-utils.cc +204 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-matchers.cc +573 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-spec-builders.cc +883 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock.cc +205 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock_main.cc +54 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/BUILD.bazel +123 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-actions_test.cc +1575 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-cardinalities_test.cc +428 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-actions_test.cc +1230 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-function-mockers_test.cc +647 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc +129 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc +1341 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-internal-utils_test.cc +718 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-matchers_test.cc +6767 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-more-actions_test.cc +710 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-nice-strict_test.cc +511 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-port_test.cc +43 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-spec-builders_test.cc +2771 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_all_test.cc +51 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_ex_test.cc +81 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test.py +108 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test_.cc +100 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link2_test.cc +40 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.cc +40 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.h +691 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test.py +183 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_.cc +310 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_golden.txt +317 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_stress_test.cc +323 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test.cc +262 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test_utils.py +110 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CHANGES +157 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt +312 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CONTRIBUTORS +37 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/LICENSE +28 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/Makefile.am +339 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/README.md +341 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest.pc.in +9 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/gtest_main.pc.in +10 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/internal_utils.cmake +280 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.cbproj +138 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.groupproj +54 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_all.cc +38 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_link.cc +40 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_main.cbproj +82 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_unittest.cbproj +88 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/configure.ac +68 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Pkgconfig.md +146 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/PumpManual.md +177 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/XcodeGuide.md +93 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/advanced.md +2416 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/faq.md +1092 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/primer.md +536 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/samples.md +14 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-death-test.h +342 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-message.h +249 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h +1438 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h.pump +501 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-printers.h +1082 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-spi.h +231 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-test-part.h +179 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h +264 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest.h +2332 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h +357 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_prod.h +61 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h +70 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-printers.h +42 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h +45 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h +275 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h +205 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h +1277 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-linked_ptr.h +243 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h +5139 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +279 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h +723 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h +100 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h +2687 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h +167 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h +1020 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h.pump +347 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h +3347 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump +313 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/acx_pthread.m4 +363 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/gtest.m4 +74 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/make/Makefile +82 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.sln +55 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj +149 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest-md.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.sln +55 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj +149 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj +154 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main-md.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj +162 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_main.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj +199 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters +26 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj +191 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters +26 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj +188 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj +180 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/2010/gtest_unittest.vcxproj.filters +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/prime_tables.h +127 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.cc +68 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.h +43 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample10_unittest.cc +140 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1_unittest.cc +154 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.cc +56 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.h +85 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2_unittest.cc +110 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3-inl.h +172 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3_unittest.cc +152 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.cc +46 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.h +53 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4_unittest.cc +49 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample5_unittest.cc +199 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample6_unittest.cc +225 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample7_unittest.cc +118 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample8_unittest.cc +174 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample9_unittest.cc +157 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/common.py +83 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/fuse_gtest_files.py +253 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gen_gtest_pred_impl.py +730 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gtest-config.in +274 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/pump.py +855 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/release_docs.py +158 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/test/Makefile +59 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload.py +1387 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload_gtest.py +78 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-all.cc +48 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-death-test.cc +1536 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-filepath.cc +385 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-internal-inl.h +1175 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-port.cc +1277 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-printers.cc +458 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-test-part.cc +102 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-typed-test.cc +119 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest.cc +5846 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest_main.cc +38 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/BUILD.bazel +396 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_ex_test.cc +93 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_test.cc +1424 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-filepath_test.cc +652 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-linked_ptr_test.cc +154 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-listener_test.cc +311 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-message_test.cc +159 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-options_test.cc +213 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test2_test.cc +61 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.cc +1110 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.h +53 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-port_test.cc +1303 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-printers_test.cc +1737 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-test-part_test.cc +208 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-tuple_test.cc +320 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test2_test.cc +45 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.cc +380 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.h +66 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-unittest-api_test.cc +341 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_all_test.cc +47 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_assert_by_exception_test.cc +119 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest.py +210 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest_.cc +87 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test.py +235 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test_.cc +311 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test.py +129 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test_.cc +63 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test.py +119 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test_.cc +124 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_environment_test.cc +189 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest.py +638 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest_.cc +138 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test.py +172 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test_.cc +46 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_outfiles_test.py +162 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_output_unittest.py +611 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_json_test_utils.py +60 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest.py +207 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest_.cc +157 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_main_unittest.cc +45 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_no_test_unittest.cc +56 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test.py +344 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_.cc +1067 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_golden_lin.txt +781 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_pred_impl_unittest.cc +2427 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_premature_exit_test.cc +127 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_prod_test.cc +57 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_repeat_test.cc +236 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test.py +325 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test_.cc +103 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_sole_header_test.cc +57 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_stress_test.cc +250 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_test_utils.py +318 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test.py +65 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_testbridge_test_.cc +44 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_ex_test.cc +92 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test.py +171 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test_.cc +72 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test.py +69 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test_.cc +43 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_unittest.cc +7797 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile1_test_.cc +48 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile2_test_.cc +48 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfiles_test.py +140 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest.py +378 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest_.cc +179 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_test_utils.py +196 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.cc +36 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.h +55 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/DebugProject.xcconfig +30 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/FrameworkTarget.xcconfig +17 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/General.xcconfig +41 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/ReleaseProject.xcconfig +32 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/StaticLibraryTarget.xcconfig +18 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/TestTarget.xcconfig +8 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Resources/Info.plist +30 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/Info.plist +28 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj +457 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/runtests.sh +62 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.cc +63 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.h +59 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget_test.cc +68 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/runtests.sh +65 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/versiongenerate.py +100 -0
- data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj +1182 -0
- data/ext/rj_schema/rapidjson/travis-doxygen.sh +128 -0
- metadata +613 -1
@@ -0,0 +1,428 @@
|
|
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 tests the built-in cardinalities.
|
35
|
+
|
36
|
+
#include "gmock/gmock.h"
|
37
|
+
#include "gtest/gtest.h"
|
38
|
+
#include "gtest/gtest-spi.h"
|
39
|
+
|
40
|
+
namespace {
|
41
|
+
|
42
|
+
using std::stringstream;
|
43
|
+
using testing::AnyNumber;
|
44
|
+
using testing::AtLeast;
|
45
|
+
using testing::AtMost;
|
46
|
+
using testing::Between;
|
47
|
+
using testing::Cardinality;
|
48
|
+
using testing::CardinalityInterface;
|
49
|
+
using testing::Exactly;
|
50
|
+
using testing::IsSubstring;
|
51
|
+
using testing::MakeCardinality;
|
52
|
+
|
53
|
+
class MockFoo {
|
54
|
+
public:
|
55
|
+
MockFoo() {}
|
56
|
+
MOCK_METHOD0(Bar, int()); // NOLINT
|
57
|
+
|
58
|
+
private:
|
59
|
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
|
60
|
+
};
|
61
|
+
|
62
|
+
// Tests that Cardinality objects can be default constructed.
|
63
|
+
TEST(CardinalityTest, IsDefaultConstructable) {
|
64
|
+
Cardinality c;
|
65
|
+
}
|
66
|
+
|
67
|
+
// Tests that Cardinality objects are copyable.
|
68
|
+
TEST(CardinalityTest, IsCopyable) {
|
69
|
+
// Tests the copy constructor.
|
70
|
+
Cardinality c = Exactly(1);
|
71
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(0));
|
72
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(1));
|
73
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(1));
|
74
|
+
|
75
|
+
// Tests the assignment operator.
|
76
|
+
c = Exactly(2);
|
77
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(1));
|
78
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(2));
|
79
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(2));
|
80
|
+
}
|
81
|
+
|
82
|
+
TEST(CardinalityTest, IsOverSaturatedByCallCountWorks) {
|
83
|
+
const Cardinality c = AtMost(5);
|
84
|
+
EXPECT_FALSE(c.IsOverSaturatedByCallCount(4));
|
85
|
+
EXPECT_FALSE(c.IsOverSaturatedByCallCount(5));
|
86
|
+
EXPECT_TRUE(c.IsOverSaturatedByCallCount(6));
|
87
|
+
}
|
88
|
+
|
89
|
+
// Tests that Cardinality::DescribeActualCallCountTo() creates the
|
90
|
+
// correct description.
|
91
|
+
TEST(CardinalityTest, CanDescribeActualCallCount) {
|
92
|
+
stringstream ss0;
|
93
|
+
Cardinality::DescribeActualCallCountTo(0, &ss0);
|
94
|
+
EXPECT_EQ("never called", ss0.str());
|
95
|
+
|
96
|
+
stringstream ss1;
|
97
|
+
Cardinality::DescribeActualCallCountTo(1, &ss1);
|
98
|
+
EXPECT_EQ("called once", ss1.str());
|
99
|
+
|
100
|
+
stringstream ss2;
|
101
|
+
Cardinality::DescribeActualCallCountTo(2, &ss2);
|
102
|
+
EXPECT_EQ("called twice", ss2.str());
|
103
|
+
|
104
|
+
stringstream ss3;
|
105
|
+
Cardinality::DescribeActualCallCountTo(3, &ss3);
|
106
|
+
EXPECT_EQ("called 3 times", ss3.str());
|
107
|
+
}
|
108
|
+
|
109
|
+
// Tests AnyNumber()
|
110
|
+
TEST(AnyNumber, Works) {
|
111
|
+
const Cardinality c = AnyNumber();
|
112
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(0));
|
113
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(0));
|
114
|
+
|
115
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(1));
|
116
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(1));
|
117
|
+
|
118
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(9));
|
119
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(9));
|
120
|
+
|
121
|
+
stringstream ss;
|
122
|
+
c.DescribeTo(&ss);
|
123
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "called any number of times",
|
124
|
+
ss.str());
|
125
|
+
}
|
126
|
+
|
127
|
+
TEST(AnyNumberTest, HasCorrectBounds) {
|
128
|
+
const Cardinality c = AnyNumber();
|
129
|
+
EXPECT_EQ(0, c.ConservativeLowerBound());
|
130
|
+
EXPECT_EQ(INT_MAX, c.ConservativeUpperBound());
|
131
|
+
}
|
132
|
+
|
133
|
+
// Tests AtLeast(n).
|
134
|
+
|
135
|
+
TEST(AtLeastTest, OnNegativeNumber) {
|
136
|
+
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
137
|
+
AtLeast(-1);
|
138
|
+
}, "The invocation lower bound must be >= 0");
|
139
|
+
}
|
140
|
+
|
141
|
+
TEST(AtLeastTest, OnZero) {
|
142
|
+
const Cardinality c = AtLeast(0);
|
143
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(0));
|
144
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(0));
|
145
|
+
|
146
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(1));
|
147
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(1));
|
148
|
+
|
149
|
+
stringstream ss;
|
150
|
+
c.DescribeTo(&ss);
|
151
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "any number of times",
|
152
|
+
ss.str());
|
153
|
+
}
|
154
|
+
|
155
|
+
TEST(AtLeastTest, OnPositiveNumber) {
|
156
|
+
const Cardinality c = AtLeast(2);
|
157
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(0));
|
158
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(0));
|
159
|
+
|
160
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(1));
|
161
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(1));
|
162
|
+
|
163
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(2));
|
164
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(2));
|
165
|
+
|
166
|
+
stringstream ss1;
|
167
|
+
AtLeast(1).DescribeTo(&ss1);
|
168
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "at least once",
|
169
|
+
ss1.str());
|
170
|
+
|
171
|
+
stringstream ss2;
|
172
|
+
c.DescribeTo(&ss2);
|
173
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "at least twice",
|
174
|
+
ss2.str());
|
175
|
+
|
176
|
+
stringstream ss3;
|
177
|
+
AtLeast(3).DescribeTo(&ss3);
|
178
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "at least 3 times",
|
179
|
+
ss3.str());
|
180
|
+
}
|
181
|
+
|
182
|
+
TEST(AtLeastTest, HasCorrectBounds) {
|
183
|
+
const Cardinality c = AtLeast(2);
|
184
|
+
EXPECT_EQ(2, c.ConservativeLowerBound());
|
185
|
+
EXPECT_EQ(INT_MAX, c.ConservativeUpperBound());
|
186
|
+
}
|
187
|
+
|
188
|
+
// Tests AtMost(n).
|
189
|
+
|
190
|
+
TEST(AtMostTest, OnNegativeNumber) {
|
191
|
+
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
192
|
+
AtMost(-1);
|
193
|
+
}, "The invocation upper bound must be >= 0");
|
194
|
+
}
|
195
|
+
|
196
|
+
TEST(AtMostTest, OnZero) {
|
197
|
+
const Cardinality c = AtMost(0);
|
198
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(0));
|
199
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(0));
|
200
|
+
|
201
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(1));
|
202
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(1));
|
203
|
+
|
204
|
+
stringstream ss;
|
205
|
+
c.DescribeTo(&ss);
|
206
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "never called",
|
207
|
+
ss.str());
|
208
|
+
}
|
209
|
+
|
210
|
+
TEST(AtMostTest, OnPositiveNumber) {
|
211
|
+
const Cardinality c = AtMost(2);
|
212
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(0));
|
213
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(0));
|
214
|
+
|
215
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(1));
|
216
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(1));
|
217
|
+
|
218
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(2));
|
219
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(2));
|
220
|
+
|
221
|
+
stringstream ss1;
|
222
|
+
AtMost(1).DescribeTo(&ss1);
|
223
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "called at most once",
|
224
|
+
ss1.str());
|
225
|
+
|
226
|
+
stringstream ss2;
|
227
|
+
c.DescribeTo(&ss2);
|
228
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "called at most twice",
|
229
|
+
ss2.str());
|
230
|
+
|
231
|
+
stringstream ss3;
|
232
|
+
AtMost(3).DescribeTo(&ss3);
|
233
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "called at most 3 times",
|
234
|
+
ss3.str());
|
235
|
+
}
|
236
|
+
|
237
|
+
TEST(AtMostTest, HasCorrectBounds) {
|
238
|
+
const Cardinality c = AtMost(2);
|
239
|
+
EXPECT_EQ(0, c.ConservativeLowerBound());
|
240
|
+
EXPECT_EQ(2, c.ConservativeUpperBound());
|
241
|
+
}
|
242
|
+
|
243
|
+
// Tests Between(m, n).
|
244
|
+
|
245
|
+
TEST(BetweenTest, OnNegativeStart) {
|
246
|
+
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
247
|
+
Between(-1, 2);
|
248
|
+
}, "The invocation lower bound must be >= 0, but is actually -1");
|
249
|
+
}
|
250
|
+
|
251
|
+
TEST(BetweenTest, OnNegativeEnd) {
|
252
|
+
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
253
|
+
Between(1, -2);
|
254
|
+
}, "The invocation upper bound must be >= 0, but is actually -2");
|
255
|
+
}
|
256
|
+
|
257
|
+
TEST(BetweenTest, OnStartBiggerThanEnd) {
|
258
|
+
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
259
|
+
Between(2, 1);
|
260
|
+
}, "The invocation upper bound (1) must be >= "
|
261
|
+
"the invocation lower bound (2)");
|
262
|
+
}
|
263
|
+
|
264
|
+
TEST(BetweenTest, OnZeroStartAndZeroEnd) {
|
265
|
+
const Cardinality c = Between(0, 0);
|
266
|
+
|
267
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(0));
|
268
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(0));
|
269
|
+
|
270
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(1));
|
271
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(1));
|
272
|
+
|
273
|
+
stringstream ss;
|
274
|
+
c.DescribeTo(&ss);
|
275
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "never called",
|
276
|
+
ss.str());
|
277
|
+
}
|
278
|
+
|
279
|
+
TEST(BetweenTest, OnZeroStartAndNonZeroEnd) {
|
280
|
+
const Cardinality c = Between(0, 2);
|
281
|
+
|
282
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(0));
|
283
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(0));
|
284
|
+
|
285
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(2));
|
286
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(2));
|
287
|
+
|
288
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(4));
|
289
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(4));
|
290
|
+
|
291
|
+
stringstream ss;
|
292
|
+
c.DescribeTo(&ss);
|
293
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "called at most twice",
|
294
|
+
ss.str());
|
295
|
+
}
|
296
|
+
|
297
|
+
TEST(BetweenTest, OnSameStartAndEnd) {
|
298
|
+
const Cardinality c = Between(3, 3);
|
299
|
+
|
300
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(2));
|
301
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(2));
|
302
|
+
|
303
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(3));
|
304
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(3));
|
305
|
+
|
306
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(4));
|
307
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(4));
|
308
|
+
|
309
|
+
stringstream ss;
|
310
|
+
c.DescribeTo(&ss);
|
311
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "called 3 times",
|
312
|
+
ss.str());
|
313
|
+
}
|
314
|
+
|
315
|
+
TEST(BetweenTest, OnDifferentStartAndEnd) {
|
316
|
+
const Cardinality c = Between(3, 5);
|
317
|
+
|
318
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(2));
|
319
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(2));
|
320
|
+
|
321
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(3));
|
322
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(3));
|
323
|
+
|
324
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(5));
|
325
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(5));
|
326
|
+
|
327
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(6));
|
328
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(6));
|
329
|
+
|
330
|
+
stringstream ss;
|
331
|
+
c.DescribeTo(&ss);
|
332
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "called between 3 and 5 times",
|
333
|
+
ss.str());
|
334
|
+
}
|
335
|
+
|
336
|
+
TEST(BetweenTest, HasCorrectBounds) {
|
337
|
+
const Cardinality c = Between(3, 5);
|
338
|
+
EXPECT_EQ(3, c.ConservativeLowerBound());
|
339
|
+
EXPECT_EQ(5, c.ConservativeUpperBound());
|
340
|
+
}
|
341
|
+
|
342
|
+
// Tests Exactly(n).
|
343
|
+
|
344
|
+
TEST(ExactlyTest, OnNegativeNumber) {
|
345
|
+
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
346
|
+
Exactly(-1);
|
347
|
+
}, "The invocation lower bound must be >= 0");
|
348
|
+
}
|
349
|
+
|
350
|
+
TEST(ExactlyTest, OnZero) {
|
351
|
+
const Cardinality c = Exactly(0);
|
352
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(0));
|
353
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(0));
|
354
|
+
|
355
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(1));
|
356
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(1));
|
357
|
+
|
358
|
+
stringstream ss;
|
359
|
+
c.DescribeTo(&ss);
|
360
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "never called",
|
361
|
+
ss.str());
|
362
|
+
}
|
363
|
+
|
364
|
+
TEST(ExactlyTest, OnPositiveNumber) {
|
365
|
+
const Cardinality c = Exactly(2);
|
366
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(0));
|
367
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(0));
|
368
|
+
|
369
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(2));
|
370
|
+
EXPECT_TRUE(c.IsSaturatedByCallCount(2));
|
371
|
+
|
372
|
+
stringstream ss1;
|
373
|
+
Exactly(1).DescribeTo(&ss1);
|
374
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "called once",
|
375
|
+
ss1.str());
|
376
|
+
|
377
|
+
stringstream ss2;
|
378
|
+
c.DescribeTo(&ss2);
|
379
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "called twice",
|
380
|
+
ss2.str());
|
381
|
+
|
382
|
+
stringstream ss3;
|
383
|
+
Exactly(3).DescribeTo(&ss3);
|
384
|
+
EXPECT_PRED_FORMAT2(IsSubstring, "called 3 times",
|
385
|
+
ss3.str());
|
386
|
+
}
|
387
|
+
|
388
|
+
TEST(ExactlyTest, HasCorrectBounds) {
|
389
|
+
const Cardinality c = Exactly(3);
|
390
|
+
EXPECT_EQ(3, c.ConservativeLowerBound());
|
391
|
+
EXPECT_EQ(3, c.ConservativeUpperBound());
|
392
|
+
}
|
393
|
+
|
394
|
+
// Tests that a user can make their own cardinality by implementing
|
395
|
+
// CardinalityInterface and calling MakeCardinality().
|
396
|
+
|
397
|
+
class EvenCardinality : public CardinalityInterface {
|
398
|
+
public:
|
399
|
+
// Returns true iff call_count calls will satisfy this cardinality.
|
400
|
+
virtual bool IsSatisfiedByCallCount(int call_count) const {
|
401
|
+
return (call_count % 2 == 0);
|
402
|
+
}
|
403
|
+
|
404
|
+
// Returns true iff call_count calls will saturate this cardinality.
|
405
|
+
virtual bool IsSaturatedByCallCount(int /* call_count */) const {
|
406
|
+
return false;
|
407
|
+
}
|
408
|
+
|
409
|
+
// Describes self to an ostream.
|
410
|
+
virtual void DescribeTo(::std::ostream* ss) const {
|
411
|
+
*ss << "called even number of times";
|
412
|
+
}
|
413
|
+
};
|
414
|
+
|
415
|
+
TEST(MakeCardinalityTest, ConstructsCardinalityFromInterface) {
|
416
|
+
const Cardinality c = MakeCardinality(new EvenCardinality);
|
417
|
+
|
418
|
+
EXPECT_TRUE(c.IsSatisfiedByCallCount(2));
|
419
|
+
EXPECT_FALSE(c.IsSatisfiedByCallCount(3));
|
420
|
+
|
421
|
+
EXPECT_FALSE(c.IsSaturatedByCallCount(10000));
|
422
|
+
|
423
|
+
stringstream ss;
|
424
|
+
c.DescribeTo(&ss);
|
425
|
+
EXPECT_EQ("called even number of times", ss.str());
|
426
|
+
}
|
427
|
+
|
428
|
+
} // Unnamed namespace
|
@@ -0,0 +1,1230 @@
|
|
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 tests the built-in actions generated by a script.
|
35
|
+
|
36
|
+
#include "gmock/gmock-generated-actions.h"
|
37
|
+
|
38
|
+
#include <functional>
|
39
|
+
#include <sstream>
|
40
|
+
#include <string>
|
41
|
+
#include "gmock/gmock.h"
|
42
|
+
#include "gtest/gtest.h"
|
43
|
+
|
44
|
+
namespace testing {
|
45
|
+
namespace gmock_generated_actions_test {
|
46
|
+
|
47
|
+
using ::std::plus;
|
48
|
+
using ::std::string;
|
49
|
+
using testing::get;
|
50
|
+
using testing::make_tuple;
|
51
|
+
using testing::tuple;
|
52
|
+
using testing::tuple_element;
|
53
|
+
using testing::_;
|
54
|
+
using testing::Action;
|
55
|
+
using testing::ActionInterface;
|
56
|
+
using testing::ByRef;
|
57
|
+
using testing::DoAll;
|
58
|
+
using testing::Invoke;
|
59
|
+
using testing::Return;
|
60
|
+
using testing::ReturnNew;
|
61
|
+
using testing::SetArgPointee;
|
62
|
+
using testing::StaticAssertTypeEq;
|
63
|
+
using testing::Unused;
|
64
|
+
using testing::WithArgs;
|
65
|
+
|
66
|
+
// For suppressing compiler warnings on conversion possibly losing precision.
|
67
|
+
inline short Short(short n) { return n; } // NOLINT
|
68
|
+
inline char Char(char ch) { return ch; }
|
69
|
+
|
70
|
+
// Sample functions and functors for testing various actions.
|
71
|
+
int Nullary() { return 1; }
|
72
|
+
|
73
|
+
class NullaryFunctor {
|
74
|
+
public:
|
75
|
+
int operator()() { return 2; }
|
76
|
+
};
|
77
|
+
|
78
|
+
bool g_done = false;
|
79
|
+
|
80
|
+
bool Unary(int x) { return x < 0; }
|
81
|
+
|
82
|
+
const char* Plus1(const char* s) { return s + 1; }
|
83
|
+
|
84
|
+
bool ByConstRef(const std::string& s) { return s == "Hi"; }
|
85
|
+
|
86
|
+
const double g_double = 0;
|
87
|
+
bool ReferencesGlobalDouble(const double& x) { return &x == &g_double; }
|
88
|
+
|
89
|
+
std::string ByNonConstRef(std::string& s) { return s += "+"; } // NOLINT
|
90
|
+
|
91
|
+
struct UnaryFunctor {
|
92
|
+
int operator()(bool x) { return x ? 1 : -1; }
|
93
|
+
};
|
94
|
+
|
95
|
+
const char* Binary(const char* input, short n) { return input + n; } // NOLINT
|
96
|
+
|
97
|
+
void VoidBinary(int, char) { g_done = true; }
|
98
|
+
|
99
|
+
int Ternary(int x, char y, short z) { return x + y + z; } // NOLINT
|
100
|
+
|
101
|
+
void VoidTernary(int, char, bool) { g_done = true; }
|
102
|
+
|
103
|
+
int SumOf4(int a, int b, int c, int d) { return a + b + c + d; }
|
104
|
+
|
105
|
+
std::string Concat4(const char* s1, const char* s2, const char* s3,
|
106
|
+
const char* s4) {
|
107
|
+
return std::string(s1) + s2 + s3 + s4;
|
108
|
+
}
|
109
|
+
|
110
|
+
int SumOf5(int a, int b, int c, int d, int e) { return a + b + c + d + e; }
|
111
|
+
|
112
|
+
struct SumOf5Functor {
|
113
|
+
int operator()(int a, int b, int c, int d, int e) {
|
114
|
+
return a + b + c + d + e;
|
115
|
+
}
|
116
|
+
};
|
117
|
+
|
118
|
+
std::string Concat5(const char* s1, const char* s2, const char* s3,
|
119
|
+
const char* s4, const char* s5) {
|
120
|
+
return std::string(s1) + s2 + s3 + s4 + s5;
|
121
|
+
}
|
122
|
+
|
123
|
+
int SumOf6(int a, int b, int c, int d, int e, int f) {
|
124
|
+
return a + b + c + d + e + f;
|
125
|
+
}
|
126
|
+
|
127
|
+
struct SumOf6Functor {
|
128
|
+
int operator()(int a, int b, int c, int d, int e, int f) {
|
129
|
+
return a + b + c + d + e + f;
|
130
|
+
}
|
131
|
+
};
|
132
|
+
|
133
|
+
std::string Concat6(const char* s1, const char* s2, const char* s3,
|
134
|
+
const char* s4, const char* s5, const char* s6) {
|
135
|
+
return std::string(s1) + s2 + s3 + s4 + s5 + s6;
|
136
|
+
}
|
137
|
+
|
138
|
+
std::string Concat7(const char* s1, const char* s2, const char* s3,
|
139
|
+
const char* s4, const char* s5, const char* s6,
|
140
|
+
const char* s7) {
|
141
|
+
return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
|
142
|
+
}
|
143
|
+
|
144
|
+
std::string Concat8(const char* s1, const char* s2, const char* s3,
|
145
|
+
const char* s4, const char* s5, const char* s6,
|
146
|
+
const char* s7, const char* s8) {
|
147
|
+
return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
|
148
|
+
}
|
149
|
+
|
150
|
+
std::string Concat9(const char* s1, const char* s2, const char* s3,
|
151
|
+
const char* s4, const char* s5, const char* s6,
|
152
|
+
const char* s7, const char* s8, const char* s9) {
|
153
|
+
return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
|
154
|
+
}
|
155
|
+
|
156
|
+
std::string Concat10(const char* s1, const char* s2, const char* s3,
|
157
|
+
const char* s4, const char* s5, const char* s6,
|
158
|
+
const char* s7, const char* s8, const char* s9,
|
159
|
+
const char* s10) {
|
160
|
+
return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
|
161
|
+
}
|
162
|
+
|
163
|
+
// A helper that turns the type of a C-string literal from const
|
164
|
+
// char[N] to const char*.
|
165
|
+
inline const char* CharPtr(const char* s) { return s; }
|
166
|
+
|
167
|
+
// Tests InvokeArgument<N>(...).
|
168
|
+
|
169
|
+
// Tests using InvokeArgument with a nullary function.
|
170
|
+
TEST(InvokeArgumentTest, Function0) {
|
171
|
+
Action<int(int, int(*)())> a = InvokeArgument<1>(); // NOLINT
|
172
|
+
EXPECT_EQ(1, a.Perform(make_tuple(2, &Nullary)));
|
173
|
+
}
|
174
|
+
|
175
|
+
// Tests using InvokeArgument with a unary function.
|
176
|
+
TEST(InvokeArgumentTest, Functor1) {
|
177
|
+
Action<int(UnaryFunctor)> a = InvokeArgument<0>(true); // NOLINT
|
178
|
+
EXPECT_EQ(1, a.Perform(make_tuple(UnaryFunctor())));
|
179
|
+
}
|
180
|
+
|
181
|
+
// Tests using InvokeArgument with a 5-ary function.
|
182
|
+
TEST(InvokeArgumentTest, Function5) {
|
183
|
+
Action<int(int(*)(int, int, int, int, int))> a = // NOLINT
|
184
|
+
InvokeArgument<0>(10000, 2000, 300, 40, 5);
|
185
|
+
EXPECT_EQ(12345, a.Perform(make_tuple(&SumOf5)));
|
186
|
+
}
|
187
|
+
|
188
|
+
// Tests using InvokeArgument with a 5-ary functor.
|
189
|
+
TEST(InvokeArgumentTest, Functor5) {
|
190
|
+
Action<int(SumOf5Functor)> a = // NOLINT
|
191
|
+
InvokeArgument<0>(10000, 2000, 300, 40, 5);
|
192
|
+
EXPECT_EQ(12345, a.Perform(make_tuple(SumOf5Functor())));
|
193
|
+
}
|
194
|
+
|
195
|
+
// Tests using InvokeArgument with a 6-ary function.
|
196
|
+
TEST(InvokeArgumentTest, Function6) {
|
197
|
+
Action<int(int(*)(int, int, int, int, int, int))> a = // NOLINT
|
198
|
+
InvokeArgument<0>(100000, 20000, 3000, 400, 50, 6);
|
199
|
+
EXPECT_EQ(123456, a.Perform(make_tuple(&SumOf6)));
|
200
|
+
}
|
201
|
+
|
202
|
+
// Tests using InvokeArgument with a 6-ary functor.
|
203
|
+
TEST(InvokeArgumentTest, Functor6) {
|
204
|
+
Action<int(SumOf6Functor)> a = // NOLINT
|
205
|
+
InvokeArgument<0>(100000, 20000, 3000, 400, 50, 6);
|
206
|
+
EXPECT_EQ(123456, a.Perform(make_tuple(SumOf6Functor())));
|
207
|
+
}
|
208
|
+
|
209
|
+
// Tests using InvokeArgument with a 7-ary function.
|
210
|
+
TEST(InvokeArgumentTest, Function7) {
|
211
|
+
Action<std::string(std::string(*)(const char*, const char*, const char*,
|
212
|
+
const char*, const char*, const char*,
|
213
|
+
const char*))>
|
214
|
+
a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7");
|
215
|
+
EXPECT_EQ("1234567", a.Perform(make_tuple(&Concat7)));
|
216
|
+
}
|
217
|
+
|
218
|
+
// Tests using InvokeArgument with a 8-ary function.
|
219
|
+
TEST(InvokeArgumentTest, Function8) {
|
220
|
+
Action<std::string(std::string(*)(const char*, const char*, const char*,
|
221
|
+
const char*, const char*, const char*,
|
222
|
+
const char*, const char*))>
|
223
|
+
a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8");
|
224
|
+
EXPECT_EQ("12345678", a.Perform(make_tuple(&Concat8)));
|
225
|
+
}
|
226
|
+
|
227
|
+
// Tests using InvokeArgument with a 9-ary function.
|
228
|
+
TEST(InvokeArgumentTest, Function9) {
|
229
|
+
Action<std::string(std::string(*)(const char*, const char*, const char*,
|
230
|
+
const char*, const char*, const char*,
|
231
|
+
const char*, const char*, const char*))>
|
232
|
+
a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8", "9");
|
233
|
+
EXPECT_EQ("123456789", a.Perform(make_tuple(&Concat9)));
|
234
|
+
}
|
235
|
+
|
236
|
+
// Tests using InvokeArgument with a 10-ary function.
|
237
|
+
TEST(InvokeArgumentTest, Function10) {
|
238
|
+
Action<std::string(std::string(*)(
|
239
|
+
const char*, const char*, const char*, const char*, const char*,
|
240
|
+
const char*, const char*, const char*, const char*, const char*))>
|
241
|
+
a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
|
242
|
+
EXPECT_EQ("1234567890", a.Perform(make_tuple(&Concat10)));
|
243
|
+
}
|
244
|
+
|
245
|
+
// Tests using InvokeArgument with a function that takes a pointer argument.
|
246
|
+
TEST(InvokeArgumentTest, ByPointerFunction) {
|
247
|
+
Action<const char*(const char*(*)(const char* input, short n))> a = // NOLINT
|
248
|
+
InvokeArgument<0>(static_cast<const char*>("Hi"), Short(1));
|
249
|
+
EXPECT_STREQ("i", a.Perform(make_tuple(&Binary)));
|
250
|
+
}
|
251
|
+
|
252
|
+
// Tests using InvokeArgument with a function that takes a const char*
|
253
|
+
// by passing it a C-string literal.
|
254
|
+
TEST(InvokeArgumentTest, FunctionWithCStringLiteral) {
|
255
|
+
Action<const char*(const char*(*)(const char* input, short n))> a = // NOLINT
|
256
|
+
InvokeArgument<0>("Hi", Short(1));
|
257
|
+
EXPECT_STREQ("i", a.Perform(make_tuple(&Binary)));
|
258
|
+
}
|
259
|
+
|
260
|
+
// Tests using InvokeArgument with a function that takes a const reference.
|
261
|
+
TEST(InvokeArgumentTest, ByConstReferenceFunction) {
|
262
|
+
Action<bool(bool (*function)(const std::string& s))> a = // NOLINT
|
263
|
+
InvokeArgument<0>(std::string("Hi"));
|
264
|
+
// When action 'a' is constructed, it makes a copy of the temporary
|
265
|
+
// string object passed to it, so it's OK to use 'a' later, when the
|
266
|
+
// temporary object has already died.
|
267
|
+
EXPECT_TRUE(a.Perform(make_tuple(&ByConstRef)));
|
268
|
+
}
|
269
|
+
|
270
|
+
// Tests using InvokeArgument with ByRef() and a function that takes a
|
271
|
+
// const reference.
|
272
|
+
TEST(InvokeArgumentTest, ByExplicitConstReferenceFunction) {
|
273
|
+
Action<bool(bool(*)(const double& x))> a = // NOLINT
|
274
|
+
InvokeArgument<0>(ByRef(g_double));
|
275
|
+
// The above line calls ByRef() on a const value.
|
276
|
+
EXPECT_TRUE(a.Perform(make_tuple(&ReferencesGlobalDouble)));
|
277
|
+
|
278
|
+
double x = 0;
|
279
|
+
a = InvokeArgument<0>(ByRef(x)); // This calls ByRef() on a non-const.
|
280
|
+
EXPECT_FALSE(a.Perform(make_tuple(&ReferencesGlobalDouble)));
|
281
|
+
}
|
282
|
+
|
283
|
+
// Tests using WithArgs and with an action that takes 1 argument.
|
284
|
+
TEST(WithArgsTest, OneArg) {
|
285
|
+
Action<bool(double x, int n)> a = WithArgs<1>(Invoke(Unary)); // NOLINT
|
286
|
+
EXPECT_TRUE(a.Perform(make_tuple(1.5, -1)));
|
287
|
+
EXPECT_FALSE(a.Perform(make_tuple(1.5, 1)));
|
288
|
+
}
|
289
|
+
|
290
|
+
// Tests using WithArgs with an action that takes 2 arguments.
|
291
|
+
TEST(WithArgsTest, TwoArgs) {
|
292
|
+
Action<const char*(const char* s, double x, short n)> a =
|
293
|
+
WithArgs<0, 2>(Invoke(Binary));
|
294
|
+
const char s[] = "Hello";
|
295
|
+
EXPECT_EQ(s + 2, a.Perform(make_tuple(CharPtr(s), 0.5, Short(2))));
|
296
|
+
}
|
297
|
+
|
298
|
+
// Tests using WithArgs with an action that takes 3 arguments.
|
299
|
+
TEST(WithArgsTest, ThreeArgs) {
|
300
|
+
Action<int(int, double, char, short)> a = // NOLINT
|
301
|
+
WithArgs<0, 2, 3>(Invoke(Ternary));
|
302
|
+
EXPECT_EQ(123, a.Perform(make_tuple(100, 6.5, Char(20), Short(3))));
|
303
|
+
}
|
304
|
+
|
305
|
+
// Tests using WithArgs with an action that takes 4 arguments.
|
306
|
+
TEST(WithArgsTest, FourArgs) {
|
307
|
+
Action<std::string(const char*, const char*, double, const char*,
|
308
|
+
const char*)>
|
309
|
+
a = WithArgs<4, 3, 1, 0>(Invoke(Concat4));
|
310
|
+
EXPECT_EQ("4310", a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), 2.5,
|
311
|
+
CharPtr("3"), CharPtr("4"))));
|
312
|
+
}
|
313
|
+
|
314
|
+
// Tests using WithArgs with an action that takes 5 arguments.
|
315
|
+
TEST(WithArgsTest, FiveArgs) {
|
316
|
+
Action<std::string(const char*, const char*, const char*, const char*,
|
317
|
+
const char*)>
|
318
|
+
a = WithArgs<4, 3, 2, 1, 0>(Invoke(Concat5));
|
319
|
+
EXPECT_EQ("43210",
|
320
|
+
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"),
|
321
|
+
CharPtr("3"), CharPtr("4"))));
|
322
|
+
}
|
323
|
+
|
324
|
+
// Tests using WithArgs with an action that takes 6 arguments.
|
325
|
+
TEST(WithArgsTest, SixArgs) {
|
326
|
+
Action<std::string(const char*, const char*, const char*)> a =
|
327
|
+
WithArgs<0, 1, 2, 2, 1, 0>(Invoke(Concat6));
|
328
|
+
EXPECT_EQ("012210",
|
329
|
+
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"))));
|
330
|
+
}
|
331
|
+
|
332
|
+
// Tests using WithArgs with an action that takes 7 arguments.
|
333
|
+
TEST(WithArgsTest, SevenArgs) {
|
334
|
+
Action<std::string(const char*, const char*, const char*, const char*)> a =
|
335
|
+
WithArgs<0, 1, 2, 3, 2, 1, 0>(Invoke(Concat7));
|
336
|
+
EXPECT_EQ("0123210",
|
337
|
+
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"),
|
338
|
+
CharPtr("3"))));
|
339
|
+
}
|
340
|
+
|
341
|
+
// Tests using WithArgs with an action that takes 8 arguments.
|
342
|
+
TEST(WithArgsTest, EightArgs) {
|
343
|
+
Action<std::string(const char*, const char*, const char*, const char*)> a =
|
344
|
+
WithArgs<0, 1, 2, 3, 0, 1, 2, 3>(Invoke(Concat8));
|
345
|
+
EXPECT_EQ("01230123",
|
346
|
+
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"),
|
347
|
+
CharPtr("3"))));
|
348
|
+
}
|
349
|
+
|
350
|
+
// Tests using WithArgs with an action that takes 9 arguments.
|
351
|
+
TEST(WithArgsTest, NineArgs) {
|
352
|
+
Action<std::string(const char*, const char*, const char*, const char*)> a =
|
353
|
+
WithArgs<0, 1, 2, 3, 1, 2, 3, 2, 3>(Invoke(Concat9));
|
354
|
+
EXPECT_EQ("012312323",
|
355
|
+
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"),
|
356
|
+
CharPtr("3"))));
|
357
|
+
}
|
358
|
+
|
359
|
+
// Tests using WithArgs with an action that takes 10 arguments.
|
360
|
+
TEST(WithArgsTest, TenArgs) {
|
361
|
+
Action<std::string(const char*, const char*, const char*, const char*)> a =
|
362
|
+
WithArgs<0, 1, 2, 3, 2, 1, 0, 1, 2, 3>(Invoke(Concat10));
|
363
|
+
EXPECT_EQ("0123210123",
|
364
|
+
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"),
|
365
|
+
CharPtr("3"))));
|
366
|
+
}
|
367
|
+
|
368
|
+
// Tests using WithArgs with an action that is not Invoke().
|
369
|
+
class SubstractAction : public ActionInterface<int(int, int)> { // NOLINT
|
370
|
+
public:
|
371
|
+
virtual int Perform(const tuple<int, int>& args) {
|
372
|
+
return get<0>(args) - get<1>(args);
|
373
|
+
}
|
374
|
+
};
|
375
|
+
|
376
|
+
TEST(WithArgsTest, NonInvokeAction) {
|
377
|
+
Action<int(const std::string&, int, int)> a = // NOLINT
|
378
|
+
WithArgs<2, 1>(MakeAction(new SubstractAction));
|
379
|
+
tuple<std::string, int, int> dummy = make_tuple(std::string("hi"), 2, 10);
|
380
|
+
EXPECT_EQ(8, a.Perform(dummy));
|
381
|
+
}
|
382
|
+
|
383
|
+
// Tests using WithArgs to pass all original arguments in the original order.
|
384
|
+
TEST(WithArgsTest, Identity) {
|
385
|
+
Action<int(int x, char y, short z)> a = // NOLINT
|
386
|
+
WithArgs<0, 1, 2>(Invoke(Ternary));
|
387
|
+
EXPECT_EQ(123, a.Perform(make_tuple(100, Char(20), Short(3))));
|
388
|
+
}
|
389
|
+
|
390
|
+
// Tests using WithArgs with repeated arguments.
|
391
|
+
TEST(WithArgsTest, RepeatedArguments) {
|
392
|
+
Action<int(bool, int m, int n)> a = // NOLINT
|
393
|
+
WithArgs<1, 1, 1, 1>(Invoke(SumOf4));
|
394
|
+
EXPECT_EQ(4, a.Perform(make_tuple(false, 1, 10)));
|
395
|
+
}
|
396
|
+
|
397
|
+
// Tests using WithArgs with reversed argument order.
|
398
|
+
TEST(WithArgsTest, ReversedArgumentOrder) {
|
399
|
+
Action<const char*(short n, const char* input)> a = // NOLINT
|
400
|
+
WithArgs<1, 0>(Invoke(Binary));
|
401
|
+
const char s[] = "Hello";
|
402
|
+
EXPECT_EQ(s + 2, a.Perform(make_tuple(Short(2), CharPtr(s))));
|
403
|
+
}
|
404
|
+
|
405
|
+
// Tests using WithArgs with compatible, but not identical, argument types.
|
406
|
+
TEST(WithArgsTest, ArgsOfCompatibleTypes) {
|
407
|
+
Action<long(short x, char y, double z, char c)> a = // NOLINT
|
408
|
+
WithArgs<0, 1, 3>(Invoke(Ternary));
|
409
|
+
EXPECT_EQ(123, a.Perform(make_tuple(Short(100), Char(20), 5.6, Char(3))));
|
410
|
+
}
|
411
|
+
|
412
|
+
// Tests using WithArgs with an action that returns void.
|
413
|
+
TEST(WithArgsTest, VoidAction) {
|
414
|
+
Action<void(double x, char c, int n)> a = WithArgs<2, 1>(Invoke(VoidBinary));
|
415
|
+
g_done = false;
|
416
|
+
a.Perform(make_tuple(1.5, 'a', 3));
|
417
|
+
EXPECT_TRUE(g_done);
|
418
|
+
}
|
419
|
+
|
420
|
+
// Tests DoAll(a1, a2).
|
421
|
+
TEST(DoAllTest, TwoActions) {
|
422
|
+
int n = 0;
|
423
|
+
Action<int(int*)> a = DoAll(SetArgPointee<0>(1), // NOLINT
|
424
|
+
Return(2));
|
425
|
+
EXPECT_EQ(2, a.Perform(make_tuple(&n)));
|
426
|
+
EXPECT_EQ(1, n);
|
427
|
+
}
|
428
|
+
|
429
|
+
// Tests DoAll(a1, a2, a3).
|
430
|
+
TEST(DoAllTest, ThreeActions) {
|
431
|
+
int m = 0, n = 0;
|
432
|
+
Action<int(int*, int*)> a = DoAll(SetArgPointee<0>(1), // NOLINT
|
433
|
+
SetArgPointee<1>(2),
|
434
|
+
Return(3));
|
435
|
+
EXPECT_EQ(3, a.Perform(make_tuple(&m, &n)));
|
436
|
+
EXPECT_EQ(1, m);
|
437
|
+
EXPECT_EQ(2, n);
|
438
|
+
}
|
439
|
+
|
440
|
+
// Tests DoAll(a1, a2, a3, a4).
|
441
|
+
TEST(DoAllTest, FourActions) {
|
442
|
+
int m = 0, n = 0;
|
443
|
+
char ch = '\0';
|
444
|
+
Action<int(int*, int*, char*)> a = // NOLINT
|
445
|
+
DoAll(SetArgPointee<0>(1),
|
446
|
+
SetArgPointee<1>(2),
|
447
|
+
SetArgPointee<2>('a'),
|
448
|
+
Return(3));
|
449
|
+
EXPECT_EQ(3, a.Perform(make_tuple(&m, &n, &ch)));
|
450
|
+
EXPECT_EQ(1, m);
|
451
|
+
EXPECT_EQ(2, n);
|
452
|
+
EXPECT_EQ('a', ch);
|
453
|
+
}
|
454
|
+
|
455
|
+
// Tests DoAll(a1, a2, a3, a4, a5).
|
456
|
+
TEST(DoAllTest, FiveActions) {
|
457
|
+
int m = 0, n = 0;
|
458
|
+
char a = '\0', b = '\0';
|
459
|
+
Action<int(int*, int*, char*, char*)> action = // NOLINT
|
460
|
+
DoAll(SetArgPointee<0>(1),
|
461
|
+
SetArgPointee<1>(2),
|
462
|
+
SetArgPointee<2>('a'),
|
463
|
+
SetArgPointee<3>('b'),
|
464
|
+
Return(3));
|
465
|
+
EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b)));
|
466
|
+
EXPECT_EQ(1, m);
|
467
|
+
EXPECT_EQ(2, n);
|
468
|
+
EXPECT_EQ('a', a);
|
469
|
+
EXPECT_EQ('b', b);
|
470
|
+
}
|
471
|
+
|
472
|
+
// Tests DoAll(a1, a2, ..., a6).
|
473
|
+
TEST(DoAllTest, SixActions) {
|
474
|
+
int m = 0, n = 0;
|
475
|
+
char a = '\0', b = '\0', c = '\0';
|
476
|
+
Action<int(int*, int*, char*, char*, char*)> action = // NOLINT
|
477
|
+
DoAll(SetArgPointee<0>(1),
|
478
|
+
SetArgPointee<1>(2),
|
479
|
+
SetArgPointee<2>('a'),
|
480
|
+
SetArgPointee<3>('b'),
|
481
|
+
SetArgPointee<4>('c'),
|
482
|
+
Return(3));
|
483
|
+
EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b, &c)));
|
484
|
+
EXPECT_EQ(1, m);
|
485
|
+
EXPECT_EQ(2, n);
|
486
|
+
EXPECT_EQ('a', a);
|
487
|
+
EXPECT_EQ('b', b);
|
488
|
+
EXPECT_EQ('c', c);
|
489
|
+
}
|
490
|
+
|
491
|
+
// Tests DoAll(a1, a2, ..., a7).
|
492
|
+
TEST(DoAllTest, SevenActions) {
|
493
|
+
int m = 0, n = 0;
|
494
|
+
char a = '\0', b = '\0', c = '\0', d = '\0';
|
495
|
+
Action<int(int*, int*, char*, char*, char*, char*)> action = // NOLINT
|
496
|
+
DoAll(SetArgPointee<0>(1),
|
497
|
+
SetArgPointee<1>(2),
|
498
|
+
SetArgPointee<2>('a'),
|
499
|
+
SetArgPointee<3>('b'),
|
500
|
+
SetArgPointee<4>('c'),
|
501
|
+
SetArgPointee<5>('d'),
|
502
|
+
Return(3));
|
503
|
+
EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b, &c, &d)));
|
504
|
+
EXPECT_EQ(1, m);
|
505
|
+
EXPECT_EQ(2, n);
|
506
|
+
EXPECT_EQ('a', a);
|
507
|
+
EXPECT_EQ('b', b);
|
508
|
+
EXPECT_EQ('c', c);
|
509
|
+
EXPECT_EQ('d', d);
|
510
|
+
}
|
511
|
+
|
512
|
+
// Tests DoAll(a1, a2, ..., a8).
|
513
|
+
TEST(DoAllTest, EightActions) {
|
514
|
+
int m = 0, n = 0;
|
515
|
+
char a = '\0', b = '\0', c = '\0', d = '\0', e = '\0';
|
516
|
+
Action<int(int*, int*, char*, char*, char*, char*, // NOLINT
|
517
|
+
char*)> action =
|
518
|
+
DoAll(SetArgPointee<0>(1),
|
519
|
+
SetArgPointee<1>(2),
|
520
|
+
SetArgPointee<2>('a'),
|
521
|
+
SetArgPointee<3>('b'),
|
522
|
+
SetArgPointee<4>('c'),
|
523
|
+
SetArgPointee<5>('d'),
|
524
|
+
SetArgPointee<6>('e'),
|
525
|
+
Return(3));
|
526
|
+
EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b, &c, &d, &e)));
|
527
|
+
EXPECT_EQ(1, m);
|
528
|
+
EXPECT_EQ(2, n);
|
529
|
+
EXPECT_EQ('a', a);
|
530
|
+
EXPECT_EQ('b', b);
|
531
|
+
EXPECT_EQ('c', c);
|
532
|
+
EXPECT_EQ('d', d);
|
533
|
+
EXPECT_EQ('e', e);
|
534
|
+
}
|
535
|
+
|
536
|
+
// Tests DoAll(a1, a2, ..., a9).
|
537
|
+
TEST(DoAllTest, NineActions) {
|
538
|
+
int m = 0, n = 0;
|
539
|
+
char a = '\0', b = '\0', c = '\0', d = '\0', e = '\0', f = '\0';
|
540
|
+
Action<int(int*, int*, char*, char*, char*, char*, // NOLINT
|
541
|
+
char*, char*)> action =
|
542
|
+
DoAll(SetArgPointee<0>(1),
|
543
|
+
SetArgPointee<1>(2),
|
544
|
+
SetArgPointee<2>('a'),
|
545
|
+
SetArgPointee<3>('b'),
|
546
|
+
SetArgPointee<4>('c'),
|
547
|
+
SetArgPointee<5>('d'),
|
548
|
+
SetArgPointee<6>('e'),
|
549
|
+
SetArgPointee<7>('f'),
|
550
|
+
Return(3));
|
551
|
+
EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b, &c, &d, &e, &f)));
|
552
|
+
EXPECT_EQ(1, m);
|
553
|
+
EXPECT_EQ(2, n);
|
554
|
+
EXPECT_EQ('a', a);
|
555
|
+
EXPECT_EQ('b', b);
|
556
|
+
EXPECT_EQ('c', c);
|
557
|
+
EXPECT_EQ('d', d);
|
558
|
+
EXPECT_EQ('e', e);
|
559
|
+
EXPECT_EQ('f', f);
|
560
|
+
}
|
561
|
+
|
562
|
+
// Tests DoAll(a1, a2, ..., a10).
|
563
|
+
TEST(DoAllTest, TenActions) {
|
564
|
+
int m = 0, n = 0;
|
565
|
+
char a = '\0', b = '\0', c = '\0', d = '\0';
|
566
|
+
char e = '\0', f = '\0', g = '\0';
|
567
|
+
Action<int(int*, int*, char*, char*, char*, char*, // NOLINT
|
568
|
+
char*, char*, char*)> action =
|
569
|
+
DoAll(SetArgPointee<0>(1),
|
570
|
+
SetArgPointee<1>(2),
|
571
|
+
SetArgPointee<2>('a'),
|
572
|
+
SetArgPointee<3>('b'),
|
573
|
+
SetArgPointee<4>('c'),
|
574
|
+
SetArgPointee<5>('d'),
|
575
|
+
SetArgPointee<6>('e'),
|
576
|
+
SetArgPointee<7>('f'),
|
577
|
+
SetArgPointee<8>('g'),
|
578
|
+
Return(3));
|
579
|
+
EXPECT_EQ(3, action.Perform(make_tuple(&m, &n, &a, &b, &c, &d, &e, &f, &g)));
|
580
|
+
EXPECT_EQ(1, m);
|
581
|
+
EXPECT_EQ(2, n);
|
582
|
+
EXPECT_EQ('a', a);
|
583
|
+
EXPECT_EQ('b', b);
|
584
|
+
EXPECT_EQ('c', c);
|
585
|
+
EXPECT_EQ('d', d);
|
586
|
+
EXPECT_EQ('e', e);
|
587
|
+
EXPECT_EQ('f', f);
|
588
|
+
EXPECT_EQ('g', g);
|
589
|
+
}
|
590
|
+
|
591
|
+
// The ACTION*() macros trigger warning C4100 (unreferenced formal
|
592
|
+
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
|
593
|
+
// the macro definition, as the warnings are generated when the macro
|
594
|
+
// is expanded and macro expansion cannot contain #pragma. Therefore
|
595
|
+
// we suppress them here.
|
596
|
+
#ifdef _MSC_VER
|
597
|
+
# pragma warning(push)
|
598
|
+
# pragma warning(disable:4100)
|
599
|
+
#endif
|
600
|
+
|
601
|
+
// Tests the ACTION*() macro family.
|
602
|
+
|
603
|
+
// Tests that ACTION() can define an action that doesn't reference the
|
604
|
+
// mock function arguments.
|
605
|
+
ACTION(Return5) { return 5; }
|
606
|
+
|
607
|
+
TEST(ActionMacroTest, WorksWhenNotReferencingArguments) {
|
608
|
+
Action<double()> a1 = Return5();
|
609
|
+
EXPECT_DOUBLE_EQ(5, a1.Perform(make_tuple()));
|
610
|
+
|
611
|
+
Action<int(double, bool)> a2 = Return5();
|
612
|
+
EXPECT_EQ(5, a2.Perform(make_tuple(1, true)));
|
613
|
+
}
|
614
|
+
|
615
|
+
// Tests that ACTION() can define an action that returns void.
|
616
|
+
ACTION(IncrementArg1) { (*arg1)++; }
|
617
|
+
|
618
|
+
TEST(ActionMacroTest, WorksWhenReturningVoid) {
|
619
|
+
Action<void(int, int*)> a1 = IncrementArg1();
|
620
|
+
int n = 0;
|
621
|
+
a1.Perform(make_tuple(5, &n));
|
622
|
+
EXPECT_EQ(1, n);
|
623
|
+
}
|
624
|
+
|
625
|
+
// Tests that the body of ACTION() can reference the type of the
|
626
|
+
// argument.
|
627
|
+
ACTION(IncrementArg2) {
|
628
|
+
StaticAssertTypeEq<int*, arg2_type>();
|
629
|
+
arg2_type temp = arg2;
|
630
|
+
(*temp)++;
|
631
|
+
}
|
632
|
+
|
633
|
+
TEST(ActionMacroTest, CanReferenceArgumentType) {
|
634
|
+
Action<void(int, bool, int*)> a1 = IncrementArg2();
|
635
|
+
int n = 0;
|
636
|
+
a1.Perform(make_tuple(5, false, &n));
|
637
|
+
EXPECT_EQ(1, n);
|
638
|
+
}
|
639
|
+
|
640
|
+
// Tests that the body of ACTION() can reference the argument tuple
|
641
|
+
// via args_type and args.
|
642
|
+
ACTION(Sum2) {
|
643
|
+
StaticAssertTypeEq<tuple<int, char, int*>, args_type>();
|
644
|
+
args_type args_copy = args;
|
645
|
+
return get<0>(args_copy) + get<1>(args_copy);
|
646
|
+
}
|
647
|
+
|
648
|
+
TEST(ActionMacroTest, CanReferenceArgumentTuple) {
|
649
|
+
Action<int(int, char, int*)> a1 = Sum2();
|
650
|
+
int dummy = 0;
|
651
|
+
EXPECT_EQ(11, a1.Perform(make_tuple(5, Char(6), &dummy)));
|
652
|
+
}
|
653
|
+
|
654
|
+
// Tests that the body of ACTION() can reference the mock function
|
655
|
+
// type.
|
656
|
+
int Dummy(bool flag) { return flag? 1 : 0; }
|
657
|
+
|
658
|
+
ACTION(InvokeDummy) {
|
659
|
+
StaticAssertTypeEq<int(bool), function_type>();
|
660
|
+
function_type* fp = &Dummy;
|
661
|
+
return (*fp)(true);
|
662
|
+
}
|
663
|
+
|
664
|
+
TEST(ActionMacroTest, CanReferenceMockFunctionType) {
|
665
|
+
Action<int(bool)> a1 = InvokeDummy();
|
666
|
+
EXPECT_EQ(1, a1.Perform(make_tuple(true)));
|
667
|
+
EXPECT_EQ(1, a1.Perform(make_tuple(false)));
|
668
|
+
}
|
669
|
+
|
670
|
+
// Tests that the body of ACTION() can reference the mock function's
|
671
|
+
// return type.
|
672
|
+
ACTION(InvokeDummy2) {
|
673
|
+
StaticAssertTypeEq<int, return_type>();
|
674
|
+
return_type result = Dummy(true);
|
675
|
+
return result;
|
676
|
+
}
|
677
|
+
|
678
|
+
TEST(ActionMacroTest, CanReferenceMockFunctionReturnType) {
|
679
|
+
Action<int(bool)> a1 = InvokeDummy2();
|
680
|
+
EXPECT_EQ(1, a1.Perform(make_tuple(true)));
|
681
|
+
EXPECT_EQ(1, a1.Perform(make_tuple(false)));
|
682
|
+
}
|
683
|
+
|
684
|
+
// Tests that ACTION() works for arguments passed by const reference.
|
685
|
+
ACTION(ReturnAddrOfConstBoolReferenceArg) {
|
686
|
+
StaticAssertTypeEq<const bool&, arg1_type>();
|
687
|
+
return &arg1;
|
688
|
+
}
|
689
|
+
|
690
|
+
TEST(ActionMacroTest, WorksForConstReferenceArg) {
|
691
|
+
Action<const bool*(int, const bool&)> a = ReturnAddrOfConstBoolReferenceArg();
|
692
|
+
const bool b = false;
|
693
|
+
EXPECT_EQ(&b, a.Perform(tuple<int, const bool&>(0, b)));
|
694
|
+
}
|
695
|
+
|
696
|
+
// Tests that ACTION() works for arguments passed by non-const reference.
|
697
|
+
ACTION(ReturnAddrOfIntReferenceArg) {
|
698
|
+
StaticAssertTypeEq<int&, arg0_type>();
|
699
|
+
return &arg0;
|
700
|
+
}
|
701
|
+
|
702
|
+
TEST(ActionMacroTest, WorksForNonConstReferenceArg) {
|
703
|
+
Action<int*(int&, bool, int)> a = ReturnAddrOfIntReferenceArg();
|
704
|
+
int n = 0;
|
705
|
+
EXPECT_EQ(&n, a.Perform(tuple<int&, bool, int>(n, true, 1)));
|
706
|
+
}
|
707
|
+
|
708
|
+
// Tests that ACTION() can be used in a namespace.
|
709
|
+
namespace action_test {
|
710
|
+
ACTION(Sum) { return arg0 + arg1; }
|
711
|
+
} // namespace action_test
|
712
|
+
|
713
|
+
TEST(ActionMacroTest, WorksInNamespace) {
|
714
|
+
Action<int(int, int)> a1 = action_test::Sum();
|
715
|
+
EXPECT_EQ(3, a1.Perform(make_tuple(1, 2)));
|
716
|
+
}
|
717
|
+
|
718
|
+
// Tests that the same ACTION definition works for mock functions with
|
719
|
+
// different argument numbers.
|
720
|
+
ACTION(PlusTwo) { return arg0 + 2; }
|
721
|
+
|
722
|
+
TEST(ActionMacroTest, WorksForDifferentArgumentNumbers) {
|
723
|
+
Action<int(int)> a1 = PlusTwo();
|
724
|
+
EXPECT_EQ(4, a1.Perform(make_tuple(2)));
|
725
|
+
|
726
|
+
Action<double(float, void*)> a2 = PlusTwo();
|
727
|
+
int dummy;
|
728
|
+
EXPECT_DOUBLE_EQ(6, a2.Perform(make_tuple(4.0f, &dummy)));
|
729
|
+
}
|
730
|
+
|
731
|
+
// Tests that ACTION_P can define a parameterized action.
|
732
|
+
ACTION_P(Plus, n) { return arg0 + n; }
|
733
|
+
|
734
|
+
TEST(ActionPMacroTest, DefinesParameterizedAction) {
|
735
|
+
Action<int(int m, bool t)> a1 = Plus(9);
|
736
|
+
EXPECT_EQ(10, a1.Perform(make_tuple(1, true)));
|
737
|
+
}
|
738
|
+
|
739
|
+
// Tests that the body of ACTION_P can reference the argument types
|
740
|
+
// and the parameter type.
|
741
|
+
ACTION_P(TypedPlus, n) {
|
742
|
+
arg0_type t1 = arg0;
|
743
|
+
n_type t2 = n;
|
744
|
+
return t1 + t2;
|
745
|
+
}
|
746
|
+
|
747
|
+
TEST(ActionPMacroTest, CanReferenceArgumentAndParameterTypes) {
|
748
|
+
Action<int(char m, bool t)> a1 = TypedPlus(9);
|
749
|
+
EXPECT_EQ(10, a1.Perform(make_tuple(Char(1), true)));
|
750
|
+
}
|
751
|
+
|
752
|
+
// Tests that a parameterized action can be used in any mock function
|
753
|
+
// whose type is compatible.
|
754
|
+
TEST(ActionPMacroTest, WorksInCompatibleMockFunction) {
|
755
|
+
Action<std::string(const std::string& s)> a1 = Plus("tail");
|
756
|
+
const std::string re = "re";
|
757
|
+
tuple<const std::string> dummy = make_tuple(re);
|
758
|
+
EXPECT_EQ("retail", a1.Perform(dummy));
|
759
|
+
}
|
760
|
+
|
761
|
+
// Tests that we can use ACTION*() to define actions overloaded on the
|
762
|
+
// number of parameters.
|
763
|
+
|
764
|
+
ACTION(OverloadedAction) { return arg0 ? arg1 : "hello"; }
|
765
|
+
|
766
|
+
ACTION_P(OverloadedAction, default_value) {
|
767
|
+
return arg0 ? arg1 : default_value;
|
768
|
+
}
|
769
|
+
|
770
|
+
ACTION_P2(OverloadedAction, true_value, false_value) {
|
771
|
+
return arg0 ? true_value : false_value;
|
772
|
+
}
|
773
|
+
|
774
|
+
TEST(ActionMacroTest, CanDefineOverloadedActions) {
|
775
|
+
typedef Action<const char*(bool, const char*)> MyAction;
|
776
|
+
|
777
|
+
const MyAction a1 = OverloadedAction();
|
778
|
+
EXPECT_STREQ("hello", a1.Perform(make_tuple(false, CharPtr("world"))));
|
779
|
+
EXPECT_STREQ("world", a1.Perform(make_tuple(true, CharPtr("world"))));
|
780
|
+
|
781
|
+
const MyAction a2 = OverloadedAction("hi");
|
782
|
+
EXPECT_STREQ("hi", a2.Perform(make_tuple(false, CharPtr("world"))));
|
783
|
+
EXPECT_STREQ("world", a2.Perform(make_tuple(true, CharPtr("world"))));
|
784
|
+
|
785
|
+
const MyAction a3 = OverloadedAction("hi", "you");
|
786
|
+
EXPECT_STREQ("hi", a3.Perform(make_tuple(true, CharPtr("world"))));
|
787
|
+
EXPECT_STREQ("you", a3.Perform(make_tuple(false, CharPtr("world"))));
|
788
|
+
}
|
789
|
+
|
790
|
+
// Tests ACTION_Pn where n >= 3.
|
791
|
+
|
792
|
+
ACTION_P3(Plus, m, n, k) { return arg0 + m + n + k; }
|
793
|
+
|
794
|
+
TEST(ActionPnMacroTest, WorksFor3Parameters) {
|
795
|
+
Action<double(int m, bool t)> a1 = Plus(100, 20, 3.4);
|
796
|
+
EXPECT_DOUBLE_EQ(3123.4, a1.Perform(make_tuple(3000, true)));
|
797
|
+
|
798
|
+
Action<std::string(const std::string& s)> a2 = Plus("tail", "-", ">");
|
799
|
+
const std::string re = "re";
|
800
|
+
tuple<const std::string> dummy = make_tuple(re);
|
801
|
+
EXPECT_EQ("retail->", a2.Perform(dummy));
|
802
|
+
}
|
803
|
+
|
804
|
+
ACTION_P4(Plus, p0, p1, p2, p3) { return arg0 + p0 + p1 + p2 + p3; }
|
805
|
+
|
806
|
+
TEST(ActionPnMacroTest, WorksFor4Parameters) {
|
807
|
+
Action<int(int)> a1 = Plus(1, 2, 3, 4);
|
808
|
+
EXPECT_EQ(10 + 1 + 2 + 3 + 4, a1.Perform(make_tuple(10)));
|
809
|
+
}
|
810
|
+
|
811
|
+
ACTION_P5(Plus, p0, p1, p2, p3, p4) { return arg0 + p0 + p1 + p2 + p3 + p4; }
|
812
|
+
|
813
|
+
TEST(ActionPnMacroTest, WorksFor5Parameters) {
|
814
|
+
Action<int(int)> a1 = Plus(1, 2, 3, 4, 5);
|
815
|
+
EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5, a1.Perform(make_tuple(10)));
|
816
|
+
}
|
817
|
+
|
818
|
+
ACTION_P6(Plus, p0, p1, p2, p3, p4, p5) {
|
819
|
+
return arg0 + p0 + p1 + p2 + p3 + p4 + p5;
|
820
|
+
}
|
821
|
+
|
822
|
+
TEST(ActionPnMacroTest, WorksFor6Parameters) {
|
823
|
+
Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6);
|
824
|
+
EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6, a1.Perform(make_tuple(10)));
|
825
|
+
}
|
826
|
+
|
827
|
+
ACTION_P7(Plus, p0, p1, p2, p3, p4, p5, p6) {
|
828
|
+
return arg0 + p0 + p1 + p2 + p3 + p4 + p5 + p6;
|
829
|
+
}
|
830
|
+
|
831
|
+
TEST(ActionPnMacroTest, WorksFor7Parameters) {
|
832
|
+
Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7);
|
833
|
+
EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7, a1.Perform(make_tuple(10)));
|
834
|
+
}
|
835
|
+
|
836
|
+
ACTION_P8(Plus, p0, p1, p2, p3, p4, p5, p6, p7) {
|
837
|
+
return arg0 + p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7;
|
838
|
+
}
|
839
|
+
|
840
|
+
TEST(ActionPnMacroTest, WorksFor8Parameters) {
|
841
|
+
Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8);
|
842
|
+
EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8, a1.Perform(make_tuple(10)));
|
843
|
+
}
|
844
|
+
|
845
|
+
ACTION_P9(Plus, p0, p1, p2, p3, p4, p5, p6, p7, p8) {
|
846
|
+
return arg0 + p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8;
|
847
|
+
}
|
848
|
+
|
849
|
+
TEST(ActionPnMacroTest, WorksFor9Parameters) {
|
850
|
+
Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8, 9);
|
851
|
+
EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9, a1.Perform(make_tuple(10)));
|
852
|
+
}
|
853
|
+
|
854
|
+
ACTION_P10(Plus, p0, p1, p2, p3, p4, p5, p6, p7, p8, last_param) {
|
855
|
+
arg0_type t0 = arg0;
|
856
|
+
last_param_type t9 = last_param;
|
857
|
+
return t0 + p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + t9;
|
858
|
+
}
|
859
|
+
|
860
|
+
TEST(ActionPnMacroTest, WorksFor10Parameters) {
|
861
|
+
Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
862
|
+
EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10,
|
863
|
+
a1.Perform(make_tuple(10)));
|
864
|
+
}
|
865
|
+
|
866
|
+
// Tests that the action body can promote the parameter types.
|
867
|
+
|
868
|
+
ACTION_P2(PadArgument, prefix, suffix) {
|
869
|
+
// The following lines promote the two parameters to desired types.
|
870
|
+
std::string prefix_str(prefix);
|
871
|
+
char suffix_char = static_cast<char>(suffix);
|
872
|
+
return prefix_str + arg0 + suffix_char;
|
873
|
+
}
|
874
|
+
|
875
|
+
TEST(ActionPnMacroTest, SimpleTypePromotion) {
|
876
|
+
Action<std::string(const char*)> no_promo =
|
877
|
+
PadArgument(std::string("foo"), 'r');
|
878
|
+
Action<std::string(const char*)> promo =
|
879
|
+
PadArgument("foo", static_cast<int>('r'));
|
880
|
+
EXPECT_EQ("foobar", no_promo.Perform(make_tuple(CharPtr("ba"))));
|
881
|
+
EXPECT_EQ("foobar", promo.Perform(make_tuple(CharPtr("ba"))));
|
882
|
+
}
|
883
|
+
|
884
|
+
// Tests that we can partially restrict parameter types using a
|
885
|
+
// straight-forward pattern.
|
886
|
+
|
887
|
+
// Defines a generic action that doesn't restrict the types of its
|
888
|
+
// parameters.
|
889
|
+
ACTION_P3(ConcatImpl, a, b, c) {
|
890
|
+
std::stringstream ss;
|
891
|
+
ss << a << b << c;
|
892
|
+
return ss.str();
|
893
|
+
}
|
894
|
+
|
895
|
+
// Next, we try to restrict that either the first parameter is a
|
896
|
+
// string, or the second parameter is an int.
|
897
|
+
|
898
|
+
// Defines a partially specialized wrapper that restricts the first
|
899
|
+
// parameter to std::string.
|
900
|
+
template <typename T1, typename T2>
|
901
|
+
// ConcatImplActionP3 is the class template ACTION_P3 uses to
|
902
|
+
// implement ConcatImpl. We shouldn't change the name as this
|
903
|
+
// pattern requires the user to use it directly.
|
904
|
+
ConcatImplActionP3<std::string, T1, T2>
|
905
|
+
Concat(const std::string& a, T1 b, T2 c) {
|
906
|
+
GTEST_INTENTIONAL_CONST_COND_PUSH_()
|
907
|
+
if (true) {
|
908
|
+
GTEST_INTENTIONAL_CONST_COND_POP_()
|
909
|
+
// This branch verifies that ConcatImpl() can be invoked without
|
910
|
+
// explicit template arguments.
|
911
|
+
return ConcatImpl(a, b, c);
|
912
|
+
} else {
|
913
|
+
// This branch verifies that ConcatImpl() can also be invoked with
|
914
|
+
// explicit template arguments. It doesn't really need to be
|
915
|
+
// executed as this is a compile-time verification.
|
916
|
+
return ConcatImpl<std::string, T1, T2>(a, b, c);
|
917
|
+
}
|
918
|
+
}
|
919
|
+
|
920
|
+
// Defines another partially specialized wrapper that restricts the
|
921
|
+
// second parameter to int.
|
922
|
+
template <typename T1, typename T2>
|
923
|
+
ConcatImplActionP3<T1, int, T2>
|
924
|
+
Concat(T1 a, int b, T2 c) {
|
925
|
+
return ConcatImpl(a, b, c);
|
926
|
+
}
|
927
|
+
|
928
|
+
TEST(ActionPnMacroTest, CanPartiallyRestrictParameterTypes) {
|
929
|
+
Action<const std::string()> a1 = Concat("Hello", "1", 2);
|
930
|
+
EXPECT_EQ("Hello12", a1.Perform(make_tuple()));
|
931
|
+
|
932
|
+
a1 = Concat(1, 2, 3);
|
933
|
+
EXPECT_EQ("123", a1.Perform(make_tuple()));
|
934
|
+
}
|
935
|
+
|
936
|
+
// Verifies the type of an ACTION*.
|
937
|
+
|
938
|
+
ACTION(DoFoo) {}
|
939
|
+
ACTION_P(DoFoo, p) {}
|
940
|
+
ACTION_P2(DoFoo, p0, p1) {}
|
941
|
+
|
942
|
+
TEST(ActionPnMacroTest, TypesAreCorrect) {
|
943
|
+
// DoFoo() must be assignable to a DoFooAction variable.
|
944
|
+
DoFooAction a0 = DoFoo();
|
945
|
+
|
946
|
+
// DoFoo(1) must be assignable to a DoFooActionP variable.
|
947
|
+
DoFooActionP<int> a1 = DoFoo(1);
|
948
|
+
|
949
|
+
// DoFoo(p1, ..., pk) must be assignable to a DoFooActionPk
|
950
|
+
// variable, and so on.
|
951
|
+
DoFooActionP2<int, char> a2 = DoFoo(1, '2');
|
952
|
+
PlusActionP3<int, int, char> a3 = Plus(1, 2, '3');
|
953
|
+
PlusActionP4<int, int, int, char> a4 = Plus(1, 2, 3, '4');
|
954
|
+
PlusActionP5<int, int, int, int, char> a5 = Plus(1, 2, 3, 4, '5');
|
955
|
+
PlusActionP6<int, int, int, int, int, char> a6 = Plus(1, 2, 3, 4, 5, '6');
|
956
|
+
PlusActionP7<int, int, int, int, int, int, char> a7 =
|
957
|
+
Plus(1, 2, 3, 4, 5, 6, '7');
|
958
|
+
PlusActionP8<int, int, int, int, int, int, int, char> a8 =
|
959
|
+
Plus(1, 2, 3, 4, 5, 6, 7, '8');
|
960
|
+
PlusActionP9<int, int, int, int, int, int, int, int, char> a9 =
|
961
|
+
Plus(1, 2, 3, 4, 5, 6, 7, 8, '9');
|
962
|
+
PlusActionP10<int, int, int, int, int, int, int, int, int, char> a10 =
|
963
|
+
Plus(1, 2, 3, 4, 5, 6, 7, 8, 9, '0');
|
964
|
+
|
965
|
+
// Avoid "unused variable" warnings.
|
966
|
+
(void)a0;
|
967
|
+
(void)a1;
|
968
|
+
(void)a2;
|
969
|
+
(void)a3;
|
970
|
+
(void)a4;
|
971
|
+
(void)a5;
|
972
|
+
(void)a6;
|
973
|
+
(void)a7;
|
974
|
+
(void)a8;
|
975
|
+
(void)a9;
|
976
|
+
(void)a10;
|
977
|
+
}
|
978
|
+
|
979
|
+
// Tests that an ACTION_P*() action can be explicitly instantiated
|
980
|
+
// with reference-typed parameters.
|
981
|
+
|
982
|
+
ACTION_P(Plus1, x) { return x; }
|
983
|
+
ACTION_P2(Plus2, x, y) { return x + y; }
|
984
|
+
ACTION_P3(Plus3, x, y, z) { return x + y + z; }
|
985
|
+
ACTION_P10(Plus10, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
986
|
+
return a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9;
|
987
|
+
}
|
988
|
+
|
989
|
+
TEST(ActionPnMacroTest, CanExplicitlyInstantiateWithReferenceTypes) {
|
990
|
+
int x = 1, y = 2, z = 3;
|
991
|
+
const tuple<> empty = make_tuple();
|
992
|
+
|
993
|
+
Action<int()> a = Plus1<int&>(x);
|
994
|
+
EXPECT_EQ(1, a.Perform(empty));
|
995
|
+
|
996
|
+
a = Plus2<const int&, int&>(x, y);
|
997
|
+
EXPECT_EQ(3, a.Perform(empty));
|
998
|
+
|
999
|
+
a = Plus3<int&, const int&, int&>(x, y, z);
|
1000
|
+
EXPECT_EQ(6, a.Perform(empty));
|
1001
|
+
|
1002
|
+
int n[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
1003
|
+
a = Plus10<const int&, int&, const int&, int&, const int&, int&, const int&,
|
1004
|
+
int&, const int&, int&>(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7],
|
1005
|
+
n[8], n[9]);
|
1006
|
+
EXPECT_EQ(55, a.Perform(empty));
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
class NullaryConstructorClass {
|
1010
|
+
public:
|
1011
|
+
NullaryConstructorClass() : value_(123) {}
|
1012
|
+
int value_;
|
1013
|
+
};
|
1014
|
+
|
1015
|
+
// Tests using ReturnNew() with a nullary constructor.
|
1016
|
+
TEST(ReturnNewTest, NoArgs) {
|
1017
|
+
Action<NullaryConstructorClass*()> a = ReturnNew<NullaryConstructorClass>();
|
1018
|
+
NullaryConstructorClass* c = a.Perform(make_tuple());
|
1019
|
+
EXPECT_EQ(123, c->value_);
|
1020
|
+
delete c;
|
1021
|
+
}
|
1022
|
+
|
1023
|
+
class UnaryConstructorClass {
|
1024
|
+
public:
|
1025
|
+
explicit UnaryConstructorClass(int value) : value_(value) {}
|
1026
|
+
int value_;
|
1027
|
+
};
|
1028
|
+
|
1029
|
+
// Tests using ReturnNew() with a unary constructor.
|
1030
|
+
TEST(ReturnNewTest, Unary) {
|
1031
|
+
Action<UnaryConstructorClass*()> a = ReturnNew<UnaryConstructorClass>(4000);
|
1032
|
+
UnaryConstructorClass* c = a.Perform(make_tuple());
|
1033
|
+
EXPECT_EQ(4000, c->value_);
|
1034
|
+
delete c;
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
TEST(ReturnNewTest, UnaryWorksWhenMockMethodHasArgs) {
|
1038
|
+
Action<UnaryConstructorClass*(bool, int)> a =
|
1039
|
+
ReturnNew<UnaryConstructorClass>(4000);
|
1040
|
+
UnaryConstructorClass* c = a.Perform(make_tuple(false, 5));
|
1041
|
+
EXPECT_EQ(4000, c->value_);
|
1042
|
+
delete c;
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
TEST(ReturnNewTest, UnaryWorksWhenMockMethodReturnsPointerToConst) {
|
1046
|
+
Action<const UnaryConstructorClass*()> a =
|
1047
|
+
ReturnNew<UnaryConstructorClass>(4000);
|
1048
|
+
const UnaryConstructorClass* c = a.Perform(make_tuple());
|
1049
|
+
EXPECT_EQ(4000, c->value_);
|
1050
|
+
delete c;
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
class TenArgConstructorClass {
|
1054
|
+
public:
|
1055
|
+
TenArgConstructorClass(int a1, int a2, int a3, int a4, int a5,
|
1056
|
+
int a6, int a7, int a8, int a9, int a10)
|
1057
|
+
: value_(a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10) {
|
1058
|
+
}
|
1059
|
+
int value_;
|
1060
|
+
};
|
1061
|
+
|
1062
|
+
// Tests using ReturnNew() with a 10-argument constructor.
|
1063
|
+
TEST(ReturnNewTest, ConstructorThatTakes10Arguments) {
|
1064
|
+
Action<TenArgConstructorClass*()> a =
|
1065
|
+
ReturnNew<TenArgConstructorClass>(1000000000, 200000000, 30000000,
|
1066
|
+
4000000, 500000, 60000,
|
1067
|
+
7000, 800, 90, 0);
|
1068
|
+
TenArgConstructorClass* c = a.Perform(make_tuple());
|
1069
|
+
EXPECT_EQ(1234567890, c->value_);
|
1070
|
+
delete c;
|
1071
|
+
}
|
1072
|
+
|
1073
|
+
// Tests that ACTION_TEMPLATE works when there is no value parameter.
|
1074
|
+
ACTION_TEMPLATE(CreateNew,
|
1075
|
+
HAS_1_TEMPLATE_PARAMS(typename, T),
|
1076
|
+
AND_0_VALUE_PARAMS()) {
|
1077
|
+
return new T;
|
1078
|
+
}
|
1079
|
+
|
1080
|
+
TEST(ActionTemplateTest, WorksWithoutValueParam) {
|
1081
|
+
const Action<int*()> a = CreateNew<int>();
|
1082
|
+
int* p = a.Perform(make_tuple());
|
1083
|
+
delete p;
|
1084
|
+
}
|
1085
|
+
|
1086
|
+
// Tests that ACTION_TEMPLATE works when there are value parameters.
|
1087
|
+
ACTION_TEMPLATE(CreateNew,
|
1088
|
+
HAS_1_TEMPLATE_PARAMS(typename, T),
|
1089
|
+
AND_1_VALUE_PARAMS(a0)) {
|
1090
|
+
return new T(a0);
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
TEST(ActionTemplateTest, WorksWithValueParams) {
|
1094
|
+
const Action<int*()> a = CreateNew<int>(42);
|
1095
|
+
int* p = a.Perform(make_tuple());
|
1096
|
+
EXPECT_EQ(42, *p);
|
1097
|
+
delete p;
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
// Tests that ACTION_TEMPLATE works for integral template parameters.
|
1101
|
+
ACTION_TEMPLATE(MyDeleteArg,
|
1102
|
+
HAS_1_TEMPLATE_PARAMS(int, k),
|
1103
|
+
AND_0_VALUE_PARAMS()) {
|
1104
|
+
delete get<k>(args);
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
// Resets a bool variable in the destructor.
|
1108
|
+
class BoolResetter {
|
1109
|
+
public:
|
1110
|
+
explicit BoolResetter(bool* value) : value_(value) {}
|
1111
|
+
~BoolResetter() { *value_ = false; }
|
1112
|
+
private:
|
1113
|
+
bool* value_;
|
1114
|
+
};
|
1115
|
+
|
1116
|
+
TEST(ActionTemplateTest, WorksForIntegralTemplateParams) {
|
1117
|
+
const Action<void(int*, BoolResetter*)> a = MyDeleteArg<1>();
|
1118
|
+
int n = 0;
|
1119
|
+
bool b = true;
|
1120
|
+
BoolResetter* resetter = new BoolResetter(&b);
|
1121
|
+
a.Perform(make_tuple(&n, resetter));
|
1122
|
+
EXPECT_FALSE(b); // Verifies that resetter is deleted.
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
// Tests that ACTION_TEMPLATES works for template template parameters.
|
1126
|
+
ACTION_TEMPLATE(ReturnSmartPointer,
|
1127
|
+
HAS_1_TEMPLATE_PARAMS(template <typename Pointee> class,
|
1128
|
+
Pointer),
|
1129
|
+
AND_1_VALUE_PARAMS(pointee)) {
|
1130
|
+
return Pointer<pointee_type>(new pointee_type(pointee));
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
TEST(ActionTemplateTest, WorksForTemplateTemplateParameters) {
|
1134
|
+
using ::testing::internal::linked_ptr;
|
1135
|
+
const Action<linked_ptr<int>()> a = ReturnSmartPointer<linked_ptr>(42);
|
1136
|
+
linked_ptr<int> p = a.Perform(make_tuple());
|
1137
|
+
EXPECT_EQ(42, *p);
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
// Tests that ACTION_TEMPLATE works for 10 template parameters.
|
1141
|
+
template <typename T1, typename T2, typename T3, int k4, bool k5,
|
1142
|
+
unsigned int k6, typename T7, typename T8, typename T9>
|
1143
|
+
struct GiantTemplate {
|
1144
|
+
public:
|
1145
|
+
explicit GiantTemplate(int a_value) : value(a_value) {}
|
1146
|
+
int value;
|
1147
|
+
};
|
1148
|
+
|
1149
|
+
ACTION_TEMPLATE(ReturnGiant,
|
1150
|
+
HAS_10_TEMPLATE_PARAMS(
|
1151
|
+
typename, T1,
|
1152
|
+
typename, T2,
|
1153
|
+
typename, T3,
|
1154
|
+
int, k4,
|
1155
|
+
bool, k5,
|
1156
|
+
unsigned int, k6,
|
1157
|
+
class, T7,
|
1158
|
+
class, T8,
|
1159
|
+
class, T9,
|
1160
|
+
template <typename T> class, T10),
|
1161
|
+
AND_1_VALUE_PARAMS(value)) {
|
1162
|
+
return GiantTemplate<T10<T1>, T2, T3, k4, k5, k6, T7, T8, T9>(value);
|
1163
|
+
}
|
1164
|
+
|
1165
|
+
TEST(ActionTemplateTest, WorksFor10TemplateParameters) {
|
1166
|
+
using ::testing::internal::linked_ptr;
|
1167
|
+
typedef GiantTemplate<linked_ptr<int>, bool, double, 5,
|
1168
|
+
true, 6, char, unsigned, int> Giant;
|
1169
|
+
const Action<Giant()> a = ReturnGiant<
|
1170
|
+
int, bool, double, 5, true, 6, char, unsigned, int, linked_ptr>(42);
|
1171
|
+
Giant giant = a.Perform(make_tuple());
|
1172
|
+
EXPECT_EQ(42, giant.value);
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
// Tests that ACTION_TEMPLATE works for 10 value parameters.
|
1176
|
+
ACTION_TEMPLATE(ReturnSum,
|
1177
|
+
HAS_1_TEMPLATE_PARAMS(typename, Number),
|
1178
|
+
AND_10_VALUE_PARAMS(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10)) {
|
1179
|
+
return static_cast<Number>(v1) + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10;
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
TEST(ActionTemplateTest, WorksFor10ValueParameters) {
|
1183
|
+
const Action<int()> a = ReturnSum<int>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
1184
|
+
EXPECT_EQ(55, a.Perform(make_tuple()));
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
// Tests that ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded
|
1188
|
+
// on the number of value parameters.
|
1189
|
+
|
1190
|
+
ACTION(ReturnSum) { return 0; }
|
1191
|
+
|
1192
|
+
ACTION_P(ReturnSum, x) { return x; }
|
1193
|
+
|
1194
|
+
ACTION_TEMPLATE(ReturnSum,
|
1195
|
+
HAS_1_TEMPLATE_PARAMS(typename, Number),
|
1196
|
+
AND_2_VALUE_PARAMS(v1, v2)) {
|
1197
|
+
return static_cast<Number>(v1) + v2;
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
ACTION_TEMPLATE(ReturnSum,
|
1201
|
+
HAS_1_TEMPLATE_PARAMS(typename, Number),
|
1202
|
+
AND_3_VALUE_PARAMS(v1, v2, v3)) {
|
1203
|
+
return static_cast<Number>(v1) + v2 + v3;
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
ACTION_TEMPLATE(ReturnSum,
|
1207
|
+
HAS_2_TEMPLATE_PARAMS(typename, Number, int, k),
|
1208
|
+
AND_4_VALUE_PARAMS(v1, v2, v3, v4)) {
|
1209
|
+
return static_cast<Number>(v1) + v2 + v3 + v4 + k;
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
TEST(ActionTemplateTest, CanBeOverloadedOnNumberOfValueParameters) {
|
1213
|
+
const Action<int()> a0 = ReturnSum();
|
1214
|
+
const Action<int()> a1 = ReturnSum(1);
|
1215
|
+
const Action<int()> a2 = ReturnSum<int>(1, 2);
|
1216
|
+
const Action<int()> a3 = ReturnSum<int>(1, 2, 3);
|
1217
|
+
const Action<int()> a4 = ReturnSum<int, 10000>(2000, 300, 40, 5);
|
1218
|
+
EXPECT_EQ(0, a0.Perform(make_tuple()));
|
1219
|
+
EXPECT_EQ(1, a1.Perform(make_tuple()));
|
1220
|
+
EXPECT_EQ(3, a2.Perform(make_tuple()));
|
1221
|
+
EXPECT_EQ(6, a3.Perform(make_tuple()));
|
1222
|
+
EXPECT_EQ(12345, a4.Perform(make_tuple()));
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
#ifdef _MSC_VER
|
1226
|
+
# pragma warning(pop)
|
1227
|
+
#endif
|
1228
|
+
|
1229
|
+
} // namespace gmock_generated_actions_test
|
1230
|
+
} // namespace testing
|