mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-25 20:14:10 +08:00
tests: Fix truncation test
data/truncation.xml was corrupted at some point and was not actually valid. Fix the file and make the test fail if we can't parse truncation.xml at all.
This commit is contained in:
parent
15fba1debc
commit
51da129b50
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE é_+å + SYSTEM "weekly-utf-8.dtd">
|
||||
<!-- é_+å +ã'÷ã__ã_-ã_< -->
|
||||
<!DOCTYPE 週報 SYSTEM "weekly-utf-8.dtd">
|
||||
<!-- 週報サンプル -->
|
||||
<mesh name="mesh_root">
|
||||
<!-- here is a mesh node -->
|
||||
some text
|
||||
@ -8,12 +8,12 @@
|
||||
some more text
|
||||
<node attr1="value1" attr2="value2" />
|
||||
<node attr1="value2">
|
||||
<æ+%è¯- å__å--="name" ä>·å__="value">ä¸-ç_æ_%å__å¤_è¯-è¨_ð¤-¢</æ+%è¯->
|
||||
<汉语 名字="name" 价值="value">世界有很多语言𤭢</汉语>
|
||||
<innernode/>
|
||||
</node>
|
||||
<æ°_å__>
|
||||
<æ°_>å++ç"°</æ°_>
|
||||
<å__>太é__</å__>
|
||||
</æ°_å__>
|
||||
<氏名>
|
||||
<氏>山田</氏>
|
||||
<名>太郎</名>
|
||||
</氏名>
|
||||
<?include somedata?>
|
||||
</mesh>
|
||||
</mesh>
|
@ -1010,7 +1010,7 @@ TEST(document_progressive_truncation)
|
||||
|
||||
char* buffer = new char[original_size];
|
||||
|
||||
for (size_t i = 1; i < original_size; ++i)
|
||||
for (size_t i = 1; i <= original_size; ++i)
|
||||
{
|
||||
char* truncated_data = buffer + original_size - i;
|
||||
|
||||
@ -1022,7 +1022,7 @@ TEST(document_progressive_truncation)
|
||||
bool result = doc.load_buffer_inplace(truncated_data, i);
|
||||
|
||||
// only eof is parseable
|
||||
CHECK((i >= 3325) ? result : !result);
|
||||
CHECK((i == original_size) ? result : !result);
|
||||
}
|
||||
|
||||
// fragment mode
|
||||
@ -1033,7 +1033,7 @@ TEST(document_progressive_truncation)
|
||||
bool result = doc.load_buffer_inplace(truncated_data, i, parse_default | parse_fragment);
|
||||
|
||||
// some truncate locations are parseable - those that come after declaration, declaration + doctype, declaration + doctype + comment and eof
|
||||
CHECK(((i - 21) < 3 || (i - 66) < 3 || (i - 95) < 3 || i >= 3325) ? result : !result);
|
||||
CHECK(((i - 21) < 3 || (i - 66) < 3 || (i - 95) < 3 || i == original_size) ? result : !result);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user