diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-03-13 22:13:10 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-03-13 22:13:10 -0700 |
commit | 51da129b50a0b99ee85af20cc4a4b77f6bc823ff (patch) | |
tree | 8338307c3cd46102b4e9719771568c6b0ee51610 /tests | |
parent | 15fba1debca5498989048677ffda38758b2df984 (diff) |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/truncation.xml | 16 | ||||
-rw-r--r-- | tests/test_document.cpp | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/tests/data/truncation.xml b/tests/data/truncation.xml index 9cdbe13..1b0e9a8 100644 --- a/tests/data/truncation.xml +++ b/tests/data/truncation.xml @@ -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>
\ No newline at end of file diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 49428f2..09d89d7 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -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); } } |