summaryrefslogtreecommitdiff
path: root/tests/test_document.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-29 07:17:30 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-29 07:17:30 +0000
commitfc602fd37554f5e2d58fcee71a58e380d23d22d4 (patch)
tree2955c7999c2053c06a81c21a79fd55670bb6940e /tests/test_document.cpp
parent0640f87859a5a676b41783be4741a62f4d1ea266 (diff)
tests: Supported all pugixml compilation modes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@191 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_document.cpp')
-rw-r--r--tests/test_document.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index ec54e95..d52635c 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -1,6 +1,8 @@
#include "common.hpp"
#include <fstream>
+#include <sstream>
+#include <string>
#ifdef _MSC_VER
#pragma warning(disable: 4996)
@@ -13,6 +15,7 @@ TEST(document_create)
CHECK_NODE(doc, "<node />");
}
+#ifndef PUGIXML_NO_STL
TEST(document_load_stream)
{
pugi::xml_document doc;
@@ -41,6 +44,7 @@ TEST(document_load_stream_error)
std::istringstream iss("<node/>");
CHECK(doc.load(iss).status == status_out_of_memory);
}
+#endif
TEST(document_load_string)
{
@@ -64,12 +68,12 @@ TEST(document_load_file_large)
CHECK(doc.load_file("tests/data/large.xml"));
- std::ostringstream oss;
- oss << "<node>";
- for (int i = 0; i < 10000; ++i) oss << "<node />";
- oss << "</node>";
+ std::string str;
+ str += "<node>";
+ for (int i = 0; i < 10000; ++i) str += "<node />";
+ str += "</node>";
- CHECK_NODE(doc, oss.str().c_str());
+ CHECK_NODE(doc, str.c_str());
}
TEST(document_load_file_error)
@@ -90,32 +94,29 @@ TEST(document_load_file_error)
TEST_XML(document_save, "<node/>")
{
- std::ostringstream oss;
- xml_writer_stream writer(oss);
+ xml_writer_string writer;
doc.save(writer, "", pugi::format_no_declaration | pugi::format_raw);
- CHECK(oss.str() == "<node />");
+ CHECK(writer.result == "<node />");
}
TEST_XML(document_save_bom, "<node/>")
{
- std::ostringstream oss;
- xml_writer_stream writer(oss);
+ xml_writer_string writer;
doc.save(writer, "", pugi::format_no_declaration | pugi::format_raw | pugi::format_write_bom_utf8);
- CHECK(oss.str() == "\xef\xbb\xbf<node />");
+ CHECK(writer.result == "\xef\xbb\xbf<node />");
}
TEST_XML(document_save_declaration, "<node/>")
{
- std::ostringstream oss;
- xml_writer_stream writer(oss);
+ xml_writer_string writer;
doc.save(writer);
- CHECK(oss.str() == "<?xml version=\"1.0\"?>\n<node />\n");
+ CHECK(writer.result == "<?xml version=\"1.0\"?>\n<node />\n");
}
TEST_XML(document_save_file, "<node/>")