Explorar o código

clean up the pass/fail logic, still return the same value from test if it fails

Lee Thomason (grinliz) %!s(int64=12) %!d(string=hai) anos
pai
achega
db304256bb
Modificáronse 2 ficheiros con 3 adicións e 6 borrados
  1. 1 0
      tinyxml2.h
  2. 2 6
      xmltest.cpp

+ 1 - 0
tinyxml2.h

@@ -14,6 +14,7 @@ not claim that you wrote the original software. If you use this
 software in a product, an acknowledgment in the product documentation
 software in a product, an acknowledgment in the product documentation
 would be appreciated but is not required.
 would be appreciated but is not required.
 
 
+
 2. Altered source versions must be plainly marked as such, and
 2. Altered source versions must be plainly marked as such, and
 must not be misrepresented as being the original software.
 must not be misrepresented as being the original software.
 
 

+ 2 - 6
xmltest.cpp

@@ -21,7 +21,6 @@
 #endif
 #endif
 
 
 using namespace tinyxml2;
 using namespace tinyxml2;
-int gTests = 0;
 int gPass = 0;
 int gPass = 0;
 int gFail = 0;
 int gFail = 0;
 
 
@@ -48,8 +47,6 @@ bool XMLTest (const char* testString, const char* expected, const char* found, b
 		}
 		}
 	}
 	}
 
 
-    ++gTests;
-
 	if ( pass )
 	if ( pass )
 		++gPass;
 		++gPass;
 	else
 	else
@@ -71,8 +68,6 @@ template< class T > bool XMLTest( const char* testString, T expected, T found, b
 	else
 	else
 		printf (" %s [%d][%d]\n", testString, static_cast<int>(expected), static_cast<int>(found) );
 		printf (" %s [%d][%d]\n", testString, static_cast<int>(expected), static_cast<int>(found) );
 
 
-    ++gTests;
-
 	if ( pass )
 	if ( pass )
 		++gPass;
 		++gPass;
 	else
 	else
@@ -1267,5 +1262,6 @@ int main( int argc, const char ** argv )
 	#endif
 	#endif
 
 
 	printf ("\nPass %d, Fail %d\n", gPass, gFail);
 	printf ("\nPass %d, Fail %d\n", gPass, gFail);
-	return (gTests - gPass);
+
+	return gFail;
 }
 }