Changeset 290
- Timestamp:
- Apr 22, 2005, 12:19:59 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/test_nni.cc
r285 r290 21 21 int main(const int argc,const char* argv[]) 22 22 { 23 bool print=false; 24 if (argc>1 && argv[1]==std::string("-p")) 25 print=true; 23 26 27 bool ok = true; 24 28 uint neighbours=3; 25 29 std::string knni_data("data/knni_matrix.data"); … … 50 54 // hardcoded number below should be changed. 51 55 if (fabs(control(i,j))>5e-13) { 52 //std::cerr << "test_nni: kNNI FAILED, cannot reproduce test result\n"; 53 exit(-1); // calculation result out of accepted error bounds 56 if (print) 57 std::cerr << "test_nni: kNNI FAILED, cannot reproduce test result\n"; 58 ok=false; // calculation result out of accepted error bounds 54 59 } 55 60 else 56 61 if (!((control(i,j)==control(i,j)))) { 57 //std::cerr << "test_nni: kNNI FAILED, nan (not a number) encountered in test\n"; 58 exit(-1); // calucaltion error detected 62 if (print){ 63 std::cerr << "test_nni: kNNI FAILED, nan (not a number) " 64 << "encountered in test\n"; 65 } 66 ok =false; // calucaltion error detected 59 67 } 60 68 control_stream.close(); … … 76 84 // hardcoded number below should be changed. 77 85 if (fabs(control(i,j))>5e-13) { 78 //std::cerr << "test_nni: WeNNI FAILED, cannot reproduce test result\n"; 79 exit(-1); // calculation result out of accepted error bounds 86 if (print) 87 std::cerr << "test_nni: WeNNI FAILED, cannot reproduce test result\n"; 88 ok=false; // calculation result out of accepted error bounds 80 89 } 81 90 else 82 91 if (!((control(i,j)==control(i,j)))) { 83 //std::cerr << "test_nni: WeNNI FAILED, nan (not a number) encountered in test\n"; 84 exit(-1); // calucaltion error detected 92 if (print) { 93 std::cerr << "test_nni: WeNNI FAILED, nan (not a number) " 94 << "encountered in test\n"; 95 } 96 ok=false; // calucaltion error detected 85 97 } 86 87 //std::cout << "test_nni: SUCCESS, reproducing test result\n";88 exit(0); // normal exit98 if(ok) 99 return 0; 100 return -1; 89 101 }
Note: See TracChangeset
for help on using the changeset viewer.