diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-28 20:08:19 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-28 20:08:19 +0000 |
commit | 9216c82cfdeba41a35314f0315a5b61b42e82c1c (patch) | |
tree | f554c2aee0c74550bd13bdbaee9ba7e53f54319f | |
parent | 0815f85d7a1814c4026e6b15e93d8cb88121fe7d (diff) |
tests: Fixed MSVC warnings/errors
git-svn-id: http://pugixml.googlecode.com/svn/trunk@185 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r-- | tests/test.hpp | 4 | ||||
-rw-r--r-- | tests/test_document.cpp | 8 | ||||
-rw-r--r-- | tests/test_dom_traverse.cpp | 4 | ||||
-rw-r--r-- | tests/test_unicode.cpp | 7 |
4 files changed, 20 insertions, 3 deletions
diff --git a/tests/test.hpp b/tests/test.hpp index d93b38d..0cd70a7 100644 --- a/tests/test.hpp +++ b/tests/test.hpp @@ -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)
diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 362b469..ff5c4d6 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -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);
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index b1f83e3..9c45dc6 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -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);
diff --git a/tests/test_unicode.cpp b/tests/test_unicode.cpp index b763355..e7adc47 100644 --- a/tests/test_unicode.cpp +++ b/tests/test_unicode.cpp @@ -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");
|