diff options
Diffstat (limited to 'shared/tinyxml/xmltest.cpp')
-rw-r--r-- | shared/tinyxml/xmltest.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/shared/tinyxml/xmltest.cpp b/shared/tinyxml/xmltest.cpp index b4d3551c..7d920466 100644 --- a/shared/tinyxml/xmltest.cpp +++ b/shared/tinyxml/xmltest.cpp @@ -69,6 +69,19 @@ bool XmlTest( const char* testString, int expected, int found, bool noEcho ) } +void NullLineEndings( char* p ) +{ + while( p && *p ) + { + if ( *p == '\n' || *p == '\r' ) + { + *p = 0; + return; + } + ++p; + } +} + // // This file demonstrates some basic functionality of TinyXml. // Note that the example is very contrived. It presumes you know @@ -590,20 +603,30 @@ int main() FILE* saved = fopen( "utf8testout.xml", "r" ); FILE* verify = fopen( "utf8testverify.xml", "r" ); + + //bool firstLineBOM=true; if ( saved && verify ) { while ( fgets( verifyBuf, 256, verify ) ) { fgets( savedBuf, 256, saved ); - if ( strcmp( verifyBuf, savedBuf ) ) + NullLineEndings( verifyBuf ); + NullLineEndings( savedBuf ); + + if ( /*!firstLineBOM && */ strcmp( verifyBuf, savedBuf ) ) { + printf( "verify:%s<\n", verifyBuf ); + printf( "saved :%s<\n", savedBuf ); okay = 0; break; } + //firstLineBOM = false; } + } + if ( saved ) fclose( saved ); + if ( verify ) fclose( verify ); - } XmlTest( "UTF-8: Verified multi-language round trip.", 1, okay ); // On most Western machines, this is an element that contains @@ -1327,6 +1350,13 @@ int main() } { + // This one must not result in an infinite loop + TiXmlDocument xml; + xml.Parse( "<infinite>loop" ); + XmlTest( "Infinite loop test.", true, true ); + } + + { // 1709904 - can not repro the crash { TiXmlDocument xml; @@ -1355,6 +1385,7 @@ int main() xml.Print(stdout); } */ + #if defined( WIN32 ) && defined( TUNE ) _CrtMemCheckpoint( &endMemState ); //_CrtMemDumpStatistics( &endMemState ); |