react-native-nitro-xlsx 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NitroXlsx.podspec +26 -27
- package/Package.swift +31 -10
- package/README.md +1 -1
- package/android/CMakeLists.txt +20 -27
- package/package.json +2 -2
- package/scripts/run-cpp-tests.sh +1 -1
- package/thirdparty/OpenXLSX/.clang-format +118 -0
- package/thirdparty/OpenXLSX/.clang-tidy +28 -0
- package/thirdparty/OpenXLSX/.gitignore +130 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_before_XMLNode_wrappers +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_and_stripping +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_char_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespaced_name_disabled +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-11-benchmarks_post-XLCellIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-14-benchmarks_post-default-row-column-style-support +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-09-02-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-19-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-30-benchmarks-post-XLSharedStrings-by-ref +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-09-benchmarks-post-conditionalFormatsAndSheetProtection +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-10-benchmarks-post-XLCellValue-bugfix +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-31-benchmarks-post-XLComments-implementation +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-02-02-benchmarks-post-XLRowIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-07-20-benchmarks-after-hiding-pugixml-internals +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-08-29-benchmarks-after-code-review-with-libzip +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/Benchmark.cpp +249 -0
- package/thirdparty/OpenXLSX/Benchmarks/CMakeLists.txt +19 -0
- package/thirdparty/OpenXLSX/CMakeLists.txt +466 -0
- package/thirdparty/OpenXLSX/Documentation/CMakeLists.txt +31 -0
- package/thirdparty/OpenXLSX/Documentation/Doxyfile.in +2471 -0
- package/thirdparty/OpenXLSX/Documentation/DoxygenLayout.xml +194 -0
- package/thirdparty/OpenXLSX/Documentation/customdoxygen.css +1355 -0
- package/thirdparty/OpenXLSX/Examples/CMakeLists.txt +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo1.cpp +279 -0
- package/thirdparty/OpenXLSX/Examples/Demo10.cpp +545 -0
- package/thirdparty/OpenXLSX/Examples/Demo1A.cpp +137 -0
- package/thirdparty/OpenXLSX/Examples/Demo2.cpp +65 -0
- package/thirdparty/OpenXLSX/Examples/Demo3.cpp +89 -0
- package/thirdparty/OpenXLSX/Examples/Demo4.cpp +86 -0
- package/thirdparty/OpenXLSX/Examples/Demo5.cpp +77 -0
- package/thirdparty/OpenXLSX/Examples/Demo6.cpp +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo7.cpp +79 -0
- package/thirdparty/OpenXLSX/Examples/Demo8.cpp +117 -0
- package/thirdparty/OpenXLSX/Examples/Demo9.cpp +363 -0
- package/thirdparty/OpenXLSX/Examples/cmake/FindLIBZIP.cmake +61 -0
- package/thirdparty/OpenXLSX/Examples/external/CustomZip/CustomZip.hpp +256 -0
- package/thirdparty/OpenXLSX/LICENSE.md +29 -0
- package/thirdparty/OpenXLSX/Makefile.GNU +530 -0
- package/thirdparty/OpenXLSX/Notes/TBDs.txt +16 -0
- package/thirdparty/OpenXLSX/Notes/confirmed-TBCs.txt +8 -0
- package/thirdparty/OpenXLSX/Notes/styles-missing-support.xml +12 -0
- package/thirdparty/OpenXLSX/Notes/todo-list.txt +108 -0
- package/thirdparty/OpenXLSX/OpenXLSX/CMakeLists.txt +631 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSX.hpp +63 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSXConfig.cmake +11 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/bundle_static_library.cmake +198 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/patch_pkg_config.cmake +69 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/IZipArchive.hpp +361 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX-Exports.hpp +12 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCell.hpp +367 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellIterator.hpp +252 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellRange.hpp +223 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellReference.hpp +317 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellValue.hpp +793 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColor.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColumn.hpp +159 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCommandQuery.hpp +228 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLComments.hpp +270 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLConstants.hpp +18 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLContentTypes.hpp +264 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDateTime.hpp +175 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDocument.hpp +505 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDrawing.hpp +452 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLException.hpp +161 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLFormula.hpp +375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLIterator.hpp +40 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLMergeCells.hpp +216 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLProperties.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRelationships.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRow.hpp +721 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRowData.hpp +488 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSharedStrings.hpp +204 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSheet.hpp +1640 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLStyles.hpp +2390 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLTables.hpp +132 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLWorkbook.hpp +404 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlData.hpp +283 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlFile.hpp +194 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParser.hpp +282 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParserForwardDeclarations.hpp +85 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLZipArchive.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/LibZip.hpp +447 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/OpenXLSXFileSystemTools.hpp +207 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/Zippy.hpp +1375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCell.cpp +340 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellIterator.cpp +427 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellRange.cpp +221 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellReference.cpp +408 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellValue.cpp +519 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColor.cpp +202 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColumn.cpp +141 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLComments.cpp +637 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLContentTypes.cpp +329 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDateTime.cpp +269 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDocument.cpp +1678 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDrawing.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLFormula.cpp +201 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLMergeCells.cpp +357 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLProperties.cpp +810 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRelationships.cpp +529 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRow.cpp +918 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRowData.cpp +508 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSharedStrings.cpp +220 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSheet.cpp +1970 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLStyles.cpp +3014 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLTables.cpp +125 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLWorkbook.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlData.cpp +247 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlFile.cpp +160 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlParser.cpp +261 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLZipArchive.cpp +266 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/utilities/XLUtilities.hpp +478 -0
- package/thirdparty/OpenXLSX/README.md +1279 -0
- package/thirdparty/OpenXLSX/Scripts/cmake-cleanup.sh +102 -0
- package/thirdparty/OpenXLSX/Scripts/compile.sh +23 -0
- package/thirdparty/OpenXLSX/Scripts/demos-cleanup.sh +25 -0
- package/thirdparty/OpenXLSX/Scripts/demos-run-all.sh +60 -0
- package/thirdparty/OpenXLSX/Scripts/guarded-xml-format.sh +47 -0
- package/thirdparty/OpenXLSX/Scripts/make-gnu.sh +11 -0
- package/thirdparty/OpenXLSX/Scripts/uninstall-manifest.sh +48 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format-all.sh +19 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format.sh +38 -0
- package/thirdparty/OpenXLSX/Tests/CMakeLists.txt +37 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch.hpp +17799 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_automake.hpp +68 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_sonarqube.hpp +182 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_tap.hpp +278 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_teamcity.hpp +212 -0
- package/thirdparty/OpenXLSX/Tests/main.cpp +55 -0
- package/thirdparty/OpenXLSX/Tests/testXLCell.cpp +176 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellRange.cpp +180 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellReference.cpp +160 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValue.cpp +366 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValueProxy.cpp +255 -0
- package/thirdparty/OpenXLSX/Tests/testXLColor.cpp +75 -0
- package/thirdparty/OpenXLSX/Tests/testXLDateTime.cpp +229 -0
- package/thirdparty/OpenXLSX/Tests/testXLDocument.cpp +197 -0
- package/thirdparty/OpenXLSX/Tests/testXLFormula.cpp +131 -0
- package/thirdparty/OpenXLSX/Tests/testXLRow.cpp +597 -0
- package/thirdparty/OpenXLSX/Tests/testXLSheet.cpp +77 -0
- package/thirdparty/OpenXLSX/Tests/ziptest-with-libs.cpp +88 -0
- package/thirdparty/OpenXLSX/Tests/ziptest.cpp +735 -0
- package/thirdparty/OpenXLSX/cmake/get-git-HEAD-ID.cmake +45 -0
- package/thirdparty/OpenXLSX/cmake/libopenxlsxCPackOptions.cmake.in +20 -0
- package/thirdparty/OpenXLSX/cmake/manage_dependency.cmake +813 -0
- package/thirdparty/OpenXLSX/cmake/recursive_library_type_test.cmake +52 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-shared.hpp +42 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-static.hpp +42 -0
- package/thirdparty/OpenXLSX/vcpkg.json +24 -0
- package/thirdparty/README.md +42 -0
- package/thirdparty/miniz/.clang-format +47 -0
- package/thirdparty/miniz/.travis.yml +2 -0
- package/thirdparty/miniz/CMakeLists.txt +333 -0
- package/thirdparty/miniz/CMakePresets.json +31 -0
- package/thirdparty/miniz/ChangeLog.md +272 -0
- package/thirdparty/miniz/Config.cmake.in +1 -0
- package/thirdparty/miniz/LICENSE +22 -0
- package/thirdparty/miniz/amalgamate.sh +57 -0
- package/thirdparty/miniz/examples/example1.c +105 -0
- package/thirdparty/miniz/examples/example2.c +164 -0
- package/thirdparty/miniz/examples/example3.c +269 -0
- package/thirdparty/miniz/examples/example4.c +102 -0
- package/thirdparty/miniz/examples/example5.c +327 -0
- package/thirdparty/miniz/examples/example6.c +189 -0
- package/thirdparty/miniz/meson.build +21 -0
- package/thirdparty/miniz/miniz.c +646 -0
- package/thirdparty/miniz/miniz.h +615 -0
- package/thirdparty/miniz/miniz.pc.in +13 -0
- package/thirdparty/miniz/miniz_common.h +89 -0
- package/thirdparty/miniz/miniz_export.h +20 -0
- package/thirdparty/miniz/miniz_tdef.c +1602 -0
- package/thirdparty/miniz/miniz_tdef.h +199 -0
- package/thirdparty/miniz/miniz_tinfl.c +778 -0
- package/thirdparty/miniz/miniz_tinfl.h +150 -0
- package/thirdparty/miniz/miniz_zip.c +4895 -0
- package/thirdparty/miniz/miniz_zip.h +454 -0
- package/thirdparty/miniz/readme.md +46 -0
- package/thirdparty/miniz/test.sh +36 -0
- package/thirdparty/miniz/tests/add_in_place_fuzzer.c +87 -0
- package/thirdparty/miniz/tests/catch_amalgamated.cpp +10795 -0
- package/thirdparty/miniz/tests/catch_amalgamated.hpp +13143 -0
- package/thirdparty/miniz/tests/checksum_fuzzer.c +26 -0
- package/thirdparty/miniz/tests/compress_fuzzer.c +91 -0
- package/thirdparty/miniz/tests/flush_fuzzer.c +88 -0
- package/thirdparty/miniz/tests/fuzz_main.c +55 -0
- package/thirdparty/miniz/tests/large_fuzzer.c +133 -0
- package/thirdparty/miniz/tests/main.cpp +185 -0
- package/thirdparty/miniz/tests/miniz_tdefl_fuzzer.cc +115 -0
- package/thirdparty/miniz/tests/miniz_tester.cpp +1881 -0
- package/thirdparty/miniz/tests/miniz_zip_validate_fuzzer.cc +71 -0
- package/thirdparty/miniz/tests/miniz_zip_writer_fuzzer.cc +96 -0
- package/thirdparty/miniz/tests/ossfuzz.sh +48 -0
- package/thirdparty/miniz/tests/small_fuzzer.c +126 -0
- package/thirdparty/miniz/tests/timer.cpp +152 -0
- package/thirdparty/miniz/tests/timer.h +40 -0
- package/thirdparty/miniz/tests/uncompress2_fuzzer.c +21 -0
- package/thirdparty/miniz/tests/uncompress_fuzzer.c +30 -0
- package/thirdparty/miniz/tests/zip.dict +9 -0
- package/thirdparty/miniz/tests/zip_fuzzer.c +63 -0
- package/thirdparty/pugixml/.codecov.yml +7 -0
- package/thirdparty/pugixml/.gitattributes +1 -0
- package/thirdparty/pugixml/CMakeLists.txt +330 -0
- package/thirdparty/pugixml/LICENSE.md +24 -0
- package/thirdparty/pugixml/Makefile +98 -0
- package/thirdparty/pugixml/README.md +81 -0
- package/thirdparty/pugixml/SECURITY.md +9 -0
- package/thirdparty/pugixml/appveyor.yml +50 -0
- package/thirdparty/pugixml/docs/config.adoc +7 -0
- package/thirdparty/pugixml/docs/images/dom_tree.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch3.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch4.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link2.png +0 -0
- package/thirdparty/pugixml/docs/manual.adoc +3326 -0
- package/thirdparty/pugixml/docs/manual.html +6395 -0
- package/thirdparty/pugixml/docs/quickstart.adoc +287 -0
- package/thirdparty/pugixml/docs/quickstart.html +1107 -0
- package/thirdparty/pugixml/docs/samples/character.xml +8 -0
- package/thirdparty/pugixml/docs/samples/custom_memory_management.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/include.cpp +64 -0
- package/thirdparty/pugixml/docs/samples/load_error_handling.cpp +33 -0
- package/thirdparty/pugixml/docs/samples/load_file.cpp +16 -0
- package/thirdparty/pugixml/docs/samples/load_memory.cpp +66 -0
- package/thirdparty/pugixml/docs/samples/load_options.cpp +30 -0
- package/thirdparty/pugixml/docs/samples/load_stream.cpp +97 -0
- package/thirdparty/pugixml/docs/samples/modify_add.cpp +29 -0
- package/thirdparty/pugixml/docs/samples/modify_base.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/modify_remove.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_custom_writer.cpp +116 -0
- package/thirdparty/pugixml/docs/samples/save_declaration.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_file.cpp +17 -0
- package/thirdparty/pugixml/docs/samples/save_options.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/save_stream.cpp +18 -0
- package/thirdparty/pugixml/docs/samples/save_subtree.cpp +26 -0
- package/thirdparty/pugixml/docs/samples/text.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/transitions.xml +7 -0
- package/thirdparty/pugixml/docs/samples/traverse_base.cpp +51 -0
- package/thirdparty/pugixml/docs/samples/traverse_iter.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/traverse_predicate.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/traverse_rangefor.cpp +32 -0
- package/thirdparty/pugixml/docs/samples/traverse_walker.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/tree.xml +12 -0
- package/thirdparty/pugixml/docs/samples/weekly-shift_jis.xml +78 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-16.xml +0 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-8.xml +78 -0
- package/thirdparty/pugixml/docs/samples/xgconsole.xml +12 -0
- package/thirdparty/pugixml/docs/samples/xpath_error.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/xpath_query.cpp +36 -0
- package/thirdparty/pugixml/docs/samples/xpath_select.cpp +28 -0
- package/thirdparty/pugixml/docs/samples/xpath_variables.cpp +38 -0
- package/thirdparty/pugixml/readme.txt +50 -0
- package/thirdparty/pugixml/scripts/archive.py +54 -0
- package/thirdparty/pugixml/scripts/cocoapods_push.sh +4 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml.natvis +77 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml_compact.natvis +506 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml-propertiesui.xml +17 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml.targets +28 -0
- package/thirdparty/pugixml/scripts/nuget/pugixml.nuspec +20 -0
- package/thirdparty/pugixml/scripts/nuget_build.ps1 +60 -0
- package/thirdparty/pugixml/scripts/premake4.lua +92 -0
- package/thirdparty/pugixml/scripts/pugixml-config.cmake.in +12 -0
- package/thirdparty/pugixml/scripts/pugixml.pc.in +11 -0
- package/thirdparty/pugixml/scripts/pugixml.podspec +14 -0
- package/thirdparty/pugixml/scripts/pugixml.xcodeproj/project.pbxproj +212 -0
- package/thirdparty/pugixml/scripts/pugixml_airplay.mkf +13 -0
- package/thirdparty/pugixml/scripts/pugixml_codeblocks.cbp +44 -0
- package/thirdparty/pugixml/scripts/pugixml_codelite.project +56 -0
- package/thirdparty/pugixml/scripts/pugixml_dll.rc +45 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005_static.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008_static.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010_static.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013_static.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/sbom.cdx.json +47 -0
- package/thirdparty/pugixml/src/pugiconfig.hpp +81 -0
- package/thirdparty/pugixml/src/pugixml.cpp +13776 -0
- package/thirdparty/pugixml/src/pugixml.hpp +1604 -0
- package/thirdparty/pugixml/tests/allocator.cpp +175 -0
- package/thirdparty/pugixml/tests/allocator.hpp +10 -0
- package/thirdparty/pugixml/tests/autotest-appveyor.ps1 +93 -0
- package/thirdparty/pugixml/tests/cmake-appveyor.ps1 +57 -0
- package/thirdparty/pugixml/tests/data/empty.xml +0 -0
- package/thirdparty/pugixml/tests/data/large.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_latin1.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_utf8.xml +1 -0
- package/thirdparty/pugixml/tests/data/multiline.xml +3 -0
- package/thirdparty/pugixml/tests/data/small.xml +1 -0
- package/thirdparty/pugixml/tests/data/truncation.xml +19 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_bom.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_clean.xml +84 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_nodecl.xml +86 -0
- package/thirdparty/pugixml/tests/data//321/202/320/265/321/201/321/202.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/basic.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/doctype.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/refs.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/types.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf16.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf32.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/basic.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/functions.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/math.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/path.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/predicate.xpath +1 -0
- package/thirdparty/pugixml/tests/fuzz_parse.cpp +14 -0
- package/thirdparty/pugixml/tests/fuzz_parse.dict +72 -0
- package/thirdparty/pugixml/tests/fuzz_setup.sh +11 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.cpp +46 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.dict +72 -0
- package/thirdparty/pugixml/tests/helpers.hpp +114 -0
- package/thirdparty/pugixml/tests/main.cpp +218 -0
- package/thirdparty/pugixml/tests/test.cpp +220 -0
- package/thirdparty/pugixml/tests/test.hpp +175 -0
- package/thirdparty/pugixml/tests/test_compact.cpp +150 -0
- package/thirdparty/pugixml/tests/test_deprecated.cpp +25 -0
- package/thirdparty/pugixml/tests/test_document.cpp +1910 -0
- package/thirdparty/pugixml/tests/test_dom_modify.cpp +2122 -0
- package/thirdparty/pugixml/tests/test_dom_text.cpp +601 -0
- package/thirdparty/pugixml/tests/test_dom_traverse.cpp +1481 -0
- package/thirdparty/pugixml/tests/test_header_guard.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_only_1.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_only_2.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_string_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_iostream.cpp +5 -0
- package/thirdparty/pugixml/tests/test_memory.cpp +303 -0
- package/thirdparty/pugixml/tests/test_parse.cpp +1463 -0
- package/thirdparty/pugixml/tests/test_parse_doctype.cpp +366 -0
- package/thirdparty/pugixml/tests/test_unicode.cpp +152 -0
- package/thirdparty/pugixml/tests/test_version.cpp +5 -0
- package/thirdparty/pugixml/tests/test_write.cpp +757 -0
- package/thirdparty/pugixml/tests/test_xpath.cpp +833 -0
- package/thirdparty/pugixml/tests/test_xpath_api.cpp +646 -0
- package/thirdparty/pugixml/tests/test_xpath_functions.cpp +844 -0
- package/thirdparty/pugixml/tests/test_xpath_operators.cpp +566 -0
- package/thirdparty/pugixml/tests/test_xpath_parse.cpp +428 -0
- package/thirdparty/pugixml/tests/test_xpath_paths.cpp +787 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_abbrev_w3c.cpp +219 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_w3c.cpp +312 -0
- package/thirdparty/pugixml/tests/test_xpath_variables.cpp +683 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_1.cpp +411 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_2.cpp +417 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_3.cpp +321 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_4.cpp +300 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_5.cpp +295 -0
- package/thirdparty/pugixml/tests/writer_string.cpp +79 -0
- package/thirdparty/pugixml/tests/writer_string.hpp +27 -0
- package/scripts/prepare-openxlsx.js +0 -126
|
@@ -0,0 +1,833 @@
|
|
|
1
|
+
#ifndef PUGIXML_NO_XPATH
|
|
2
|
+
|
|
3
|
+
#include "test.hpp"
|
|
4
|
+
|
|
5
|
+
#include <string.h>
|
|
6
|
+
#include <wchar.h>
|
|
7
|
+
|
|
8
|
+
#include <string>
|
|
9
|
+
#include <vector>
|
|
10
|
+
#include <algorithm>
|
|
11
|
+
#include <limits>
|
|
12
|
+
|
|
13
|
+
using namespace pugi;
|
|
14
|
+
|
|
15
|
+
static void load_document_copy(xml_document& doc, const char_t* text)
|
|
16
|
+
{
|
|
17
|
+
xml_document source;
|
|
18
|
+
CHECK(source.load_string(text));
|
|
19
|
+
|
|
20
|
+
doc.append_copy(source.first_child());
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
template <typename T>
|
|
24
|
+
static void random_shuffle(std::vector<T>& v)
|
|
25
|
+
{
|
|
26
|
+
size_t rng = 2147483647;
|
|
27
|
+
|
|
28
|
+
for (size_t i = v.size() - 1; i > 0; --i)
|
|
29
|
+
{
|
|
30
|
+
// Fisher-Yates shuffle
|
|
31
|
+
size_t j = rng % (i + 1);
|
|
32
|
+
std::swap(v[j], v[i]);
|
|
33
|
+
|
|
34
|
+
// LCG RNG, constants from Numerical Recipes
|
|
35
|
+
rng = rng * 1664525 + 1013904223;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
TEST(xpath_allocator_many_pages)
|
|
40
|
+
{
|
|
41
|
+
std::basic_string<char_t> query = STR("0");
|
|
42
|
+
|
|
43
|
+
for (int i = 0; i < 128; ++i) query += STR("+string-length('abcdefgh')");
|
|
44
|
+
|
|
45
|
+
CHECK_XPATH_NUMBER(xml_node(), query.c_str(), 1024);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
TEST(xpath_allocator_large_page)
|
|
49
|
+
{
|
|
50
|
+
std::basic_string<char_t> query;
|
|
51
|
+
|
|
52
|
+
for (int i = 0; i < 1024; ++i) query += STR("abcdefgh");
|
|
53
|
+
|
|
54
|
+
CHECK_XPATH_NUMBER(xml_node(), (STR("string-length('") + query + STR("')")).c_str(), 8192);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
TEST_XML(xpath_sort_complex, "<node><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>")
|
|
58
|
+
{
|
|
59
|
+
// just some random union order, it should not matter probably?
|
|
60
|
+
xpath_node_set ns = doc.child(STR("node")).select_nodes(STR("child1 | child2 | child1/@* | . | child2/@* | child2/text()"));
|
|
61
|
+
|
|
62
|
+
ns.sort(false);
|
|
63
|
+
xpath_node_set sorted = ns;
|
|
64
|
+
|
|
65
|
+
ns.sort(true);
|
|
66
|
+
xpath_node_set reverse_sorted = ns;
|
|
67
|
+
|
|
68
|
+
xpath_node_set_tester(sorted, "sorted order failed") % 2 % 3 % 4 % 5 % 6 % 7 % 8;
|
|
69
|
+
xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 8 % 7 % 6 % 5 % 4 % 3 % 2;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
TEST(xpath_sort_complex_copy) // copy the document so that document order optimization does not work
|
|
73
|
+
{
|
|
74
|
+
xml_document doc;
|
|
75
|
+
load_document_copy(doc, STR("<node><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>"));
|
|
76
|
+
|
|
77
|
+
// just some random union order, it should not matter probably?
|
|
78
|
+
xpath_node_set ns = doc.child(STR("node")).select_nodes(STR("child1 | child2 | child1/@* | . | child2/@* | child2/text()"));
|
|
79
|
+
|
|
80
|
+
ns.sort(false);
|
|
81
|
+
xpath_node_set sorted = ns;
|
|
82
|
+
|
|
83
|
+
ns.sort(true);
|
|
84
|
+
xpath_node_set reverse_sorted = ns;
|
|
85
|
+
|
|
86
|
+
xpath_node_set_tester(sorted, "sorted order failed") % 2 % 3 % 4 % 5 % 6 % 7 % 8;
|
|
87
|
+
xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 8 % 7 % 6 % 5 % 4 % 3 % 2;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
TEST_XML(xpath_sort_children, "<node><child><subchild id='1'/></child><child><subchild id='2'/></child></node>")
|
|
91
|
+
{
|
|
92
|
+
xpath_node_set ns = doc.child(STR("node")).select_nodes(STR("child/subchild[@id=1] | child/subchild[@id=2]"));
|
|
93
|
+
|
|
94
|
+
ns.sort(false);
|
|
95
|
+
xpath_node_set sorted = ns;
|
|
96
|
+
|
|
97
|
+
ns.sort(true);
|
|
98
|
+
xpath_node_set reverse_sorted = ns;
|
|
99
|
+
|
|
100
|
+
xpath_node_set_tester(sorted, "sorted order failed") % 4 % 7;
|
|
101
|
+
xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 7 % 4;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
TEST(xpath_sort_children_copy) // copy the document so that document order optimization does not work
|
|
105
|
+
{
|
|
106
|
+
xml_document doc;
|
|
107
|
+
load_document_copy(doc, STR("<node><child><subchild id='1'/></child><child><subchild id='2'/></child></node>"));
|
|
108
|
+
|
|
109
|
+
xpath_node_set ns = doc.child(STR("node")).select_nodes(STR("child/subchild[@id=1] | child/subchild[@id=2]"));
|
|
110
|
+
|
|
111
|
+
ns.sort(false);
|
|
112
|
+
xpath_node_set sorted = ns;
|
|
113
|
+
|
|
114
|
+
ns.sort(true);
|
|
115
|
+
xpath_node_set reverse_sorted = ns;
|
|
116
|
+
|
|
117
|
+
xpath_node_set_tester(sorted, "sorted order failed") % 4 % 7;
|
|
118
|
+
xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 7 % 4;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
TEST_XML(xpath_sort_attributes, "<node/>")
|
|
122
|
+
{
|
|
123
|
+
xml_node n = doc.child(STR("node"));
|
|
124
|
+
|
|
125
|
+
// we need to insert attributes manually since unsorted node sets are (always?) sorted via pointers because of remove_duplicates,
|
|
126
|
+
// so we need to have different document and pointer order to cover all comparator cases
|
|
127
|
+
n.append_attribute(STR("attr2"));
|
|
128
|
+
n.append_attribute(STR("attr3"));
|
|
129
|
+
n.insert_attribute_before(STR("attr1"), n.attribute(STR("attr2")));
|
|
130
|
+
|
|
131
|
+
xpath_node_set ns = n.select_nodes(STR("@* | @*"));
|
|
132
|
+
|
|
133
|
+
ns.sort(true);
|
|
134
|
+
xpath_node_set reverse_sorted = ns;
|
|
135
|
+
|
|
136
|
+
ns.sort(false);
|
|
137
|
+
xpath_node_set sorted = ns;
|
|
138
|
+
|
|
139
|
+
xpath_node_set_tester(sorted, "sorted order failed") % 3 % 4 % 5;
|
|
140
|
+
xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 5 % 4 % 3;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
TEST_XML(xpath_sort_attributes_docorder, "<node attr1='' attr2='value' attr4='value' />")
|
|
144
|
+
{
|
|
145
|
+
xml_node n = doc.child(STR("node"));
|
|
146
|
+
|
|
147
|
+
n.first_attribute().set_name(STR("attribute1"));
|
|
148
|
+
n.insert_attribute_after(STR("attr3"), n.attribute(STR("attr2")));
|
|
149
|
+
|
|
150
|
+
xpath_node_set ns = n.select_nodes(STR("@* | @*"));
|
|
151
|
+
|
|
152
|
+
ns.sort(true);
|
|
153
|
+
xpath_node_set reverse_sorted = ns;
|
|
154
|
+
|
|
155
|
+
ns.sort(false);
|
|
156
|
+
xpath_node_set sorted = ns;
|
|
157
|
+
|
|
158
|
+
xpath_node_set_tester(sorted, "sorted order failed") % 3 % 4 % 5 % 6;
|
|
159
|
+
xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 6 % 5 % 4 % 3;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
TEST(xpath_sort_random_medium)
|
|
163
|
+
{
|
|
164
|
+
xml_document doc;
|
|
165
|
+
load_document_copy(doc, STR("<node>")
|
|
166
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
167
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
168
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
169
|
+
STR("</node>"));
|
|
170
|
+
|
|
171
|
+
xpath_node_set ns = doc.select_nodes(STR("//node() | //@*"));
|
|
172
|
+
|
|
173
|
+
std::vector<xpath_node> nsv(ns.begin(), ns.end());
|
|
174
|
+
random_shuffle(nsv);
|
|
175
|
+
|
|
176
|
+
xpath_node_set copy(&nsv[0], &nsv[0] + nsv.size());
|
|
177
|
+
copy.sort();
|
|
178
|
+
|
|
179
|
+
xpath_node_set_tester tester(copy, "sorted order failed");
|
|
180
|
+
|
|
181
|
+
for (unsigned int i = 2; i < 39; ++i) tester % i;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
TEST(xpath_sort_random_large)
|
|
185
|
+
{
|
|
186
|
+
xml_document doc;
|
|
187
|
+
load_document_copy(doc, STR("<node>")
|
|
188
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
189
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
190
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
191
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
192
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
193
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
194
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
195
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
196
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
197
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>")
|
|
198
|
+
STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>"));
|
|
199
|
+
|
|
200
|
+
xpath_node_set ns = doc.select_nodes(STR("//node() | //@*"));
|
|
201
|
+
|
|
202
|
+
std::vector<xpath_node> nsv(ns.begin(), ns.end());
|
|
203
|
+
random_shuffle(nsv);
|
|
204
|
+
|
|
205
|
+
xpath_node_set copy(&nsv[0], &nsv[0] + nsv.size());
|
|
206
|
+
copy.sort();
|
|
207
|
+
|
|
208
|
+
xpath_node_set_tester tester(copy, "sorted order failed");
|
|
209
|
+
|
|
210
|
+
for (unsigned int i = 2; i < 129; ++i) tester % i;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
TEST_XML(xpath_sort_coverage, "<node><a/><b/></node>")
|
|
214
|
+
{
|
|
215
|
+
xml_node a = doc.child(STR("node")).child(STR("a"));
|
|
216
|
+
xml_node b = doc.child(STR("node")).child(STR("b"));
|
|
217
|
+
|
|
218
|
+
xpath_node nodes[17];
|
|
219
|
+
for (size_t i = 0; i < sizeof(nodes) / sizeof(nodes[0]); ++i)
|
|
220
|
+
nodes[i] = (i == 0 || i == 8 || i == 16) ? a : b;
|
|
221
|
+
|
|
222
|
+
xpath_node_set ns(nodes, nodes + sizeof(nodes) / sizeof(nodes[0]), xpath_node_set::type_unsorted);
|
|
223
|
+
ns.sort();
|
|
224
|
+
|
|
225
|
+
CHECK(ns.type() == xpath_node_set::type_sorted);
|
|
226
|
+
|
|
227
|
+
for (size_t i = 0; i < ns.size(); ++i)
|
|
228
|
+
CHECK(ns[i].node() == (i < 3 ? a : b));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
TEST(xpath_long_numbers_parse)
|
|
232
|
+
{
|
|
233
|
+
const char_t* str_flt_max = STR("340282346638528860000000000000000000000");
|
|
234
|
+
const char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000");
|
|
235
|
+
|
|
236
|
+
const char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
|
237
|
+
const char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000");
|
|
238
|
+
|
|
239
|
+
xml_node c;
|
|
240
|
+
|
|
241
|
+
// check parsing
|
|
242
|
+
CHECK_XPATH_NUMBER(c, str_flt_max, double(std::numeric_limits<float>::max()));
|
|
243
|
+
CHECK_XPATH_NUMBER(c, str_flt_max_dec, double(std::numeric_limits<float>::max()));
|
|
244
|
+
CHECK_XPATH_NUMBER(c, str_dbl_max, std::numeric_limits<double>::max());
|
|
245
|
+
CHECK_XPATH_NUMBER(c, str_dbl_max_dec, std::numeric_limits<double>::max());
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
static bool test_xpath_string_prefix(const xml_node& node, const char_t* query, const char_t* expected, size_t match_length)
|
|
249
|
+
{
|
|
250
|
+
xpath_query q(query);
|
|
251
|
+
|
|
252
|
+
char_t result[32];
|
|
253
|
+
size_t size = q.evaluate_string(result, sizeof(result) / sizeof(result[0]), node);
|
|
254
|
+
|
|
255
|
+
size_t expected_length = std::char_traits<char_t>::length(expected);
|
|
256
|
+
|
|
257
|
+
return size == expected_length + 1 && std::char_traits<char_t>::compare(result, expected, match_length) == 0;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
TEST(xpath_long_numbers_stringize)
|
|
261
|
+
{
|
|
262
|
+
const char_t* str_flt_max = STR("340282346638528860000000000000000000000");
|
|
263
|
+
const char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000");
|
|
264
|
+
|
|
265
|
+
const char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
|
266
|
+
const char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000");
|
|
267
|
+
|
|
268
|
+
xml_node c;
|
|
269
|
+
|
|
270
|
+
CHECK(test_xpath_string_prefix(c, str_flt_max, str_flt_max, 15));
|
|
271
|
+
CHECK(test_xpath_string_prefix(c, str_flt_max_dec, str_flt_max, 15));
|
|
272
|
+
|
|
273
|
+
CHECK(test_xpath_string_prefix(c, str_dbl_max, str_dbl_max, 15));
|
|
274
|
+
CHECK(test_xpath_string_prefix(c, str_dbl_max_dec, str_dbl_max, 15));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
TEST(xpath_denorm_numbers)
|
|
278
|
+
{
|
|
279
|
+
std::basic_string<char_t> query;
|
|
280
|
+
|
|
281
|
+
// 10^-318 - double denormal
|
|
282
|
+
for (int i = 0; i < 106; ++i)
|
|
283
|
+
{
|
|
284
|
+
if (i != 0) query += STR(" * ");
|
|
285
|
+
query += STR("0.001");
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// check if current fpu setup supports denormals
|
|
289
|
+
double denorm = xpath_query(query.c_str()).evaluate_number(xml_node());
|
|
290
|
+
|
|
291
|
+
if (denorm != 0.0)
|
|
292
|
+
{
|
|
293
|
+
CHECK_XPATH_STRING(xml_node(), query.c_str(), STR("0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009999987484955998"));
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
TEST_XML(xpath_rexml_1, "<a><b><c id='a'/></b><c id='b'/></a>")
|
|
298
|
+
{
|
|
299
|
+
CHECK_XPATH_NODESET(doc, STR("//*[local-name()='c' and @id='b']")) % 6;
|
|
300
|
+
CHECK_XPATH_NODESET(doc, STR("//*[ local-name()='c' and @id='b' ]")) % 6;
|
|
301
|
+
CHECK_XPATH_NODESET(doc, STR("/a/c[@id]")) % 6;
|
|
302
|
+
CHECK_XPATH_NODESET(doc, STR("/a/c[(@id)]")) % 6;
|
|
303
|
+
CHECK_XPATH_NODESET(doc, STR("/a/c[ @id ]")) % 6;
|
|
304
|
+
CHECK_XPATH_NODESET(doc, STR("/a/c[ (@id) ]")) % 6;
|
|
305
|
+
CHECK_XPATH_NODESET(doc, STR("/a/c[( @id )]")) % 6;
|
|
306
|
+
CHECK_XPATH_NODESET(doc, STR("/a/c[ ( @id ) ]")) % 6;
|
|
307
|
+
CHECK_XPATH_NODESET(doc, STR("/a/c [ ( @id ) ] ")) % 6;
|
|
308
|
+
CHECK_XPATH_NODESET(doc, STR(" / a / c [ ( @id ) ] ")) % 6;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
TEST_XML(xpath_rexml_2, "<a:x xmlns:a='1'><a:y p='p' q='q'><a:z>zzz</a:z></a:y></a:x>")
|
|
312
|
+
{
|
|
313
|
+
CHECK_XPATH_NODESET(doc, STR("a:x/a:y[@p='p' and @q='q']/a:z/text()")) % 8;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
TEST_XML(xpath_rexml_3, "<article><section role='subdivision' id='1'><para>free flowing text.</para></section><section role='division'><section role='subdivision' id='2'><para>free flowing text.</para></section><section role='division'><para>free flowing text.</para></section></section></article>")
|
|
317
|
+
{
|
|
318
|
+
CHECK_XPATH_NODESET(doc, STR("//section[../self::section[@role=\"division\"]]")) % 10 % 15;
|
|
319
|
+
CHECK_XPATH_NODESET(doc, STR("//section[@role=\"subdivision\" and not(../self::section[@role=\"division\"])]")) % 3;
|
|
320
|
+
CHECK_XPATH_NODESET(doc, STR("//section[@role=\"subdivision\"][not(../self::section[@role=\"division\"])]")) % 3;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
TEST_XML_FLAGS(xpath_rexml_4, "<a><b number='1' str='abc'>TEXT1</b><c number='1'/><c number='2' str='def'><b number='3'/><d number='1' str='abc'>TEXT2</d><b number='2'><!--COMMENT--></b></c></a>", parse_default | parse_comments)
|
|
324
|
+
{
|
|
325
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant-or-self::node()[count(child::node()|following-sibling::node()|preceding-sibling::node())=0]")) % 6 % 17 % 20;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
TEST_XML(xpath_rexml_5, "<a><b><c id='a'/></b><c id='b'/></a>")
|
|
329
|
+
{
|
|
330
|
+
CHECK_XPATH_FAIL(STR(".//[@id]"));
|
|
331
|
+
CHECK_XPATH_NODESET(doc, STR(".//self::*[@id]")) % 4 % 6;
|
|
332
|
+
CHECK_XPATH_NODESET(doc, STR(".//node()[@id]")) % 4 % 6;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
TEST_XML(xpath_rexml_6, "<div><span><strong>a</strong></span><em>b</em></div>")
|
|
336
|
+
{
|
|
337
|
+
CHECK_XPATH_NODESET(doc, STR("//em|//strong")) % 4 % 6;
|
|
338
|
+
CHECK_XPATH_NODESET(doc, STR("//*[self::em | self::strong]")) % 4 % 6;
|
|
339
|
+
CHECK_XPATH_NODESET(doc, STR("//*[name()=\"em\" or name()=\"strong\"]")) % 4 % 6;
|
|
340
|
+
CHECK_XPATH_NODESET(doc, STR("//*[self::em or self::strong]")) % 4 % 6;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
TEST_XML(xpath_xsl_list_1, "<input><type>whatever</type></input><input><type>text</type></input><input><type>select</type></input><input><type>something</type></input>")
|
|
344
|
+
{
|
|
345
|
+
// if I'm not last, and the next input/type isn't select
|
|
346
|
+
CHECK_XPATH_NODESET(doc, STR("input[type[parent::input/following-sibling::input[1]/type != 'select']]")) % 2 % 8;
|
|
347
|
+
CHECK_XPATH_NODESET(doc, STR("input[type[../following-sibling::input[1]/type != 'select']]")) % 2 % 8;
|
|
348
|
+
|
|
349
|
+
CHECK_XPATH_NODESET(doc, STR("input[position()+1]"));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
TEST_XML(xpath_xsl_list_2, "<TR><TD id='1'>text1</TD><TD id='2'>text2</TD><TD id='3'>text3</TD><TD id='4'>text4</TD></TR>")
|
|
353
|
+
{
|
|
354
|
+
CHECK_XPATH_FAIL(STR(".[not(.=ancestor::TR/TD[15]/node())]"));
|
|
355
|
+
|
|
356
|
+
CHECK_XPATH_NODESET(doc.child(STR("TR")).find_child_by_attribute(STR("TD"), STR("id"), STR("1")).first_child(), STR("self::node()[not(.=ancestor::TR/TD[3]/node())]")) % 5;
|
|
357
|
+
CHECK_XPATH_NODESET(doc.child(STR("TR")).find_child_by_attribute(STR("TD"), STR("id"), STR("2")).first_child(), STR("self::node()[not(.=ancestor::TR/TD[3]/node())]")) % 8;
|
|
358
|
+
CHECK_XPATH_NODESET(doc.child(STR("TR")).find_child_by_attribute(STR("TD"), STR("id"), STR("3")).first_child(), STR("self::node()[not(.=ancestor::TR/TD[3]/node())]"));
|
|
359
|
+
CHECK_XPATH_NODESET(doc.child(STR("TR")).find_child_by_attribute(STR("TD"), STR("id"), STR("4")).first_child(), STR("self::node()[not(.=ancestor::TR/TD[3]/node())]")) % 14;
|
|
360
|
+
|
|
361
|
+
CHECK_XPATH_NODESET(doc.child(STR("TR")).find_child_by_attribute(STR("TD"), STR("id"), STR("1")), STR("node()[not(.=ancestor::TR/TD[3]/node())]")) % 5;
|
|
362
|
+
CHECK_XPATH_NODESET(doc.child(STR("TR")).find_child_by_attribute(STR("TD"), STR("id"), STR("2")), STR("node()[not(.=ancestor::TR/TD[3]/node())]")) % 8;
|
|
363
|
+
CHECK_XPATH_NODESET(doc.child(STR("TR")).find_child_by_attribute(STR("TD"), STR("id"), STR("3")), STR("node()[not(.=ancestor::TR/TD[3]/node())]"));
|
|
364
|
+
CHECK_XPATH_NODESET(doc.child(STR("TR")).find_child_by_attribute(STR("TD"), STR("id"), STR("4")), STR("node()[not(.=ancestor::TR/TD[3]/node())]")) % 14;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
TEST_XML(xpath_star_token, "<node>0.5<section><child/><child/><child/><child/></section><section/></node>")
|
|
368
|
+
{
|
|
369
|
+
CHECK_XPATH_NODESET(doc, STR("//*[/* * 4]")) % 6 % 9;
|
|
370
|
+
CHECK_XPATH_NODESET(doc, STR("//*[/**4]")) % 6 % 9;
|
|
371
|
+
CHECK_XPATH_FAIL(STR("//*[/***4]"));
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
TEST(xpath_miscellaneous)
|
|
375
|
+
{
|
|
376
|
+
CHECK_XPATH_FAIL(STR("/root/child[a=3]/substring(child::text())"));
|
|
377
|
+
CHECK_XPATH_NODESET(xml_node(), STR("foo/@FOO/@bar"));
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
TEST_XML(xpath_context_node, "<node>5</node>")
|
|
381
|
+
{
|
|
382
|
+
CHECK_XPATH_NODESET(doc, STR("node")) % 2;
|
|
383
|
+
CHECK_XPATH_BOOLEAN(doc, STR("node"), true);
|
|
384
|
+
CHECK_XPATH_NUMBER(doc, STR("node"), 5);
|
|
385
|
+
CHECK_XPATH_STRING(doc, STR("node"), STR("5"));
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
TEST_XML(xpath_context_position, "<node>5</node>")
|
|
389
|
+
{
|
|
390
|
+
CHECK_XPATH_NODESET(doc, STR("id(position() + last())"));
|
|
391
|
+
CHECK_XPATH_BOOLEAN(doc, STR("position() + last() = 2"), true);
|
|
392
|
+
CHECK_XPATH_NUMBER(doc, STR("position() + last()"), 2);
|
|
393
|
+
CHECK_XPATH_STRING(doc, STR("position() + last()"), STR("2"));
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
TEST(xpath_lexer_unknown_lexeme)
|
|
397
|
+
{
|
|
398
|
+
CHECK_XPATH_FAIL(STR("(^3))"));
|
|
399
|
+
CHECK_XPATH_FAIL(STR("(!3))"));
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
TEST(xpath_large_node_set)
|
|
403
|
+
{
|
|
404
|
+
xml_document doc;
|
|
405
|
+
CHECK(doc.load_file("tests/data/large.xml"));
|
|
406
|
+
|
|
407
|
+
xpath_node_set ns = doc.select_nodes(STR("//*"));
|
|
408
|
+
|
|
409
|
+
CHECK(ns.size() == 10001);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
TEST(xpath_out_of_memory_query)
|
|
413
|
+
{
|
|
414
|
+
test_runner::_memory_fail_threshold = 1;
|
|
415
|
+
|
|
416
|
+
CHECK_ALLOC_FAIL(xpath_query q(STR("node")));
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
TEST_XML(xpath_out_of_memory_evaluate, "<n/>")
|
|
420
|
+
{
|
|
421
|
+
test_runner::_memory_fail_threshold = 4196 * sizeof(char_t) + 4096 * 2 + 32768;
|
|
422
|
+
|
|
423
|
+
std::basic_string<char_t> query = STR("*[concat(\"a\", \"");
|
|
424
|
+
|
|
425
|
+
query.resize(4196, 'a');
|
|
426
|
+
query += STR("\")]");
|
|
427
|
+
|
|
428
|
+
xpath_query q(query.c_str());
|
|
429
|
+
|
|
430
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_boolean(doc) == false));
|
|
431
|
+
CHECK_ALLOC_FAIL(CHECK_DOUBLE_NAN(q.evaluate_number(doc)));
|
|
432
|
+
|
|
433
|
+
#ifndef PUGIXML_NO_STL
|
|
434
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(doc).empty()));
|
|
435
|
+
#endif
|
|
436
|
+
|
|
437
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
|
|
438
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node(doc) == xpath_node()));
|
|
439
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc).empty()));
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
TEST(xpath_out_of_memory_evaluate_concat)
|
|
443
|
+
{
|
|
444
|
+
test_runner::_memory_fail_threshold = 4196 * sizeof(char_t) + 4096 * 2;
|
|
445
|
+
|
|
446
|
+
std::basic_string<char_t> query = STR("concat(\"a\", \"");
|
|
447
|
+
|
|
448
|
+
query.resize(4196, 'a');
|
|
449
|
+
query += STR("\")");
|
|
450
|
+
|
|
451
|
+
xpath_query q(query.c_str());
|
|
452
|
+
|
|
453
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
TEST(xpath_out_of_memory_evaluate_concat_list)
|
|
457
|
+
{
|
|
458
|
+
std::basic_string<char_t> query = STR("concat(");
|
|
459
|
+
|
|
460
|
+
for (size_t i = 0; i < 500; ++i)
|
|
461
|
+
query += STR("\"\",");
|
|
462
|
+
|
|
463
|
+
query += STR("\"\")");
|
|
464
|
+
|
|
465
|
+
xpath_query q(query.c_str());
|
|
466
|
+
|
|
467
|
+
test_runner::_memory_fail_threshold = 1;
|
|
468
|
+
|
|
469
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
TEST(xpath_out_of_memory_evaluate_substring)
|
|
473
|
+
{
|
|
474
|
+
test_runner::_memory_fail_threshold = 4196 * sizeof(char_t) + 4096 * 2;
|
|
475
|
+
|
|
476
|
+
std::basic_string<char_t> query = STR("substring(\"");
|
|
477
|
+
|
|
478
|
+
query.resize(4196, 'a');
|
|
479
|
+
query += STR("\", 1, 4097)");
|
|
480
|
+
|
|
481
|
+
xpath_query q(query.c_str());
|
|
482
|
+
|
|
483
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
TEST_XML(xpath_out_of_memory_evaluate_union, "<node />")
|
|
487
|
+
{
|
|
488
|
+
// left hand side: size * sizeof(xpath_node) (8 on 32-bit, 16 on 64-bit)
|
|
489
|
+
// right hand side: same
|
|
490
|
+
// to make sure that when we append right hand side to left hand side, we run out of an XPath stack page (4K), we need slightly more than 2K/8 = 256 nodes on 32-bit, 128 nodes on 64-bit
|
|
491
|
+
size_t count = sizeof(void*) == 4 ? 300 : 150;
|
|
492
|
+
|
|
493
|
+
for (size_t i = 0; i < count; ++i)
|
|
494
|
+
doc.first_child().append_child(STR("a"));
|
|
495
|
+
|
|
496
|
+
xpath_query q(STR("a|a"));
|
|
497
|
+
|
|
498
|
+
test_runner::_memory_fail_threshold = 1;
|
|
499
|
+
|
|
500
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc.child(STR("node"))).empty()));
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
TEST_XML(xpath_out_of_memory_evaluate_union_hash, "<node />")
|
|
504
|
+
{
|
|
505
|
+
// left hand side: size * sizeof(xpath_node) (8 on 32-bit, 16 on 64-bit)
|
|
506
|
+
// right hand side: same
|
|
507
|
+
// hash table: size * 1.5 * sizeof(void*)
|
|
508
|
+
// to make sure that when we append right hand side to left hand side, we do *not* run out of an XPath stack page (4K), we need slightly less than 2K/8 = 256 nodes on 32-bit, 128 nodes on 64-bit
|
|
509
|
+
size_t count = sizeof(void*) == 4 ? 200 : 100;
|
|
510
|
+
|
|
511
|
+
for (size_t i = 0; i < count; ++i)
|
|
512
|
+
doc.first_child().append_child(STR("a"));
|
|
513
|
+
|
|
514
|
+
xpath_query q(STR("a|a"));
|
|
515
|
+
|
|
516
|
+
test_runner::_memory_fail_threshold = 1;
|
|
517
|
+
|
|
518
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc.child(STR("node"))).empty()));
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
TEST_XML(xpath_out_of_memory_evaluate_predicate, "<node><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/></node>")
|
|
523
|
+
{
|
|
524
|
+
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
|
525
|
+
|
|
526
|
+
xpath_query q(STR("//a[//a[//a[//a[true()]]]]"));
|
|
527
|
+
|
|
528
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc).empty()));
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
TEST_XML(xpath_out_of_memory_evaluate_normalize_space_0, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
|
|
532
|
+
{
|
|
533
|
+
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
|
534
|
+
|
|
535
|
+
xpath_query q(STR("concat(normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space())"));
|
|
536
|
+
|
|
537
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc.first_child()) == 1));
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
TEST_XML(xpath_out_of_memory_evaluate_normalize_space_1, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
|
|
541
|
+
{
|
|
542
|
+
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
|
543
|
+
|
|
544
|
+
xpath_query q(STR("concat(normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node))"));
|
|
545
|
+
|
|
546
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
TEST_XML(xpath_out_of_memory_evaluate_translate, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
|
|
550
|
+
{
|
|
551
|
+
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
|
552
|
+
|
|
553
|
+
xpath_query q(STR("concat(translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'))"));
|
|
554
|
+
|
|
555
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
TEST_XML(xpath_out_of_memory_evaluate_translate_table, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
|
|
559
|
+
{
|
|
560
|
+
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
|
561
|
+
|
|
562
|
+
xpath_query q(STR("concat(translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'))"));
|
|
563
|
+
|
|
564
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
TEST(xpath_out_of_memory_evaluate_string_append)
|
|
568
|
+
{
|
|
569
|
+
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
|
570
|
+
|
|
571
|
+
std::basic_string<char_t> literal(5000, 'a');
|
|
572
|
+
|
|
573
|
+
std::basic_string<char_t> buf;
|
|
574
|
+
buf += STR("<n><c>text</c><c>");
|
|
575
|
+
buf += literal;
|
|
576
|
+
buf += STR("</c></n>");
|
|
577
|
+
|
|
578
|
+
xml_document doc;
|
|
579
|
+
CHECK(doc.load_buffer_inplace(&buf[0], buf.size() * sizeof(char_t)));
|
|
580
|
+
|
|
581
|
+
xpath_query q(STR("string(n)"));
|
|
582
|
+
CHECK(q);
|
|
583
|
+
|
|
584
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
TEST(xpath_out_of_memory_evaluate_number_to_string)
|
|
588
|
+
{
|
|
589
|
+
test_runner::_memory_fail_threshold = 4096 + 128;
|
|
590
|
+
|
|
591
|
+
xpath_variable_set vars;
|
|
592
|
+
vars.set(STR("x"), 1e+308);
|
|
593
|
+
|
|
594
|
+
xpath_query q(STR("concat($x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x)"), &vars);
|
|
595
|
+
|
|
596
|
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
TEST(xpath_memory_concat_massive)
|
|
600
|
+
{
|
|
601
|
+
xml_document doc;
|
|
602
|
+
xml_node node = doc.append_child(STR("node"));
|
|
603
|
+
|
|
604
|
+
for (int i = 0; i < 5000; ++i)
|
|
605
|
+
node.append_child(STR("c")).text().set(i % 10);
|
|
606
|
+
|
|
607
|
+
xpath_query q(STR("/"));
|
|
608
|
+
size_t size = q.evaluate_string(0, 0, node);
|
|
609
|
+
|
|
610
|
+
CHECK(size == 5001);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
TEST_XML(xpath_memory_translate_table, "<node>a</node>")
|
|
614
|
+
{
|
|
615
|
+
test_runner::_memory_fail_threshold = 32768 + 4096 + 128;
|
|
616
|
+
|
|
617
|
+
// 128b per table => we need 32+ translate calls to exhaust a page
|
|
618
|
+
std::basic_string<char_t> query = STR("concat(");
|
|
619
|
+
for (int i = 0; i < 64; ++i)
|
|
620
|
+
query += STR("translate(.,'a','A'),");
|
|
621
|
+
query += STR("'')");
|
|
622
|
+
|
|
623
|
+
CHECK_ALLOC_FAIL(CHECK(!xpath_query(query.c_str())));
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
TEST_XML(xpath_sort_copy_share, "<node><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>")
|
|
627
|
+
{
|
|
628
|
+
// copy sharing shares the name/value data for nodes that can potentially make document order optimization invalid (silently)
|
|
629
|
+
xml_node node = doc.child(STR("node"));
|
|
630
|
+
xml_node child1 = node.child(STR("child1"));
|
|
631
|
+
xml_node child2 = node.child(STR("child2"));
|
|
632
|
+
|
|
633
|
+
// swap child1 & child2
|
|
634
|
+
node.prepend_copy(child2);
|
|
635
|
+
node.append_copy(child1);
|
|
636
|
+
|
|
637
|
+
node.remove_child(child1);
|
|
638
|
+
node.remove_child(child2);
|
|
639
|
+
|
|
640
|
+
// just some random union order, it should not matter probably?
|
|
641
|
+
xpath_node_set ns = doc.child(STR("node")).select_nodes(STR("child1 | child2 | child1/@* | . | child2/@* | child2/text()"));
|
|
642
|
+
|
|
643
|
+
ns.sort(false);
|
|
644
|
+
xpath_node_set sorted = ns;
|
|
645
|
+
|
|
646
|
+
ns.sort(true);
|
|
647
|
+
xpath_node_set reverse_sorted = ns;
|
|
648
|
+
|
|
649
|
+
xpath_node_set_tester(sorted, "sorted order failed") % 2 % 3 % 4 % 5 % 6 % 7 % 8;
|
|
650
|
+
xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 8 % 7 % 6 % 5 % 4 % 3 % 2;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
TEST_XML(xpath_sort_move_share, "<node><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>")
|
|
654
|
+
{
|
|
655
|
+
// moving changes the relation between name/value data and document order, this can potentially make document order optimization invalid (silently)
|
|
656
|
+
xml_node node = doc.child(STR("node"));
|
|
657
|
+
xml_node child1 = node.child(STR("child1"));
|
|
658
|
+
xml_node child2 = node.child(STR("child2"));
|
|
659
|
+
|
|
660
|
+
// swap child1 & child2
|
|
661
|
+
node.prepend_move(child2);
|
|
662
|
+
node.append_move(child1);
|
|
663
|
+
|
|
664
|
+
// just some random union order, it should not matter probably?
|
|
665
|
+
xpath_node_set ns = doc.child(STR("node")).select_nodes(STR("child1 | child2 | child1/@* | . | child2/@* | child2/text()"));
|
|
666
|
+
|
|
667
|
+
ns.sort(false);
|
|
668
|
+
xpath_node_set sorted = ns;
|
|
669
|
+
|
|
670
|
+
ns.sort(true);
|
|
671
|
+
xpath_node_set reverse_sorted = ns;
|
|
672
|
+
|
|
673
|
+
xpath_node_set_tester(sorted, "sorted order failed") % 2 % 3 % 4 % 5 % 6 % 7 % 8;
|
|
674
|
+
xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 8 % 7 % 6 % 5 % 4 % 3 % 2;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
TEST_XML(xpath_sort_append_buffer, "<node /><node />")
|
|
678
|
+
{
|
|
679
|
+
// append_buffer changes the relation between name/value data and document order, this can potentially make document order optimization invalid (silently)
|
|
680
|
+
const char* child1 = "<child1 attr1='value1' attr2='value2'/>";
|
|
681
|
+
const char* child2 = "<child2 attr1='value1'>test </child2>";
|
|
682
|
+
|
|
683
|
+
doc.last_child().append_buffer(child2, strlen(child2));
|
|
684
|
+
doc.first_child().append_buffer(child1, strlen(child1));
|
|
685
|
+
|
|
686
|
+
// just some random union order, it should not matter probably?
|
|
687
|
+
xpath_node_set ns = doc.select_nodes(STR("node/child1 | node/child2 | node/child1/@* | node/. | node/child2/@* | node/child2/text()"));
|
|
688
|
+
|
|
689
|
+
ns.sort(false);
|
|
690
|
+
xpath_node_set sorted = ns;
|
|
691
|
+
|
|
692
|
+
ns.sort(true);
|
|
693
|
+
xpath_node_set reverse_sorted = ns;
|
|
694
|
+
|
|
695
|
+
xpath_node_set_tester(sorted, "sorted order failed") % 2 % 3 % 4 % 5 % 6 % 7 % 8 % 9;
|
|
696
|
+
xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 9 % 8 % 7 % 6 % 5 % 4 % 3 % 2;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
TEST(xpath_sort_crossdoc)
|
|
700
|
+
{
|
|
701
|
+
xml_document doc1;
|
|
702
|
+
CHECK(doc1.load_string(STR("<node />")));
|
|
703
|
+
|
|
704
|
+
xml_document doc2;
|
|
705
|
+
CHECK(doc2.load_string(STR("<node />")));
|
|
706
|
+
|
|
707
|
+
xpath_node_set ns1 = doc1.select_nodes(STR("*"));
|
|
708
|
+
CHECK(ns1.size() == 1);
|
|
709
|
+
|
|
710
|
+
xpath_node_set ns2 = doc2.select_nodes(STR("*"));
|
|
711
|
+
CHECK(ns2.size() == 1);
|
|
712
|
+
|
|
713
|
+
xpath_variable_set set;
|
|
714
|
+
set.set(STR("ns1"), ns1);
|
|
715
|
+
set.set(STR("ns2"), ns2);
|
|
716
|
+
|
|
717
|
+
xpath_node_set ns = xpath_query(STR("$ns1 | $ns2"), &set).evaluate_node_set(xpath_node());
|
|
718
|
+
|
|
719
|
+
ns.sort();
|
|
720
|
+
|
|
721
|
+
CHECK(ns.size() == 2);
|
|
722
|
+
CHECK((ns[0] == ns1[0] && ns[1] == ns2[0]) || (ns[0] == ns2[0] && ns[1] == ns1[0]));
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
TEST(xpath_sort_crossdoc_dynamic)
|
|
726
|
+
{
|
|
727
|
+
xml_document doc1;
|
|
728
|
+
doc1.append_child(STR("node"));
|
|
729
|
+
|
|
730
|
+
xml_document doc2;
|
|
731
|
+
doc2.append_child(STR("node"));
|
|
732
|
+
|
|
733
|
+
xpath_node_set ns1 = doc1.select_nodes(STR("*"));
|
|
734
|
+
CHECK(ns1.size() == 1);
|
|
735
|
+
|
|
736
|
+
xpath_node_set ns2 = doc2.select_nodes(STR("*"));
|
|
737
|
+
CHECK(ns2.size() == 1);
|
|
738
|
+
|
|
739
|
+
xpath_variable_set set;
|
|
740
|
+
set.set(STR("ns1"), ns1);
|
|
741
|
+
set.set(STR("ns2"), ns2);
|
|
742
|
+
|
|
743
|
+
xpath_node_set ns = xpath_query(STR("$ns1 | $ns2"), &set).evaluate_node_set(xpath_node());
|
|
744
|
+
|
|
745
|
+
ns.sort();
|
|
746
|
+
|
|
747
|
+
CHECK(ns.size() == 2);
|
|
748
|
+
CHECK((ns[0] == ns1[0] && ns[1] == ns2[0]) || (ns[0] == ns2[0] && ns[1] == ns1[0]));
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
TEST(xpath_sort_crossdoc_different_depth)
|
|
752
|
+
{
|
|
753
|
+
xml_document doc1;
|
|
754
|
+
doc1.append_child(STR("node"));
|
|
755
|
+
|
|
756
|
+
xml_document doc2;
|
|
757
|
+
doc2.append_child(STR("node")).append_child(STR("node"));
|
|
758
|
+
|
|
759
|
+
xpath_node_set ns1 = doc1.select_nodes(STR("*"));
|
|
760
|
+
CHECK(ns1.size() == 1);
|
|
761
|
+
|
|
762
|
+
xpath_node_set ns2 = doc2.select_nodes(STR("*/*"));
|
|
763
|
+
CHECK(ns2.size() == 1);
|
|
764
|
+
|
|
765
|
+
xpath_variable_set set;
|
|
766
|
+
set.set(STR("ns1"), ns1);
|
|
767
|
+
set.set(STR("ns2"), ns2);
|
|
768
|
+
|
|
769
|
+
xpath_node_set ns = xpath_query(STR("$ns1 | $ns2"), &set).evaluate_node_set(xpath_node());
|
|
770
|
+
|
|
771
|
+
ns.sort();
|
|
772
|
+
|
|
773
|
+
CHECK(ns.size() == 2);
|
|
774
|
+
CHECK((ns[0] == ns1[0] && ns[1] == ns2[0]) || (ns[0] == ns2[0] && ns[1] == ns1[0]));
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
TEST_XML(xpath_sort_empty_node, "<node><child1/><child2/></node>")
|
|
778
|
+
{
|
|
779
|
+
xml_node n = doc.child(STR("node"));
|
|
780
|
+
xpath_node nodes[] = { n.child(STR("child2")), xml_node(), n.child(STR("child1")), xml_node() };
|
|
781
|
+
xpath_node_set ns(nodes, nodes + sizeof(nodes) / sizeof(nodes[0]));
|
|
782
|
+
|
|
783
|
+
ns.sort();
|
|
784
|
+
|
|
785
|
+
CHECK(!ns[0] && !ns[1] && ns[2] == nodes[2] && ns[3] == nodes[0]);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
TEST(xpath_allocate_string_out_of_memory)
|
|
789
|
+
{
|
|
790
|
+
std::basic_string<char_t> query;
|
|
791
|
+
|
|
792
|
+
for (int i = 0; i < 1024; ++i) query += STR("abcdefgh");
|
|
793
|
+
|
|
794
|
+
test_runner::_memory_fail_threshold = 8*1024;
|
|
795
|
+
|
|
796
|
+
#ifndef __DMC__ // DigitalMars exception handling crashes instead of catching the exception...
|
|
797
|
+
CHECK_ALLOC_FAIL(CHECK(!xpath_query(query.c_str())));
|
|
798
|
+
#endif
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
TEST(xpath_remove_duplicates)
|
|
802
|
+
{
|
|
803
|
+
xml_document doc;
|
|
804
|
+
|
|
805
|
+
for (int i = 0; i < 20; ++i)
|
|
806
|
+
{
|
|
807
|
+
doc.append_child(STR("node2"));
|
|
808
|
+
doc.prepend_child(STR("node1"));
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
xpath_node_set ns = doc.select_nodes(STR("/node2/preceding::* | //node1 | /node() | /* | /node1/following-sibling::*"));
|
|
812
|
+
|
|
813
|
+
ns.sort();
|
|
814
|
+
|
|
815
|
+
{
|
|
816
|
+
xpath_node_set_tester tester(ns, "sorted order failed");
|
|
817
|
+
|
|
818
|
+
for (int i = 0; i < 40; ++i)
|
|
819
|
+
tester % (2 + i);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
TEST(xpath_anonymous_nodes)
|
|
824
|
+
{
|
|
825
|
+
xml_document doc;
|
|
826
|
+
doc.append_child(node_element);
|
|
827
|
+
doc.append_child(node_pi);
|
|
828
|
+
|
|
829
|
+
CHECK_XPATH_NODESET(doc, STR("/name"));
|
|
830
|
+
CHECK_XPATH_NODESET(doc, STR("/processing-instruction('a')"));
|
|
831
|
+
CHECK_XPATH_NODESET(doc, STR("/ns:*"));
|
|
832
|
+
}
|
|
833
|
+
#endif
|