0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-27 13:33:17 +08:00

58 Commits

Author SHA1 Message Date
Arseny Kapoulkine
c60ca94cdd tests: Fix MSVC 2022 build
Instead of trying to detect if we can safely use random shuffle simply reimplement it ourselves.
The quality of the RNG is not essential for these tests.
2022-02-15 20:23:05 -08:00
denchat
86e0fe1980
Fix forgotten indentation 2019-06-10 00:35:17 +07:00
denchat
1312a46d91
std::random_shuffle is removed in current standard
use <random> 's generator and std::shuffle instead
2019-06-10 00:14:21 +07:00
Arseny Kapoulkine
12e8b699ce tests: Expand out-of-memory union tests
We now have two tests: one tests behavior when we run out of space when
appending the node set (in which case the append fails), another one
tests behavior when we run out of space when filtering the node set (in
which case the set still contains redundant data).
2019-02-26 23:57:58 -08:00
Arseny Kapoulkine
930a701f1f tests: Disable flaky test
This test is very sensitive to the particular implementation of union
aggregation; for now lets disable this.

We need a more robust way to test union allocation failures.
2019-02-26 22:15:34 -08:00
Arseny Kapoulkine
f9a2a7d19e Fix Wdouble-promotion warnings
We had a few places in test code and library source where we used an
implicit float->double cast; while it should preserve the value exactly,
gcc/clang implement this warning to make sure uses of double are intentional.

This change also adds the warning to Makefile to make sure we don't
regress on this warning.

Fixes #243.
2018-11-23 23:39:22 -08:00
Arseny Kapoulkine
1a96777b11 tests: Fix XPath denorm tests on Intel compiler
Intel compiler by default sets flush-to-zero flags which causes our
denorm test to produce 0.0. So make sure that denorms work on FPU before
testing the string output.

Fixes #218.
2018-08-13 22:06:57 -07:00
Arseny Kapoulkine
62728d9c2e tests: Fix PUGIXML_NO_EXCEPTIONS tests 2018-04-02 21:51:04 -07:00
Arseny Kapoulkine
a32585286a tests: Fix PUGIXML_NO_STL build 2018-04-02 21:33:03 -07:00
Arseny Kapoulkine
5867aff943 tests: Make using namespace more explicit
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-22 20:41:08 -07:00
Arseny Kapoulkine
4b371e10ee tests: Remove redundant pugi:: qualifier
Most tests have `using namespace pugi` which makes explicit
qualifications unnecessary.
2017-06-22 20:33:02 -07:00
Arseny Kapoulkine
0027b6ac79 tests: Improve XPath coverage
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-16 22:45:42 -07:00
Arseny Kapoulkine
02c599f52b tests: Increase the number of translate calls
This should make the test fail on a 32-bit target.
2017-02-08 01:18:11 -08:00
Arseny Kapoulkine
b98c914053 tests: Fix clang build 2017-02-08 00:33:51 -08:00
Arseny Kapoulkine
1688f44185 tests: Add more XPath out of memory tests 2017-02-08 00:09:32 -08:00
Arseny Kapoulkine
10676b6b85 tests: Add more XPath sorting tests
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-05 21:12:55 -08:00
Arseny Kapoulkine
faadd460c4 tests: Add more out of memory tests for XPath evaluation 2017-02-02 08:57:02 -08:00
Arseny Kapoulkine
a1bc15c8d5 tests: Add more coverage tests
Expand out of memory coverage during XPath parsing and evaluation and
add some other small tests.
2017-01-30 23:52:32 -08:00
Arseny Kapoulkine
60d5688a87 tests: Make predicate out-of-memory test less aggressive
Currently this test has very large runtime and relies on the fact that
the first memory allocation error causes the test to terminate. This
does not work with new behavior of running the query through and
reporting the error at the end, so make the runtime reasonable but still
generate enough memory to blow past the budget.
2017-01-30 22:27:48 -08:00
Arseny Kapoulkine
02cee98492 tests: Add more tests for branch coverage
gcov -b surfaced many lines with partial coverage, where branch is only
ever taken or not taken, or one of the expressions in a complex
conditional is always either true or false. This change adds a series of
tests (mostly focusing on XPath) to reduce the number of partially
covered lines.
2017-01-30 21:58:48 -08:00
Stephan Beyer
f7aa65db8a Fix whitespace issues
Git warns when it finds "whitespace errors". This commit gets
rid of these whitespace errors for code and adoc files.
2016-01-24 14:05:44 +01:00
Arseny Kapoulkine
4e004176ba tests: Improve out-of-memory tests
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-11 22:46:08 -07:00
Arseny Kapoulkine
417048d8cb tests: Fix tests on various compilers
Some compilers don't handle NaNs properly.
Some compilers don't implement fmod in a IEEE-compatible way.
Some compilers have exception handling codegen bugs (DMC...).
2014-11-19 16:34:57 -08:00
Arseny Kapoulkine
e9956ae3a6 Rename xml_document::load to load_string
This should completely eliminate the confusion between load and load_file.
Of course, for compatibility reasons we have to preserve the old variant -
it will be deprecated in a future version and subsequently removed.
2014-11-17 19:52:23 -08:00
Arseny Kapoulkine
546997683a tests: Add even more coverage tests
Also fix MSVC6 compilation (make convertions to function pointers explicit).

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1076 99668b35-9821-0410-8761-19e4c4f06640
2014-10-24 01:17:57 +00:00
Arseny Kapoulkine
903db8682a tests: Add more tests for better coverage
More tests for out-of-memory and other edge conditions

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1075 99668b35-9821-0410-8761-19e4c4f06640
2014-10-23 07:41:07 +00:00
Arseny Kapoulkine
1b8b87904b XPath: Introduce _first/_any set evaluation modes
Sometimes when evaluating the node set we don't need the entire set and
only need the first element in docorder or any element. In the absence of
iterator support we can still use this information to short-circuit
traversals.

This does not have any effect on straightforward node collection queries,
but frequently improves performance of complex queries with predicates
etc. XMark benchmark gets 15x faster with some queries enjoying 100x
speedup on 10 Mb dataset due to a significant complexity improvement.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1067 99668b35-9821-0410-8761-19e4c4f06640
2014-10-20 01:00:48 +00:00
Arseny Kapoulkine
b17501c3fb tests: Add XPath sorting tests and a simple test for numeric predicates
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1051 99668b35-9821-0410-8761-19e4c4f06640
2014-10-05 04:20:52 +00:00
Arseny Kapoulkine
290bf521fa tests: Add XPath sorting tests for move/append_buffer
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1035 99668b35-9821-0410-8761-19e4c4f06640
2014-10-01 07:03:12 +00:00
Arseny Kapoulkine
3ae516abe2 tests: Add tests for copyless copy and related potential bugs
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1033 99668b35-9821-0410-8761-19e4c4f06640
2014-10-01 07:02:59 +00:00
Arseny Kapoulkine
89fc7c241c tests: More XPath tests
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1020 99668b35-9821-0410-8761-19e4c4f06640
2014-09-23 04:39:51 +00:00
Arseny Kapoulkine
757c494340 Improve XPath allocator performance
When allocating new pages, make sure that the page has at least 1/4 of the
base page size free. This makes sure that we can do small allocations after
big allocations (i.e. huge node lists) without doing a heap alloc.

This is important because XPath stack code always reclaims extra pages after
evaluating sub-expressions, so allocating a small chunk of memory and then
rolling the state back is a common case (filtering a node list using a
predicate usually does this).

A better solution involves smarter allocation rollback strategy, but the
implemented solution is simple and practical.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@999 99668b35-9821-0410-8761-19e4c4f06640
2014-06-01 19:12:36 +00:00
arseny.kapoulkine@gmail.com
4e1add1a46 Fix invalid assertion in XPath: reallocation can result in allocating buffer of the same size due to pointer-sized alignment
git-svn-id: http://pugixml.googlecode.com/svn/trunk@946 99668b35-9821-0410-8761-19e4c4f06640
2013-03-20 02:44:05 +00:00
arseny.kapoulkine@gmail.com
cee7eca229 XPath: Fix unit test that (incorrectly) relied on right-associativity of union operator to trigger out of memory condition
git-svn-id: http://pugixml.googlecode.com/svn/trunk@930 99668b35-9821-0410-8761-19e4c4f06640
2012-11-17 23:51:43 +00:00
arseny.kapoulkine
d99745be21 Enabled many additional GCC warnings (most notably -Wshadow and -Wold-style-cast), fixed the code accordingly
git-svn-id: http://pugixml.googlecode.com/svn/trunk@800 99668b35-9821-0410-8761-19e4c4f06640
2010-12-19 10:16:37 +00:00
arseny.kapoulkine
d6d6876da7 tests: Fixed MSVC 6/7 compilation error
git-svn-id: http://pugixml.googlecode.com/svn/trunk@731 99668b35-9821-0410-8761-19e4c4f06640
2010-09-14 07:09:17 +00:00
arseny.kapoulkine
91f097d34d tests: Improved XPath sort coverage
git-svn-id: http://pugixml.googlecode.com/svn/trunk@730 99668b35-9821-0410-8761-19e4c4f06640
2010-09-14 05:43:13 +00:00
arseny.kapoulkine
521384bd21 tests: Added XPath out of memory tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@728 99668b35-9821-0410-8761-19e4c4f06640
2010-09-14 05:29:16 +00:00
arseny.kapoulkine
72bc1f0807 tests: Fixed wchar mode tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@723 99668b35-9821-0410-8761-19e4c4f06640
2010-09-13 18:58:42 +00:00
arseny.kapoulkine
7709a32b09 tests: Added XPath test for large node sets
git-svn-id: http://pugixml.googlecode.com/svn/trunk@721 99668b35-9821-0410-8761-19e4c4f06640
2010-09-13 18:33:47 +00:00
arseny.kapoulkine
31b8e28997 tests: Improved document_order() coverage
git-svn-id: http://pugixml.googlecode.com/svn/trunk@693 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29 15:49:35 +00:00
arseny.kapoulkine
049fa3906d tests: Added new evaluate_string tests, fixed tests for NO_STL mode
git-svn-id: http://pugixml.googlecode.com/svn/trunk@661 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29 15:25:05 +00:00
arseny.kapoulkine
6154125dce tests: Removed redundant includes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@642 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29 15:11:00 +00:00
arseny.kapoulkine
deb9e8bc74 tests: Added more XPath tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@628 99668b35-9821-0410-8761-19e4c4f06640
2010-08-04 14:15:46 +00:00
arseny.kapoulkine
4f6ecee14c tests: More miscellaneous tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@619 99668b35-9821-0410-8761-19e4c4f06640
2010-08-02 20:16:53 +00:00
arseny.kapoulkine
958ee27e7f tests: Miscellaneous test fixes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@618 99668b35-9821-0410-8761-19e4c4f06640
2010-07-22 17:22:44 +00:00
arseny.kapoulkine
f889bf88c0 tests: Removed invalid document order test, improved document order coverage by adding tests that are not subject to document order optimization
git-svn-id: http://pugixml.googlecode.com/svn/trunk@615 99668b35-9821-0410-8761-19e4c4f06640
2010-07-22 08:04:02 +00:00
arseny.kapoulkine
7d24b9b565 Set svn:eol-style to native for all text files
git-svn-id: http://pugixml.googlecode.com/svn/trunk@607 99668b35-9821-0410-8761-19e4c4f06640
2010-07-19 09:57:32 +00:00
arseny.kapoulkine
4394a588c2 XPath: Rewritten number->string conversion using CRT scientific format (much better XPath REC compliance)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@523 99668b35-9821-0410-8761-19e4c4f06640
2010-06-14 18:03:50 +00:00
arseny.kapoulkine
162962a736 tests: Fixed tests for wchar_t mode, disabled some tests on compilers with broken NaN behavior
git-svn-id: http://pugixml.googlecode.com/svn/trunk@463 99668b35-9821-0410-8761-19e4c4f06640
2010-05-29 13:36:53 +00:00