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