Changeset 2592 in Sophya for trunk/SophyaProg/Tests
- Timestamp:
- Aug 9, 2004, 11:38:58 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/Tests/tcmd.cc
r2513 r2592 58 58 59 59 if (narg < 2) { 60 cout << " Usage: tcmd commander/cexptst/rpntst \n"61 << " -commander: Commader class test \n"62 << " -cexptst: CExpressionEvaluator class test \n"63 << " -rpntst: RPNExpressionEvaluator class test \n" << endl;60 cout << " Usage: tcmd S=commander/cexptst/rpntst \n" 61 << " S= commander: Commader class test \n" 62 << " S= cexptst: CExpressionEvaluator class test \n" 63 << " S= rpntst: RPNExpressionEvaluator class test \n" << endl; 64 64 return 0; 65 65 } … … 68 68 InitTim(); 69 69 int rc = 0; 70 cout << " ---- tcmd S= " << opt << " (commander/evaluator test) " << endl; 70 71 try { 71 72 if (opt == "commander") { … … 75 76 } 76 77 else if (opt == "cexptst") rc = tst_cexpreval(); 77 else rc = tst_rpneval(); 78 } 78 else if (opt == "rpntst") rc = tst_rpneval(); 79 else { 80 cout << " tcmd/error: Unknown select option: " << opt << endl; 81 rc = 9; 82 } 83 } 79 84 80 85 catch (PThrowable & exc) { … … 82 87 << " - Msg= " << exc.Msg() << endl; 83 88 } 89 catch (exception & e) { 90 cerr << " exception catched : e.what()= " << e.what() << endl; 91 } 84 92 catch (...) { 85 93 cerr << " some other exception was caught ! " << endl; … … 87 95 88 96 PrtTim(" End of tcmd "); 97 PrtTim("--Fin tcmd "); 89 98 return(rc); 90 99 } … … 135 144 try { 136 145 num++; 146 CExpressionEvaluator cex("4.e-1"); 147 cout << "CExpr=" << cex; 148 cout << " -> cex.Value() = " << cex.Value() << " =? " << ( res=4.e-1 ) << endl; 149 if (fabs(cex.Value()-res) > 1.e-9) { 150 cout << " ERREUR CALCUL " << cex << endl; 151 nerr++; 152 } 153 else nok++; 154 } 155 catch (CExprException& err) { 156 nerrparse++; 157 cout << "Exp[" << num << "] Exception: " << err.Msg() << endl; 158 } 159 cout << " [" << num << "] CExprBase::NbCreate() = " << CExprBase::NbCreate() 160 << "CExprBase::NbDelete()=" << CExprBase::NbDelete() << endl; 161 162 try { 163 num++; 137 164 CExpressionEvaluator cex("4*3+8"); 138 165 cout << "CExpr=" << cex; … … 266 293 267 294 // Expression avec erreur de syntaxe 295 cout << " >>>>> Expression avec erreur <<<<<< " << endl; 268 296 try { 269 297 num++; … … 313 341 cout << "-------- CExprBase::NbCreate() = " << CExprBase::NbCreate() << " CExprBase::NbDelete()=" << CExprBase::NbDelete() << endl; 314 342 cout << "--- NExpr= " << num << " NOk= " << nok << " NErr=" << nerr << " NErrParse=" << nerrparse << endl; 315 return 0; 343 if ( (nok == 8) && (nerr == 0) && (nerrparse == 3) ) return 0; 344 else return 99; 316 345 } 317 346
Note:
See TracChangeset
for help on using the changeset viewer.