Tuan Anh Tran
b9b2aeecaf
Custom precision ( #300 )
...
Fixes #285
2019-09-22 08:42:41 -07:00
Arseny Kapoulkine
6202519ca6
tests: Add memory safety tests for remove_children/attributes
...
The newly added tests make sure that during node/attribute destruction
we deallocate a few memory pages; this makes sure that we don't read
node data after it's being destroyed.
Also clean up formatting/style in the remove_* implementation a bit.
2019-09-17 20:34:40 -07:00
Tuan Anh Tran
fd7326fb91
feat: add remove_attributes() and remove_children() ( #296 )
...
These functions remove all attributes / child nodes in bulk which is faster than removing them one at a time.
2019-09-17 20:18:41 -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
6ffd2ffc41
tests: Add more DOM coverage tests
...
Add tests for various corner cases of DOM inspection and modification
routines.
2017-01-31 00:10:20 -08:00
Arseny Kapoulkine
2e0ed8284b
Remove extra space in an empty tag for format_raw
...
When using format_raw the space in the empty tag (<node />) is the only
character that does not have to be there; so format_raw almost results in
a minimal XML but not quite.
It's pretty unlikely that this is crucial for any users - the formatting
change should be benign, and it's better to improve format_raw than to add
yet another flag.
Fixes #87 .
2016-04-14 00:30:24 -07:00
Arseny Kapoulkine
d2e72ee05a
tests: Add tests for long setters
2016-02-02 08:49:32 -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
94c08f27c6
tests: Fix Borland C++ 5.4 compilation
...
The tests now compile fine but crash on the first floating-point exception
despite our attempts to disable them in main()...
2015-10-25 13:44:26 -07:00
Arseny Kapoulkine
e2358e5e3b
tests: Split fp roundtrip test into float and double
2015-05-20 08:05:43 -07:00
Arseny Kapoulkine
3643b505a6
Fix node_pi memory leak
2015-04-22 08:38:52 -07:00
Arseny Kapoulkine
054b0b447e
Merge branch 'master' into compact
2015-04-12 22:09:45 -07:00
Arseny Kapoulkine
9539c488c2
Fix unused variable warning
...
Also fix test in wchar_t mode.
2015-04-12 22:06:17 -07:00
Arseny Kapoulkine
6c11a0c693
Fix compilation and tests after merge.
2015-04-12 03:14:08 -07:00
Arseny Kapoulkine
a19da1c246
Merge branch 'master' into compact
2015-04-12 03:05:58 -07:00
Arseny Kapoulkine
a0d065cd22
Implment copyless copy for attributes
...
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-12 03:03:56 -07:00
Arseny Kapoulkine
2537cccad3
tests: Fix some Coverity issues
2015-04-12 02:17:20 -07: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
03ea04c32a
tests: Use char_t instead of wchar_t
2015-04-11 00:33:35 -07:00
Arseny Kapoulkine
29fef9aca2
tests: Add more out of memory tests
...
This provides more coverage for #17 .
2015-04-11 00:16:39 -07:00
Arseny Kapoulkine
e90d2ac8ba
Merge branch 'master' into compact
2015-04-10 22:26:57 -07:00
Arseny Kapoulkine
5959a17967
tests: Final test fix for CW
2015-03-21 17:09:42 -07:00
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
f81d7cc018
Merge branch 'master' into compact
2015-03-10 20:44:06 -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
e5ecbd63ce
Merge branch 'master' into compact
2015-01-16 21:48:50 -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
db8df4a566
Merge branch 'master' into compact
2014-11-20 23:47:16 -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
50bfdb1856
tests: Fix all tests for compact mode
...
Memory allocation behavior is different in compact mode so tests that rely
on current behavior have to be adjusted.
2014-11-06 09:59:07 +01: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