├── .clang-format ├── .github ├── CONTRIBUTING.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── codeql-analysis.yml │ └── github-ci.yml ├── .gitignore ├── CMakeLists.txt ├── Comparison.md ├── Install.md ├── LICENSE ├── LICENSE-xxhash ├── Performance.md ├── README.md ├── TODO ├── VERSION ├── VelocyPack.md ├── cmake └── Modules │ ├── AR_CompilerSettings.cmake │ ├── FindSSE.cmake │ └── TargetArch.cmake ├── download-rapidjson.sh ├── download-simdjson.sh ├── examples ├── API.md ├── CMakeLists.txt ├── Embedding.md ├── README.md ├── exampleAliases.cpp ├── exampleArrayHandling.cpp ├── exampleArrayIterator.cpp ├── exampleAttributeTranslation.cpp ├── exampleBuilder.cpp ├── exampleBuilderFancy.cpp ├── exampleCustom.cpp ├── exampleDumper.cpp ├── exampleDumperFile.cpp ├── exampleDumperPretty.cpp ├── exampleObjectHandling.cpp ├── exampleObjectIterator.cpp ├── exampleObjectLookup.cpp ├── exampleParser.cpp └── exampleSlice.cpp ├── external └── sse2neon │ ├── emmintrin.h │ ├── smmintrin.h │ └── sse2neon.h ├── include └── velocypack │ ├── AttributeTranslator.h │ ├── Basics.h │ ├── Buffer.h │ ├── Builder.h │ ├── Collection.h │ ├── Compare.h │ ├── Dumper.h │ ├── Exception.h │ ├── HashedStringRef.h │ ├── HexDump.h │ ├── Iterator.h │ ├── Options.h │ ├── Parser.h │ ├── Serializable.h │ ├── SharedSlice.h │ ├── Sink.h │ ├── Slice.h │ ├── SliceBase.h │ ├── SliceBase.tpp │ ├── SliceContainer.h │ ├── SliceStaticData.h │ ├── SmallVector.h │ ├── String.h │ ├── StringRef.h │ ├── Utf8Helper.h │ ├── Validator.h │ ├── Value.h │ ├── ValueType.h │ ├── Version.h │ ├── velocypack-aliases.h │ ├── velocypack-common.h │ ├── velocypack-exception-macros.h │ ├── velocypack-memory.h │ ├── velocypack-version-number.h │ ├── velocypack-wyhash.h │ └── vpack.h ├── scripts ├── GdbSlicePrettyPrint.py ├── build-version.cpp ├── collect-coverage.sh ├── execute-test.sh └── run_litefuzz │ ├── README.md │ └── runFuzz.sh ├── src ├── AttributeTranslator.cpp ├── Builder.cpp ├── Collection.cpp ├── Compare.cpp ├── Dumper.cpp ├── Exception.cpp ├── HashedStringRef.cpp ├── HexDump.cpp ├── Iterator.cpp ├── Options.cpp ├── Parser.cpp ├── Serializable.cpp ├── SharedSlice.cpp ├── Slice.cpp ├── String.cpp ├── Utf8Helper.cpp ├── Validator.cpp ├── Value.cpp ├── ValueType.cpp ├── Version.cpp ├── asm-functions.cpp ├── asm-functions.h ├── asm-utf8check.cpp ├── asm-utf8check.h ├── fasthash.cpp ├── fpconv.cpp ├── powers.h ├── string-functions.cpp ├── velocypack-common.cpp ├── xxhash.c └── xxhash.h ├── tests ├── CMakeLists.txt ├── googletest │ ├── .clang-format │ ├── .gitignore │ ├── .travis.yml │ ├── BUILD.bazel │ ├── CMakeLists.txt │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── Makefile.am │ ├── README.md │ ├── WORKSPACE │ ├── appveyor.yml │ ├── ci │ │ ├── build-linux-autotools.sh │ │ ├── build-linux-bazel.sh │ │ ├── build-platformio.sh │ │ ├── env-linux.sh │ │ ├── env-osx.sh │ │ ├── get-nprocessors.sh │ │ ├── install-linux.sh │ │ ├── install-osx.sh │ │ ├── install-platformio.sh │ │ ├── log-config.sh │ │ └── travis.sh │ ├── configure.ac │ ├── googlemock │ │ ├── CMakeLists.txt │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── Makefile.am │ │ ├── README.md │ │ ├── build-aux │ │ │ └── .keep │ │ ├── cmake │ │ │ ├── gmock.pc.in │ │ │ └── gmock_main.pc.in │ │ ├── configure.ac │ │ ├── docs │ │ │ ├── CheatSheet.md │ │ │ ├── CookBook.md │ │ │ ├── DesignDoc.md │ │ │ ├── Documentation.md │ │ │ ├── ForDummies.md │ │ │ ├── FrequentlyAskedQuestions.md │ │ │ └── KnownIssues.md │ │ ├── include │ │ │ └── gmock │ │ │ │ ├── gmock-actions.h │ │ │ │ ├── gmock-cardinalities.h │ │ │ │ ├── gmock-function-mocker.h │ │ │ │ ├── gmock-generated-actions.h │ │ │ │ ├── gmock-generated-actions.h.pump │ │ │ │ ├── gmock-generated-function-mockers.h │ │ │ │ ├── gmock-generated-function-mockers.h.pump │ │ │ │ ├── gmock-generated-matchers.h │ │ │ │ ├── gmock-generated-matchers.h.pump │ │ │ │ ├── gmock-matchers.h │ │ │ │ ├── gmock-more-actions.h │ │ │ │ ├── gmock-more-matchers.h │ │ │ │ ├── gmock-nice-strict.h │ │ │ │ ├── gmock-spec-builders.h │ │ │ │ ├── gmock.h │ │ │ │ └── internal │ │ │ │ ├── custom │ │ │ │ ├── README.md │ │ │ │ ├── gmock-generated-actions.h │ │ │ │ ├── gmock-generated-actions.h.pump │ │ │ │ ├── gmock-matchers.h │ │ │ │ └── gmock-port.h │ │ │ │ ├── gmock-internal-utils.h │ │ │ │ ├── gmock-port.h │ │ │ │ └── gmock-pp.h │ │ ├── make │ │ │ └── Makefile │ │ ├── msvc │ │ │ ├── 2005 │ │ │ │ ├── gmock.sln │ │ │ │ ├── gmock.vcproj │ │ │ │ ├── gmock_config.vsprops │ │ │ │ ├── gmock_main.vcproj │ │ │ │ └── gmock_test.vcproj │ │ │ ├── 2010 │ │ │ │ ├── gmock.sln │ │ │ │ ├── gmock.vcxproj │ │ │ │ ├── gmock_config.props │ │ │ │ ├── gmock_main.vcxproj │ │ │ │ └── gmock_test.vcxproj │ │ │ └── 2015 │ │ │ │ ├── gmock.sln │ │ │ │ ├── gmock.vcxproj │ │ │ │ ├── gmock_config.props │ │ │ │ ├── gmock_main.vcxproj │ │ │ │ └── gmock_test.vcxproj │ │ ├── scripts │ │ │ ├── fuse_gmock_files.py │ │ │ ├── generator │ │ │ │ ├── LICENSE │ │ │ │ ├── README │ │ │ │ ├── README.cppclean │ │ │ │ ├── cpp │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── ast.py │ │ │ │ │ ├── gmock_class.py │ │ │ │ │ ├── gmock_class_test.py │ │ │ │ │ ├── keywords.py │ │ │ │ │ ├── tokenize.py │ │ │ │ │ └── utils.py │ │ │ │ └── gmock_gen.py │ │ │ ├── gmock-config.in │ │ │ ├── gmock_doctor.py │ │ │ ├── upload.py │ │ │ └── upload_gmock.py │ │ ├── src │ │ │ ├── gmock-all.cc │ │ │ ├── gmock-cardinalities.cc │ │ │ ├── gmock-internal-utils.cc │ │ │ ├── gmock-matchers.cc │ │ │ ├── gmock-spec-builders.cc │ │ │ ├── gmock.cc │ │ │ └── gmock_main.cc │ │ └── test │ │ │ ├── BUILD.bazel │ │ │ ├── gmock-actions_test.cc │ │ │ ├── gmock-cardinalities_test.cc │ │ │ ├── gmock-function-mocker_nc.cc │ │ │ ├── gmock-function-mocker_nc_test.py │ │ │ ├── gmock-function-mocker_test.cc │ │ │ ├── gmock-generated-actions_test.cc │ │ │ ├── gmock-generated-function-mockers_test.cc │ │ │ ├── gmock-generated-matchers_test.cc │ │ │ ├── gmock-internal-utils_test.cc │ │ │ ├── gmock-matchers_test.cc │ │ │ ├── gmock-more-actions_test.cc │ │ │ ├── gmock-nice-strict_test.cc │ │ │ ├── gmock-port_test.cc │ │ │ ├── gmock-pp-string_test.cc │ │ │ ├── gmock-pp_test.cc │ │ │ ├── gmock-spec-builders_test.cc │ │ │ ├── gmock_all_test.cc │ │ │ ├── gmock_ex_test.cc │ │ │ ├── gmock_leak_test.py │ │ │ ├── gmock_leak_test_.cc │ │ │ ├── gmock_link2_test.cc │ │ │ ├── gmock_link_test.cc │ │ │ ├── gmock_link_test.h │ │ │ ├── gmock_output_test.py │ │ │ ├── gmock_output_test_.cc │ │ │ ├── gmock_output_test_golden.txt │ │ │ ├── gmock_stress_test.cc │ │ │ ├── gmock_test.cc │ │ │ └── gmock_test_utils.py │ ├── googletest │ │ ├── CMakeLists.txt │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── Makefile.am │ │ ├── README.md │ │ ├── cmake │ │ │ ├── Config.cmake.in │ │ │ ├── gtest.pc.in │ │ │ ├── gtest_main.pc.in │ │ │ └── internal_utils.cmake │ │ ├── codegear │ │ │ ├── gtest.cbproj │ │ │ ├── gtest.groupproj │ │ │ ├── gtest_all.cc │ │ │ ├── gtest_link.cc │ │ │ ├── gtest_main.cbproj │ │ │ └── gtest_unittest.cbproj │ │ ├── configure.ac │ │ ├── docs │ │ │ ├── Pkgconfig.md │ │ │ ├── PumpManual.md │ │ │ ├── XcodeGuide.md │ │ │ ├── advanced.md │ │ │ ├── faq.md │ │ │ ├── primer.md │ │ │ └── samples.md │ │ ├── include │ │ │ └── gtest │ │ │ │ ├── gtest-death-test.h │ │ │ │ ├── gtest-matchers.h │ │ │ │ ├── gtest-message.h │ │ │ │ ├── gtest-param-test.h │ │ │ │ ├── gtest-param-test.h.pump │ │ │ │ ├── gtest-printers.h │ │ │ │ ├── gtest-spi.h │ │ │ │ ├── gtest-test-part.h │ │ │ │ ├── gtest-typed-test.h │ │ │ │ ├── gtest.h │ │ │ │ ├── gtest_pred_impl.h │ │ │ │ ├── gtest_prod.h │ │ │ │ └── internal │ │ │ │ ├── custom │ │ │ │ ├── README.md │ │ │ │ ├── gtest-port.h │ │ │ │ ├── gtest-printers.h │ │ │ │ └── gtest.h │ │ │ │ ├── gtest-death-test-internal.h │ │ │ │ ├── gtest-filepath.h │ │ │ │ ├── gtest-internal.h │ │ │ │ ├── gtest-param-util-generated.h │ │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ │ ├── gtest-param-util.h │ │ │ │ ├── gtest-port-arch.h │ │ │ │ ├── gtest-port.h │ │ │ │ ├── gtest-string.h │ │ │ │ ├── gtest-type-util.h │ │ │ │ └── gtest-type-util.h.pump │ │ ├── m4 │ │ │ ├── acx_pthread.m4 │ │ │ └── gtest.m4 │ │ ├── make │ │ │ └── Makefile │ │ ├── msvc │ │ │ └── 2010 │ │ │ │ ├── gtest-md.sln │ │ │ │ ├── gtest-md.vcxproj │ │ │ │ ├── gtest-md.vcxproj.filters │ │ │ │ ├── gtest.sln │ │ │ │ ├── gtest.vcxproj │ │ │ │ ├── gtest.vcxproj.filters │ │ │ │ ├── gtest_main-md.vcxproj │ │ │ │ ├── gtest_main-md.vcxproj.filters │ │ │ │ ├── gtest_main.vcxproj │ │ │ │ ├── gtest_main.vcxproj.filters │ │ │ │ ├── gtest_prod_test-md.vcxproj │ │ │ │ ├── gtest_prod_test-md.vcxproj.filters │ │ │ │ ├── gtest_prod_test.vcxproj │ │ │ │ ├── gtest_prod_test.vcxproj.filters │ │ │ │ ├── gtest_unittest-md.vcxproj │ │ │ │ ├── gtest_unittest-md.vcxproj.filters │ │ │ │ ├── gtest_unittest.vcxproj │ │ │ │ └── gtest_unittest.vcxproj.filters │ │ ├── samples │ │ │ ├── prime_tables.h │ │ │ ├── sample1.cc │ │ │ ├── sample1.h │ │ │ ├── sample10_unittest.cc │ │ │ ├── sample1_unittest.cc │ │ │ ├── sample2.cc │ │ │ ├── sample2.h │ │ │ ├── sample2_unittest.cc │ │ │ ├── sample3-inl.h │ │ │ ├── sample3_unittest.cc │ │ │ ├── sample4.cc │ │ │ ├── sample4.h │ │ │ ├── sample4_unittest.cc │ │ │ ├── sample5_unittest.cc │ │ │ ├── sample6_unittest.cc │ │ │ ├── sample7_unittest.cc │ │ │ ├── sample8_unittest.cc │ │ │ └── sample9_unittest.cc │ │ ├── scripts │ │ │ ├── common.py │ │ │ ├── fuse_gtest_files.py │ │ │ ├── gen_gtest_pred_impl.py │ │ │ ├── gtest-config.in │ │ │ ├── pump.py │ │ │ ├── release_docs.py │ │ │ ├── test │ │ │ │ └── Makefile │ │ │ ├── upload.py │ │ │ └── upload_gtest.py │ │ ├── src │ │ │ ├── gtest-all.cc │ │ │ ├── gtest-death-test.cc │ │ │ ├── gtest-filepath.cc │ │ │ ├── gtest-internal-inl.h │ │ │ ├── gtest-matchers.cc │ │ │ ├── gtest-port.cc │ │ │ ├── gtest-printers.cc │ │ │ ├── gtest-test-part.cc │ │ │ ├── gtest-typed-test.cc │ │ │ ├── gtest.cc │ │ │ └── gtest_main.cc │ │ ├── test │ │ │ ├── BUILD.bazel │ │ │ ├── googletest-break-on-failure-unittest.py │ │ │ ├── googletest-break-on-failure-unittest_.cc │ │ │ ├── googletest-catch-exceptions-test.py │ │ │ ├── googletest-catch-exceptions-test_.cc │ │ │ ├── googletest-color-test.py │ │ │ ├── googletest-color-test_.cc │ │ │ ├── googletest-death-test-test.cc │ │ │ ├── googletest-death-test_ex_test.cc │ │ │ ├── googletest-env-var-test.py │ │ │ ├── googletest-env-var-test_.cc │ │ │ ├── googletest-filepath-test.cc │ │ │ ├── googletest-filter-unittest.py │ │ │ ├── googletest-filter-unittest_.cc │ │ │ ├── googletest-json-outfiles-test.py │ │ │ ├── googletest-json-output-unittest.py │ │ │ ├── googletest-list-tests-unittest.py │ │ │ ├── googletest-list-tests-unittest_.cc │ │ │ ├── googletest-listener-test.cc │ │ │ ├── googletest-message-test.cc │ │ │ ├── googletest-options-test.cc │ │ │ ├── googletest-output-test-golden-lin.txt │ │ │ ├── googletest-output-test.py │ │ │ ├── googletest-output-test_.cc │ │ │ ├── googletest-param-test-invalid-name1-test.py │ │ │ ├── googletest-param-test-invalid-name1-test_.cc │ │ │ ├── googletest-param-test-invalid-name2-test.py │ │ │ ├── googletest-param-test-invalid-name2-test_.cc │ │ │ ├── googletest-param-test-test.cc │ │ │ ├── googletest-param-test-test.h │ │ │ ├── googletest-param-test2-test.cc │ │ │ ├── googletest-port-test.cc │ │ │ ├── googletest-printers-test.cc │ │ │ ├── googletest-shuffle-test.py │ │ │ ├── googletest-shuffle-test_.cc │ │ │ ├── googletest-test-part-test.cc │ │ │ ├── googletest-test2_test.cc │ │ │ ├── googletest-throw-on-failure-test.py │ │ │ ├── googletest-throw-on-failure-test_.cc │ │ │ ├── googletest-uninitialized-test.py │ │ │ ├── googletest-uninitialized-test_.cc │ │ │ ├── gtest-typed-test2_test.cc │ │ │ ├── gtest-typed-test_test.cc │ │ │ ├── gtest-typed-test_test.h │ │ │ ├── gtest-unittest-api_test.cc │ │ │ ├── gtest_all_test.cc │ │ │ ├── gtest_assert_by_exception_test.cc │ │ │ ├── gtest_environment_test.cc │ │ │ ├── gtest_help_test.py │ │ │ ├── gtest_help_test_.cc │ │ │ ├── gtest_json_test_utils.py │ │ │ ├── gtest_list_output_unittest.py │ │ │ ├── gtest_list_output_unittest_.cc │ │ │ ├── gtest_main_unittest.cc │ │ │ ├── gtest_no_test_unittest.cc │ │ │ ├── gtest_pred_impl_unittest.cc │ │ │ ├── gtest_premature_exit_test.cc │ │ │ ├── gtest_prod_test.cc │ │ │ ├── gtest_repeat_test.cc │ │ │ ├── gtest_skip_test.cc │ │ │ ├── gtest_sole_header_test.cc │ │ │ ├── gtest_stress_test.cc │ │ │ ├── gtest_test_macro_stack_footprint_test.cc │ │ │ ├── gtest_test_utils.py │ │ │ ├── gtest_testbridge_test.py │ │ │ ├── gtest_testbridge_test_.cc │ │ │ ├── gtest_throw_on_failure_ex_test.cc │ │ │ ├── gtest_unittest.cc │ │ │ ├── gtest_xml_outfile1_test_.cc │ │ │ ├── gtest_xml_outfile2_test_.cc │ │ │ ├── gtest_xml_outfiles_test.py │ │ │ ├── gtest_xml_output_unittest.py │ │ │ ├── gtest_xml_output_unittest_.cc │ │ │ ├── gtest_xml_test_utils.py │ │ │ ├── production.cc │ │ │ └── production.h │ │ └── xcode │ │ │ ├── Config │ │ │ ├── DebugProject.xcconfig │ │ │ ├── FrameworkTarget.xcconfig │ │ │ ├── General.xcconfig │ │ │ ├── ReleaseProject.xcconfig │ │ │ ├── StaticLibraryTarget.xcconfig │ │ │ └── TestTarget.xcconfig │ │ │ ├── Resources │ │ │ └── Info.plist │ │ │ ├── Samples │ │ │ └── FrameworkSample │ │ │ │ ├── Info.plist │ │ │ │ ├── WidgetFramework.xcodeproj │ │ │ │ └── project.pbxproj │ │ │ │ ├── runtests.sh │ │ │ │ ├── widget.cc │ │ │ │ ├── widget.h │ │ │ │ └── widget_test.cc │ │ │ ├── Scripts │ │ │ ├── runtests.sh │ │ │ └── versiongenerate.py │ │ │ └── gtest.xcodeproj │ │ │ └── project.pbxproj │ ├── library.json │ └── platformio.ini ├── jsonSample │ ├── README.md │ ├── api-docs.json │ ├── commits.json │ ├── countries.json │ ├── directory-tree.json │ ├── doubles-small.json │ ├── doubles.json │ ├── fail1.json │ ├── fail10.json │ ├── fail11.json │ ├── fail12.json │ ├── fail13.json │ ├── fail14.json │ ├── fail15.json │ ├── fail16.json │ ├── fail17.json │ ├── fail18.json │ ├── fail19.json │ ├── fail2.json │ ├── fail20.json │ ├── fail21.json │ ├── fail22.json │ ├── fail23.json │ ├── fail24.json │ ├── fail25.json │ ├── fail26.json │ ├── fail27.json │ ├── fail28.json │ ├── fail29.json │ ├── fail3.json │ ├── fail30.json │ ├── fail31.json │ ├── fail32.json │ ├── fail33.json │ ├── fail4.json │ ├── fail5.json │ ├── fail6.json │ ├── fail7.json │ ├── fail8.json │ ├── fail9.json │ ├── file-list.json │ ├── object.json │ ├── pass1.json │ ├── pass2.json │ ├── pass3.json │ ├── random1.json │ ├── random2.json │ ├── random3.json │ ├── sample.json │ ├── sampleNoWhite.json │ └── small.json ├── tests-common.h ├── testsAliases.cpp ├── testsBuffer.cpp ├── testsBuilder.cpp ├── testsCollection.cpp ├── testsCommon.cpp ├── testsCompare.cpp ├── testsDumper.cpp ├── testsException.cpp ├── testsFiles.cpp ├── testsHashedStringRef.cpp ├── testsHexDump.cpp ├── testsIterator.cpp ├── testsLarge.cpp ├── testsLookup.cpp ├── testsParser.cpp ├── testsSerializable.cpp ├── testsSharedSlice.cpp ├── testsSink.cpp ├── testsSlice.cpp ├── testsSliceContainer.cpp ├── testsType.cpp ├── testsValidator.cpp └── testsVersion.cpp └── tools ├── CMakeLists.txt ├── README.md ├── bench.cpp ├── bench.md ├── bench.png ├── fuzzer.cpp ├── json-to-vpack.cpp ├── vpack-to-json.cpp └── vpack-validate.cpp /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | We welcome bug fixes and patches from 3rd party contributors! 5 | 6 | Please follow these guidelines if you want to contribute to VelocyPack: 7 | 8 | * If you found a bug: if the bug you found is not yet described in an existing 9 | Github issue, please file a new one. The new issue should include a clear 10 | description of the bug and how to reproduce it (including your OS / environment). 11 | 12 | * If you want to contribute code, documentation or a missing feature, please 13 | develop and test the feature locally first and then send us a pull request. 14 | Please note that we require you to sign the [Contributor Agreement](https://www.arangodb.com/documents/cla.pdf) 15 | before we can accept your pull requests. 16 | Code changes in the VelocyPack library should use the "Google" style and 17 | conventions as used by *clang-format*. 18 | 19 | * Please let us know if you plan to work on a ticket. This way we can make sure 20 | redundant work is avoided. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Please note that for legal reasons we require you to sign the 2 | [Contributor Agreement](https://www.arangodb.com/documents/cla.pdf) 3 | before we can accept your pull requests. 4 | 5 | Code changes and contributions in the VelocyPack library should use 6 | the "Google" style and conventions as used by *clang-format*. 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bench 2 | vpack-to-json 3 | json-to-vpack 4 | core 5 | AsmTest 6 | *.o 7 | *.orig 8 | *.rej 9 | rapidjson 10 | simdjson 11 | .deps 12 | Makefile 13 | autom4te.cache 14 | config.h 15 | config.log 16 | config.status 17 | libvelocypack.a 18 | stamp-h1 19 | config.h.in~ 20 | 21 | tests/googletest/ 22 | CMakeCache.txt 23 | CMakeFiles/ 24 | build/ 25 | cmake_install.cmake 26 | install_manifest.txt 27 | DartConfiguration.tcl 28 | tests/CTestTestfile.cmake 29 | 30 | 31 | .vscode -------------------------------------------------------------------------------- /Comparison.md: -------------------------------------------------------------------------------- 1 | Comparison of VelocyPack to other formats 2 | ========================================= 3 | 4 | - MessagePack 5 | - Protocol Buffers 6 | - Thrift 7 | - Google's flat buffers 8 | - JSON 9 | - BSON 10 | 11 | Pro/Contra for each 12 | Use cases 13 | 14 | Performance and size overview 15 | 16 | Table 17 | -------------------------------------------------------------------------------- /LICENSE-xxhash: -------------------------------------------------------------------------------- 1 | xxHash Library 2 | Copyright (c) 2012-2020 Yann Collet 3 | All rights reserved. 4 | 5 | BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, this 14 | list of conditions and the following disclaimer in the documentation and/or 15 | other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | ---------------------------------------------------- 29 | 30 | xxhsum command line interface 31 | Copyright (c) 2013-2020 Yann Collet 32 | All rights reserved. 33 | 34 | GPL v2 License 35 | 36 | This program is free software; you can redistribute it and/or modify 37 | it under the terms of the GNU General Public License as published by 38 | the Free Software Foundation; either version 2 of the License, or 39 | (at your option) any later version. 40 | 41 | This program is distributed in the hope that it will be useful, 42 | but WITHOUT ANY WARRANTY; without even the implied warranty of 43 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 44 | GNU General Public License for more details. 45 | 46 | You should have received a copy of the GNU General Public License along 47 | with this program; if not, write to the Free Software Foundation, Inc., 48 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 49 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Testing 2 | ------- 3 | * automate tests on MacOS and ARM 4 | 5 | Features 6 | -------- 7 | * implement missing type BCD in Builder, Slice, Parser and Dumper 8 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.1.35 2 | -------------------------------------------------------------------------------- /download-rapidjson.sh: -------------------------------------------------------------------------------- 1 | rm -rf rapidjson 2 | git clone https://github.com/miloyip/rapidjson 3 | -------------------------------------------------------------------------------- /download-simdjson.sh: -------------------------------------------------------------------------------- 1 | rm -rf simdjson 2 | git clone https://github.com/simdjson/simdjson 3 | cd simdjson 4 | mkdir build && cd build 5 | cmake ../ -DCMAKE_BUILD_TYPE=Release -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # options 2 | 3 | set(CMAKE_INTERPROCEDURAL_OPTIMIZATION False) 4 | option(BuildVelocyPackExamples "Build examples" ON) 5 | 6 | message(STATUS "VelocyPack building examples: ${BuildVelocyPackExamples}") 7 | if(BuildVelocyPackExamples) 8 | set(Examples 9 | exampleAliases 10 | exampleArrayHandling 11 | exampleArrayIterator 12 | exampleAttributeTranslation 13 | exampleBuilder 14 | exampleBuilderFancy 15 | exampleCustom 16 | exampleDumper 17 | exampleDumperFile 18 | exampleDumperPretty 19 | exampleObjectHandling 20 | exampleObjectIterator 21 | exampleObjectLookup 22 | exampleParser 23 | exampleSlice 24 | ) 25 | 26 | foreach (exampleName ${Examples}) 27 | add_executable(${exampleName} ${exampleName}.cpp) 28 | target_link_libraries(${exampleName} velocypack) 29 | endforeach() 30 | endif() 31 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | Using VPack 2 | =========== 3 | 4 | This directory contains example code that demonstrates the usage of the 5 | VPack library from C++ programs. Please consult the file [API.md](API.md) for 6 | a description of the main VPack classes and explained usage examples. 7 | 8 | The file [Embedding.md](Embedding.md) contains additional information 9 | about how to embed the VPack library into client applications. 10 | -------------------------------------------------------------------------------- /examples/exampleAliases.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "velocypack/Builder.h" 3 | #include "velocypack/Iterator.h" 4 | #include "velocypack/Slice.h" 5 | #include "velocypack/Value.h" 6 | #include "velocypack/ValueType.h" 7 | #include "velocypack/velocypack-aliases.h" 8 | #include "velocypack/velocypack-exception-macros.h" 9 | 10 | int main(int, char*[]) { 11 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 12 | 13 | // create an array with 10 number members 14 | VPackBuilder b; 15 | 16 | b(VPackValue(VPackValueType::Array)); 17 | for (size_t i = 0; i < 10; ++i) { 18 | b.add(VPackValue(i)); 19 | } 20 | b.close(); 21 | 22 | // a Slice is a lightweight accessor for a VPack value 23 | VPackSlice s(b.start()); 24 | 25 | // inspect the outermost value (should be an Array...) 26 | std::cout << "Slice: " << s << std::endl; 27 | std::cout << "Type: " << s.type() << std::endl; 28 | std::cout << "Bytesize: " << s.byteSize() << std::endl; 29 | std::cout << "Members: " << s.length() << std::endl; 30 | 31 | // now iterate over the array members 32 | std::cout << "Iterating Array members:" << std::endl; 33 | for (auto const& it : VPackArrayIterator(s)) { 34 | std::cout << it << ", number value: " << it.getUInt() << std::endl; 35 | } 36 | 37 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 38 | } 39 | -------------------------------------------------------------------------------- /examples/exampleArrayHandling.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "velocypack/vpack.h" 3 | #include "velocypack/velocypack-exception-macros.h" 4 | 5 | using namespace arangodb::velocypack; 6 | 7 | int main(int, char*[]) { 8 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 9 | 10 | // create an array with 10 number members 11 | Builder b; 12 | 13 | b(Value(ValueType::Array)); 14 | for (size_t i = 0; i < 10; ++i) { 15 | b.add(Value(i)); 16 | } 17 | b.close(); 18 | 19 | // a Slice is a lightweight accessor for a VPack value 20 | Slice s(b.start()); 21 | 22 | // filter out all array values less than 5 23 | Builder filtered = 24 | Collection::filter(s, [](Slice const& current, ValueLength) { 25 | if (current.getNumber() < 5) { 26 | // exclude 27 | return false; 28 | } 29 | // include 30 | return true; 31 | }); 32 | 33 | // print filtered array 34 | Slice f(filtered.slice()); 35 | std::cout << "Filtered length: " << f.length() << std::endl; 36 | 37 | // now iterate over the (left over) array members 38 | std::cout << "Iterating Array members:" << std::endl; 39 | for (auto const& it : ArrayIterator(f)) { 40 | std::cout << it << ", number value: " << it.getUInt() << std::endl; 41 | } 42 | 43 | // iterate again, this time using Collection::forEach 44 | std::cout << "Iterating some Array members using forEach:" << std::endl; 45 | Collection::forEach(f, [](Slice const& current, ValueLength index) { 46 | std::cout << current << ", number value: " << current.getUInt() 47 | << std::endl; 48 | return (index != 2); // stop after the 3rd element (indexes are 0-based) 49 | }); 50 | 51 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 52 | } 53 | -------------------------------------------------------------------------------- /examples/exampleArrayIterator.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "velocypack/vpack.h" 3 | #include "velocypack/velocypack-exception-macros.h" 4 | 5 | using namespace arangodb::velocypack; 6 | 7 | int main(int, char*[]) { 8 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 9 | 10 | // create an array with 10 number members 11 | Builder b; 12 | 13 | b(Value(ValueType::Array)); 14 | for (size_t i = 0; i < 10; ++i) { 15 | b.add(Value(i)); 16 | } 17 | b.close(); 18 | 19 | // a Slice is a lightweight accessor for a VPack value 20 | Slice s(b.start()); 21 | 22 | // inspect the outermost value (should be an Array...) 23 | std::cout << "Slice: " << s << std::endl; 24 | std::cout << "Type: " << s.type() << std::endl; 25 | std::cout << "Bytesize: " << s.byteSize() << std::endl; 26 | std::cout << "Members: " << s.length() << std::endl; 27 | 28 | // now iterate over the array members 29 | std::cout << "Iterating Array members:" << std::endl; 30 | for (auto const& it : ArrayIterator(s)) { 31 | std::cout << it << ", number value: " << it.getUInt() << std::endl; 32 | } 33 | 34 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 35 | } 36 | -------------------------------------------------------------------------------- /examples/exampleBuilder.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "velocypack/vpack.h" 4 | #include "velocypack/velocypack-exception-macros.h" 5 | 6 | using namespace arangodb::velocypack; 7 | 8 | int main(int, char*[]) { 9 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 10 | 11 | // create an object with attributes "b", "a", "l" and "name" 12 | // note that the attribute names will be sorted in the target VPack object! 13 | Builder b; 14 | 15 | b.add(Value(ValueType::Object)); 16 | b.add("b", Value(12)); 17 | b.add("a", Value(true)); 18 | b.add("l", Value(ValueType::Array)); 19 | b.add(Value(1)); 20 | b.add(Value(2)); 21 | b.add(Value(3)); 22 | b.close(); 23 | b.add("name", Value("Gustav")); 24 | b.close(); 25 | 26 | // now dump the resulting VPack value 27 | std::cout << "Resulting VPack:" << std::endl; 28 | std::cout << "Resulting VPack:" << b.slice() << std::endl; 29 | std::cout << HexDump(b.slice()) << std::endl; 30 | 31 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 32 | } 33 | -------------------------------------------------------------------------------- /examples/exampleBuilderFancy.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "velocypack/vpack.h" 4 | #include "velocypack/velocypack-exception-macros.h" 5 | 6 | using namespace arangodb::velocypack; 7 | 8 | int main(int, char*[]) { 9 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 10 | 11 | // create an object with attributes "b", "a", "l" and "name" 12 | // note that the attribute names will be sorted in the target VPack object! 13 | Builder b; 14 | 15 | b(Value(ValueType::Object))("b", Value(12))("a", Value(true))( 16 | "l", Value(ValueType::Array))(Value(1))(Value(2))(Value(3))()( 17 | "name", Value("Gustav"))(); 18 | 19 | // now dump the resulting VPack value 20 | std::cout << "Resulting VPack:" << std::endl; 21 | std::cout << HexDump(b.slice()) << std::endl; 22 | 23 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 24 | } 25 | -------------------------------------------------------------------------------- /examples/exampleDumper.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "velocypack/vpack.h" 3 | #include "velocypack/velocypack-exception-macros.h" 4 | 5 | using namespace arangodb::velocypack; 6 | 7 | int main(int, char*[]) { 8 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 9 | 10 | Builder b; 11 | // build an object with attribute names "b", "a", "l", "name" 12 | b(Value(ValueType::Object))("b", Value(12))("a", Value(true))( 13 | "l", Value(ValueType::Array))(Value(1))(Value(2))(Value(3))()( 14 | "name", Value("Gustav"))(); 15 | 16 | // a Slice is a lightweight accessor for a VPack value 17 | Slice s(b.start()); 18 | 19 | // now dump the Slice into an std::string sink 20 | std::string buffer; 21 | StringSink sink(&buffer); 22 | Dumper dumper(&sink); 23 | dumper.dump(s); 24 | 25 | // and print it 26 | std::cout << "Resulting VPack:" << std::endl << buffer << std::endl; 27 | 28 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 29 | } 30 | -------------------------------------------------------------------------------- /examples/exampleDumperFile.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "velocypack/vpack.h" 4 | #include "velocypack/velocypack-exception-macros.h" 5 | 6 | using namespace arangodb::velocypack; 7 | 8 | int main(int, char*[]) { 9 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 10 | 11 | Builder b; 12 | 13 | // build an object with attribute names "b", "a", "l", "name" 14 | b(Value(ValueType::Object))("b", Value(12))("a", Value(true))( 15 | "l", Value(ValueType::Array))(Value(1))(Value(2))(Value(3))()( 16 | "name", Value("Gustav"))(); 17 | 18 | // a Slice is a lightweight accessor for a VPack value 19 | Slice s(b.start()); 20 | 21 | // now dump the Slice into an outfile 22 | Options dumperOptions; 23 | dumperOptions.prettyPrint = true; 24 | 25 | // this is our output file 26 | try { 27 | std::ofstream ofs("prettified.json", std::ofstream::out); 28 | 29 | OutputFileStreamSink sink(&ofs); 30 | Dumper::dump(s, &sink); 31 | std::cout << "successfully wrote JSON to outfile 'prettified.json'" 32 | << std::endl; 33 | } catch (std::exception const& ex) { 34 | std::cout << "could not write outfile 'prettified.json': " << ex.what() 35 | << std::endl; 36 | } 37 | 38 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 39 | } 40 | -------------------------------------------------------------------------------- /examples/exampleDumperPretty.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "velocypack/vpack.h" 3 | #include "velocypack/velocypack-exception-macros.h" 4 | 5 | using namespace arangodb::velocypack; 6 | 7 | int main(int, char*[]) { 8 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 9 | 10 | Builder b; 11 | // build an object with attribute names "b", "a", "l", "name" 12 | b(Value(ValueType::Object))("b", Value(12))("a", Value(true))( 13 | "l", Value(ValueType::Array))(Value(1))(Value(2))(Value(3))()( 14 | "name", Value("Gustav"))(); 15 | 16 | // a Slice is a lightweight accessor for a VPack value 17 | Slice s(b.start()); 18 | 19 | Options dumperOptions; 20 | dumperOptions.prettyPrint = true; 21 | // now dump the Slice into an std::string 22 | std::string buffer; 23 | StringSink sink(&buffer); 24 | Dumper::dump(s, &sink, &dumperOptions); 25 | 26 | // and print it 27 | std::cout << "Resulting JSON:" << std::endl << buffer << std::endl; 28 | 29 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 30 | } 31 | -------------------------------------------------------------------------------- /examples/exampleObjectHandling.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "velocypack/vpack.h" 3 | #include "velocypack/velocypack-exception-macros.h" 4 | 5 | using namespace arangodb::velocypack; 6 | 7 | int main(int, char*[]) { 8 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 9 | 10 | // create an object with a few members 11 | Builder b; 12 | 13 | b(Value(ValueType::Object)); 14 | b.add("foo", Value(42)); 15 | b.add("bar", Value("some string value")); 16 | b.add("baz", Value(ValueType::Object)); 17 | b.add("qux", Value(true)); 18 | b.add("bart", Value("this is a string")); 19 | b.close(); 20 | b.add("quux", Value(ValueType::Array)); 21 | b.add(Value(1)); 22 | b.add(Value(2)); 23 | b.add(Value(3)); 24 | b.close(); 25 | b.close(); 26 | 27 | // a Slice is a lightweight accessor for a VPack value 28 | Slice s(b.start()); 29 | 30 | // get all object keys. returns a vector of strings 31 | for (auto const& key : Collection::keys(s)) { 32 | // print key 33 | std::cout << "Object has key '" << key << "'" << std::endl; 34 | } 35 | 36 | // get all object values. returns a Builder object with an Array inside 37 | Builder values = Collection::values(s); 38 | for (auto const& value : ArrayIterator(values.slice())) { 39 | std::cout << "Object value is: " << value << ", as JSON: " << value.toJson() 40 | << std::endl; 41 | } 42 | 43 | // recursively visit all members in the Object 44 | // PostOrder here means we'll be visiting compound members before 45 | // we're diving into their subvalues 46 | Collection::visitRecursive( 47 | s, Collection::PostOrder, 48 | [](Slice const& key, Slice const& value) -> bool { 49 | if (!key.isNone()) { 50 | // we are visiting an Object member 51 | std::cout << "Visiting Object member: " << key.copyString() 52 | << ", value: " << value.toJson() << std::endl; 53 | } else { 54 | // we are visiting an Array member 55 | std::cout << "Visiting Array member: " << value.toJson() << std::endl; 56 | } 57 | // to continue visiting, return true. to abort visiting, return false 58 | return true; 59 | }); 60 | 61 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 62 | } 63 | -------------------------------------------------------------------------------- /examples/exampleObjectIterator.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "velocypack/vpack.h" 3 | #include "velocypack/velocypack-exception-macros.h" 4 | 5 | using namespace arangodb::velocypack; 6 | 7 | int main(int, char*[]) { 8 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 9 | 10 | // create an object with a few members 11 | Builder b; 12 | 13 | b(Value(ValueType::Object)); 14 | b.add("foo", Value(42)); 15 | b.add("bar", Value("some string value")); 16 | b.add("baz", Value(ValueType::Array)); 17 | b.add(Value(1)); 18 | b.add(Value(2)); 19 | b.close(); 20 | b.add("qux", Value(true)); 21 | b.close(); 22 | 23 | // a Slice is a lightweight accessor for a VPack value 24 | Slice s(b.start()); 25 | 26 | // inspect the outermost value (should be an Object...) 27 | std::cout << "Slice: " << s << std::endl; 28 | std::cout << "Type: " << s.type() << std::endl; 29 | std::cout << "Bytesize: " << s.byteSize() << std::endl; 30 | std::cout << "Members: " << s.length() << std::endl; 31 | 32 | // now iterate over the object members 33 | std::cout << "Iterating Object members:" << std::endl; 34 | for (auto const& it : ObjectIterator(s, /*useSequentialIteration*/ true)) { 35 | std::cout << "key: " << it.key.stringView() << ", value: " << it.value 36 | << std::endl; 37 | } 38 | 39 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 40 | } 41 | -------------------------------------------------------------------------------- /examples/exampleParser.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "velocypack/vpack.h" 4 | #include "velocypack/velocypack-exception-macros.h" 5 | 6 | using namespace arangodb::velocypack; 7 | 8 | int main(int, char*[]) { 9 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 10 | 11 | // this is the JSON string we are going to parse 12 | std::string const json = "{\"a\":12}"; 13 | std::cout << "Parsing JSON string '" << json << "'" << std::endl; 14 | 15 | Parser parser; 16 | try { 17 | ValueLength nr = parser.parse(json); 18 | std::cout << "Number of values: " << nr << std::endl; 19 | } catch (std::bad_alloc const&) { 20 | std::cout << "Out of memory!" << std::endl; 21 | throw; 22 | } catch (Exception const& ex) { 23 | std::cout << "Parse error: " << ex.what() << std::endl; 24 | std::cout << "Position of error: " << parser.errorPos() << std::endl; 25 | throw; 26 | } 27 | 28 | // get a pointer to the start of the data 29 | std::shared_ptr b = parser.steal(); 30 | 31 | // now dump the resulting VPack value 32 | std::cout << "Resulting VPack:" << std::endl; 33 | std::cout << HexDump(b->slice()) << std::endl; 34 | 35 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 36 | } 37 | -------------------------------------------------------------------------------- /examples/exampleSlice.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "velocypack/vpack.h" 3 | #include "velocypack/velocypack-exception-macros.h" 4 | 5 | using namespace arangodb::velocypack; 6 | 7 | int main(int, char*[]) { 8 | VELOCYPACK_GLOBAL_EXCEPTION_TRY 9 | 10 | // create an object with attributes "b", "a", "l" and "name" 11 | // note that the attribute names will be sorted in the target VPack object! 12 | Builder b; 13 | 14 | b(Value(ValueType::Object))("b", Value(12))("a", Value(true))( 15 | "l", Value(ValueType::Array))(Value(1))(Value(2))(Value(3))()( 16 | "name", Value("Gustav"))(); 17 | 18 | // a Slice is a lightweight accessor for a VPack value 19 | Slice s(b.start()); 20 | 21 | // inspect the outermost value (should be an Object...) 22 | std::cout << "Slice: " << s << std::endl; 23 | std::cout << "Type: " << s.type() << std::endl; 24 | std::cout << "Bytesize: " << s.byteSize() << std::endl; 25 | std::cout << "Members: " << s.length() << std::endl; 26 | 27 | if (s.isObject()) { 28 | Slice ss = s.get("l"); // Now ss points to the subvalue under "l" 29 | std::cout << "Length of .l: " << ss.length() << std::endl; 30 | std::cout << "Second entry of .l:" << ss.at(1).getInt() << std::endl; 31 | } 32 | 33 | Slice sss = s.get("name"); 34 | if (sss.isString()) { 35 | ValueLength len; 36 | char const* st = sss.getString(len); 37 | std::cout << "Name in .name: " << std::string(st, checkOverflow(len)) 38 | << std::endl; 39 | } 40 | 41 | VELOCYPACK_GLOBAL_EXCEPTION_CATCH 42 | } 43 | -------------------------------------------------------------------------------- /external/sse2neon/emmintrin.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /external/sse2neon/smmintrin.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /include/velocypack/Basics.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | namespace arangodb::velocypack { 30 | 31 | // classes from Basics.h are for internal use only and are not exposed here 32 | 33 | // prevent copying 34 | class NonCopyable { 35 | public: 36 | NonCopyable() = default; 37 | ~NonCopyable() = default; 38 | 39 | private: 40 | NonCopyable(NonCopyable const&) = delete; 41 | NonCopyable& operator=(NonCopyable const&) = delete; 42 | }; 43 | 44 | #ifdef _WIN32 45 | // turn off warnings about unimplemented exception specifications 46 | #pragma warning(push) 47 | #pragma warning(disable : 4290) 48 | #endif 49 | 50 | // prevent heap allocation 51 | struct NonHeapAllocatable { 52 | void* operator new(std::size_t) = delete; 53 | void operator delete(void*) noexcept = delete; 54 | void* operator new[](std::size_t) = delete; 55 | void operator delete[](void*) noexcept = delete; 56 | }; 57 | 58 | #ifdef _WIN32 59 | #pragma warning(pop) 60 | #endif 61 | 62 | } // namespace arangodb::velocypack 63 | -------------------------------------------------------------------------------- /include/velocypack/Serializable.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Lars Maier 22 | //////////////////////////////////////////////////////////////////////////////// 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include "velocypack/velocypack-common.h" 29 | 30 | namespace arangodb::velocypack { 31 | class Builder; 32 | 33 | class Serializable { 34 | public: 35 | virtual void toVelocyPack(Builder&) const = 0; 36 | 37 | // convenience method 38 | std::shared_ptr toVelocyPack() const; 39 | 40 | virtual ~Serializable() = default; 41 | }; 42 | 43 | struct Serialize { 44 | Serialize(Serializable const& sable) : _sable(sable) {} 45 | Serializable const& _sable; 46 | }; 47 | 48 | } // namespace arangodb::velocypack 49 | 50 | using VPackSerializable = arangodb::velocypack::Serializable; 51 | using VPackSerialize = arangodb::velocypack::Serialize; 52 | -------------------------------------------------------------------------------- /include/velocypack/StringRef.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | namespace arangodb::velocypack { 30 | using StringRef = std::string_view; 31 | } // namespace arangodb::velocypack 32 | 33 | using VPackStringRef = arangodb::velocypack::StringRef; 34 | -------------------------------------------------------------------------------- /include/velocypack/Utf8Helper.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | #include "velocypack/velocypack-common.h" 28 | 29 | namespace arangodb::velocypack { 30 | 31 | struct Utf8Helper { 32 | static bool isValidUtf8(uint8_t const* p, ValueLength len); 33 | }; 34 | 35 | } // namespace arangodb::velocypack 36 | 37 | using VPackUtf8Helper = arangodb::velocypack::Utf8Helper; 38 | -------------------------------------------------------------------------------- /include/velocypack/ValueType.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | #include 28 | #include 29 | 30 | #include "velocypack-common.h" 31 | 32 | namespace arangodb::velocypack { 33 | 34 | enum class ValueType : uint8_t { 35 | None, // not yet initialized 36 | Illegal, // illegal value 37 | Null, // JSON null 38 | Bool, 39 | Array, 40 | Object, 41 | Double, 42 | UTCDate, 43 | External, 44 | MinKey, 45 | MaxKey, 46 | Int, 47 | UInt, 48 | SmallInt, 49 | String, 50 | Binary, 51 | BCD, 52 | Custom, 53 | Tagged 54 | }; 55 | 56 | char const* valueTypeName(ValueType); 57 | 58 | ValueType valueTypeGroup(ValueType type); 59 | 60 | } // namespace arangodb::velocypack 61 | 62 | std::ostream& operator<<(std::ostream&, arangodb::velocypack::ValueType); 63 | 64 | using VPackValueType = arangodb::velocypack::ValueType; 65 | -------------------------------------------------------------------------------- /include/velocypack/Version.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | 27 | #include "velocypack/velocypack-common.h" 28 | #include "velocypack/velocypack-version-number.h" 29 | 30 | namespace arangodb::velocypack { 31 | 32 | struct Version { 33 | Version() = delete; 34 | Version(Version const&) = delete; 35 | Version& operator=(Version const&) = delete; 36 | 37 | Version(int majorValue, int minorValue, int patchValue) 38 | : majorValue(majorValue), 39 | minorValue(minorValue), 40 | patchValue(patchValue) {} 41 | 42 | std::string toString() const; 43 | 44 | int compare(Version const& other) const; 45 | 46 | static int compare(Version const& lhs, Version const& rhs); 47 | 48 | int const majorValue; 49 | int const minorValue; 50 | int const patchValue; 51 | 52 | static Version const BuildVersion; 53 | }; 54 | 55 | } // namespace arangodb::velocypack 56 | 57 | using VPackVersion = arangodb::velocypack::Version; 58 | -------------------------------------------------------------------------------- /include/velocypack/velocypack-aliases.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include "velocypack/velocypack-common.h" 26 | 27 | // this file is deprecated and shouldn't be used anymore. 28 | // aliases are now present in the individual header files. 29 | -------------------------------------------------------------------------------- /include/velocypack/velocypack-exception-macros.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #define VELOCYPACK_GLOBAL_EXCEPTION_TRY try { 26 | #define VELOCYPACK_GLOBAL_EXCEPTION_CATCH \ 27 | } \ 28 | catch (std::exception const& ex) { \ 29 | std::cerr << "caught exception: " << ex.what() << std::endl; \ 30 | return EXIT_FAILURE; \ 31 | } \ 32 | catch (...) { \ 33 | std::cerr << "caught unknown exception" << std::endl; \ 34 | return EXIT_FAILURE; \ 35 | } 36 | -------------------------------------------------------------------------------- /include/velocypack/velocypack-memory.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Lauri Keel 22 | //////////////////////////////////////////////////////////////////////////////// 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | // memory management definitions 30 | 31 | extern "C" { 32 | 33 | extern void* velocypack_malloc(std::size_t size); 34 | extern void* velocypack_realloc(void* ptr, std::size_t size); 35 | extern void velocypack_free(void* ptr); 36 | 37 | #ifndef velocypack_malloc 38 | 39 | #define velocypack_malloc(size) malloc(size) 40 | #define velocypack_realloc(ptr, size) realloc(ptr, size) 41 | #define velocypack_free(ptr) free(ptr) 42 | 43 | #endif 44 | } 45 | -------------------------------------------------------------------------------- /include/velocypack/velocypack-version-number.h: -------------------------------------------------------------------------------- 1 | // this is an auto-generated file. do not edit! 2 | 3 | #pragma once 4 | #define VELOCYPACK_VERSION "0.2.1" 5 | 6 | #define VELOCYPACK_VERSION_MAJOR 0 7 | #define VELOCYPACK_VERSION_MINOR 2 8 | #define VELOCYPACK_VERSION_PATCH 1 9 | -------------------------------------------------------------------------------- /include/velocypack/vpack.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | #include "velocypack/velocypack-common.h" 28 | #include "velocypack/AttributeTranslator.h" 29 | #include "velocypack/Basics.h" 30 | #include "velocypack/Buffer.h" 31 | #include "velocypack/Builder.h" 32 | #include "velocypack/Collection.h" 33 | #include "velocypack/Compare.h" 34 | #include "velocypack/Dumper.h" 35 | #include "velocypack/Exception.h" 36 | #include "velocypack/HashedStringRef.h" 37 | #include "velocypack/HexDump.h" 38 | #include "velocypack/Iterator.h" 39 | #include "velocypack/Options.h" 40 | #include "velocypack/Parser.h" 41 | #include "velocypack/Serializable.h" 42 | #include "velocypack/SharedSlice.h" 43 | #include "velocypack/Sink.h" 44 | #include "velocypack/Slice.h" 45 | #include "velocypack/SliceContainer.h" 46 | #include "velocypack/SmallVector.h" 47 | #include "velocypack/StringRef.h" 48 | #include "velocypack/Utf8Helper.h" 49 | #include "velocypack/Validator.h" 50 | #include "velocypack/Value.h" 51 | #include "velocypack/ValueType.h" 52 | #include "velocypack/Version.h" 53 | -------------------------------------------------------------------------------- /scripts/collect-coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -u 3 | ferr(){ 4 | echo "$@" 5 | exit 1 6 | } 7 | 8 | #prepare 9 | project_dir="$(readlink -f .)" 10 | build_dir="$project_dir/build" 11 | 12 | echo "project directory $project_dir" 13 | echo "build directory $build_dir" 14 | cd ${project_dir} || ferr "can not enter build dir" 15 | 16 | CXX=${CXX:='gcc'} 17 | version=${CXX#*-} 18 | if [[ -n $version ]]; then 19 | version="-$version" 20 | fi 21 | GCOV=gcov${version} 22 | echo "gcov: $GCOV" 23 | 24 | LCOV=( 25 | 'lcov' 26 | '--directory' "$project_dir" 27 | '--gcov-tool' "$(type -p ${GCOV})" 28 | ) 29 | 30 | # clear counters 31 | "${LCOV[@]}" --capture --initial --output-file base_coverage.info || ferr "failed lcov" 32 | "${LCOV[@]}" --zerocounters || ferr "failed lcov" 33 | 34 | # run tests 35 | (cd "${build_dir}/tests" && ctest -V) || ferr "failed to run tests" 36 | 37 | # collect coverage info 38 | "${LCOV[@]}" --capture --output-file test_coverage.info || ferr "failed lcov" 39 | "${LCOV[@]}" --add-tracefile base_coverage.info --add-tracefile test_coverage.info --output-file coverage.info || ferr "failed lcov" 40 | "${LCOV[@]}" --remove coverage.info \ 41 | '/usr/*' \ 42 | '*CMakeFiles/*' \ 43 | "$project_dir"'/examples/*' \ 44 | "$project_dir"'/tools/*' \ 45 | "$project_dir"'/tests/*' \ 46 | "$project_dir"'/include/velocypack/velocypack-wyhash*' \ 47 | "$project_dir"'/src/xxhash*' \ 48 | "$project_dir"'/src/fasthash*' \ 49 | "$project_dir"'/src/powers.h' \ 50 | --output-file coverage.info || ferr "failed lcov" 51 | 52 | "${LCOV[@]}" --list coverage.info || ferr "failed lcov" 53 | 54 | sed -i "s#${project_dir}/##" coverage.info 55 | 56 | echo $PWD 57 | ls -lah 58 | 59 | echo "Done with lcov" 60 | -------------------------------------------------------------------------------- /scripts/execute-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -u 3 | ferr(){ 4 | echo "$@" 5 | exit 1 6 | } 7 | 8 | SANITIZER=${SANITIZER:-false} 9 | 10 | (cd build/tests && ctest --output-on-failure) || ferr "failed to run tests" 11 | 12 | if [[ "$SANITIZER" == "false" ]]; then 13 | echo "running fuzz tests..." 14 | 15 | build/tools/fuzzer --vpack --iterations 10000 --threads 4 || ferr "failed to run sunshine fuzzer for vpack" 16 | build/tools/fuzzer --vpack --iterations 10000 --threads 4 --evil || ferr "failed to run darkness fuzzer for vpack" 17 | build/tools/fuzzer --json --iterations 1000 --threads 4 || ferr "failed to run sunshine fuzzer for json" 18 | fi 19 | -------------------------------------------------------------------------------- /src/Iterator.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | 27 | #include "velocypack/velocypack-common.h" 28 | #include "velocypack/Iterator.h" 29 | 30 | using namespace arangodb::velocypack; 31 | 32 | std::ostream& operator<<(std::ostream& stream, ArrayIterator const* it) { 33 | stream << "[ArrayIterator " << it->index() << " / " << it->size() << "]"; 34 | return stream; 35 | } 36 | 37 | std::ostream& operator<<(std::ostream& stream, ArrayIterator const& it) { 38 | return operator<<(stream, &it); 39 | } 40 | 41 | std::ostream& operator<<(std::ostream& stream, ObjectIterator const* it) { 42 | stream << "[ObjectIterator " << it->index() << " / " << it->size() << "]"; 43 | return stream; 44 | } 45 | 46 | std::ostream& operator<<(std::ostream& stream, ObjectIterator const& it) { 47 | return operator<<(stream, &it); 48 | } 49 | -------------------------------------------------------------------------------- /src/Options.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include "velocypack/velocypack-common.h" 26 | #include "velocypack/Exception.h" 27 | #include "velocypack/Options.h" 28 | 29 | using namespace arangodb::velocypack; 30 | 31 | void CustomTypeHandler::dump(Slice const&, Dumper*, Slice const&) { 32 | throw Exception(Exception::NotImplemented); 33 | } 34 | 35 | std::string CustomTypeHandler::toString(Slice const&, Options const*, 36 | Slice const&) { 37 | throw Exception(Exception::NotImplemented); 38 | } 39 | 40 | // default options instance 41 | Options Options::Defaults; 42 | -------------------------------------------------------------------------------- /src/Serializable.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Lars Maier 22 | //////////////////////////////////////////////////////////////////////////////// 23 | 24 | #include "velocypack/velocypack-common.h" 25 | #include "velocypack/Serializable.h" 26 | #include "velocypack/Builder.h" 27 | 28 | using namespace arangodb::velocypack; 29 | 30 | // convenience method 31 | std::shared_ptr Serializable::toVelocyPack() const { 32 | auto builder = std::make_shared(); 33 | this->toVelocyPack(*builder); 34 | return builder; 35 | } 36 | -------------------------------------------------------------------------------- /src/Slice.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | #include 27 | 28 | using namespace arangodb::velocypack; 29 | 30 | uint8_t const Slice::noneSliceData[] = {0x00}; 31 | uint8_t const Slice::illegalSliceData[] = {0x17}; 32 | uint8_t const Slice::nullSliceData[] = {0x18}; 33 | uint8_t const Slice::falseSliceData[] = {0x19}; 34 | uint8_t const Slice::trueSliceData[] = {0x1a}; 35 | uint8_t const Slice::zeroSliceData[] = {0x30}; 36 | uint8_t const Slice::emptyStringSliceData[] = {0x40}; 37 | uint8_t const Slice::emptyArraySliceData[] = {0x01}; 38 | uint8_t const Slice::emptyObjectSliceData[] = {0x0a}; 39 | uint8_t const Slice::minKeySliceData[] = {0x1e}; 40 | uint8_t const Slice::maxKeySliceData[] = {0x1f}; 41 | 42 | namespace arangodb::velocypack { 43 | INSTANTIATE_TYPE(Slice, Slice) 44 | 45 | std::ostream& operator<<(std::ostream& stream, Slice const* slice) { 46 | stream << "[Slice " << valueTypeName(slice->type()) << " (" 47 | << slice->hexType() << "), byteSize: " << slice->byteSize() << "]"; 48 | return stream; 49 | } 50 | 51 | std::ostream& operator<<(std::ostream& stream, Slice const& slice) { 52 | return operator<<(stream, &slice); 53 | } 54 | } // namespace arangodb::velocypack 55 | 56 | static_assert(sizeof(arangodb::velocypack::Slice) == sizeof(void*), 57 | "Slice has an unexpected size"); 58 | -------------------------------------------------------------------------------- /src/String.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Lars Maier 22 | //////////////////////////////////////////////////////////////////////////////// 23 | 24 | #include 25 | #include 26 | 27 | namespace arangodb::velocypack { 28 | INSTANTIATE_TYPE(String, Slice); 29 | } // namespace arangodb::velocypack 30 | -------------------------------------------------------------------------------- /src/Value.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include "velocypack/Exception.h" 26 | #include "velocypack/Value.h" 27 | 28 | using namespace arangodb::velocypack; 29 | 30 | // creates a Value with the specified type Array or Object 31 | Value::Value(ValueType t, bool allowUnindexed) 32 | : _valueType(t), _cType(CType::None), _value(allowUnindexed) { 33 | // we use the boolean part to store the allowUnindexed value 34 | if (allowUnindexed && 35 | (_valueType != ValueType::Array && _valueType != ValueType::Object)) { 36 | throw Exception(Exception::InvalidValueType, "Expecting compound type"); 37 | } 38 | } 39 | 40 | bool Value::unindexed() const { 41 | if (_valueType != ValueType::Array && _valueType != ValueType::Object) { 42 | throw Exception(Exception::InvalidValueType, "Expecting compound type"); 43 | } 44 | return _value.b; 45 | } 46 | -------------------------------------------------------------------------------- /src/Version.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | 27 | #include "velocypack/velocypack-common.h" 28 | #include "velocypack/Version.h" 29 | 30 | using namespace arangodb::velocypack; 31 | 32 | Version const Version::BuildVersion(VELOCYPACK_VERSION_MAJOR, 33 | VELOCYPACK_VERSION_MINOR, 34 | VELOCYPACK_VERSION_PATCH); 35 | 36 | std::string Version::toString() const { 37 | std::stringstream version; 38 | version << majorValue << "." << minorValue << "." << patchValue; 39 | return version.str(); 40 | } 41 | 42 | int Version::compare(Version const& other) const { 43 | if (majorValue != other.majorValue) { 44 | return majorValue < other.majorValue ? -1 : 1; 45 | } 46 | if (minorValue != other.minorValue) { 47 | return minorValue < other.minorValue ? -1 : 1; 48 | } 49 | if (patchValue != other.patchValue) { 50 | return patchValue < other.patchValue ? -1 : 1; 51 | } 52 | return 0; 53 | } 54 | 55 | int Version::compare(Version const& lhs, Version const& rhs) { 56 | return lhs.compare(rhs); 57 | } 58 | -------------------------------------------------------------------------------- /src/asm-functions.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | namespace arangodb::velocypack { 30 | 31 | extern std::size_t (*JSONStringCopy)(uint8_t*, uint8_t const*, std::size_t); 32 | 33 | // Now a version which also stops at high bit set bytes: 34 | extern std::size_t (*JSONStringCopyCheckUtf8)(uint8_t*, uint8_t const*, 35 | std::size_t); 36 | 37 | // White space skipping: 38 | extern std::size_t (*JSONSkipWhiteSpace)(uint8_t const*, std::size_t); 39 | 40 | // check string for invalid utf-8 sequences 41 | extern bool (*ValidateUtf8String)(uint8_t const*, std::size_t); 42 | 43 | void enableNativeStringFunctions() noexcept; 44 | void enableBuiltinStringFunctions() noexcept; 45 | 46 | } // namespace arangodb::velocypack 47 | -------------------------------------------------------------------------------- /src/asm-utf8check.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright Daniel Lemire 5 | /// 6 | /// Licensed under the Apache License, Version 2.0 (the "License"); 7 | /// you may not use this file except in compliance with the License. 8 | /// You may obtain a copy of the License at 9 | /// 10 | /// http://www.apache.org/licenses/LICENSE-2.0 11 | /// 12 | /// Unless required by applicable law or agreed to in writing, software 13 | /// distributed under the License is distributed on an "AS IS" BASIS, 14 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | /// See the License for the specific language governing permissions and 16 | /// limitations under the License. 17 | /// 18 | /// Copyright holder is Daniel Lemire 19 | /// 20 | /// @author Daniel Lemire 21 | /// @author Simon Grätzer 22 | //////////////////////////////////////////////////////////////////////////////// 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | namespace arangodb::velocypack { 30 | 31 | #if VELOCYPACK_ASM_OPTIMIZATIONS == 1 32 | bool validate_utf8_fast_sse42(uint8_t const* src, std::size_t len); 33 | #ifdef __AVX2__ 34 | bool validate_utf8_fast_avx_asciipath(char const* src, std::size_t len); 35 | bool validate_utf8_fast_avx(uint8_t const* src, std::size_t len); 36 | #endif // __AVX2__ 37 | #endif // VELOCYPACK_ASM_OPTIMIZATIONS 38 | 39 | } // namespace arangodb::velocypack 40 | -------------------------------------------------------------------------------- /src/string-functions.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | 27 | namespace arangodb::velocypack { 28 | 29 | void* memrchr(void const* block, int c, std::size_t size) { 30 | #ifdef __linux__ 31 | return const_cast(::memrchr(block, c, size)); 32 | #else 33 | /// naive memrchr overlay for Windows or other platforms, which don't 34 | /// implement it 35 | if (size) { 36 | unsigned char const* p = static_cast(block); 37 | 38 | for (p += size - 1; size; p--, size--) { 39 | if (*p == c) { 40 | return const_cast(static_cast(p)); 41 | } 42 | } 43 | } 44 | return nullptr; 45 | #endif 46 | } 47 | 48 | } // namespace arangodb::velocypack 49 | -------------------------------------------------------------------------------- /src/velocypack-common.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | /// DISCLAIMER 3 | /// 4 | /// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany 5 | /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany 6 | /// 7 | /// Licensed under the Business Source License 1.1 (the "License"); 8 | /// you may not use this file except in compliance with the License. 9 | /// You may obtain a copy of the License at 10 | /// 11 | /// https://github.com/arangodb/arangodb/blob/devel/LICENSE 12 | /// 13 | /// Unless required by applicable law or agreed to in writing, software 14 | /// distributed under the License is distributed on an "AS IS" BASIS, 15 | /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | /// See the License for the specific language governing permissions and 17 | /// limitations under the License. 18 | /// 19 | /// Copyright holder is ArangoDB GmbH, Cologne, Germany 20 | /// 21 | /// @author Max Neunhoeffer 22 | /// @author Jan Steemann 23 | //////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include 26 | 27 | #include "velocypack/velocypack-common.h" 28 | #include "velocypack/Exception.h" 29 | 30 | using namespace arangodb::velocypack; 31 | 32 | #ifndef VELOCYPACK_64BIT 33 | // check if the length is beyond the size of a SIZE_MAX on this platform 34 | std::size_t arangodb::velocypack::checkOverflow(ValueLength length) { 35 | if (length > static_cast(SIZE_MAX)) { 36 | throw Exception(Exception::NumberOutOfRange); 37 | } 38 | return static_cast(length); 39 | } 40 | #else 41 | // 64 bit platform 42 | static_assert(sizeof(std::size_t) == 8, "unexpected size_t size"); 43 | static_assert(sizeof(std::size_t) == sizeof(uint64_t), 44 | "unexpected size_t size"); 45 | #endif 46 | 47 | int64_t arangodb::velocypack::currentUTCDateValue() { 48 | return static_cast( 49 | std::chrono::duration_cast( 50 | std::chrono::system_clock::now().time_since_epoch()) 51 | .count()); 52 | } 53 | 54 | static_assert(sizeof(arangodb::velocypack::ValueLength) >= sizeof(SIZE_MAX), 55 | "invalid value for SIZE_MAX"); 56 | -------------------------------------------------------------------------------- /src/xxhash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * xxHash - Extremely Fast Hash algorithm 3 | * Copyright (C) 2012-2020 Yann Collet 4 | * 5 | * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are 9 | * met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above 14 | * copyright notice, this list of conditions and the following disclaimer 15 | * in the documentation and/or other materials provided with the 16 | * distribution. 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 | * You can contact the author at: 31 | * - xxHash homepage: https://www.xxhash.com 32 | * - xxHash source repository: https://github.com/Cyan4973/xxHash 33 | */ 34 | 35 | /* 36 | * xxhash.c instantiates functions defined in xxhash.h 37 | */ 38 | 39 | #define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ 40 | #define XXH_IMPLEMENTATION /* access definitions */ 41 | 42 | #include "xxhash.h" 43 | -------------------------------------------------------------------------------- /tests/googletest/.clang-format: -------------------------------------------------------------------------------- 1 | # Run manually to reformat a file: 2 | # clang-format -i --style=file 3 | Language: Cpp 4 | BasedOnStyle: Google 5 | -------------------------------------------------------------------------------- /tests/googletest/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore CI build directory 2 | build/ 3 | xcuserdata 4 | cmake-build-debug/ 5 | .idea/ 6 | bazel-bin 7 | bazel-genfiles 8 | bazel-googletest 9 | bazel-out 10 | bazel-testlogs 11 | # python 12 | *.pyc 13 | 14 | # Visual Studio files 15 | .vs 16 | *.sdf 17 | *.opensdf 18 | *.VC.opendb 19 | *.suo 20 | *.user 21 | _ReSharper.Caches/ 22 | Win32-Debug/ 23 | Win32-Release/ 24 | x64-Debug/ 25 | x64-Release/ 26 | 27 | # Ignore autoconf / automake files 28 | Makefile.in 29 | aclocal.m4 30 | configure 31 | build-aux/ 32 | autom4te.cache/ 33 | googletest/m4/libtool.m4 34 | googletest/m4/ltoptions.m4 35 | googletest/m4/ltsugar.m4 36 | googletest/m4/ltversion.m4 37 | googletest/m4/lt~obsolete.m4 38 | 39 | # Ignore generated directories. 40 | googlemock/fused-src/ 41 | googletest/fused-src/ 42 | 43 | # macOS files 44 | .DS_Store 45 | googletest/.DS_Store 46 | googletest/xcode/.DS_Store 47 | 48 | # Ignore cmake generated directories and files. 49 | CMakeFiles 50 | CTestTestfile.cmake 51 | Makefile 52 | cmake_install.cmake 53 | googlemock/CMakeFiles 54 | googlemock/CTestTestfile.cmake 55 | googlemock/Makefile 56 | googlemock/cmake_install.cmake 57 | googlemock/gtest 58 | -------------------------------------------------------------------------------- /tests/googletest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.21) 2 | 3 | if (CMAKE_VERSION VERSION_LESS "3.1") 4 | add_definitions(-std=c++11) 5 | else() 6 | set(CMAKE_CXX_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 8 | set(CMAKE_CXX_EXTENSIONS OFF) 9 | endif() 10 | 11 | if (POLICY CMP0048) 12 | cmake_policy(SET CMP0048 NEW) 13 | endif (POLICY CMP0048) 14 | 15 | project(googletest-distribution) 16 | set(GOOGLETEST_VERSION 1.9.0) 17 | 18 | enable_testing() 19 | 20 | include(CMakeDependentOption) 21 | include(GNUInstallDirs) 22 | 23 | #Note that googlemock target already builds googletest 24 | option(BUILD_GMOCK "Builds the googlemock subproject" ON) 25 | option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON) 26 | 27 | if(BUILD_GMOCK) 28 | add_subdirectory( googlemock ) 29 | else() 30 | add_subdirectory( googletest ) 31 | endif() 32 | -------------------------------------------------------------------------------- /tests/googletest/LICENSE: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /tests/googletest/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | ACLOCAL_AMFLAGS = -I m4 3 | 4 | AUTOMAKE_OPTIONS = foreign 5 | 6 | # Build . before src so that our all-local and clean-local hooks kicks in at 7 | # the right time. 8 | SUBDIRS = googletest googlemock 9 | 10 | EXTRA_DIST = \ 11 | BUILD.bazel \ 12 | CMakeLists.txt \ 13 | README.md \ 14 | WORKSPACE 15 | -------------------------------------------------------------------------------- /tests/googletest/WORKSPACE: -------------------------------------------------------------------------------- 1 | workspace(name = "com_google_googletest") 2 | 3 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 4 | 5 | # Abseil 6 | http_archive( 7 | name = "com_google_absl", 8 | urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"], 9 | strip_prefix = "abseil-cpp-master", 10 | ) 11 | -------------------------------------------------------------------------------- /tests/googletest/ci/build-linux-autotools.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | set -e 33 | 34 | . ci/get-nprocessors.sh 35 | 36 | # Create the configuration script 37 | autoreconf -i 38 | 39 | # Run in a subdirectory to keep the sources clean 40 | mkdir build || true 41 | cd build 42 | ../configure 43 | 44 | make -j ${NPROCESSORS:-2} 45 | -------------------------------------------------------------------------------- /tests/googletest/ci/build-linux-bazel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | set -e 33 | 34 | bazel build --curses=no //...:all 35 | bazel test --curses=no //...:all 36 | bazel test --curses=no //...:all --define absl=1 37 | -------------------------------------------------------------------------------- /tests/googletest/ci/build-platformio.sh: -------------------------------------------------------------------------------- 1 | # run PlatformIO builds 2 | platformio run 3 | -------------------------------------------------------------------------------- /tests/googletest/ci/env-linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # 33 | # This file should be sourced, and not executed as a standalone script. 34 | # 35 | 36 | # TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. 37 | 38 | if [ "${TRAVIS_OS_NAME}" = "linux" ]; then 39 | if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi 40 | if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi 41 | fi 42 | -------------------------------------------------------------------------------- /tests/googletest/ci/env-osx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # 33 | # This file should be sourced, and not executed as a standalone script. 34 | # 35 | 36 | # TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. 37 | # 38 | 39 | if [ "${TRAVIS_OS_NAME}" = "osx" ]; then 40 | if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi 41 | fi 42 | -------------------------------------------------------------------------------- /tests/googletest/ci/install-osx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | set -eu 33 | 34 | if [ "${TRAVIS_OS_NAME}" != "osx" ]; then 35 | echo "Not a macOS build; skipping installation" 36 | exit 0 37 | fi 38 | 39 | brew install ccache 40 | -------------------------------------------------------------------------------- /tests/googletest/ci/install-platformio.sh: -------------------------------------------------------------------------------- 1 | # install PlatformIO 2 | sudo pip install -U platformio 3 | 4 | # update PlatformIO 5 | platformio update 6 | -------------------------------------------------------------------------------- /tests/googletest/ci/log-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | set -e 33 | 34 | # ccache on OS X needs installation first 35 | # reset ccache statistics 36 | ccache --zero-stats 37 | 38 | echo PATH=${PATH} 39 | 40 | echo "Compiler configuration:" 41 | echo CXX=${CXX} 42 | echo CC=${CC} 43 | echo CXXFLAGS=${CXXFLAGS} 44 | 45 | echo "C++ compiler version:" 46 | ${CXX} --version || echo "${CXX} does not seem to support the --version flag" 47 | ${CXX} -v || echo "${CXX} does not seem to support the -v flag" 48 | 49 | echo "C compiler version:" 50 | ${CC} --version || echo "${CXX} does not seem to support the --version flag" 51 | ${CC} -v || echo "${CXX} does not seem to support the -v flag" 52 | -------------------------------------------------------------------------------- /tests/googletest/ci/travis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -evx 3 | 4 | . ci/get-nprocessors.sh 5 | 6 | # if possible, ask for the precise number of processors, 7 | # otherwise take 2 processors as reasonable default; see 8 | # https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization 9 | if [ -x /usr/bin/getconf ]; then 10 | NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) 11 | else 12 | NPROCESSORS=2 13 | fi 14 | # as of 2017-09-04 Travis CI reports 32 processors, but GCC build 15 | # crashes if parallelized too much (maybe memory consumption problem), 16 | # so limit to 4 processors for the time being. 17 | if [ $NPROCESSORS -gt 4 ] ; then 18 | echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." 19 | NPROCESSORS=4 20 | fi 21 | # Tell make to use the processors. No preceding '-' required. 22 | MAKEFLAGS="j${NPROCESSORS}" 23 | export MAKEFLAGS 24 | 25 | env | sort 26 | 27 | # Set default values to OFF for these variables if not specified. 28 | : "${NO_EXCEPTION:=OFF}" 29 | : "${NO_RTTI:=OFF}" 30 | : "${COMPILER_IS_GNUCXX:=OFF}" 31 | 32 | mkdir build || true 33 | cd build 34 | cmake -Dgtest_build_samples=ON \ 35 | -Dgtest_build_tests=ON \ 36 | -Dgmock_build_tests=ON \ 37 | -Dcxx_no_exception=$NO_EXCEPTION \ 38 | -Dcxx_no_rtti=$NO_RTTI \ 39 | -DCMAKE_COMPILER_IS_GNUCXX=$COMPILER_IS_GNUCXX \ 40 | -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ 41 | -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 42 | .. 43 | make 44 | CTEST_OUTPUT_ON_FAILURE=1 make test 45 | -------------------------------------------------------------------------------- /tests/googletest/configure.ac: -------------------------------------------------------------------------------- 1 | AC_INIT([Google C++ Mocking and Testing Frameworks], 2 | [1.9.0], 3 | [googlemock@googlegroups.com], 4 | [googletest]) 5 | 6 | # Provide various options to initialize the Autoconf and configure processes. 7 | AC_PREREQ([2.59]) 8 | AC_CONFIG_SRCDIR([./README.md]) 9 | AC_CONFIG_AUX_DIR([build-aux]) 10 | AC_CONFIG_FILES([Makefile]) 11 | AC_CONFIG_SUBDIRS([googletest googlemock]) 12 | 13 | AM_INIT_AUTOMAKE 14 | 15 | # Output the generated files. No further autoconf macros may be used. 16 | AC_OUTPUT 17 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Mocking Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Benoit Sigoure 7 | Bogdan Piloca 8 | Chandler Carruth 9 | Dave MacLachlan 10 | David Anderson 11 | Dean Sturtevant 12 | Gene Volovich 13 | Hal Burch 14 | Jeffrey Yasskin 15 | Jim Keller 16 | Joe Walnes 17 | Jon Wray 18 | Keir Mierle 19 | Keith Ray 20 | Kostya Serebryany 21 | Lev Makhlis 22 | Manuel Klimek 23 | Mario Tanev 24 | Mark Paskin 25 | Markus Heule 26 | Matthew Simmons 27 | Mike Bland 28 | Neal Norwitz 29 | Nermin Ozkiranartli 30 | Owen Carlsen 31 | Paneendra Ba 32 | Paul Menage 33 | Piotr Kaminski 34 | Russ Rufer 35 | Sverre Sundsdal 36 | Takeshi Yoshino 37 | Vadim Berman 38 | Vlad Losev 39 | Wolfgang Klier 40 | Zhanyong Wan 41 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/LICENSE: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/build-aux/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arangodb/velocypack/8f0fc652e7641046a9f12b7d8a9917dcc507a5c2/tests/googletest/googlemock/build-aux/.keep -------------------------------------------------------------------------------- /tests/googletest/googlemock/cmake/gmock.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gmock 6 | Description: GoogleMock (without main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Requires: gtest 10 | Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ 11 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 12 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/cmake/gmock_main.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gmock_main 6 | Description: GoogleMock (with main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Requires: gmock 10 | Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@ 11 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 12 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/docs/Documentation.md: -------------------------------------------------------------------------------- 1 | This page lists all documentation markdown files for Google Mock **(the 2 | current git version)** 3 | -- **if you use a former version of Google Mock, please read the 4 | documentation for that specific version instead (e.g. by checking out 5 | the respective git branch/tag).** 6 | 7 | * [ForDummies](ForDummies.md) -- start here if you are new to Google Mock. 8 | * [CheatSheet](CheatSheet.md) -- a quick reference. 9 | * [CookBook](CookBook.md) -- recipes for doing various tasks using Google Mock. 10 | * [FrequentlyAskedQuestions](FrequentlyAskedQuestions.md) -- check here before asking a question on the mailing list. 11 | 12 | To contribute code to Google Mock, read: 13 | 14 | * [CONTRIBUTING](../../CONTRIBUTING.md) -- read this _before_ writing your first patch. 15 | * [Pump Manual](../../googletest/docs/PumpManual.md) -- how we generate some of Google Mock's source files. 16 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/docs/KnownIssues.md: -------------------------------------------------------------------------------- 1 | As any non-trivial software system, Google Mock has some known limitations and problems. We are working on improving it, and welcome your help! The follow is a list of issues we know about. 2 | 3 | 4 | 5 | ## README contains outdated information on Google Mock's compatibility with other testing frameworks ## 6 | 7 | The `README` file in release 1.1.0 still says that Google Mock only works with Google Test. Actually, you can configure Google Mock to work with any testing framework you choose. 8 | 9 | ## Tests failing on machines using Power PC CPUs (e.g. some Macs) ## 10 | 11 | `gmock_output_test` and `gmock-printers_test` are known to fail with Power PC CPUs. This is due to portability issues with these tests, and is not an indication of problems in Google Mock itself. You can safely ignore them. 12 | 13 | ## Failed to resolve libgtest.so.0 in tests when built against installed Google Test ## 14 | 15 | This only applies if you manually built and installed Google Test, and then built a Google Mock against it (either explicitly, or because gtest-config was in your path post-install). In this situation, Libtool has a known issue with certain systems' ldconfig setup: 16 | 17 | http://article.gmane.org/gmane.comp.sysutils.automake.general/9025 18 | 19 | This requires a manual run of "sudo ldconfig" after the "sudo make install" for Google Test before any binaries which link against it can be executed. This isn't a bug in our install, but we should at least have documented it or hacked a work-around into our install. We should have one of these solutions in our next release. -------------------------------------------------------------------------------- /tests/googletest/googlemock/include/gmock/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gmock-port.h` 6 | 7 | The following macros can be defined: 8 | 9 | ### Flag related macros: 10 | 11 | * `GMOCK_DECLARE_bool_(name)` 12 | * `GMOCK_DECLARE_int32_(name)` 13 | * `GMOCK_DECLARE_string_(name)` 14 | * `GMOCK_DEFINE_bool_(name, default_val, doc)` 15 | * `GMOCK_DEFINE_int32_(name, default_val, doc)` 16 | * `GMOCK_DEFINE_string_(name, default_val, doc)` 17 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h: -------------------------------------------------------------------------------- 1 | // This file was GENERATED by command: 2 | // pump.py gmock-generated-actions.h.pump 3 | // DO NOT EDIT BY HAND!!! 4 | 5 | // GOOGLETEST_CM0002 DO NOT DELETE 6 | 7 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 8 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 9 | 10 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 11 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump: -------------------------------------------------------------------------------- 1 | $$ -*- mode: c++; -*- 2 | $$ This is a Pump source file. Please use Pump to convert 3 | $$ it to callback-actions.h. 4 | $$ 5 | $var max_callback_arity = 5 6 | $$}} This meta comment fixes auto-indentation in editors. 7 | 8 | // GOOGLETEST_CM0002 DO NOT DELETE 9 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 10 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 11 | 12 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 13 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, 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 | // Injection point for custom user configurations. See README for details 31 | // 32 | // GOOGLETEST_CM0002 DO NOT DELETE 33 | 34 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 35 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 36 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 37 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/include/gmock/internal/custom/gmock-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, 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 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | // GOOGLETEST_CM0002 DO NOT DELETE 35 | 36 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 37 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 38 | 39 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 40 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/msvc/2005/gmock.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock", "gmock.vcproj", "{34681F0D-CE45-415D-B5F2-5C662DFE3BD5}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_test", "gmock_test.vcproj", "{F10D22F8-AC7B-4213-8720-608E7D878CD2}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_main", "gmock_main.vcproj", "{E4EF614B-30DF-4954-8C53-580A0BF6B589}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.Build.0 = Debug|Win32 18 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.ActiveCfg = Release|Win32 19 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.Build.0 = Release|Win32 20 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.Build.0 = Debug|Win32 22 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.ActiveCfg = Release|Win32 23 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.Build.0 = Release|Win32 24 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.Build.0 = Debug|Win32 26 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.ActiveCfg = Release|Win32 27 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.Build.0 = Release|Win32 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/msvc/2005/gmock_config.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/msvc/2010/gmock_config.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ../../../googletest 5 | 6 | 7 | <_ProjectFileVersion>10.0.30319.1 8 | 9 | 10 | 11 | $(GTestDir)/include;%(AdditionalIncludeDirectories) 12 | 13 | 14 | 15 | 16 | $(GTestDir) 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/msvc/2015/gmock_config.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ../../../googletest 5 | 6 | 7 | <_ProjectFileVersion>10.0.30319.1 8 | 9 | 10 | 11 | $(GTestDir)/include;%(AdditionalIncludeDirectories) 12 | 13 | 14 | 15 | 16 | $(GTestDir) 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/scripts/generator/README: -------------------------------------------------------------------------------- 1 | 2 | The Google Mock class generator is an application that is part of cppclean. 3 | For more information about cppclean, visit http://code.google.com/p/cppclean/ 4 | 5 | The mock generator requires Python 2.3.5 or later. If you don't have Python 6 | installed on your system, you will also need to install it. You can download 7 | Python from: http://www.python.org/download/releases/ 8 | 9 | To use the Google Mock class generator, you need to call it 10 | on the command line passing the header file and class for which you want 11 | to generate a Google Mock class. 12 | 13 | Make sure to install the scripts somewhere in your path. Then you can 14 | run the program. 15 | 16 | gmock_gen.py header-file.h [ClassName]... 17 | 18 | If no ClassNames are specified, all classes in the file are emitted. 19 | 20 | To change the indentation from the default of 2, set INDENT in 21 | the environment. For example to use an indent of 4 spaces: 22 | 23 | INDENT=4 gmock_gen.py header-file.h ClassName 24 | 25 | This version was made from SVN revision 281 in the cppclean repository. 26 | 27 | Known Limitations 28 | ----------------- 29 | Not all code will be generated properly. For example, when mocking templated 30 | classes, the template information is lost. You will need to add the template 31 | information manually. 32 | 33 | Not all permutations of using multiple pointers/references will be rendered 34 | properly. These will also have to be fixed manually. 35 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/scripts/generator/cpp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arangodb/velocypack/8f0fc652e7641046a9f12b7d8a9917dcc507a5c2/tests/googletest/googlemock/scripts/generator/cpp/__init__.py -------------------------------------------------------------------------------- /tests/googletest/googlemock/scripts/generator/cpp/keywords.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Neal Norwitz 4 | # Portions Copyright 2007 Google Inc. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """C++ keywords and helper utilities for determining keywords.""" 19 | 20 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 21 | 22 | 23 | try: 24 | # Python 3.x 25 | import builtins 26 | except ImportError: 27 | # Python 2.x 28 | import __builtin__ as builtins 29 | 30 | 31 | if not hasattr(builtins, 'set'): 32 | # Nominal support for Python 2.3. 33 | from sets import Set as set 34 | 35 | 36 | TYPES = set('bool char int long short double float void wchar_t unsigned signed'.split()) 37 | TYPE_MODIFIERS = set('auto register const inline extern static virtual volatile mutable'.split()) 38 | ACCESS = set('public protected private friend'.split()) 39 | 40 | CASTS = set('static_cast const_cast dynamic_cast reinterpret_cast'.split()) 41 | 42 | OTHERS = set('true false asm class namespace using explicit this operator sizeof'.split()) 43 | OTHER_TYPES = set('new delete typedef struct union enum typeid typename template'.split()) 44 | 45 | CONTROL = set('case switch default if else return goto'.split()) 46 | EXCEPTION = set('try catch throw'.split()) 47 | LOOP = set('while do for break continue'.split()) 48 | 49 | ALL = TYPES | TYPE_MODIFIERS | ACCESS | CASTS | OTHERS | OTHER_TYPES | CONTROL | EXCEPTION | LOOP 50 | 51 | 52 | def IsKeyword(token): 53 | return token in ALL 54 | 55 | def IsBuiltinType(token): 56 | if token in ('virtual', 'inline'): 57 | # These only apply to methods, they can't be types by themselves. 58 | return False 59 | return token in TYPES or token in TYPE_MODIFIERS 60 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/scripts/generator/cpp/utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Neal Norwitz 4 | # Portions Copyright 2007 Google Inc. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """Generic utilities for C++ parsing.""" 19 | 20 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 21 | 22 | 23 | import sys 24 | 25 | 26 | # Set to True to see the start/end token indices. 27 | DEBUG = True 28 | 29 | 30 | def ReadFile(filename, print_error=True): 31 | """Returns the contents of a file.""" 32 | try: 33 | fp = open(filename) 34 | try: 35 | return fp.read() 36 | finally: 37 | fp.close() 38 | except IOError: 39 | if print_error: 40 | print('Error reading %s: %s' % (filename, sys.exc_info()[1])) 41 | return None 42 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/scripts/generator/gmock_gen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2008 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | """Driver for starting up Google Mock class generator.""" 18 | 19 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 20 | 21 | import os 22 | import sys 23 | 24 | if __name__ == '__main__': 25 | # Add the directory of this script to the path so we can import gmock_class. 26 | sys.path.append(os.path.dirname(__file__)) 27 | 28 | from cpp import gmock_class 29 | # Fix the docstring in case they require the usage. 30 | gmock_class.__doc__ = gmock_class.__doc__.replace('gmock_class.py', __file__) 31 | gmock_class.main() 32 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/src/gmock-all.cc: -------------------------------------------------------------------------------- 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 C++ Mocking Framework (Google Mock) 32 | // 33 | // This file #includes all Google Mock implementation .cc files. The 34 | // purpose is to allow a user to build Google Mock by compiling this 35 | // file alone. 36 | 37 | // This line ensures that gmock.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gmock/gmock.h" 40 | 41 | // The following lines pull in the real gmock *.cc files. 42 | #include "src/gmock-cardinalities.cc" 43 | #include "src/gmock-internal-utils.cc" 44 | #include "src/gmock-matchers.cc" 45 | #include "src/gmock-spec-builders.cc" 46 | #include "src/gmock.cc" 47 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/test/gmock-function-mocker_nc.cc: -------------------------------------------------------------------------------- 1 | #include "gmock/gmock.h" 2 | 3 | #include 4 | #include 5 | 6 | #if defined(TEST_MOCK_METHOD_INVALID_CONST_SPEC) 7 | 8 | struct Base { 9 | MOCK_METHOD(int, F, (), (onst)); 10 | }; 11 | 12 | #else 13 | 14 | // Sanity check - this should compile. 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/test/gmock-function-mocker_nc_test.py: -------------------------------------------------------------------------------- 1 | """Negative compilation tests for Google Mock macro MOCK_METHOD.""" 2 | 3 | import os 4 | import sys 5 | 6 | IS_LINUX = os.name == "posix" and os.uname()[0] == "Linux" 7 | if not IS_LINUX: 8 | sys.stderr.write( 9 | "WARNING: Negative compilation tests are not supported on this platform") 10 | sys.exit(0) 11 | 12 | # Suppresses the 'Import not at the top of the file' lint complaint. 13 | # pylint: disable-msg=C6204 14 | from google3.testing.pybase import fake_target_util 15 | from google3.testing.pybase import googletest 16 | 17 | # pylint: enable-msg=C6204 18 | 19 | 20 | class GMockMethodNCTest(googletest.TestCase): 21 | """Negative compilation tests for MOCK_METHOD.""" 22 | 23 | # The class body is intentionally empty. The actual test*() methods 24 | # will be defined at run time by a call to 25 | # DefineNegativeCompilationTests() later. 26 | pass 27 | 28 | 29 | # Defines a list of test specs, where each element is a tuple 30 | # (test name, list of regexes for matching the compiler errors). 31 | TEST_SPECS = [ 32 | ("MOCK_METHOD_INVALID_CONST_SPEC", 33 | [r"onst cannot be recognized as a valid specification modifier"]), 34 | ] 35 | 36 | # Define a test method in GMockNCTest for each element in TEST_SPECS. 37 | fake_target_util.DefineNegativeCompilationTests( 38 | GMockMethodNCTest, 39 | "google3/third_party/googletest/googlemock/test/gmock-function-mocker_nc", 40 | "gmock-function-mocker_nc.o", TEST_SPECS) 41 | 42 | if __name__ == "__main__": 43 | googletest.main() 44 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/test/gmock-port_test.cc: -------------------------------------------------------------------------------- 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 Mock - a framework for writing C++ mock classes. 32 | // 33 | // This file tests the internal cross-platform support utilities. 34 | 35 | #include "gmock/internal/gmock-port.h" 36 | #include "gtest/gtest.h" 37 | 38 | // NOTE: if this file is left without tests for some reason, put a dummy 39 | // test here to make references to symbols in the gtest library and avoid 40 | // 'undefined symbol' linker errors in gmock_main: 41 | 42 | TEST(DummyTest, Dummy) {} 43 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/test/gmock_link2_test.cc: -------------------------------------------------------------------------------- 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 Mock - a framework for writing C++ mock classes. 32 | // 33 | // This file is for verifying that various Google Mock constructs do not 34 | // produce linker errors when instantiated in different translation units. 35 | // Please see gmock_link_test.h for details. 36 | 37 | #define LinkTest LinkTest2 38 | 39 | #include "test/gmock_link_test.h" 40 | -------------------------------------------------------------------------------- /tests/googletest/googlemock/test/gmock_link_test.cc: -------------------------------------------------------------------------------- 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 Mock - a framework for writing C++ mock classes. 32 | // 33 | // This file is for verifying that various Google Mock constructs do not 34 | // produce linker errors when instantiated in different translation units. 35 | // Please see gmock_link_test.h for details. 36 | 37 | #define LinkTest LinkTest1 38 | 39 | #include "test/gmock_link_test.h" 40 | -------------------------------------------------------------------------------- /tests/googletest/googletest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /tests/googletest/googletest/LICENSE: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /tests/googletest/googletest/cmake/Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | include(CMakeFindDependencyMacro) 3 | if (@GTEST_HAS_PTHREAD@) 4 | set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@) 5 | find_dependency(Threads) 6 | endif() 7 | 8 | include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") 9 | check_required_components("@project_name@") 10 | -------------------------------------------------------------------------------- /tests/googletest/googletest/cmake/gtest.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gtest 6 | Description: GoogleTest (without main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Libs: -L${libdir} -lgtest @CMAKE_THREAD_LIBS_INIT@ 10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 11 | -------------------------------------------------------------------------------- /tests/googletest/googletest/cmake/gtest_main.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gtest_main 6 | Description: GoogleTest (with main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Requires: gtest 10 | Libs: -L${libdir} -lgtest_main @CMAKE_THREAD_LIBS_INIT@ 11 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 12 | -------------------------------------------------------------------------------- /tests/googletest/googletest/codegear/gtest.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {c1d923e0-6cba-4332-9b6f-3420acbf5091} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Default.Personality 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /tests/googletest/googletest/codegear/gtest_all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, 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: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // C++Builder's IDE cannot build a static library from files with hyphens 35 | // in their name. See http://qc.codegear.com/wc/qcmain.aspx?d=70977 . 36 | // This file serves as a workaround. 37 | 38 | #include "src/gtest-all.cc" 39 | -------------------------------------------------------------------------------- /tests/googletest/googletest/codegear/gtest_link.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, 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: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Links gtest.lib and gtest_main.lib into the current project in C++Builder. 35 | // This means that these libraries can't be renamed, but it's the only way to 36 | // ensure that Debug versus Release test builds are linked against the 37 | // appropriate Debug or Release build of the libraries. 38 | 39 | #pragma link "gtest.lib" 40 | #pragma link "gtest_main.lib" 41 | -------------------------------------------------------------------------------- /tests/googletest/googletest/docs/samples.md: -------------------------------------------------------------------------------- 1 | # Googletest Samples 2 | 3 | If you're like us, you'd like to look at [googletest 4 | samples.](https://github.com/google/googletest/tree/master/googletest/samples) 5 | The sample directory has a number of well-commented samples showing how to use a 6 | variety of googletest features. 7 | 8 | * Sample #1 shows the basic steps of using googletest to test C++ functions. 9 | * Sample #2 shows a more complex unit test for a class with multiple member 10 | functions. 11 | * Sample #3 uses a test fixture. 12 | * Sample #4 teaches you how to use googletest and `googletest.h` together to 13 | get the best of both libraries. 14 | * Sample #5 puts shared testing logic in a base test fixture, and reuses it in 15 | derived fixtures. 16 | * Sample #6 demonstrates type-parameterized tests. 17 | * Sample #7 teaches the basics of value-parameterized tests. 18 | * Sample #8 shows using `Combine()` in value-parameterized tests. 19 | * Sample #9 shows use of the listener API to modify Google Test's console 20 | output and the use of its reflection API to inspect test results. 21 | * Sample #10 shows use of the listener API to implement a primitive memory 22 | leak checker. 23 | -------------------------------------------------------------------------------- /tests/googletest/googletest/include/gtest/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gtest.h` 6 | 7 | ### The following macros can be defined: 8 | 9 | * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of 10 | `OsStackTraceGetterInterface`. 11 | * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See 12 | `testing::TempDir` for semantics and signature. 13 | 14 | ## Header `gtest-port.h` 15 | 16 | The following macros can be defined: 17 | 18 | ### Flag related macros: 19 | 20 | * `GTEST_FLAG(flag_name)` 21 | * `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its 22 | own flagfile flag parsing. 23 | * `GTEST_DECLARE_bool_(name)` 24 | * `GTEST_DECLARE_int32_(name)` 25 | * `GTEST_DECLARE_string_(name)` 26 | * `GTEST_DEFINE_bool_(name, default_val, doc)` 27 | * `GTEST_DEFINE_int32_(name, default_val, doc)` 28 | * `GTEST_DEFINE_string_(name, default_val, doc)` 29 | 30 | ### Logging: 31 | 32 | * `GTEST_LOG_(severity)` 33 | * `GTEST_CHECK_(condition)` 34 | * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. 35 | 36 | ### Threading: 37 | 38 | * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. 39 | * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` 40 | are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` 41 | and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` 42 | * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` 43 | * `GTEST_LOCK_EXCLUDED_(locks)` 44 | 45 | ### Underlying library support features 46 | 47 | * `GTEST_HAS_CXXABI_H_` 48 | 49 | ### Exporting API symbols: 50 | 51 | * `GTEST_API_` - Specifier for exported symbols. 52 | 53 | ## Header `gtest-printers.h` 54 | 55 | * See documentation at `gtest/gtest-printers.h` for details on how to define a 56 | custom printer. 57 | -------------------------------------------------------------------------------- /tests/googletest/googletest/include/gtest/internal/custom/gtest-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, 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 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 38 | -------------------------------------------------------------------------------- /tests/googletest/googletest/include/gtest/internal/custom/gtest-printers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, 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 | // This file provides an injection point for custom printers in a local 31 | // installation of gTest. 32 | // It will be included from gtest-printers.h and the overrides in this file 33 | // will be visible to everyone. 34 | // 35 | // Injection point for custom user configurations. See README for details 36 | // 37 | // ** Custom implementation starts here ** 38 | 39 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 40 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 41 | 42 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 43 | -------------------------------------------------------------------------------- /tests/googletest/googletest/include/gtest/internal/custom/gtest.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, 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 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 38 | -------------------------------------------------------------------------------- /tests/googletest/googletest/msvc/2010/gtest-md.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/googletest/googletest/msvc/2010/gtest.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/googletest/googletest/msvc/2010/gtest_main-md.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/googletest/googletest/msvc/2010/gtest_main.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/googletest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | 23 | Header Files 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/googletest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | 23 | Header Files 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/googletest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/googletest/googletest/msvc/2010/gtest_unittest.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/googletest/googletest/samples/sample1.h: -------------------------------------------------------------------------------- 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 | // A sample program demonstrating using Google C++ testing framework. 31 | 32 | #ifndef GTEST_SAMPLES_SAMPLE1_H_ 33 | #define GTEST_SAMPLES_SAMPLE1_H_ 34 | 35 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 36 | int Factorial(int n); 37 | 38 | // Returns true iff n is a prime number. 39 | bool IsPrime(int n); 40 | 41 | #endif // GTEST_SAMPLES_SAMPLE1_H_ 42 | -------------------------------------------------------------------------------- /tests/googletest/googletest/samples/sample4.cc: -------------------------------------------------------------------------------- 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 | // A sample program demonstrating using Google C++ testing framework. 31 | 32 | #include 33 | 34 | #include "sample4.h" 35 | 36 | // Returns the current counter value, and increments it. 37 | int Counter::Increment() { 38 | return counter_++; 39 | } 40 | 41 | // Returns the current counter value, and decrements it. 42 | // counter can not be less than 0, return 0 in this case 43 | int Counter::Decrement() { 44 | if (counter_ == 0) { 45 | return counter_; 46 | } else { 47 | return counter_--; 48 | } 49 | } 50 | 51 | // Prints the current counter value to STDOUT. 52 | void Counter::Print() const { 53 | printf("%d", counter_); 54 | } 55 | -------------------------------------------------------------------------------- /tests/googletest/googletest/samples/sample4.h: -------------------------------------------------------------------------------- 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 | // A sample program demonstrating using Google C++ testing framework. 31 | #ifndef GTEST_SAMPLES_SAMPLE4_H_ 32 | #define GTEST_SAMPLES_SAMPLE4_H_ 33 | 34 | // A simple monotonic counter. 35 | class Counter { 36 | private: 37 | int counter_; 38 | 39 | public: 40 | // Creates a counter that starts at 0. 41 | Counter() : counter_(0) {} 42 | 43 | // Returns the current counter value, and increments it. 44 | int Increment(); 45 | 46 | // Returns the current counter value, and decrements it. 47 | int Decrement(); 48 | 49 | // Prints the current counter value to STDOUT. 50 | void Print() const; 51 | }; 52 | 53 | #endif // GTEST_SAMPLES_SAMPLE4_H_ 54 | -------------------------------------------------------------------------------- /tests/googletest/googletest/samples/sample4_unittest.cc: -------------------------------------------------------------------------------- 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 | 31 | #include "sample4.h" 32 | #include "gtest/gtest.h" 33 | 34 | namespace { 35 | // Tests the Increment() method. 36 | 37 | TEST(Counter, Increment) { 38 | Counter c; 39 | 40 | // Test that counter 0 returns 0 41 | EXPECT_EQ(0, c.Decrement()); 42 | 43 | // EXPECT_EQ() evaluates its arguments exactly once, so they 44 | // can have side effects. 45 | 46 | EXPECT_EQ(0, c.Increment()); 47 | EXPECT_EQ(1, c.Increment()); 48 | EXPECT_EQ(2, c.Increment()); 49 | 50 | EXPECT_EQ(3, c.Decrement()); 51 | } 52 | 53 | } // namespace 54 | -------------------------------------------------------------------------------- /tests/googletest/googletest/scripts/test/Makefile: -------------------------------------------------------------------------------- 1 | # A Makefile for fusing Google Test and building a sample test against it. 2 | # 3 | # SYNOPSIS: 4 | # 5 | # make [all] - makes everything. 6 | # make TARGET - makes the given target. 7 | # make check - makes everything and runs the built sample test. 8 | # make clean - removes all files generated by make. 9 | 10 | # Points to the root of fused Google Test, relative to where this file is. 11 | FUSED_GTEST_DIR = output 12 | 13 | # Paths to the fused gtest files. 14 | FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h 15 | FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 16 | 17 | # Where to find the sample test. 18 | SAMPLE_DIR = ../../samples 19 | 20 | # Where to find gtest_main.cc. 21 | GTEST_MAIN_CC = ../../src/gtest_main.cc 22 | 23 | # Flags passed to the preprocessor. 24 | # We have no idea here whether pthreads is available in the system, so 25 | # disable its use. 26 | CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0 27 | 28 | # Flags passed to the C++ compiler. 29 | CXXFLAGS += -g 30 | 31 | all : sample1_unittest 32 | 33 | check : all 34 | ./sample1_unittest 35 | 36 | clean : 37 | rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o 38 | 39 | $(FUSED_GTEST_H) : 40 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 41 | 42 | $(FUSED_GTEST_ALL_CC) : 43 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 44 | 45 | gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC) 46 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 47 | 48 | gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC) 49 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC) 50 | 51 | sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h 52 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc 53 | 54 | sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \ 55 | $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H) 56 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc 57 | 58 | sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o 59 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ 60 | -------------------------------------------------------------------------------- /tests/googletest/googletest/src/gtest-all.cc: -------------------------------------------------------------------------------- 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 C++ Testing and Mocking Framework (Google Test) 32 | // 33 | // Sometimes it's desirable to build Google Test by compiling a single file. 34 | // This file serves this purpose. 35 | 36 | // This line ensures that gtest.h can be compiled on its own, even 37 | // when it's fused. 38 | #include "gtest/gtest.h" 39 | 40 | // The following lines pull in the real gtest *.cc files. 41 | #include "src/gtest.cc" 42 | #include "src/gtest-death-test.cc" 43 | #include "src/gtest-filepath.cc" 44 | #include "src/gtest-matchers.cc" 45 | #include "src/gtest-port.cc" 46 | #include "src/gtest-printers.cc" 47 | #include "src/gtest-test-part.cc" 48 | #include "src/gtest-typed-test.cc" 49 | -------------------------------------------------------------------------------- /tests/googletest/googletest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, 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 | #include 31 | #include "gtest/gtest.h" 32 | 33 | #ifdef ARDUINO 34 | void setup() { 35 | // Since Arduino doesn't have a command line, fake out the argc/argv arguments 36 | int argc = 1; 37 | const auto arg0 = "PlatformIO"; 38 | char* argv0 = const_cast(arg0); 39 | char** argv = &argv0; 40 | 41 | testing::InitGoogleTest(&argc, argv); 42 | } 43 | 44 | void loop() { RUN_ALL_TESTS(); } 45 | 46 | #else 47 | 48 | GTEST_API_ int main(int argc, char **argv) { 49 | printf("Running main() from %s\n", __FILE__); 50 | testing::InitGoogleTest(&argc, argv); 51 | return RUN_ALL_TESTS(); 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/googletest-param-test-invalid-name1-test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015, 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 | #include "gtest/gtest.h" 32 | 33 | namespace { 34 | class DummyTest : public ::testing::TestWithParam {}; 35 | 36 | TEST_P(DummyTest, Dummy) { 37 | } 38 | 39 | INSTANTIATE_TEST_CASE_P(InvalidTestName, 40 | DummyTest, 41 | ::testing::Values("InvalidWithQuotes"), 42 | ::testing::PrintToStringParamName()); 43 | 44 | } // namespace 45 | 46 | int main(int argc, char *argv[]) { 47 | testing::InitGoogleTest(&argc, argv); 48 | return RUN_ALL_TESTS(); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/googletest-param-test-invalid-name2-test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015, 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 | #include "gtest/gtest.h" 32 | 33 | namespace { 34 | class DummyTest : public ::testing::TestWithParam {}; 35 | 36 | std::string StringParamTestSuffix( 37 | const testing::TestParamInfo& info) { 38 | return std::string(info.param); 39 | } 40 | 41 | TEST_P(DummyTest, Dummy) { 42 | } 43 | 44 | INSTANTIATE_TEST_CASE_P(DuplicateTestNames, 45 | DummyTest, 46 | ::testing::Values("a", "b", "a", "c"), 47 | StringParamTestSuffix); 48 | } // namespace 49 | 50 | int main(int argc, char *argv[]) { 51 | testing::InitGoogleTest(&argc, argv); 52 | return RUN_ALL_TESTS(); 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/googletest-uninitialized-test_.cc: -------------------------------------------------------------------------------- 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 | #include "gtest/gtest.h" 32 | 33 | TEST(DummyTest, Dummy) { 34 | // This test doesn't verify anything. We just need it to create a 35 | // realistic stage for testing the behavior of Google Test when 36 | // RUN_ALL_TESTS() is called without 37 | // testing::InitGoogleTest() being called first. 38 | } 39 | 40 | int main() { 41 | return RUN_ALL_TESTS(); 42 | } 43 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/gtest-typed-test2_test.cc: -------------------------------------------------------------------------------- 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 | #include 32 | 33 | #include "test/gtest-typed-test_test.h" 34 | #include "gtest/gtest.h" 35 | 36 | #if GTEST_HAS_TYPED_TEST_P 37 | 38 | // Tests that the same type-parameterized test case can be 39 | // instantiated in different translation units linked together. 40 | // (ContainerTest is also instantiated in gtest-typed-test_test.cc.) 41 | INSTANTIATE_TYPED_TEST_CASE_P(Vector, ContainerTest, 42 | testing::Types >); 43 | 44 | #endif // GTEST_HAS_TYPED_TEST_P 45 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/gtest_help_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, 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 | // This program is meant to be run by gtest_help_test.py. Do not run 32 | // it directly. 33 | 34 | #include "gtest/gtest.h" 35 | 36 | // When a help flag is specified, this program should skip the tests 37 | // and exit with 0; otherwise the following test will be executed, 38 | // causing this program to exit with a non-zero code. 39 | TEST(HelpFlagTest, ShouldNotBeRun) { 40 | ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified."; 41 | } 42 | 43 | #if GTEST_HAS_DEATH_TEST 44 | TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {} 45 | #endif 46 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/gtest_list_output_unittest_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018, 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: david.schuldenfrei@gmail.com (David Schuldenfrei) 31 | 32 | // Unit test for Google Test's --gtest_list_tests and --gtest_output flag. 33 | // 34 | // A user can ask Google Test to list all tests that will run, 35 | // and have the output saved in a Json/Xml file. 36 | // The tests will not be run after listing. 37 | // 38 | // This program will be invoked from a Python unit test. 39 | // Don't run it directly. 40 | 41 | #include "gtest/gtest.h" 42 | 43 | TEST(FooTest, Test1) {} 44 | 45 | TEST(FooTest, Test2) {} 46 | 47 | int main(int argc, char **argv) { 48 | ::testing::InitGoogleTest(&argc, argv); 49 | 50 | return RUN_ALL_TESTS(); 51 | } 52 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/gtest_main_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, 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 | #include "gtest/gtest.h" 32 | 33 | // Tests that we don't have to define main() when we link to 34 | // gtest_main instead of gtest. 35 | 36 | namespace { 37 | 38 | TEST(GTestMainTest, ShouldSucceed) { 39 | } 40 | 41 | } // namespace 42 | 43 | // We are using the main() function defined in gtest_main.cc, so we 44 | // don't define it here. 45 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/gtest_prod_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, 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 | // Unit test for gtest_prod.h. 32 | 33 | #include "production.h" 34 | #include "gtest/gtest.h" 35 | 36 | // Tests that private members can be accessed from a TEST declared as 37 | // a friend of the class. 38 | TEST(PrivateCodeTest, CanAccessPrivateMembers) { 39 | PrivateCode a; 40 | EXPECT_EQ(0, a.x_); 41 | 42 | a.set_x(1); 43 | EXPECT_EQ(1, a.x_); 44 | } 45 | 46 | typedef testing::Test PrivateCodeFixtureTest; 47 | 48 | // Tests that private members can be accessed from a TEST_F declared 49 | // as a friend of the class. 50 | TEST_F(PrivateCodeFixtureTest, CanAccessPrivateMembers) { 51 | PrivateCode a; 52 | EXPECT_EQ(0, a.x_); 53 | 54 | a.set_x(2); 55 | EXPECT_EQ(2, a.x_); 56 | } 57 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/gtest_skip_test.cc: -------------------------------------------------------------------------------- 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: arseny.aprelev@gmail.com (Arseny Aprelev) 31 | // 32 | 33 | #include "gtest/gtest.h" 34 | 35 | using ::testing::Test; 36 | 37 | TEST(SkipTest, DoesSkip) { 38 | GTEST_SKIP(); 39 | EXPECT_EQ(0, 1); 40 | } 41 | 42 | class Fixture : public Test { 43 | protected: 44 | void SetUp() override { 45 | GTEST_SKIP() << "skipping all tests for this fixture"; 46 | } 47 | }; 48 | 49 | TEST_F(Fixture, SkipsOneTest) { 50 | EXPECT_EQ(5, 7); 51 | } 52 | 53 | TEST_F(Fixture, SkipsAnotherTest) { 54 | EXPECT_EQ(99, 100); 55 | } 56 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/gtest_testbridge_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Google LLC. 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 | // This program is meant to be run by gtest_test_filter_test.py. Do not run 32 | // it directly. 33 | 34 | #include "gtest/gtest.h" 35 | 36 | // These tests are used to detect if filtering is working. Only 37 | // 'TestThatSucceeds' should ever run. 38 | 39 | TEST(TestFilterTest, TestThatSucceeds) {} 40 | 41 | TEST(TestFilterTest, TestThatFails) { 42 | ASSERT_TRUE(false) << "This test should never be run."; 43 | } 44 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/gtest_xml_outfile1_test_.cc: -------------------------------------------------------------------------------- 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 | // gtest_xml_outfile1_test_ writes some xml via TestProperty used by 31 | // gtest_xml_outfiles_test.py 32 | 33 | #include "gtest/gtest.h" 34 | 35 | class PropertyOne : public testing::Test { 36 | protected: 37 | void SetUp() override { RecordProperty("SetUpProp", 1); } 38 | void TearDown() override { RecordProperty("TearDownProp", 1); } 39 | }; 40 | 41 | TEST_F(PropertyOne, TestSomeProperties) { 42 | RecordProperty("TestSomeProperty", 1); 43 | } 44 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/gtest_xml_outfile2_test_.cc: -------------------------------------------------------------------------------- 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 | // gtest_xml_outfile2_test_ writes some xml via TestProperty used by 31 | // gtest_xml_outfiles_test.py 32 | 33 | #include "gtest/gtest.h" 34 | 35 | class PropertyTwo : public testing::Test { 36 | protected: 37 | void SetUp() override { RecordProperty("SetUpProp", 2); } 38 | void TearDown() override { RecordProperty("TearDownProp", 2); } 39 | }; 40 | 41 | TEST_F(PropertyTwo, TestSomeProperties) { 42 | RecordProperty("TestSomeProperty", 2); 43 | } 44 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, 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 | // This is part of the unit test for gtest_prod.h. 32 | 33 | #include "production.h" 34 | 35 | PrivateCode::PrivateCode() : x_(0) {} 36 | -------------------------------------------------------------------------------- /tests/googletest/googletest/test/production.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, 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 | // This is part of the unit test for gtest_prod.h. 32 | 33 | #ifndef GTEST_TEST_PRODUCTION_H_ 34 | #define GTEST_TEST_PRODUCTION_H_ 35 | 36 | #include "gtest/gtest_prod.h" 37 | 38 | class PrivateCode { 39 | public: 40 | // Declares a friend test that does not use a fixture. 41 | FRIEND_TEST(PrivateCodeTest, CanAccessPrivateMembers); 42 | 43 | // Declares a friend test that uses a fixture. 44 | FRIEND_TEST(PrivateCodeFixtureTest, CanAccessPrivateMembers); 45 | 46 | PrivateCode(); 47 | 48 | int x() const { return x_; } 49 | private: 50 | void set_x(int an_x) { x_ = an_x; } 51 | int x_; 52 | }; 53 | 54 | #endif // GTEST_TEST_PRODUCTION_H_ 55 | -------------------------------------------------------------------------------- /tests/googletest/googletest/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // https://github.com/google/google-toolbox-for-mac 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /tests/googletest/googletest/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // https://github.com/google/google-toolbox-for-mac 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /tests/googletest/googletest/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // https://github.com/google/google-toolbox-for-mac 8 | // 9 | 10 | // Build for PPC and Intel 64-bit 11 | ARCHS = x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /tests/googletest/googletest/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // https://github.com/google/google-toolbox-for-mac 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /tests/googletest/googletest/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // https://github.com/google/google-toolbox-for-mac 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /tests/googletest/googletest/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /tests/googletest/googletest/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/googletest/googletest/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/googletest/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "googletest", 3 | "keywords": "unittest, unit, test, gtest, gmock", 4 | "description": "googletest is a testing framework developed by the Testing Technology team with Google's specific requirements and constraints in mind. No matter whether you work on Linux, Windows, or a Mac, if you write C++ code, googletest can help you. And it supports any kind of tests, not just unit tests.", 5 | "license": "BSD-3-Clause", 6 | "homepage": "https://github.com/google/googletest/blob/master/README.md", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/google/googletest.git" 10 | }, 11 | "version": "1.8.1", 12 | "frameworks": "arduino", 13 | "platforms": [ 14 | "espressif32" 15 | ], 16 | "export": { 17 | "include": [ 18 | "googlemock/include/*", 19 | "googlemock/src/*", 20 | "googletest/include/*", 21 | "googletest/src/*" 22 | ], 23 | "exclude": [ 24 | "ci", 25 | "googlemock/build-aux", 26 | "googlemock/cmake", 27 | "googlemock/make", 28 | "googlemock/msvc", 29 | "googlemock/scripts", 30 | "googlemock/test", 31 | "googlemock/CMakeLists.txt", 32 | "googlemock/Makefile.am", 33 | "googlemock/configure.ac", 34 | "googletest/cmake", 35 | "googletest/codegear", 36 | "googletest/m4", 37 | "googletest/make", 38 | "googletest/msvc", 39 | "googletest/scripts", 40 | "googletest/test", 41 | "googletest/xcode", 42 | "googletest/CMakeLists.txt", 43 | "googletest/Makefile.am", 44 | "googletest/configure.ac" 45 | ] 46 | }, 47 | "build": { 48 | "flags": [ 49 | "-Igooglemock/include", 50 | "-Igooglemock", 51 | "-Igoogletest/include", 52 | "-Igoogletest" 53 | ] 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/googletest/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | 12 | [platformio] 13 | #src_dir = ./googlemock 14 | #src_dir = ./googletest 15 | src_dir = . 16 | 17 | [env:googletest_esp32] 18 | platform = espressif32 19 | board = esp32dev 20 | framework = arduino 21 | build_flags = -I./googletest/include -I./googletest 22 | src_filter = +<*> -<.git/> - - - - - - + + 23 | upload_speed = 921600 24 | 25 | [env:googlemock_esp32] 26 | platform = espressif32 27 | board = esp32dev 28 | framework = arduino 29 | build_flags = -I./googlemock/include -I./googletest/include -I./googletest -I./googlemock 30 | src_filter = +<*> -<.git/> - - - + + + 31 | upload_speed = 921600 32 | -------------------------------------------------------------------------------- /tests/jsonSample/README.md: -------------------------------------------------------------------------------- 1 | Sample JSON files 2 | ================= 3 | 4 | The `fail*.json` and `pass*.json` files in this directory are from the 5 | [JSON checker](http://json.org/JSON_checker/) [test suite](http://json.org/JSON_checker/test.zip). 6 | The file `sample.json` was downloaded from the [json-test-suite project](http://code.google.com/p/json-test-suite/downloads/detail?name=sample.zip). 7 | -------------------------------------------------------------------------------- /tests/jsonSample/fail1.json: -------------------------------------------------------------------------------- 1 | "A JSON payload should be an object or array, not a string." -------------------------------------------------------------------------------- /tests/jsonSample/fail10.json: -------------------------------------------------------------------------------- 1 | {"Extra value after close": true} "misplaced quoted value" -------------------------------------------------------------------------------- /tests/jsonSample/fail11.json: -------------------------------------------------------------------------------- 1 | {"Illegal expression": 1 + 2} -------------------------------------------------------------------------------- /tests/jsonSample/fail12.json: -------------------------------------------------------------------------------- 1 | {"Illegal invocation": alert()} -------------------------------------------------------------------------------- /tests/jsonSample/fail13.json: -------------------------------------------------------------------------------- 1 | {"Numbers cannot have leading zeroes": 013} -------------------------------------------------------------------------------- /tests/jsonSample/fail14.json: -------------------------------------------------------------------------------- 1 | {"Numbers cannot be hex": 0x14} -------------------------------------------------------------------------------- /tests/jsonSample/fail15.json: -------------------------------------------------------------------------------- 1 | ["Illegal backslash escape: \x15"] -------------------------------------------------------------------------------- /tests/jsonSample/fail16.json: -------------------------------------------------------------------------------- 1 | [\naked] -------------------------------------------------------------------------------- /tests/jsonSample/fail17.json: -------------------------------------------------------------------------------- 1 | ["Illegal backslash escape: \017"] -------------------------------------------------------------------------------- /tests/jsonSample/fail18.json: -------------------------------------------------------------------------------- 1 | [[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]] -------------------------------------------------------------------------------- /tests/jsonSample/fail19.json: -------------------------------------------------------------------------------- 1 | {"Missing colon" null} -------------------------------------------------------------------------------- /tests/jsonSample/fail2.json: -------------------------------------------------------------------------------- 1 | ["Unclosed array" -------------------------------------------------------------------------------- /tests/jsonSample/fail20.json: -------------------------------------------------------------------------------- 1 | {"Double colon":: null} -------------------------------------------------------------------------------- /tests/jsonSample/fail21.json: -------------------------------------------------------------------------------- 1 | {"Comma instead of colon", null} -------------------------------------------------------------------------------- /tests/jsonSample/fail22.json: -------------------------------------------------------------------------------- 1 | ["Colon instead of comma": false] -------------------------------------------------------------------------------- /tests/jsonSample/fail23.json: -------------------------------------------------------------------------------- 1 | ["Bad value", truth] -------------------------------------------------------------------------------- /tests/jsonSample/fail24.json: -------------------------------------------------------------------------------- 1 | ['single quote'] -------------------------------------------------------------------------------- /tests/jsonSample/fail25.json: -------------------------------------------------------------------------------- 1 | [" tab character in string "] -------------------------------------------------------------------------------- /tests/jsonSample/fail26.json: -------------------------------------------------------------------------------- 1 | ["tab\ character\ in\ string\ "] -------------------------------------------------------------------------------- /tests/jsonSample/fail27.json: -------------------------------------------------------------------------------- 1 | ["line 2 | break"] -------------------------------------------------------------------------------- /tests/jsonSample/fail28.json: -------------------------------------------------------------------------------- 1 | ["line\ 2 | break"] -------------------------------------------------------------------------------- /tests/jsonSample/fail29.json: -------------------------------------------------------------------------------- 1 | [0e] -------------------------------------------------------------------------------- /tests/jsonSample/fail3.json: -------------------------------------------------------------------------------- 1 | {unquoted_key: "keys must be quoted"} -------------------------------------------------------------------------------- /tests/jsonSample/fail30.json: -------------------------------------------------------------------------------- 1 | [0e+] -------------------------------------------------------------------------------- /tests/jsonSample/fail31.json: -------------------------------------------------------------------------------- 1 | [0e+-1] -------------------------------------------------------------------------------- /tests/jsonSample/fail32.json: -------------------------------------------------------------------------------- 1 | {"Comma instead if closing brace": true, -------------------------------------------------------------------------------- /tests/jsonSample/fail33.json: -------------------------------------------------------------------------------- 1 | ["mismatch"} -------------------------------------------------------------------------------- /tests/jsonSample/fail4.json: -------------------------------------------------------------------------------- 1 | ["extra comma",] -------------------------------------------------------------------------------- /tests/jsonSample/fail5.json: -------------------------------------------------------------------------------- 1 | ["double extra comma",,] -------------------------------------------------------------------------------- /tests/jsonSample/fail6.json: -------------------------------------------------------------------------------- 1 | [ , "<-- missing value"] -------------------------------------------------------------------------------- /tests/jsonSample/fail7.json: -------------------------------------------------------------------------------- 1 | ["Comma after the close"], -------------------------------------------------------------------------------- /tests/jsonSample/fail8.json: -------------------------------------------------------------------------------- 1 | ["Extra close"]] -------------------------------------------------------------------------------- /tests/jsonSample/fail9.json: -------------------------------------------------------------------------------- 1 | {"Extra comma": true,} -------------------------------------------------------------------------------- /tests/jsonSample/pass1.json: -------------------------------------------------------------------------------- 1 | [ 2 | "JSON Test Pattern pass1", 3 | {"object with 1 member":["array with 1 element"]}, 4 | {}, 5 | [], 6 | -42, 7 | true, 8 | false, 9 | null, 10 | { 11 | "integer": 1234567890, 12 | "real": -9876.543210, 13 | "e": 0.123456789e-12, 14 | "E": 1.234567890E+34, 15 | "": 23456789012E66, 16 | "zero": 0, 17 | "one": 1, 18 | "space": " ", 19 | "quote": "\"", 20 | "backslash": "\\", 21 | "controls": "\b\f\n\r\t", 22 | "slash": "/ & \/", 23 | "alpha": "abcdefghijklmnopqrstuvwyz", 24 | "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ", 25 | "digit": "0123456789", 26 | "0123456789": "digit", 27 | "special": "`1~!@#$%^&*()_+-={':[,]}|;.?", 28 | "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", 29 | "true": true, 30 | "false": false, 31 | "null": null, 32 | "array":[ ], 33 | "object":{ }, 34 | "address": "50 St. James Street", 35 | "url": "http://www.JSON.org/", 36 | "comment": "// /* */": " ", 38 | " s p a c e d " :[1,2 , 3 39 | 40 | , 41 | 42 | 4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7], 43 | "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", 44 | "quotes": "" \u0022 %22 0x22 034 "", 45 | "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" 46 | : "A key can be any string" 47 | }, 48 | 0.5 ,98.6 49 | , 50 | 99.44 51 | , 52 | 53 | 1066, 54 | 1e1, 55 | 0.1e1, 56 | 1e-1, 57 | 1e00,2e+00,2e-00 58 | ,"rosebud"] -------------------------------------------------------------------------------- /tests/jsonSample/pass2.json: -------------------------------------------------------------------------------- 1 | [[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] -------------------------------------------------------------------------------- /tests/jsonSample/pass3.json: -------------------------------------------------------------------------------- 1 | { 2 | "JSON Test Pattern pass3": { 3 | "The outermost value": "must be an object or array.", 4 | "In this test": "It is an object." 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/jsonSample/small.json: -------------------------------------------------------------------------------- 1 | { "a": 12, 2 | "b": "abc", 3 | "c": true, 4 | "d": false, 5 | "e": null, 6 | "f": [1,2,3] } 7 | -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # -*- mode: CMAKE; -*- 2 | 3 | set(CMAKE_INTERPROCEDURAL_OPTIMIZATION False) 4 | 5 | # options 6 | option(BuildBench "Build bench performance test suite" OFF) 7 | message(STATUS "VelocyPack building bench performance test suite: ${BuildBench}") 8 | 9 | option(BuildTools "Build support programs and tools" ON) 10 | message(STATUS "VelocyPack building support programs and tools: ${BuildTools}") 11 | 12 | if(BuildTools) 13 | # build json-to-vpack.cpp 14 | add_executable("json-to-vpack" json-to-vpack.cpp) 15 | target_link_libraries("json-to-vpack" velocypack) 16 | install(TARGETS "json-to-vpack" DESTINATION bin) 17 | 18 | # build vpack-to-json.cpp 19 | add_executable("vpack-to-json" vpack-to-json.cpp) 20 | target_link_libraries("vpack-to-json" velocypack) 21 | install(TARGETS "vpack-to-json" DESTINATION bin) 22 | 23 | # build vpack-validate.cpp 24 | add_executable("vpack-validate" vpack-validate.cpp) 25 | target_link_libraries("vpack-validate" velocypack) 26 | install(TARGETS "vpack-validate" DESTINATION bin) 27 | 28 | # build fuzzer.cpp 29 | set(THREADS_PREFER_PTHREAD_FLAG ON) 30 | find_package(Threads REQUIRED) 31 | add_executable("fuzzer" fuzzer.cpp) 32 | target_link_libraries("fuzzer" PRIVATE velocypack Threads::Threads) 33 | install(TARGETS "fuzzer" DESTINATION bin) 34 | endif() 35 | 36 | # build bench.cpp 37 | if(BuildBench) 38 | if(NOT IS_DIRECTORY "${PROJECT_SOURCE_DIR}/rapidjson") 39 | message(FATAL_ERROR "rapidjson library not found in subdirectory 'rapidjson'. Please run ./download-rapidjson.sh") 40 | endif() 41 | if(NOT IS_DIRECTORY "${PROJECT_SOURCE_DIR}/simdjson") 42 | message(FATAL_ERROR "simdjson library not found in subdirectory 'simdjson'. Please run ./download-simdjson.sh") 43 | endif() 44 | 45 | add_library(simdjson STATIC IMPORTED) 46 | set_target_properties(simdjson PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/simdjson/build/libsimdjson.a) 47 | 48 | add_executable(bench bench.cpp) 49 | target_link_libraries(bench velocypack) 50 | target_link_libraries(bench simdjson) 51 | target_include_directories(bench PRIVATE ${PROJECT_SOURCE_DIR}/rapidjson/include) 52 | target_include_directories(bench PRIVATE ${PROJECT_SOURCE_DIR}/simdjson/include) 53 | 54 | if(EnableSSE) 55 | target_compile_definitions(bench PRIVATE RAPIDJSON_SSE42) 56 | endif() 57 | endif() 58 | 59 | -------------------------------------------------------------------------------- /tools/bench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arangodb/velocypack/8f0fc652e7641046a9f12b7d8a9917dcc507a5c2/tools/bench.png --------------------------------------------------------------------------------