summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2015-09-20tests: Add tests for integer overflow during conversionArseny Kapoulkine
These tests are only testing attribute as_int in hopes that xml_text uses the same underlying implementation (which it does).
2015-09-19tests: Convert several files to Unix line endingsArseny Kapoulkine
They were still using Windows EOL by mistake
2015-07-25tests: Fix test allocator to provide fundamental alignmentArseny Kapoulkine
Previously test allocator only guaranteed alignment enough for a pointer. On some platforms (e.g. SPARC) double has to be aligned to 8 bytes but pointers can have a size of 4 bytes. This commit increases allocation header to fix that. In practical terms the allocation header is now always 8 bytes.
2015-07-25tests: Only enable page heap on x86/x64Arseny Kapoulkine
This fixes tests in PUGIXML_NO_XPATH mode on SPARC64 (#48). SPARC does not allow unaligned accesses - e.g. you can't read an unaligned int. Normally pugixml does not perform unaligned integer/pointer accesses, but page heap can allocate blocks that are not aligned so that we can detect a single- byte read/write overrun. Additionally, the hardcoded page size we're currently using is really system specific - on SPARC the page size can be 8 Kb instead of 4 Kb so mprotect can fail.
2015-05-22tests: Add newline at the end of fileArseny Kapoulkine
2015-05-22tests: Fix MSVC6 compilationArseny Kapoulkine
2015-05-20tests: Split fp roundtrip test into float and doubleArseny Kapoulkine
2015-05-14Implement xml_node::attribute with a hintArseny Kapoulkine
Extra argument 'hint' is used to start the attribute lookup; if the attribute is not found the lookup is restarted from the beginning of the attriubte list. This allows to optimize attribute lookups if you need to get many attributes from the node and can make assumptions about the likely ordering. The code is correct regardless of the order, but it is faster than using vanilla lookups if the order matches the calling order. Fixes #30.
2015-05-12tests: Fix address sanitizer detection for GCCArseny Kapoulkine
2015-05-12Add Visual Studio 2015 to AppVeyorArseny Kapoulkine
2015-05-12tests: Disable page allocator if address sanitizer is activeArseny Kapoulkine
Address sanitizer can detect underflows so we don't really need the custom allocator. Additionally, custom allocator can return memory that is not pointer-aligned; this causes undefined behavior sanitizer to complain.
2015-05-12tests: Fix clang 3.7 warningArseny Kapoulkine
Work around -Wself-move using ref-deref.
2015-05-03tests: Fix MSVC6 compatibilityArseny Kapoulkine
Apply the usual workaround for for scoping issues. Also fix integer conversion warning for BorlandC.
2015-05-02tests: Add one more page reclamation testArseny Kapoulkine
2015-04-29tests: Fix spurious failures in compact modeArseny Kapoulkine
The memory_large_allocations test sometimes classified hash allocations as page allocations since hash table could reach 512 entries.
2015-04-22Fix node_pi memory leakArseny Kapoulkine
2015-04-21tests: Adjust allocation thresholds to fix testsArseny Kapoulkine
2015-04-21Merge branch 'master' into compactArseny Kapoulkine
2015-04-21tests: Fix MSVC warningsArseny Kapoulkine
2015-04-21tests: Add move semantics testsArseny Kapoulkine
Also test ranged for and copying big xpath_variable_set objects (to make sure we actually handle hash collisions properly)
2015-04-15Implement copy ctor/assignment for xpath_variable_setArseny Kapoulkine
xpath_variable_set is essentially an associative container; it's about time it became copyable. Implementation is slightly tricky due to out of memory handling. Both copy ctor and assignment operator have strong exception guarantee (even if exceptions are disabled! which translates to "roll back on allocation errors").
2015-04-15tests: Fix Linux buildArseny Kapoulkine
2015-04-15tests: Use malloc for OSX/Linux page heapArseny Kapoulkine
Switch to malloc and manually aligning the pointer to the page boundary. mmap is much slower than malloc; this change makes tests ~4x faster.
2015-04-14Fix xpath_node_set assignment to provide strong exception guaranteeArseny Kapoulkine
Since the type of the set was updated before assignment, assigning in out-of-memory condition could change the type to not match the content.
2015-04-13Refactor format_indent_attributes implementationArseny Kapoulkine
Fix code style and revert redundant parameters/whitespace changes. Also remove format_each_attribute_on_new_line - we're only introducing one extra formatting flag. The flag implies format_indent but does not include its bitmask. Also add a few more tests. Fixes #14.
2015-04-13Merge branch 'AlignAttributesEachOnSeparateLine' of ↵Arseny Kapoulkine
git://github.com/halex2005/pugixml into indent_attributes
2015-04-13tests: Add PUGIXML_COMPACT to AppVeyorArseny Kapoulkine
2015-04-13Merge branch 'master' into compactArseny Kapoulkine
2015-04-13Remove all files for the Jamplus-based build systemArseny Kapoulkine
End of an era. Make can be used for regular development (Linux/OSX), documentation building and release packaging. CMake can be used for regular development (Windows); it's also used by some Linux distributions. Continuous integration is now performed by Travis CI and AppVeyor.
2015-04-13Add AppVeyor build scriptsArseny Kapoulkine
2015-04-14add tests for aligning each attribute on next linehalex2005
2015-04-12Merge branch 'master' into compactArseny Kapoulkine
2015-04-12Fix unused variable warningArseny Kapoulkine
Also fix test in wchar_t mode.
2015-04-12Permit custom allocation function to throwArseny Kapoulkine
Ensure that all the necessary cleanup is performed in case the allocation fails with an exception - files are closed, buffers are reclaimed, etc. Any test that triggers a simulated out-of-memory condition is ran once again with a throwing allocation function. Unobserved std::bad_alloc count as test failures and require CHECK_ALLOC_FAIL macro. Fixes #17.
2015-04-12tests: Add more out of memory testsArseny Kapoulkine
Also add tests that verify save_file for absence of FILE leaks.
2015-04-12Fix compilation and tests after merge.Arseny Kapoulkine
2015-04-12Merge branch 'master' into compactArseny Kapoulkine
2015-04-12Implment copyless copy for attributesArseny Kapoulkine
Previously attributes that were copied with their node used string sharing, but standalone attributes that were copied using xml_node::*_copy(xml_attribute) were not.
2015-04-12tests: Add a test that verifies absence of file leaksArseny Kapoulkine
If an out of memory error happens in load_file there's a danger of leaking the FILE object. Since there is a limited supply of the objects we can easily test that the leak does not happen.
2015-04-12tests: Fix some Coverity issuesArseny Kapoulkine
2015-04-11Fix Travis CI build.Arseny Kapoulkine
2015-04-11tests: Improve out-of-memory testsArseny Kapoulkine
Previously there was no guarantee that the tests that check for out of memory handling behavior are actually correct - e.g. that they correctly simulate out of memory conditions. Now every simulated out of memory condition has to be "guarded" using CHECK_ALLOC_FAIL. It makes sure that every piece of code that is supposed to cause out-of-memory does so, and that no other code runs out of memory unnoticed.
2015-04-11tests: Add a test for throwing from xml_writer::writeArseny Kapoulkine
We currently don't allocate/modify any state so there are no issues with this.
2015-04-11Fix exception type for out-of-memory for XPath variablesArseny Kapoulkine
When parsing XPath variables, we need to perform a heap allocation; if it fails, an xpath_exception instead of bad_alloc used to be thrown. Now we throw the exception of a correct type so that xpath_exception means 'parsing error'.
2015-04-11tests: Use char_t instead of wchar_tArseny Kapoulkine
2015-04-11tests: Add more out of memory testsArseny Kapoulkine
This provides more coverage for #17.
2015-04-10Merge branch 'master' into compactArseny Kapoulkine
2015-04-10Fix archive packagingArseny Kapoulkine
Base directory is now using target basename.
2015-03-21tests: Final test fix for CWArseny Kapoulkine
2015-03-21tests: Work around fp issues in various runtime librariesArseny Kapoulkine
Disable/change some tests for some compilers; use binary float comparison for early MSVC versions.