tests: More fixes and toolsets support

git-svn-id: http://pugixml.googlecode.com/svn/trunk@190 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine 2009-10-28 22:22:19 +00:00
parent e2ac08d5b4
commit 0640f87859
5 changed files with 92 additions and 20 deletions

View file

@ -13,25 +13,25 @@ if ( $(toolset:I=^mingw) )
actions ObjectAction
{
%$(toolset)_PATH%\bin\gcc -W -Wall -Wextra -Werror -pedantic -c $(>) -o $(<) $(CCFLAGS)
"%$(toolset)_PATH%\bin\gcc" -W -Wall -Wextra -Werror -pedantic -c $(>) -o $(<) $(CCFLAGS)
}
actions LibraryAction
{
%$(toolset)_PATH%\bin\ar rc $(<) $(>)
"%$(toolset)_PATH%\bin\ar" rc $(<) $(>)
}
actions LinkAction
{
%$(toolset)_PATH%\bin\g++ $(>) -o $(<) $(LDFLAGS)
"%$(toolset)_PATH%\bin\g++" $(>) -o $(<) $(LDFLAGS)
}
actions CoverageAction
{
%$(toolset)_PATH%\bin\gcov $(>:\\) $(GCOVFLAGS) | perl tests/gcov-filter.pl
"%$(toolset)_PATH%\bin\gcov" $(>:\\) $(GCOVFLAGS) | perl tests/gcov-filter.pl
}
}
else if ( $(toolset:I^=msvc) )
else if ( $(toolset:I=^msvc) )
{
if ( $(configuration) = "debug" )
{
@ -53,17 +53,79 @@ else if ( $(toolset:I^=msvc) )
actions ObjectAction
{
%$(toolset)_PATH%\bin\cl.exe /EHsc /WX /I%$(toolset)_PATH%\include /c $(>) /Fo$(<) /nologo $(CCFLAGS)
"%$(toolset)_PATH%\bin\cl.exe" /EHsc /WX /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS)
}
actions LibraryAction
{
%$(toolset)_PATH%\bin\lib.exe /NOLOGO /OUT:$(<) $(>)
"%$(toolset)_PATH%\bin\lib.exe" /NOLOGO /OUT:$(<) $(>)
}
actions LinkAction
{
%$(toolset)_PATH%\bin\link.exe /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:%$(toolset)_PATH%\lib /LIBPATH:%$(toolset)_PATH%\PlatformSDK\lib $(LDFLAGS)
"%$(toolset)_PATH%\bin\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:"%$(toolset)_PATH%\lib" /LIBPATH:"%$(toolset)_PATH%\PlatformSDK\lib" $(LDFLAGS)
}
actions CoverageAction
{
}
}
else if ( $(toolset) = "ic8" )
{
msvc = "msvc7" ;
if ( $(configuration) = "debug" )
{
CCFLAGS += /D_DEBUG /MTd ;
}
else
{
CCFLAGS += /DNDEBUG /Ox /MT ;
}
actions ObjectAction
{
"%$(toolset)_PATH%\bin\icl.exe" /EHsc /W4 /WX /Wport /Qwd981,444,280,383,909,304,167 /I"%$(msvc)_PATH%\include" /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS)
}
actions LibraryAction
{
"%$(msvc)_PATH%\bin\lib.exe" /NOLOGO /OUT:$(<) $(>)
}
actions LinkAction
{
"%$(msvc)_PATH%\bin\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:"%$(toolset)_PATH%\lib" /LIBPATH:"%$(msvc)_PATH%\lib" /LIBPATH:"%$(msvc)_PATH%\PlatformSDK\lib" $(LDFLAGS)
}
actions CoverageAction
{
}
}
else if ( $(toolset:I=^dmc) )
{
if ( $(configuration) = "debug" )
{
CCFLAGS += -D_DEBUG ;
}
else
{
CCFLAGS += -DNDEBUG ;
}
actions ObjectAction
{
"%$(toolset)_PATH%\bin\dmc.exe" -c -f -wx -Ae $(>) -o$(<)
}
actions LibraryAction
{
"%$(toolset)_PATH%\bin\lib.exe" -c $(<) $(>)
}
actions LinkAction
{
"%$(toolset)_PATH%\bin\link.exe" $(>:\\) , $(<:\\) , nul , $(LDFLAGS:\\)
}
actions CoverageAction
@ -71,7 +133,7 @@ else if ( $(toolset:I^=msvc) )
}
}
actions RunAction
actions screenoutput RunAction
{
$(>:\\)
}

View file

@ -8,9 +8,9 @@
test_runner* test_runner::_tests = 0;
size_t test_runner::_memory_fail_threshold = 0;
size_t g_memory_total_size = 0;
static size_t g_memory_total_size = 0;
void* custom_allocate(size_t size)
static void* custom_allocate(size_t size)
{
if (test_runner::_memory_fail_threshold > 0 && test_runner::_memory_fail_threshold < size)
return 0;
@ -24,7 +24,7 @@ void* custom_allocate(size_t size)
}
}
void custom_deallocate(void* ptr)
static void custom_deallocate(void* ptr)
{
if (ptr)
{
@ -34,7 +34,7 @@ void custom_deallocate(void* ptr)
}
}
void replace_memory_management()
static void replace_memory_management()
{
// create some document to touch original functions
{
@ -87,7 +87,7 @@ int main()
if (failed != 0)
printf("FAILURE: %u out of %u tests failed.\n", failed, total);
else
printf("Success: %d tests passed.\n", total);
printf("Success: %u tests passed.\n", total);
return failed;
}

View file

@ -29,9 +29,11 @@ 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::ifstream fs3("nul");
CHECK(doc.load(fs3).status == status_io_error);
@ -75,7 +77,11 @@ TEST(document_load_file_error)
pugi::xml_document doc;
CHECK(doc.load_file("filedoesnotexist").status == status_file_not_found);
#ifndef __DMC__ // Digital Mars CRT does not like 'con' pseudo-file
CHECK(doc.load_file("con").status == status_io_error);
#endif
CHECK(doc.load_file("nul").status == status_io_error);
test_runner::_memory_fail_threshold = 1;

View file

@ -8,13 +8,13 @@
#pragma warning(disable: 4996)
#endif
template <typename I> I move_iter(I base, int n)
template <typename I> static I move_iter(I base, int n)
{
std::advance(base, n);
return base;
}
template <typename T> void generic_bool_ops_test(const T& obj)
template <typename T> static void generic_bool_ops_test(const T& obj)
{
T null;
@ -28,7 +28,7 @@ template <typename T> void generic_bool_ops_test(const T& obj)
CHECK(b2);
}
template <typename T> void generic_rel_ops_test(T obj1, T obj2)
template <typename T> static void generic_rel_ops_test(T obj1, T obj2)
{
T null = T();
@ -88,7 +88,7 @@ template <typename T> void generic_rel_ops_test(T obj1, T obj2)
CHECK(!(obj1 >= obj2));
}
template <typename T> void generic_empty_test(const T& obj)
template <typename T> static void generic_empty_test(const T& obj)
{
T null;

View file

@ -1,7 +1,11 @@
#include "common.hpp"
#if defined(_MSC_VER) && _MSC_VER == 1200
#define MSVC6_NAN_BUG // NaN comparison on MSVC6 is incorrect, see http://www.nabble.com/assertDoubleEquals,-NaN---Microsoft-Visual-Studio-6-td9137859.html
# define MSVC6_NAN_BUG // NaN comparison on MSVC6 is incorrect, see http://www.nabble.com/assertDoubleEquals,-NaN---Microsoft-Visual-Studio-6-td9137859.html
#endif
#if defined(__INTEL_COMPILER) && __INTEL_COMPILER == 800
# define MSVC6_NAN_BUG // IC8 seems to have the same bug as MSVC6 does
#endif
TEST_XML(xpath_operators_arithmetic, "<node><foo-bar>10</foo-bar><foo>2</foo><bar>3</bar></node>")