0
0
mirror of https://github.com/zeux/pugixml.git synced 2025-01-14 01:47:55 +08:00

tests: Fixed MSVC warnings/errors

git-svn-id: http://pugixml.googlecode.com/svn/trunk@185 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine 2009-10-28 20:08:19 +00:00
parent 0815f85d7a
commit 9216c82cfd
4 changed files with 20 additions and 3 deletions

View File

@ -118,6 +118,10 @@ struct dummy_fixture {};
{ \
CHECK(doc.load(xml, flags)); \
} \
\
private: \
test_fixture_##name(const test_fixture_##name&); \
test_fixture_##name& operator=(const test_fixture_##name&); \
}; \
\
TEST_FIXTURE(name, test_fixture_##name)

View File

@ -2,6 +2,10 @@
#include <fstream>
#ifdef _MSC_VER
#pragma warning(disable: 4996)
#endif
TEST(document_create)
{
pugi::xml_document doc;
@ -22,7 +26,7 @@ TEST(document_load_stream_error)
{
pugi::xml_document doc;
std::ifstream fs1("");
std::ifstream fs1("filedoesnotexist");
CHECK(doc.load(fs1).status == status_io_error);
std::ifstream fs2("con");
@ -70,7 +74,7 @@ TEST(document_load_file_error)
{
pugi::xml_document doc;
CHECK(doc.load_file("").status == status_file_not_found);
CHECK(doc.load_file("filedoesnotexist").status == status_file_not_found);
CHECK(doc.load_file("con").status == status_io_error);
CHECK(doc.load_file("nul").status == status_io_error);

View File

@ -4,6 +4,10 @@
#include <vector>
#include <iterator>
#ifdef _MSC_VER
#pragma warning(disable: 4996)
#endif
template <typename I> I move_iter(I base, int n)
{
std::advance(base, n);

View File

@ -2,6 +2,11 @@
// letters taken from http://www.utf8-chartable.de/
inline wchar_t wchar_cast(unsigned int value)
{
return static_cast<wchar_t>(value); // to avoid C4310 on MSVC
}
TEST(as_utf16)
{
// valid 1-byte, 2-byte and 3-byte inputs
@ -12,7 +17,7 @@ TEST(as_utf16)
// valid 4-byte input
std::wstring b4 = as_utf16("\xf2\x97\x98\xa4 \xf4\x80\x8f\xbf");
CHECK(b4.size() == 3 && b4[0] == (wchar_t)0x97624 && b4[1] == L' ' && b4[2] == (wchar_t)0x1003ff);
CHECK(b4.size() == 3 && b4[0] == wchar_cast(0x97624) && b4[1] == L' ' && b4[2] == wchar_cast(0x1003ff));
// invalid 5-byte input
std::wstring b5 = as_utf16("\xf8\nbcd");