From fc602fd37554f5e2d58fcee71a58e380d23d22d4 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Thu, 29 Oct 2009 07:17:30 +0000 Subject: tests: Supported all pugixml compilation modes git-svn-id: http://pugixml.googlecode.com/svn/trunk@191 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_document.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'tests/test_document.cpp') 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 +#include +#include #ifdef _MSC_VER #pragma warning(disable: 4996) @@ -13,6 +15,7 @@ TEST(document_create) CHECK_NODE(doc, ""); } +#ifndef PUGIXML_NO_STL TEST(document_load_stream) { pugi::xml_document doc; @@ -41,6 +44,7 @@ TEST(document_load_stream_error) std::istringstream iss(""); 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 << ""; - for (int i = 0; i < 10000; ++i) oss << ""; - oss << ""; + std::string str; + str += ""; + for (int i = 0; i < 10000; ++i) str += ""; + str += ""; - 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, "") { - 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() == ""); + CHECK(writer.result == ""); } TEST_XML(document_save_bom, "") { - 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"); + CHECK(writer.result == "\xef\xbb\xbf"); } TEST_XML(document_save_declaration, "") { - std::ostringstream oss; - xml_writer_stream writer(oss); + xml_writer_string writer; doc.save(writer); - CHECK(oss.str() == "\n\n"); + CHECK(writer.result == "\n\n"); } TEST_XML(document_save_file, "") -- cgit v1.2.3