diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-04 20:10:10 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-04 20:10:10 +0000 |
commit | a9bc2d88736cc4d2f2963915e3de66b93585f479 (patch) | |
tree | 33f32417ccbd1af6a714bda55862322d92f1fb2c /tests | |
parent | deb9e8bc74e67ec14a39dd977afbfe345d5586f6 (diff) |
tests: Fixed tests for wchar_t mode, added dummy std::cout/wcout usage for MSVC in order to create locales beforehand (avoids memory leaks during tests), minor additional test fixes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@629 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests')
-rw-r--r-- | tests/main.cpp | 8 | ||||
-rw-r--r-- | tests/test_document.cpp | 10 | ||||
-rw-r--r-- | tests/test_dom_modify.cpp | 4 |
3 files changed, 12 insertions, 10 deletions
diff --git a/tests/main.cpp b/tests/main.cpp index 03ad2f5..2af0a55 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -3,6 +3,7 @@ #include <new> #include <exception> +#include <iostream> #include <stdio.h> #include <float.h> @@ -52,7 +53,7 @@ static void replace_memory_management() pugi::set_memory_management_functions(custom_allocate, custom_deallocate); } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #define DECL_THROW(e) throw(e) #define DECL_NOTHROW() throw() #else @@ -179,6 +180,11 @@ int main() #ifdef __BORLANDC__ _control87(MCW_EM | PC_53, MCW_EM | MCW_PC); #endif + +#if defined(_MSC_VER) && !defined(__GNUC__) + std::cout.flush(); + std::wcout.flush(); +#endif replace_memory_management(); diff --git a/tests/test_document.cpp b/tests/test_document.cpp index ced06a8..34c00a5 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -75,10 +75,8 @@ TEST(document_load_stream_error) std::ifstream fs1("filedoesnotexist"); CHECK(doc.load(fs1).status == status_io_error); -#ifndef __DMC__ // Digital Mars CRT does not like 'con' pseudo-file std::ifstream fs2("con"); CHECK(doc.load(fs2).status == status_io_error); -#endif std::istringstream iss("<node/>"); test_runner::_memory_fail_threshold = 1; @@ -130,7 +128,7 @@ TEST(document_load_stream_exceptions) TEST(document_load_stream_error_previous) { pugi::xml_document doc; - CHECK(doc.load("<node/>")); + CHECK(doc.load(STR("<node/>"))); CHECK(doc.first_child()); std::ifstream fs1("filedoesnotexist"); @@ -141,7 +139,7 @@ TEST(document_load_stream_error_previous) TEST(document_load_stream_wide_error_previous) { pugi::xml_document doc; - CHECK(doc.load("<node/>")); + CHECK(doc.load(STR("<node/>"))); CHECK(doc.first_child()); std::basic_ifstream<wchar_t> fs1("filedoesnotexist"); @@ -195,10 +193,8 @@ TEST(document_load_file_error) CHECK(doc.load_file("filedoesnotexist").status == status_file_not_found); #ifdef _WIN32 -#ifndef __DMC__ // Digital Mars CRT does not like 'con' pseudo-file CHECK(doc.load_file("con").status == status_io_error); #endif -#endif test_runner::_memory_fail_threshold = 1; CHECK(doc.load_file("tests/data/small.xml").status == status_out_of_memory); @@ -207,7 +203,7 @@ TEST(document_load_file_error) TEST(document_load_file_error_previous) { pugi::xml_document doc; - CHECK(doc.load("<node/>")); + CHECK(doc.load(STR("<node/>"))); CHECK(doc.first_child()); CHECK(doc.load_file("filedoesnotexist").status == status_file_not_found); diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp index e29cbb9..46b0543 100644 --- a/tests/test_dom_modify.cpp +++ b/tests/test_dom_modify.cpp @@ -667,11 +667,11 @@ TEST(dom_node_memory_limit) for (unsigned int i = 0; i < length; ++i) string[i] = 'a'; string[length] = 0; - test_runner::_memory_fail_threshold = 32768 * 4; + test_runner::_memory_fail_threshold = 32768 * 2 + sizeof(string); xml_document doc; - for (int i = 0; i < 32; ++i) + for (int j = 0; j < 32; ++j) { CHECK(doc.append_child().set_name(string)); CHECK(doc.remove_child(doc.first_child())); |