From 721b42da8e4efdb095aa39373c557ad40385d88a Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Wed, 31 Jul 2013 11:50:44 -0300 Subject: [PATCH] make the xmltest to return != 0, if one of the tests has failed. --- xmltest.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xmltest.cpp b/xmltest.cpp index abb2f1b..1df0c44 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -21,6 +21,7 @@ #endif using namespace tinyxml2; +int gTests = 0; int gPass = 0; int gFail = 0; @@ -47,6 +48,8 @@ bool XMLTest (const char* testString, const char* expected, const char* found, b } } + ++gTests; + if ( pass ) ++gPass; else @@ -68,6 +71,8 @@ template< class T > bool XMLTest( const char* testString, T expected, T found, b else printf (" %s [%d][%d]\n", testString, static_cast(expected), static_cast(found) ); + ++gTests; + if ( pass ) ++gPass; else @@ -1262,5 +1267,5 @@ int main( int argc, const char ** argv ) #endif printf ("\nPass %d, Fail %d\n", gPass, gFail); - return 0; + return (gTests - gPass); }