0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-28 23:03:00 +08:00

44 Commits

Author SHA1 Message Date
Arseny Kapoulkine
250b690a54 tests: Work around fp issues in various runtime libraries
Disable/change some tests for some compilers; use binary float comparison
for early MSVC versions.
2015-03-21 01:05:31 -07:00
Arseny Kapoulkine
3181a305ed tests: Fix MSVC 2008 compilation warning
Also include math.h to fix issues on some compilers.
2015-01-17 18:40:09 -08:00
Arseny Kapoulkine
d454013cff tests: Add tests for fp roundtrip
We test min/max and several different mantissas for the entire exponent range
for both float and double.

It's not clear whether all supported compilers provide an implementation of
sprintf/strtod that supports roundtripping so we may need to disable some of
these tests in the future.
2015-01-16 21:43:28 -08:00
Arseny Kapoulkine
f9ee391233 tests: Add coverage tests for new float setters
These only do basic testing to make sure the paths are covered and trivial
values work.
2015-01-16 21:42:35 -08:00
Steve Doiel
cf72c20ca1 Increase precision on large number test 2015-01-16 16:14:59 -08:00
Arseny Kapoulkine
125aa55061 Fix node_declaration copying with empty name
node_copy_string relied on the fact that target node had an empty name and
value. Normally this is a safe assumption (and a good one to make since it
makes copying faster), however it was not checked and there was one case when
it did not hold.

Since we're reusing the logic for inserting nodes, newly inserted declaration
nodes had the name set automatically to xml, which in our case violates the
assumption and is counter-productive since we'll override the name right after
setting it.

For now the best solution is to do the same insertion manually - that results
in some code duplication that we can refactor later (same logic is partially
shared by _move variants anyway so on a level duplicating is not that bad).
2014-11-20 23:39:40 -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
e9948b4b05 Fix undefined behavior while calling memcpy
Calling memcpy(x, 0, 0) is technically undefined (although it should usually
be a no-op).
2014-11-02 09:30:56 +01:00
Arseny Kapoulkine
0b7964917c Fix node copying for some out of memory cases
A page can fail to allocate during attribute creation; this case was not
previously handled.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1080 99668b35-9821-0410-8761-19e4c4f06640
2014-10-25 16:37:16 +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
bbd75fda46 tests: Improve test coverage
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1074 99668b35-9821-0410-8761-19e4c4f06640
2014-10-23 05:46:44 +00:00
Arseny Kapoulkine
f3b220ca4e tests: Fix MSVC6 compilation
Also fixes PUGIXML_NO_STL compilation and makes it possible to build with
any version of new Windows SDK.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1044 99668b35-9821-0410-8761-19e4c4f06640
2014-10-03 02:40:11 +00:00
Arseny Kapoulkine
59409f70ef tests: Add a test for out-of-memory during copy
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1040 99668b35-9821-0410-8761-19e4c4f06640
2014-10-02 16:19:55 +00:00
Arseny Kapoulkine
3fcc530b34 tests: Add missing tests to increase code coverage
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1038 99668b35-9821-0410-8761-19e4c4f06640
2014-10-02 03:06:59 +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
d519f7a473 tests: Add a test for stackless copy
This test has previously caused a stack overflow on x86/MSVC.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1028 99668b35-9821-0410-8761-19e4c4f06640
2014-09-28 23:23:35 +00:00
Arseny Kapoulkine
54b68a32b4 tests: Add tests for node movement
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1003 99668b35-9821-0410-8761-19e4c4f06640
2014-08-10 23:52:52 +00:00
Arseny Kapoulkine
47c15ad949 Implement document fragment parsing.
Introduce a notable behavior change in default parsing mode: documents without a
document element node are now considered invalid. This is technically a breaking change,
however the amount of documents it affects is very small, all parsed data still persists,
and lack of this check results in very confusing behavior in a number of cases.

In order to be able to parse documents without an element node, a fragment parsing flag is
introduced.

Parsing a buffer in fragment mode treats the buffer as a fragment of a valid XML.
As a consequence, top-level PCDATA is added to the tree; additionally, there are no
restrictions on the number of nodes -- so documents without a document element are considered
valid.

Due to the way parsing works internally, load_buffer_inplace occasionally can not preserve
the document contents if it's parsed in a fragment mode. While unfortunate, this problem is
fundamental; since the use case is relatively obscure, hopefully documenting this shortcoming
will be enough.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@980 99668b35-9821-0410-8761-19e4c4f06640
2014-02-11 06:45:27 +00:00
Arseny Kapoulkine
f9bbc39bd9 Implement long long support if PUGIXML_HAS_LONG_LONG is defined (autodetection is not implemented yet)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@962 99668b35-9821-0410-8761-19e4c4f06640
2014-02-08 20:36:09 +00:00
arseny.kapoulkine@gmail.com
9b9a414ab6 Compatibility fixes (fixed warnings in gcc, msvc7, fixed errors in bcc, cw, msvc6)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@939 99668b35-9821-0410-8761-19e4c4f06640
2012-12-07 06:35:53 +00:00
arseny.kapoulkine@gmail.com
00d4994f24 tests: Added append_buffer tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@937 99668b35-9821-0410-8761-19e4c4f06640
2012-12-07 04:49:51 +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
09b5dfdcb0 Added xml_document::reset, added append/prepend/insert child overloads for elements (with explicit name)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@779 99668b35-9821-0410-8761-19e4c4f06640
2010-10-26 17:09:34 +00:00
arseny.kapoulkine@gmail.com
b979d4c2bd Added prepend_attribute, prepend_child and prepend_copy functions
git-svn-id: http://pugixml.googlecode.com/svn/trunk@769 99668b35-9821-0410-8761-19e4c4f06640
2010-10-19 14:29:02 +00:00
arseny.kapoulkine
630be2edb3 tests: Added node_doctype and parse_doctype tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@757 99668b35-9821-0410-8761-19e4c4f06640
2010-09-26 19:01:36 +00:00
arseny.kapoulkine
a9bc2d8873 tests: Fixed tests for wchar_t mode, added dummy std::cout/wcout usage for MSVC in order to create locales beforehand (avoids memory leaks during tests), minor additional test fixes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@629 99668b35-9821-0410-8761-19e4c4f06640
2010-08-04 20:10:10 +00:00
arseny.kapoulkine
6df3609007 tests: Added even more tests for better code coverage
git-svn-id: http://pugixml.googlecode.com/svn/trunk@627 99668b35-9821-0410-8761-19e4c4f06640
2010-08-04 13:07:35 +00:00
arseny.kapoulkine
085584aa30 tests: Preparations for custom new/delete (leak detection)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@620 99668b35-9821-0410-8761-19e4c4f06640
2010-08-03 08:03:23 +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
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
c3e70f0b74 tests: Minor fix
git-svn-id: http://pugixml.googlecode.com/svn/trunk@573 99668b35-9821-0410-8761-19e4c4f06640
2010-07-07 21:16:47 +00:00
arseny.kapoulkine
5811786ccd remove_child and remove_attribute now return operation result
git-svn-id: http://pugixml.googlecode.com/svn/trunk@572 99668b35-9821-0410-8761-19e4c4f06640
2010-07-07 20:10:48 +00:00
arseny.kapoulkine
ab72b14d17 Internal XML parsing error handling is done via setjmp/longjmp, all allocation errors are now handled correctly (parser returns status_out_of_memory, modification functions return errors); added tests for some out of memory situations
git-svn-id: http://pugixml.googlecode.com/svn/trunk@520 99668b35-9821-0410-8761-19e4c4f06640
2010-06-13 19:24:20 +00:00
arseny.kapoulkine
a562014cc2 Declaration nodes improvements (they now automatically get name "xml", they can't be inserted as a non-document child, document saving prints declaration only if there is none present in the document)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@517 99668b35-9821-0410-8761-19e4c4f06640
2010-06-12 09:04:52 +00:00
arseny.kapoulkine
0ed895d79c Refactored PI/declaration parsing, now non top-level declarations result in parsing errors
git-svn-id: http://pugixml.googlecode.com/svn/trunk@515 99668b35-9821-0410-8761-19e4c4f06640
2010-06-12 07:30:13 +00:00
arseny.kapoulkine
df6f466e15 tests: Minor addition to attribute value modification tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@443 99668b35-9821-0410-8761-19e4c4f06640
2010-05-23 07:43:07 +00:00
arseny.kapoulkine
ba1b2017db as_* functions now all use strto*/wcsto* functions; this unifies the behavior and fixes large unsigned integer parsing in as_uint
git-svn-id: http://pugixml.googlecode.com/svn/trunk@438 99668b35-9821-0410-8761-19e4c4f06640
2010-05-20 20:35:49 +00:00
arseny.kapoulkine
b47b4905a6 Added more tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@407 99668b35-9821-0410-8761-19e4c4f06640
2010-05-10 17:14:48 +00:00
arseny.kapoulkine
8afeb9d71a Added more tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@406 99668b35-9821-0410-8761-19e4c4f06640
2010-05-10 16:43:07 +00:00
arseny.kapoulkine
47c23efe62 Reworked DOM memory allocation scheme (name/value allocations use the same pages as node/attribute structures, pages are now deallocated when completely free)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@401 99668b35-9821-0410-8761-19e4c4f06640
2010-05-10 08:59:48 +00:00
arseny.kapoulkine
f542c5ebb8 Integrated changes from unicode branch to trunk
git-svn-id: http://pugixml.googlecode.com/svn/trunk@383 99668b35-9821-0410-8761-19e4c4f06640
2010-05-06 20:28:36 +00:00
arseny.kapoulkine
02cb7bf685 tests: More tree modification tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@159 99668b35-9821-0410-8761-19e4c4f06640
2009-10-20 19:21:13 +00:00
arseny.kapoulkine
8cc555de36 tests: More DOM modification tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@150 99668b35-9821-0410-8761-19e4c4f06640
2009-10-12 10:34:24 +00:00
arseny.kapoulkine
b6433db226 tests: Initial tree modification tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@148 99668b35-9821-0410-8761-19e4c4f06640
2009-10-11 10:24:12 +00:00