Ignore:
Timestamp:
Mar 16, 2008, 6:47:42 AM (15 years ago)
Author:
Peter
Message:

working on #223

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/nbc_test.cc

    r1157 r1241  
    2222*/
    2323
     24#include "Suite.h"
     25
    2426#include "yat/classifier/MatrixLookup.h"
    2527#include "yat/classifier/MatrixLookupWeighted.h"
     
    3537using namespace theplu::yat;
    3638
    37 int main(const int argc,const char* argv[])
     39int main(int argc, char* argv[])
    3840
    39 
    40   std::ostream* error;
    41   if (argc>1 && argv[1]==std::string("-v"))
    42     error = &std::cerr;
    43   else {
    44     error = new std::ofstream("/dev/null");
    45     if (argc>1)
    46       *error << "nbc_test -v : for printing extra information\n";
    47   }
    48   *error << "testing ncc" << std::endl;
    49   bool ok = true;
     41  test::Suite suite(argc, argv);
     42  suite.err() << "testing ncc" << std::endl;
    5043
    5144  std::ifstream is("data/nm_data_centralized.txt");
     
    5851  is.close();
    5952
    60   *error << "Constructing NBC" << std::endl;
     53  suite.err() << "Constructing NBC" << std::endl;
    6154  classifier::NBC nbc;
    62   *error << "Training NBC" << std::endl;
     55  suite.err() << "Training NBC" << std::endl;
    6356  nbc.train(data,target);
    6457  utility::Matrix res;
    65   *error << "Predicting" << std::endl;
     58  suite.err() << "Predicting" << std::endl;
    6659  nbc.predict(data, res);
    6760
    68 
    69   if(ok)
    70     *error << "OK" << std::endl;
    71   else
    72     *error << "test failed" << std::endl;
    73 
    74   if (error!=&std::cerr)
    75     delete error;
    76 
    77   if(ok)
    78     return 0;
    79   return -1;
    80  
     61  return suite.return_value();
    8162}
Note: See TracChangeset for help on using the changeset viewer.