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
This commit is contained in:
Arseny Kapoulkine 2014-10-02 03:07:08 +00:00
parent 3fcc530b34
commit 4d39ae9e45

View File

@ -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();
}
}