rj_schema 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +18 -0
- data/ext/rj_schema/extconf.rb +7 -0
- data/ext/rj_schema/rapidjson/CHANGELOG.md +158 -0
- data/ext/rj_schema/rapidjson/CMakeLists.txt +221 -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 +15 -0
- data/ext/rj_schema/rapidjson/RapidJSONConfigVersion.cmake.in +10 -0
- data/ext/rj_schema/rapidjson/appveyor.yml +41 -0
- data/ext/rj_schema/rapidjson/bin/data/glossary.json +22 -0
- data/ext/rj_schema/rapidjson/bin/data/menu.json +27 -0
- data/ext/rj_schema/rapidjson/bin/data/readme.txt +1 -0
- data/ext/rj_schema/rapidjson/bin/data/sample.json +3315 -0
- data/ext/rj_schema/rapidjson/bin/data/webapp.json +88 -0
- data/ext/rj_schema/rapidjson/bin/data/widget.json +26 -0
- data/ext/rj_schema/rapidjson/bin/draft-04/schema +150 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf16be.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf16bebom.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf16le.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf16lebom.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf32be.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf32bebom.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf32le.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf32lebom.json +0 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf8.json +7 -0
- data/ext/rj_schema/rapidjson/bin/encodings/utf8bom.json +7 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail1.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail10.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail11.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail12.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail13.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail14.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail15.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail16.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail17.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail18.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail19.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail2.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail20.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail21.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail22.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail23.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail24.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail25.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail26.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail27.json +2 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail28.json +2 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail29.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail3.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail30.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail31.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail32.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail33.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail4.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail5.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail6.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail7.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail8.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/fail9.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/pass1.json +58 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/pass2.json +1 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/pass3.json +6 -0
- data/ext/rj_schema/rapidjson/bin/jsonchecker/readme.txt +3 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/LICENSE +19 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/README.md +148 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/bin/jsonschema_suite +283 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/folder/folderInteger.json +3 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/integer.json +3 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/subSchemas.json +8 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/additionalItems.json +82 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/additionalProperties.json +88 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/default.json +49 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/dependencies.json +108 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/disallow.json +80 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/divisibleBy.json +60 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/enum.json +71 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/extends.json +94 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/items.json +46 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maxItems.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maxLength.json +33 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maximum.json +42 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minItems.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minLength.json +33 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minimum.json +42 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/bignum.json +107 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/format.json +222 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/jsregex.json +18 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/zeroTerminatedFloats.json +15 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/pattern.json +34 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/patternProperties.json +110 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/properties.json +92 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/ref.json +159 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/refRemote.json +74 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/required.json +53 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/type.json +474 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/uniqueItems.json +79 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/additionalItems.json +82 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/additionalProperties.json +88 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/allOf.json +112 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/anyOf.json +68 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/default.json +49 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/definitions.json +32 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/dependencies.json +113 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/enum.json +72 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/items.json +46 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxItems.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxLength.json +33 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxProperties.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maximum.json +42 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minItems.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minLength.json +33 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minProperties.json +28 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minimum.json +42 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/multipleOf.json +60 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/not.json +96 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/oneOf.json +68 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/bignum.json +107 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/format.json +148 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/zeroTerminatedFloats.json +15 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/pattern.json +34 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/patternProperties.json +110 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/properties.json +92 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/ref.json +159 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/refRemote.json +74 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/required.json +39 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/type.json +330 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/uniqueItems.json +79 -0
- data/ext/rj_schema/rapidjson/bin/jsonschema/tox.ini +8 -0
- data/ext/rj_schema/rapidjson/bin/types/booleans.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/floats.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/guids.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/integers.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/mixed.json +592 -0
- data/ext/rj_schema/rapidjson/bin/types/nulls.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/paragraphs.json +102 -0
- data/ext/rj_schema/rapidjson/bin/types/readme.txt +1 -0
- data/ext/rj_schema/rapidjson/contrib/natvis/LICENSE +45 -0
- data/ext/rj_schema/rapidjson/contrib/natvis/README.md +7 -0
- data/ext/rj_schema/rapidjson/contrib/natvis/rapidjson.natvis +38 -0
- data/ext/rj_schema/rapidjson/doc/CMakeLists.txt +27 -0
- data/ext/rj_schema/rapidjson/doc/Doxyfile.in +2369 -0
- data/ext/rj_schema/rapidjson/doc/Doxyfile.zh-cn.in +2369 -0
- data/ext/rj_schema/rapidjson/doc/diagram/architecture.dot +50 -0
- data/ext/rj_schema/rapidjson/doc/diagram/architecture.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/insituparsing.dot +65 -0
- data/ext/rj_schema/rapidjson/doc/diagram/insituparsing.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/iterative-parser-states-diagram.dot +62 -0
- data/ext/rj_schema/rapidjson/doc/diagram/iterative-parser-states-diagram.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/makefile +8 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move1.dot +47 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move1.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move2.dot +62 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move2.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move3.dot +60 -0
- data/ext/rj_schema/rapidjson/doc/diagram/move3.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/normalparsing.dot +56 -0
- data/ext/rj_schema/rapidjson/doc/diagram/normalparsing.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/simpledom.dot +54 -0
- data/ext/rj_schema/rapidjson/doc/diagram/simpledom.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/tutorial.dot +58 -0
- data/ext/rj_schema/rapidjson/doc/diagram/tutorial.png +0 -0
- data/ext/rj_schema/rapidjson/doc/diagram/utilityclass.dot +73 -0
- data/ext/rj_schema/rapidjson/doc/diagram/utilityclass.png +0 -0
- data/ext/rj_schema/rapidjson/doc/dom.md +280 -0
- data/ext/rj_schema/rapidjson/doc/dom.zh-cn.md +284 -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 +426 -0
- data/ext/rj_schema/rapidjson/doc/stream.zh-cn.md +426 -0
- data/ext/rj_schema/rapidjson/doc/tutorial.md +536 -0
- data/ext/rj_schema/rapidjson/doc/tutorial.zh-cn.md +534 -0
- data/ext/rj_schema/rapidjson/docker/debian/Dockerfile +8 -0
- data/ext/rj_schema/rapidjson/example/CMakeLists.txt +45 -0
- data/ext/rj_schema/rapidjson/example/archiver/archiver.cpp +292 -0
- data/ext/rj_schema/rapidjson/example/archiver/archiver.h +145 -0
- data/ext/rj_schema/rapidjson/example/archiver/archivertest.cpp +287 -0
- data/ext/rj_schema/rapidjson/example/capitalize/capitalize.cpp +67 -0
- data/ext/rj_schema/rapidjson/example/condense/condense.cpp +32 -0
- data/ext/rj_schema/rapidjson/example/filterkey/filterkey.cpp +135 -0
- data/ext/rj_schema/rapidjson/example/filterkeydom/filterkeydom.cpp +170 -0
- data/ext/rj_schema/rapidjson/example/jsonx/jsonx.cpp +207 -0
- data/ext/rj_schema/rapidjson/example/lookaheadparser/lookaheadparser.cpp +350 -0
- data/ext/rj_schema/rapidjson/example/messagereader/messagereader.cpp +105 -0
- data/ext/rj_schema/rapidjson/example/parsebyparts/parsebyparts.cpp +176 -0
- data/ext/rj_schema/rapidjson/example/pretty/pretty.cpp +30 -0
- data/ext/rj_schema/rapidjson/example/prettyauto/prettyauto.cpp +56 -0
- data/ext/rj_schema/rapidjson/example/schemavalidator/schemavalidator.cpp +78 -0
- data/ext/rj_schema/rapidjson/example/serialize/serialize.cpp +173 -0
- data/ext/rj_schema/rapidjson/example/simpledom/simpledom.cpp +29 -0
- data/ext/rj_schema/rapidjson/example/simplepullreader/simplepullreader.cpp +53 -0
- data/ext/rj_schema/rapidjson/example/simplereader/simplereader.cpp +42 -0
- data/ext/rj_schema/rapidjson/example/simplewriter/simplewriter.cpp +36 -0
- data/ext/rj_schema/rapidjson/example/tutorial/tutorial.cpp +151 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/allocators.h +271 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/cursorstreamwrapper.h +78 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/document.h +2630 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/encodedstream.h +299 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/encodings.h +716 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/error/en.h +74 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/error/error.h +161 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/filereadstream.h +99 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/filewritestream.h +104 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/fwd.h +151 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/biginteger.h +290 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/diyfp.h +258 -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 +304 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/meta.h +181 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/pow10.h +55 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/regex.h +734 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/stack.h +231 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/strfunc.h +69 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/strtod.h +269 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/internal/swap.h +46 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/istreamwrapper.h +115 -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 +1363 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/prettywriter.h +277 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/rapidjson.h +628 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/reader.h +2222 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/schema.h +2479 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/stream.h +223 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/stringbuffer.h +121 -0
- data/ext/rj_schema/rapidjson/include/rapidjson/writer.h +716 -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 +160 -0
- data/ext/rj_schema/rapidjson/readme.zh-cn.md +152 -0
- data/ext/rj_schema/rapidjson/test/CMakeLists.txt +20 -0
- data/ext/rj_schema/rapidjson/test/perftest/CMakeLists.txt +28 -0
- data/ext/rj_schema/rapidjson/test/perftest/misctest.cpp +974 -0
- data/ext/rj_schema/rapidjson/test/perftest/perftest.cpp +24 -0
- data/ext/rj_schema/rapidjson/test/perftest/perftest.h +185 -0
- data/ext/rj_schema/rapidjson/test/perftest/platformtest.cpp +166 -0
- data/ext/rj_schema/rapidjson/test/perftest/rapidjsontest.cpp +472 -0
- data/ext/rj_schema/rapidjson/test/perftest/schematest.cpp +216 -0
- data/ext/rj_schema/rapidjson/test/unittest/CMakeLists.txt +92 -0
- data/ext/rj_schema/rapidjson/test/unittest/allocatorstest.cpp +102 -0
- data/ext/rj_schema/rapidjson/test/unittest/bigintegertest.cpp +133 -0
- data/ext/rj_schema/rapidjson/test/unittest/cursorstreamwrappertest.cpp +115 -0
- data/ext/rj_schema/rapidjson/test/unittest/documenttest.cpp +672 -0
- data/ext/rj_schema/rapidjson/test/unittest/dtoatest.cpp +98 -0
- data/ext/rj_schema/rapidjson/test/unittest/encodedstreamtest.cpp +313 -0
- data/ext/rj_schema/rapidjson/test/unittest/encodingstest.cpp +451 -0
- data/ext/rj_schema/rapidjson/test/unittest/filestreamtest.cpp +112 -0
- data/ext/rj_schema/rapidjson/test/unittest/fwdtest.cpp +230 -0
- data/ext/rj_schema/rapidjson/test/unittest/istreamwrappertest.cpp +181 -0
- data/ext/rj_schema/rapidjson/test/unittest/itoatest.cpp +160 -0
- data/ext/rj_schema/rapidjson/test/unittest/jsoncheckertest.cpp +143 -0
- data/ext/rj_schema/rapidjson/test/unittest/namespacetest.cpp +70 -0
- data/ext/rj_schema/rapidjson/test/unittest/ostreamwrappertest.cpp +92 -0
- data/ext/rj_schema/rapidjson/test/unittest/pointertest.cpp +1529 -0
- data/ext/rj_schema/rapidjson/test/unittest/prettywritertest.cpp +344 -0
- data/ext/rj_schema/rapidjson/test/unittest/readertest.cpp +1895 -0
- data/ext/rj_schema/rapidjson/test/unittest/regextest.cpp +638 -0
- data/ext/rj_schema/rapidjson/test/unittest/schematest.cpp +2009 -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 +140 -0
- data/ext/rj_schema/rapidjson/test/unittest/valuetest.cpp +1829 -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/travis-doxygen.sh +121 -0
- data/ext/rj_schema/rj_schema.cpp +136 -0
- data/lib/rj_schema.rb +7 -0
- metadata +371 -0
@@ -0,0 +1,112 @@
|
|
1
|
+
// Tencent is pleased to support the open source community by making RapidJSON available.
|
2
|
+
//
|
3
|
+
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
|
4
|
+
//
|
5
|
+
// Licensed under the MIT License (the "License"); you may not use this file except
|
6
|
+
// in compliance with the License. You may obtain a copy of the License at
|
7
|
+
//
|
8
|
+
// http://opensource.org/licenses/MIT
|
9
|
+
//
|
10
|
+
// Unless required by applicable law or agreed to in writing, software distributed
|
11
|
+
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
12
|
+
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
13
|
+
// specific language governing permissions and limitations under the License.
|
14
|
+
|
15
|
+
#include "unittest.h"
|
16
|
+
#include "rapidjson/filereadstream.h"
|
17
|
+
#include "rapidjson/filewritestream.h"
|
18
|
+
#include "rapidjson/encodedstream.h"
|
19
|
+
|
20
|
+
using namespace rapidjson;
|
21
|
+
|
22
|
+
class FileStreamTest : public ::testing::Test {
|
23
|
+
public:
|
24
|
+
FileStreamTest() : filename_(), json_(), length_() {}
|
25
|
+
virtual ~FileStreamTest();
|
26
|
+
|
27
|
+
virtual void SetUp() {
|
28
|
+
const char *paths[] = {
|
29
|
+
"data/sample.json",
|
30
|
+
"bin/data/sample.json",
|
31
|
+
"../bin/data/sample.json",
|
32
|
+
"../../bin/data/sample.json",
|
33
|
+
"../../../bin/data/sample.json"
|
34
|
+
};
|
35
|
+
FILE* fp = 0;
|
36
|
+
for (size_t i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
|
37
|
+
fp = fopen(paths[i], "rb");
|
38
|
+
if (fp) {
|
39
|
+
filename_ = paths[i];
|
40
|
+
break;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
ASSERT_TRUE(fp != 0);
|
44
|
+
|
45
|
+
fseek(fp, 0, SEEK_END);
|
46
|
+
length_ = static_cast<size_t>(ftell(fp));
|
47
|
+
fseek(fp, 0, SEEK_SET);
|
48
|
+
json_ = static_cast<char*>(malloc(length_ + 1));
|
49
|
+
size_t readLength = fread(json_, 1, length_, fp);
|
50
|
+
json_[readLength] = '\0';
|
51
|
+
fclose(fp);
|
52
|
+
}
|
53
|
+
|
54
|
+
virtual void TearDown() {
|
55
|
+
free(json_);
|
56
|
+
json_ = 0;
|
57
|
+
}
|
58
|
+
|
59
|
+
private:
|
60
|
+
FileStreamTest(const FileStreamTest&);
|
61
|
+
FileStreamTest& operator=(const FileStreamTest&);
|
62
|
+
|
63
|
+
protected:
|
64
|
+
const char* filename_;
|
65
|
+
char *json_;
|
66
|
+
size_t length_;
|
67
|
+
};
|
68
|
+
|
69
|
+
FileStreamTest::~FileStreamTest() {}
|
70
|
+
|
71
|
+
TEST_F(FileStreamTest, FileReadStream) {
|
72
|
+
FILE *fp = fopen(filename_, "rb");
|
73
|
+
ASSERT_TRUE(fp != 0);
|
74
|
+
char buffer[65536];
|
75
|
+
FileReadStream s(fp, buffer, sizeof(buffer));
|
76
|
+
|
77
|
+
for (size_t i = 0; i < length_; i++) {
|
78
|
+
EXPECT_EQ(json_[i], s.Peek());
|
79
|
+
EXPECT_EQ(json_[i], s.Peek()); // 2nd time should be the same
|
80
|
+
EXPECT_EQ(json_[i], s.Take());
|
81
|
+
}
|
82
|
+
|
83
|
+
EXPECT_EQ(length_, s.Tell());
|
84
|
+
EXPECT_EQ('\0', s.Peek());
|
85
|
+
|
86
|
+
fclose(fp);
|
87
|
+
}
|
88
|
+
|
89
|
+
TEST_F(FileStreamTest, FileWriteStream) {
|
90
|
+
char filename[L_tmpnam];
|
91
|
+
FILE* fp = TempFile(filename);
|
92
|
+
|
93
|
+
char buffer[65536];
|
94
|
+
FileWriteStream os(fp, buffer, sizeof(buffer));
|
95
|
+
for (size_t i = 0; i < length_; i++)
|
96
|
+
os.Put(json_[i]);
|
97
|
+
os.Flush();
|
98
|
+
fclose(fp);
|
99
|
+
|
100
|
+
// Read it back to verify
|
101
|
+
fp = fopen(filename, "rb");
|
102
|
+
FileReadStream is(fp, buffer, sizeof(buffer));
|
103
|
+
|
104
|
+
for (size_t i = 0; i < length_; i++)
|
105
|
+
EXPECT_EQ(json_[i], is.Take());
|
106
|
+
|
107
|
+
EXPECT_EQ(length_, is.Tell());
|
108
|
+
fclose(fp);
|
109
|
+
|
110
|
+
//std::cout << filename << std::endl;
|
111
|
+
remove(filename);
|
112
|
+
}
|
@@ -0,0 +1,230 @@
|
|
1
|
+
// Tencent is pleased to support the open source community by making RapidJSON available.
|
2
|
+
//
|
3
|
+
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
|
4
|
+
//
|
5
|
+
// Licensed under the MIT License (the "License"); you may not use this file except
|
6
|
+
// in compliance with the License. You may obtain a copy of the License at
|
7
|
+
//
|
8
|
+
// http://opensource.org/licenses/MIT
|
9
|
+
//
|
10
|
+
// Unless required by applicable law or agreed to in writing, software distributed
|
11
|
+
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
12
|
+
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
13
|
+
// specific language governing permissions and limitations under the License.
|
14
|
+
|
15
|
+
#include "unittest.h"
|
16
|
+
|
17
|
+
// Using forward declared types here.
|
18
|
+
|
19
|
+
#include "rapidjson/fwd.h"
|
20
|
+
|
21
|
+
#ifdef __GNUC__
|
22
|
+
RAPIDJSON_DIAG_PUSH
|
23
|
+
RAPIDJSON_DIAG_OFF(effc++)
|
24
|
+
#endif
|
25
|
+
|
26
|
+
using namespace rapidjson;
|
27
|
+
|
28
|
+
struct Foo {
|
29
|
+
Foo();
|
30
|
+
~Foo();
|
31
|
+
|
32
|
+
// encodings.h
|
33
|
+
UTF8<char>* utf8;
|
34
|
+
UTF16<wchar_t>* utf16;
|
35
|
+
UTF16BE<wchar_t>* utf16be;
|
36
|
+
UTF16LE<wchar_t>* utf16le;
|
37
|
+
UTF32<unsigned>* utf32;
|
38
|
+
UTF32BE<unsigned>* utf32be;
|
39
|
+
UTF32LE<unsigned>* utf32le;
|
40
|
+
ASCII<char>* ascii;
|
41
|
+
AutoUTF<unsigned>* autoutf;
|
42
|
+
Transcoder<UTF8<char>, UTF8<char> >* transcoder;
|
43
|
+
|
44
|
+
// allocators.h
|
45
|
+
CrtAllocator* crtallocator;
|
46
|
+
MemoryPoolAllocator<CrtAllocator>* memorypoolallocator;
|
47
|
+
|
48
|
+
// stream.h
|
49
|
+
StringStream* stringstream;
|
50
|
+
InsituStringStream* insitustringstream;
|
51
|
+
|
52
|
+
// stringbuffer.h
|
53
|
+
StringBuffer* stringbuffer;
|
54
|
+
|
55
|
+
// // filereadstream.h
|
56
|
+
// FileReadStream* filereadstream;
|
57
|
+
|
58
|
+
// // filewritestream.h
|
59
|
+
// FileWriteStream* filewritestream;
|
60
|
+
|
61
|
+
// memorybuffer.h
|
62
|
+
MemoryBuffer* memorybuffer;
|
63
|
+
|
64
|
+
// memorystream.h
|
65
|
+
MemoryStream* memorystream;
|
66
|
+
|
67
|
+
// reader.h
|
68
|
+
BaseReaderHandler<UTF8<char>, void>* basereaderhandler;
|
69
|
+
Reader* reader;
|
70
|
+
|
71
|
+
// writer.h
|
72
|
+
Writer<StringBuffer, UTF8<char>, UTF8<char>, CrtAllocator, 0>* writer;
|
73
|
+
|
74
|
+
// prettywriter.h
|
75
|
+
PrettyWriter<StringBuffer, UTF8<char>, UTF8<char>, CrtAllocator, 0>* prettywriter;
|
76
|
+
|
77
|
+
// document.h
|
78
|
+
Value* value;
|
79
|
+
Document* document;
|
80
|
+
|
81
|
+
// pointer.h
|
82
|
+
Pointer* pointer;
|
83
|
+
|
84
|
+
// schema.h
|
85
|
+
SchemaDocument* schemadocument;
|
86
|
+
SchemaValidator* schemavalidator;
|
87
|
+
|
88
|
+
// char buffer[16];
|
89
|
+
};
|
90
|
+
|
91
|
+
// Using type definitions here.
|
92
|
+
|
93
|
+
#include "rapidjson/stringbuffer.h"
|
94
|
+
#include "rapidjson/filereadstream.h"
|
95
|
+
#include "rapidjson/filewritestream.h"
|
96
|
+
#include "rapidjson/memorybuffer.h"
|
97
|
+
#include "rapidjson/memorystream.h"
|
98
|
+
#include "rapidjson/document.h" // -> reader.h
|
99
|
+
#include "rapidjson/writer.h"
|
100
|
+
#include "rapidjson/prettywriter.h"
|
101
|
+
#include "rapidjson/schema.h" // -> pointer.h
|
102
|
+
|
103
|
+
typedef Transcoder<UTF8<>, UTF8<> > TranscoderUtf8ToUtf8;
|
104
|
+
typedef BaseReaderHandler<UTF8<>, void> BaseReaderHandlerUtf8Void;
|
105
|
+
|
106
|
+
Foo::Foo() :
|
107
|
+
// encodings.h
|
108
|
+
utf8(RAPIDJSON_NEW(UTF8<>)),
|
109
|
+
utf16(RAPIDJSON_NEW(UTF16<>)),
|
110
|
+
utf16be(RAPIDJSON_NEW(UTF16BE<>)),
|
111
|
+
utf16le(RAPIDJSON_NEW(UTF16LE<>)),
|
112
|
+
utf32(RAPIDJSON_NEW(UTF32<>)),
|
113
|
+
utf32be(RAPIDJSON_NEW(UTF32BE<>)),
|
114
|
+
utf32le(RAPIDJSON_NEW(UTF32LE<>)),
|
115
|
+
ascii(RAPIDJSON_NEW(ASCII<>)),
|
116
|
+
autoutf(RAPIDJSON_NEW(AutoUTF<unsigned>)),
|
117
|
+
transcoder(RAPIDJSON_NEW(TranscoderUtf8ToUtf8)),
|
118
|
+
|
119
|
+
// allocators.h
|
120
|
+
crtallocator(RAPIDJSON_NEW(CrtAllocator)),
|
121
|
+
memorypoolallocator(RAPIDJSON_NEW(MemoryPoolAllocator<>)),
|
122
|
+
|
123
|
+
// stream.h
|
124
|
+
stringstream(RAPIDJSON_NEW(StringStream)(NULL)),
|
125
|
+
insitustringstream(RAPIDJSON_NEW(InsituStringStream)(NULL)),
|
126
|
+
|
127
|
+
// stringbuffer.h
|
128
|
+
stringbuffer(RAPIDJSON_NEW(StringBuffer)),
|
129
|
+
|
130
|
+
// // filereadstream.h
|
131
|
+
// filereadstream(RAPIDJSON_NEW(FileReadStream)(stdout, buffer, sizeof(buffer))),
|
132
|
+
|
133
|
+
// // filewritestream.h
|
134
|
+
// filewritestream(RAPIDJSON_NEW(FileWriteStream)(stdout, buffer, sizeof(buffer))),
|
135
|
+
|
136
|
+
// memorybuffer.h
|
137
|
+
memorybuffer(RAPIDJSON_NEW(MemoryBuffer)),
|
138
|
+
|
139
|
+
// memorystream.h
|
140
|
+
memorystream(RAPIDJSON_NEW(MemoryStream)(NULL, 0)),
|
141
|
+
|
142
|
+
// reader.h
|
143
|
+
basereaderhandler(RAPIDJSON_NEW(BaseReaderHandlerUtf8Void)),
|
144
|
+
reader(RAPIDJSON_NEW(Reader)),
|
145
|
+
|
146
|
+
// writer.h
|
147
|
+
writer(RAPIDJSON_NEW(Writer<StringBuffer>)),
|
148
|
+
|
149
|
+
// prettywriter.h
|
150
|
+
prettywriter(RAPIDJSON_NEW(PrettyWriter<StringBuffer>)),
|
151
|
+
|
152
|
+
// document.h
|
153
|
+
value(RAPIDJSON_NEW(Value)),
|
154
|
+
document(RAPIDJSON_NEW(Document)),
|
155
|
+
|
156
|
+
// pointer.h
|
157
|
+
pointer(RAPIDJSON_NEW(Pointer)),
|
158
|
+
|
159
|
+
// schema.h
|
160
|
+
schemadocument(RAPIDJSON_NEW(SchemaDocument)(*document)),
|
161
|
+
schemavalidator(RAPIDJSON_NEW(SchemaValidator)(*schemadocument))
|
162
|
+
{
|
163
|
+
|
164
|
+
}
|
165
|
+
|
166
|
+
Foo::~Foo() {
|
167
|
+
// encodings.h
|
168
|
+
RAPIDJSON_DELETE(utf8);
|
169
|
+
RAPIDJSON_DELETE(utf16);
|
170
|
+
RAPIDJSON_DELETE(utf16be);
|
171
|
+
RAPIDJSON_DELETE(utf16le);
|
172
|
+
RAPIDJSON_DELETE(utf32);
|
173
|
+
RAPIDJSON_DELETE(utf32be);
|
174
|
+
RAPIDJSON_DELETE(utf32le);
|
175
|
+
RAPIDJSON_DELETE(ascii);
|
176
|
+
RAPIDJSON_DELETE(autoutf);
|
177
|
+
RAPIDJSON_DELETE(transcoder);
|
178
|
+
|
179
|
+
// allocators.h
|
180
|
+
RAPIDJSON_DELETE(crtallocator);
|
181
|
+
RAPIDJSON_DELETE(memorypoolallocator);
|
182
|
+
|
183
|
+
// stream.h
|
184
|
+
RAPIDJSON_DELETE(stringstream);
|
185
|
+
RAPIDJSON_DELETE(insitustringstream);
|
186
|
+
|
187
|
+
// stringbuffer.h
|
188
|
+
RAPIDJSON_DELETE(stringbuffer);
|
189
|
+
|
190
|
+
// // filereadstream.h
|
191
|
+
// RAPIDJSON_DELETE(filereadstream);
|
192
|
+
|
193
|
+
// // filewritestream.h
|
194
|
+
// RAPIDJSON_DELETE(filewritestream);
|
195
|
+
|
196
|
+
// memorybuffer.h
|
197
|
+
RAPIDJSON_DELETE(memorybuffer);
|
198
|
+
|
199
|
+
// memorystream.h
|
200
|
+
RAPIDJSON_DELETE(memorystream);
|
201
|
+
|
202
|
+
// reader.h
|
203
|
+
RAPIDJSON_DELETE(basereaderhandler);
|
204
|
+
RAPIDJSON_DELETE(reader);
|
205
|
+
|
206
|
+
// writer.h
|
207
|
+
RAPIDJSON_DELETE(writer);
|
208
|
+
|
209
|
+
// prettywriter.h
|
210
|
+
RAPIDJSON_DELETE(prettywriter);
|
211
|
+
|
212
|
+
// document.h
|
213
|
+
RAPIDJSON_DELETE(value);
|
214
|
+
RAPIDJSON_DELETE(document);
|
215
|
+
|
216
|
+
// pointer.h
|
217
|
+
RAPIDJSON_DELETE(pointer);
|
218
|
+
|
219
|
+
// schema.h
|
220
|
+
RAPIDJSON_DELETE(schemadocument);
|
221
|
+
RAPIDJSON_DELETE(schemavalidator);
|
222
|
+
}
|
223
|
+
|
224
|
+
TEST(Fwd, Fwd) {
|
225
|
+
Foo f;
|
226
|
+
}
|
227
|
+
|
228
|
+
#ifdef __GNUC__
|
229
|
+
RAPIDJSON_DIAG_POP
|
230
|
+
#endif
|
@@ -0,0 +1,181 @@
|
|
1
|
+
// Tencent is pleased to support the open source community by making RapidJSON available.
|
2
|
+
//
|
3
|
+
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
|
4
|
+
//
|
5
|
+
// Licensed under the MIT License (the "License"); you may not use this file except
|
6
|
+
// in compliance with the License. You may obtain a copy of the License at
|
7
|
+
//
|
8
|
+
// http://opensource.org/licenses/MIT
|
9
|
+
//
|
10
|
+
// Unless required by applicable law or agreed to in writing, software distributed
|
11
|
+
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
12
|
+
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
13
|
+
// specific language governing permissions and limitations under the License.
|
14
|
+
|
15
|
+
#include "unittest.h"
|
16
|
+
|
17
|
+
#include "rapidjson/istreamwrapper.h"
|
18
|
+
#include "rapidjson/encodedstream.h"
|
19
|
+
#include "rapidjson/document.h"
|
20
|
+
#include <sstream>
|
21
|
+
#include <fstream>
|
22
|
+
|
23
|
+
#ifdef _MSC_VER
|
24
|
+
RAPIDJSON_DIAG_PUSH
|
25
|
+
RAPIDJSON_DIAG_OFF(4702) // unreachable code
|
26
|
+
#endif
|
27
|
+
|
28
|
+
using namespace rapidjson;
|
29
|
+
using namespace std;
|
30
|
+
|
31
|
+
template <typename StringStreamType>
|
32
|
+
static void TestStringStream() {
|
33
|
+
typedef typename StringStreamType::char_type Ch;
|
34
|
+
|
35
|
+
{
|
36
|
+
StringStreamType iss;
|
37
|
+
BasicIStreamWrapper<StringStreamType> is(iss);
|
38
|
+
EXPECT_EQ(0, is.Tell());
|
39
|
+
if (sizeof(Ch) == 1) {
|
40
|
+
EXPECT_EQ(0, is.Peek4());
|
41
|
+
EXPECT_EQ(0, is.Tell());
|
42
|
+
}
|
43
|
+
EXPECT_EQ(0, is.Peek());
|
44
|
+
EXPECT_EQ(0, is.Take());
|
45
|
+
EXPECT_EQ(0, is.Tell());
|
46
|
+
}
|
47
|
+
|
48
|
+
{
|
49
|
+
Ch s[] = { 'A', 'B', 'C', '\0' };
|
50
|
+
StringStreamType iss(s);
|
51
|
+
BasicIStreamWrapper<StringStreamType> is(iss);
|
52
|
+
EXPECT_EQ(0, is.Tell());
|
53
|
+
if (sizeof(Ch) == 1) {
|
54
|
+
EXPECT_EQ(0, is.Peek4()); // less than 4 bytes
|
55
|
+
}
|
56
|
+
for (int i = 0; i < 3; i++) {
|
57
|
+
EXPECT_EQ(static_cast<size_t>(i), is.Tell());
|
58
|
+
EXPECT_EQ('A' + i, is.Peek());
|
59
|
+
EXPECT_EQ('A' + i, is.Peek());
|
60
|
+
EXPECT_EQ('A' + i, is.Take());
|
61
|
+
}
|
62
|
+
EXPECT_EQ(3, is.Tell());
|
63
|
+
EXPECT_EQ(0, is.Peek());
|
64
|
+
EXPECT_EQ(0, is.Take());
|
65
|
+
}
|
66
|
+
|
67
|
+
{
|
68
|
+
Ch s[] = { 'A', 'B', 'C', 'D', 'E', '\0' };
|
69
|
+
StringStreamType iss(s);
|
70
|
+
BasicIStreamWrapper<StringStreamType> is(iss);
|
71
|
+
if (sizeof(Ch) == 1) {
|
72
|
+
const Ch* c = is.Peek4();
|
73
|
+
for (int i = 0; i < 4; i++)
|
74
|
+
EXPECT_EQ('A' + i, c[i]);
|
75
|
+
EXPECT_EQ(0, is.Tell());
|
76
|
+
}
|
77
|
+
for (int i = 0; i < 5; i++) {
|
78
|
+
EXPECT_EQ(static_cast<size_t>(i), is.Tell());
|
79
|
+
EXPECT_EQ('A' + i, is.Peek());
|
80
|
+
EXPECT_EQ('A' + i, is.Peek());
|
81
|
+
EXPECT_EQ('A' + i, is.Take());
|
82
|
+
}
|
83
|
+
EXPECT_EQ(5, is.Tell());
|
84
|
+
EXPECT_EQ(0, is.Peek());
|
85
|
+
EXPECT_EQ(0, is.Take());
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
TEST(IStreamWrapper, istringstream) {
|
90
|
+
TestStringStream<istringstream>();
|
91
|
+
}
|
92
|
+
|
93
|
+
TEST(IStreamWrapper, stringstream) {
|
94
|
+
TestStringStream<stringstream>();
|
95
|
+
}
|
96
|
+
|
97
|
+
TEST(IStreamWrapper, wistringstream) {
|
98
|
+
TestStringStream<wistringstream>();
|
99
|
+
}
|
100
|
+
|
101
|
+
TEST(IStreamWrapper, wstringstream) {
|
102
|
+
TestStringStream<wstringstream>();
|
103
|
+
}
|
104
|
+
|
105
|
+
template <typename FileStreamType>
|
106
|
+
static bool Open(FileStreamType& fs, const char* filename) {
|
107
|
+
const char *paths[] = {
|
108
|
+
"encodings",
|
109
|
+
"bin/encodings",
|
110
|
+
"../bin/encodings",
|
111
|
+
"../../bin/encodings",
|
112
|
+
"../../../bin/encodings"
|
113
|
+
};
|
114
|
+
char buffer[1024];
|
115
|
+
for (size_t i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
|
116
|
+
sprintf(buffer, "%s/%s", paths[i], filename);
|
117
|
+
fs.open(buffer, ios_base::in | ios_base::binary);
|
118
|
+
if (fs.is_open())
|
119
|
+
return true;
|
120
|
+
}
|
121
|
+
return false;
|
122
|
+
}
|
123
|
+
|
124
|
+
TEST(IStreamWrapper, ifstream) {
|
125
|
+
ifstream ifs;
|
126
|
+
ASSERT_TRUE(Open(ifs, "utf8bom.json"));
|
127
|
+
IStreamWrapper isw(ifs);
|
128
|
+
EncodedInputStream<UTF8<>, IStreamWrapper> eis(isw);
|
129
|
+
Document d;
|
130
|
+
EXPECT_TRUE(!d.ParseStream(eis).HasParseError());
|
131
|
+
EXPECT_TRUE(d.IsObject());
|
132
|
+
EXPECT_EQ(5, d.MemberCount());
|
133
|
+
}
|
134
|
+
|
135
|
+
TEST(IStreamWrapper, fstream) {
|
136
|
+
fstream fs;
|
137
|
+
ASSERT_TRUE(Open(fs, "utf8bom.json"));
|
138
|
+
IStreamWrapper isw(fs);
|
139
|
+
EncodedInputStream<UTF8<>, IStreamWrapper> eis(isw);
|
140
|
+
Document d;
|
141
|
+
EXPECT_TRUE(!d.ParseStream(eis).HasParseError());
|
142
|
+
EXPECT_TRUE(d.IsObject());
|
143
|
+
EXPECT_EQ(5, d.MemberCount());
|
144
|
+
}
|
145
|
+
|
146
|
+
// wifstream/wfstream only works on C++11 with codecvt_utf16
|
147
|
+
// But many C++11 library still not have it.
|
148
|
+
#if 0
|
149
|
+
#include <codecvt>
|
150
|
+
|
151
|
+
TEST(IStreamWrapper, wifstream) {
|
152
|
+
wifstream ifs;
|
153
|
+
ASSERT_TRUE(Open(ifs, "utf16bebom.json"));
|
154
|
+
ifs.imbue(std::locale(ifs.getloc(),
|
155
|
+
new std::codecvt_utf16<wchar_t, 0x10ffff, std::consume_header>));
|
156
|
+
WIStreamWrapper isw(ifs);
|
157
|
+
GenericDocument<UTF16<> > d;
|
158
|
+
d.ParseStream<kParseDefaultFlags, UTF16<>, WIStreamWrapper>(isw);
|
159
|
+
EXPECT_TRUE(!d.HasParseError());
|
160
|
+
EXPECT_TRUE(d.IsObject());
|
161
|
+
EXPECT_EQ(5, d.MemberCount());
|
162
|
+
}
|
163
|
+
|
164
|
+
TEST(IStreamWrapper, wfstream) {
|
165
|
+
wfstream fs;
|
166
|
+
ASSERT_TRUE(Open(fs, "utf16bebom.json"));
|
167
|
+
fs.imbue(std::locale(fs.getloc(),
|
168
|
+
new std::codecvt_utf16<wchar_t, 0x10ffff, std::consume_header>));
|
169
|
+
WIStreamWrapper isw(fs);
|
170
|
+
GenericDocument<UTF16<> > d;
|
171
|
+
d.ParseStream<kParseDefaultFlags, UTF16<>, WIStreamWrapper>(isw);
|
172
|
+
EXPECT_TRUE(!d.HasParseError());
|
173
|
+
EXPECT_TRUE(d.IsObject());
|
174
|
+
EXPECT_EQ(5, d.MemberCount());
|
175
|
+
}
|
176
|
+
|
177
|
+
#endif
|
178
|
+
|
179
|
+
#ifdef _MSC_VER
|
180
|
+
RAPIDJSON_DIAG_POP
|
181
|
+
#endif
|