diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-10-02 03:07:08 +0000 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-10-02 03:07:08 +0000 |
commit | 4d39ae9e45363b5082c308fc79bb90fa96dc3ed3 (patch) | |
tree | e6a31cdfefd44e2629f2dfc2f4163f4a73697cda /tests/test_document.cpp | |
parent | 3fcc530b341709000b7acf4e8b85ad11cac0927d (diff) |
tests: Add a test to verify that xml_document object works with any valid pointer alignment
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1039 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_document.cpp')
-rw-r--r-- | tests/test_document.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp index c34eb42..c75ed8f 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -1220,3 +1220,18 @@ TEST(document_load_stream_truncated) } } #endif + +TEST(document_alignment) +{ + char buf[256 + sizeof(xml_document)]; + + for (size_t offset = 0; offset < 256; offset += sizeof(void*)) + { + xml_document* doc = new (buf + offset) xml_document; + + CHECK(doc->load(STR("<node />"))); + CHECK_NODE(*doc, STR("<node />")); + + doc->~xml_document(); + } +} |