summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2018-03-16tests: Fix PUGIXML_COMPACT+PUGIXML_WCHAR_MODE testsArseny Kapoulkine
Several tests got the buffer size wrong when sizeof(char_t)>1, and one test didn't meet the carefully tuned allocation criteria under compact mode due to the hash table usage and had to be changed a bit.
2017-12-22tests: Fix OSX test failureArseny Kapoulkine
Apparently at some point OSX behavior when reading /dev/tty switched from "can't open the file" to "the file can be opened and 0 bytes can be read from it" which generates a wrong error and doesn't exercise the code path we care about.
2017-11-13Merge pull request #170 from zeux/moveArseny Kapoulkine
This change implements move ctor and assign support for xml_document. All node handles remain valid after the move and point to the new document; the only exception is the document node itself (that remains unmoved). Move is O(document size) in theory because it needs to relocate immediate document children (there is just one in conformant documents) and all memory pages; in practice the memory pages only need the header adjusted, which is ~0.1% of the actual data size. Move requires no allocations in general, except when using compact mode where some moves need to grow the hash table which can fail (throw). Fixes #104
2017-11-13tests: Add compact move testsArseny Kapoulkine
This helps make sure our error handling logic works and is exercised.
2017-11-10tests: Fix expansion-to-defined warningArseny Kapoulkine
This warning is new as of GCC 7 and highlights undefined behavior in the preprocessor that ASAN detection was relying on.
2017-10-26tests: Add more tests for document moveArseny Kapoulkine
These tests currently fail for compact mode because of ->reserve() failing.
2017-10-20tests: Add more move testsArseny Kapoulkine
We now check that appending a child to a moved document performs no allocations - this is already the case, but if we neglected to copy the allocator state this test would fail.
2017-09-25tests: Adjust move coverage testsArseny Kapoulkine
Large test wasn't testing shared parent condition properly - add one more level of hierarchy so that it works as expected.
2017-09-25tests: Add more move testsArseny Kapoulkine
Add a test that checks that static buffer pointer was moved correctly by checking if offset_debug still works.
2017-09-25tests: Add more move testsArseny Kapoulkine
Make sure we have coverage for empty documents and for large documents that trigger compact_shared_parent != root for some pages.
2017-09-25tests: Add more document move testsArseny Kapoulkine
Verify that move doesn't allocate and that it preserves structures required for tree memory management and append_buffer in tact.
2017-09-25tests: Add basic move testsArseny Kapoulkine
These just verify that move ctor/assignment operator work as expected in simple cases - there are a number of ways in which the internal structure can be incorrect...
2017-06-23tests: Add more stream coverage testsArseny Kapoulkine
These new tests test that tellg() can fail when being called the second time, which leads to seekable implementation failing.
2017-06-23tests: Add stream coverage testsArseny Kapoulkine
These tests simulate various error conditions when reading data from streams - seeks failing in seekable streams, underflow throwing an exception causing read to set badbit, etc. This change also adjusts memory thresholds to cause a reliable out of memory during construction of a final buffer for non-seekable streams.
2017-06-22tests: Fix PUGIXML_WCHAR_MODE buildArseny Kapoulkine
2017-06-22tests: Add more XPath out of memory testsArseny Kapoulkine
This fixes missing coverage in translate_table_generate and xpath_node_set_raw::append.
2017-06-22tests: Make using namespace more explicitArseny Kapoulkine
Hiding using namespace in common.hpp is somewhat surprising so remove common.hpp and move using namespace into all .cpp files that need it.
2017-06-22tests: Remove redundant pugi:: qualifierArseny Kapoulkine
Most tests have `using namespace pugi` which makes explicit qualifications unnecessary.
2017-06-22Deprecate xml_document::load(const char*) and xml_node::select_single_nodeArseny Kapoulkine
These functions were deprecated via comments in 1.5 but never got the deprecated attribute; now is the time! Using deprecated functions produces a warning; to silence it, this change moves the relevant tests to a separate translation unit that has deprecation disabled.
2017-06-18Add VS2017 to AppVeyor test runArseny Kapoulkine
This requires moving the list of VS versions out of autotest-appveyor.ps1 and into appveyor.yml.
2017-06-16tests: Improve XPath coverageArseny Kapoulkine
Add memory allocation failure test for concact with a very large list and make sure we have every single axis covered with and without a predicate, with and without a previous step.
2017-06-16tests: Add even more stream coverage testsArseny Kapoulkine
Apparently only narrow character streams had out of memory coverage - fix that and also split this into a separate test.
2017-06-16tests: Add more stream coverage testsArseny Kapoulkine
Cover both char and wchar_t stream loading in a single run instead of using pugi::char_t.
2017-06-16tests: Add more coverage tests for stream loadingArseny Kapoulkine
Cover more failure cases and simplify the streambuf implementation a bit.
2017-06-16Fix BorlandC compilationArseny Kapoulkine
Rename partition to partition3 to resolve conflicts with std::partition.
2017-06-16tests: Improve XPath test coverageArseny Kapoulkine
Add more memory allocation failure tests.
2017-06-16tests: Expand write_flush coverageArseny Kapoulkine
Adjust the buffer size to be right on the edge of the overflow, make sure we actually output " instead of ".
2017-06-15tests: Add xml_buffered_writer coverage testArseny Kapoulkine
This test triggers flush() condition for each optimized write() method.
2017-06-15tests: Add tests for loading special filesArseny Kapoulkine
New tests try to load a folder as an XML document, and a device. Both are intended to exercise some otherwise non-hittable error paths in load_file implementation.
2017-06-14tests: Increase compact_pointer coverageArseny Kapoulkine
This adds tests that complete branch coverage in compact pointer encoding/decoding code (previously first_attribute was always encoded using compact encoding in the entire test suite).
2017-04-03Move libFuzzer build to MakefileArseny Kapoulkine
Now the only thing fuzz_setup.sh does is installing new clang; if system clang supports -fsanitize-coverage then fuzz_setup.sh is not required.
2017-04-03tests: Fix fuzz_setup.shArseny Kapoulkine
The script only worked if clang folder was already created.
2017-03-21tests: Do not use unsigned underflow in test codeArseny Kapoulkine
This triggers a runtime error under integer sanitizer
2017-03-21tests: Fix invalid buffer sizeArseny Kapoulkine
This was triggering an buffer read overflow with asan.
2017-02-11tests: Fix fuzz_setup.shArseny Kapoulkine
Make the file executable, fix Windows newlines and fix clang setup.
2017-02-11tests: Add fuzzing dictionariesArseny Kapoulkine
Hopefully this will allow for better fuzzing coverage
2017-02-09tests: Add XPath fuzzingArseny Kapoulkine
Only fuzz the parser for now.
2017-02-09tests: Add a script to set up fuzzing toolsArseny Kapoulkine
This downloads a clang build that has support for instrumentation, and also downloads and compiles libFuzzer.a.
2017-02-09fuzz: Use libFuzzer instead of afl-fuzzArseny Kapoulkine
This allows us to have faster fuzz cycles since the fuzzer is in-process.
2017-02-09tests: Increase the number of translate callsArseny Kapoulkine
This should make the test fail on a 32-bit target.
2017-02-09tests: Fix clang buildArseny Kapoulkine
2017-02-09tests: Add more XPath out of memory testsArseny Kapoulkine
2017-02-05tests: Add more XPath sorting testsArseny Kapoulkine
Cover empty node case - no XPath query can result in that but it's possible to create a node set with empty nodes manually.
2017-02-02tests: Add more out of memory tests for XPath evaluationArseny Kapoulkine
2017-02-02tests: Add more embed_pcdata testsArseny Kapoulkine
2017-02-01tests: Improve parsing coverageArseny Kapoulkine
Add tests for PI erroring exactly at the buffer boundary with non-zero-terminated buffers (so we have to clear the last character which changes the parsing flow slightly) and a test that makes sure parse_embed_pcdata works properly with XML fragments where PCDATA can be at the root level but can't be embedded into the document node.
2017-02-01tests: Remove redundant coverage testArseny Kapoulkine
The only point was to try to test all paths where we can run out of memory while decoding something. It seems like it may be impossible to actually do this given that we can't run all paths as wchar_t size detection is done at runtime...
2017-01-31tests: Add more tests to increase coverageArseny Kapoulkine
This change adds more thorough tests for attribute conversion as well as some assorted tests that fix gaps in coverage.
2017-01-31tests: Add compact hash table reserve testArseny Kapoulkine
This makes sure all .reserve calls failure paths are covered. These tests don't explicitly test if reserve is present on all paths - this is much harder to test since not all modifications require reserve to be called, so we'll have to rely on a combination of automated testing and sanity checking for this. Also add more parsing out of memory coverage tests.
2017-01-31tests: Add coverage tests for encoding detectionArseny Kapoulkine
Enumerate successfull cases and also cases where the detection stops half-way and results in a different detected encoding.