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
data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc
ADDED
@@ -0,0 +1,129 @@
|
|
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 internal utilities.
|
35
|
+
|
36
|
+
#include "gmock/internal/gmock-generated-internal-utils.h"
|
37
|
+
#include "gmock/internal/gmock-internal-utils.h"
|
38
|
+
#include "gtest/gtest.h"
|
39
|
+
|
40
|
+
namespace {
|
41
|
+
|
42
|
+
using ::testing::tuple;
|
43
|
+
using ::testing::Matcher;
|
44
|
+
using ::testing::internal::CompileAssertTypesEqual;
|
45
|
+
using ::testing::internal::MatcherTuple;
|
46
|
+
using ::testing::internal::Function;
|
47
|
+
using ::testing::internal::IgnoredValue;
|
48
|
+
|
49
|
+
// Tests the MatcherTuple template struct.
|
50
|
+
|
51
|
+
TEST(MatcherTupleTest, ForSize0) {
|
52
|
+
CompileAssertTypesEqual<tuple<>, MatcherTuple<tuple<> >::type>();
|
53
|
+
}
|
54
|
+
|
55
|
+
TEST(MatcherTupleTest, ForSize1) {
|
56
|
+
CompileAssertTypesEqual<tuple<Matcher<int> >,
|
57
|
+
MatcherTuple<tuple<int> >::type>();
|
58
|
+
}
|
59
|
+
|
60
|
+
TEST(MatcherTupleTest, ForSize2) {
|
61
|
+
CompileAssertTypesEqual<tuple<Matcher<int>, Matcher<char> >,
|
62
|
+
MatcherTuple<tuple<int, char> >::type>();
|
63
|
+
}
|
64
|
+
|
65
|
+
TEST(MatcherTupleTest, ForSize5) {
|
66
|
+
CompileAssertTypesEqual<
|
67
|
+
tuple<Matcher<int>, Matcher<char>, Matcher<bool>, Matcher<double>,
|
68
|
+
Matcher<char*> >,
|
69
|
+
MatcherTuple<tuple<int, char, bool, double, char*> >::type>();
|
70
|
+
}
|
71
|
+
|
72
|
+
// Tests the Function template struct.
|
73
|
+
|
74
|
+
TEST(FunctionTest, Nullary) {
|
75
|
+
typedef Function<int()> F; // NOLINT
|
76
|
+
CompileAssertTypesEqual<int, F::Result>();
|
77
|
+
CompileAssertTypesEqual<tuple<>, F::ArgumentTuple>();
|
78
|
+
CompileAssertTypesEqual<tuple<>, F::ArgumentMatcherTuple>();
|
79
|
+
CompileAssertTypesEqual<void(), F::MakeResultVoid>();
|
80
|
+
CompileAssertTypesEqual<IgnoredValue(), F::MakeResultIgnoredValue>();
|
81
|
+
}
|
82
|
+
|
83
|
+
TEST(FunctionTest, Unary) {
|
84
|
+
typedef Function<int(bool)> F; // NOLINT
|
85
|
+
CompileAssertTypesEqual<int, F::Result>();
|
86
|
+
CompileAssertTypesEqual<bool, F::Argument1>();
|
87
|
+
CompileAssertTypesEqual<tuple<bool>, F::ArgumentTuple>();
|
88
|
+
CompileAssertTypesEqual<tuple<Matcher<bool> >, F::ArgumentMatcherTuple>();
|
89
|
+
CompileAssertTypesEqual<void(bool), F::MakeResultVoid>(); // NOLINT
|
90
|
+
CompileAssertTypesEqual<IgnoredValue(bool), // NOLINT
|
91
|
+
F::MakeResultIgnoredValue>();
|
92
|
+
}
|
93
|
+
|
94
|
+
TEST(FunctionTest, Binary) {
|
95
|
+
typedef Function<int(bool, const long&)> F; // NOLINT
|
96
|
+
CompileAssertTypesEqual<int, F::Result>();
|
97
|
+
CompileAssertTypesEqual<bool, F::Argument1>();
|
98
|
+
CompileAssertTypesEqual<const long&, F::Argument2>(); // NOLINT
|
99
|
+
CompileAssertTypesEqual<tuple<bool, const long&>, F::ArgumentTuple>(); // NOLINT
|
100
|
+
CompileAssertTypesEqual<
|
101
|
+
tuple<Matcher<bool>, Matcher<const long&> >, // NOLINT
|
102
|
+
F::ArgumentMatcherTuple>();
|
103
|
+
CompileAssertTypesEqual<void(bool, const long&), F::MakeResultVoid>(); // NOLINT
|
104
|
+
CompileAssertTypesEqual<IgnoredValue(bool, const long&), // NOLINT
|
105
|
+
F::MakeResultIgnoredValue>();
|
106
|
+
}
|
107
|
+
|
108
|
+
TEST(FunctionTest, LongArgumentList) {
|
109
|
+
typedef Function<char(bool, int, char*, int&, const long&)> F; // NOLINT
|
110
|
+
CompileAssertTypesEqual<char, F::Result>();
|
111
|
+
CompileAssertTypesEqual<bool, F::Argument1>();
|
112
|
+
CompileAssertTypesEqual<int, F::Argument2>();
|
113
|
+
CompileAssertTypesEqual<char*, F::Argument3>();
|
114
|
+
CompileAssertTypesEqual<int&, F::Argument4>();
|
115
|
+
CompileAssertTypesEqual<const long&, F::Argument5>(); // NOLINT
|
116
|
+
CompileAssertTypesEqual<tuple<bool, int, char*, int&, const long&>, // NOLINT
|
117
|
+
F::ArgumentTuple>();
|
118
|
+
CompileAssertTypesEqual<
|
119
|
+
tuple<Matcher<bool>, Matcher<int>, Matcher<char*>, Matcher<int&>,
|
120
|
+
Matcher<const long&> >, // NOLINT
|
121
|
+
F::ArgumentMatcherTuple>();
|
122
|
+
CompileAssertTypesEqual<void(bool, int, char*, int&, const long&), // NOLINT
|
123
|
+
F::MakeResultVoid>();
|
124
|
+
CompileAssertTypesEqual<
|
125
|
+
IgnoredValue(bool, int, char*, int&, const long&), // NOLINT
|
126
|
+
F::MakeResultIgnoredValue>();
|
127
|
+
}
|
128
|
+
|
129
|
+
} // Unnamed namespace
|
data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc
ADDED
@@ -0,0 +1,1341 @@
|
|
1
|
+
// Copyright 2008, Google Inc.
|
2
|
+
// All rights reserved.
|
3
|
+
//
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
5
|
+
// modification, are permitted provided that the following conditions are
|
6
|
+
// met:
|
7
|
+
//
|
8
|
+
// * Redistributions of source code must retain the above copyright
|
9
|
+
// notice, this list of conditions and the following disclaimer.
|
10
|
+
// * Redistributions in binary form must reproduce the above
|
11
|
+
// copyright notice, this list of conditions and the following disclaimer
|
12
|
+
// in the documentation and/or other materials provided with the
|
13
|
+
// distribution.
|
14
|
+
// * Neither the name of Google Inc. nor the names of its
|
15
|
+
// contributors may be used to endorse or promote products derived from
|
16
|
+
// this software without specific prior written permission.
|
17
|
+
//
|
18
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
// Google Mock - a framework for writing C++ mock classes.
|
31
|
+
//
|
32
|
+
// This file tests the built-in matchers generated by a script.
|
33
|
+
|
34
|
+
// Silence warning C4244: 'initializing': conversion from 'int' to 'short',
|
35
|
+
// possible loss of data and C4100, unreferenced local parameter
|
36
|
+
#ifdef _MSC_VER
|
37
|
+
# pragma warning(push)
|
38
|
+
# pragma warning(disable:4244)
|
39
|
+
# pragma warning(disable:4100)
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#include "gmock/gmock-generated-matchers.h"
|
43
|
+
|
44
|
+
#include <list>
|
45
|
+
#include <map>
|
46
|
+
#include <memory>
|
47
|
+
#include <set>
|
48
|
+
#include <sstream>
|
49
|
+
#include <string>
|
50
|
+
#include <utility>
|
51
|
+
#include <vector>
|
52
|
+
|
53
|
+
#include "gmock/gmock.h"
|
54
|
+
#include "gtest/gtest.h"
|
55
|
+
#include "gtest/gtest-spi.h"
|
56
|
+
|
57
|
+
namespace {
|
58
|
+
|
59
|
+
using std::list;
|
60
|
+
using std::map;
|
61
|
+
using std::pair;
|
62
|
+
using std::set;
|
63
|
+
using std::stringstream;
|
64
|
+
using std::vector;
|
65
|
+
using testing::get;
|
66
|
+
using testing::make_tuple;
|
67
|
+
using testing::tuple;
|
68
|
+
using testing::_;
|
69
|
+
using testing::AllOf;
|
70
|
+
using testing::AnyOf;
|
71
|
+
using testing::Args;
|
72
|
+
using testing::Contains;
|
73
|
+
using testing::ElementsAre;
|
74
|
+
using testing::ElementsAreArray;
|
75
|
+
using testing::Eq;
|
76
|
+
using testing::Ge;
|
77
|
+
using testing::Gt;
|
78
|
+
using testing::Le;
|
79
|
+
using testing::Lt;
|
80
|
+
using testing::MakeMatcher;
|
81
|
+
using testing::Matcher;
|
82
|
+
using testing::MatcherInterface;
|
83
|
+
using testing::MatchResultListener;
|
84
|
+
using testing::Ne;
|
85
|
+
using testing::Not;
|
86
|
+
using testing::Pointee;
|
87
|
+
using testing::PrintToString;
|
88
|
+
using testing::Ref;
|
89
|
+
using testing::StaticAssertTypeEq;
|
90
|
+
using testing::StrEq;
|
91
|
+
using testing::Value;
|
92
|
+
using testing::internal::ElementsAreArrayMatcher;
|
93
|
+
|
94
|
+
// Returns the description of the given matcher.
|
95
|
+
template <typename T>
|
96
|
+
std::string Describe(const Matcher<T>& m) {
|
97
|
+
stringstream ss;
|
98
|
+
m.DescribeTo(&ss);
|
99
|
+
return ss.str();
|
100
|
+
}
|
101
|
+
|
102
|
+
// Returns the description of the negation of the given matcher.
|
103
|
+
template <typename T>
|
104
|
+
std::string DescribeNegation(const Matcher<T>& m) {
|
105
|
+
stringstream ss;
|
106
|
+
m.DescribeNegationTo(&ss);
|
107
|
+
return ss.str();
|
108
|
+
}
|
109
|
+
|
110
|
+
// Returns the reason why x matches, or doesn't match, m.
|
111
|
+
template <typename MatcherType, typename Value>
|
112
|
+
std::string Explain(const MatcherType& m, const Value& x) {
|
113
|
+
stringstream ss;
|
114
|
+
m.ExplainMatchResultTo(x, &ss);
|
115
|
+
return ss.str();
|
116
|
+
}
|
117
|
+
|
118
|
+
// Tests Args<k0, ..., kn>(m).
|
119
|
+
|
120
|
+
TEST(ArgsTest, AcceptsZeroTemplateArg) {
|
121
|
+
const tuple<int, bool> t(5, true);
|
122
|
+
EXPECT_THAT(t, Args<>(Eq(tuple<>())));
|
123
|
+
EXPECT_THAT(t, Not(Args<>(Ne(tuple<>()))));
|
124
|
+
}
|
125
|
+
|
126
|
+
TEST(ArgsTest, AcceptsOneTemplateArg) {
|
127
|
+
const tuple<int, bool> t(5, true);
|
128
|
+
EXPECT_THAT(t, Args<0>(Eq(make_tuple(5))));
|
129
|
+
EXPECT_THAT(t, Args<1>(Eq(make_tuple(true))));
|
130
|
+
EXPECT_THAT(t, Not(Args<1>(Eq(make_tuple(false)))));
|
131
|
+
}
|
132
|
+
|
133
|
+
TEST(ArgsTest, AcceptsTwoTemplateArgs) {
|
134
|
+
const tuple<short, int, long> t(4, 5, 6L); // NOLINT
|
135
|
+
|
136
|
+
EXPECT_THAT(t, (Args<0, 1>(Lt())));
|
137
|
+
EXPECT_THAT(t, (Args<1, 2>(Lt())));
|
138
|
+
EXPECT_THAT(t, Not(Args<0, 2>(Gt())));
|
139
|
+
}
|
140
|
+
|
141
|
+
TEST(ArgsTest, AcceptsRepeatedTemplateArgs) {
|
142
|
+
const tuple<short, int, long> t(4, 5, 6L); // NOLINT
|
143
|
+
EXPECT_THAT(t, (Args<0, 0>(Eq())));
|
144
|
+
EXPECT_THAT(t, Not(Args<1, 1>(Ne())));
|
145
|
+
}
|
146
|
+
|
147
|
+
TEST(ArgsTest, AcceptsDecreasingTemplateArgs) {
|
148
|
+
const tuple<short, int, long> t(4, 5, 6L); // NOLINT
|
149
|
+
EXPECT_THAT(t, (Args<2, 0>(Gt())));
|
150
|
+
EXPECT_THAT(t, Not(Args<2, 1>(Lt())));
|
151
|
+
}
|
152
|
+
|
153
|
+
// The MATCHER*() macros trigger warning C4100 (unreferenced formal
|
154
|
+
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
|
155
|
+
// the macro definition, as the warnings are generated when the macro
|
156
|
+
// is expanded and macro expansion cannot contain #pragma. Therefore
|
157
|
+
// we suppress them here.
|
158
|
+
#ifdef _MSC_VER
|
159
|
+
# pragma warning(push)
|
160
|
+
# pragma warning(disable:4100)
|
161
|
+
#endif
|
162
|
+
|
163
|
+
MATCHER(SumIsZero, "") {
|
164
|
+
return get<0>(arg) + get<1>(arg) + get<2>(arg) == 0;
|
165
|
+
}
|
166
|
+
|
167
|
+
TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) {
|
168
|
+
EXPECT_THAT(make_tuple(-1, 2), (Args<0, 0, 1>(SumIsZero())));
|
169
|
+
EXPECT_THAT(make_tuple(1, 2), Not(Args<0, 0, 1>(SumIsZero())));
|
170
|
+
}
|
171
|
+
|
172
|
+
TEST(ArgsTest, CanBeNested) {
|
173
|
+
const tuple<short, int, long, int> t(4, 5, 6L, 6); // NOLINT
|
174
|
+
EXPECT_THAT(t, (Args<1, 2, 3>(Args<1, 2>(Eq()))));
|
175
|
+
EXPECT_THAT(t, (Args<0, 1, 3>(Args<0, 2>(Lt()))));
|
176
|
+
}
|
177
|
+
|
178
|
+
TEST(ArgsTest, CanMatchTupleByValue) {
|
179
|
+
typedef tuple<char, int, int> Tuple3;
|
180
|
+
const Matcher<Tuple3> m = Args<1, 2>(Lt());
|
181
|
+
EXPECT_TRUE(m.Matches(Tuple3('a', 1, 2)));
|
182
|
+
EXPECT_FALSE(m.Matches(Tuple3('b', 2, 2)));
|
183
|
+
}
|
184
|
+
|
185
|
+
TEST(ArgsTest, CanMatchTupleByReference) {
|
186
|
+
typedef tuple<char, char, int> Tuple3;
|
187
|
+
const Matcher<const Tuple3&> m = Args<0, 1>(Lt());
|
188
|
+
EXPECT_TRUE(m.Matches(Tuple3('a', 'b', 2)));
|
189
|
+
EXPECT_FALSE(m.Matches(Tuple3('b', 'b', 2)));
|
190
|
+
}
|
191
|
+
|
192
|
+
// Validates that arg is printed as str.
|
193
|
+
MATCHER_P(PrintsAs, str, "") {
|
194
|
+
return testing::PrintToString(arg) == str;
|
195
|
+
}
|
196
|
+
|
197
|
+
TEST(ArgsTest, AcceptsTenTemplateArgs) {
|
198
|
+
EXPECT_THAT(make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9),
|
199
|
+
(Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>(
|
200
|
+
PrintsAs("(9, 8, 7, 6, 5, 4, 3, 2, 1, 0)"))));
|
201
|
+
EXPECT_THAT(make_tuple(0, 1L, 2, 3L, 4, 5, 6, 7, 8, 9),
|
202
|
+
Not(Args<9, 8, 7, 6, 5, 4, 3, 2, 1, 0>(
|
203
|
+
PrintsAs("(0, 8, 7, 6, 5, 4, 3, 2, 1, 0)"))));
|
204
|
+
}
|
205
|
+
|
206
|
+
TEST(ArgsTest, DescirbesSelfCorrectly) {
|
207
|
+
const Matcher<tuple<int, bool, char> > m = Args<2, 0>(Lt());
|
208
|
+
EXPECT_EQ("are a tuple whose fields (#2, #0) are a pair where "
|
209
|
+
"the first < the second",
|
210
|
+
Describe(m));
|
211
|
+
}
|
212
|
+
|
213
|
+
TEST(ArgsTest, DescirbesNestedArgsCorrectly) {
|
214
|
+
const Matcher<const tuple<int, bool, char, int>&> m =
|
215
|
+
Args<0, 2, 3>(Args<2, 0>(Lt()));
|
216
|
+
EXPECT_EQ("are a tuple whose fields (#0, #2, #3) are a tuple "
|
217
|
+
"whose fields (#2, #0) are a pair where the first < the second",
|
218
|
+
Describe(m));
|
219
|
+
}
|
220
|
+
|
221
|
+
TEST(ArgsTest, DescribesNegationCorrectly) {
|
222
|
+
const Matcher<tuple<int, char> > m = Args<1, 0>(Gt());
|
223
|
+
EXPECT_EQ("are a tuple whose fields (#1, #0) aren't a pair "
|
224
|
+
"where the first > the second",
|
225
|
+
DescribeNegation(m));
|
226
|
+
}
|
227
|
+
|
228
|
+
TEST(ArgsTest, ExplainsMatchResultWithoutInnerExplanation) {
|
229
|
+
const Matcher<tuple<bool, int, int> > m = Args<1, 2>(Eq());
|
230
|
+
EXPECT_EQ("whose fields (#1, #2) are (42, 42)",
|
231
|
+
Explain(m, make_tuple(false, 42, 42)));
|
232
|
+
EXPECT_EQ("whose fields (#1, #2) are (42, 43)",
|
233
|
+
Explain(m, make_tuple(false, 42, 43)));
|
234
|
+
}
|
235
|
+
|
236
|
+
// For testing Args<>'s explanation.
|
237
|
+
class LessThanMatcher : public MatcherInterface<tuple<char, int> > {
|
238
|
+
public:
|
239
|
+
virtual void DescribeTo(::std::ostream* os) const {}
|
240
|
+
|
241
|
+
virtual bool MatchAndExplain(tuple<char, int> value,
|
242
|
+
MatchResultListener* listener) const {
|
243
|
+
const int diff = get<0>(value) - get<1>(value);
|
244
|
+
if (diff > 0) {
|
245
|
+
*listener << "where the first value is " << diff
|
246
|
+
<< " more than the second";
|
247
|
+
}
|
248
|
+
return diff < 0;
|
249
|
+
}
|
250
|
+
};
|
251
|
+
|
252
|
+
Matcher<tuple<char, int> > LessThan() {
|
253
|
+
return MakeMatcher(new LessThanMatcher);
|
254
|
+
}
|
255
|
+
|
256
|
+
TEST(ArgsTest, ExplainsMatchResultWithInnerExplanation) {
|
257
|
+
const Matcher<tuple<char, int, int> > m = Args<0, 2>(LessThan());
|
258
|
+
EXPECT_EQ("whose fields (#0, #2) are ('a' (97, 0x61), 42), "
|
259
|
+
"where the first value is 55 more than the second",
|
260
|
+
Explain(m, make_tuple('a', 42, 42)));
|
261
|
+
EXPECT_EQ("whose fields (#0, #2) are ('\\0', 43)",
|
262
|
+
Explain(m, make_tuple('\0', 42, 43)));
|
263
|
+
}
|
264
|
+
|
265
|
+
// For testing ExplainMatchResultTo().
|
266
|
+
class GreaterThanMatcher : public MatcherInterface<int> {
|
267
|
+
public:
|
268
|
+
explicit GreaterThanMatcher(int rhs) : rhs_(rhs) {}
|
269
|
+
|
270
|
+
virtual void DescribeTo(::std::ostream* os) const {
|
271
|
+
*os << "is greater than " << rhs_;
|
272
|
+
}
|
273
|
+
|
274
|
+
virtual bool MatchAndExplain(int lhs,
|
275
|
+
MatchResultListener* listener) const {
|
276
|
+
const int diff = lhs - rhs_;
|
277
|
+
if (diff > 0) {
|
278
|
+
*listener << "which is " << diff << " more than " << rhs_;
|
279
|
+
} else if (diff == 0) {
|
280
|
+
*listener << "which is the same as " << rhs_;
|
281
|
+
} else {
|
282
|
+
*listener << "which is " << -diff << " less than " << rhs_;
|
283
|
+
}
|
284
|
+
|
285
|
+
return lhs > rhs_;
|
286
|
+
}
|
287
|
+
|
288
|
+
private:
|
289
|
+
int rhs_;
|
290
|
+
};
|
291
|
+
|
292
|
+
Matcher<int> GreaterThan(int n) {
|
293
|
+
return MakeMatcher(new GreaterThanMatcher(n));
|
294
|
+
}
|
295
|
+
|
296
|
+
// Tests for ElementsAre().
|
297
|
+
|
298
|
+
TEST(ElementsAreTest, CanDescribeExpectingNoElement) {
|
299
|
+
Matcher<const vector<int>&> m = ElementsAre();
|
300
|
+
EXPECT_EQ("is empty", Describe(m));
|
301
|
+
}
|
302
|
+
|
303
|
+
TEST(ElementsAreTest, CanDescribeExpectingOneElement) {
|
304
|
+
Matcher<vector<int> > m = ElementsAre(Gt(5));
|
305
|
+
EXPECT_EQ("has 1 element that is > 5", Describe(m));
|
306
|
+
}
|
307
|
+
|
308
|
+
TEST(ElementsAreTest, CanDescribeExpectingManyElements) {
|
309
|
+
Matcher<list<std::string> > m = ElementsAre(StrEq("one"), "two");
|
310
|
+
EXPECT_EQ("has 2 elements where\n"
|
311
|
+
"element #0 is equal to \"one\",\n"
|
312
|
+
"element #1 is equal to \"two\"", Describe(m));
|
313
|
+
}
|
314
|
+
|
315
|
+
TEST(ElementsAreTest, CanDescribeNegationOfExpectingNoElement) {
|
316
|
+
Matcher<vector<int> > m = ElementsAre();
|
317
|
+
EXPECT_EQ("isn't empty", DescribeNegation(m));
|
318
|
+
}
|
319
|
+
|
320
|
+
TEST(ElementsAreTest, CanDescribeNegationOfExpectingOneElment) {
|
321
|
+
Matcher<const list<int>& > m = ElementsAre(Gt(5));
|
322
|
+
EXPECT_EQ("doesn't have 1 element, or\n"
|
323
|
+
"element #0 isn't > 5", DescribeNegation(m));
|
324
|
+
}
|
325
|
+
|
326
|
+
TEST(ElementsAreTest, CanDescribeNegationOfExpectingManyElements) {
|
327
|
+
Matcher<const list<std::string>&> m = ElementsAre("one", "two");
|
328
|
+
EXPECT_EQ("doesn't have 2 elements, or\n"
|
329
|
+
"element #0 isn't equal to \"one\", or\n"
|
330
|
+
"element #1 isn't equal to \"two\"", DescribeNegation(m));
|
331
|
+
}
|
332
|
+
|
333
|
+
TEST(ElementsAreTest, DoesNotExplainTrivialMatch) {
|
334
|
+
Matcher<const list<int>& > m = ElementsAre(1, Ne(2));
|
335
|
+
|
336
|
+
list<int> test_list;
|
337
|
+
test_list.push_back(1);
|
338
|
+
test_list.push_back(3);
|
339
|
+
EXPECT_EQ("", Explain(m, test_list)); // No need to explain anything.
|
340
|
+
}
|
341
|
+
|
342
|
+
TEST(ElementsAreTest, ExplainsNonTrivialMatch) {
|
343
|
+
Matcher<const vector<int>& > m =
|
344
|
+
ElementsAre(GreaterThan(1), 0, GreaterThan(2));
|
345
|
+
|
346
|
+
const int a[] = { 10, 0, 100 };
|
347
|
+
vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
|
348
|
+
EXPECT_EQ("whose element #0 matches, which is 9 more than 1,\n"
|
349
|
+
"and whose element #2 matches, which is 98 more than 2",
|
350
|
+
Explain(m, test_vector));
|
351
|
+
}
|
352
|
+
|
353
|
+
TEST(ElementsAreTest, CanExplainMismatchWrongSize) {
|
354
|
+
Matcher<const list<int>& > m = ElementsAre(1, 3);
|
355
|
+
|
356
|
+
list<int> test_list;
|
357
|
+
// No need to explain when the container is empty.
|
358
|
+
EXPECT_EQ("", Explain(m, test_list));
|
359
|
+
|
360
|
+
test_list.push_back(1);
|
361
|
+
EXPECT_EQ("which has 1 element", Explain(m, test_list));
|
362
|
+
}
|
363
|
+
|
364
|
+
TEST(ElementsAreTest, CanExplainMismatchRightSize) {
|
365
|
+
Matcher<const vector<int>& > m = ElementsAre(1, GreaterThan(5));
|
366
|
+
|
367
|
+
vector<int> v;
|
368
|
+
v.push_back(2);
|
369
|
+
v.push_back(1);
|
370
|
+
EXPECT_EQ("whose element #0 doesn't match", Explain(m, v));
|
371
|
+
|
372
|
+
v[0] = 1;
|
373
|
+
EXPECT_EQ("whose element #1 doesn't match, which is 4 less than 5",
|
374
|
+
Explain(m, v));
|
375
|
+
}
|
376
|
+
|
377
|
+
TEST(ElementsAreTest, MatchesOneElementVector) {
|
378
|
+
vector<std::string> test_vector;
|
379
|
+
test_vector.push_back("test string");
|
380
|
+
|
381
|
+
EXPECT_THAT(test_vector, ElementsAre(StrEq("test string")));
|
382
|
+
}
|
383
|
+
|
384
|
+
TEST(ElementsAreTest, MatchesOneElementList) {
|
385
|
+
list<std::string> test_list;
|
386
|
+
test_list.push_back("test string");
|
387
|
+
|
388
|
+
EXPECT_THAT(test_list, ElementsAre("test string"));
|
389
|
+
}
|
390
|
+
|
391
|
+
TEST(ElementsAreTest, MatchesThreeElementVector) {
|
392
|
+
vector<std::string> test_vector;
|
393
|
+
test_vector.push_back("one");
|
394
|
+
test_vector.push_back("two");
|
395
|
+
test_vector.push_back("three");
|
396
|
+
|
397
|
+
EXPECT_THAT(test_vector, ElementsAre("one", StrEq("two"), _));
|
398
|
+
}
|
399
|
+
|
400
|
+
TEST(ElementsAreTest, MatchesOneElementEqMatcher) {
|
401
|
+
vector<int> test_vector;
|
402
|
+
test_vector.push_back(4);
|
403
|
+
|
404
|
+
EXPECT_THAT(test_vector, ElementsAre(Eq(4)));
|
405
|
+
}
|
406
|
+
|
407
|
+
TEST(ElementsAreTest, MatchesOneElementAnyMatcher) {
|
408
|
+
vector<int> test_vector;
|
409
|
+
test_vector.push_back(4);
|
410
|
+
|
411
|
+
EXPECT_THAT(test_vector, ElementsAre(_));
|
412
|
+
}
|
413
|
+
|
414
|
+
TEST(ElementsAreTest, MatchesOneElementValue) {
|
415
|
+
vector<int> test_vector;
|
416
|
+
test_vector.push_back(4);
|
417
|
+
|
418
|
+
EXPECT_THAT(test_vector, ElementsAre(4));
|
419
|
+
}
|
420
|
+
|
421
|
+
TEST(ElementsAreTest, MatchesThreeElementsMixedMatchers) {
|
422
|
+
vector<int> test_vector;
|
423
|
+
test_vector.push_back(1);
|
424
|
+
test_vector.push_back(2);
|
425
|
+
test_vector.push_back(3);
|
426
|
+
|
427
|
+
EXPECT_THAT(test_vector, ElementsAre(1, Eq(2), _));
|
428
|
+
}
|
429
|
+
|
430
|
+
TEST(ElementsAreTest, MatchesTenElementVector) {
|
431
|
+
const int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
432
|
+
vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
|
433
|
+
|
434
|
+
EXPECT_THAT(test_vector,
|
435
|
+
// The element list can contain values and/or matchers
|
436
|
+
// of different types.
|
437
|
+
ElementsAre(0, Ge(0), _, 3, 4, Ne(2), Eq(6), 7, 8, _));
|
438
|
+
}
|
439
|
+
|
440
|
+
TEST(ElementsAreTest, DoesNotMatchWrongSize) {
|
441
|
+
vector<std::string> test_vector;
|
442
|
+
test_vector.push_back("test string");
|
443
|
+
test_vector.push_back("test string");
|
444
|
+
|
445
|
+
Matcher<vector<std::string> > m = ElementsAre(StrEq("test string"));
|
446
|
+
EXPECT_FALSE(m.Matches(test_vector));
|
447
|
+
}
|
448
|
+
|
449
|
+
TEST(ElementsAreTest, DoesNotMatchWrongValue) {
|
450
|
+
vector<std::string> test_vector;
|
451
|
+
test_vector.push_back("other string");
|
452
|
+
|
453
|
+
Matcher<vector<std::string> > m = ElementsAre(StrEq("test string"));
|
454
|
+
EXPECT_FALSE(m.Matches(test_vector));
|
455
|
+
}
|
456
|
+
|
457
|
+
TEST(ElementsAreTest, DoesNotMatchWrongOrder) {
|
458
|
+
vector<std::string> test_vector;
|
459
|
+
test_vector.push_back("one");
|
460
|
+
test_vector.push_back("three");
|
461
|
+
test_vector.push_back("two");
|
462
|
+
|
463
|
+
Matcher<vector<std::string> > m =
|
464
|
+
ElementsAre(StrEq("one"), StrEq("two"), StrEq("three"));
|
465
|
+
EXPECT_FALSE(m.Matches(test_vector));
|
466
|
+
}
|
467
|
+
|
468
|
+
TEST(ElementsAreTest, WorksForNestedContainer) {
|
469
|
+
const char* strings[] = {
|
470
|
+
"Hi",
|
471
|
+
"world"
|
472
|
+
};
|
473
|
+
|
474
|
+
vector<list<char> > nested;
|
475
|
+
for (size_t i = 0; i < GTEST_ARRAY_SIZE_(strings); i++) {
|
476
|
+
nested.push_back(list<char>(strings[i], strings[i] + strlen(strings[i])));
|
477
|
+
}
|
478
|
+
|
479
|
+
EXPECT_THAT(nested, ElementsAre(ElementsAre('H', Ne('e')),
|
480
|
+
ElementsAre('w', 'o', _, _, 'd')));
|
481
|
+
EXPECT_THAT(nested, Not(ElementsAre(ElementsAre('H', 'e'),
|
482
|
+
ElementsAre('w', 'o', _, _, 'd'))));
|
483
|
+
}
|
484
|
+
|
485
|
+
TEST(ElementsAreTest, WorksWithByRefElementMatchers) {
|
486
|
+
int a[] = { 0, 1, 2 };
|
487
|
+
vector<int> v(a, a + GTEST_ARRAY_SIZE_(a));
|
488
|
+
|
489
|
+
EXPECT_THAT(v, ElementsAre(Ref(v[0]), Ref(v[1]), Ref(v[2])));
|
490
|
+
EXPECT_THAT(v, Not(ElementsAre(Ref(v[0]), Ref(v[1]), Ref(a[2]))));
|
491
|
+
}
|
492
|
+
|
493
|
+
TEST(ElementsAreTest, WorksWithContainerPointerUsingPointee) {
|
494
|
+
int a[] = { 0, 1, 2 };
|
495
|
+
vector<int> v(a, a + GTEST_ARRAY_SIZE_(a));
|
496
|
+
|
497
|
+
EXPECT_THAT(&v, Pointee(ElementsAre(0, 1, _)));
|
498
|
+
EXPECT_THAT(&v, Not(Pointee(ElementsAre(0, _, 3))));
|
499
|
+
}
|
500
|
+
|
501
|
+
TEST(ElementsAreTest, WorksWithNativeArrayPassedByReference) {
|
502
|
+
int array[] = { 0, 1, 2 };
|
503
|
+
EXPECT_THAT(array, ElementsAre(0, 1, _));
|
504
|
+
EXPECT_THAT(array, Not(ElementsAre(1, _, _)));
|
505
|
+
EXPECT_THAT(array, Not(ElementsAre(0, _)));
|
506
|
+
}
|
507
|
+
|
508
|
+
class NativeArrayPassedAsPointerAndSize {
|
509
|
+
public:
|
510
|
+
NativeArrayPassedAsPointerAndSize() {}
|
511
|
+
|
512
|
+
MOCK_METHOD2(Helper, void(int* array, int size));
|
513
|
+
|
514
|
+
private:
|
515
|
+
GTEST_DISALLOW_COPY_AND_ASSIGN_(NativeArrayPassedAsPointerAndSize);
|
516
|
+
};
|
517
|
+
|
518
|
+
TEST(ElementsAreTest, WorksWithNativeArrayPassedAsPointerAndSize) {
|
519
|
+
int array[] = { 0, 1 };
|
520
|
+
::testing::tuple<int*, size_t> array_as_tuple(array, 2);
|
521
|
+
EXPECT_THAT(array_as_tuple, ElementsAre(0, 1));
|
522
|
+
EXPECT_THAT(array_as_tuple, Not(ElementsAre(0)));
|
523
|
+
|
524
|
+
NativeArrayPassedAsPointerAndSize helper;
|
525
|
+
EXPECT_CALL(helper, Helper(_, _))
|
526
|
+
.With(ElementsAre(0, 1));
|
527
|
+
helper.Helper(array, 2);
|
528
|
+
}
|
529
|
+
|
530
|
+
TEST(ElementsAreTest, WorksWithTwoDimensionalNativeArray) {
|
531
|
+
const char a2[][3] = { "hi", "lo" };
|
532
|
+
EXPECT_THAT(a2, ElementsAre(ElementsAre('h', 'i', '\0'),
|
533
|
+
ElementsAre('l', 'o', '\0')));
|
534
|
+
EXPECT_THAT(a2, ElementsAre(StrEq("hi"), StrEq("lo")));
|
535
|
+
EXPECT_THAT(a2, ElementsAre(Not(ElementsAre('h', 'o', '\0')),
|
536
|
+
ElementsAre('l', 'o', '\0')));
|
537
|
+
}
|
538
|
+
|
539
|
+
TEST(ElementsAreTest, AcceptsStringLiteral) {
|
540
|
+
std::string array[] = {"hi", "one", "two"};
|
541
|
+
EXPECT_THAT(array, ElementsAre("hi", "one", "two"));
|
542
|
+
EXPECT_THAT(array, Not(ElementsAre("hi", "one", "too")));
|
543
|
+
}
|
544
|
+
|
545
|
+
#ifndef _MSC_VER
|
546
|
+
|
547
|
+
// The following test passes a value of type const char[] to a
|
548
|
+
// function template that expects const T&. Some versions of MSVC
|
549
|
+
// generates a compiler error C2665 for that. We believe it's a bug
|
550
|
+
// in MSVC. Therefore this test is #if-ed out for MSVC.
|
551
|
+
|
552
|
+
// Declared here with the size unknown. Defined AFTER the following test.
|
553
|
+
extern const char kHi[];
|
554
|
+
|
555
|
+
TEST(ElementsAreTest, AcceptsArrayWithUnknownSize) {
|
556
|
+
// The size of kHi is not known in this test, but ElementsAre() should
|
557
|
+
// still accept it.
|
558
|
+
|
559
|
+
std::string array1[] = {"hi"};
|
560
|
+
EXPECT_THAT(array1, ElementsAre(kHi));
|
561
|
+
|
562
|
+
std::string array2[] = {"ho"};
|
563
|
+
EXPECT_THAT(array2, Not(ElementsAre(kHi)));
|
564
|
+
}
|
565
|
+
|
566
|
+
const char kHi[] = "hi";
|
567
|
+
|
568
|
+
#endif // _MSC_VER
|
569
|
+
|
570
|
+
TEST(ElementsAreTest, MakesCopyOfArguments) {
|
571
|
+
int x = 1;
|
572
|
+
int y = 2;
|
573
|
+
// This should make a copy of x and y.
|
574
|
+
::testing::internal::ElementsAreMatcher<testing::tuple<int, int> >
|
575
|
+
polymorphic_matcher = ElementsAre(x, y);
|
576
|
+
// Changing x and y now shouldn't affect the meaning of the above matcher.
|
577
|
+
x = y = 0;
|
578
|
+
const int array1[] = { 1, 2 };
|
579
|
+
EXPECT_THAT(array1, polymorphic_matcher);
|
580
|
+
const int array2[] = { 0, 0 };
|
581
|
+
EXPECT_THAT(array2, Not(polymorphic_matcher));
|
582
|
+
}
|
583
|
+
|
584
|
+
|
585
|
+
// Tests for ElementsAreArray(). Since ElementsAreArray() shares most
|
586
|
+
// of the implementation with ElementsAre(), we don't test it as
|
587
|
+
// thoroughly here.
|
588
|
+
|
589
|
+
TEST(ElementsAreArrayTest, CanBeCreatedWithValueArray) {
|
590
|
+
const int a[] = { 1, 2, 3 };
|
591
|
+
|
592
|
+
vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
|
593
|
+
EXPECT_THAT(test_vector, ElementsAreArray(a));
|
594
|
+
|
595
|
+
test_vector[2] = 0;
|
596
|
+
EXPECT_THAT(test_vector, Not(ElementsAreArray(a)));
|
597
|
+
}
|
598
|
+
|
599
|
+
TEST(ElementsAreArrayTest, CanBeCreatedWithArraySize) {
|
600
|
+
const char* a[] = { "one", "two", "three" };
|
601
|
+
|
602
|
+
vector<std::string> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
|
603
|
+
EXPECT_THAT(test_vector, ElementsAreArray(a, GTEST_ARRAY_SIZE_(a)));
|
604
|
+
|
605
|
+
const char** p = a;
|
606
|
+
test_vector[0] = "1";
|
607
|
+
EXPECT_THAT(test_vector, Not(ElementsAreArray(p, GTEST_ARRAY_SIZE_(a))));
|
608
|
+
}
|
609
|
+
|
610
|
+
TEST(ElementsAreArrayTest, CanBeCreatedWithoutArraySize) {
|
611
|
+
const char* a[] = { "one", "two", "three" };
|
612
|
+
|
613
|
+
vector<std::string> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
|
614
|
+
EXPECT_THAT(test_vector, ElementsAreArray(a));
|
615
|
+
|
616
|
+
test_vector[0] = "1";
|
617
|
+
EXPECT_THAT(test_vector, Not(ElementsAreArray(a)));
|
618
|
+
}
|
619
|
+
|
620
|
+
TEST(ElementsAreArrayTest, CanBeCreatedWithMatcherArray) {
|
621
|
+
const Matcher<std::string> kMatcherArray[] = {StrEq("one"), StrEq("two"),
|
622
|
+
StrEq("three")};
|
623
|
+
|
624
|
+
vector<std::string> test_vector;
|
625
|
+
test_vector.push_back("one");
|
626
|
+
test_vector.push_back("two");
|
627
|
+
test_vector.push_back("three");
|
628
|
+
EXPECT_THAT(test_vector, ElementsAreArray(kMatcherArray));
|
629
|
+
|
630
|
+
test_vector.push_back("three");
|
631
|
+
EXPECT_THAT(test_vector, Not(ElementsAreArray(kMatcherArray)));
|
632
|
+
}
|
633
|
+
|
634
|
+
TEST(ElementsAreArrayTest, CanBeCreatedWithVector) {
|
635
|
+
const int a[] = { 1, 2, 3 };
|
636
|
+
vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
|
637
|
+
const vector<int> expected(a, a + GTEST_ARRAY_SIZE_(a));
|
638
|
+
EXPECT_THAT(test_vector, ElementsAreArray(expected));
|
639
|
+
test_vector.push_back(4);
|
640
|
+
EXPECT_THAT(test_vector, Not(ElementsAreArray(expected)));
|
641
|
+
}
|
642
|
+
|
643
|
+
#if GTEST_HAS_STD_INITIALIZER_LIST_
|
644
|
+
|
645
|
+
TEST(ElementsAreArrayTest, TakesInitializerList) {
|
646
|
+
const int a[5] = { 1, 2, 3, 4, 5 };
|
647
|
+
EXPECT_THAT(a, ElementsAreArray({ 1, 2, 3, 4, 5 }));
|
648
|
+
EXPECT_THAT(a, Not(ElementsAreArray({ 1, 2, 3, 5, 4 })));
|
649
|
+
EXPECT_THAT(a, Not(ElementsAreArray({ 1, 2, 3, 4, 6 })));
|
650
|
+
}
|
651
|
+
|
652
|
+
TEST(ElementsAreArrayTest, TakesInitializerListOfCStrings) {
|
653
|
+
const std::string a[5] = {"a", "b", "c", "d", "e"};
|
654
|
+
EXPECT_THAT(a, ElementsAreArray({ "a", "b", "c", "d", "e" }));
|
655
|
+
EXPECT_THAT(a, Not(ElementsAreArray({ "a", "b", "c", "e", "d" })));
|
656
|
+
EXPECT_THAT(a, Not(ElementsAreArray({ "a", "b", "c", "d", "ef" })));
|
657
|
+
}
|
658
|
+
|
659
|
+
TEST(ElementsAreArrayTest, TakesInitializerListOfSameTypedMatchers) {
|
660
|
+
const int a[5] = { 1, 2, 3, 4, 5 };
|
661
|
+
EXPECT_THAT(a, ElementsAreArray(
|
662
|
+
{ Eq(1), Eq(2), Eq(3), Eq(4), Eq(5) }));
|
663
|
+
EXPECT_THAT(a, Not(ElementsAreArray(
|
664
|
+
{ Eq(1), Eq(2), Eq(3), Eq(4), Eq(6) })));
|
665
|
+
}
|
666
|
+
|
667
|
+
TEST(ElementsAreArrayTest,
|
668
|
+
TakesInitializerListOfDifferentTypedMatchers) {
|
669
|
+
const int a[5] = { 1, 2, 3, 4, 5 };
|
670
|
+
// The compiler cannot infer the type of the initializer list if its
|
671
|
+
// elements have different types. We must explicitly specify the
|
672
|
+
// unified element type in this case.
|
673
|
+
EXPECT_THAT(a, ElementsAreArray<Matcher<int> >(
|
674
|
+
{ Eq(1), Ne(-2), Ge(3), Le(4), Eq(5) }));
|
675
|
+
EXPECT_THAT(a, Not(ElementsAreArray<Matcher<int> >(
|
676
|
+
{ Eq(1), Ne(-2), Ge(3), Le(4), Eq(6) })));
|
677
|
+
}
|
678
|
+
|
679
|
+
#endif // GTEST_HAS_STD_INITIALIZER_LIST_
|
680
|
+
|
681
|
+
TEST(ElementsAreArrayTest, CanBeCreatedWithMatcherVector) {
|
682
|
+
const int a[] = { 1, 2, 3 };
|
683
|
+
const Matcher<int> kMatchers[] = { Eq(1), Eq(2), Eq(3) };
|
684
|
+
vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
|
685
|
+
const vector<Matcher<int> > expected(
|
686
|
+
kMatchers, kMatchers + GTEST_ARRAY_SIZE_(kMatchers));
|
687
|
+
EXPECT_THAT(test_vector, ElementsAreArray(expected));
|
688
|
+
test_vector.push_back(4);
|
689
|
+
EXPECT_THAT(test_vector, Not(ElementsAreArray(expected)));
|
690
|
+
}
|
691
|
+
|
692
|
+
TEST(ElementsAreArrayTest, CanBeCreatedWithIteratorRange) {
|
693
|
+
const int a[] = { 1, 2, 3 };
|
694
|
+
const vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
|
695
|
+
const vector<int> expected(a, a + GTEST_ARRAY_SIZE_(a));
|
696
|
+
EXPECT_THAT(test_vector, ElementsAreArray(expected.begin(), expected.end()));
|
697
|
+
// Pointers are iterators, too.
|
698
|
+
EXPECT_THAT(test_vector, ElementsAreArray(a, a + GTEST_ARRAY_SIZE_(a)));
|
699
|
+
// The empty range of NULL pointers should also be okay.
|
700
|
+
int* const null_int = NULL;
|
701
|
+
EXPECT_THAT(test_vector, Not(ElementsAreArray(null_int, null_int)));
|
702
|
+
EXPECT_THAT((vector<int>()), ElementsAreArray(null_int, null_int));
|
703
|
+
}
|
704
|
+
|
705
|
+
// Since ElementsAre() and ElementsAreArray() share much of the
|
706
|
+
// implementation, we only do a sanity test for native arrays here.
|
707
|
+
TEST(ElementsAreArrayTest, WorksWithNativeArray) {
|
708
|
+
::std::string a[] = { "hi", "ho" };
|
709
|
+
::std::string b[] = { "hi", "ho" };
|
710
|
+
|
711
|
+
EXPECT_THAT(a, ElementsAreArray(b));
|
712
|
+
EXPECT_THAT(a, ElementsAreArray(b, 2));
|
713
|
+
EXPECT_THAT(a, Not(ElementsAreArray(b, 1)));
|
714
|
+
}
|
715
|
+
|
716
|
+
TEST(ElementsAreArrayTest, SourceLifeSpan) {
|
717
|
+
const int a[] = { 1, 2, 3 };
|
718
|
+
vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
|
719
|
+
vector<int> expect(a, a + GTEST_ARRAY_SIZE_(a));
|
720
|
+
ElementsAreArrayMatcher<int> matcher_maker =
|
721
|
+
ElementsAreArray(expect.begin(), expect.end());
|
722
|
+
EXPECT_THAT(test_vector, matcher_maker);
|
723
|
+
// Changing in place the values that initialized matcher_maker should not
|
724
|
+
// affect matcher_maker anymore. It should have made its own copy of them.
|
725
|
+
typedef vector<int>::iterator Iter;
|
726
|
+
for (Iter it = expect.begin(); it != expect.end(); ++it) { *it += 10; }
|
727
|
+
EXPECT_THAT(test_vector, matcher_maker);
|
728
|
+
test_vector.push_back(3);
|
729
|
+
EXPECT_THAT(test_vector, Not(matcher_maker));
|
730
|
+
}
|
731
|
+
|
732
|
+
// Tests for the MATCHER*() macro family.
|
733
|
+
|
734
|
+
// Tests that a simple MATCHER() definition works.
|
735
|
+
|
736
|
+
MATCHER(IsEven, "") { return (arg % 2) == 0; }
|
737
|
+
|
738
|
+
TEST(MatcherMacroTest, Works) {
|
739
|
+
const Matcher<int> m = IsEven();
|
740
|
+
EXPECT_TRUE(m.Matches(6));
|
741
|
+
EXPECT_FALSE(m.Matches(7));
|
742
|
+
|
743
|
+
EXPECT_EQ("is even", Describe(m));
|
744
|
+
EXPECT_EQ("not (is even)", DescribeNegation(m));
|
745
|
+
EXPECT_EQ("", Explain(m, 6));
|
746
|
+
EXPECT_EQ("", Explain(m, 7));
|
747
|
+
}
|
748
|
+
|
749
|
+
// This also tests that the description string can reference 'negation'.
|
750
|
+
MATCHER(IsEven2, negation ? "is odd" : "is even") {
|
751
|
+
if ((arg % 2) == 0) {
|
752
|
+
// Verifies that we can stream to result_listener, a listener
|
753
|
+
// supplied by the MATCHER macro implicitly.
|
754
|
+
*result_listener << "OK";
|
755
|
+
return true;
|
756
|
+
} else {
|
757
|
+
*result_listener << "% 2 == " << (arg % 2);
|
758
|
+
return false;
|
759
|
+
}
|
760
|
+
}
|
761
|
+
|
762
|
+
// This also tests that the description string can reference matcher
|
763
|
+
// parameters.
|
764
|
+
MATCHER_P2(EqSumOf, x, y, std::string(negation ? "doesn't equal" : "equals") +
|
765
|
+
" the sum of " + PrintToString(x) + " and " +
|
766
|
+
PrintToString(y)) {
|
767
|
+
if (arg == (x + y)) {
|
768
|
+
*result_listener << "OK";
|
769
|
+
return true;
|
770
|
+
} else {
|
771
|
+
// Verifies that we can stream to the underlying stream of
|
772
|
+
// result_listener.
|
773
|
+
if (result_listener->stream() != NULL) {
|
774
|
+
*result_listener->stream() << "diff == " << (x + y - arg);
|
775
|
+
}
|
776
|
+
return false;
|
777
|
+
}
|
778
|
+
}
|
779
|
+
|
780
|
+
// Tests that the matcher description can reference 'negation' and the
|
781
|
+
// matcher parameters.
|
782
|
+
TEST(MatcherMacroTest, DescriptionCanReferenceNegationAndParameters) {
|
783
|
+
const Matcher<int> m1 = IsEven2();
|
784
|
+
EXPECT_EQ("is even", Describe(m1));
|
785
|
+
EXPECT_EQ("is odd", DescribeNegation(m1));
|
786
|
+
|
787
|
+
const Matcher<int> m2 = EqSumOf(5, 9);
|
788
|
+
EXPECT_EQ("equals the sum of 5 and 9", Describe(m2));
|
789
|
+
EXPECT_EQ("doesn't equal the sum of 5 and 9", DescribeNegation(m2));
|
790
|
+
}
|
791
|
+
|
792
|
+
// Tests explaining match result in a MATCHER* macro.
|
793
|
+
TEST(MatcherMacroTest, CanExplainMatchResult) {
|
794
|
+
const Matcher<int> m1 = IsEven2();
|
795
|
+
EXPECT_EQ("OK", Explain(m1, 4));
|
796
|
+
EXPECT_EQ("% 2 == 1", Explain(m1, 5));
|
797
|
+
|
798
|
+
const Matcher<int> m2 = EqSumOf(1, 2);
|
799
|
+
EXPECT_EQ("OK", Explain(m2, 3));
|
800
|
+
EXPECT_EQ("diff == -1", Explain(m2, 4));
|
801
|
+
}
|
802
|
+
|
803
|
+
// Tests that the body of MATCHER() can reference the type of the
|
804
|
+
// value being matched.
|
805
|
+
|
806
|
+
MATCHER(IsEmptyString, "") {
|
807
|
+
StaticAssertTypeEq< ::std::string, arg_type>();
|
808
|
+
return arg == "";
|
809
|
+
}
|
810
|
+
|
811
|
+
MATCHER(IsEmptyStringByRef, "") {
|
812
|
+
StaticAssertTypeEq<const ::std::string&, arg_type>();
|
813
|
+
return arg == "";
|
814
|
+
}
|
815
|
+
|
816
|
+
TEST(MatcherMacroTest, CanReferenceArgType) {
|
817
|
+
const Matcher< ::std::string> m1 = IsEmptyString();
|
818
|
+
EXPECT_TRUE(m1.Matches(""));
|
819
|
+
|
820
|
+
const Matcher<const ::std::string&> m2 = IsEmptyStringByRef();
|
821
|
+
EXPECT_TRUE(m2.Matches(""));
|
822
|
+
}
|
823
|
+
|
824
|
+
// Tests that MATCHER() can be used in a namespace.
|
825
|
+
|
826
|
+
namespace matcher_test {
|
827
|
+
MATCHER(IsOdd, "") { return (arg % 2) != 0; }
|
828
|
+
} // namespace matcher_test
|
829
|
+
|
830
|
+
TEST(MatcherMacroTest, WorksInNamespace) {
|
831
|
+
Matcher<int> m = matcher_test::IsOdd();
|
832
|
+
EXPECT_FALSE(m.Matches(4));
|
833
|
+
EXPECT_TRUE(m.Matches(5));
|
834
|
+
}
|
835
|
+
|
836
|
+
// Tests that Value() can be used to compose matchers.
|
837
|
+
MATCHER(IsPositiveOdd, "") {
|
838
|
+
return Value(arg, matcher_test::IsOdd()) && arg > 0;
|
839
|
+
}
|
840
|
+
|
841
|
+
TEST(MatcherMacroTest, CanBeComposedUsingValue) {
|
842
|
+
EXPECT_THAT(3, IsPositiveOdd());
|
843
|
+
EXPECT_THAT(4, Not(IsPositiveOdd()));
|
844
|
+
EXPECT_THAT(-1, Not(IsPositiveOdd()));
|
845
|
+
}
|
846
|
+
|
847
|
+
// Tests that a simple MATCHER_P() definition works.
|
848
|
+
|
849
|
+
MATCHER_P(IsGreaterThan32And, n, "") { return arg > 32 && arg > n; }
|
850
|
+
|
851
|
+
TEST(MatcherPMacroTest, Works) {
|
852
|
+
const Matcher<int> m = IsGreaterThan32And(5);
|
853
|
+
EXPECT_TRUE(m.Matches(36));
|
854
|
+
EXPECT_FALSE(m.Matches(5));
|
855
|
+
|
856
|
+
EXPECT_EQ("is greater than 32 and 5", Describe(m));
|
857
|
+
EXPECT_EQ("not (is greater than 32 and 5)", DescribeNegation(m));
|
858
|
+
EXPECT_EQ("", Explain(m, 36));
|
859
|
+
EXPECT_EQ("", Explain(m, 5));
|
860
|
+
}
|
861
|
+
|
862
|
+
// Tests that the description is calculated correctly from the matcher name.
|
863
|
+
MATCHER_P(_is_Greater_Than32and_, n, "") { return arg > 32 && arg > n; }
|
864
|
+
|
865
|
+
TEST(MatcherPMacroTest, GeneratesCorrectDescription) {
|
866
|
+
const Matcher<int> m = _is_Greater_Than32and_(5);
|
867
|
+
|
868
|
+
EXPECT_EQ("is greater than 32 and 5", Describe(m));
|
869
|
+
EXPECT_EQ("not (is greater than 32 and 5)", DescribeNegation(m));
|
870
|
+
EXPECT_EQ("", Explain(m, 36));
|
871
|
+
EXPECT_EQ("", Explain(m, 5));
|
872
|
+
}
|
873
|
+
|
874
|
+
// Tests that a MATCHER_P matcher can be explicitly instantiated with
|
875
|
+
// a reference parameter type.
|
876
|
+
|
877
|
+
class UncopyableFoo {
|
878
|
+
public:
|
879
|
+
explicit UncopyableFoo(char value) : value_(value) {}
|
880
|
+
private:
|
881
|
+
UncopyableFoo(const UncopyableFoo&);
|
882
|
+
void operator=(const UncopyableFoo&);
|
883
|
+
|
884
|
+
char value_;
|
885
|
+
};
|
886
|
+
|
887
|
+
MATCHER_P(ReferencesUncopyable, variable, "") { return &arg == &variable; }
|
888
|
+
|
889
|
+
TEST(MatcherPMacroTest, WorksWhenExplicitlyInstantiatedWithReference) {
|
890
|
+
UncopyableFoo foo1('1'), foo2('2');
|
891
|
+
const Matcher<const UncopyableFoo&> m =
|
892
|
+
ReferencesUncopyable<const UncopyableFoo&>(foo1);
|
893
|
+
|
894
|
+
EXPECT_TRUE(m.Matches(foo1));
|
895
|
+
EXPECT_FALSE(m.Matches(foo2));
|
896
|
+
|
897
|
+
// We don't want the address of the parameter printed, as most
|
898
|
+
// likely it will just annoy the user. If the address is
|
899
|
+
// interesting, the user should consider passing the parameter by
|
900
|
+
// pointer instead.
|
901
|
+
EXPECT_EQ("references uncopyable 1-byte object <31>", Describe(m));
|
902
|
+
}
|
903
|
+
|
904
|
+
|
905
|
+
// Tests that the body of MATCHER_Pn() can reference the parameter
|
906
|
+
// types.
|
907
|
+
|
908
|
+
MATCHER_P3(ParamTypesAreIntLongAndChar, foo, bar, baz, "") {
|
909
|
+
StaticAssertTypeEq<int, foo_type>();
|
910
|
+
StaticAssertTypeEq<long, bar_type>(); // NOLINT
|
911
|
+
StaticAssertTypeEq<char, baz_type>();
|
912
|
+
return arg == 0;
|
913
|
+
}
|
914
|
+
|
915
|
+
TEST(MatcherPnMacroTest, CanReferenceParamTypes) {
|
916
|
+
EXPECT_THAT(0, ParamTypesAreIntLongAndChar(10, 20L, 'a'));
|
917
|
+
}
|
918
|
+
|
919
|
+
// Tests that a MATCHER_Pn matcher can be explicitly instantiated with
|
920
|
+
// reference parameter types.
|
921
|
+
|
922
|
+
MATCHER_P2(ReferencesAnyOf, variable1, variable2, "") {
|
923
|
+
return &arg == &variable1 || &arg == &variable2;
|
924
|
+
}
|
925
|
+
|
926
|
+
TEST(MatcherPnMacroTest, WorksWhenExplicitlyInstantiatedWithReferences) {
|
927
|
+
UncopyableFoo foo1('1'), foo2('2'), foo3('3');
|
928
|
+
const Matcher<const UncopyableFoo&> m =
|
929
|
+
ReferencesAnyOf<const UncopyableFoo&, const UncopyableFoo&>(foo1, foo2);
|
930
|
+
|
931
|
+
EXPECT_TRUE(m.Matches(foo1));
|
932
|
+
EXPECT_TRUE(m.Matches(foo2));
|
933
|
+
EXPECT_FALSE(m.Matches(foo3));
|
934
|
+
}
|
935
|
+
|
936
|
+
TEST(MatcherPnMacroTest,
|
937
|
+
GeneratesCorretDescriptionWhenExplicitlyInstantiatedWithReferences) {
|
938
|
+
UncopyableFoo foo1('1'), foo2('2');
|
939
|
+
const Matcher<const UncopyableFoo&> m =
|
940
|
+
ReferencesAnyOf<const UncopyableFoo&, const UncopyableFoo&>(foo1, foo2);
|
941
|
+
|
942
|
+
// We don't want the addresses of the parameters printed, as most
|
943
|
+
// likely they will just annoy the user. If the addresses are
|
944
|
+
// interesting, the user should consider passing the parameters by
|
945
|
+
// pointers instead.
|
946
|
+
EXPECT_EQ("references any of (1-byte object <31>, 1-byte object <32>)",
|
947
|
+
Describe(m));
|
948
|
+
}
|
949
|
+
|
950
|
+
// Tests that a simple MATCHER_P2() definition works.
|
951
|
+
|
952
|
+
MATCHER_P2(IsNotInClosedRange, low, hi, "") { return arg < low || arg > hi; }
|
953
|
+
|
954
|
+
TEST(MatcherPnMacroTest, Works) {
|
955
|
+
const Matcher<const long&> m = IsNotInClosedRange(10, 20); // NOLINT
|
956
|
+
EXPECT_TRUE(m.Matches(36L));
|
957
|
+
EXPECT_FALSE(m.Matches(15L));
|
958
|
+
|
959
|
+
EXPECT_EQ("is not in closed range (10, 20)", Describe(m));
|
960
|
+
EXPECT_EQ("not (is not in closed range (10, 20))", DescribeNegation(m));
|
961
|
+
EXPECT_EQ("", Explain(m, 36L));
|
962
|
+
EXPECT_EQ("", Explain(m, 15L));
|
963
|
+
}
|
964
|
+
|
965
|
+
// Tests that MATCHER*() definitions can be overloaded on the number
|
966
|
+
// of parameters; also tests MATCHER_Pn() where n >= 3.
|
967
|
+
|
968
|
+
MATCHER(EqualsSumOf, "") { return arg == 0; }
|
969
|
+
MATCHER_P(EqualsSumOf, a, "") { return arg == a; }
|
970
|
+
MATCHER_P2(EqualsSumOf, a, b, "") { return arg == a + b; }
|
971
|
+
MATCHER_P3(EqualsSumOf, a, b, c, "") { return arg == a + b + c; }
|
972
|
+
MATCHER_P4(EqualsSumOf, a, b, c, d, "") { return arg == a + b + c + d; }
|
973
|
+
MATCHER_P5(EqualsSumOf, a, b, c, d, e, "") { return arg == a + b + c + d + e; }
|
974
|
+
MATCHER_P6(EqualsSumOf, a, b, c, d, e, f, "") {
|
975
|
+
return arg == a + b + c + d + e + f;
|
976
|
+
}
|
977
|
+
MATCHER_P7(EqualsSumOf, a, b, c, d, e, f, g, "") {
|
978
|
+
return arg == a + b + c + d + e + f + g;
|
979
|
+
}
|
980
|
+
MATCHER_P8(EqualsSumOf, a, b, c, d, e, f, g, h, "") {
|
981
|
+
return arg == a + b + c + d + e + f + g + h;
|
982
|
+
}
|
983
|
+
MATCHER_P9(EqualsSumOf, a, b, c, d, e, f, g, h, i, "") {
|
984
|
+
return arg == a + b + c + d + e + f + g + h + i;
|
985
|
+
}
|
986
|
+
MATCHER_P10(EqualsSumOf, a, b, c, d, e, f, g, h, i, j, "") {
|
987
|
+
return arg == a + b + c + d + e + f + g + h + i + j;
|
988
|
+
}
|
989
|
+
|
990
|
+
TEST(MatcherPnMacroTest, CanBeOverloadedOnNumberOfParameters) {
|
991
|
+
EXPECT_THAT(0, EqualsSumOf());
|
992
|
+
EXPECT_THAT(1, EqualsSumOf(1));
|
993
|
+
EXPECT_THAT(12, EqualsSumOf(10, 2));
|
994
|
+
EXPECT_THAT(123, EqualsSumOf(100, 20, 3));
|
995
|
+
EXPECT_THAT(1234, EqualsSumOf(1000, 200, 30, 4));
|
996
|
+
EXPECT_THAT(12345, EqualsSumOf(10000, 2000, 300, 40, 5));
|
997
|
+
EXPECT_THAT("abcdef",
|
998
|
+
EqualsSumOf(::std::string("a"), 'b', 'c', "d", "e", 'f'));
|
999
|
+
EXPECT_THAT("abcdefg",
|
1000
|
+
EqualsSumOf(::std::string("a"), 'b', 'c', "d", "e", 'f', 'g'));
|
1001
|
+
EXPECT_THAT("abcdefgh",
|
1002
|
+
EqualsSumOf(::std::string("a"), 'b', 'c', "d", "e", 'f', 'g',
|
1003
|
+
"h"));
|
1004
|
+
EXPECT_THAT("abcdefghi",
|
1005
|
+
EqualsSumOf(::std::string("a"), 'b', 'c', "d", "e", 'f', 'g',
|
1006
|
+
"h", 'i'));
|
1007
|
+
EXPECT_THAT("abcdefghij",
|
1008
|
+
EqualsSumOf(::std::string("a"), 'b', 'c', "d", "e", 'f', 'g',
|
1009
|
+
"h", 'i', ::std::string("j")));
|
1010
|
+
|
1011
|
+
EXPECT_THAT(1, Not(EqualsSumOf()));
|
1012
|
+
EXPECT_THAT(-1, Not(EqualsSumOf(1)));
|
1013
|
+
EXPECT_THAT(-12, Not(EqualsSumOf(10, 2)));
|
1014
|
+
EXPECT_THAT(-123, Not(EqualsSumOf(100, 20, 3)));
|
1015
|
+
EXPECT_THAT(-1234, Not(EqualsSumOf(1000, 200, 30, 4)));
|
1016
|
+
EXPECT_THAT(-12345, Not(EqualsSumOf(10000, 2000, 300, 40, 5)));
|
1017
|
+
EXPECT_THAT("abcdef ",
|
1018
|
+
Not(EqualsSumOf(::std::string("a"), 'b', 'c', "d", "e", 'f')));
|
1019
|
+
EXPECT_THAT("abcdefg ",
|
1020
|
+
Not(EqualsSumOf(::std::string("a"), 'b', 'c', "d", "e", 'f',
|
1021
|
+
'g')));
|
1022
|
+
EXPECT_THAT("abcdefgh ",
|
1023
|
+
Not(EqualsSumOf(::std::string("a"), 'b', 'c', "d", "e", 'f', 'g',
|
1024
|
+
"h")));
|
1025
|
+
EXPECT_THAT("abcdefghi ",
|
1026
|
+
Not(EqualsSumOf(::std::string("a"), 'b', 'c', "d", "e", 'f', 'g',
|
1027
|
+
"h", 'i')));
|
1028
|
+
EXPECT_THAT("abcdefghij ",
|
1029
|
+
Not(EqualsSumOf(::std::string("a"), 'b', 'c', "d", "e", 'f', 'g',
|
1030
|
+
"h", 'i', ::std::string("j"))));
|
1031
|
+
}
|
1032
|
+
|
1033
|
+
// Tests that a MATCHER_Pn() definition can be instantiated with any
|
1034
|
+
// compatible parameter types.
|
1035
|
+
TEST(MatcherPnMacroTest, WorksForDifferentParameterTypes) {
|
1036
|
+
EXPECT_THAT(123, EqualsSumOf(100L, 20, static_cast<char>(3)));
|
1037
|
+
EXPECT_THAT("abcd", EqualsSumOf(::std::string("a"), "b", 'c', "d"));
|
1038
|
+
|
1039
|
+
EXPECT_THAT(124, Not(EqualsSumOf(100L, 20, static_cast<char>(3))));
|
1040
|
+
EXPECT_THAT("abcde", Not(EqualsSumOf(::std::string("a"), "b", 'c', "d")));
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
// Tests that the matcher body can promote the parameter types.
|
1044
|
+
|
1045
|
+
MATCHER_P2(EqConcat, prefix, suffix, "") {
|
1046
|
+
// The following lines promote the two parameters to desired types.
|
1047
|
+
std::string prefix_str(prefix);
|
1048
|
+
char suffix_char = static_cast<char>(suffix);
|
1049
|
+
return arg == prefix_str + suffix_char;
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
TEST(MatcherPnMacroTest, SimpleTypePromotion) {
|
1053
|
+
Matcher<std::string> no_promo =
|
1054
|
+
EqConcat(std::string("foo"), 't');
|
1055
|
+
Matcher<const std::string&> promo =
|
1056
|
+
EqConcat("foo", static_cast<int>('t'));
|
1057
|
+
EXPECT_FALSE(no_promo.Matches("fool"));
|
1058
|
+
EXPECT_FALSE(promo.Matches("fool"));
|
1059
|
+
EXPECT_TRUE(no_promo.Matches("foot"));
|
1060
|
+
EXPECT_TRUE(promo.Matches("foot"));
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
// Verifies the type of a MATCHER*.
|
1064
|
+
|
1065
|
+
TEST(MatcherPnMacroTest, TypesAreCorrect) {
|
1066
|
+
// EqualsSumOf() must be assignable to a EqualsSumOfMatcher variable.
|
1067
|
+
EqualsSumOfMatcher a0 = EqualsSumOf();
|
1068
|
+
|
1069
|
+
// EqualsSumOf(1) must be assignable to a EqualsSumOfMatcherP variable.
|
1070
|
+
EqualsSumOfMatcherP<int> a1 = EqualsSumOf(1);
|
1071
|
+
|
1072
|
+
// EqualsSumOf(p1, ..., pk) must be assignable to a EqualsSumOfMatcherPk
|
1073
|
+
// variable, and so on.
|
1074
|
+
EqualsSumOfMatcherP2<int, char> a2 = EqualsSumOf(1, '2');
|
1075
|
+
EqualsSumOfMatcherP3<int, int, char> a3 = EqualsSumOf(1, 2, '3');
|
1076
|
+
EqualsSumOfMatcherP4<int, int, int, char> a4 = EqualsSumOf(1, 2, 3, '4');
|
1077
|
+
EqualsSumOfMatcherP5<int, int, int, int, char> a5 =
|
1078
|
+
EqualsSumOf(1, 2, 3, 4, '5');
|
1079
|
+
EqualsSumOfMatcherP6<int, int, int, int, int, char> a6 =
|
1080
|
+
EqualsSumOf(1, 2, 3, 4, 5, '6');
|
1081
|
+
EqualsSumOfMatcherP7<int, int, int, int, int, int, char> a7 =
|
1082
|
+
EqualsSumOf(1, 2, 3, 4, 5, 6, '7');
|
1083
|
+
EqualsSumOfMatcherP8<int, int, int, int, int, int, int, char> a8 =
|
1084
|
+
EqualsSumOf(1, 2, 3, 4, 5, 6, 7, '8');
|
1085
|
+
EqualsSumOfMatcherP9<int, int, int, int, int, int, int, int, char> a9 =
|
1086
|
+
EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8, '9');
|
1087
|
+
EqualsSumOfMatcherP10<int, int, int, int, int, int, int, int, int, char> a10 =
|
1088
|
+
EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8, 9, '0');
|
1089
|
+
|
1090
|
+
// Avoid "unused variable" warnings.
|
1091
|
+
(void)a0;
|
1092
|
+
(void)a1;
|
1093
|
+
(void)a2;
|
1094
|
+
(void)a3;
|
1095
|
+
(void)a4;
|
1096
|
+
(void)a5;
|
1097
|
+
(void)a6;
|
1098
|
+
(void)a7;
|
1099
|
+
(void)a8;
|
1100
|
+
(void)a9;
|
1101
|
+
(void)a10;
|
1102
|
+
}
|
1103
|
+
|
1104
|
+
// Tests that matcher-typed parameters can be used in Value() inside a
|
1105
|
+
// MATCHER_Pn definition.
|
1106
|
+
|
1107
|
+
// Succeeds if arg matches exactly 2 of the 3 matchers.
|
1108
|
+
MATCHER_P3(TwoOf, m1, m2, m3, "") {
|
1109
|
+
const int count = static_cast<int>(Value(arg, m1))
|
1110
|
+
+ static_cast<int>(Value(arg, m2)) + static_cast<int>(Value(arg, m3));
|
1111
|
+
return count == 2;
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
TEST(MatcherPnMacroTest, CanUseMatcherTypedParameterInValue) {
|
1115
|
+
EXPECT_THAT(42, TwoOf(Gt(0), Lt(50), Eq(10)));
|
1116
|
+
EXPECT_THAT(0, Not(TwoOf(Gt(-1), Lt(1), Eq(0))));
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
// Tests Contains().
|
1120
|
+
|
1121
|
+
TEST(ContainsTest, ListMatchesWhenElementIsInContainer) {
|
1122
|
+
list<int> some_list;
|
1123
|
+
some_list.push_back(3);
|
1124
|
+
some_list.push_back(1);
|
1125
|
+
some_list.push_back(2);
|
1126
|
+
EXPECT_THAT(some_list, Contains(1));
|
1127
|
+
EXPECT_THAT(some_list, Contains(Gt(2.5)));
|
1128
|
+
EXPECT_THAT(some_list, Contains(Eq(2.0f)));
|
1129
|
+
|
1130
|
+
list<std::string> another_list;
|
1131
|
+
another_list.push_back("fee");
|
1132
|
+
another_list.push_back("fie");
|
1133
|
+
another_list.push_back("foe");
|
1134
|
+
another_list.push_back("fum");
|
1135
|
+
EXPECT_THAT(another_list, Contains(std::string("fee")));
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
TEST(ContainsTest, ListDoesNotMatchWhenElementIsNotInContainer) {
|
1139
|
+
list<int> some_list;
|
1140
|
+
some_list.push_back(3);
|
1141
|
+
some_list.push_back(1);
|
1142
|
+
EXPECT_THAT(some_list, Not(Contains(4)));
|
1143
|
+
}
|
1144
|
+
|
1145
|
+
TEST(ContainsTest, SetMatchesWhenElementIsInContainer) {
|
1146
|
+
set<int> some_set;
|
1147
|
+
some_set.insert(3);
|
1148
|
+
some_set.insert(1);
|
1149
|
+
some_set.insert(2);
|
1150
|
+
EXPECT_THAT(some_set, Contains(Eq(1.0)));
|
1151
|
+
EXPECT_THAT(some_set, Contains(Eq(3.0f)));
|
1152
|
+
EXPECT_THAT(some_set, Contains(2));
|
1153
|
+
|
1154
|
+
set<const char*> another_set;
|
1155
|
+
another_set.insert("fee");
|
1156
|
+
another_set.insert("fie");
|
1157
|
+
another_set.insert("foe");
|
1158
|
+
another_set.insert("fum");
|
1159
|
+
EXPECT_THAT(another_set, Contains(Eq(std::string("fum"))));
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
TEST(ContainsTest, SetDoesNotMatchWhenElementIsNotInContainer) {
|
1163
|
+
set<int> some_set;
|
1164
|
+
some_set.insert(3);
|
1165
|
+
some_set.insert(1);
|
1166
|
+
EXPECT_THAT(some_set, Not(Contains(4)));
|
1167
|
+
|
1168
|
+
set<const char*> c_string_set;
|
1169
|
+
c_string_set.insert("hello");
|
1170
|
+
EXPECT_THAT(c_string_set, Not(Contains(std::string("hello").c_str())));
|
1171
|
+
}
|
1172
|
+
|
1173
|
+
TEST(ContainsTest, ExplainsMatchResultCorrectly) {
|
1174
|
+
const int a[2] = { 1, 2 };
|
1175
|
+
Matcher<const int (&)[2]> m = Contains(2);
|
1176
|
+
EXPECT_EQ("whose element #1 matches", Explain(m, a));
|
1177
|
+
|
1178
|
+
m = Contains(3);
|
1179
|
+
EXPECT_EQ("", Explain(m, a));
|
1180
|
+
|
1181
|
+
m = Contains(GreaterThan(0));
|
1182
|
+
EXPECT_EQ("whose element #0 matches, which is 1 more than 0", Explain(m, a));
|
1183
|
+
|
1184
|
+
m = Contains(GreaterThan(10));
|
1185
|
+
EXPECT_EQ("", Explain(m, a));
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
TEST(ContainsTest, DescribesItselfCorrectly) {
|
1189
|
+
Matcher<vector<int> > m = Contains(1);
|
1190
|
+
EXPECT_EQ("contains at least one element that is equal to 1", Describe(m));
|
1191
|
+
|
1192
|
+
Matcher<vector<int> > m2 = Not(m);
|
1193
|
+
EXPECT_EQ("doesn't contain any element that is equal to 1", Describe(m2));
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
TEST(ContainsTest, MapMatchesWhenElementIsInContainer) {
|
1197
|
+
map<const char*, int> my_map;
|
1198
|
+
const char* bar = "a string";
|
1199
|
+
my_map[bar] = 2;
|
1200
|
+
EXPECT_THAT(my_map, Contains(pair<const char* const, int>(bar, 2)));
|
1201
|
+
|
1202
|
+
map<std::string, int> another_map;
|
1203
|
+
another_map["fee"] = 1;
|
1204
|
+
another_map["fie"] = 2;
|
1205
|
+
another_map["foe"] = 3;
|
1206
|
+
another_map["fum"] = 4;
|
1207
|
+
EXPECT_THAT(another_map,
|
1208
|
+
Contains(pair<const std::string, int>(std::string("fee"), 1)));
|
1209
|
+
EXPECT_THAT(another_map, Contains(pair<const std::string, int>("fie", 2)));
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
TEST(ContainsTest, MapDoesNotMatchWhenElementIsNotInContainer) {
|
1213
|
+
map<int, int> some_map;
|
1214
|
+
some_map[1] = 11;
|
1215
|
+
some_map[2] = 22;
|
1216
|
+
EXPECT_THAT(some_map, Not(Contains(pair<const int, int>(2, 23))));
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
TEST(ContainsTest, ArrayMatchesWhenElementIsInContainer) {
|
1220
|
+
const char* string_array[] = { "fee", "fie", "foe", "fum" };
|
1221
|
+
EXPECT_THAT(string_array, Contains(Eq(std::string("fum"))));
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
TEST(ContainsTest, ArrayDoesNotMatchWhenElementIsNotInContainer) {
|
1225
|
+
int int_array[] = { 1, 2, 3, 4 };
|
1226
|
+
EXPECT_THAT(int_array, Not(Contains(5)));
|
1227
|
+
}
|
1228
|
+
|
1229
|
+
TEST(ContainsTest, AcceptsMatcher) {
|
1230
|
+
const int a[] = { 1, 2, 3 };
|
1231
|
+
EXPECT_THAT(a, Contains(Gt(2)));
|
1232
|
+
EXPECT_THAT(a, Not(Contains(Gt(4))));
|
1233
|
+
}
|
1234
|
+
|
1235
|
+
TEST(ContainsTest, WorksForNativeArrayAsTuple) {
|
1236
|
+
const int a[] = { 1, 2 };
|
1237
|
+
const int* const pointer = a;
|
1238
|
+
EXPECT_THAT(make_tuple(pointer, 2), Contains(1));
|
1239
|
+
EXPECT_THAT(make_tuple(pointer, 2), Not(Contains(Gt(3))));
|
1240
|
+
}
|
1241
|
+
|
1242
|
+
TEST(ContainsTest, WorksForTwoDimensionalNativeArray) {
|
1243
|
+
int a[][3] = { { 1, 2, 3 }, { 4, 5, 6 } };
|
1244
|
+
EXPECT_THAT(a, Contains(ElementsAre(4, 5, 6)));
|
1245
|
+
EXPECT_THAT(a, Contains(Contains(5)));
|
1246
|
+
EXPECT_THAT(a, Not(Contains(ElementsAre(3, 4, 5))));
|
1247
|
+
EXPECT_THAT(a, Contains(Not(Contains(5))));
|
1248
|
+
}
|
1249
|
+
|
1250
|
+
TEST(AllOfTest, HugeMatcher) {
|
1251
|
+
// Verify that using AllOf with many arguments doesn't cause
|
1252
|
+
// the compiler to exceed template instantiation depth limit.
|
1253
|
+
EXPECT_THAT(0, testing::AllOf(_, _, _, _, _, _, _, _, _,
|
1254
|
+
testing::AllOf(_, _, _, _, _, _, _, _, _, _)));
|
1255
|
+
}
|
1256
|
+
|
1257
|
+
TEST(AnyOfTest, HugeMatcher) {
|
1258
|
+
// Verify that using AnyOf with many arguments doesn't cause
|
1259
|
+
// the compiler to exceed template instantiation depth limit.
|
1260
|
+
EXPECT_THAT(0, testing::AnyOf(_, _, _, _, _, _, _, _, _,
|
1261
|
+
testing::AnyOf(_, _, _, _, _, _, _, _, _, _)));
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
namespace adl_test {
|
1265
|
+
|
1266
|
+
// Verifies that the implementation of ::testing::AllOf and ::testing::AnyOf
|
1267
|
+
// don't issue unqualified recursive calls. If they do, the argument dependent
|
1268
|
+
// name lookup will cause AllOf/AnyOf in the 'adl_test' namespace to be found
|
1269
|
+
// as a candidate and the compilation will break due to an ambiguous overload.
|
1270
|
+
|
1271
|
+
// The matcher must be in the same namespace as AllOf/AnyOf to make argument
|
1272
|
+
// dependent lookup find those.
|
1273
|
+
MATCHER(M, "") { return true; }
|
1274
|
+
|
1275
|
+
template <typename T1, typename T2>
|
1276
|
+
bool AllOf(const T1& t1, const T2& t2) { return true; }
|
1277
|
+
|
1278
|
+
TEST(AllOfTest, DoesNotCallAllOfUnqualified) {
|
1279
|
+
EXPECT_THAT(42, testing::AllOf(
|
1280
|
+
M(), M(), M(), M(), M(), M(), M(), M(), M(), M()));
|
1281
|
+
}
|
1282
|
+
|
1283
|
+
template <typename T1, typename T2> bool
|
1284
|
+
AnyOf(const T1& t1, const T2& t2) { return true; }
|
1285
|
+
|
1286
|
+
TEST(AnyOfTest, DoesNotCallAnyOfUnqualified) {
|
1287
|
+
EXPECT_THAT(42, testing::AnyOf(
|
1288
|
+
M(), M(), M(), M(), M(), M(), M(), M(), M(), M()));
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
} // namespace adl_test
|
1292
|
+
|
1293
|
+
#ifdef _MSC_VER
|
1294
|
+
# pragma warning(pop)
|
1295
|
+
#endif
|
1296
|
+
|
1297
|
+
#if GTEST_LANG_CXX11
|
1298
|
+
|
1299
|
+
TEST(AllOfTest, WorksOnMoveOnlyType) {
|
1300
|
+
std::unique_ptr<int> p(new int(3));
|
1301
|
+
EXPECT_THAT(p, AllOf(Pointee(Eq(3)), Pointee(Gt(0)), Pointee(Lt(5))));
|
1302
|
+
EXPECT_THAT(p, Not(AllOf(Pointee(Eq(3)), Pointee(Gt(0)), Pointee(Lt(3)))));
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
TEST(AnyOfTest, WorksOnMoveOnlyType) {
|
1306
|
+
std::unique_ptr<int> p(new int(3));
|
1307
|
+
EXPECT_THAT(p, AnyOf(Pointee(Eq(5)), Pointee(Lt(0)), Pointee(Lt(5))));
|
1308
|
+
EXPECT_THAT(p, Not(AnyOf(Pointee(Eq(5)), Pointee(Lt(0)), Pointee(Gt(5)))));
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
MATCHER(IsNotNull, "") {
|
1312
|
+
return arg != nullptr;
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
// Verifies that a matcher defined using MATCHER() can work on
|
1316
|
+
// move-only types.
|
1317
|
+
TEST(MatcherMacroTest, WorksOnMoveOnlyType) {
|
1318
|
+
std::unique_ptr<int> p(new int(3));
|
1319
|
+
EXPECT_THAT(p, IsNotNull());
|
1320
|
+
EXPECT_THAT(std::unique_ptr<int>(), Not(IsNotNull()));
|
1321
|
+
}
|
1322
|
+
|
1323
|
+
MATCHER_P(UniquePointee, pointee, "") {
|
1324
|
+
return *arg == pointee;
|
1325
|
+
}
|
1326
|
+
|
1327
|
+
// Verifies that a matcher defined using MATCHER_P*() can work on
|
1328
|
+
// move-only types.
|
1329
|
+
TEST(MatcherPMacroTest, WorksOnMoveOnlyType) {
|
1330
|
+
std::unique_ptr<int> p(new int(3));
|
1331
|
+
EXPECT_THAT(p, UniquePointee(3));
|
1332
|
+
EXPECT_THAT(p, Not(UniquePointee(2)));
|
1333
|
+
}
|
1334
|
+
|
1335
|
+
#endif // GTEST_LASNG_CXX11
|
1336
|
+
|
1337
|
+
} // namespace
|
1338
|
+
|
1339
|
+
#ifdef _MSC_VER
|
1340
|
+
# pragma warning(pop)
|
1341
|
+
#endif
|