// ============================================================ // // validate.cpp // // Copyright 2001, Dennis Meilicke // // ============================================================ // // Description // // Regression test (validation) program for the lnv3 library. // // ============================================================ // // AIX: String.h does not exist. Use mstring.h instead #ifdef _AIX #include "mstring.h" #else #include #endif #include using namespace std; #include "validate.h" #include "funcList.h" bool verbose = false; long errorCount = 0; long lineNumber = 0; // ============================================================ void ShowActivity( void ) { if( ! verbose ) { static short count = 0; if( count && ( ( count % 40 ) == 0 ) ) cout << endl; cout << "." << flush; count++; } } // ============================================================ int main( int argc, char **argv ) { if( argc > 1 ) if( strcmp( argv[1], "-v" ) == 0 ) verbose = true; TestFunctionList tfl; testFuncList_t* pList = tfl.GetList( ); testFuncList_t::iterator i; string operation; while(cin) { cin >> operation; if( !cin ) break; lineNumber++; ShowActivity( ); if( operation[0] == '#' ) cin.ignore( 100000, '\n' ); else { bool res = false; for( i=pList->begin() ; i != pList->end( ) ; ++i ) { res = (*(*i))( operation ); if( res ) break; } if( ! res ) { cerr << endl << "Unknown test type: " << operation << endl; cin.ignore( 2000, '\n' ); // skip to next op. } } } cout << endl << "Number of errors: " << errorCount << endl; return 0; }