From 178e4ccd5b4ba18ecd47e2e6c8b315b14d89e62e Mon Sep 17 00:00:00 2001 From: Lee Thomason Date: Fri, 25 Jan 2013 16:19:05 -0800 Subject: [PATCH] Add file load to xmltest. --- xmltest.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/xmltest.cpp b/xmltest.cpp index 8a13382..7de9d73 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -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 ) _CrtMemCheckpoint( &startMemState ); @@ -276,6 +276,23 @@ int main( int /*argc*/, const char ** /*argv*/ ) mkdir( "resources/out/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); #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" ); if ( !fp ) { printf( "Error opening test file 'dream.xml'.\n"