Add file load to xmltest.

This commit is contained in:
Lee Thomason 2013-01-25 16:19:05 -08:00
parent 980e535aae
commit 178e4ccd5b
1 changed files with 18 additions and 1 deletions

View File

@ -264,7 +264,7 @@ bool example_4()
*/ */
int main( int /*argc*/, const char ** /*argv*/ ) int main( int argc, const char ** argv )
{ {
#if defined( _MSC_VER ) && defined( DEBUG ) #if defined( _MSC_VER ) && defined( DEBUG )
_CrtMemCheckpoint( &startMemState ); _CrtMemCheckpoint( &startMemState );
@ -276,6 +276,23 @@ int main( int /*argc*/, const char ** /*argv*/ )
mkdir( "resources/out/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); mkdir( "resources/out/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
#endif #endif
if ( argc > 1 ) {
XMLDocument* doc = new XMLDocument();
clock_t startTime = clock();
doc->LoadFile( argv[1] );
clock_t loadTime = clock();
int errorID = doc->ErrorID();
delete doc; doc = 0;
clock_t deleteTime = clock();
printf( "Test file '%s' loaded. ErrorID=%d\n", argv[1], errorID );
if ( !errorID ) {
printf( "Load time=%d\n", loadTime - startTime );
printf( "Delete time=%d\n", deleteTime - loadTime );
}
exit(0);
}
FILE* fp = fopen( "resources/dream.xml", "r" ); FILE* fp = fopen( "resources/dream.xml", "r" );
if ( !fp ) { if ( !fp ) {
printf( "Error opening test file 'dream.xml'.\n" printf( "Error opening test file 'dream.xml'.\n"